+ case 'm': // Minimum balance
+ if( i + 1 >= argc ) {
+ fprintf(stderr, "%s: -m takes an argument\n", argv[0]);
+ ShowUsage();
+ return RV_ARGUMENTS;
+ }
+ giMinimumBalance = atoi(argv[++i]);
+ break;
+ case 'M': // Maximum balance
+ if( i + 1 >= argc ) {
+ fprintf(stderr, "%s: -M takes an argument\n", argv[0]);
+ ShowUsage();
+ return RV_ARGUMENTS;
+ }
+ giMaximumBalance = atoi(argv[++i]);
+ break;
+
+ case 'u': // Override User
+ if( i + 1 >= argc ) {
+ fprintf(stderr, "%s: -u takes an argument\n", argv[0]);
+ ShowUsage();
+ return RV_ARGUMENTS;
+ }
+ gsEffectiveUser = argv[++i];
+ break;
+
+ case 'H': // Override remote host
+ if( i + 1 >= argc ) {
+ fprintf(stderr, "%s: -H takes an argument\n", argv[0]);
+ ShowUsage();
+ return RV_ARGUMENTS;
+ }
+ gsDispenseServer = argv[++i];
+ break;
+ case 'P': // Override remote port
+ if( i + 1 >= argc ) {
+ fprintf(stderr, "%s: -P takes an argument\n", argv[0]);
+ ShowUsage();
+ return RV_ARGUMENTS;
+ }
+ giDispensePort = atoi(argv[++i]);
+ break;
+
+ // Set slot name/price
+ case 's':
+ if( giTextArgc != 0 ) {
+ fprintf(stderr, "%s: -s must appear before other arguments\n", argv[0]);
+ ShowUsage();
+ return RV_ARGUMENTS;
+ }
+ gsTextArgs[0] = "slot"; // HACK!!
+ giTextArgc ++;
+ break;
+
+ case 'G': // Don't use GUI
+ giUIMode = UI_MODE_BASIC;
+ break;
+ case 'D': // Drinks only
+ giUIMode = UI_MODE_DRINKSONLY;
+ break;
+ case 'n': // Dry Run / read-only
+ gbDryRun = 1;
+ break;
+ case '-':
+ if( strcmp(argv[i], "--help") == 0 ) {
+ ShowUsage();
+ return 0;
+ }
+ else if( strcmp(argv[i], "--dry-run") == 0 ) {
+ gbDryRun = 1;
+ }
+ else if( strcmp(argv[i], "--drinks-only") == 0 ) {
+ giUIMode = UI_MODE_DRINKSONLY;
+ }
+ else if( strcmp(argv[i], "--can-select-all") == 0 ) {
+ gbDisallowSelectWithoutBalance = 0;
+ }
+ else {
+ fprintf(stderr, "%s: Unknown switch '%s'\n", argv[0], argv[i]);
+ ShowUsage();
+ return RV_ARGUMENTS;
+ }
+ break;
+ default: _default:
+ // The first argument is not allowed to begin with 'i'
+ // (catches most bad flags)
+ if( giTextArgc == 0 ) {
+ fprintf(stderr, "%s: Unknown switch '%s'\n", argv[0], argv[i]);
+ ShowUsage();
+ return RV_ARGUMENTS;
+ }
+ if( giTextArgc == MAX_TXT_ARGS )
+ {
+ fprintf(stderr, "ERROR: Too many arguments\n");
+ return RV_ARGUMENTS;
+ }
+ gsTextArgs[giTextArgc++] = argv[i];
+ break;
+ }