Netpbm patches

The following are some patches to be applied to the 1mar1994 version of netpbm. Read the descriptions before applying them. I've sent all of these patches to the netpbm and pbmplus maintainers, but they haven't responded.

Note: I've sent these patches to the Red Hat Linux folks, and their current netpbm package (netpbm-1mar1994-15) contains them.

ppmdither patch
This patch fixes two bugs in ppmdither which can cause it to generate incorrect output. The first is that ppmdither ignores the "maxval" specified in the input ppm file. The second is a less conspicuous problem which can result in regularly-spaced dots of the wrong color in the output. See the patch file itself for more details.

ppmquant patch
There is an overflow bug in ppmquant that causes it to produce very poor results when the input ppm file has a large maxval (>25000 or so). This patch fixes it.

Imakefile patch
The Imakefile in netpbm-1mar1994 is improperly formatted, and assumes `.' is on the installer's PATH. These problems can cause make to fail. This patch fixes these Imakefile problems.

colordb patch
On many systems, the rgb.txt file contains comments which are indicated by a `!' as the first character of the line. This causes some netpbm utilities to issue a harmless warning ("can't parse color names database line"). This patch will eliminate that warning.

ppmchange patch
See the patch file for details.

HP/UX patch
With some compilers, notably gcc 2.6.3 under HP/UX, functions that return structs can cause problems. To test for this bug, first compile with the patches above, and then run this test:
ppmmake white 100 100 | pnmdepth 1 | ppmdither | ppmhist
The output should look like this:
 r   g   b      lum     count
--- --- ---     ---     -----
255 255 255     255     10000
If you get something like this instead, try the patch:
 r   g   b      lum     count
--- --- ---     ---     -----
255 255   0     226     10000