On Tue Jul 11 05:38:54 CDT 2006, [EMAIL PROTECTED] wrote:
> > I recall the pages on http://plan9.bell-labs.com/ were build rather with 
> > compatibility with mothra
> 
> Actually, the changes to the plan9 website earlier this year made it
> incompatible with mothra.  With a great effort of will I have restrained
> myself from complaining about this in 9fans.  

just admit it.  you'd rather code than complain. ☺

i've attached some diffs that allow .bz2 support.
there's also some (misguided?) cleanup in html.h.

> Instead I've updated mothra
> with support for the requisite features: charset=utf-8, more &entities,
> and .png images.
> 
> Just in case anyone besides me is still using mothra, the new version
> is now in /n/sources/extra/mothra.

thanks.  i still use it, but much less since the new version of abaco is 
working so well.
i'm even able to get wikipedia to work with a few changes to libhtml. (i've 
submitted
one patch and am collecting a second.)

- erik
diff -c /n/sources/extra/mothra//filetype.c ./filetype.c
/n/sources/extra/mothra//filetype.c:22,36 - ./filetype.c:22,36
        ".gif",         GIF,
        ".jpe",         JPEG,
        ".jpg",         JPEG,
-       ".jpeg",        JPEG,
-       ".png", PNG,
+       ".jpeg",        JPEG,
        ".pic",         PIC,
+       ".png",         PNG,
        ".au",          AUDIO,
        ".tif",         TIFF,
-       ".tiff",        TIFF,
+       ".tiff",        TIFF,
        ".xbm",         XBM,
        ".txt",         PLAIN,
-       ".text",        PLAIN,
+       ".text",        PLAIN,
        ".ai",          POSTSCRIPT,
        ".eps",         POSTSCRIPT,
        ".ps",          POSTSCRIPT,
/n/sources/extra/mothra//filetype.c:51,56 - ./filetype.c:51,57
        int len, kind, restore;
        char *s;
        len=strlen(name);
+       
        if(len>=2 && cistrcmp(name+len-2, ".Z")==0){
                kind=COMPRESS;
                len-=2;
/n/sources/extra/mothra//filetype.c:59,64 - ./filetype.c:60,69
                kind=GUNZIP;
                len-=3;
        }
+       else if(len>=4 && cistrcmp(name+len-3, ".bz2")==0){
+               kind=BZIP2;
+               len-=4;
+       }
        else
                kind=0;
        restore=name[len];
/n/sources/extra/mothra//filetype.c:99,104 - ./filetype.c:104,111
        "compress",     COMPRESS,
        "x-gzip",       GUNZIP,
        "gzip",         GUNZIP,
+       "bzip2",                BZIP2,
+       "x-bzip",               BZIP2,
        0,              0
  };
  int encoding2type(char *s){
diff -c /n/sources/extra/mothra//getpix.c ./getpix.c
/n/sources/extra/mothra//getpix.c:13,23 - ./getpix.c:13,23
  };
  Pix pix[NPIX];
  Pix *epix=pix;
- char *pixcmd[]={
+ char *pixcmd[CTYPEMASK+1]={
  [GIF] "gif -9v",
  [JPEG]        "jpg -9v",
- [PNG] "png -9v",
  [PIC] "fb/3to1 /lib/fb/cmap/rgbv",
+ [PNG] "png -9v",
  [TIFF]        "/sys/lib/mothra/tiffcvt",
  [XBM] "fb/xbm2pic",
  };
/n/sources/extra/mothra//getpix.c:72,83 - ./getpix.c:72,78
                }
                return;
        }
-       if(url.type!=GIF
-       && url.type!=JPEG
-       && url.type!=PNG
-       && url.type!=PIC
-       && url.type!=TIFF
-       && url.type!=XBM){
+       if(pixcmd[CTYPEMASK & url.type] == 0){
                werrstr("unknown image type");
                goto Err;
        }
Common subdirectories: /n/sources/extra/mothra//libpanel and ./libpanel
diff -c /n/sources/extra/mothra//mothra.h ./mothra.h
/n/sources/extra/mothra//mothra.h:52,84 - ./mothra.h:52,93
   * url reference types -- COMPRESS and GUNZIP are flags that can modify any 
other type
   * Changing these in a non-downward compatible way spoils cache entries
   */
- #define       GIF             1
- #define       HTML            2
- #define       JPEG            3
- #define       PIC             4
- #define       TIFF            5
- #define       AUDIO           6
- #define       PLAIN           7
- #define       XBM             8
- #define       POSTSCRIPT      9
- #define       FORWARD         10
- #define       PDF             11
- #define       SUFFIX          12
- #define ZIP           13      /* rm */
- #define PNG           14
- #define       COMPRESS        16
- #define       GUNZIP          32
- #define       COMPRESSION     (COMPRESS|GUNZIP)
+ enum {
+       GIF,
+       HTML,
+       JPEG,
+       PIC,
+       TIFF,
+       AUDIO,
+       PLAIN,
+       XBM,
+       POSTSCRIPT,
+       FORWARD,
+       PDF,
+       SUFFIX,
+       ZIP,                    // rm
+       PNG,
+ 
+       CTYPEMASK       = 15,   // i.e. COMRESS-1
+       COMPRESS        = 16,
+       GUNZIP  = 32,
+       BZIP2           = 64,
+       COMPRESSION     = (COMPRESS|GUNZIP|BZIP2),
+ };
+ 
  /*
   * url access types
   */
- #define       HTTP            1
- #define       FTP             2
- #define       FILE            3
- #define       TELNET          4
- #define       MAILTO          5
- #define       EXEC            6
- #define       GOPHER          7
+ enum{
+       HTTP            = 1,
+       FTP,
+       FILE,
+       TELNET,
+       MAILTO,
+       EXEC,
+       GOPHER,
+ };
+ 
  /*
   *  authentication types
   */
/n/sources/extra/mothra//mothra.h:122,130 - ./mothra.h:131,133
  uchar cmap[256*3];
  RGB map[256];
  char version[];
- #ifndef brazil
- #     define  RFREND  0
- #endif
- #ifndef       nil
- #define       nil     0
- #endif

Reply via email to