NOTES
+-
+
+
+diff --git a/userguide/pamtoavs.html b/userguide/pamtoavs.html
+index 5d0ae35..bee1a40 100644
+--- a/userguide/pamtoavs.html
++++ b/userguide/pamtoavs.html
+@@ -2,13 +2,15 @@
+ Pamtoavs User Manual
+
+ pamtoavs
+-Updated: 07 February 2010
+-
+-Table Of Contents
++
++Updated: 7 February 2010
++
++Table Of Contents
++
+
+ NAME
+
+-pamtoavs - convert a Netpbm image to an AVS X image
++
pamtoavs - convert a Netpbm image to an AVS X image
+
+ SYNOPSIS
+
+@@ -17,7 +19,7 @@ Updated: 07 February 2010
+
+ DESCRIPTION
+
+-This program is part of Netpbm.
++
This program is part of Netpbm.
+
+ pamtoavs reads a Netpbm image as input and produces a Stardent
+ AVS
+@@ -27,14 +29,14 @@ href="http://www.gnuplot.info/">Gnuplot v4.2 and later can use.
+
netpbmfile is the input file, which defaults to Standard Input.
+ Output is always on Standard Output.
+
+-
Try the following:
++
Try the following:
+
+
+ gnuplot> plot 'myimage.avs' binary filetype=avs with rgbimage
+
+
+ See the Gnuplot
+-manual for more information.
++manual for more information.
+
+
+ OPTIONS
+@@ -42,29 +44,29 @@ manual for more information.
+ There are no command line options defined specifically
+ for pamtoavs, but it recognizes the options common to all
+ programs based on libnetpbm (See
+-Common Options.)
++Common Options.)
+
+ AUTHOR
+
+ Copyright © 2010 Scott Pakin,
+-scott+pbm@pakin.org.
++scott+pbm@pakin.org.
+
+ SEE ALSO
+
+ avstopam,
+ gnuplot,
+-pam
++pam
+
+
+
+ Table Of Contents
+
+
+
+
+diff --git a/userguide/pamtooctaveimg.html b/userguide/pamtooctaveimg.html
+index 4e09e8e..d2cc50b 100644
+--- a/userguide/pamtooctaveimg.html
++++ b/userguide/pamtooctaveimg.html
+@@ -2,13 +2,13 @@
+ Pamtooctaveimg User Manual
+
+ pamtooctaveimg
+-
+-Updated: 27 June 2007
+-Table Of Contents
++
++
Updated: 27 June 2007
++Table Of Contents
+
+ NAME
+
+-pamtooctaveimg - convert a Netpbm image to a GNU Octave image
++
pamtooctaveimg - convert a Netpbm image to a GNU Octave image
+
+ SYNOPSIS
+
+@@ -17,7 +17,7 @@
+
+ DESCRIPTION
+
+-This program is part of Netpbm.
++
This program is part of Netpbm.
+
+ pamtooctaveimg reads a Netpbm image as input and produces a GNU Octave image file as output.
+@@ -45,7 +45,7 @@ Image Processing chapter of the GNU Octave manual for details.
+
There are no command line options defined specifically
+ for pamtooctaveimg, but it recognizes the options common to all
+ programs based on libnetpbm (See
+-Common Options.)
++Common Options.)
+
+ ARGUMENTS
+
+@@ -77,7 +77,8 @@ specify netpbmfile, the input is from Standard Input.
+ NOTES
+
+ There is no octavetopam program. However, GNU Octave's
+-saveimage command can save images in PPM format.
++saveimage command can save images in PPM format.
++
+
+ HISTORY
+
+@@ -86,7 +87,7 @@ specify netpbmfile, the input is from Standard Input.
+ AUTHOR
+
+ Copyright (C) 2007 Scott Pakin,
+-scott+pbm@pakin.org.
++scott+pbm@pakin.org.
+
+ SEE ALSO
+
+@@ -98,15 +99,15 @@ href="http://www.gnu.org/software/octave/doc/interpreter/index.html">octave
+
+ Table Of Contents
+
+
+
+diff --git a/userguide/pnmflip.html b/userguide/pnmflip.html
+index 2bd7368..8a1916e 100644
+--- a/userguide/pnmflip.html
++++ b/userguide/pnmflip.html
+@@ -5,17 +5,18 @@
+
+ NAME
+
+-pnmflip - replaced by pamflip
++pnmflip - replaced by pamflip
+
+ DESCRIPTION
+
+-This program is part of Netpbm.
++
This program is part of Netpbm.
+
pnmflip was replaced in Netpbm 10.13 (December 2002) by
pamflip.
-+
DESCRIPTION
- pamflip is mostly backward compatible with pnmflip,
- but works on PAM images too.
++
DESCRIPTION
+ pamflip is mostly backward compatible with pnmflip,
+-but works on PAM images too.
++but works on PAM images too.
+
+ One way pamflip is not backward compatible with pnmflip
+ is that pnmflip lets you specify any number of basic flip options,
+@@ -23,12 +24,12 @@ whereas pamflip requires exactly one. (pamflip provides
+ the -xform option for requesting multiple transformations, though).
+ Because of this incompatibility, pnmflip still exists as a
+ separate program, and all it does is translate its options to pamflip
+-style and run pamflip.
++style and run pamflip.
+
+ You should not make any new use of pnmflip and if you modify an
+ existing use, you should upgrade to pamflip. But note that if you
+ write a program that might have to be used with very old
+-Netpbm, pnmflip is the only way to do that.
++Netpbm, pnmflip is the only way to do that.
+
+
+
+diff --git a/userguide/pnmmercator.html b/userguide/pnmmercator.html
+index 998f7fb..65576ac 100644
+--- a/userguide/pnmmercator.html
++++ b/userguide/pnmmercator.html
+@@ -18,11 +18,12 @@ projection and vice-versa
+ [filename]
+
+ Minimum unique abbreviation of option is acceptable.
+-You may use double hyphens instead of single hyphen to denote options.
++You may use double hyphens instead of single hyphen to denote options.
+
+ DESCRIPTION
+
+-This program is part of Netpbm.
++
This program is part of Netpbm.
+
+ The pnmmercator utility, converts a rectangular projection worldmap
+ to a Mercator projection format, as used for maps.google.com and many other
+@@ -31,34 +32,34 @@ online maps. The map used as input for pnmmercator must have rows for
+ file will typically be twice as wide as high, but this is not a
+ requirement. The output file will be using the Mercator
+-projection and will get double the height of the input file.
++projection and will get double the height of the input file.
+
+ Maps using the Mercator projection are stretched more the closer a row is
+ to the North or South Pole. The last few degrees (> 85 or < -85 degrees)
+ are not part of a Mercator map at all because they would be stretched too much
+ and the rows close to the edge will show banding, because they originate from
+-the same row in the original map.
++the same row in the original map.
+
+ To overcome this, the program will by default do interpolation of pixel
+ colors, which will eliminate the banding effect, but will cause some blurring
+ of the output. With the -nomix option, this interpolation of colors isn't
+ applied. You can obtain the highest quality output by starting with an input
+ map of high resolution, so that you can follow the pnmmercator
+-transformation with a pamscale reduction in size.
++transformation with a pamscale reduction in size.
+
+ This program can also convert a Mercator projection map back to a
+ rectangular projection based. As said, the Mercator map doesn't have
+ information about the latitudes close to the poles. Therefore the top rows in
+ the output image will be identical and copied from the row corresponding with
+-latitude of 85 degrees. The same at the bottom of the map.
++latitude of 85 degrees. The same at the bottom of the map.
+
+ Pnmmercator doesn't have any provision for scaling the image. You can scale
+ by piping the output of the program through Netpbm programs such as
+-pamscale.
++pamscale.
+
+ You can find maps to be used as input at flatplanet.sourceforge.net
+-or uic.edu/pape.
++or uic.edu/pape.
+
+ The point of a Mercator projection map is that compass directions work on
+ it. If you draw a straight line northeast from some point on the Mercator
+@@ -78,33 +79,33 @@ proportional to angular longitude.
+
PARAMETERS
+
+ filename is the name of the input file. If you don't specify
+-this, pnmmercator reads the image from standard Input.
++this, pnmmercator reads the image from standard Input.
+
+ OPTIONS
+
+ In addition to the options common to all programs based on libnetpbm
+ (most notably -quiet, see
+ Common Options), pnmmercator recognizes the following
+-command line options:
++command line options:
+
+
+ - -inverse
+ -
+
With this option a conversion from Mercator to degrees is applied.The
+-output image will have half the height of the input map.
++output image will have half the height of the input map.
+
+ - -nomix
+ -
+
Default behaviour is that color blending is applied in between two adjacent
+ rows. If you specify the -nomix parameter there is no blending. The
+ consequence is a banding at the top and bottom of the map. With this option,
+-the output map will also consist of exactly the same colors as the input.
++the output map will also consist of exactly the same colors as the input.
+
+ - -verbose and -vverbose
+ -
+
This parameter outputs some additional information. If you double the 'v',
+ it will output debug data about the lat/long degree and Mercator
+-conversions.
++conversions.
+
+
+
+@@ -114,25 +115,26 @@ conversions.
+ ppmglobe
+
+ HISTORY
+-pnmmercator was new in Netpbm 10.49 (December 2009).
++
pnmmercator was new in Netpbm 10.49 (December 2009).
+
+ AUTHORS
+
+ Willem van Schaik (of
+ pnmtopng/pngtopnm fame) wrote this program in October 2009 and
+-suggested it for inclusion in Netpbm.
++suggested it for inclusion in Netpbm.
+
+
+
+ Table Of Contents
+
+
+
+diff --git a/userguide/ppmtogif.html b/userguide/ppmtogif.html
+index 513133a..fa72e09 100644
+--- a/userguide/ppmtogif.html
++++ b/userguide/ppmtogif.html
+@@ -5,17 +5,16 @@
+
+ NAME
+
+-ppmtogif - replaced by pamtogif
+-
+-DESCRIPTION
+-
+-This program is part of Netpbm.
++
ppmtogif - replaced by pamtogif
++This program is part of Netpbm.
-diff -urNp old/userguide/pnmmercator.html new/userguide/pnmmercator.html
---- old/userguide/pnmmercator.html 2017-09-05 13:58:08.334559565 +0200
-+++ new/userguide/pnmmercator.html 2017-09-05 14:08:08.305214742 +0200
-@@ -1,7 +1,6 @@
--
-+
-
-
--
- PnmMercator User Manual
-
-
-diff -urNp old/userguide/ppmtogif.html new/userguide/ppmtogif.html
---- old/userguide/ppmtogif.html 2017-09-05 13:58:08.337559553 +0200
-+++ new/userguide/ppmtogif.html 2017-09-05 14:09:51.450583126 +0200
-@@ -4,11 +4,14 @@
-
- ppmtogif
-
-+NAME
ppmtogif was replaced in Netpbm 10.37 (December 2006) by
- pamtogif.
+-pamtogif.
++pamtogif.
-+SYNOPSIS
- pamtogif is mostly backward compatible with ppmtogif.
++
SYNOPSIS
+ pamtogif is mostly backward compatible with ppmtogif.
-+
DESCRIPTION
- One way pamtogif is not backward compatible with ppmtogif
++
DESCRIPTION
+ One way pamtogif is not backward compatible with ppmtogif
is that to specify a transparency (alpha) mask with ppmtogif, you
supply the transparency as a separate pseudo-PGM image and use the
+@@ -77,8 +76,8 @@ the alpha image need not have the same maxval as the input.
+ ppmtogif interprets the alpha file using the alpha file's
+ maxval.
+
+-
You cannot specify both -transparent and -alpha.
++
You cannot specify both -transparent and -alpha.
+
+
+-
+-
++
++
diff --git a/netpbm-manual-pages.patch b/netpbm-manual-pages.patch
index d52c8eb..df35cbb 100644
--- a/netpbm-manual-pages.patch
+++ b/netpbm-manual-pages.patch
@@ -1,9 +1,9 @@
diff --git a/userguide/libnetpbm_ug.html b/userguide/libnetpbm_ug.html
-index 94d4fd4..bb1c77e 100644
+index 92df98a..60ccc88 100644
--- a/userguide/libnetpbm_ug.html
+++ b/userguide/libnetpbm_ug.html
@@ -374,7 +374,7 @@ plain format.
- Reference
+ Reference
The Libnetpbm Netpbm Image
-Processing Manual describes the the libnetpbm functions for
@@ -12,10 +12,10 @@ index 94d4fd4..bb1c77e 100644
The Libnetpbm Utility Manual
diff --git a/userguide/pamfunc.html b/userguide/pamfunc.html
-index d158393..e0fe96a 100644
+index 60d53d6..80f90f2 100644
--- a/userguide/pamfunc.html
+++ b/userguide/pamfunc.html
-@@ -57,7 +57,7 @@ output image.
+@@ -60,7 +60,7 @@ output image.
and bit string (such as and with 01001000). For the arithmetic functions, the
function arguments and results are the fraction that a sample is of the
maxval, i.e. normal interpretation of PAM tuples. But for the bit string
@@ -25,49 +25,55 @@ index d158393..e0fe96a 100644
Arithmetic functions
diff --git a/userguide/pbmtog3.html b/userguide/pbmtog3.html
-index ee2bd6b..3b23517 100644
+index 88de765..4590a17 100644
--- a/userguide/pbmtog3.html
+++ b/userguide/pbmtog3.html
-@@ -77,7 +77,7 @@ You cannot specify both.
- HISTORY
+@@ -36,7 +36,7 @@ use those encodings.
+ In addition to the options common to all programs based on libnetpbm
+ (most notably -quiet, see
+ Common Options), pbmtog3 recognizes the following
+-command line options:
++command line options:
+
+
+ - -reversebits
+@@ -80,7 +80,7 @@ You cannot specify both.
+
HISTORY
Before Netpbm 10.79 (June 2017), there was a different program by the same
-name in Netpbm, which was written by by Paul Haeberli
+name in Netpbm, which was written by Paul Haeberli
- <paul@manray.sgi.com> in 1989
+ <paul@manray.sgi.com> in 1989
and then modified extensively by others.
diff --git a/userguide/ppmtompeg.html b/userguide/ppmtompeg.html
deleted file mode 100644
-index a1ce767..0000000
+index af5a8d7..0000000
--- a/userguide/ppmtompeg.html
+++ /dev/null
-@@ -1,1291 +0,0 @@
--
--
--
--Ppmtompeg User Manual
--
--
--Ppmtompeg
+@@ -1,1294 +0,0 @@
+-
+-Ppmtompeg User Manual
+-
+-ppmtompeg
-Updated: 23 July 2006
--
--Table Of Contents
+-
+-Table Of Contents
-
--NAME
+-NAME
-ppmtompeg - encode an MPEG-1 bitstream
-
--SYNOPSIS
+-SYNOPSIS
-
--ppmtompeg
--[options]
--parameter-file
+-ppmtompeg
+-[options]
+-parameter-file
-
--DESCRIPTION
+-DESCRIPTION
-
-This program is part of Netpbm.
-
--
ppmtompeg produces an MPEG-1 video stream. MPEG-1 is the
+-
ppmtompeg produces an MPEG-1 video stream. MPEG-1 is the
-first great video compression method, and is what is used in Video CDs
-(VCD). ppmtompeg originated in the year 1995. DVD uses a more
-advanced method, MPEG-2. There is an even newer method called MPEG-4
@@ -93,21 +99,21 @@ index a1ce767..0000000
-input files and other parameters. The file is described in detail
-below.
-
--
To understand this program, you need to understand something about
+-
To understand this program, you need to understand something about
-the complex MPEG-1 format. One source of information about this
-standard format is the section Introduction to MPEG in the Compression FAQ.
-
--
OPTIONS
+-OPTIONS
-
-The -gop, -combine_gops, -frames, and
--combine_frames options are all mutually exclusive.
-
--
--- -stat stat_file
+-
+-- -stat stat_file
-
--
- This option causes ppmtompeg to append the statistics that
--it write to Standard Output to the file stat_file as well. The
+-
- This option causes ppmtompeg to append the statistics that
+-it write to Standard Output to the file stat_file as well. The
-statistics use the following abbreviations: bits per block (bpb), bits
-per frame (bpf), seconds per frame (spf), and bits per second (bps).
-
@@ -115,40 +121,41 @@ index a1ce767..0000000
-and information about compression and quality.
-
-
--
- -quiet num_seconds
+-
- -quiet num_seconds
-
--
- causes ppmtompeg not to report remaining time more often
+-
- causes ppmtompeg not to report remaining time more often
-than every num_seconds seconds (unless the time estimate rises,
-which will happen near the beginning of the run). A negative value
-tells ppmtompeg not to report at all. 0 is the default
-(reports once after each frame). Note that the time remaining is an
-estimate and does not take into account time to read in frames.
-
--
- -realquiet
- causes ppmtompeg to run silently,
+-
- -realquiet
- causes ppmtompeg to run silently,
-with the only screen output being errors. Particularly useful when
--reading input from stdin.
+-reading input from stdin. The equivalent of the -quiet
+-common option of most other Netpbm programs.
-
--
-
---no_frame_summary
+-
-
+--no_frame_summary
-
--
- This option prevents ppmtompeg from printing a summary
+-
- This option prevents ppmtompeg from printing a summary
-line for each frame
-
--
- -float_dct
+-
- -float_dct
-
--
- forces ppmtompeg to use a more accurate, yet more
+-
- forces ppmtompeg to use a more accurate, yet more
-computationally expensive version of the DCT.
-
--
- -gop gop_num
--
-
+-
- -gop gop_num
+-
-
-causes ppmtompeg to encode only the numbered GOP (first GOP is 0). The
-parameter file is the same as for normal usage. The output file will be
-the normal output file with the suffix .gop.gop_num.
-ppmtompeg does not output any sequence information.
-
--
- -combine_gops
+-
- -combine_gops
-
--
- causes ppmtompeg simply to combine some GOP files into a
+-
- causes ppmtompeg simply to combine some GOP files into a
-single MPEG output stream. ppmtompeg inserts a sequence header
-and trailer. In this case, the parameter file needs only to contain
-the SIZE value, an output file, and perhaps a list of input GOP
@@ -171,9 +178,9 @@ index a1ce767..0000000
-(-combine_gops).
-
-
--
- -frames first_frame last_frame
+-
- -frames first_frame last_frame
-
--
- This option causes ppmtompeg to encode only the frames numbered
+-
- This option causes ppmtompeg to encode only the frames numbered
-first_frame to last_frame, inclusive. The parameter
-file is the same as for normal usage. The output will be placed in
-separate files, one per frame, with the file names being the normal
@@ -185,9 +192,9 @@ index a1ce767..0000000
-an MPEG stream.
-
-
--
- -combine_frames
+-
- -combine_frames
-
--
- This option causes ppmtompeg simply to combine some
+-
- This option causes ppmtompeg simply to combine some
-individual MPEG frames (such as you might have created with an earlier
-run of ppmtompeg -frames) into a single MPEG stream. Sequence
-and GOP headers are inserted appropriately. In this case, the
@@ -203,42 +210,42 @@ index a1ce767..0000000
-
-
-
--
- -nice
+-
- -nice
-
--
- This option causes ppmtompeg to run any remote processes
+-
- This option causes ppmtompeg to run any remote processes
-"nicely," i.e. at low priority. (This is relevant only if you are
-running ppmtompeg in parallel mode. Otherwise, there are no
-remote processes). See 'man nice.'
-
--
- -max_machines num_machines
+-
- -max_machines num_machines
-
--
- This option causes ppmtompeg to use no more than
+-
- This option causes ppmtompeg to use no more than
-num_machines machines as slaves for use in parallel encoding.
-
--
- -snr
+-
- -snr
-
--
- This option causes ppmtompeg to include the signal-to-noise
+-
- This option causes ppmtompeg to include the signal-to-noise
-ratio in the reported statistics. Prints SNR (Y U V) and peak SNR (Y
-U V) for each frame. In summary, prints averages of luminance only
-(Y). SNR is defined as 10*log(variance of original/variance of
-error). Peak SNR is defined as 20*log(255/RMSE). Note that
-ppmtompeg runs a little slower when you use this option.
-
--
- -mse
+-
- -mse
-
--
- This option causes ppmtompeg to report the mean squared
+-
- This option causes ppmtompeg to report the mean squared
-error per block. It also automatically reports the quality of the
-images, so there is no need to specify -snr then.
-
--
- -bit_rate_info rate_file
+-
- -bit_rate_info rate_file
-
--
- This option makes ppmtompeg write bit rate information
+-
- This option makes ppmtompeg write bit rate information
-into the file rate_file. Bit rate information is bits per frame, and
-also bits per I-frame-to-I-frame.
-
--
- -mv_histogram
+-
- -mv_histogram
-
--
- This option causes ppmtompeg to print a histogram of the
+-
- This option causes ppmtompeg to print a histogram of the
-motion vectors as part of statistics. There are three histograms --
-one for P frame, one for forward B frame, and one for backward B frame
-motion vectors.
@@ -260,19 +267,19 @@ index a1ce767..0000000
-machines when you run ppmtompeg in parallel
-mode.
-
--
+-
-
--PARAMETER FILE
+-PARAMETER FILE
-
--The parameter file must contain the following
+-
The parameter file must contain the following
-lines (except when using the -combine_gops or -combine_frames
-options):
-
--
+-
-
--- PATTERN pattern
+-
- PATTERN pattern
-
--
- This statement specifies the pattern (sequence) of I frames, P frames,
+-
- This statement specifies the pattern (sequence) of I frames, P frames,
-and B frames. pattern is just a sequence of the letters I, P, and
-B with nothing between. Example:
-
@@ -282,12 +289,12 @@ index a1ce767..0000000
-
-
See I Frames, P Frames, B Frames.
-
--
- OUTPUT output file
--
- This names the file where the output MPEG stream goes.
+-
- OUTPUT output file
+-
- This names the file where the output MPEG stream goes.
-
--
- INPUT_DIR directory
+-
- INPUT_DIR directory
-
--
- This statement tells where the input images (frames) come from.
+-
- This statement tells where the input images (frames) come from.
-If each frame is in a separate file, directory is the directory
-where they all are. You may use . to refer to the current
-directory. A null directory refers to the root directory of the
@@ -299,10 +306,10 @@ index a1ce767..0000000
- INPUT_DIR stdin
-
-
--
- INPUT
--
-
+-
- INPUT
+-
-
-This line must be followed by a list of the input files (in display order)
--and then the line END_INPUT.
+-and then the line END_INPUT.
-
-
There are three types of lines between INPUT and END_INPUT. First,
-a line may simply be the name of an input file. Second, the line
@@ -336,13 +343,13 @@ index a1ce767..0000000
-
-
-If input is from Standard Input (per the INPUT_DIR statement),
--ppmtompeg ignores the INPUT/END_INPUT block, but
+-ppmtompeg ignores the INPUT/END_INPUT block, but
-it still must be present.
-
--
- BASE_FILE_FORMAT {PPM | PNM | YUV |
+-
- BASE_FILE_FORMAT {PPM | PNM | YUV |
- JPEG | JMOVIE}
-
--
- ppmtompeg must convert all input files to one of the
+-
- ppmtompeg must convert all input files to one of the
-following formats as a first step of processing: PNM, YUV, JPEG(v4),
-or JMOVIE. (The conversion may be trivial if your input files are
-already in one of these formats). This line specifies which of the
@@ -350,9 +357,9 @@ index a1ce767..0000000
-specification is allowed for backward compatibility. Use PNM instead
-of PPM in new applications.
-
--
- INPUT_CONVERT conversion_command
+-
- INPUT_CONVERT conversion_command
-
--
- You must specify how to convert a file to the base file format.
+-
- You must specify how to convert a file to the base file format.
-If no conversion is necessary, then you would just say:
-
-
@@ -360,7 +367,7 @@ index a1ce767..0000000
-
-
-Otherwise, conversion_command is a shell command that causes
--an image in the format your specified with BASE_FILE_FORMAT to
+-an image in the format your specified with BASE_FILE_FORMAT to
-be written to Standard Output. ppmtompeg executes the command
-once for each line between INPUT and END_INPUT (which is
-normally, but not necessarily, a file name). In the conversion
@@ -387,7 +394,7 @@ index a1ce767..0000000
-
-as described above.
-
--
- SIZE widthxheight
+-
- SIZE widthxheight
-
-
-
-
@@ -405,21 +412,21 @@ index a1ce767..0000000
-SIZE is required and must give the same dimensions as the
-input image files.
-
--
- YUV_SIZE widthxheight
+-
- YUV_SIZE widthxheight
-
-
- This is an obsolete synonym of SIZE.
-
--
- YUV_FORMAT {ABEKAS | PHILLIPS | UCB |
+-
- YUV_FORMAT {ABEKAS | PHILLIPS | UCB |
- EYUV | pattern}
-
--
- This is meaningful only when BASE_FILE_FORMAT specifies
+-
- This is meaningful only when BASE_FILE_FORMAT specifies
-YUV format, and then it is required. It specifies the sub-format of
-the YUV class.
-
-
--
- GOP_SIZE n
+-
- GOP_SIZE n
-
--
- n is the number of frames in a Group of Pictures. Except that
+-
- n is the number of frames in a Group of Pictures. Except that
-because a GOP must start with an I frame, ppmtompeg makes a GOP as
-much longer than n as it has to to make the next GOP start with an
-I frame.
@@ -430,59 +437,59 @@ index a1ce767..0000000
-
-
See Group Of Pictures.
-
--
- SLICES_PER_FRAME n
+-
- SLICES_PER_FRAME n
-
- n is roughly the number of slices per frame. Note, at
-least one MPEG player may complain if slices do not start at the left
-side of an image. To ensure this does not happen, make sure the
-number of rows is divisible by SLICES_PER_FRAME.
-
--
- PIXEL {FULL | HALF}
+-
- PIXEL {FULL | HALF}
-
-
- use half-pixel motion vectors, or just full-pixel ones It is
-usually important that you use half-pixel motion vectors, because it
-results in both better quality and better compression.
-
-
--
- RANGE n
+-
- RANGE n
-
- Use a search range of n pixels in each of the four directions
-from a subject pixel. (So the search window is a square n*2 pixels
-on a side).
-
--
- PSEARCH_ALG {EXHAUSTIVE | TWOLEVEL |
+-
- PSEARCH_ALG {EXHAUSTIVE | TWOLEVEL |
- SUBSAMPLE | LOGARITHMIC}
-
-
- This statement tells ppmtompeg what kind of search
- technique (algorithm) to use for P frames. You select the desired
- combination of speed and compression. EXHAUSTIVE gives the
-- best compression, but LOGARITHMIC is the fastest.
-- TWOLEVEL is an exhaustive full-pixel search, followed by a
+- best compression, but LOGARITHMIC is the fastest.
+- TWOLEVEL is an exhaustive full-pixel search, followed by a
- local half- pixel search around the best full-pixel vector (the
- PIXEL option is ignored for this search technique).
-
--
- BSEARCH_ALG {SIMPLE | CROSS2 | EXHAUSTIVE}
+-
- BSEARCH_ALG {SIMPLE | CROSS2 | EXHAUSTIVE}
-
-
- This statement tells ppmtompeg what kind of search
-- technique (algorithm) to use for B frames. SIMPLE means
+- technique (algorithm) to use for B frames. SIMPLE means
- find best forward and backward vectors, then interpolate.
-- CROSS2 means find those two vectors, then see what backward
+- CROSS2 means find those two vectors, then see what backward
- vector best matches the best forward vector, and vice versa.
- EXHAUSTIVE does an n-squared search and is
- extremely slow in relation to the others (CROSS2
-- is about half as fast as SIMPLE).
+- is about half as fast as SIMPLE).
-
--
- IQSCALE n
+-
- IQSCALE n
-
- Use n as the qscale for I frames.
- See Qscale.
-
--
- PQSCALE n
+-
- PQSCALE n
-
- Use n as the qscale for P frames.
- See Qscale.
-
--
- BQSCALE n
+-
- BQSCALE n
-
- Use n as the qscale for B frames.
- See Qscale.
-
--
- REFERENCE_FRAME {ORIGINAL | DECODED}
- This
+-
- REFERENCE_FRAME {ORIGINAL | DECODED}
- This
-statement determines whether ppmtompeg uses the original images
-or the decoded images when computing motion vectors. Using decoded
-images is more accurate and should increase the playback quality of
@@ -492,12 +499,11 @@ index a1ce767..0000000
-do as a trade-off is select ORIGINAL here, and lower the
-qscale (see QSCALE if the quality is not good enough.
-
--
+-
- Original or Decoded? (Normalized)
-
-
--
+-
- Reference |
- Compression |
- Speed |
@@ -506,20 +512,20 @@ index a1ce767..0000000
- Quality B |
-
-
-- Decoded |
-- 1000 |
-- 1000 |
-- 1000 |
-- 969 |
-- 919 |
+- Decoded |
+- 1000 |
+- 1000 |
+- 1000 |
+- 969 |
+- 919 |
-
-
-- Original |
-- 885 |
-- 1373 |
-- 1000 |
-- 912 |
-- 884 |
+- Original |
+- 885 |
+- 1373 |
+- 1000 |
+- 912 |
+- 884 |
-
-
-
@@ -529,9 +535,9 @@ index a1ce767..0000000
-
-The following lines are optional:
-
--
+-
-
--- FORCE_ENCODE_LAST_FRAME
+-
- FORCE_ENCODE_LAST_FRAME
-
-
- This statement is obsolete. It does nothing.
-
@@ -543,7 +549,7 @@ index a1ce767..0000000
-has today.
-
-
--
- NIQTABLE
+-
- NIQTABLE
-
-
- This statement specifies a custom non-intra quantization table.
-If you don't specify this statement, ppmtompeg uses a default
@@ -554,11 +560,11 @@ index a1ce767..0000000
-table. Each line defines a table row and consists of 8 integers,
-whitespace-delimited, which define the table columns.
-
--
- IQTABLE
+-
- IQTABLE
-
-
- This is analogous to NIQTABLE, but for the intra quantization table.
-
--
- ASPECT_RATIO ratio
+-
- ASPECT_RATIO ratio
-
-
- This statement specifies the aspect ratio for ppmtompeg to
-specify in the MPEG output. I'm not sure what this is used for.
@@ -566,18 +572,18 @@ index a1ce767..0000000
-
ratio must be 1.0, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437,
-0.8935, 0.9157, 0.9815, 1.0255, 1.0695, 1.0950, 1.1575, or 1.2015.
-
--
- FRAME_RATE rate
+-
- FRAME_RATE rate
-
- This specifies the frame rate for ppmtompeg to specify in the
-MPEG output. Some players use this value to determine the playback rate.
-
-
rate must be 23.976, 24, 25, 29.97, 30, 50, 59.94, or 60.
-
--
- BIT_RATE rate
--
- This specifies the bit rate for Constant Bit Rate (CBR) encoding.
+-
- BIT_RATE rate
+-
- This specifies the bit rate for Constant Bit Rate (CBR) encoding.
-
-
rate must be an integer.
-
--
- BUFFER_SIZE size
+-
- BUFFER_SIZE size
-
-
- This specifies the value
-ppmtompeg is to specify in the MPEG output for the Video
@@ -591,42 +597,42 @@ index a1ce767..0000000
-process in terms of how many bits would be in the VBV as each frame gets
-decoded, assuming a VBV of the size you indicate.
-
--
If you specify the WARN_VBV_UNDERFLOW statement,
+-
If you specify the WARN_VBV_UNDERFLOW statement,
-ppmtompeg issues a warning each time the simulation underflows
-the buffer, which suggests that an underflow would occur on playback,
-which suggests the buffer is too small.
-
--
If you specify the WARN_VBV_OVERFLOW statement,
+-
If you specify the WARN_VBV_OVERFLOW statement,
-ppmtompeg issues a warning each time the simulation overflows
-the buffer, which suggests that an overflow would occur on playback,
-which suggests the buffer is too small.
-
--
- WARN_VBV_UNDERFLOW
--
- WARN_VBV_OVERFLOW
+-
- WARN_VBV_UNDERFLOW
+-
- WARN_VBV_OVERFLOW
-
-
- See BUFFER_SIZE.
-
-
These options were new in Netpbm 10.26 (January 2005). Before that,
-ppmtompeg issued the warnings always.
-
--
+-
-
-
-The following statements apply only to parallel operation:
-
--
+-
-
--- PARALLEL
+-
- PARALLEL
-
--
- This statement, paired with END PARALLEL, is what causes
+-
- This statement, paired with END PARALLEL, is what causes
-ppmtompeg to operate in parallel mode. See Parallel Operation.
-
-
- END PARALLEL
-
--
- This goes with PARALLEL.
+-
- This goes with PARALLEL.
-
--
- PARALLEL_TEST_FRAMES n
+-
- PARALLEL_TEST_FRAMES n
-
-
- The master starts off by measuring each slave's speed. It does
-this by giving each slave n frames to encode and noting how
@@ -644,7 +650,7 @@ index a1ce767..0000000
-number of test frames, ppmtompeg will give some slaves fewer.
-
-
--
- PARALLEL_TIME_CHUNKS t
+-
- PARALLEL_TIME_CHUNKS t
-
-
- When you specify this statement, the master attempts to feed work
-to the slaves in chunks that take t seconds to process. It uses
@@ -659,9 +665,9 @@ index a1ce767..0000000
-
You may specify only one of PARALLEL_TIME_CHUNKS, PARALLEL_CHUNK_TAPER,
-and PARALLEL_PERFECT. PARALLEL_CHUNK_TAPER is usually best.
-
--
- PARALLEL_CHUNK_TAPER
+-
- PARALLEL_CHUNK_TAPER
-
--
- When you specify this statement, the master distributes work like
+-
- When you specify this statement, the master distributes work like
-with PARALLEL_TIME_CHUNKS, except that the master chooses the number
-of seconds for the chunks. It starts with a large number and, as it
-gets closer to finishing the job, reduces it. That way, it reduces
@@ -674,7 +680,7 @@ index a1ce767..0000000
-and PARALLEL_PERFECT. PARALLEL_CHUNK_TAPER is usually best.
-
-
--
- PARALLEL_PERFECT
+-
- PARALLEL_PERFECT
-
-
- If this statement is present, ppmtompeg schedules on the
-assumption that each machine is about the same speed. The master will
@@ -693,9 +699,9 @@ index a1ce767..0000000
-
You may specify only one of PARALLEL_TIME_CHUNKS, PARALLEL_CHUNK_TAPER,
-and PARALLEL_PERFECT. PARALLEL_CHUNK_TAPER is usually best.
-
--
- RSH remote_shell_command
+-
- RSH remote_shell_command
-
--
- ppmtompeg executes the shell command
+-
- ppmtompeg executes the shell command
-remote_shell_command to start a process on another machine.
-The default command is rsh, and whatever command you specify
-must have compatible semantics. ssh is usually compatible.
@@ -708,7 +714,7 @@ index a1ce767..0000000
-
On some HP machines, rsh is the restricted shell, and you want
-to specify remsh.
-
--
- FORCE_I_ALIGN
+-
- FORCE_I_ALIGN
-
-
- This statement forces each slave to encode a chunk of frames which
-is a multiple of the pattern length (see PATTERN). Since the
@@ -721,7 +727,7 @@ index a1ce767..0000000
-But ppmtompeg has apparently always ignored that argument, and
-it does now.
-
--
- KEEP_TEMP_FILES
+-
- KEEP_TEMP_FILES
-
-
- This statement causes ppmtompeg not to delete the temporary
-files it uses to transmit encoded frames to the combine server. This
@@ -735,12 +741,12 @@ index a1ce767..0000000
-
-
This option was new in Netpbm 10.26 (January 2005).
-
--
+-
-
-
--Parameter File Notes
+-Parameter File Notes
-
-- If you use the -combine_gops option, then you need to specify
+-
If you use the -combine_gops option, then you need to specify
-only the SIZE and OUTPUT values in the parameter file. In
-addition, the parameter file may specify input GOP files in the same
-manner as normal input files -- except instead of using INPUT_DIR,
@@ -765,27 +771,27 @@ index a1ce767..0000000
-parameter file for normal usage and for -combine_gops and
--combine_frames.
-
--
The file format is case-sensitive so all keywords should be in
+-
The file format is case-sensitive so all keywords should be in
-upper case.
-
--
The statements may appear in any order, except that the order within
+-
The statements may appear in any order, except that the order within
-a block statement (such as INPUT ... END INPUT) is significant.
-
--
ppmtompeg is prepared to handle up to 16 B frames between
+-
ppmtompeg is prepared to handle up to 16 B frames between
-reference frames when encoding with input from stdin. (To build a
-modified ppmtompeg with a higher limit, change the constant
-B_FRAME_RUN in frame.c and recompile).
-
--
GENERAL USAGE INFORMATION
+-GENERAL USAGE INFORMATION
-
--Qscale
+-Qscale
-
-The quantization scale values (qscale) give a trade-off between
-quality and compression. Using different Qscale values has very little
-effect on speed. The qscale values can be set separately for I, P, and
-B frames.
-
--
You select the qscale values with the IQSCALE,
+-
You select the qscale values with the IQSCALE,
-PQSCALE, and BSCALE parameter file statements.
-
-
A qscale value is an integer from 1 to 31. Larger numbers give
@@ -797,117 +803,116 @@ index a1ce767..0000000
-
-
Flower garden tests:
-
--
+-
- Qscale vs Quality
-
-
--
+-
- Qscale |
- I Frames |
- P Frames |
- B Frames |
-
-
-- 1 |
-- 43.2 |
-- 46.3 |
-- 46.5 |
+- 1 |
+- 43.2 |
+- 46.3 |
+- 46.5 |
-
-
-- 6 |
-- 32.6 |
-- 34.6 |
-- 34.3 |
+- 6 |
+- 32.6 |
+- 34.6 |
+- 34.3 |
-
-
-- 11 |
-- 28.6 |
-- 29.5 |
-- 30.0 |
+- 11 |
+- 28.6 |
+- 29.5 |
+- 30.0 |
-
-
-- 16 |
-- 26.3 |
-- 26.8 |
-- 28.6 |
+- 16 |
+- 26.3 |
+- 26.8 |
+- 28.6 |
-
-
-- 21 |
-- 24.7 |
-- 25.0 |
-- 27.9 |
+- 21 |
+- 24.7 |
+- 25.0 |
+- 27.9 |
-
-
-- 26 |
-- 23.5 |
-- 23.9 |
-- 27.5 |
+- 26 |
+- 23.5 |
+- 23.9 |
+- 27.5 |
-
-
-- 31 |
-- 22.6 |
-- 23.0 |
-- 27.3 |
+- 31 |
+- 22.6 |
+- 23.0 |
+- 27.3 |
-
-
-
--
+-
- Qscale vs Compression
-
-
--
+-
- Qscale |
- I Frames |
- P Frames |
- B Frames |
-
-
-- 1 |
-- 2 |
-- 2 |
-- 2 |
+- 1 |
+- 2 |
+- 2 |
+- 2 |
-
-
-- 6 |
-- 7 |
-- 10 |
-- 15 |
+- 6 |
+- 7 |
+- 10 |
+- 15 |
-
-
-- 11 |
-- 11 |
-- 18 |
-- 43 |
+- 11 |
+- 11 |
+- 18 |
+- 43 |
-
-
-- 16 |
-- 15 |
-- 29 |
-- 97 |
+- 16 |
+- 15 |
+- 29 |
+- 97 |
-
-
-- 21 |
-- 19 |
-- 41 |
-- 173 |
+- 21 |
+- 19 |
+- 41 |
+- 173 |
-
-
-- 26 |
-- 24 |
-- 56 |
-- 256 |
+- 26 |
+- 24 |
+- 56 |
+- 256 |
-
-
-- 31 |
-- 28 |
-- 73 |
-- 330 |
+- 31 |
+- 28 |
+- 73 |
+- 330 |
-
-
-
-
--Search Techniques
+-Search Techniques
-
-There are several different motion vector search techniques
-available. There are different techniques available for P frame
@@ -925,71 +930,69 @@ index a1ce767..0000000
-P frame search, and Cross2 and Simple for B frame search. Here are
-some numbers comparing the different search methods:
-
--
+-
- P frame Motion Vector Search (Normalized)
-
-
--
+-
- Technique |
- Compression1 |
- Speed 2 |
- Quality 3 |
-
-
-- Exhaustive |
-- 1000 |
-- 1000 |
-- 1000 |
+- Exhaustive |
+- 1000 |
+- 1000 |
+- 1000 |
-
-
-- SubSample |
-- 1008 |
-- 2456 |
-- 1000 |
+- SubSample |
+- 1008 |
+- 2456 |
+- 1000 |
-
-
-- TwoLevel |
-- 1009 |
-- 3237 |
-- 1000 |
+- TwoLevel |
+- 1009 |
+- 3237 |
+- 1000 |
-
-
-- Logarithmic |
-- 1085 |
-- 8229 |
-- 998 |
+- Logarithmic |
+- 1085 |
+- 8229 |
+- 998 |
-
-
-
--
+-
- B frame Motion Vector Search (Normalized)
-
-
--
+-
- Technique |
- Compression1 |
- Speed2 |
- Quality3 |
-
-
-- Exhaustive |
-- 1000 |
-- 1000 |
-- 1000 |
+- Exhaustive |
+- 1000 |
+- 1000 |
+- 1000 |
-
-
-- Cross2 |
-- 975 |
-- 1000 |
-- 996 |
+- Cross2 |
+- 975 |
+- 1000 |
+- 996 |
-
-
-- Simple |
-- 938 |
-- 1765 |
-- 991 |
+- Simple |
+- 938 |
+- 1765 |
+- 991 |
-
-
-
@@ -1004,12 +1007,11 @@ index a1ce767..0000000
-For some reason, Simple seems to give better compression, but it
-depends on the image sequence.
-
--
Select the search techniques with the PSEARCH_ALG and
--BSEARCH_ALG parameter file statements.
+-
Select the search techniques with the PSEARCH_ALG and
+-BSEARCH_ALG parameter file statements.
-
-
--
--
Group Of Pictures (GOP)
+-Group Of Pictures (GOP)
-
-A Group of Pictures (GOP) is a roughly independently decodable
-sequence of frames. An MPEG video stream is made of one or more
@@ -1023,7 +1025,7 @@ index a1ce767..0000000
-with the -combine_gops command option.
-
-
--
Slices
+-Slices
-
-A slice is an independently decodable unit in a frame. It can be
-as small as one macroblock, or it can be as big as the entire frame.
@@ -1033,7 +1035,7 @@ index a1ce767..0000000
-usually errors are not such a problem, we usually just use one slice
-per frame.
-
--
Control the slice size with the SLICES_PER_FRAME parameter
+-
Control the slice size with the SLICES_PER_FRAME parameter
-file statement.
-
-
Some MPEG playback systems require that each slice consist of whole
@@ -1048,12 +1050,12 @@ index a1ce767..0000000
-
-
-
--
Search Window
+-Search Window
-
-The search window is the window in which ppmtompeg searches
-for motion vectors. The window is a square. You can specify the size
-of the square, and whether to allow half-pixel motion vectors or not,
--with the RANGE and PIXEL parameter file statements.
+-with the RANGE and PIXEL parameter file statements.
-
-
I Frames, P Frames, B Frames
-
@@ -1082,34 +1084,33 @@ index a1ce767..0000000
-affects speed, quality, and stream size. Here is a chart which shows
-some of the trade-offs:
-
--
+-
- Comparison of I/P/B Frames (Normalized)
-
-
--
+-
- Frame Type |
- Size |
- Speed |
- Quality |
-
-
-- I frames |
-- 1000 |
-- 1000 |
-- 1000 |
+- I frames |
+- 1000 |
+- 1000 |
+- 1000 |
-
-
-- P frames |
-- 409 |
-- 609 |
-- 969 |
+- P frames |
+- 409 |
+- 609 |
+- 969 |
-
-
-- B frames |
-- 72 |
-- 260 |
-- 919 |
+- B frames |
+- 72 |
+- 260 |
+- 919 |
-
-
-
@@ -1117,7 +1118,7 @@ index a1ce767..0000000
-
-A standard sequence is IBBPBBPBBPBBPBB.
-
--
Select the sequence with the PATTERN parameter file statement.
+-
Select the sequence with the PATTERN parameter file statement.
-
-
Since the last MPEG frame cannot be a B frame (see above), if the
-pattern you specify indicates a B frame for the last movie frame of
@@ -1138,17 +1139,17 @@ index a1ce767..0000000
-respectively.
-
-
--
Specifying Input and Output Files
+-Specifying Input and Output Files
-
--Specify the input frame images with the INPUT_DIR,
--INPUT, END_INPUT, BASE_FILE_FORMAT,
--SIZE, YUV_FORMAT and INPUT_CONVERT parameter
+-
Specify the input frame images with the INPUT_DIR,
+-INPUT, END_INPUT, BASE_FILE_FORMAT,
+-SIZE, YUV_FORMAT and INPUT_CONVERT parameter
-file statements.
-
-
Specify the output file with the OUTPUT parameter file statement.
-
-
--
Statistics
+-Statistics
-
-ppmtompeg can generate a variety of statistics about the
-encoding. See the -stat, -snr, -mv_histogram,
@@ -1156,9 +1157,9 @@ index a1ce767..0000000
-options.
-
-
--
PARALLEL OPERATION
+-PARALLEL OPERATION
-
--You can run ppmtompeg on multiple machines at once, encoding
+-
You can run ppmtompeg on multiple machines at once, encoding
-the same MPEG stream. When you do, the machines are used as shown in
-the following diagram. We call this "parallel mode."
-
@@ -1183,12 +1184,12 @@ index a1ce767..0000000
-
-machine user executable
-
--
The executable is normally ppmtompeg (you may need to give
+-
The executable is normally ppmtompeg (you may need to give
-the complete path if you've built for different architectures). If
-the machine does not have filesystem access to the input files, the line
-is:
-
--
REMOTE machine user executable
+-
REMOTE machine user executable
-parameter file
-
-
The -max_machines command option limits the number of
@@ -1205,8 +1206,8 @@ index a1ce767..0000000
-using an NFS filesystem, you must make sure it is mounted at the same
-mountpoint on all systems).
-
--
Because not all of the processes involved in parallel operation
--have easy access to the input files, you must specify the SIZE
+-
Because not all of the processes involved in parallel operation
+-have easy access to the input files, you must specify the SIZE
-parameter file statement when you do parallel operation.
-
-
The machine on which you originally invoke ppmtompeg is the
@@ -1238,39 +1239,38 @@ index a1ce767..0000000
-long-running CPU load will have minimal impact on other, possibly
-interactive, users of the systems.
-
--
--
SPEED
+-SPEED
-
-Here is a look at ppmtompeg speed, in single-node (not parallel)
-operation:
-
--
+-
- Compression Speed
-
-
--
+-
- Machine Type |
- Macroblocks per second1 |
-
-
-- HP 9000/755 |
-- 280 |
+- HP 9000/755 |
+- 280 |
-
-
-- DEC 3000/400 |
-- 247 |
+- DEC 3000/400 |
+- 247 |
-
-
-- HP 9000/750 |
-- 191 |
+- HP 9000/750 |
+- 191 |
-
-
-- Sparc 10 |
-- 104 |
+- Sparc 10 |
+- 104 |
-
-
-- DEC 5000 |
-- 68 |
+- DEC 5000 |
+- 68 |
-
-
-1A macroblock is a 16x16 pixel square
@@ -1295,42 +1295,54 @@ index a1ce767..0000000
-problems.
-
-
--AUTHORS
+-AUTHORS
-
--
+-
-
--- Kevin Gong - University of California, Berkeley, keving@cs.berkeley.edu
+-
- Kevin Gong - University of California, Berkeley, keving@cs.berkeley.edu
-
--
- Ketan Patel - University of California, Berkeley, kpatel@cs.berkeley.edu
+-
- Ketan Patel - University of California, Berkeley, kpatel@cs.berkeley.edu
-
--
- Dan Wallach - University of California, Berkeley, dwallach@cs.berkeley.edu
+-
- Dan Wallach - University of California, Berkeley, dwallach@cs.berkeley.edu
-
--
- Darryl Brown - University of California, Berkeley, darryl@cs.berkeley.edu
+-
- Darryl Brown - University of California, Berkeley, darryl@cs.berkeley.edu
-
--
- Eugene Hung - University of California, Berkeley, eyhung@cs.berkeley.edu
+-
- Eugene Hung - University of California, Berkeley, eyhung@cs.berkeley.edu
-
--
- Steve Smoot - University of California, Berkeley, smoot@cs.berkeley.edu
+-
- Steve Smoot - University of California, Berkeley, smoot@cs.berkeley.edu
-
--
+-
-
--
--
--Table Of Contents
--
--
--
+-
+-Table Of Contents
+-
+-
+-
diff --git a/netpbm-security-code.patch b/netpbm-security-code.patch
index d97b629..c092963 100644
--- a/netpbm-security-code.patch
+++ b/netpbm-security-code.patch
@@ -1602,7 +1602,7 @@ index fafcc91..9fe49d0 100644
planesize = cols * rows;
if ( !( sirarray = (unsigned char*) malloc( picsize ) ) )
diff --git a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c
-index 05493e7..26a5d7f 100644
+index 0c301a4..88c99e7 100644
--- a/converter/other/tifftopnm.c
+++ b/converter/other/tifftopnm.c
@@ -1372,7 +1372,9 @@ convertRasterByRows(pnmOut * const pnmOutP,
@@ -1617,7 +1617,7 @@ index 05493e7..26a5d7f 100644
pm_error("can't allocate memory for row buffer");
diff --git a/converter/other/xwdtopnm.c b/converter/other/xwdtopnm.c
-index a74da34..4d26a31 100644
+index a99768b..6e23aa6 100644
--- a/converter/other/xwdtopnm.c
+++ b/converter/other/xwdtopnm.c
@@ -210,6 +210,10 @@ processX10Header(X10WDFileHeader * const h10P,
@@ -2329,7 +2329,7 @@ index e252ba2..270ae3b 100644
if (headerCols > rawcols) {
pm_message("warning - BytesPerLine = %d, "
diff --git a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c
-index 9cf570e..6020f67 100644
+index 4bc5337..a5a0ad5 100644
--- a/converter/ppm/picttoppm.c
+++ b/converter/ppm/picttoppm.c
@@ -1,3 +1,4 @@
@@ -2338,12 +2338,15 @@ index 9cf570e..6020f67 100644
* picttoppm.c -- convert a MacIntosh PICT file to PPM format.
*
diff --git a/converter/ppm/pjtoppm.c b/converter/ppm/pjtoppm.c
-index ffb01d0..e7f9392 100644
+index e556803..c458c06 100644
--- a/converter/ppm/pjtoppm.c
+++ b/converter/ppm/pjtoppm.c
-@@ -11,87 +11,65 @@
+@@ -10,98 +10,66 @@
+ ** implied warranty.
*/
+-#include
+-
#include "ppm.h"
-#include "pm_c_util.h"
#include "mallocvar.h"
@@ -2393,13 +2396,19 @@ index ffb01d0..e7f9392 100644
+{
int cmd, val;
char buffer[BUFSIZ];
- int planes = 3, rows = -1, cols = -1;
+- int planes = 3;
+- unsigned int rows;
+- unsigned int rowsX;
+- unsigned int cols;
+- bool colsIsSet;
++ int planes = 3, rows = -1, cols = -1;
+ int r = 0, c = 0, p = 0, i;
unsigned char **image = NULL;
int *imlen;
- FILE * ifP;
+ FILE *fp = stdin;
int mode;
+- bool modeIsSet;
int argn;
unsigned char bf[3];
- pixel * pixrow;
@@ -2424,6 +2433,9 @@ index ffb01d0..e7f9392 100644
- row = 0; /* initial value */
- plane = 0; /* initial value */
+- modeIsSet = false; /* initial value */
+- colsIsSet = false; /* initial value */
+- rowsX = 0; /* initial value */
-
- while ((c = fgetc(ifP)) != -1) {
+ while ((c = fgetc(fp)) != -1) {
@@ -2451,33 +2463,54 @@ index ffb01d0..e7f9392 100644
pm_error("bad value `%s' at *%c%c", buffer, cmd, c);
}
else
-@@ -122,7 +100,7 @@ main(int argc, const char ** argv) {
+@@ -125,18 +93,18 @@ main(int argc, const char ** argv) {
+ case 'r':
+ switch (c) {
+ case 'S': /* width */
+- if (val < 0)
++ if (val < 0) {
+ pm_error("invalid width value");
+- else {
++ } else {
+ cols = val;
+- colsIsSet = true;
+ }
+ break;
+ case 'T': /* height */
+- if (val < 0)
++ if (val < 0) {
+ pm_error ("invalid height value");
+- else
+- rowsX = val;
++ } else {
++ rows = val;
++ }
break;
case 'U': /* planes */
planes = val;
-- if (planes != 3)
-+ if (planes != 3)
- pm_error("can handle only 3 plane files");
- break;
- case 'A': /* begin raster */
-@@ -148,33 +126,40 @@ main(int argc, const char ** argv) {
+@@ -163,40 +131,43 @@ main(int argc, const char ** argv) {
+ if (val != 0 && val != 1)
+ pm_error("unimplemented transmission mode %d", val);
+ mode = val;
+- modeIsSet = true;
break;
case 'V': /* send plane */
case 'W': /* send last plane */
-- if (rows == -1 || row >= rows || image == NULL) {
-- if (rows == -1 || row >= rows)
+- if (row >= rowsX || image == NULL) {
+- if (row >= rowsX)
+- rowsX += 100;
+ if (rows == -1 || r >= rows || image == NULL) {
+ if (rows == -1 || r >= rows) {
+ overflow_add(rows, 100);
- rows += 100;
++ rows += 100;
+ }
+
if (image == NULL) {
-- MALLOCARRAY(image, uintProduct(rows, planes));
-- MALLOCARRAY(imlen, uintProduct(rows, planes));
+- MALLOCARRAY(image, uintProduct(rowsX, planes));
+- MALLOCARRAY(imlen, uintProduct(rowsX, planes));
- } else {
-- REALLOCARRAY(image, uintProduct(rows, planes));
-- REALLOCARRAY(imlen, uintProduct(rows, planes));
+- REALLOCARRAY(image, uintProduct(rowsX, planes));
+- REALLOCARRAY(imlen, uintProduct(rowsX, planes));
+ image = (unsigned char **)
+ malloc3(rows , planes , sizeof(unsigned char *));
+ imlen = (int *) malloc3(rows , planes, sizeof(int));
@@ -2494,6 +2527,9 @@ index ffb01d0..e7f9392 100644
- if (plane >= planes)
+ if (p == planes)
pm_error("too many planes");
+- if (!colsIsSet)
+- pm_error("missing width value");
+-
- cols = MAX(cols, val);
- imlen[row * planes + plane] = val;
- MALLOCARRAY(image[row * planes + plane], val);
@@ -2517,7 +2553,7 @@ index ffb01d0..e7f9392 100644
}
break;
default:
-@@ -183,7 +168,7 @@ main(int argc, const char ** argv) {
+@@ -205,7 +176,7 @@ main(int argc, const char ** argv) {
}
break;
case 'p': /* Position */
@@ -2526,7 +2562,7 @@ index ffb01d0..e7f9392 100644
pm_error("changed position in the middle of "
"transferring planes");
switch (c) {
-@@ -192,15 +177,15 @@ main(int argc, const char ** argv) {
+@@ -214,15 +185,15 @@ main(int argc, const char ** argv) {
break;
case 'Y':
if (buffer[0] == '+')
@@ -2549,7 +2585,7 @@ index ffb01d0..e7f9392 100644
break;
default:
pm_message("uninmplemented *%c%d%c", cmd, val, c);
-@@ -209,80 +194,65 @@ main(int argc, const char ** argv) {
+@@ -231,86 +202,65 @@ main(int argc, const char ** argv) {
default:
pm_message("uninmplemented *%c%d%c", cmd, val, c);
break;
@@ -2560,11 +2596,17 @@ index ffb01d0..e7f9392 100644
+ }
}
- pm_close(ifP);
+-
+- if (!modeIsSet)
+- pm_error("Input does not contain a 'bM' transmission mode order");
+-
- rows = row;
+ pm_close(fp);
+ rows = r;
if (mode == 1) {
-- int const newcols = 10240; /* It could not be larger that that! */
+- unsigned int const newcols = 10240;
+- /* It could not be larger than that! */
+-
- unsigned char * buf;
- unsigned int row;
-
@@ -2709,18 +2751,855 @@ index 50b790d..63d3182 100644
medias.maxrows *= 2;
}
diff --git a/converter/ppm/ppmtopcx.c b/converter/ppm/ppmtopcx.c
-index 76f0629..e7b06ff 100644
+index 5b7e100..e7b06ff 100644
--- a/converter/ppm/ppmtopcx.c
+++ b/converter/ppm/ppmtopcx.c
-@@ -422,6 +422,8 @@ ppmTo16ColorPcx(pixel ** const pixels,
- else Planes = 1;
+@@ -31,13 +31,13 @@
+ #define PCX_MAXVAL (pixval)255
+
+
+-struct CmdlineInfo {
++struct cmdlineInfo {
+ /* All the information the user supplied in the command line,
+ in a form easy for the program to use.
+ */
+- const char * inputFilespec; /* '-' if stdin */
++ const char *inputFilespec; /* '-' if stdin */
+ unsigned int truecolor; /* -24bit option */
+- unsigned int use8Bit; /* -8bit option */
++ unsigned int use_8_bit; /* -8bit option */
+ unsigned int planes; /* zero means minimum */
+ unsigned int packed;
+ unsigned int verbose;
+@@ -49,16 +49,16 @@ struct CmdlineInfo {
+
+
+
+-struct PcxCmapEntry {
++struct pcxCmapEntry {
+ unsigned char r;
+ unsigned char g;
+ unsigned char b;
+ };
+
+-static struct PcxCmapEntry
++static struct pcxCmapEntry
+ pcxCmapEntryFromPixel(pixel const colorPixel) {
+
+- struct PcxCmapEntry retval;
++ struct pcxCmapEntry retval;
+
+ retval.r = PPM_GETR(colorPixel);
+ retval.g = PPM_GETG(colorPixel);
+@@ -70,8 +70,8 @@ pcxCmapEntryFromPixel(pixel const colorPixel) {
+
+
+ static void
+-parseCommandLine(int argc, const char ** argv,
+- struct CmdlineInfo * const cmdlineP) {
++parseCommandLine(int argc, char ** argv,
++ struct cmdlineInfo * const cmdlineP) {
+ /*----------------------------------------------------------------------------
+ parse program command line described in Unix standard form by argc
+ and argv. Return the information in the options as *cmdlineP.
+@@ -82,7 +82,7 @@ parseCommandLine(int argc, const char ** argv,
+ Note that the strings we return are stored in the storage that
+ was passed to us as the argv array. We also trash *argv.
+ -----------------------------------------------------------------------------*/
+- optEntry * option_def;
++ optEntry *option_def;
+ /* Instructions to pm_optParseOptions3 on how to parse our options.
+ */
+ optStruct3 opt;
+@@ -97,7 +97,7 @@ parseCommandLine(int argc, const char ** argv,
+ OPTENT3(0, "24bit", OPT_FLAG, NULL,
+ &cmdlineP->truecolor, 0);
+ OPTENT3(0, "8bit", OPT_FLAG, NULL,
+- &cmdlineP->use8Bit, 0);
++ &cmdlineP->use_8_bit, 0);
+ OPTENT3(0, "planes", OPT_UINT, &cmdlineP->planes,
+ &planesSpec, 0);
+ OPTENT3(0, "packed", OPT_FLAG, NULL,
+@@ -115,7 +115,7 @@ parseCommandLine(int argc, const char ** argv,
+ opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */
+ opt.allowNegNum = FALSE; /* We have no parms that are negative numbers */
+
+- pm_optParseOptions3( &argc, (char **)argv, opt, sizeof(opt), 0 );
++ pm_optParseOptions3( &argc, argv, opt, sizeof(opt), 0 );
+ /* Uses and sets argc, argv, and some of *cmdline_p and others. */
+
+ if (!xposSpec)
+@@ -141,7 +141,7 @@ parseCommandLine(int argc, const char ** argv,
+ pm_error("-planes is meaningless with -packed.");
+ if (cmdlineP->truecolor)
+ pm_error("-planes is meaningless with -24bit");
+- if (cmdlineP->use8Bit)
++ if (cmdlineP->use_8_bit)
+ pm_error("-planes is meaningless with -8bit");
+ }
+
+@@ -151,7 +151,7 @@ parseCommandLine(int argc, const char ** argv,
+ if (!paletteSpec)
+ cmdlineP->palette = NULL;
+
+- if (cmdlineP->use8Bit && cmdlineP->truecolor)
++ if (cmdlineP->use_8_bit && cmdlineP->truecolor)
+ pm_error("You cannot specify both -8bit and -truecolor");
+
+ if (argc-1 < 1)
+@@ -172,8 +172,8 @@ parseCommandLine(int argc, const char ** argv,
+ * Write out a two-byte little-endian word to the PCX file
+ */
+ static void
+-putword(unsigned int const w,
+- FILE * const fp) {
++Putword(int const w,
++ FILE * const fp) {
+
+ int rc;
+
+@@ -189,13 +189,12 @@ putword(unsigned int const w,
+ * Write out a byte to the PCX file
+ */
+ static void
+-putbyte(unsigned int const b,
+- FILE * const ofP) {
++Putbyte(int const b,
++ FILE * const fp) {
+
+ int rc;
+
+- rc = fputc(b & 0xff, ofP);
+-
++ rc = fputc(b & 0xff, fp);
+ if (rc == EOF)
+ pm_error("Error writing byte to output file.");
+ }
+@@ -204,9 +203,9 @@ putbyte(unsigned int const b,
+
+ static void
+ extractPlane(unsigned char * const rawrow,
+- unsigned int const cols,
++ int const cols,
+ unsigned char * const buf,
+- unsigned int const plane) {
++ int const plane) {
+ /*----------------------------------------------------------------------------
+ From the image row 'rawrow', which is an array of 'cols' palette indices
+ (as unsigned 8 bit integers), extract plane number 'plane' and return
+@@ -224,7 +223,9 @@ extractPlane(unsigned char * const rawrow,
+
+ cp = buf; /* initial value */
+
+- for (col = 0, cbit = 7, byteUnderConstruction = 0x00; col < cols; ++col) {
++ cbit = 7;
++ byteUnderConstruction = 0x00;
++ for (col = 0; col < cols; ++col) {
+ if (rawrow[col] & planeMask)
+ byteUnderConstruction |= (1 << cbit);
+
+@@ -246,17 +247,14 @@ extractPlane(unsigned char * const rawrow,
+
+
+ static void
+-packBits(unsigned char * const rawrow,
+- unsigned int const width,
++PackBits(unsigned char * const rawrow,
++ int const width,
+ unsigned char * const buf,
+- unsigned int const bits) {
++ int const bits) {
+
+- unsigned int x;
+- int i;
+- int shift;
++ int x, i, shift;
+
+- shift = -1;
+- i = -1;
++ shift = i = -1;
+
+ for (x = 0; x < width; ++x) {
+ if (shift < 0) {
+@@ -272,73 +270,71 @@ packBits(unsigned char * const rawrow,
+
+
+ static void
+-writeHeader(FILE * const ofP,
+- unsigned int const cols,
+- unsigned int const rows,
+- unsigned int const bitsPerPixel,
+- unsigned int const planes,
+- struct PcxCmapEntry const cmap16[],
+- unsigned int const xPos,
+- unsigned int const yPos) {
+-
+- unsigned int bytesPerLine;
+-
+- putbyte(PCX_MAGIC, ofP); /* .PCX magic number */
+- putbyte(0x05, ofP); /* PC Paintbrush version */
+- putbyte(0x01, ofP); /* .PCX run length encoding */
+- putbyte(bitsPerPixel, ofP); /* bits per pixel */
+-
+- putword(xPos, ofP); /* x1 - image left */
+- putword(yPos, ofP); /* y1 - image top */
+- putword(xPos+cols-1, ofP); /* x2 - image right */
+- putword(yPos+rows-1, ofP); /* y2 - image bottom */
+-
+- putword(cols, ofP); /* horizontal resolution */
+- putword(rows, ofP); /* vertical resolution */
++write_header(FILE * const fp,
++ int const cols,
++ int const rows,
++ int const BitsPerPixel,
++ int const Planes,
++ struct pcxCmapEntry const cmap16[],
++ unsigned int const xPos,
++ unsigned int const yPos) {
++
++ int i, BytesPerLine;
++
++ Putbyte(PCX_MAGIC, fp); /* .PCX magic number */
++ Putbyte(0x05, fp); /* PC Paintbrush version */
++ Putbyte(0x01, fp); /* .PCX run length encoding */
++ Putbyte(BitsPerPixel, fp); /* bits per pixel */
++
++ Putword(xPos, fp); /* x1 - image left */
++ Putword(yPos, fp); /* y1 - image top */
++ Putword(xPos+cols-1, fp); /* x2 - image right */
++ Putword(yPos+rows-1, fp); /* y2 - image bottom */
++
++ Putword(cols, fp); /* horizontal resolution */
++ Putword(rows, fp); /* vertical resolution */
+
+ /* Write out the Color Map for images with 16 colors or less */
+- if (cmap16) {
+- unsigned int i;
++ if (cmap16)
+ for (i = 0; i < 16; ++i) {
+- putbyte(cmap16[i].r, ofP);
+- putbyte(cmap16[i].g, ofP);
+- putbyte(cmap16[i].b, ofP);
++ Putbyte(cmap16[i].r, fp);
++ Putbyte(cmap16[i].g, fp);
++ Putbyte(cmap16[i].b, fp);
+ }
+- } else {
++ else {
+ unsigned int i;
+ for (i = 0; i < 16; ++i) {
+- putbyte(0, ofP);
+- putbyte(0, ofP);
+- putbyte(0, ofP);
++ Putbyte(0, fp);
++ Putbyte(0, fp);
++ Putbyte(0, fp);
}
}
+- putbyte(0, ofP); /* reserved byte */
+- putbyte(planes, ofP); /* number of color planes */
++ Putbyte(0, fp); /* reserved byte */
++ Putbyte(Planes, fp); /* number of color planes */
+
+- bytesPerLine = ((cols * bitsPerPixel) + 7) / 8;
+- putword(bytesPerLine, ofP); /* number of bytes per scanline */
++ BytesPerLine = ((cols * BitsPerPixel) + 7) / 8;
++ Putword(BytesPerLine, fp); /* number of bytes per scanline */
+
+- putword(1, ofP); /* palette info */
++ Putword(1, fp); /* palette info */
+
+ {
+ unsigned int i;
+ for (i = 0; i < 58; ++i) /* fill to end of header */
+- putbyte(0, ofP);
++ Putbyte(0, fp);
+ }
+ }
+
+
+
+ static void
+-pcxEncode(FILE * const ofP,
++PCXEncode(FILE * const fp,
+ const unsigned char * const buf,
+- unsigned int const size) {
++ int const Size) {
+
+- const unsigned char * const end = buf + size;
++ const unsigned char * const end = buf + Size;
+
+ const unsigned char * currentP;
+- unsigned int previous;
+- unsigned int count;
++ int previous, count;
+
+ currentP = buf;
+ previous = *currentP++;
+@@ -351,19 +347,19 @@ pcxEncode(FILE * const ofP,
+ else {
+ if (count > 1 || (previous & 0xc0) == 0xc0) {
+ count |= 0xc0;
+- putbyte ( count , ofP );
++ Putbyte ( count , fp );
+ }
+- putbyte(previous, ofP);
++ Putbyte(previous, fp);
+ previous = c;
+- count = 1;
++ count = 1;
+ }
+ }
+
+ if (count > 1 || (previous & 0xc0) == 0xc0) {
+ count |= 0xc0;
+- putbyte(count, ofP);
++ Putbyte ( count , fp );
+ }
+- putbyte(previous, ofP);
++ Putbyte(previous, fp);
+ }
+
+
+@@ -390,46 +386,63 @@ indexOfColor(colorhash_table const cht,
+
+
+ static void
+-writeRaster16Color(FILE * const ofP,
+- pixel ** const pixels,
+- unsigned int const cols,
+- unsigned int const rows,
+- unsigned int const planes,
+- colorhash_table const cht,
+- bool const packbits,
+- unsigned int const bitsPerPixel) {
+-
+- unsigned int const bytesPerLine = ((cols * bitsPerPixel) + 7) / 8;
+-
+- unsigned char * indexRow; /* malloc'ed */
+- /* indexRow[x] is the palette index of the pixel at column x of
+- the row currently being processed
+- */
+- unsigned char * planesrow; /* malloc'ed */
+- /* This is the input for a single row to the compressor */
++ppmTo16ColorPcx(pixel ** const pixels,
++ int const cols,
++ int const rows,
++ struct pcxCmapEntry const pcxcmap[],
++ int const colors,
++ colorhash_table const cht,
++ bool const packbits,
++ unsigned int const planesRequested,
++ unsigned int const xPos,
++ unsigned int const yPos) {
+
+- unsigned int row;
++ int Planes, BytesPerLine, BitsPerPixel;
++ unsigned char *indexRow; /* malloc'ed */
++ /* indexRow[x] is the palette index of the pixel at column x of
++ the row currently being processed
++ */
++ unsigned char *planesrow; /* malloc'ed */
++ /* This is the input for a single row to the compressor */
++ int row;
+
++ if (packbits) {
++ Planes = 1;
++ if (colors > 4) BitsPerPixel = 4;
++ else if (colors > 2) BitsPerPixel = 2;
++ else BitsPerPixel = 1;
++ } else {
++ BitsPerPixel = 1;
++ if (planesRequested)
++ Planes = planesRequested;
++ else {
++ if (colors > 8) Planes = 4;
++ else if (colors > 4) Planes = 3;
++ else if (colors > 2) Planes = 2;
++ else Planes = 1;
++ }
++ }
+ overflow2(BitsPerPixel, cols);
+ overflow_add(BitsPerPixel * cols, 7);
- BytesPerLine = ((cols * BitsPerPixel) + 7) / 8;
++ BytesPerLine = ((cols * BitsPerPixel) + 7) / 8;
MALLOCARRAY_NOFAIL(indexRow, cols);
- MALLOCARRAY_NOFAIL(planesrow, BytesPerLine);
+- MALLOCARRAY(planesrow, bytesPerLine);
+-
+- if (!planesrow)
+- pm_error("Failed to allocate buffer for a line of %u bytes",
+- bytesPerLine);
++ MALLOCARRAY_NOFAIL(planesrow, BytesPerLine);
+
++ write_header(stdout, cols, rows, BitsPerPixel, Planes, pcxcmap,
++ xPos, yPos);
+ for (row = 0; row < rows; ++row) {
+- unsigned int col;
++ int col;
+ for (col = 0; col < cols; ++col)
+ indexRow[col] = indexOfColor(cht, pixels[row][col]);
+
+ if (packbits) {
+- packBits(indexRow, cols, planesrow, bitsPerPixel);
+- pcxEncode(ofP, planesrow, bytesPerLine);
++ PackBits(indexRow, cols, planesrow, BitsPerPixel);
++ PCXEncode(stdout, planesrow, BytesPerLine);
+ } else {
+ unsigned int plane;
+- for (plane = 0; plane < planes; ++plane) {
++ for (plane = 0; plane < Planes; ++plane) {
+ extractPlane(indexRow, cols, planesrow, plane);
+- pcxEncode(stdout, planesrow, bytesPerLine);
++ PCXEncode(stdout, planesrow, BytesPerLine);
+ }
+ }
+ }
+@@ -439,143 +452,84 @@ writeRaster16Color(FILE * const ofP,
+
+
+
+-static void
+-ppmTo16ColorPcx(pixel ** const pixels,
+- unsigned int const cols,
+- unsigned int const rows,
+- struct PcxCmapEntry const pcxcmap[],
+- unsigned int const colorCt,
+- colorhash_table const cht,
+- bool const packbits,
+- unsigned int const planesRequested,
+- unsigned int const xPos,
+- unsigned int const yPos) {
+-
+- unsigned int planes;
+- unsigned int bitsPerPixel;
+-
+- if (packbits) {
+- planes = 1;
+- if (colorCt > 4) bitsPerPixel = 4;
+- else if (colorCt > 2) bitsPerPixel = 2;
+- else bitsPerPixel = 1;
+- } else {
+- bitsPerPixel = 1;
+- if (planesRequested)
+- planes = planesRequested;
+- else {
+- if (colorCt > 8) planes = 4;
+- else if (colorCt > 4) planes = 3;
+- else if (colorCt > 2) planes = 2;
+- else planes = 1;
+- }
+- }
+-
+- writeHeader(stdout, cols, rows, bitsPerPixel, planes, pcxcmap,
+- xPos, yPos);
+-
+- writeRaster16Color(stdout, pixels, cols, rows, planes, cht, packbits,
+- bitsPerPixel);
+-}
+-
+-
+-
+ static void
+ ppmTo256ColorPcx(pixel ** const pixels,
+- unsigned int const cols,
+- unsigned int const rows,
+- struct PcxCmapEntry const pcxcmap[],
+- unsigned int const colorCt,
++ int const cols,
++ int const rows,
++ struct pcxCmapEntry const pcxcmap[],
++ int const colors,
+ colorhash_table const cht,
+ unsigned int const xPos,
+ unsigned int const yPos) {
+
+- unsigned char * rawrow;
+- unsigned int row;
+-
+- MALLOCARRAY(rawrow, cols);
++ int row;
++ unsigned int i;
++ unsigned char *rawrow;
+
+- if (!rawrow)
+- pm_error("Failed to allocate a buffer for %u columns", cols);
++ rawrow = (unsigned char *)pm_allocrow(cols, sizeof(unsigned char));
+
+ /* 8 bits per pixel, 1 plane */
+- writeHeader(stdout, cols, rows, 8, 1, NULL, xPos, yPos);
++ write_header(stdout, cols, rows, 8, 1, NULL, xPos, yPos);
+ for (row = 0; row < rows; ++row) {
+- unsigned int col;
++ int col;
+ for (col = 0; col < cols; ++col)
+ rawrow[col] = indexOfColor(cht, pixels[row][col]);
+- pcxEncode(stdout, rawrow, cols);
+-
++ PCXEncode(stdout, rawrow, cols);
+ }
+- putbyte(PCX_256_COLORS, stdout);
+-
+- {
+- unsigned int i;
+-
+- for (i = 0; i < MAXCOLORS; ++i) {
+- putbyte(pcxcmap[i].r, stdout);
+- putbyte(pcxcmap[i].g, stdout);
+- putbyte(pcxcmap[i].b, stdout);
+- }
++ Putbyte(PCX_256_COLORS, stdout);
++ for (i = 0; i < MAXCOLORS; ++i) {
++ Putbyte(pcxcmap[i].r, stdout);
++ Putbyte(pcxcmap[i].g, stdout);
++ Putbyte(pcxcmap[i].b, stdout);
+ }
+- free(rawrow);
++ pm_freerow((void*)rawrow);
+ }
+
+
+
+ static void
+ ppmToTruecolorPcx(pixel ** const pixels,
+- unsigned int const cols,
+- unsigned int const rows,
++ int const cols,
++ int const rows,
+ pixval const maxval,
+ unsigned int const xPos,
+ unsigned int const yPos) {
+
+- unsigned char * redrow;
+- unsigned char * grnrow;
+- unsigned char * blurow;
+- unsigned int row;
++ unsigned char *redrow, *greenrow, *bluerow;
++ int col, row;
+
+- MALLOCARRAY(redrow, cols);
+- MALLOCARRAY(grnrow, cols);
+- MALLOCARRAY(blurow, cols);
+-
+- if (!redrow || !grnrow || !blurow)
+- pm_error("Unable to allocate buffer for a row of %u pixels", cols);
++ redrow = (unsigned char *)pm_allocrow(cols, sizeof(unsigned char));
++ greenrow = (unsigned char *)pm_allocrow(cols, sizeof(unsigned char));
++ bluerow = (unsigned char *)pm_allocrow(cols, sizeof(unsigned char));
+
+ /* 8 bits per pixel, 3 planes */
+- writeHeader(stdout, cols, rows, 8, 3, NULL, xPos, yPos);
+-
+- for (row = 0; row < rows; ++row) {
+- pixel * const pixrow = pixels[row];
+-
+- unsigned int col;
+-
+- for (col = 0; col < cols; ++col) {
+- pixel const pix = pixrow[col];
+-
+- if (maxval != PCX_MAXVAL) {
+- redrow[col] = (long)PPM_GETR(pix) * PCX_MAXVAL / maxval;
+- grnrow[col] = (long)PPM_GETG(pix) * PCX_MAXVAL / maxval;
+- blurow[col] = (long)PPM_GETB(pix) * PCX_MAXVAL / maxval;
+- } else {
+- redrow[col] = PPM_GETR(pix);
+- grnrow[col] = PPM_GETG(pix);
+- blurow[col] = PPM_GETB(pix);
++ write_header(stdout, cols, rows, 8, 3, NULL, xPos, yPos);
++ for( row = 0; row < rows; row++ ) {
++ register pixel *pP = pixels[row];
++ for( col = 0; col < cols; col++, pP++ ) {
++ if( maxval != PCX_MAXVAL ) {
++ redrow[col] = (long)PPM_GETR(*pP) * PCX_MAXVAL / maxval;
++ greenrow[col] = (long)PPM_GETG(*pP) * PCX_MAXVAL / maxval;
++ bluerow[col] = (long)PPM_GETB(*pP) * PCX_MAXVAL / maxval;
++ }
++ else {
++ redrow[col] = PPM_GETR(*pP);
++ greenrow[col] = PPM_GETG(*pP);
++ bluerow[col] = PPM_GETB(*pP);
+ }
+ }
+- pcxEncode(stdout, redrow, cols);
+- pcxEncode(stdout, grnrow, cols);
+- pcxEncode(stdout, blurow, cols);
++ PCXEncode(stdout, redrow, cols);
++ PCXEncode(stdout, greenrow, cols);
++ PCXEncode(stdout, bluerow, cols);
+ }
+- free(blurow);
+- free(grnrow);
+- free(redrow);
++ pm_freerow((void*)bluerow);
++ pm_freerow((void*)greenrow);
++ pm_freerow((void*)redrow);
+ }
+
+
+
+-static const struct PcxCmapEntry
++static const struct pcxCmapEntry
+ stdPalette[] = {
+ { 0, 0, 0 },
+ { 0, 0, 170 },
+@@ -653,19 +607,20 @@ putPcxColorInHash(colorhash_table const cht,
+
+
+ static void
+-generateStandardPalette(struct PcxCmapEntry ** const pcxcmapP,
++generateStandardPalette(struct pcxCmapEntry ** const pcxcmapP,
+ pixval const maxval,
+ colorhash_table * const chtP,
+- unsigned int * const colorsP) {
++ int * const colorsP) {
+
+ unsigned int const stdPaletteSize = 16;
+-
+- unsigned int colorIndex;
+- struct PcxCmapEntry * pcxcmap;
+- colorhash_table cht;
++ unsigned int colorIndex;
++ struct pcxCmapEntry * pcxcmap;
++ colorhash_table cht;
+
+ MALLOCARRAY_NOFAIL(pcxcmap, MAXCOLORS);
+
++ *pcxcmapP = pcxcmap;
++
+ cht = ppm_alloccolorhash();
+
+ for (colorIndex = 0; colorIndex < stdPaletteSize; ++colorIndex) {
+@@ -692,7 +647,6 @@ generateStandardPalette(struct PcxCmapEntry ** const pcxcmapP,
+ pcxcmap[colorIndex].b = 0;
+ }
+
+- *pcxcmapP = pcxcmap;
+ *chtP = cht;
+ *colorsP = stdPaletteSize;
+ }
+@@ -721,10 +675,11 @@ readPpmPalette(const char * const paletteFileName,
+ *paletteSizeP, MAXCOLORS);
+
+ {
+- unsigned int j;
+- unsigned int row;
+- for (row = 0, j = 0; row < rows; ++row) {
+- unsigned int col;
++ int j;
++ int row;
++ j = 0; /* initial value */
++ for (row = 0; row < rows; ++row) {
++ int col;
+ for (col = 0; col < cols; ++col)
+ (*ppmPaletteP)[j++] = pixels[row][col];
+ }
+@@ -735,16 +690,16 @@ readPpmPalette(const char * const paletteFileName,
+
+
+ static void
+-readPaletteFromFile(struct PcxCmapEntry ** const pcxcmapP,
++readPaletteFromFile(struct pcxCmapEntry ** const pcxcmapP,
+ const char * const paletteFileName,
+ pixval const maxval,
+ colorhash_table * const chtP,
+- unsigned int * const colorsP) {
++ int * const colorsP) {
+
+ unsigned int colorIndex;
+ pixel ppmPalette[MAXCOLORS];
+ unsigned int paletteSize;
+- struct PcxCmapEntry * pcxcmap;
++ struct pcxCmapEntry * pcxcmap;
+ colorhash_table cht;
+
+ readPpmPalette(paletteFileName, &ppmPalette, &paletteSize);
+@@ -777,7 +732,7 @@ readPaletteFromFile(struct PcxCmapEntry ** const pcxcmapP,
+
+ static void
+ moveBlackToIndex0(colorhist_vector const chv,
+- unsigned int const colorCt) {
++ int const colors) {
+ /*----------------------------------------------------------------------------
+ If black is in the palette, make it at Index 0.
+ -----------------------------------------------------------------------------*/
+@@ -789,7 +744,7 @@ moveBlackToIndex0(colorhist_vector const chv,
+
+ blackPresent = FALSE; /* initial assumption */
+
+- for (i = 0; i < colorCt; ++i)
++ for (i = 0; i < colors; ++i)
+ if (PPM_EQUAL(chv[i].color, blackPixel))
+ blackPresent = TRUE;
+
+@@ -798,11 +753,10 @@ moveBlackToIndex0(colorhist_vector const chv,
+ beginning of the table and if the color is already elsewhere in
+ the table, removes it.
+ */
+- int colorCt2;
+-
+- colorCt2 = colorCt;
+- ppm_addtocolorhist(chv, &colorCt2, MAXCOLORS, &blackPixel, 0, 0);
+- assert(colorCt2 == colorCt);
++ int colors2;
++ colors2 = colors;
++ ppm_addtocolorhist(chv, &colors2, MAXCOLORS, &blackPixel, 0, 0);
++ assert(colors2 == colors);
+ }
+ }
+
+@@ -810,12 +764,12 @@ moveBlackToIndex0(colorhist_vector const chv,
+
+ static void
+ makePcxColormapFromImage(pixel ** const pixels,
+- unsigned int const cols,
+- unsigned int const rows,
++ int const cols,
++ int const rows,
+ pixval const maxval,
+- struct PcxCmapEntry ** const pcxcmapP,
++ struct pcxCmapEntry ** const pcxcmapP,
+ colorhash_table * const chtP,
+- unsigned int * const colorCtP,
++ int * const colorsP,
+ bool * const tooManyColorsP) {
+ /*----------------------------------------------------------------------------
+ Make a colormap (palette) for the PCX header that can be used
+@@ -831,29 +785,29 @@ makePcxColormapFromImage(pixel ** const pixels,
+ Iff there are too many colors to do that (i.e. more than 256),
+ return *tooManyColorsP == TRUE.
+ -----------------------------------------------------------------------------*/
+- int colorCt;
++ int colors;
+ colorhist_vector chv;
+
+ pm_message("computing colormap...");
+
+- chv = ppm_computecolorhist(pixels, cols, rows, MAXCOLORS, &colorCt);
++ chv = ppm_computecolorhist(pixels, cols, rows, MAXCOLORS, &colors);
+ if (chv == NULL)
+ *tooManyColorsP = TRUE;
+ else {
+- unsigned int i;
+- struct PcxCmapEntry * pcxcmap;
++ int i;
++ struct pcxCmapEntry * pcxcmap;
+
+ *tooManyColorsP = FALSE;
+
+- pm_message("%d colors found", colorCt);
++ pm_message("%d colors found", colors);
+
+- moveBlackToIndex0(chv, colorCt);
++ moveBlackToIndex0(chv, colors);
+
+ MALLOCARRAY_NOFAIL(pcxcmap, MAXCOLORS);
+
+ *pcxcmapP = pcxcmap;
+
+- for (i = 0; i < colorCt; ++i) {
++ for (i = 0; i < colors; ++i) {
+ pixel p;
+
+ PPM_DEPTH(p, chv[i].color, maxval, PCX_MAXVAL);
+@@ -870,9 +824,9 @@ makePcxColormapFromImage(pixel ** const pixels,
+ pcxcmap[i].b = 0;
+ }
+
+- *chtP = ppm_colorhisttocolorhash(chv, colorCt);
++ *chtP = ppm_colorhisttocolorhash(chv, colors);
+
+- *colorCtP = colorCt;
++ *colorsP = colors;
+
+ ppm_freecolorhist(chv);
+ }
+@@ -882,43 +836,43 @@ makePcxColormapFromImage(pixel ** const pixels,
+
+ static void
+ ppmToPalettePcx(pixel ** const pixels,
+- unsigned int const cols,
+- unsigned int const rows,
++ int const cols,
++ int const rows,
+ pixval const maxval,
+ unsigned int const xPos,
+ unsigned int const yPos,
+- struct PcxCmapEntry const pcxcmap[],
++ struct pcxCmapEntry const pcxcmap[],
+ colorhash_table const cht,
+- unsigned int const colorCt,
++ int const colors,
+ bool const packbits,
+ unsigned int const planes,
+- bool const use8Bit) {
++ bool const use_8_bit) {
+
+ /* convert image */
+- if (colorCt <= 16 && !use8Bit )
+- ppmTo16ColorPcx(pixels, cols, rows, pcxcmap, colorCt, cht,
++ if( colors <= 16 && !use_8_bit )
++ ppmTo16ColorPcx(pixels, cols, rows, pcxcmap, colors, cht,
+ packbits, planes, xPos, yPos);
+ else
+- ppmTo256ColorPcx(pixels, cols, rows, pcxcmap, colorCt, cht,
++ ppmTo256ColorPcx(pixels, cols, rows, pcxcmap, colors, cht,
+ xPos, yPos);
+ }
+
+
+
+ int
+-main(int argc, const char *argv[]) {
++main(int argc, char *argv[]) {
+
+- struct CmdlineInfo cmdline;
+- FILE * ifP;
++ struct cmdlineInfo cmdline;
++ FILE* ifP;
+ int rows, cols;
+ pixval maxval;
+ pixel **pixels;
+- struct PcxCmapEntry * pcxcmap;
++ struct pcxCmapEntry * pcxcmap;
+ colorhash_table cht;
+ bool truecolor;
+- unsigned int colorCt;
++ int colors;
+
+- pm_proginit(&argc, argv);
++ ppm_init(&argc, argv);
+
+ parseCommandLine(argc, argv, &cmdline);
+
+@@ -931,15 +885,15 @@ main(int argc, const char *argv[]) {
+ else {
+ if (cmdline.stdpalette) {
+ truecolor = FALSE;
+- generateStandardPalette(&pcxcmap, maxval, &cht, &colorCt);
++ generateStandardPalette(&pcxcmap, maxval, &cht, &colors);
+ } else if (cmdline.palette) {
+ truecolor = FALSE;
+ readPaletteFromFile(&pcxcmap, cmdline.palette, maxval,
+- &cht, &colorCt);
++ &cht, &colors);
+ } else {
+ bool tooManyColors;
+ makePcxColormapFromImage(pixels, cols, rows, maxval,
+- &pcxcmap, &cht, &colorCt,
++ &pcxcmap, &cht, &colors,
+ &tooManyColors);
+
+ if (tooManyColors) {
+@@ -958,8 +912,8 @@ main(int argc, const char *argv[]) {
+ else {
+ ppmToPalettePcx(pixels, cols, rows, maxval,
+ cmdline.xpos, cmdline.ypos,
+- pcxcmap, cht, colorCt, cmdline.packed,
+- cmdline.planes, cmdline.use8Bit);
++ pcxcmap, cht, colors, cmdline.packed,
++ cmdline.planes, cmdline.use_8_bit);
+
+ ppm_freecolorhash(cht);
+ free(pcxcmap);
diff --git a/converter/ppm/ppmtopict.c b/converter/ppm/ppmtopict.c
index 36464b6..c91ccf2 100644
--- a/converter/ppm/ppmtopict.c
@@ -3077,34 +3956,100 @@ index 2fef023..1f30cbd 100644
PPM_ASSIGN(rgbcolor, 0, 0, 0);
ppmd_filledrectangle(pixels, pixcols, pixrows, pixmaxval, 0, 0,
diff --git a/converter/ppm/ximtoppm.c b/converter/ppm/ximtoppm.c
-index 9620942..e9083f3 100644
+index d839e77..e9083f3 100644
--- a/converter/ppm/ximtoppm.c
+++ b/converter/ppm/ximtoppm.c
-@@ -118,6 +118,7 @@ ReadXimHeader(FILE * const in_fp,
+@@ -22,9 +22,7 @@
+ #include "shhopt.h"
+ #include "nstring.h"
+
+-
+-
+-struct CmdlineInfo {
++struct cmdlineInfo {
+ /* All the information the user supplied in the command line,
+ in a form easy for the program to use.
+ */
+@@ -36,8 +34,8 @@ struct CmdlineInfo {
+
+
+ static void
+-parseCommandLine(int argc, const char ** argv,
+- struct CmdlineInfo *cmdlineP) {
++parseCommandLine(int argc, char ** argv,
++ struct cmdlineInfo *cmdlineP) {
+ /*----------------------------------------------------------------------------
+ Note that many of the strings that this function returns in the
+ *cmdlineP structure are actually in the supplied argv array. And
+@@ -59,7 +57,7 @@ parseCommandLine(int argc, const char ** argv,
+ opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */
+ opt.allowNegNum = FALSE; /* We have no parms that are negative numbers */
+
+- pm_optParseOptions3(&argc, (char**)argv, opt, sizeof(opt), 0);
++ pm_optParseOptions3(&argc, argv, opt, sizeof(opt), 0);
+ /* Uses and sets argc, argv, and all of *cmdlineP. */
+
+ if (!alphaoutSpec)
+@@ -102,11 +100,6 @@ ReadXimHeader(FILE * const in_fp,
+ pm_message("ReadXimHeader: unable to read file header" );
+ return(0);
+ }
+- /* Force broken ASCIIZ strings to at least be valid ASCIIZ */
+- a_head.author [sizeof(a_head.author) - 1] = '\0';
+- a_head.date [sizeof(a_head.date) - 1] = '\0';
+- a_head.program[sizeof(a_head.program) - 1] = '\0';
+-
+ if (atoi(a_head.header_size) != sizeof(ImageHeader)) {
+ pm_message("ReadXimHeader: header size mismatch" );
+ return(0);
+@@ -120,15 +113,39 @@ ReadXimHeader(FILE * const in_fp,
+ header->ncolors = atoi(a_head.num_colors);
+ header->nchannels = atoi(a_head.num_channels);
+ header->bytes_per_line = atoi(a_head.bytes_per_line);
+-#if 0
+- header->npics = atoi(a_head.num_pictures);
+-#endif
++/* header->npics = atoi(a_head.num_pictures);
++*/
header->bits_channel = atoi(a_head.bits_per_channel);
header->alpha_flag = atoi(a_head.alpha_channel);
- if (strlen(a_head.author)) {
+- header->author = pm_strdup(a_head.author);
+- header->date = pm_strdup(a_head.date);
+- header->program = pm_strdup(a_head.program);
+-
++ if (strlen(a_head.author)) {
+ overflow_add(strlen(a_head.author),1);
- if (!(header->author = calloc((unsigned int)strlen(a_head.author)+1,
- 1))) {
- pm_message("ReadXimHeader: can't calloc author string" );
-@@ -127,6 +128,7 @@ ReadXimHeader(FILE * const in_fp,
- strncpy(header->author, a_head.author, strlen(a_head.author));
- }
- if (strlen(a_head.date)) {
++ if (!(header->author = calloc((unsigned int)strlen(a_head.author)+1,
++ 1))) {
++ pm_message("ReadXimHeader: can't calloc author string" );
++ return(0);
++ }
++ header->width = atoi(a_head.image_width);
++ strncpy(header->author, a_head.author, strlen(a_head.author));
++ }
++ if (strlen(a_head.date)) {
+ overflow_add(strlen(a_head.date),1);
- if (!(header->date =calloc((unsigned int)strlen(a_head.date)+1,1))){
- pm_message("ReadXimHeader: can't calloc date string" );
- return(0);
-@@ -135,6 +137,7 @@ ReadXimHeader(FILE * const in_fp,
- strncpy(header->date, a_head.date, strlen(a_head.date));
- }
- if (strlen(a_head.program)) {
++ if (!(header->date =calloc((unsigned int)strlen(a_head.date)+1,1))){
++ pm_message("ReadXimHeader: can't calloc date string" );
++ return(0);
++ }
++ header->width = atoi(a_head.image_width);
++ strncpy(header->date, a_head.date, strlen(a_head.date));
++ }
++ if (strlen(a_head.program)) {
+ overflow_add(strlen(a_head.program),1);
- if (!(header->program = calloc(
- (unsigned int)strlen(a_head.program) + 1, 1))) {
- pm_message("ReadXimHeader: can't calloc program string" );
-@@ -161,6 +164,7 @@ ReadXimHeader(FILE * const in_fp,
++ if (!(header->program = calloc(
++ (unsigned int)strlen(a_head.program) + 1, 1))) {
++ pm_message("ReadXimHeader: can't calloc program string" );
++ return(0);
++ }
++ header->width = atoi(a_head.image_width);
++ strncpy(header->program, a_head.program,strlen(a_head.program));
++ }
+ /* Do double checking for backwards compatibility */
+ if (header->npics == 0)
+ header->npics = 1;
+@@ -147,6 +164,7 @@ ReadXimHeader(FILE * const in_fp,
if (header->nchannels == 3 && header->bits_channel == 8)
header->ncolors = 0;
else if (header->nchannels == 1 && header->bits_channel == 8) {
@@ -3112,6 +4057,65 @@ index 9620942..e9083f3 100644
header->colors = (Color *)calloc((unsigned int)header->ncolors,
sizeof(Color));
if (header->colors == NULL) {
+@@ -197,8 +215,7 @@ ReadImageChannel(FILE * const infp,
+ }
+ /* return to the beginning of the next image's buffer */
+ if (fseek(infp, marker, 0) == -1) {
+- pm_message("ReadImageChannel: can't fseek to location "
+- "in image buffer");
++ pm_message("ReadImageChannel: can't fseek to location in image buffer" );
+ return(0);
+ }
+ free((char *)line);
+@@ -307,26 +324,28 @@ ReadXimImage(FILE * const in_fp,
+ ***********************************************************************/
+
+ static int
+-ReadXim(FILE * const in_fp,
+- XimImage * const xim) {
+-
++ReadXim(in_fp, xim)
++ FILE *in_fp;
++ XimImage *xim;
++{
+ if (!ReadXimHeader(in_fp, xim)) {
+ pm_message("can't read xim header" );
+- return 0;
+- } else if (!ReadXimImage(in_fp, xim)) {
++ return(0);
++ }
++ if (!ReadXimImage(in_fp, xim)) {
+ pm_message("can't read xim data" );
+- return 0;
+- } else
+- return 1;
++ return(0);
++ }
++ return(1);
+ }
+
+
+
+ int
+-main(int argc,
+- const char **argv) {
++main(int argc,
++ char *argv[]) {
+
+- struct CmdlineInfo cmdline;
++ struct cmdlineInfo cmdline;
+ FILE *ifP, *imageout_file, *alpha_file;
+ XimImage xim;
+ pixel *pixelrow, colormap[256];
+@@ -338,7 +357,7 @@ main(int argc,
+ pixval maxval;
+ bool success;
+
+- pm_proginit(&argc, argv);
++ ppm_init(&argc, argv);
+
+ parseCommandLine(argc, argv, &cmdline);
+
diff --git a/editor/pamcut.c b/editor/pamcut.c
index 1fc9d9b..ad0e030 100644
--- a/editor/pamcut.c
@@ -3270,7 +4274,7 @@ index 6cb8d3a..6f4bde9 100644
if (hist == NULL)
pm_error("Unable to allocate memory for histogram.");
diff --git a/lib/libpam.c b/lib/libpam.c
-index a8f140b..e6986f1 100644
+index d19534e..ca6250a 100644
--- a/lib/libpam.c
+++ b/lib/libpam.c
@@ -225,7 +225,8 @@ allocPamRow(const struct pam * const pamP) {
@@ -3644,7 +4648,7 @@ index 569156f..ba27a4c 100644
return colorname;
}
diff --git a/lib/libpm.c b/lib/libpm.c
-index 47a2f49..a263598 100644
+index bc92238..aa67dcd 100644
--- a/lib/libpm.c
+++ b/lib/libpm.c
@@ -888,5 +888,53 @@ pm_parse_height(const char * const arg) {
@@ -6434,7 +7438,7 @@ index 0000000..ae220f5
+
+
diff --git a/urt/rle_hdr.c b/urt/rle_hdr.c
-index 1edb7a3..d306607 100644
+index bdb728d..e3f5330 100644
--- a/urt/rle_hdr.c
+++ b/urt/rle_hdr.c
@@ -148,7 +148,7 @@ rle_hdr_cp(rle_hdr * const fromHdrP,
@@ -7019,18 +8023,1614 @@ index ab2eb20..ce83615 100644
/* Can't realloc because somebody else might be pointing to this
* comments block. Of course, if this were true, then the
diff --git a/urt/scanargs.c b/urt/scanargs.c
-index f3af334..5e114bb 100644
+index 1dcdd23..5e114bb 100644
--- a/urt/scanargs.c
+++ b/urt/scanargs.c
-@@ -62,9 +62,8 @@ typedef int *ptr;
- /*
+@@ -1,24 +1,24 @@
+-/*
++/*
+ * $Id: scanargs.c,v 3.0.1.3 1992/02/27 21:18:14 spencer Exp $
+- * Version 7 compatible
+- * Argument scanner, scans argv style argument list.
+- *
+- * Some stuff is a kludge because sscanf screws up
+- *
+- * Gary Newman - 10/4/1979 - Ampex Corp.
+- *
+- * Modified by Spencer W. Thomas, Univ. of Utah, 5/81 to
+- * add args introduced by a flag, add qscanargs call,
+- * allow empty flags.
+- *
+- * If you make improvements we'd like to get them too.
+- * Jay Lepreau lepreau@utah-20, decvax!harpo!utah-cs!lepreau
+- * Spencer Thomas thomas@utah-20, decvax!harpo!utah-cs!thomas
+- *
+- * (I know the code is ugly, but it just grew, you see ...)
+- *
+- * Modified by: Spencer W. Thomas
+- * Date: Feb 25 1983
++ * Version 7 compatible
++ * Argument scanner, scans argv style argument list.
++ *
++ * Some stuff is a kludge because sscanf screws up
++ *
++ * Gary Newman - 10/4/1979 - Ampex Corp.
++ *
++ * Modified by Spencer W. Thomas, Univ. of Utah, 5/81 to
++ * add args introduced by a flag, add qscanargs call,
++ * allow empty flags.
++ *
++ * If you make improvements we'd like to get them too.
++ * Jay Lepreau lepreau@utah-20, decvax!harpo!utah-cs!lepreau
++ * Spencer Thomas thomas@utah-20, decvax!harpo!utah-cs!thomas
++ *
++ * (I know the code is ugly, but it just grew, you see ...)
++ *
++ * Modified by: Spencer W. Thomas
++ * Date: Feb 25 1983
+ * 1. Fixed scanning of optional args. Now args introduced by a flag
+ * must follow the flag which introduces them and precede any other
+ * flag argument. It is still possible for a flag introduced
+@@ -26,11 +26,11 @@
+ * earlier in the format string. This implies that flags may not
+ * be conditional upon other flags, and a message will be generated
+ * if this is attempted.
+- *
++ *
+ * 2. Usage message can be formatted by inserting newlines, tabs and
+ * spaces into the format string. This is especially useful for
+ * long argument lists.
+- *
++ *
+ * 3. Added n/N types for "numeric" args. These args are scanned
+ * using the C language conventions - a number starting 0x is
+ * hexadecimal, a number starting with 0 is octal, otherwise it is
+@@ -49,7 +49,7 @@
+ #include "rle_config.h"
+ #include "rle.h"
+
+-/*
++/*
+ * An explicit assumption is made in this code that all pointers look
+ * alike, except possible char * pointers.
+ */
+@@ -59,19 +59,18 @@ typedef int *ptr;
+ #define NO 0
+ #define ERROR(msg) {fprintf(stderr, "%s\n", msg); goto error; }
+
+-/*
++/*
* Storage allocation macros
*/
--#define NEW( type, cnt ) (type *) malloc( (cnt) * sizeof( type ) )
--#define RENEW( type, ptr, cnt ) (type *) realloc( ptr, (cnt) * sizeof( type ) )
+-#define NEW( type, cnt ) (type *) malloc( (cnt) * sizeof( type ) )
+-#define RENEW( type, ptr, cnt ) (type *) realloc( ptr, (cnt) * sizeof( type ) )
-
+#define NEW( type, cnt ) (type *) malloc2( (cnt) , sizeof( type ) )
+#define RENEW( type, ptr, cnt ) (type *) realloc2( ptr, (cnt), sizeof( type ) )
static CONST_DECL char * prformat( CONST_DECL char *, int );
static int isnum( CONST_DECL char *, int, int );
- static int _do_scanargs( int argc, char **argv, CONST_DECL char *format,
+-static int _do_scanargs( int argc, char **argv, CONST_DECL char *format,
+- va_list argl );
+-void scan_usage( char **, CONST_DECL char * );
++static int _do_scanargs( int argc, char **argv, CONST_DECL char *format,
++ va_list argl );
++void scan_usage( char **, CONST_DECL char * );
+
+-/*
++/*
+ * Argument list is (argc, argv, format, ... )
+ */
+ int
+@@ -84,8 +83,8 @@ scanargs ( int argc, char **argv, CONST_DECL char *format, ... )
+ va_end( argl );
+ return retval;
+ }
+-
+-/*
++
++/*
+ * This routine is necessary because of a pyramid compiler botch that
+ * uses parameter registers in a varargs routine. The extra
+ * subroutine call isolates the args on the register stack so they
+@@ -94,583 +93,583 @@ scanargs ( int argc, char **argv, CONST_DECL char *format, ... )
+
+ static int
+ _do_scanargs( argc, argv, format, argl )
+-int argc; /* Actual arguments */
++int argc; /* Actual arguments */
+ char **argv;
+ CONST_DECL char *format;
+ va_list argl;
+ {
+
+- int check; /* check counter to be sure all argvs
+- are processed */
++ int check; /* check counter to be sure all argvs
++ are processed */
+ register CONST_DECL char *cp;
+ int cnt;
+- int optarg = 0; /* where optional args start */
+- int nopt = 0;
+- char tmpflg, /* temp flag */
+- typchr; /* type char from format string */
++ int optarg = 0; /* where optional args start */
++ int nopt = 0;
++ char tmpflg, /* temp flag */
++ typchr; /* type char from format string */
+ char c;
+- bool * arg_used; /* array of flags */
+- ptr aptr = 0; /* pointer to return loc */
++ bool * arg_used; /* array of flags */
++ ptr aptr = 0; /* pointer to return loc */
+
+ bool required;
+- int excnt; /* which flag is set */
+- unsigned int exflag; /* How many of a set of exclusive
+- flags is set */
+-
+- bool list_of; /* set if parsing off a list of args */
+- bool comma_list; /* set if AT&T style multiple args */
+- bool no_usage; /* If set, don't print usage msg. */
+- bool help = NO; /* If set, always print usage. */
+- int * cnt_arg = 0; /* where to stuff list count */
+- int list_cnt; /* how many in list */
++ int excnt; /* which flag is set */
++ bool exflag; /* when set, one of a set of exclusive
++ flags is set */
++
++ bool list_of; /* set if parsing off a list of args */
++ bool comma_list; /* set if AT&T style multiple args */
++ bool no_usage; /* If set, don't print usage msg. */
++ bool help = NO; /* If set, always print usage. */
++ int * cnt_arg = 0; /* where to stuff list count */
++ int list_cnt; /* how many in list */
+ /* These are used to build return lists */
+ char ** strlist = 0;
+ int * intlist = 0;
+ long * longlist = 0;
+ float * fltlist = 0;
+ double *dbllist = 0;
+- char * argp; /* Pointer to argument. */
++ char * argp; /* Pointer to argument. */
+
+- CONST_DECL char *ncp; /* remember cp during flag scanning */
+- static char cntrl[7] = "% %1s"; /* control string for scanf's */
+- char junk[2]; /* junk buffer for scanf's */
++ CONST_DECL char *ncp; /* remember cp during flag scanning */
++ static char cntrl[7] = "% %1s"; /* control string for scanf's */
++ char junk[2]; /* junk buffer for scanf's */
+
+ /* Set up for argument counting. */
+ arg_used = NEW( bool, argc );
+ if (arg_used == NULL)
+ {
+- fprintf(stderr, "malloc failed in scanargs, exiting\n");
+- exit(-1);
++ fprintf(stderr, "malloc failed in scanargs, exiting\n");
++ exit(-1);
+ }
+ else
+ {
+- for (cnt=0; cnt 0 )
+- switch ( *(cp++) )
+- {
+- case '(': depth++; break;
+- case ')': depth--; break;
+- }
+- break;
+- }
+-
+- case '!': /* required argument */
+- required = YES;
+- case '%': /* not required argument */
+-reswitch: /* after finding '*' or ',' */
+- switch (typchr = *(cp++))
+- {
+- case ',': /* argument is AT&T list of things */
+- comma_list = YES;
+- case '*': /* argument is list of things */
+- list_of = YES;
+- list_cnt = 0; /* none yet */
+- cnt_arg = va_arg( argl, int *); /* item count * here */
+- goto reswitch; /* try again */
+-
+- case '$': /* "rest" of argument list */
+- while ( argc > 1 && !arg_used[argc-1] )
+- argc--; /* find last used argument */
+- *va_arg( argl, int * ) = argc;
+- break;
+-
+- case '&': /* Return unused args. */
+- /* Count how many. Always include argv[0]. */
+- for ( nopt = cnt = 1; cnt < argc; cnt++ )
+- if ( !arg_used[cnt] )
+- nopt++;
+- if ( nopt == 1 )
+- nopt = 0; /* Special case for no args. */
+- if ( nopt > 0 )
+- {
+- strlist = NEW( char *, nopt + 1 );
+- /* Copy program name, for sure. */
+- strlist[0] = argv[0];
+- for ( nopt = cnt = 1; cnt < argc; cnt++ )
+- if ( !arg_used[cnt] )
+- {
+- strlist[nopt++] = argv[cnt];
+- check += cnt;
+- arg_used[cnt] = 1;
+- }
+- strlist[nopt] = NULL;
+- }
+- else
+- strlist = NULL; /* No args, return empty. */
+-
+- /* Return count and arg list. */
+- *va_arg( argl, int * ) = nopt;
+- *va_arg( argl, char *** ) = strlist;
+- break;
+-
+- case '-': /* argument is flag */
+- if (optarg > 0)
+- ERROR("Format error: flag conditional on flag not allowed");
+-
+- /* go back to label */
+- ncp = cp-1; /* remember */
+- cp -= 3;
+- for (excnt = exflag = 0
+- ; *cp != ' ' && !(*cp=='-' &&(cp[-1]=='!'||cp[-1]=='%'));
+- (--cp, excnt++))
+- {
+- for (cnt = optarg+1; cnt < argc; cnt++)
+- {
+- /* flags all start with - */
+- if (*argv[cnt] == '-' && !arg_used[cnt] &&
+- !ISDIGIT(argv[cnt][1]))
+- if (*(argv[cnt] + 1) == *cp)
+- {
+- if (*(argv[cnt] + 2) != 0)
+- ERROR ("extra flags ignored");
+- if (exflag)
+- ERROR ("more than one exclusive flag chosen");
+- exflag++;
+- required = NO;
+- check += cnt;
+- arg_used[cnt] = 1;
+- nopt = cnt;
+- *va_arg( argl, int *) |= (1 << excnt);
+- break;
+- }
+- }
+- }
+- if (required)
+- ERROR ("flag argument missing");
+- cp = ncp;
+- /*
+- * If none of these flags were found, skip any
+- * optional arguments (in the varargs list, too).
+- */
+- if (!exflag)
+- {
+- (void)va_arg( argl, int * );/* skip the arg, too */
+- while (*++cp && ! ISSPACE(*cp))
+- if (*cp == '!' || *cp == '%')
+- {
+- if ( *++cp == '*' || *cp == ',' )
+- {
+- cp++;
+- (void)va_arg( argl, int * );
+- }
+- /*
+- * Assume that char * might be a
+- * different size, but that all
+- * other pointers are same size.
+- */
+- if ( *cp == 's' )
+- (void)va_arg( argl, char * );
+- else
+- (void)va_arg( argl, ptr );
+- }
+- }
+- else
+- {
+- optarg = nopt;
+- cp++; /* skip over - */
+- }
+-
+- break;
+-
+- case 's': /* char string */
+- case 'd': /* decimal # */
+- case 'o': /* octal # */
+- case 'x': /* hexadecimal # */
+- case 'n': /* "number" in C syntax */
+- case 'f': /* floating # */
+- case 'D': /* long decimal # */
+- case 'O': /* long octal # */
+- case 'X': /* long hexadecimal # */
+- case 'N': /* long number in C syntax */
+- case 'F': /* double precision floating # */
++ required = NO; /* reset per-arg flags */
++ list_of = NO;
++ comma_list = NO;
++ list_cnt = 0;
++ switch (*(cp++))
++ {
++ default: /* all other chars */
++ break;
++ case ' ': /* separators */
++ case '\t':
++ case '\n':
++ optarg = 0; /* end of optional arg string */
++ break;
++
++ case '(': /* Surrounds a comment. */
++ {
++ int depth = 1; /* Count parenthesis depth. */
++ while ( *cp && depth > 0 )
++ switch ( *(cp++) )
++ {
++ case '(': depth++; break;
++ case ')': depth--; break;
++ }
++ break;
++ }
++
++ case '!': /* required argument */
++ required = YES;
++ case '%': /* not required argument */
++reswitch: /* after finding '*' or ',' */
++ switch (typchr = *(cp++))
++ {
++ case ',': /* argument is AT&T list of things */
++ comma_list = YES;
++ case '*': /* argument is list of things */
++ list_of = YES;
++ list_cnt = 0; /* none yet */
++ cnt_arg = va_arg( argl, int *); /* item count * here */
++ goto reswitch; /* try again */
++
++ case '$': /* "rest" of argument list */
++ while ( argc > 1 && !arg_used[argc-1] )
++ argc--; /* find last used argument */
++ *va_arg( argl, int * ) = argc;
++ break;
++
++ case '&': /* Return unused args. */
++ /* Count how many. Always include argv[0]. */
++ for ( nopt = cnt = 1; cnt < argc; cnt++ )
++ if ( !arg_used[cnt] )
++ nopt++;
++ if ( nopt == 1 )
++ nopt = 0; /* Special case for no args. */
++ if ( nopt > 0 )
++ {
++ strlist = NEW( char *, nopt + 1 );
++ /* Copy program name, for sure. */
++ strlist[0] = argv[0];
++ for ( nopt = cnt = 1; cnt < argc; cnt++ )
++ if ( !arg_used[cnt] )
++ {
++ strlist[nopt++] = argv[cnt];
++ check += cnt;
++ arg_used[cnt] = 1;
++ }
++ strlist[nopt] = NULL;
++ }
++ else
++ strlist = NULL; /* No args, return empty. */
++
++ /* Return count and arg list. */
++ *va_arg( argl, int * ) = nopt;
++ *va_arg( argl, char *** ) = strlist;
++ break;
++
++ case '-': /* argument is flag */
++ if (optarg > 0)
++ ERROR("Format error: flag conditional on flag not allowed");
++
++ /* go back to label */
++ ncp = cp-1; /* remember */
++ cp -= 3;
++ for (excnt = exflag = 0
++ ; *cp != ' ' && !(*cp=='-' &&(cp[-1]=='!'||cp[-1]=='%'));
++ (--cp, excnt++))
++ {
++ for (cnt = optarg+1; cnt < argc; cnt++)
++ {
++ /* flags all start with - */
++ if (*argv[cnt] == '-' && !arg_used[cnt] &&
++ !ISDIGIT(argv[cnt][1]))
++ if (*(argv[cnt] + 1) == *cp)
++ {
++ if (*(argv[cnt] + 2) != 0)
++ ERROR ("extra flags ignored");
++ if (exflag)
++ ERROR ("more than one exclusive flag chosen");
++ exflag++;
++ required = NO;
++ check += cnt;
++ arg_used[cnt] = 1;
++ nopt = cnt;
++ *va_arg( argl, int *) |= (1 << excnt);
++ break;
++ }
++ }
++ }
++ if (required)
++ ERROR ("flag argument missing");
++ cp = ncp;
++ /*
++ * If none of these flags were found, skip any
++ * optional arguments (in the varargs list, too).
++ */
++ if (!exflag)
++ {
++ (void)va_arg( argl, int * );/* skip the arg, too */
++ while (*++cp && ! ISSPACE(*cp))
++ if (*cp == '!' || *cp == '%')
++ {
++ if ( *++cp == '*' || *cp == ',' )
++ {
++ cp++;
++ (void)va_arg( argl, int * );
++ }
++ /*
++ * Assume that char * might be a
++ * different size, but that all
++ * other pointers are same size.
++ */
++ if ( *cp == 's' )
++ (void)va_arg( argl, char * );
++ else
++ (void)va_arg( argl, ptr );
++ }
++ }
++ else
++ {
++ optarg = nopt;
++ cp++; /* skip over - */
++ }
++
++ break;
++
++ case 's': /* char string */
++ case 'd': /* decimal # */
++ case 'o': /* octal # */
++ case 'x': /* hexadecimal # */
++ case 'n': /* "number" in C syntax */
++ case 'f': /* floating # */
++ case 'D': /* long decimal # */
++ case 'O': /* long octal # */
++ case 'X': /* long hexadecimal # */
++ case 'N': /* long number in C syntax */
++ case 'F': /* double precision floating # */
+ #if defined(sgi) && !defined(mips)
+- /* Fix for broken SGI IRIS 2400/3000 floats */
+- if ( typchr == 'F' ) typchr = 'f';
++ /* Fix for broken SGI IRIS 2400/3000 floats */
++ if ( typchr == 'F' ) typchr = 'f';
+ #endif /* sgi */
+- for (cnt = optarg+1; cnt < argc; cnt++)
+- {
+- argp = argv[cnt];
+-
+- if ( isnum( argp, typchr, comma_list ) )
+- {
+- ; /* it's ok, then */
+- }
+- else if ( *argp == '-' && argp[1] != '\0' )
+- if ( optarg > 0 ) /* end optional args? */
+- {
+- /* Eat the arg, too, if necessary */
+- if ( list_cnt == 0 ) {
+- if ( typchr == 's' )
+- (void)va_arg( argl, char * );
+- else
+- (void)va_arg( argl, ptr );
++ for (cnt = optarg+1; cnt < argc; cnt++)
++ {
++ argp = argv[cnt];
++
++ if ( isnum( argp, typchr, comma_list ) )
++ {
++ ; /* it's ok, then */
++ }
++ else if ( *argp == '-' && argp[1] != '\0' )
++ if ( optarg > 0 ) /* end optional args? */
++ {
++ /* Eat the arg, too, if necessary */
++ if ( list_cnt == 0 ) {
++ if ( typchr == 's' )
++ (void)va_arg( argl, char * );
++ else
++ (void)va_arg( argl, ptr );
+ }
+- break;
+- }
+- else
+- continue;
+- else if ( typchr != 's' )
+- continue; /* not number, keep looking */
+-
+- /*
+- * Otherwise usable argument may already
+- * be used. (Must check this after
+- * checking for flag, though.)
+- */
+- if (arg_used[cnt]) continue;
+-
+- /*
+- * If it's a comma-and-or-space-separated
+- * list then count how many, and separate
+- * the list into an array of strings.
+- */
+- if ( comma_list )
+- {
+- register char * s;
+- int pass;
+-
+- /*
+- * Copy the string so we remain nondestructive
+- */
+- s = NEW( char, strlen(argp)+1 );
+- strcpy( s, argp );
+- argp = s;
+-
+- /*
+- * On pass 0, just count them. On
+- * pass 1, null terminate each string
+- */
+- for ( pass = 0; pass <= 1; pass++ )
+- {
+- for ( s = argp; *s != '\0'; )
+- {
+- if ( pass )
+- strlist[list_cnt] = s;
+- while ( (c = *s) != '\0' && c != ' ' &&
+- c != '\t' && c != ',' )
+- s++;
+- if ( pass )
+- *s = '\0';
+-
+- list_cnt++; /* count separators */
+- /*
+- * Two commas in a row give a null
+- * string, but two spaces
+- * don't. Also skip spaces
+- * after a comma.
+- */
+- if ( c != '\0' )
+- while ( *++s == ' ' || *s == '\t' )
+- ;
+- }
+- if ( pass == 0 )
+- {
+- strlist = NEW( char *, list_cnt );
+- list_cnt = 0;
+- }
+- }
+- }
+- else if ( list_of )
+- list_cnt++; /* getting them one at a time */
+- /*
+- * If it's either type of list, then alloc
+- * storage space for the returned values
+- * (except that comma-separated string
+- * lists already are done).
+- */
+- if ( list_of )
+- {
+- if ( list_cnt == 1 || comma_list )
+- switch( typchr )
+- {
+- case 's':
+- if ( !comma_list )
+- strlist = NEW( char *, 1 );
+- aptr = (ptr) &strlist[0];
+- break;
+- case 'n':
+- case 'd':
+- case 'o':
+- case 'x':
+- intlist = NEW( int, list_cnt );
+- aptr = (ptr) &intlist[0];
+- break;
+- case 'N':
+- case 'D':
+- case 'O':
+- case 'X':
+- longlist = NEW( long, list_cnt );
+- aptr = (ptr) &longlist[0];
+- break;
+- case 'f':
+- fltlist = NEW( float, list_cnt );
+- aptr = (ptr) &fltlist[0];
+- break;
+- case 'F':
+- dbllist = NEW( double, list_cnt );
+- aptr = (ptr) &dbllist[0];
+- break;
+- }
+- else
+- switch( typchr )
+- {
+- case 's':
+- strlist = RENEW( char *, strlist,
+- list_cnt );
+- aptr = (ptr) &strlist[list_cnt-1];
+- break;
+- case 'n':
+- case 'd':
+- case 'o':
+- case 'x':
+- intlist = RENEW( int, intlist,
+- list_cnt );
+- aptr = (ptr) &intlist[list_cnt-1];
+- break;
+- case 'N':
+- case 'D':
+- case 'O':
+- case 'X':
+- longlist = RENEW( long, longlist,
+- list_cnt );
+- aptr = (ptr) &longlist[list_cnt-1];
+- break;
+- case 'f':
+- fltlist = RENEW( float, fltlist,
+- list_cnt );
+- aptr = (ptr) &fltlist[list_cnt-1];
+- break;
+- case 'F':
+- dbllist = RENEW( double, dbllist,
+- list_cnt );
+- aptr = (ptr) &dbllist[list_cnt-1];
+- break;
+- }
+- }
+- else
+- aptr = va_arg( argl, ptr );
+-
+- if ( typchr == 's' )
+- {
+- if ( ! comma_list )
+- *(char **)aptr = argp;
+- }
+- else
+- {
+- nopt = 0;
+- do {
+- /*
+- * Need to update aptr if parsing
+- * a comma list
+- */
+- if ( comma_list && nopt > 0 )
+- {
+- argp = strlist[nopt];
+- switch( typchr )
+- {
+- case 'n':
+- case 'd':
+- case 'o':
+- case 'x':
+- aptr = (ptr) &intlist[nopt];
+- break;
+- case 'N':
+- case 'D':
+- case 'O':
+- case 'X':
+- aptr = (ptr) &longlist[nopt];
+- break;
+- case 'f':
+- aptr = (ptr) &fltlist[nopt];
+- break;
+- case 'F':
+- aptr = (ptr) &dbllist[nopt];
+- break;
+- }
+- }
+- /*
+- * Do conversion for n and N types
+- */
+- tmpflg = typchr;
+- if (typchr == 'n' || typchr == 'N' ) {
+- if (*argp != '0')
+- tmpflg = 'd';
+- else if (*(argp+1) == 'x' ||
+- *(argp+1) == 'X')
+- {
+- tmpflg = 'x';
+- argp += 2;
+- }
+- else
+- tmpflg = 'o';
++ break;
++ }
++ else
++ continue;
++ else if ( typchr != 's' )
++ continue; /* not number, keep looking */
++
++ /*
++ * Otherwise usable argument may already
++ * be used. (Must check this after
++ * checking for flag, though.)
++ */
++ if (arg_used[cnt]) continue;
++
++ /*
++ * If it's a comma-and-or-space-separated
++ * list then count how many, and separate
++ * the list into an array of strings.
++ */
++ if ( comma_list )
++ {
++ register char * s;
++ int pass;
++
++ /*
++ * Copy the string so we remain nondestructive
++ */
++ s = NEW( char, strlen(argp)+1 );
++ strcpy( s, argp );
++ argp = s;
++
++ /*
++ * On pass 0, just count them. On
++ * pass 1, null terminate each string
++ */
++ for ( pass = 0; pass <= 1; pass++ )
++ {
++ for ( s = argp; *s != '\0'; )
++ {
++ if ( pass )
++ strlist[list_cnt] = s;
++ while ( (c = *s) != '\0' && c != ' ' &&
++ c != '\t' && c != ',' )
++ s++;
++ if ( pass )
++ *s = '\0';
++
++ list_cnt++; /* count separators */
++ /*
++ * Two commas in a row give a null
++ * string, but two spaces
++ * don't. Also skip spaces
++ * after a comma.
++ */
++ if ( c != '\0' )
++ while ( *++s == ' ' || *s == '\t' )
++ ;
++ }
++ if ( pass == 0 )
++ {
++ strlist = NEW( char *, list_cnt );
++ list_cnt = 0;
++ }
++ }
++ }
++ else if ( list_of )
++ list_cnt++; /* getting them one at a time */
++ /*
++ * If it's either type of list, then alloc
++ * storage space for the returned values
++ * (except that comma-separated string
++ * lists already are done).
++ */
++ if ( list_of )
++ {
++ if ( list_cnt == 1 || comma_list )
++ switch( typchr )
++ {
++ case 's':
++ if ( !comma_list )
++ strlist = NEW( char *, 1 );
++ aptr = (ptr) &strlist[0];
++ break;
++ case 'n':
++ case 'd':
++ case 'o':
++ case 'x':
++ intlist = NEW( int, list_cnt );
++ aptr = (ptr) &intlist[0];
++ break;
++ case 'N':
++ case 'D':
++ case 'O':
++ case 'X':
++ longlist = NEW( long, list_cnt );
++ aptr = (ptr) &longlist[0];
++ break;
++ case 'f':
++ fltlist = NEW( float, list_cnt );
++ aptr = (ptr) &fltlist[0];
++ break;
++ case 'F':
++ dbllist = NEW( double, list_cnt );
++ aptr = (ptr) &dbllist[0];
++ break;
++ }
++ else
++ switch( typchr )
++ {
++ case 's':
++ strlist = RENEW( char *, strlist,
++ list_cnt );
++ aptr = (ptr) &strlist[list_cnt-1];
++ break;
++ case 'n':
++ case 'd':
++ case 'o':
++ case 'x':
++ intlist = RENEW( int, intlist,
++ list_cnt );
++ aptr = (ptr) &intlist[list_cnt-1];
++ break;
++ case 'N':
++ case 'D':
++ case 'O':
++ case 'X':
++ longlist = RENEW( long, longlist,
++ list_cnt );
++ aptr = (ptr) &longlist[list_cnt-1];
++ break;
++ case 'f':
++ fltlist = RENEW( float, fltlist,
++ list_cnt );
++ aptr = (ptr) &fltlist[list_cnt-1];
++ break;
++ case 'F':
++ dbllist = RENEW( double, dbllist,
++ list_cnt );
++ aptr = (ptr) &dbllist[list_cnt-1];
++ break;
++ }
++ }
++ else
++ aptr = va_arg( argl, ptr );
++
++ if ( typchr == 's' )
++ {
++ if ( ! comma_list )
++ *(char **)aptr = argp;
++ }
++ else
++ {
++ nopt = 0;
++ do {
++ /*
++ * Need to update aptr if parsing
++ * a comma list
++ */
++ if ( comma_list && nopt > 0 )
++ {
++ argp = strlist[nopt];
++ switch( typchr )
++ {
++ case 'n':
++ case 'd':
++ case 'o':
++ case 'x':
++ aptr = (ptr) &intlist[nopt];
++ break;
++ case 'N':
++ case 'D':
++ case 'O':
++ case 'X':
++ aptr = (ptr) &longlist[nopt];
++ break;
++ case 'f':
++ aptr = (ptr) &fltlist[nopt];
++ break;
++ case 'F':
++ aptr = (ptr) &dbllist[nopt];
++ break;
++ }
++ }
++ /*
++ * Do conversion for n and N types
++ */
++ tmpflg = typchr;
++ if (typchr == 'n' || typchr == 'N' ) {
++ if (*argp != '0')
++ tmpflg = 'd';
++ else if (*(argp+1) == 'x' ||
++ *(argp+1) == 'X')
++ {
++ tmpflg = 'x';
++ argp += 2;
++ }
++ else
++ tmpflg = 'o';
+ }
+- if (typchr == 'N')
+- tmpflg = toupper( tmpflg );
+-
+-
+- /* put in conversion */
+- if ( isupper( tmpflg ) )
+- {
+- cntrl[1] = 'l';
+- cntrl[2] = tolower( tmpflg );
+- }
+- else
+- {
+- cntrl[1] = tmpflg;
+- cntrl[2] = ' ';
+- }
+- if (sscanf (argp, cntrl, aptr, junk) != 1)
+- ERROR ("Bad numeric argument");
+- } while ( comma_list && ++nopt < list_cnt );
+- }
+- check += cnt;
+- arg_used[cnt] = 1;
+- required = NO;
+- /*
+- * If not looking for multiple args,
+- * then done, otherwise, keep looking.
+- */
+- if ( !( list_of && !comma_list ) )
+- break;
+- else
+- continue;
+- }
+- if (required)
+- switch (typchr)
+- {
+- case 'x':
+- case 'X':
+- ERROR ("missing hexadecimal argument");
+- case 's':
+- ERROR ("missing string argument");
+- case 'o':
+- case 'O':
+- ERROR ("missing octal argument");
+- case 'd':
+- case 'D':
+- ERROR ("missing decimal argument");
+- case 'f':
+- case 'F':
+- ERROR ("missing floating argument");
+- case 'n':
+- case 'N':
+- ERROR ("missing numeric argument");
+- }
+- if ( list_cnt > 0 )
+- {
+- *cnt_arg = list_cnt;
+- switch ( typchr )
+- {
+- case 's':
+- *va_arg( argl, char *** ) = strlist;
+- break;
+- case 'n':
+- case 'd':
+- case 'o':
+- case 'x':
+- *va_arg( argl, int ** ) = intlist;
+- break;
+- case 'N':
+- case 'D':
+- case 'O':
+- case 'X':
+- *va_arg( argl, long ** ) = longlist;
+- break;
+- case 'f':
+- *va_arg( argl, float ** ) = fltlist;
+- break;
+- case 'F':
+- *va_arg( argl, double **) = dbllist;
+- break;
+- }
+- if ( typchr != 's' && comma_list )
+- free( (char *) strlist );
+- }
+- else if ( cnt >= argc )
+- {
+- /* Fell off end looking, so must eat the arg */
+- if ( typchr == 's' )
+- (void)va_arg( argl, char * );
+- else
+- (void)va_arg( argl, ptr );
+- }
+- break;
+- default: /* error */
+- fprintf (stderr,
+- "scanargs: Corrupt or invalid format spec\n");
+- return 0;
+- }
+- }
++ if (typchr == 'N')
++ tmpflg = toupper( tmpflg );
++
++
++ /* put in conversion */
++ if ( isupper( tmpflg ) )
++ {
++ cntrl[1] = 'l';
++ cntrl[2] = tolower( tmpflg );
++ }
++ else
++ {
++ cntrl[1] = tmpflg;
++ cntrl[2] = ' ';
++ }
++ if (sscanf (argp, cntrl, aptr, junk) != 1)
++ ERROR ("Bad numeric argument");
++ } while ( comma_list && ++nopt < list_cnt );
++ }
++ check += cnt;
++ arg_used[cnt] = 1;
++ required = NO;
++ /*
++ * If not looking for multiple args,
++ * then done, otherwise, keep looking.
++ */
++ if ( !( list_of && !comma_list ) )
++ break;
++ else
++ continue;
++ }
++ if (required)
++ switch (typchr)
++ {
++ case 'x':
++ case 'X':
++ ERROR ("missing hexadecimal argument");
++ case 's':
++ ERROR ("missing string argument");
++ case 'o':
++ case 'O':
++ ERROR ("missing octal argument");
++ case 'd':
++ case 'D':
++ ERROR ("missing decimal argument");
++ case 'f':
++ case 'F':
++ ERROR ("missing floating argument");
++ case 'n':
++ case 'N':
++ ERROR ("missing numeric argument");
++ }
++ if ( list_cnt > 0 )
++ {
++ *cnt_arg = list_cnt;
++ switch ( typchr )
++ {
++ case 's':
++ *va_arg( argl, char *** ) = strlist;
++ break;
++ case 'n':
++ case 'd':
++ case 'o':
++ case 'x':
++ *va_arg( argl, int ** ) = intlist;
++ break;
++ case 'N':
++ case 'D':
++ case 'O':
++ case 'X':
++ *va_arg( argl, long ** ) = longlist;
++ break;
++ case 'f':
++ *va_arg( argl, float ** ) = fltlist;
++ break;
++ case 'F':
++ *va_arg( argl, double **) = dbllist;
++ break;
++ }
++ if ( typchr != 's' && comma_list )
++ free( (char *) strlist );
++ }
++ else if ( cnt >= argc )
++ {
++ /* Fell off end looking, so must eat the arg */
++ if ( typchr == 's' )
++ (void)va_arg( argl, char * );
++ else
++ (void)va_arg( argl, ptr );
++ }
++ break;
++ default: /* error */
++ fprintf (stderr,
++ "scanargs: Corrupt or invalid format spec\n");
++ return 0;
++ }
++ }
+ }
+
+ /* Count up empty flags */
+ for (cnt=1; cnt argv[0] && *cp != '/'; cp-- )
+- ; /* find the last / */
+- if ( *cp == '/' )
+- cp++;
+- fprintf( stderr, "%s", cp );
+-
+- cp = format + 1; /* reset to where it should be */
+- }
+- while (putc (*cp++, stderr) != ' ');
++ if ( *cp == '%' )
++ {
++ /*
++ * This is bogus, but until everyone can agree on a name
++ * for (rindex/strrchr) ....
++ */
++ for ( cp = argv[0]; *cp != '\0'; cp++ )
++ ; /* find the end of the string */
++ for ( ; cp > argv[0] && *cp != '/'; cp-- )
++ ; /* find the last / */
++ if ( *cp == '/' )
++ cp++;
++ fprintf( stderr, "%s", cp );
++
++ cp = format + 1; /* reset to where it should be */
++ }
++ while (putc (*cp++, stderr) != ' ');
+ }
+ else
+- fprintf (stderr, "?? ");
++ fprintf (stderr, "?? ");
+ while (*cp == ' ')
+- cp++;
++ cp++;
+ (void)prformat (cp, NO);
+ }
+
+ static CONST_DECL char *
+ prformat (format, recurse)
+ CONST_DECL char *format;
+-int recurse;
++int recurse;
+ {
+ register CONST_DECL char *cp;
+ bool required, comma_list;
+@@ -721,142 +720,142 @@ int recurse;
+
+ cp = format;
+ if (recurse)
+- putc (' ', stderr);
++ putc (' ', stderr);
+
+ required = NO;
+ list_of = 0;
+ comma_list = NO;
+ while (*cp)
+ {
+- switch (*cp)
+- {
+- default:
+- cp++;
+- break;
+- case ' ':
+- case '\n':
+- case '\t':
+- /* allow annotations */
+- for ( ; format < cp; format++ )
+- putc( *format, stderr );
+- putc(*cp, stderr);
+- format = ++cp;
+- break;
+-
+- case '(':
+- /* Parentheses surround an arbitrary (parenthesis
+- * balanced) comment.
+- */
+- for ( ; format < cp; format++ )
+- putc( *format, stderr );
+- for ( cp++, depth = 1; *cp && depth > 0; )
+- {
+- /* Don't print last close paren. */
+- if ( *cp != ')' || depth > 1 )
+- putc( *cp, stderr );
+- switch( *(cp++) )
+- {
+- case '(': depth++; break;
+- case ')': depth--; break;
+- }
+- }
+- format = cp;
+- break;
+-
+- case '!':
+- required = YES;
+- case '%':
++ switch (*cp)
++ {
++ default:
++ cp++;
++ break;
++ case ' ':
++ case '\n':
++ case '\t':
++ /* allow annotations */
++ for ( ; format < cp; format++ )
++ putc( *format, stderr );
++ putc(*cp, stderr);
++ format = ++cp;
++ break;
++
++ case '(':
++ /* Parentheses surround an arbitrary (parenthesis
++ * balanced) comment.
++ */
++ for ( ; format < cp; format++ )
++ putc( *format, stderr );
++ for ( cp++, depth = 1; *cp && depth > 0; )
++ {
++ /* Don't print last close paren. */
++ if ( *cp != ')' || depth > 1 )
++ putc( *cp, stderr );
++ switch( *(cp++) )
++ {
++ case '(': depth++; break;
++ case ')': depth--; break;
++ }
++ }
++ format = cp;
++ break;
++
++ case '!':
++ required = YES;
++ case '%':
+ reswitch:
+- switch (*++cp)
+- {
+- case ',':
+- comma_list = YES;
+- case '*':
+- list_of++;
+- goto reswitch;
+-
+- case '$': /* "rest" of argument list */
+- if (!required)
+- putc ('[', stderr);
+- for (; format < cp - 1 - list_of; format++)
+- putc (*format, stderr);
+- fputs( " ...", stderr );
+- if ( !required )
+- putc( ']', stderr );
+- break;
+-
+- case '-': /* flags */
+- if (!required)
+- putc ('[', stderr);
+- putc ('-', stderr);
+-
+- if (cp - format > 2 + list_of)
+- putc ('{', stderr);
+- cp = format;
+- while (*cp != '%' && *cp != '!')
+- putc (*cp++, stderr);
+- if (cp - format > 1 + list_of)
+- putc ('}', stderr);
+- cp += 2; /* skip !- or %- */
+- if (*cp && !ISSPACE(*cp))
+- cp = prformat (cp, YES);
+- /* this is a recursive call */
+-
+- cp--; /* don't ignore next character */
+-
+- if (!required)
+- putc (']', stderr);
+- break;
+- case 's': /* char string */
+- case 'd': /* decimal # */
+- case 'o': /* octal # */
+- case 'x': /* hexadecimal # */
+- case 'f': /* floating # */
+- case 'D': /* long decimal # */
+- case 'O': /* long octal # */
+- case 'X': /* long hexadecimal # */
+- case 'F': /* double precision floating # */
+- case 'n': /* numeric arg (C format) */
+- case 'N': /* long numeric arg */
+- if (!required)
+- putc ('[', stderr);
+- for (; format < cp - 1 - list_of; format++)
+- putc (*format, stderr);
+- if ( list_of != 0 )
+- {
+- if ( comma_list )
+- putc( ',', stderr );
+- else
+- putc( ' ', stderr );
+- fputs( "...", stderr );
+- }
+- if (!required)
+- putc (']', stderr);
+- break;
+- default:
+- break;
+- }
+- required = NO;
+- list_of = NO;
+- comma_list = NO;
+- if (*cp) /* check for end of string */
+- format = ++cp;
+- if (*cp && !ISSPACE(*cp))
+- putc (' ', stderr);
+- }
+- if (recurse && ISSPACE(*cp))
+- break;
++ switch (*++cp)
++ {
++ case ',':
++ comma_list++;
++ case '*':
++ list_of++;
++ goto reswitch;
++
++ case '$': /* "rest" of argument list */
++ if (!required)
++ putc ('[', stderr);
++ for (; format < cp - 1 - list_of; format++)
++ putc (*format, stderr);
++ fputs( " ...", stderr );
++ if ( !required )
++ putc( ']', stderr );
++ break;
++
++ case '-': /* flags */
++ if (!required)
++ putc ('[', stderr);
++ putc ('-', stderr);
++
++ if (cp - format > 2 + list_of)
++ putc ('{', stderr);
++ cp = format;
++ while (*cp != '%' && *cp != '!')
++ putc (*cp++, stderr);
++ if (cp - format > 1 + list_of)
++ putc ('}', stderr);
++ cp += 2; /* skip !- or %- */
++ if (*cp && !ISSPACE(*cp))
++ cp = prformat (cp, YES);
++ /* this is a recursive call */
++
++ cp--; /* don't ignore next character */
++
++ if (!required)
++ putc (']', stderr);
++ break;
++ case 's': /* char string */
++ case 'd': /* decimal # */
++ case 'o': /* octal # */
++ case 'x': /* hexadecimal # */
++ case 'f': /* floating # */
++ case 'D': /* long decimal # */
++ case 'O': /* long octal # */
++ case 'X': /* long hexadecimal # */
++ case 'F': /* double precision floating # */
++ case 'n': /* numeric arg (C format) */
++ case 'N': /* long numeric arg */
++ if (!required)
++ putc ('[', stderr);
++ for (; format < cp - 1 - list_of; format++)
++ putc (*format, stderr);
++ if ( list_of != 0 )
++ {
++ if ( comma_list )
++ putc( ',', stderr );
++ else
++ putc( ' ', stderr );
++ fputs( "...", stderr );
++ }
++ if (!required)
++ putc (']', stderr);
++ break;
++ default:
++ break;
++ }
++ required = NO;
++ list_of = NO;
++ comma_list = NO;
++ if (*cp) /* check for end of string */
++ format = ++cp;
++ if (*cp && !ISSPACE(*cp))
++ putc (' ', stderr);
++ }
++ if (recurse && ISSPACE(*cp))
++ break;
+ }
+ if (!recurse)
+ {
+- for ( ; format < cp; format++ )
+- putc( *format, stderr );
+- putc ('\n', stderr);
++ for ( ; format < cp; format++ )
++ putc( *format, stderr );
++ putc ('\n', stderr);
+ }
+ return (cp);
+ }
+
+-/*
++/*
+ * isnum - determine whether a string MIGHT represent a number.
+ * typchr indicates the type of argument we are looking for, and
+ * determines the legal character set. If comma_list is YES, then
+@@ -873,46 +872,46 @@ int comma_list;
+
+ switch( typchr )
+ {
+- case 'n':
+- case 'N':
+- allowed = " \t,+-x0123456789abcdefABCDEF";
+- break;
+- case 'd':
+- case 'D':
+- allowed = " \t,+-0123456789";
+- break;
+- case 'o':
+- case 'O':
+- allowed = " \t,01234567";
+- break;
+- case 'x':
+- case 'X':
+- allowed = " \t,0123456789abcdefABCDEF";
+- break;
+- case 'f':
+- case 'F':
+- allowed = " \t,+-eE.0123456789";
+- break;
+- case 's': /* only throw out decimal numbers */
+- default:
+- allowed = " \t,+-.0123456789";
+- break;
++ case 'n':
++ case 'N':
++ allowed = " \t,+-x0123456789abcdefABCDEF";
++ break;
++ case 'd':
++ case 'D':
++ allowed = " \t,+-0123456789";
++ break;
++ case 'o':
++ case 'O':
++ allowed = " \t,01234567";
++ break;
++ case 'x':
++ case 'X':
++ allowed = " \t,0123456789abcdefABCDEF";
++ break;
++ case 'f':
++ case 'F':
++ allowed = " \t,+-eE.0123456789";
++ break;
++ case 's': /* only throw out decimal numbers */
++ default:
++ allowed = " \t,+-.0123456789";
++ break;
+ }
+ digits = allowed;
+ while ( *digits != '0' )
+- digits++;
++ digits++;
+ if ( ! comma_list )
+- allowed += 3; /* then don't allow space, tab, comma */
++ allowed += 3; /* then don't allow space, tab, comma */
+
+ while ( *str != '\0' )
+ {
+- for ( cp = allowed; *cp != '\0' && *cp != *str; cp++ )
+- ;
+- if ( *cp == '\0' )
+- return NO; /* if not in allowed chars, not number */
+- if ( cp - digits >= 0 )
+- hasdigit = YES;
+- str++;
++ for ( cp = allowed; *cp != '\0' && *cp != *str; cp++ )
++ ;
++ if ( *cp == '\0' )
++ return NO; /* if not in allowed chars, not number */
++ if ( cp - digits >= 0 )
++ hasdigit = YES;
++ str++;
+ }
+ return hasdigit;
+ }
diff --git a/netpbm-userguide.patch b/netpbm-userguide.patch
index 3efdb6f..c160e13 100644
--- a/netpbm-userguide.patch
+++ b/netpbm-userguide.patch
@@ -1,9 +1,150 @@
diff --git a/userguide/pammixmulti.html b/userguide/pammixmulti.html
-index c5854c3..a18fa14 100755
+index 97cf412..d2a2ba0 100755
--- a/userguide/pammixmulti.html
+++ b/userguide/pammixmulti.html
-@@ -1,4 +1,3 @@
--
-
-
-
+@@ -2,13 +2,13 @@
+ Pammixmulti User Manual
+
+ pammixmulti
+-Updated: 18 November 2018
+-
++
++Updated: 18 November 2018
+ Table Of Contents
+
+
+-NAME
+-pammixmulti - blend together multiple PAM images
++
NAME
++pammixmulti - blend together multiple PAM images
+
+
+ SYNOPSIS
+@@ -22,11 +22,11 @@ Updated: 18 November 2018
+ Minimum unique abbreviation of an option is acceptable. You can use a
+ single hyphen instead of double hyphens to denote options. You can use white
+ space in place of the equals sign to separate an option name from its
+-value.
++value.
+
+
+ DESCRIPTION
+-This file is part of Netpbm.
++
This file is part of Netpbm.
+
+ pammixmulti mixes two or more images to produce a new image. The
+ program provides multiple ways to interpret "mix."
+@@ -37,7 +37,7 @@ program provides multiple ways to interpret "mix."
+
In addition to the options common to all programs based on libnetpbm
+ (most notably -quiet, see
+ Common Options), pammixmulti recognizes the following
+-command line options:
++command line options:
+
+
+ - --blend=average|random|mask
+@@ -50,7 +50,7 @@ output is produced by selecting the corresponding pixel from one of the input
+ images, chosen at random on a per-pixel basis. With
+ --blend=mask
, each pixel in the output is produced by a
+ weighted average of the corresponding pixels from all the input images based
+-on the grayscale level of an additional mask image.
++on the grayscale level of an additional mask image.
+
+
+ - --maskfile=filename
+@@ -60,7 +60,7 @@ grayscale mask file to control the blending of each pixel. (If the file is
+ not grayscale, the first channel is treated as gray). Where the mask file is
+ black, the first image is selected. Where the mask file is white, the last
+ image is selected. Intermediate levels of gray select intermediate
+-images.
++images.
+
+
+ - --stdev=number
+@@ -77,7 +77,7 @@ that includes roughly equal amounts of the corresponding pixel from images 1
+ and 2 but less of the corresponding pixel from image 3. As number
+ tends towards the number of input images (going beyond that has diminishing
+ impact), the output tends to look more
+-like --blend=average. number defaults to 0.25.
++like --blend=average. number defaults to 0.25.
+
+
+ - --randomseed integer
+@@ -91,39 +91,39 @@ like --blend=average. number defaults to 0.25.
+
+
ARGUMENTS
+
+-You supply the names of the files to mix as non-option arguments.
++
You supply the names of the files to mix as non-option arguments.
+
+
+ EXAMPLES
+
+-Average a bunch of PPM images to produce a new PAM image:
++
Average a bunch of PPM images to produce a new PAM image:
+
+ pammixmulti input*.ppm >output.ppm
+
+
+ Mix these same images by taking each pixel from a randomly selected input
+-image:
++image:
+
+
+ pammixmulti --blend=random input*.ppm >output.ppm
+
+
+ Use a mask image to control the fading among input images on a
+-pixel-by-pixel basis:
++pixel-by-pixel basis:
+
+
+ pammixmulti --blend=mask --maskfile=mask.pgm >output.pam \
+ one.pam two.pam three.pam four.pam
+
+
+-Do the same but with more abrupt transitions:
++
Do the same but with more abrupt transitions:
+
+
+ pammixmulti --blend=mask --maskfile=mask.pgm --stdev=0.0 >output.pam \
+ one.pam two.pam three.pam four.pam
+
+
+-and now with more gradual transitions:
++
and now with more gradual transitions:
+
+
+ pammixmulti --blend=mask --maskfile=mask.pgm --stdev=1.0 >output.pam \
+@@ -138,7 +138,7 @@ pixel-by-pixel basis:
+
+ AUTHOR
+
+-Copyright 2018 Scott Pakin, scott+pbm@pakin.org.
++
Copyright 2018 Scott Pakin, scott+pbm@pakin.org.
+
+ SEE ALSO
+
+@@ -152,14 +152,14 @@ pixel-by-pixel basis:
+ Table Of Contents
+
+
+
+
diff --git a/netpbm.spec b/netpbm.spec
index 95ce72e..d8ce976 100644
--- a/netpbm.spec
+++ b/netpbm.spec
@@ -1,7 +1,7 @@
Summary: A library for handling different graphics file formats
Name: netpbm
-Version: 10.90.00
-Release: 2%{?dist}
+Version: 10.92.00
+Release: 1%{?dist}
# See copyright_summary for details
License: BSD and GPLv2 and IJG and MIT and Public Domain
URL: http://netpbm.sourceforge.net/
@@ -24,14 +24,13 @@ Patch9: netpbm-xwdfix.patch
Patch10: netpbm-multilib.patch
Patch11: netpbm-glibc.patch
Patch12: netpbm-docfix.patch
-Patch13: netpbm-fiasco-overflow.patch
-Patch14: netpbm-cmuwtopbm.patch
-Patch15: netpbm-pamtojpeg2k.patch
-Patch16: netpbm-manfix.patch
-Patch17: netpbm-manual-pages.patch
-Patch18: netpbm-jasper.patch
-Patch19: netpbm-userguide.patch
-Patch20: netpbm-libdir-so.patch
+Patch13: netpbm-cmuwtopbm.patch
+Patch14: netpbm-pamtojpeg2k.patch
+Patch15: netpbm-manfix.patch
+Patch16: netpbm-manual-pages.patch
+Patch17: netpbm-jasper.patch
+Patch18: netpbm-userguide.patch
+Patch19: netpbm-libdir-so.patch
BuildRequires: libjpeg-devel, libpng-devel, libtiff-devel, flex, gcc, jbigkit-devel
BuildRequires: libX11-devel, perl-generators, python3, jasper-devel, libxml2-devel
@@ -230,6 +229,9 @@ popd
%doc userguide/*
%changelog
+* Wed Oct 07 2020 Josef Ridky - 10.92.00-1
+- New upstream release 10.92.00 (#1851753)
+
* Tue Jul 28 2020 Fedora Release Engineering - 10.90.00-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild