home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / www / library / implemen / htinit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  9.7 KB  |  173 lines

  1. /*        Configuration-specific Initialialization    HTInit.c
  2. **        ----------------------------------------
  3. */
  4.  
  5. /*    Define a basic set of suffixes and presentations
  6. **    ------------------------------------------------
  7. **
  8. */
  9.  
  10. /* Implements:
  11. */
  12. #include"capalloc.h"
  13. #include"capstdio.h"
  14. #include "HTInit.h"
  15.  
  16. #include "HTML.h"
  17. #include "HTPlain.h"
  18. #include "HTMLGen.h"
  19. #include "HTFile.h"
  20. #include "HTFormat.h"
  21. #include "HTMIME.h"
  22. #include "HTWSRC.h"
  23. #include "HTFWriter.h"
  24.  
  25. PUBLIC void HTFormatInit NOARGS
  26. {
  27. #ifndef MSDOS
  28. #ifdef NeXT
  29.     HTSetPresentation("application/postscript", "open %s",    1.0, 2.0, 0.0);
  30.     /* The following needs the GIF previewer -- you might not have it. */
  31.     HTSetPresentation("image/gif",         "open %s",     0.3, 2.0, 0.0);
  32.     HTSetPresentation("image/x-tiff",         "open %s",     1.0, 2.0, 0.0);
  33.     HTSetPresentation("audio/basic",         "open %s",     1.0, 2.0, 0.0);
  34.     HTSetPresentation("*",             "open %s",     1.0, 0.0, 0.0);
  35. #else
  36.     if (getenv("DISPLAY")) {    /* Must have X11 */
  37.     HTSetPresentation("application/postscript", "ghostview %s",    1.0, 3.0, 0.0);
  38.     HTSetPresentation("image/gif",         "xv %s",    1.0, 3.0, 0.0);
  39.     HTSetPresentation("image/x-tiff",     "xv %s",    1.0, 3.0, 0.0);
  40.     HTSetPresentation("image/jpeg",     "xv %s",    1.0, 3.0, 0.0);
  41.     }
  42. #endif
  43. #endif /* MSDOS */
  44.     HTSetConversion("www/mime",            "*",        HTMIMEConvert,    1.0, 0.0, 0.0);
  45.     HTSetConversion("application/x-wais-source","*",        HTWSRCConvert,     1.0, 0.0, 0.0);
  46.     HTSetConversion("text/html",        "text/x-c",    HTMLToC,    0.5, 0.0, 0.0);
  47.     HTSetConversion("text/html",        "text/plain",    HTMLToPlain,    0.5, 0.0, 0.0);
  48.     HTSetConversion("text/html",        "www/present",    HTMLPresent,    1.0, 0.0, 0.0);
  49.     HTSetConversion("text/plain",        "text/html",    HTPlainToHTML,    1.0, 0.0, 0.0);
  50.     HTSetConversion("text/plain",        "www/present",    HTPlainPresent,    1.0, 0.0, 0.0);
  51.     HTSetConversion("application/octet-stream",    "www/present",    HTSaveLocally,    0.1, 0.0, 0.0);
  52.     HTSetConversion("image/gif",        "www/present",    HTHandleImage,    0.3, 0.0, 0.0);
  53.     HTSetConversion("www/unknown",        "www/present",    HTSaveLocally,    0.3, 0.0, 0.0);
  54.     HTSetConversion("www/source",        "www/present",    HTSaveLocally,    0.3, 0.0, 0.0);
  55. }
  56.  
  57.  
  58.  
  59. /*    Define a basic set of suffixes
  60. **    ------------------------------
  61. **
  62. **    The LAST suffix for a type is that used for temporary files
  63. **    of that type.
  64. **    The quality is an apriori bias as to whether the file should be
  65. **    used.  Not that different suffixes can be used to represent files
  66. **    which are of the same format but are originals or regenerated,
  67. **    with different values.
  68. */
  69.  
  70. #ifndef NO_INIT
  71. PUBLIC void HTFileInit NOARGS
  72. {
  73.     /*        Suffix     Contenet-Type    Content-Encoding  Quality            */
  74.  
  75.     HTSetSuffix(".mime",   "www/mime",            "8bit",   1.0);    /* Internal -- MIME is    */
  76.                                     /* not recursive    */
  77.     HTSetSuffix(".bin",    "application/octet-stream",    "binary", 1.0); /* Uninterpreted binary    */
  78.     HTSetSuffix(".oda",    "application/oda",        "binary", 1.0);
  79.     HTSetSuffix(".pdf",    "application/pdf",        "binary", 1.0);
  80.     HTSetSuffix(".ai",     "application/postscript",    "8bit",   0.5);    /* Adobe Illustrator    */
  81.     HTSetSuffix(".PS",     "application/postscript",    "8bit",      0.8);    /* PostScript        */
  82.     HTSetSuffix(".eps",    "application/postscript",    "8bit",   0.8);
  83.     HTSetSuffix(".ps",     "application/postscript",    "8bit",   0.8);
  84.     HTSetSuffix(".rtf",    "application/x-rtf",        "7bit",   1.0);    /* RTF            */
  85.     HTSetSuffix(".Z",      "application/x-compressed",    "binary", 1.0);    /* Compressed data    */
  86.     HTSetSuffix(".csh",    "application/x-csh",        "7bit",   0.5);    /* C-shell script    */
  87.     HTSetSuffix(".dvi",    "application/x-dvi",        "binary", 1.0);    /* TeX DVI        */
  88.     HTSetSuffix(".hdf",    "application/x-hdf",        "binary", 1.0);    /* NCSA HDF data file    */
  89.     HTSetSuffix(".latex",  "application/x-latex",    "8bit",   1.0);    /* LaTeX source        */
  90.     HTSetSuffix(".nc",     "application/x-netcdf",    "binary", 1.0);    /* Unidata netCDF data    */
  91.     HTSetSuffix(".cdf",    "application/x-netcdf",    "binary", 1.0);
  92.     HTSetSuffix(".sh",     "application/x-sh",        "7bit",   0.5);    /* Shell-script        */
  93.     HTSetSuffix(".tcl",    "application/x-tcl",        "7bit",   0.5);    /* TCL-script        */
  94.     HTSetSuffix(".tex",    "application/x-tex",        "8bit",   1.0);    /* TeX source        */
  95.     HTSetSuffix(".texi",   "application/x-texinfo",    "7bit",   1.0);    /* Texinfo        */
  96.     HTSetSuffix(".texinfo","application/x-texinfo",    "7bit",   1.0);
  97.     HTSetSuffix(".t",      "application/x-troff",    "7bit",   0.5);    /* Troff        */
  98.     HTSetSuffix(".roff",   "application/x-troff",    "7bit",   0.5);
  99.     HTSetSuffix(".tr",     "application/x-troff",    "7bit",   0.5);
  100.     HTSetSuffix(".man",    "application/x-troff-man",    "7bit",   0.5);    /* Troff with man macros*/
  101.     HTSetSuffix(".me",     "application/x-troff-me",    "7bit",   0.5);    /* Troff with me macros    */
  102.     HTSetSuffix(".ms",     "application/x-troff-ms",    "7bit",   0.5);    /* Troff with ms macros    */
  103.     HTSetSuffix(".src",    "application/x-wais-source",    "7bit",   1.0);    /* WAIS source        */
  104.     HTSetSuffix(".zip",    "application/zip",        "binary", 1.0);    /* PKZIP        */
  105.     HTSetSuffix(".bcpio",  "application/x-bcpio",    "binary", 1.0);    /* Old binary CPIO    */
  106.     HTSetSuffix(".cpio",   "application/x-cpio",    "binary", 1.0);    /* POSIX CPIO        */
  107.     HTSetSuffix(".gtar",   "application/x-gtar",    "binary", 1.0);    /* Gnu tar        */
  108.     HTSetSuffix(".shar",   "application/x-shar",    "8bit",   1.0);    /* Shell archive    */
  109.     HTSetSuffix(".sv4cpio","application/x-sv4cpio",    "binary", 1.0);    /* SVR4 CPIO        */
  110.     HTSetSuffix(".sv4crc", "application/x-sv4crc",    "binary", 1.0);    /* SVR4 CPIO with CRC    */
  111.     HTSetSuffix(".tar",    "application/x-tar",        "binary", 1.0);    /* 4.3BSD tar        */
  112.     HTSetSuffix(".ustar",  "application/x-ustar",    "binary", 1.0);    /* POSIX tar        */
  113.     HTSetSuffix(".snd",    "audio/basic",        "binary", 1.0);    /* Audio        */
  114.     HTSetSuffix(".au",     "audio/basic",        "binary", 1.0);
  115.     HTSetSuffix(".aiff",   "audio/x-aiff",        "binary", 1.0);
  116.     HTSetSuffix(".aifc",   "audio/x-aiff",        "binary", 1.0);
  117.     HTSetSuffix(".aif",    "audio/x-aiff",        "binary", 1.0);
  118.     HTSetSuffix(".wav",    "audio/x-wav",        "binary", 1.0);    /* Windows+ WAVE format    */
  119.     HTSetSuffix(".gif",    "image/gif",            "binary", 1.0);    /* GIF            */
  120.     HTSetSuffix(".ief",    "image/ief",            "binary", 1.0);    /* Image Exchange fmt    */
  121.     HTSetSuffix(".jpg",    "image/jpeg",        "binary", 1.0);    /* JPEG            */
  122.     HTSetSuffix(".JPG",    "image/jpeg",        "binary", 1.0);
  123.     HTSetSuffix(".JPE",    "image/jpeg",        "binary", 1.0);
  124.     HTSetSuffix(".jpe",    "image/jpeg",        "binary", 1.0);
  125.     HTSetSuffix(".JPEG",   "image/jpeg",        "binary", 1.0);
  126.     HTSetSuffix(".jpeg",   "image/jpeg",        "binary", 1.0);
  127.     HTSetSuffix(".tif",    "image/tiff",        "binary", 1.0);    /* TIFF            */
  128.     HTSetSuffix(".tiff",   "image/tiff",        "binary", 1.0);
  129.     HTSetSuffix(".ras",    "image/cmu-raster",        "binary", 1.0);
  130.     HTSetSuffix(".pnm",    "image/x-portable-anymap",    "binary", 1.0);    /* PBM Anymap format    */
  131.     HTSetSuffix(".pbm",    "image/x-portable-bitmap",    "binary", 1.0);    /* PBM Bitmap format    */
  132.     HTSetSuffix(".pgm",    "image/x-portable-graymap",    "binary", 1.0);    /* PBM Graymap format    */
  133.     HTSetSuffix(".ppm",    "image/x-portable-pixmap",    "binary", 1.0);    /* PBM Pixmap format    */
  134.     HTSetSuffix(".rgb",    "image/x-rgb",        "binary", 1.0);
  135.     HTSetSuffix(".xbm",    "image/x-xbitmap",        "binary", 1.0);    /* X bitmap        */
  136.     HTSetSuffix(".xpm",    "image/x-xpixmap",        "binary", 1.0);    /* X pixmap format    */
  137.     HTSetSuffix(".xwd",    "image/x-xwindowdump",    "binary", 1.0);    /* X window dump (xwd)    */
  138.     HTSetSuffix(".html",   "text/html",            "8bit",   1.0);    /* HTML            */
  139.     HTSetSuffix(".htm",    "text/html",            "8bit",   1.0);    /* HTML            */
  140.     HTSetSuffix(".HTM",    "text/html",            "8bit",   1.0);    /* HTML            */
  141.     HTSetSuffix(".c",      "text/plain",        "7bit",   0.5);    /* C source        */
  142.     HTSetSuffix(".h",      "text/plain",        "7bit",   0.5);    /* C headers        */
  143.     HTSetSuffix(".C",      "text/plain",        "7bit",   0.5);    /* C++ source        */
  144.     HTSetSuffix(".cc",     "text/plain",        "7bit",   0.5);    /* C++ source        */
  145.     HTSetSuffix(".hh",     "text/plain",        "7bit",   0.5);    /* C++ headers        */
  146.     HTSetSuffix(".m",      "text/plain",        "7bit",   0.5);    /* Objective-C source    */
  147.     HTSetSuffix(".f90",    "text/plain",        "7bit",   0.5);    /* Fortran 90 source    */
  148.     HTSetSuffix(".txt",    "text/plain",        "7bit",   0.5);    /* Plain text        */
  149.     HTSetSuffix(".ini",       "text/plain",        "7bit",   0.5); /* Configuration files. */
  150.     HTSetSuffix(".rc",       "text/plain",        "7bit",   0.5); /* Configuration files. */
  151.     HTSetSuffix(".cfg",       "text/plain",        "7bit",   0.5); /* Configuration files. */
  152.     HTSetSuffix(".CFG",       "text/plain",        "7bit",   0.5); /* Configuration files. */
  153.     HTSetSuffix(".rtx",    "text/richtext",        "7bit",   1.0);    /* MIME Richtext format    */
  154.     HTSetSuffix(".tsv",    "text/tab-separated-values",    "7bit",   1.0);    /* Tab-separated values    */
  155.     HTSetSuffix(".etx",    "text/x-setext",        "7bit",   0.9);    /* Struct Enchanced Txt    */
  156.     HTSetSuffix(".MPG",    "video/mpeg",        "binary", 1.0);    /* MPEG            */
  157.     HTSetSuffix(".mpg",    "video/mpeg",        "binary", 1.0);
  158.     HTSetSuffix(".MPE",    "video/mpeg",        "binary", 1.0);
  159.     HTSetSuffix(".mpe",    "video/mpeg",        "binary", 1.0);
  160.     HTSetSuffix(".MPEG",   "video/mpeg",        "binary", 1.0);
  161.     HTSetSuffix(".mpeg",   "video/mpeg",        "binary", 1.0);
  162.     HTSetSuffix(".qt",     "video/quicktime",        "binary", 1.0);    /* QuickTime        */
  163.     HTSetSuffix(".mov",    "video/quicktime",        "binary", 1.0);
  164.     HTSetSuffix(".avi",    "video/x-msvideo",        "binary", 1.0);    /* MS Video for Windows    */
  165.     HTSetSuffix(".movie",  "video/x-sgi-movie",        "binary", 1.0);    /* SGI "moviepalyer"    */
  166.  
  167.     HTSetSuffix("*.*",     "application/octet-stream",    "binary", 0.1);
  168.     HTSetSuffix("*",       "text/plain",        "7bit",   0.5);
  169.  
  170. }
  171. #endif /* NO_INIT */
  172.  
  173.