--- giftrans-1.12.2.orig/giftrans.1 +++ giftrans-1.12.2/giftrans.1 @@ -6,7 +6,7 @@ .fi .in -.5i .. -.TH GIFTRANS l local +.TH GIFTRANS 1 .SH NAME .PP giftrans \- transform gif from gif87 to gif89, making one color transparent @@ -51,7 +51,9 @@ .IP -e Redirect stderr to a file .PP -Colors may be specified as index, as rgb.txt entry or in the #rrggbb form. +Colors may be specified as index, as rgb.txt entry or in the #rrggbb +form. Of course, beware that shells will often consider the # +character to start a comment and so you may have to escape it! .SH EXAMPLE .PP To convert the white background of a gif file to transparent, use --- giftrans-1.12.2.orig/giftrans.c +++ giftrans-1.12.2/giftrans.c @@ -169,7 +169,7 @@ #ifndef RGBTXT #ifdef X11 -#define RGBTXT "/usr/lib/X11/rgb.txt" +#define RGBTXT "/usr/share/X11/rgb.txt" #else /* X11 */ #ifdef OPENWIN #define RGBTXT "/usr/openwin/lib/rgb.txt" @@ -235,7 +235,7 @@ } bc,tc,tn,go,gn; static char *image,*comment; -static int skipcomment,list,verbose,output,debug; +static int skipcomment,list,verbose,output,debug,cont=1; static long int pos; static char rgbtxt[] = RGBTXT, *rgb = rgbtxt; @@ -383,7 +383,7 @@ FILE *dest; { unsigned char buffer[3*256],lsd[7],gct[3*256],gce[5]; - unsigned int cnt,cols,size,gct_size,gct_delay,gce_present; + unsigned int cnt,cols,size,gct_size=0,gct_delay,gce_present; struct entry *rgbptr; @@ -547,8 +547,8 @@ if (output) (void)fwrite((void *)buffer,10,1,dest); /* Local Color Table */ - if (buffer[8]&0x80) { - size=2<<(buffer[8]&0x7); + if (buffer[9]&0x80) { + size=2<<(buffer[9]&0x7); pos=ftell(src); (void)fread((void *)buffer,size,3,src); if (verbose) { @@ -711,7 +711,9 @@ (void)fprintf(stderr,"0x%08lx: Unknown extension 0x%02x!\n",ftell(src)-1,buffer[0]); if (debug) dump(pos,buffer,1); - return(1); + if(!cont) + return(1); + break; } } while (buffer[0]!=0x3b&&!feof(src)); return(buffer[0]==0x3b?SUCCESS:FAILURE); @@ -811,10 +813,12 @@ image=argv[0]; root=NULL; - if (*rgb) + if (*rgb) { if ((src=fopen(rgb,"r"))!=NULL) { next= &root; while (fgets(line,sizeof(line),src)) { + if (line[0] == '!') + continue; *next=(struct entry *)malloc(sizeof(struct entry)); for (ptr=line;strchr(" \t",*ptr);ptr++); for (nptr=ptr;!strchr(" \t",*ptr);ptr++); @@ -847,7 +851,7 @@ *rgb='\0'; #endif } - + } bc.index=NONE; tc.index=NONE; tn.index=NONE;