Get rid of convoluted code for stripping filename extensions.
authorDavid Griffith <dave@661.org>
Tue, 4 Sep 2018 08:33:43 +0000 (01:33 -0700)
committerDavid Griffith <dave@661.org>
Tue, 4 Sep 2018 08:33:43 +0000 (01:33 -0700)
src/curses/ux_init.c

index 3bd03b20c09477b63db2c5d4e974becee9698aac..6c2a3a4d1c59420deb4dcd186edde951d663207f 100644 (file)
@@ -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);