lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LYNX-DEV lynx-386 filename problem


From: Doug Kaufman
Subject: Re: LYNX-DEV lynx-386 filename problem
Date: Sun, 21 Sep 1997 13:08:07 -0700 (PDT)

 On Fri, 19 Sep 1997, Gary Turner wrote (to me):
 
 > (b) nprint ( which is a novell network print program ) will quite 
 > happily take a mix of / and \, but will say 'file not found' if you 
 > give it more than 8 and 3 letters. I suppose that this may be for win 
 > 95 compatability or something.

I have tried to go through the code and make it more compatible with the
DOS 8+3 naming conventions.  I believe that the following changes will
stop DOS programs from breaking by keeping temporary filenames at 8+3 or
less.  I also made some changes to code that was putting 2 "." within a
filename.  I don't really follow where that was being used, but I think
it was going to break DOS.

The patch is attached.
                            Doug

__
Doug Kaufman
Internet: address@hidden (preferred)
          address@hidden
*** lynx2-7-1/src/HTFWriter.c   Sun Sep 21 10:27:04 1997
--- lynx2-7-1/src/HTFWriter.c.new       Sun Sep 21 12:44:43 1997
***************
*** 559,567 ****
             *  Save the file under a suitably suffixed name.
             */
            *cp = '\0';
