#define EXT_SAVE ".qzl"
#define EXT_SCRIPT ".scr"
#define EXT_BLORB ".blb"
-#define EXT_BLORBLONG ".blorb"
+#define EXT_BLORB2 ".zblb"
+#define EXT_BLORB3 ".blorb"
+#define EXT_BLORB4 ".zblorb"
#define EXT_COMMAND ".rec"
#define EXT_AUX ".aux"
blorb_fp = fopen(filename, "rb");
} else {
len1 = strlen(filename) + strlen(EXT_BLORB);
- len2 = strlen(filename) + strlen(EXT_BLORBLONG);
+ len2 = strlen(filename) + strlen(EXT_BLORB3);
mystring = malloc(len2 * sizeof(char) + 1);
strncat(mystring, filename, len1 * sizeof(char));
if ((blorb_fp = fopen(mystring, "rb")) == NULL) {
p = rindex(mystring, '.');
*p = '\0';
- strncat(mystring, EXT_BLORBLONG, len2 * sizeof(char));
+ strncat(mystring, EXT_BLORB3, len2 * sizeof(char));
blorb_fp = fopen(mystring, "rb");
}
{
int c;
char *p = NULL;
+ char *blorb_ext = NULL;
+
char *home;
char configfile[FILENAME_MAX + 1];
f_setup.story_name = strdup(basename(argv[zoptind]));
/* Now strip off the extension. */
- p = rindex(f_setup.story_name, '.');
- *p = 0;
+ 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]));