void os_process_arguments(int argc, char *argv[]) { int c; do_more_prompts = TRUE; /* Parse the options */ do { c = zgetopt(argc, argv, "aAh:iI:moOpPs:R:S:tu:w:xZ:"); switch(c) { case 'a': f_setup.attribute_assignment = 1; break; case 'A': f_setup.attribute_testing = 1; break; case 'h': user_screen_height = atoi(zoptarg); break; case 'i': f_setup.ignore_errors = 1; break; case 'I': f_setup.interpreter_number = atoi(zoptarg); break; case 'm': do_more_prompts = FALSE; break; case 'o': f_setup.object_movement = 1; break; case 'O': f_setup.object_locating = 1; break; case 'P': f_setup.piracy = 1; break; case 'p': plain_ascii = 1; break; case 'R': dumb_handle_setting(zoptarg, FALSE, TRUE); break; case 's': user_random_seed = atoi(zoptarg); break; case 'S': f_setup.script_cols = atoi(zoptarg); break; case 't': user_tandy_bit = 1; break; case 'u': f_setup.undo_slots = atoi(zoptarg); break; case 'w': user_screen_width = atoi(zoptarg); break; case 'x': f_setup.expand_abbreviations = 1; break; case 'Z': f_setup.err_report_mode = atoi(zoptarg); if ((f_setup.err_report_mode < ERR_REPORT_NEVER) || (f_setup.err_report_mode > ERR_REPORT_FATAL)) f_setup.err_report_mode = ERR_DEFAULT_REPORT_MODE; break; } } while (c != EOF); if (((argc - zoptind) != 1) && ((argc - zoptind) != 2)) { printf("FROTZ V%s\tdumb interface.\n", VERSION); puts(INFORMATION); printf("\t-Z # error checking mode (default = %d)\n" "\t %d = don't report errors %d = report first error\n" "\t %d = report all errors %d = exit after any error\n\n", ERR_DEFAULT_REPORT_MODE, ERR_REPORT_NEVER, ERR_REPORT_ONCE, ERR_REPORT_ALWAYS, ERR_REPORT_FATAL); printf("While running, enter \"\\help\" to list the runtime escape sequences\n\n"); exit(1); } /* if (((argc - zoptind) != 1) && ((argc - zoptind) != 2)) { puts(usage); exit(1); } */ f_setup.story_file = argv[zoptind++]; if (zoptind < argc) graphics_filename = argv[zoptind++]; f_setup.save_name = malloc(FILENAME_MAX); }
void os_process_arguments(int argc, char *argv[]) { int c; #ifdef GARGLK garglk_set_program_name("Frotz " VERSION); garglk_set_program_info( "Glk Frotz " VERSION "\n" "Original Frotz by Stefan Jokisch\n" "Unix port by Jim Dunleavy and David Griffith\n" "Glk port by Tor Andersson\n"); #endif /* Parse the options */ do { c = zgetopt(argc, argv, "aAioOPQs:S:tu:xZ:"); switch (c) { case 'a': option_attribute_assignment = 1; break; case 'A': option_attribute_testing = 1; break; case 'i': option_ignore_errors = 1; break; case 'o': option_object_movement = 1; break; case 'O': option_object_locating = 1; break; case 'P': option_piracy = 1; break; case 'Q': option_save_quetzal = 0; break; case 's': user_random_seed = atoi(zoptarg); break; case 'S': option_script_cols = atoi(zoptarg); break; case 't': user_tandy_bit = 1; break; case 'u': option_undo_slots = atoi(zoptarg); break; case 'x': option_expand_abbreviations = 1; break; case 'Z': option_err_report_mode = atoi(zoptarg); if ((option_err_report_mode < ERR_REPORT_NEVER) || (option_err_report_mode > ERR_REPORT_FATAL)) option_err_report_mode = ERR_DEFAULT_REPORT_MODE; break; } } while (c != EOF); if (((argc - zoptind) != 1) && ((argc - zoptind) != 2)) { winid_t win; char buf[256]; win = glk_window_open(0, 0, 0, wintype_TextBuffer, 0); glk_set_window(win); glk_put_string("FROTZ V" VERSION " -- Glk 0.7.0 interface.\n"); glk_put_string(INFORMATION); sprintf(buf, " -Z # error checking mode (default = %d)\n" " %d = don't report errors. " "%d = report first error.\n" " %d = report all errors. " "%d = exit after any error.\n", ERR_DEFAULT_REPORT_MODE, ERR_REPORT_NEVER, ERR_REPORT_ONCE, ERR_REPORT_ALWAYS, ERR_REPORT_FATAL); glk_put_string(buf); glk_exit(); } else { char *s; story_name = argv[zoptind++]; if (zoptind < argc) graphics_filename = argv[zoptind++]; #ifdef GARGLK s = strrchr(story_name, '\\'); if (!s) s = strrchr(story_name, '/'); garglk_set_story_name(s ? s + 1 : story_name); #endif } }
int process_arguments(int argc, char **argv) { int c; while( (c = zgetopt(argc, argv, "a:A:cCdDeE:fFgGiklLmn:N:rR:sS:tT:u:UvxXyz:Z:")) != -1 ) { switch(c) { case 'a': options.eval_stack_size = strtol(zoptarg, NULL, 10); break; case 'A': options.call_stack_size = strtol(zoptarg, NULL, 10); break; case 'c': options.disable_color = 1; break; case 'C': options.disable_config = 1; break; case 'd': options.disable_timed = 1; break; case 'D': options.disable_sound = 1; break; case 'e': options.enable_escape = 1; break; case 'E': options.escape_string = xstrdup(zoptarg); break; case 'f': options.disable_fixed = 1; break; case 'F': options.assume_fixed = 1; break; case 'g': options.disable_graphics_font = 1; break; case 'G': options.enable_alt_graphics = 1; break; case 'i': options.show_id = 1; break; case 'k': options.disable_term_keys = 1; break; case 'l': options.disable_utf8 = 1; break; case 'L': options.force_utf8 = 1; break; case 'm': options.disable_meta_commands = 1; break; case 'n': options.int_number = strtol(zoptarg, NULL, 10); break; case 'N': options.int_version = zoptarg[0]; break; case 'r': options.replay_on = 1; break; case 'R': options.replay_name = xstrdup(zoptarg); break; case 's': options.record_on = 1; break; case 'S': options.record_name = xstrdup(zoptarg); break; case 't': options.transcript_on = 1; break; case 'T': options.transcript_name = xstrdup(zoptarg); break; case 'u': options.max_saves = strtol(zoptarg, NULL, 10); break; case 'U': options.disable_undo_compression = 1; break; case 'v': options.show_version = 1; break; case 'x': options.disable_abbreviations = 1; break; case 'X': options.enable_censorship = 1; break; case 'y': options.overwrite_transcript = 1; break; case 'z': options.random_seed = strtol(zoptarg, NULL, 10); break; case 'Z': options.random_device = xstrdup(zoptarg); break; default: return 0; } } /* Just ignore excess stories for now. */ if(zoptind < argc) game_file = argv[zoptind]; return 1; }