X-Git-Url: https://git.stderr.nl/gitweb?p=projects%2Fchimara%2Fchimara.git;a=blobdiff_plain;f=interpreters%2Fglulxe%2Funixstrt.c;h=f4fa2057990fb35aa8eb5fe237d21e70ea990026;hp=38779a2d788443d4e8eb1bed9c4cfbad0ea201d5;hb=a3d8dbef8ec2442280d6085d43601bf4ba6cadf9;hpb=f6e5b2d151ac2477fff2c533936b138d741a0ab8 diff --git a/interpreters/glulxe/unixstrt.c b/interpreters/glulxe/unixstrt.c index 38779a2..f4fa205 100644 --- a/interpreters/glulxe/unixstrt.c +++ b/interpreters/glulxe/unixstrt.c @@ -3,22 +3,14 @@ http://eblong.com/zarf/glulx/index.html */ -#include #include "glk.h" #include "glulxe.h" #include "glkstart.h" /* This comes with the Glk library. */ +#include -/* The only command-line argument is the filename. And the profiling switch, - if that's compiled in. The only *two* command-line arguments are... -*/ +/* The only command-line argument is the filename. */ glkunix_argumentlist_t glkunix_arguments[] = { - -#if VM_PROFILING - { "--profile", glkunix_arg_ValueFollows, "Generate profiling information to a file." }, -#endif /* VM_PROFILING */ - { "", glkunix_arg_ValueFollows, "filename: The game file to load." }, - { NULL, glkunix_arg_End, NULL } }; @@ -26,64 +18,35 @@ int glkunix_startup_code(glkunix_startup_t *data) { /* It turns out to be more convenient if we return TRUE from here, even when an error occurs, and display an error in glk_main(). */ - int ix; - char *filename = NULL; + char *cx; unsigned char buf[12]; int res; #ifdef GARGLK - char *cx; garglk_set_program_name("Glulxe 0.4.7"); garglk_set_program_info("Glulxe 0.4.7 by Andrew Plotkin"); #endif - /* Parse out the arguments. They've already been checked for validity, - and the library-specific ones stripped out. - As usual for Unix, the zeroth argument is the executable name. */ - for (ix=1; ixargc; ix++) { - -#if VM_PROFILING - if (!strcmp(data->argv[ix], "--profile")) { - ix++; - if (ixargc) { - strid_t profstr = glkunix_stream_open_pathname_gen(data->argv[ix], TRUE, FALSE, 1); - if (!profstr) { - init_err = "Unable to open profile output file."; - init_err2 = data->argv[ix]; - return TRUE; - } - setup_profile(profstr, NULL); - } - continue; - } -#endif /* VM_PROFILING */ - - if (filename) { - init_err = "You must supply exactly one game file."; - return TRUE; - } - filename = data->argv[ix]; - } - - if (!filename) { + if (data->argc <= 1) { init_err = "You must supply the name of a game file."; #ifdef GARGLK return TRUE; /* Hack! but I want error message in glk window */ #endif return FALSE; } + cx = data->argv[1]; - gamefile = glkunix_stream_open_pathname(filename, FALSE, 1); + gamefile = glkunix_stream_open_pathname(cx, FALSE, 1); if (!gamefile) { init_err = "The game file could not be opened."; - init_err2 = filename; + init_err2 = cx; return TRUE; } #ifdef GARGLK - cx = strrchr(filename, '/'); - if (!cx) cx = strrchr(filename, '\\'); - garglk_set_story_name(cx ? cx + 1 : filename); + cx = strrchr(data->argv[1], '/'); + if (!cx) cx = strrchr(data->argv[1], '\\'); + garglk_set_story_name(cx ? cx + 1 : data->argv[1]); #endif /* Now we have to check to see if it's a Blorb file. */