+ gsTextArgs[0] = "";
+
+ // -- Create regular expressions
+ // > Code Type Count ...
+ CompileRegex(&gArrayRegex, "^([0-9]{3})\\s+([A-Za-z]+)\\s+([0-9]+)", REG_EXTENDED); //
+ // > Code Type Ident Status Price Desc
+ CompileRegex(&gItemRegex, "^([0-9]{3})\\s+([A-Za-z]+)\\s+([A-Za-z]+):([0-9]+)\\s+(avail|sold|error)\\s+([0-9]+)\\s+(.+)$", REG_EXTENDED);
+ // > Code 'SALT' salt
+ CompileRegex(&gSaltRegex, "^([0-9]{3})\\s+([A-Za-z]+)\\s+(.+)$", REG_EXTENDED);
+ // > Code 'User' Username Balance Flags
+ CompileRegex(&gUserInfoRegex, "^([0-9]{3})\\s+([A-Za-z]+)\\s+([^ ]+)\\s+(-?[0-9]+)\\s+(.+)$", REG_EXTENDED);
+ // > Item Ident
+ CompileRegex(&gUserItemIdentRegex, "^([A-Za-z]+):([0-9]+)$", REG_EXTENDED);
+
+ // Parse Arguments
+ ret = ParseArguments(argc, argv);
+ if( ret )
+ return ret;
+
+ // Load config file
+ // - Don't check return value, leads to defaults being used
+ if( Config_ParseFile(gsConfigFile) ) {
+ fprintf(stderr, "NOTICE: Loading of config file '%s' failed, using defaults\n", gsConfigFile);
+ }
+
+ // Parse config values
+ if( !giDispenseServerSet ) {
+ Config_GetValue_Str("dispense_server", &gsDispenseServer);
+ }
+ if (!giDispensePortSet) {
+ Config_GetValue_Int("dispense_port", &giDispensePort);
+ }
+
+
+ // Sub-commands
+ if( strcmp(gsTextArgs[0], "finger") == 0 ) {
+ return subcommand_finger();
+ }
+ else if( strcmp(gsTextArgs[0], "acct") == 0 ) {
+ return subcommand_acct();
+ }
+ else if( strcmp(gsTextArgs[0], "give") == 0 ) {
+ return subcommand_give(giTextArgc-1, gsTextArgs+1);
+ }
+ else if( strcmp(gsTextArgs[0], "user") == 0 ) {
+ return subcommand_user(giTextArgc-1, gsTextArgs+1);
+ }
+ else if( strcmp(gsTextArgs[0], "donate") == 0 ) {
+ return subcommand_donate(giTextArgc-1, gsTextArgs+1);
+ }
+ else if( strcmp(gsTextArgs[0], "refund") == 0 ) {
+ return subcommand_refund(giTextArgc-1, gsTextArgs+1);
+ }
+ else if( strcmp(gsTextArgs[0], "iteminfo") == 0 ) {
+ return subcommand_iteminfo(giTextArgc-1, gsTextArgs+1);
+ }
+ else if( strcmp(gsTextArgs[0], "slot") == 0 ) {
+ return subcommand_slot(giTextArgc-1, gsTextArgs+1);
+ }
+ else if(strcmp(gsTextArgs[0], "pincheck") == 0) {
+ return subcommand_pincheck(giTextArgc-1, gsTextArgs+1);
+ }
+ else if(strcmp(gsTextArgs[0], "pinset") == 0) {
+ return subcommand_pinset(giTextArgc-1, gsTextArgs+1);
+ }
+ else {
+ // Item name / pattern
+ gsItemPattern = gsTextArgs[0];
+ }