From: David Griffith Date: Tue, 4 Sep 2018 08:33:43 +0000 (-0700) Subject: Get rid of convoluted code for stripping filename extensions. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=f5cd96a12c01019461a02062149d1c2b3e448677;p=liskon_frotz.git Get rid of convoluted code for stripping filename extensions. --- diff --git a/src/curses/ux_init.c b/src/curses/ux_init.c index 3bd03b2..6c2a3a4 100644 --- a/src/curses/ux_init.c +++ b/src/curses/ux_init.c @@ -330,31 +330,11 @@ void os_process_arguments (int argc, char *argv[]) f_setup.story_file = strdup(argv[zoptind]); f_setup.story_name = strdup(basename(argv[zoptind])); - /* Now strip off the extension. */ + /* Now strip off the extension */ p = strrchr(f_setup.story_name, '.'); - if ((p != NULL) && - ((strcmp(p,EXT_BLORB2) == 0) || - (strcmp(p,EXT_BLORB3) == 0) || - (strcmp(p,EXT_BLORB4) == 0) ) ) { -// blorb_ext = strdup(p); - } - else -// blorb_ext = strdup(EXT_BLORB); - - - /* Get rid of extensions with 1 to 6 character extensions. */ - /* This will take care of an extension like ".zblorb". */ - /* More than that, there might be something weird going on */ - /* which is not our concern. */ - if (p != NULL) { - if (strlen(p) >= 2 && strlen(p) <= 7) { - *p = '\0'; /* extension removed */ - } - } - - f_setup.story_path = strdup(dirname(argv[zoptind])); + *p = '\0'; /* extension removed */ - /* Create nice default file names */ + /* Create nice default file names */ f_setup.script_name = malloc((strlen(f_setup.story_name) + strlen(EXT_SCRIPT)) * sizeof(char) + 1); strncpy(f_setup.script_name, f_setup.story_name, strlen(f_setup.story_name) + 1);