!           if (!strcasecomp(pres->rep->name, "text/html")) {
                strcat(fnam, ".html");
!           } else if (!strcasecomp(pres->rep->name, "text/plain")) {
                strcat(fnam, ".txt");
            } else if (!strcasecomp(pres->rep->name,
                                    "application/octet-stream")) {
--- 559,575 ----
             *  Save the file under a suitably suffixed name.
             */
            *cp = '\0';
!           if (!strcasecomp(pres->rep->name, "text/html")) 
! #ifdef __DJGPP__
!           {
!               strcat(fnam, ".htm");
!           }
! #else
!           {
                strcat(fnam, ".html");
!           }
! #endif /* __DJGPP__  */
!           else if (!strcasecomp(pres->rep->name, "text/plain")) {
                strcat(fnam, ".txt");
            } else if (!strcasecomp(pres->rep->name,
                                    "application/octet-stream")) {
***************
*** 743,751 ****
             *  Save the file under a suitably suffixed name.
             */
            *cp = '\0';
!           if (!strcasecomp(pres->rep->name, "text/html")) {
                strcat(fnam, ".html");
!           } else if (!strcasecomp(pres->rep->name, "text/plain")) {
                strcat(fnam, ".txt");
            } else if (!strcasecomp(pres->rep->name,
                                    "application/octet-stream")) {
--- 751,767 ----
             *  Save the file under a suitably suffixed name.
             */
            *cp = '\0';
!           if (!strcasecomp(pres->rep->name, "text/html")) 
! #ifdef __DJGPP__
!           {
!               strcat(fnam, ".htm");
!           } 
! #else
!           {
                strcat(fnam, ".html");
!           } 
! #endif
!           else if (!strcasecomp(pres->rep->name, "text/plain")) {
                strcat(fnam, ".txt");
            } else if (!strcasecomp(pres->rep->name,
                                    "application/octet-stream")) {
***************
*** 990,1002 ****
--- 1006,1026 ----
  #ifdef VMS
            strcat(fnam, ".html-");
  #else
+ #ifdef __DJGPP__
+           strcat(fnam, ".h");
+ #else
            strcat(fnam, ".html.");
+ #endif /* __DJGPP__ */
  #endif /* VMS */
        } else if (!strcasecomp(anchor->content_type, "text/plain")) {
  #ifdef VMS
            strcat(fnam, ".txt-");
  #else
+ #ifdef __DJGPP__
+           strcat(fnam, ".t");
+ #else
            strcat(fnam, ".txt.");
+ #endif /* __DJGPP__ */
  #endif /* VMS */
        } else if (!strcasecomp(anchor->content_type,
                                "application/octet-stream")) {
***************
*** 1003,1009 ****
--- 1027,1037 ----
  #ifdef VMS
            strcat(fnam, ".bin-");
  #else
+ #ifdef __DJGPP__
+           strcat(fnam, ".b");
+ #else
            strcat(fnam, ".bin.");
+ #endif
  #endif /* VMS */
        } else if ((suffix =
                    HTFileSuffix(HTAtom_for(anchor->content_type))) &&
*** lynx2-7-1/src/HTInit.c      Sun Sep 21 10:27:33 1997
--- lynx2-7-1/src/HTInit.c.new  Sun Sep 21 12:46:15 1997
***************
*** 646,651 ****
--- 646,901 ----
  */
  
  PUBLIC void HTFileInit NOARGS
+ #ifdef __DJGPP__
+ {
+     FILE *fp;
+     extern char *global_extension_map;
+     extern char *personal_extension_map;
+ 
+     if (TRACE)
+         fprintf (stderr, "@@@ Using default extension map\n");
+ 
+     /* default suffix interpretation */
+     HTSetSuffix("*",          "text/plain", "7bit", 1.0);
+     HTSetSuffix("*.*",                "text/plain", "7bit", 1.0);
+ 
+ #ifdef EXEC_SCRIPTS
+     /*
+      *  define these extentions for exec scripts.
+      */
+ #ifndef VMS
+     /* for csh exec links */
+     HTSetSuffix(".csh",               "application/x-csh", "8bit", 0.8);
+     HTSetSuffix(".sh",                "application/x-sh", "8bit", 0.8);
+     HTSetSuffix(".ksh",               "application/x-ksh", "8bit", 0.8);
+ #else
+     HTSetSuffix(".com",               "application/x-VMS_script", "8bit", 
0.8);
+ #endif /* !VMS */
+ #endif /* EXEC_SCRIPTS */
+ 
+ 
+     HTSetSuffix(".saveme",    "application/x-Binary", "binary", 1.0);
+     HTSetSuffix(".dump",      "application/x-Binary", "binary", 1.0);
+     HTSetSuffix(".bin",               "application/x-Binary", "binary", 1.0);
+ 
+     HTSetSuffix(".arc",               "application/x-Compressed", "binary", 
1.0);
+ 
+     HTSetSuffix(".alpha-exe", "application/x-Executable", "binary", 1.0);
+     HTSetSuffix(".alpha_exe", "application/x-Executable", "binary", 1.0);
+     HTSetSuffix(".AXP-exe",   "application/x-Executable", "binary", 1.0);
+     HTSetSuffix(".AXP_exe",   "application/x-Executable", "binary", 1.0);
+     HTSetSuffix(".VAX-exe",   "application/x-Executable", "binary", 1.0);
+     HTSetSuffix(".VAX_exe",   "application/x-Executable", "binary", 1.0);
+     HTSetSuffix(".exe",               "application/x-Executable", "binary", 
1.0);
+ 
+     HTSetSuffix(".exe.Z",     "application/x-Comp. Executable",
+                                                            "binary", 1.0);
+     HTSetSuffix(".exZ",               "application/x-Comp. Executable",
+                                                            "binary", 1.0);
+   
+     HTSetSuffix(".Z",         "application/UNIX Compressed", "binary", 1.0);
+ 
+     HTSetSuffix(".tar_Z",     "application/UNIX Compr. Tar", "binary", 1.0);
+     HTSetSuffix(".tar.Z",     "application/UNIX Compr. Tar", "binary", 1.0);
+     HTSetSuffix(".taZ",               "application/UNIX Compr. Tar", 
"binary", 1.0);
+ 
+     HTSetSuffix("-gz",                "application/GNU Compressed", "binary", 
1.0);
+     HTSetSuffix("_gz",                "application/GNU Compressed", "binary", 
1.0);
+     HTSetSuffix(".gz",                "application/GNU Compressed", "binary", 
1.0);
+ 
+     HTSetSuffix(".tar.gz",    "application/GNU Compr. Tar", "binary", 1.0);
+     HTSetSuffix(".tgz",               "application/GNU Compr. Tar", "binary", 
1.0);
+ 
+     HTSetSuffix(".wsrc",      "application/x-WAIS-source", "8bit", 1.0);
+     HTSetSuffix(".src",               "application/x-WAIS-source", "8bit", 
1.0);
+ 
+     HTSetSuffix(".zip",               "application/x-Zip File", "binary", 
1.0);
+ 
+     HTSetSuffix(".uu",                "application/x-UUencoded", "8bit", 
1.0); 
+ 
+     HTSetSuffix(".hqx",               "application/x-Binhex", "8bit", 1.0);
+ 
+     HTSetSuffix(".o",         "application/x-Prog. Object", "binary", 1.0);
+     HTSetSuffix(".a",         "application/x-Prog. Library", "binary", 1.0);
+ 
+     HTSetSuffix(".oda",               "application/ODA", "binary", 1.0);
+ 
+     HTSetSuffix(".pdf",               "application/PDF", "binary", 1.0);
+ 
+     HTSetSuffix(".eps",               "application/Postscript", "8bit", 1.0);
+     HTSetSuffix(".ai",                "application/Postscript", "8bit", 1.0);
+     HTSetSuffix(".ps",                "application/Postscript", "8bit", 1.0);
+   
+     HTSetSuffix(".rtf",               "application/RTF", "8bit", 1.0);
+ 
+     HTSetSuffix(".dvi",               "application/x-DVI", "8bit", 1.0);
+ 
+     HTSetSuffix(".hdf",               "application/x-HDF", "8bit", 1.0);
+   
+     HTSetSuffix(".cdf",               "application/x-netcdf", "8bit", 1.0);
+     HTSetSuffix(".nc",                "application/x-netcdf", "8bit", 1.0);
+ 
+     HTSetSuffix(".latex",     "application/x-Latex", "8bit", 1.0);
+     HTSetSuffix(".lat",               "application/x-Latex", "8bit", 1.0);
+     HTSetSuffix(".tex",       "application/x-Tex", "8bit", 1.0);
+     HTSetSuffix(".texinfo",   "application/x-Texinfo", "8bit", 1.0);
+     HTSetSuffix(".texi",      "application/x-Texinfo", "8bit", 1.0);
+     HTSetSuffix(".txi",               "application/x-Texinfo", "8bit", 1.0);
+ 
+     HTSetSuffix(".t",         "application/x-Troff", "8bit", 1.0);
+     HTSetSuffix(".tr",                "application/x-Troff", "8bit", 1.0);
+     HTSetSuffix(".roff",      "application/x-Troff", "8bit", 1.0);
+     HTSetSuffix(".rof",               "application/x-Troff", "8bit", 1.0);
+ 
+     HTSetSuffix(".man",               "application/x-Troff-man", "8bit", 1.0);
+     HTSetSuffix(".me",                "application/x-Troff-me", "8bit", 1.0);
+     HTSetSuffix(".ms",                "application/x-Troff-ms", "8bit", 1.0);
+ 
+     HTSetSuffix(".zoo",               "application/x-Zoo File", "binary", 
1.0);
+ 
+     HTSetSuffix(".bak",               "application/x-VMS BAK File", "binary", 
1.0);
+     HTSetSuffix(".bkp",               "application/x-VMS BAK File", "binary", 
1.0);
+     HTSetSuffix(".bck",               "application/x-VMS BAK File", "binary", 
1.0);
+ 
+     HTSetSuffix(".bkp_gz",    "application/x-GNU BAK File", "binary", 1.0);
+     HTSetSuffix(".bkp-gz",    "application/x-GNU BAK File", "binary", 1.0);
+     HTSetSuffix(".bck_gz",    "application/x-GNU BAK File", "binary", 1.0);
+     HTSetSuffix(".bck-gz",    "application/x-GNU BAK File", "binary", 1.0);
+     HTSetSuffix(".bgz",               "application/x-GNU BAK File", "binary", 
1.0);
+ 
+     HTSetSuffix(".bkp-Z",     "application/x-Comp. BAK File", "binary", 1.0);
+     HTSetSuffix(".bkp_Z",     "application/x-Comp. BAK File", "binary", 1.0);
+     HTSetSuffix(".bck-Z",     "application/x-Comp. BAK File", "binary", 1.0);
+     HTSetSuffix(".bck_Z",     "application/x-Comp. BAK File", "binary", 1.0);
+     HTSetSuffix(".bcZ",               "application/x-Comp. BAK File", 
"binary", 1.0);
+ 
+     HTSetSuffix(".hlb",               "application/x-VMS Help Libr.", 
"binary", 1.0);
+     HTSetSuffix(".olb",               "application/x-VMS Obj. Libr.", 
"binary", 1.0);
+     HTSetSuffix(".tlb",               "application/x-VMS Text Libr.", 
"binary", 1.0);
+     HTSetSuffix(".obj",               "application/x-VMS Prog. Obj.", 
"binary", 1.0);
+     HTSetSuffix(".decw$book", "application/x-DEC BookReader", "binary", 1.0);
+     HTSetSuffix(".dec",               "application/x-DEC BookReader", 
"binary", 1.0);
+     HTSetSuffix(".mem",               "application/x-RUNOFF-MANUAL", "8bit", 
1.0);
+ 
+     HTSetSuffix(".vsd",               "application/visio", "binary", 1.0);
+ 
+     HTSetSuffix(".lha",               "application/x-lha File", "binary", 
1.0);
+     HTSetSuffix(".lzh",               "application/x-lzh File", "binary", 
1.0);
+ 
+     HTSetSuffix(".sea",               "application/x-sea File", "binary", 
1.0);
+     HTSetSuffix(".sit",               "application/x-sit File", "binary", 
1.0);
+ 
+     HTSetSuffix(".dms",               "application/x-dms File", "binary", 
1.0);
+ 
+     HTSetSuffix(".iff",               "application/x-iff File", "binary", 
1.0);
+ 
+     HTSetSuffix(".bcpio",     "application/x-bcpio", "binary", 1.0);
+     HTSetSuffix(".bcp",               "application/x-bcpio", "binary", 1.0);
+     HTSetSuffix(".cpio",      "application/x-cpio", "binary", 1.0);
+     HTSetSuffix(".cpi",               "application/x-cpio", "binary", 1.0);
+     HTSetSuffix(".gtar",      "application/x-gtar", "binary", 1.0);
+     HTSetSuffix(".gta",               "application/x-gtar", "binary", 1.0);
+ 
+     HTSetSuffix(".shar",      "application/x-shar", "8bit", 1.0);
+     HTSetSuffix(".sha",               "application/x-shar", "8bit", 1.0);
+     HTSetSuffix(".share",     "application/x-share", "8bit", 1.0);
+     HTSetSuffix(".shr",               "application/x-share", "8bit", 1.0);
+ 
+     HTSetSuffix(".sh",                "application/x-sh", "8bit", 1.0); /* 
xtra */
+ 
+     HTSetSuffix(".sv4cpio",   "application/x-sv4cpio", "binary", 1.0);
+     HTSetSuffix(".cpi",               "application/x-sv4cpio", "binary", 1.0);
+     HTSetSuffix(".sv4crc",    "application/x-sv4crc", "binary", 1.0);
+     HTSetSuffix(".crc",               "application/x-sv4crc", "binary", 1.0);
+ 
+     HTSetSuffix(".tar",               "application/x-Tar File", "binary", 
1.0);
+     HTSetSuffix(".ustar",     "application/x-ustar", "binary", 1.0);
+     HTSetSuffix(".ust",               "application/x-ustar", "binary", 1.0);
+ 
+     HTSetSuffix(".snd",               "audio/basic", "binary", 1.0);
+     HTSetSuffix(".au",                "audio/basic", "binary", 1.0);
+ 
+     HTSetSuffix(".aifc",      "audio/x-aiff", "binary", 1.0);
+     HTSetSuffix(".aiff",      "audio/x-aiff", "binary", 1.0);
+     HTSetSuffix(".aif",               "audio/x-aiff", "binary", 1.0);
+     HTSetSuffix(".wav",               "audio/x-wav", "binary", 1.0);
+     HTSetSuffix(".midi",      "audio/midi", "binary", 1.0);
+     HTSetSuffix(".mid",               "audio/midi", "binary", 1.0);
+     HTSetSuffix(".mod",               "audio/mod", "binary", 1.0);
+   
+     HTSetSuffix(".gif",               "image/gif", "binary", 1.0);
+     HTSetSuffix(".ief",               "image/ief", "binary", 1.0);
+     HTSetSuffix(".jfif",      "image/jpeg", "binary", 1.0); /* xtra */
+     HTSetSuffix(".jfif-tbnl", "image/jpeg", "binary", 1.0); /* xtra */
+     HTSetSuffix(".jpe",               "image/jpeg", "binary", 1.0);
+     HTSetSuffix(".jpeg",      "image/jpeg", "binary", 1.0);
+     HTSetSuffix(".jpg",               "image/jpeg", "binary", 1.0);
+     HTSetSuffix(".tiff",      "image/tiff", "binary", 1.0);
+     HTSetSuffix(".tif",               "image/tiff", "binary", 1.0);
+     HTSetSuffix(".ham",               "image/ham", "binary", 1.0);
+     HTSetSuffix(".ras",               "image/x-cmu-rast", "binary", 1.0);
+     HTSetSuffix(".pnm",               "image/x-portable-anymap", "binary", 
1.0);
+     HTSetSuffix(".pbm",               "image/x-portable-bitmap", "binary", 
1.0);
+     HTSetSuffix(".pgm",               "image/x-portable-graymap", "binary", 
1.0);
+     HTSetSuffix(".ppm",               "image/x-portable-pixmap", "binary", 
1.0);
+     HTSetSuffix(".png",               "image/png", "binary", 1.0);
+     HTSetSuffix(".rgb",               "image/x-rgb", "binary", 1.0);
+     HTSetSuffix(".xbm",               "image/x-xbitmap", "binary", 1.0);
+     HTSetSuffix(".xpm",               "image/x-xpixmap", "binary", 1.0);
+     HTSetSuffix(".xwd",               "image/x-xwindowdump", "binary", 1.0);
+ 
+     HTSetSuffix(".rtx",               "text/richtext", "8bit", 1.0);
+     HTSetSuffix(".tsv",               "text/tab-separated-values", "8bit", 
1.0);
+     HTSetSuffix(".etx",               "text/x-setext", "8bit", 1.0);
+ 
+     HTSetSuffix(".mpe",               "video/mpeg", "binary", 1.0);
+     HTSetSuffix(".mpeg",      "video/mpeg", "binary", 1.0);
+     HTSetSuffix(".mpg",               "video/mpeg", "binary", 1.0);
+     HTSetSuffix(".mov",               "video/quicktime", "binary", 1.0);
+     HTSetSuffix(".qt",                "video/quicktime", "binary", 1.0);
+     HTSetSuffix(".avi",               "video/x-msvideo", "binary", 1.0);
+     HTSetSuffix(".movie",     "video/x-sgi-movie", "binary", 1.0);
+     HTSetSuffix(".mv",                "video/x-sgi-movie", "binary", 1.0);
+ 
+     HTSetSuffix(".mime",      "message/rfc822", "8bit", 1.0);
+     HTSetSuffix(".mim",               "message/rfc822", "8bit", 1.0);
+ 
+     HTSetSuffix(".c",         "text/plain", "8bit", 1.0);
+     HTSetSuffix(".cc",                "text/plain", "8bit", 1.0);
+     HTSetSuffix(".c++",               "text/plain", "8bit", 1.0);
+     HTSetSuffix(".h",         "text/plain", "8bit", 1.0);
+     HTSetSuffix(".pl",                "text/plain", "8bit", 1.0);
+     HTSetSuffix(".text",      "text/plain", "8bit", 1.0);
+     HTSetSuffix(".txt",               "text/plain", "8bit", 1.0);
+ 
+     HTSetSuffix(".html3",     "text/html", "8bit", 1.0);
+     HTSetSuffix(".ht3",               "text/html", "8bit", 1.0);
+     HTSetSuffix(".phtml",     "text/html", "8bit", 1.0);
+     HTSetSuffix(".shtml",     "text/html", "8bit", 1.0);
+     HTSetSuffix(".htmlx",     "text/html", "8bit", 1.0);
+     HTSetSuffix(".html",      "text/html", "8bit", 1.0);
+     HTSetSuffix(".htm",               "text/html", "8bit", 1.0);
+ 
+     /* These should override the default extensions as necessary. */
+     HTLoadExtensionsConfigFile(global_extension_map);
+ 
+     if ((fp = fopen(personal_extension_map,"r")) != NULL) {
+         fclose(fp);
+         /* These should override everything else. */
+         HTLoadExtensionsConfigFile(personal_extension_map);
+     } else {
+         char buffer[256];
+ #ifdef VMS
+         sprintf(buffer, "sys$login:%s", personal_extension_map);
+ #else
+         sprintf(buffer, "%s/%s", (Home_Dir() ? Home_Dir() : ""),
+                                 personal_extension_map);
+ #endif /* VMS */
+         /* These should override everything else. */
+         HTLoadExtensionsConfigFile(buffer);
+     }
+ }
+ #else
  {
      FILE *fp;
      extern char *global_extension_map;
***************
*** 876,881 ****
--- 1126,1132 ----
          HTLoadExtensionsConfigFile(buffer);
      }
  }
+ #endif /* __DJGPP__ */
  
  
  /* -------------------- Extension config file reading --------------------- */
*** lynx2-7-1/src/LYPrint.c     Sun Sep 21 10:28:04 1997
--- lynx2-7-1/src/LYPrint.c.new Sun Sep 21 12:47:32 1997
***************
*** 528,541 ****
                if (HTisDocumentSource()) {
                    if ((len = strlen(tempfile)) > 3) {
                        len -= 4;
!                       if (!strcasecomp((tempfile + len), ".txt")) {
                            tempfile[len] = '\0';
                            strcat(tempfile, ".html");
                        }
                    }
                } else if ((len = strlen(tempfile)) > 4) {
                    len -= 5;
!                   if (!strcasecomp((tempfile + len), ".html")) {
                        tempfile[len] = '\0';
                        strcat(tempfile, ".txt");
                    }
--- 528,549 ----
                if (HTisDocumentSource()) {
                    if ((len = strlen(tempfile)) > 3) {
                        len -= 4;
!                       if (!strcasecomp((tempfile + len), ".txt")) 
! #ifdef __DJGPP__
!                       {
!                           tempfile[len] = '\0';
!                           strcat(tempfile, ".htm");
!                       }
! #else
!                       {
                            tempfile[len] = '\0';
                            strcat(tempfile, ".html");
                        }
+ #endif /* __DJGPP__
                    }
                } else if ((len = strlen(tempfile)) > 4) {
                    len -= 5;
!                   if (!strcasecomp((tempfile + len), ".html") && 
!strcasecomp((tempfile + len), ".htm")) {
                        tempfile[len] = '\0';
                        strcat(tempfile, ".txt");
                    }
***************
*** 817,826 ****
  #endif /* VMS */
                    NULL == strchr(cp, '/')) {
                    if (HTisDocumentSource() &&
!                       strcasecomp(cp, ".html")) {
                        *cp = '\0';
                        strcat(tempfile, ".html");
!                   } else if (!HTisDocumentSource() &&
                               strcasecomp(cp, ".txt")) {
                        *cp = '\0';
                        strcat(tempfile, ".txt");
--- 825,843 ----
  #endif /* VMS */
                    NULL == strchr(cp, '/')) {
                    if (HTisDocumentSource() &&
!                       (strcasecomp(cp, ".html") || strcasecomp(cp, ".htm"))) 
! #ifdef __DJGPP__
!                   {
!                       *cp = '\0';
!                       strcat(tempfile, ".htm");
!                   } 
! #else
!                   {
                        *cp = '\0';
                        strcat(tempfile, ".html");
!                   } 
! #endif
!                   else if (!HTisDocumentSource() &&
                               strcasecomp(cp, ".txt")) {
                        *cp = '\0';
                        strcat(tempfile, ".txt");

reply via email to

[Prev in Thread] Current Thread [Next in Thread]