From 6520ba94f7d1487304288452242c524b2c3ce243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=98=C3=ADdk=C3=BD?= Date: Wed, 7 Oct 2020 14:25:58 +0200 Subject: [PATCH] New upstream release (#1851753) --- netpbm-docfix.patch | 107 +- netpbm-fiasco-overflow.patch | 12 - netpbm-manfix.patch | 1563 +++++++++++++++++-- netpbm-manual-pages.patch | 664 +++++---- netpbm-security-code.patch | 2718 +++++++++++++++++++++++++++++++++- netpbm-userguide.patch | 153 +- netpbm.spec | 22 +- 7 files changed, 4634 insertions(+), 605 deletions(-) delete mode 100644 netpbm-fiasco-overflow.patch diff --git a/netpbm-docfix.patch b/netpbm-docfix.patch index 33b3b77..fe85568 100644 --- a/netpbm-docfix.patch +++ b/netpbm-docfix.patch @@ -1,7 +1,21 @@ -diff -urNp old/userguide/cameratopam.html new/userguide/cameratopam.html ---- old/userguide/cameratopam.html 2017-09-05 09:05:16.000000000 +0200 -+++ new/userguide/cameratopam.html 2017-09-05 13:16:33.622352535 +0200 -@@ -25,10 +25,10 @@ cameratopam - convert raw camera image t +diff --git a/converter/pbm/pbmtoepson.c b/converter/pbm/pbmtoepson.c +index 122a438..5d67746 100644 +--- a/converter/pbm/pbmtoepson.c ++++ b/converter/pbm/pbmtoepson.c +@@ -75,7 +75,7 @@ parseCommandLine(int argc, + &dpiSpec, 0); + OPTENT3(0, "adjacent", OPT_FLAG, NULL, + &adjacentSpec, 0); +- OPTENT3(0, "nonadjacent", OPT_FLAG, NULL, ++ OPTENT3(0, "noadjacent", OPT_FLAG, NULL, + &nonadjacentSpec, 0); + + opt.opt_table = option_def; +diff --git a/userguide/cameratopam.html b/userguide/cameratopam.html +index b50bfeb..3af9008 100644 +--- a/userguide/cameratopam.html ++++ b/userguide/cameratopam.html +@@ -24,10 +24,10 @@ cameratopam - convert raw camera image to PAM [-balance_camera] [-red_scale=float] [-blue_scale=float] @@ -14,7 +28,7 @@ diff -urNp old/userguide/cameratopam.html new/userguide/cameratopam.html [-linear] [-verbose] -@@ -106,7 +106,7 @@ the default. +@@ -110,7 +110,7 @@ the default.
Further adjust the color balance by multiplying the red and blue channels by these values. Both default to 1.0. @@ -23,7 +37,7 @@ diff -urNp old/userguide/cameratopam.html new/userguide/cameratopam.html
Change the output brightness. Default is 1.0. -@@ -114,14 +114,14 @@ channels by these values. Both default +@@ -118,14 +118,14 @@ channels by these values. Both default to 1.0.
By default, cameratoapm clips all colors to prevent pink hues in the highlights. Combine this option with @@ -40,47 +54,49 @@ diff -urNp old/userguide/cameratopam.html new/userguide/cameratopam.html
For cameras based on the Fuji Super CCD SR, this option causes cameratopam to use the secondary sensors, in effect -diff -urNp old/userguide/fiascotopnm.html new/userguide/fiascotopnm.html ---- old/userguide/fiascotopnm.html 2017-09-05 09:05:16.000000000 +0200 -+++ new/userguide/fiascotopnm.html 2017-09-05 13:32:51.810458154 +0200 -@@ -51,7 +51,7 @@ the output file(s) are written to the fi +diff --git a/userguide/fiascotopnm.html b/userguide/fiascotopnm.html +index c33f701..fa84441 100644 +--- a/userguide/fiascotopnm.html ++++ b/userguide/fiascotopnm.html +@@ -56,7 +56,7 @@ the output file(s) are written to the first (writable) directory of this list. Otherwise, the current directory is used to store the output file(s). --
-z, --fast -+
-r, --fast -
+-
-z, --fast ++
-r, --fast +
Decompress images in the 4:2:0 format; i.e., each chroma channel is decompressed to an image of halved width and height. Use this option -@@ -83,7 +83,7 @@ given amount N. N is 1 (mi - is 70. When N=0, then the smoothing amount specified in the +@@ -88,7 +88,7 @@ given amount N. N is 1 (minimum) to 100 (maximum); default + is 70. When N=0, then the smoothing amount specified in the FIASCO file is used (defined by the FIASCO coder). --
-F N, --fps=N -+
-F N, --framerate=N -
- Set number of frames per second to N. When using this option, +-
-F N, --fps=N ++
-F N, --framerate=N +
+ Set number of frames per second to N. When using this option, the frame rate specified in the FIASCO file is overridden. -@@ -113,13 +113,8 @@ following methods (in the specified orde -
  • --config=name - +@@ -118,13 +118,8 @@ following methods (in the specified order): +
  • --config=name + --
    -h, --info --
    +-
    -h, --info +-
    -Print brief help, then exit. - --
    -H, --help --
    +-
    -H, --help +-
    -Print detailed help, then exit. -+
    -h, --help ++
    -h, --help +Print help, then exit. - + -diff -urNp old/userguide/pamperspective.html new/userguide/pamperspective.html ---- old/userguide/pamperspective.html 2017-09-05 09:05:16.000000000 +0200 -+++ new/userguide/pamperspective.html 2017-09-05 13:23:15.869997105 +0200 -@@ -220,7 +220,7 @@ default rectangle as the "frame." The vi +diff --git a/userguide/pamperspective.html b/userguide/pamperspective.html +index 018f18a..13073d2 100644 +--- a/userguide/pamperspective.html ++++ b/userguide/pamperspective.html +@@ -223,7 +223,7 @@ default rectangle as the "frame." The visible part is always a rectangle the axes of which are parallel to those of the frame.

    The frame options are additive. All the parts of the image @@ -89,31 +105,20 @@ diff -urNp old/userguide/pamperspective.html new/userguide/pamperspective.html --include (or their defaults) are in the visible part. The visible part is the smallest possible rectangle that contains the parts specified those three ways. -diff -urNp old/converter/pbm/pbmtoepson.c new/converter/pbm/pbmtoepson.c ---- old/converter/pbm/pbmtoepson.c 2018-01-04 14:26:14.740024843 +0100 -+++ new/converter/pbm/pbmtoepson.c 2018-01-04 14:28:47.970518766 +0100 -@@ -75,7 +75,7 @@ parseCommandLine(int ar - &dpiSpec, 0); - OPTENT3(0, "adjacent", OPT_FLAG, NULL, - &adjacentSpec, 0); -- OPTENT3(0, "nonadjacent", OPT_FLAG, NULL, -+ OPTENT3(0, "noadjacent", OPT_FLAG, NULL, - &nonadjacentSpec, 0); - - opt.opt_table = option_def; -diff -urNp old/userguide/pbmtoepson.html new/userguide/pbmtoepson.html ---- old/userguide/pbmtoepson.html 2018-01-04 14:26:14.586024719 +0100 -+++ new/userguide/pbmtoepson.html 2018-01-04 14:27:56.466847698 +0100 -@@ -18,7 +18,7 @@ pbmtoepson - convert a PBM image into Ep +diff --git a/userguide/pbmtoepson.html b/userguide/pbmtoepson.html +index baacf7b..e74a7fe 100644 +--- a/userguide/pbmtoepson.html ++++ b/userguide/pbmtoepson.html +@@ -16,7 +16,7 @@ pbmtoepson - convert a PBM image into Epson printer graphics [-dpi=n] - [-protocol={escp9|escp}] + [-protocol={escp9|escp}] [-adjacent] -[-nonadjacent] +[-noadjacent] - [pbmfile] + [pbmfile] -@@ -74,7 +74,7 @@ print density for you consistent with yo +@@ -75,7 +75,7 @@ print density for you consistent with your other options.

    This option was new in Netpbm 10.23 (July 2004).

    -adjacent diff --git a/netpbm-fiasco-overflow.patch b/netpbm-fiasco-overflow.patch deleted file mode 100644 index 850dbc3..0000000 --- a/netpbm-fiasco-overflow.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up netpbm-10.47.09/converter/other/fiasco/lib/image.h.fiasco-overflow netpbm-10.47.09/converter/other/fiasco/lib/image.h ---- netpbm-10.47.09/converter/other/fiasco/lib/image.h.fiasco-overflow 2010-01-25 09:00:48.000000000 +0100 -+++ netpbm-10.47.09/converter/other/fiasco/lib/image.h 2010-01-27 10:29:48.000000000 +0100 -@@ -29,7 +29,7 @@ typedef struct image - * Image data - */ - { -- char id [7]; -+ char id [8]; - unsigned reference_count; - unsigned width; /* Width of the image */ - unsigned height; /* Height of the image */ diff --git a/netpbm-manfix.patch b/netpbm-manfix.patch index 54df85f..bab0e6c 100644 --- a/netpbm-manfix.patch +++ b/netpbm-manfix.patch @@ -1,33 +1,97 @@ -diff -urNp old/userguide/avstopam.html new/userguide/avstopam.html ---- old/userguide/avstopam.html 2017-09-05 13:58:08.338559550 +0200 -+++ new/userguide/avstopam.html 2017-09-05 14:00:27.371039472 +0200 -@@ -1,8 +1,7 @@ - -- -+ - - Avstopam User Manual -- - - +diff --git a/userguide/avstopam.html b/userguide/avstopam.html +index eb39766..d104518 100644 +--- a/userguide/avstopam.html ++++ b/userguide/avstopam.html +@@ -2,25 +2,29 @@ + Avstopam User Manual -diff -urNp old/userguide/escp2topbm.html new/userguide/escp2topbm.html ---- old/userguide/escp2topbm.html 2017-09-05 13:58:08.335559561 +0200 -+++ new/userguide/escp2topbm.html 2017-09-05 14:01:20.226842694 +0200 -@@ -6,6 +6,7 @@ Updated: 14 July 2015 -
    - Table Of Contents +

    avstopam

    +-Updated: 07 February 2010 +-
    ++ ++

    Updated: 7 February 2010

    ++ ++

    Table Of Contents

    ++ + Table Of Contents +

    NAME

    + +-

    avstopam - convert an AVS X image to a Netpbm image ++

    avstopam - convert an AVS X image to a Netpbm image

    ++ + +-

    SYNOPSIS

    ++

    SYNOPSIS

    + +

    avstopam + [avsfile] + +

    DESCRIPTION

    + +-

    This program is part of Netpbm. ++

    This program is part of Netpbm.

    + +

    avstopam reads a Stardent AVS X image as input and produces a Netpbm +-image as output. ++image as output.

    + +

    avsfile is the input file, which defaults to Standard Input. + Output is always on Standard Output. +@@ -30,26 +34,26 @@ Output is always on Standard Output. +

    There are no command line options defined specifically + for avstopam, 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

    + +-

    pamtoavs, pam ++

    pamtoavs, pam

    + +
    + +

    Table Of Contents

    + + + +diff --git a/userguide/escp2topbm.html b/userguide/escp2topbm.html +index 9e808b7..33b19a0 100644 +--- a/userguide/escp2topbm.html ++++ b/userguide/escp2topbm.html +@@ -8,6 +8,7 @@ Updated: 14 July 2015 + +

    NAME

    +

    NAME

    escp2topbm - convert an ESC/P2 printer file to a PBM image -

    SYNOPSIS

    -diff -urNp old/userguide/faxformat.html new/userguide/faxformat.html ---- old/userguide/faxformat.html 2017-09-05 13:58:08.337559553 +0200 -+++ new/userguide/faxformat.html 2017-09-05 14:02:33.322571279 +0200 +

    SYNOPSIS

    +diff --git a/userguide/faxformat.html b/userguide/faxformat.html +index 44b1ba5..827ffc8 100644 +--- a/userguide/faxformat.html ++++ b/userguide/faxformat.html @@ -5,10 +5,11 @@ Updated: 03 December 2008 -
    +
    +

    SYNOPSIS

    This page, part of the Netpbm user's guide, @@ -38,147 +102,1364 @@ diff -urNp old/userguide/faxformat.html new/userguide/faxformat.html

    The ITU (formerly CCITT) publishes standards for operation of fax machines (the idea is to provide a way to be sure that a fax machine is able to receive a fax sent by another). These standards incidentally specify graphics file -diff -urNp old/userguide/pampaintspill.html new/userguide/pampaintspill.html ---- old/userguide/pampaintspill.html 2017-09-05 13:58:08.338559550 +0200 -+++ new/userguide/pampaintspill.html 2017-09-05 14:03:32.625351620 +0200 -@@ -1,8 +1,7 @@ - -- -+ - - Pampaintspill User Manual -- - - +diff --git a/userguide/pampaintspill.html b/userguide/pampaintspill.html +index eeb1cac..e42db76 100644 +--- a/userguide/pampaintspill.html ++++ b/userguide/pampaintspill.html +@@ -2,12 +2,12 @@ + Pampaintspill User Manual -@@ -11,6 +10,7 @@ +

    pampaintspill

    +-Updated: 09 February 2020 ++

    Updated: 09 February 2020 +
    +-Table Of Contents ++Table Of Contents

    -

    Table Of Contents

    +

    NAME

    +-pampaintspill - smoothly spill colors into the background ++

    pampaintspill - smoothly spill colors into the background

    -+

    NAME

    -

    pampaintspill - smoothly spill colors into the background

    +

    SYNOPSIS

    -

    SYNOPSIS

    -diff -urNp old/userguide/pamrecolor.html new/userguide/pamrecolor.html ---- old/userguide/pamrecolor.html 2017-09-05 13:58:08.336559557 +0200 -+++ new/userguide/pamrecolor.html 2017-09-05 14:04:34.714122098 +0200 -@@ -1,8 +1,7 @@ -- -+ - - - Pamrecolor User Manual -- - +@@ -16,31 +16,31 @@ pampaintspill - smoothly spill colors into the background + [--bgcolor=color] + [--wrap] [--all] + [--downsample=number] +-[--power=number] [filename] ++[--power=number] [filename]

    +

    Minimum unique abbreviations of option are acceptable. You may use + double hyphens instead of single hyphen to denote options. You may use + white space in place of the equals sign to separate an option name +-from its value. ++from its value.

    + +

    DESCRIPTION

    + +-

    This program is part of Netpbm. ++

    This program is part of Netpbm.

    + +

    pampaintspill produces a smooth color gradient from all of the + non-background-colored pixels in an input image, effectively "spilling + paint" onto the background. pampaintspill is similar to +-pamgradient but differs in the following characteristics: ++pamgradient but differs in the following characteristics:

    + +
      +
    • pampaintspill accepts any number of paint + sources (non-background-colored pixels), which can lie anywhere + on the canvas. pamgradient accepts exactly +- four paint sources, one in each corner of the image. ++ four paint sources, one in each corner of the image.
    • + +
    • pampaintspill requires an input image while + pamgradient generates a new image from +- scratch. ++ scratch.
    • + +
    • pampaintspill can produce tileable output and + can control how tightly the gradient colors bind to their source +@@ -49,14 +49,14 @@ paint" onto the background. pampaintspill is similar to + +

      Results are generally best when the input image contains just a few, crisp + spots of color. Use your drawing program's pencil tool — as opposed to a +-paintbrush or airbrush tool — with a small nib. ++paintbrush or airbrush tool — with a small nib.

      + +

      OPTIONS

      + +

      In addition to the options common to all programs based on libnetpbm + (most notably -quiet, see + Common Options), pampaintspill recognizes the following +-command line options: ++command line options:

      + +
      +
      --bgcolor=color
      +diff --git a/userguide/pamrecolor.html b/userguide/pamrecolor.html +index 3f341d4..a5f2671 100644 +--- a/userguide/pamrecolor.html ++++ b/userguide/pamrecolor.html +@@ -2,12 +2,15 @@ + Pamrecolor User Manual -@@ -11,7 +10,7 @@ +

      pamrecolor

      +-Updated: 31 July 2010 +-
      +-Table Of Contents -

      Updated: 31 July 2010

      - --

      Table Of Contents

      +-

      NAME

      +-pamrecolor - alter colors without affecting luminance ++

      Updated: 31 July 2010

      ++ +

      Table Of Contents

      ++ ++ ++

      NAME

      ++ ++

      pamrecolor - alter colors without affecting luminance

      + +

      SYNOPSIS

      + +@@ -22,6 +25,7 @@ pamrecolor - alter colors without affecting luminance + [-randomseed=integer] + + [infile] ++

      -

      NAME

      -diff -urNp old/userguide/pamsistoaglyph.html new/userguide/pamsistoaglyph.html ---- old/userguide/pamsistoaglyph.html 2017-09-05 13:58:08.334559565 +0200 -+++ new/userguide/pamsistoaglyph.html 2017-09-05 14:05:25.865944327 +0200 -@@ -1,8 +1,7 @@ - -- -+ - - Pamsistoaglyph User Manual -- - +

      Minimum unique abbreviation of option is acceptable. You may use double +@@ -30,7 +34,7 @@ space in place of the equals sign to separate an option name from its value. +

      DESCRIPTION

      + +-

      This program is part of Netpbm. ++

      This program is part of Netpbm.

      + +

      pamrecolor changes an image's colors to be as close as + possible to given target colors but with the constraint that the +@@ -39,7 +43,7 @@ image will look identical if both are converted to grayscale + (e.g. with + ppmtopgm). You can have pamrecolor select + target colors randomly, specify a single hue for the entire image, or take the +-target colors from a target image. ++target colors from a target image.

      + +

      pamrecolor works on pseudo-Netpbm images based on arbitrary + color spaces. You can define the color space explicitly or choose one +@@ -49,7 +53,7 @@ of many that pamrecolor knows by name. + exact format of the PAM. If you want a PNM (PBM, PGM, or PPM) image, + use pamtopnm on the output. There is no + need to convert if you will use the image as input to a current Netpbm +-program, but many other programs don't know what a PAM is. ++program, but many other programs don't know what a PAM is.

      + + +

      OPTIONS

      +@@ -57,7 +61,7 @@ program, but many other programs don't know what a PAM is. +

      In addition to the options common to all programs based on libnetpbm + (most notably -quiet, see + Common Options), pamrecolor recognizes the following +-command line options: ++command line options:

      + +
      + +@@ -109,12 +113,12 @@ the format that uses sRGB. +

      The default is "ntsc" because this is the color space that the Netpbm + formats and many graphics utilities use. As a counterexample, + GIMP uses sRGB as its native color +-space. ++space.

      + +

      The luminance values pamrecolor uses for each of the above come from + Bruce Lindbloom's + +-Computing RGB-to-XYZ and XYZ-to-RGB matrices page.

  • ++Computing RGB-to-XYZ and XYZ-to-RGB matrices page.

    + +
    --rmult=fraction
    +
    --gmult=fraction
    +@@ -137,7 +141,7 @@ library routine (e.g., "hotpink" or "#ff69b4"). + +

    If you specify neither --targetcolor nor + --colorfile, pamrecolor will randomly select a target color for +-each pixel of the input image. ++each pixel of the input image.

    + +

    You may not specify both -targetcolor and -colorfile. + +@@ -154,7 +158,7 @@ image to be repeated in a tile pattern. + +

    If you specify neither --targetcolor nor + --colorfile, pamrecolor will randomly select a target color for +-each pixel of the input image. ++each pixel of the input image.

    + +

    You may not specify both -targetcolor and -colorfile. + +@@ -176,23 +180,23 @@ invocations. + +

    EXAMPLES

    + +-

    This command tints an image yellow: ++

    This command tints an image yellow:

    + +
    +-    pamrecolor --targetcolor=yellow colorpic.pam > yellowpic.pam
    ++    pamrecolor --targetcolor=yellow colorpic.pam > yellowpic.pam
    + 
    + +

    This command takes the colors from colorpicture.ppm and applies +-them to graypicture.pgm: ++them to graypicture.pgm:

    + +
    +-    pamrecolor --colorfile=colorpic.ppm graypic.pgm > colorizedpic.pam
    ++    pamrecolor --colorfile=colorpic.ppm graypic.pgm > colorizedpic.pam
    + 
    + +

    The grayscale version of colorizedpic.pam will look just like + graypic.pgm. Note that if you use a non-Netpbm tool to do the conversion to + grayscale, you may additionally need to specify an +-appropriate --colorspace value for your conversion tool. ++appropriate --colorspace value for your conversion tool.

    + + +

    NOTES

    +@@ -203,25 +207,25 @@ appropriate --colorspace value for your conversion tool. + + + +

    HISTORY

    + +-

    Scott Pakin wrote pamrecolor in July 2010. ++

    Scott Pakin wrote pamrecolor in July 2010.

    + +

    pamrecolor was new in Netpbm 10.52 (September 2010). + +@@ -229,7 +233,7 @@ photograph of the late 1800s). +

    AUTHOR

    + +

    Copyright (C) 2010 Scott +-Pakin, scott+pbm@pakin.org. ++Pakin, scott+pbm@pakin.org.

    + + +

    SEE ALSO

    +@@ -246,14 +250,14 @@ Pakin, scott+pbm@pakin.org. +

    Table Of Contents

    + + + + +diff --git a/userguide/pamsistoaglyph.html b/userguide/pamsistoaglyph.html +index 1ca53ac..e545986 100644 +--- a/userguide/pamsistoaglyph.html ++++ b/userguide/pamsistoaglyph.html +@@ -1,15 +1,18 @@ + + Pamsistoaglyph User Manual -diff -urNp old/userguide/pamstereogram.html new/userguide/pamstereogram.html ---- old/userguide/pamstereogram.html 2017-09-05 13:58:08.337559553 +0200 -+++ new/userguide/pamstereogram.html 2017-09-05 14:13:28.523959069 +0200 -@@ -1,5 +1,5 @@ -- -- -+ -+ - - Pamstereogram User Manual - -@@ -10,7 +10,7 @@ - -

    Updated: 19 June 2015

    - --

    Table Of Contents

    ++ +

    pamsistoaglyph

    +-Updated: 05 April 2009 +-
    +-Table Of Contents ++ ++

    Updated: 5 April 2009

    ++ +

    Table Of Contents

    ++ + +

    NAME

    + +-pamsistoaglyph - convert a single-image stereogram to a red/cyan +-anaglyphic image ++

    pamsistoaglyph - convert a single-image stereogram to a red/cyan ++anaglyphic image

    -

    NAME

    -diff -urNp old/userguide/pamtoavs.html new/userguide/pamtoavs.html ---- old/userguide/pamtoavs.html 2017-09-05 13:58:08.329559583 +0200 -+++ new/userguide/pamtoavs.html 2017-09-05 14:05:49.299863901 +0200 -@@ -1,5 +1,5 @@ - -- -+ - - Pamtoavs User Manual - -diff -urNp old/userguide/pamtooctaveimg.html new/userguide/pamtooctaveimg.html ---- old/userguide/pamtooctaveimg.html 2017-09-05 13:58:08.335559561 +0200 -+++ new/userguide/pamtooctaveimg.html 2017-09-05 14:06:21.825752356 +0200 -@@ -1,8 +1,7 @@ - -- -+ - - Pamtooctaveimg User Manual -- - +

    SYNOPSIS

    +@@ -20,11 +23,11 @@ anaglyphic image + [--minsep=number] + [--gray=number] + [in_netpbmfile +- ++

    +

    All options can be abbreviated to their shortest unique prefix. You + may use either white space or an equals sign between an option name +-and its value. ++and its value.

    + + +

    DESCRIPTION

    +@@ -32,7 +35,7 @@ and its value. +

    This program is part of Netpbm. + +

    pamsistoaglyph reads a Netpbm image as input and +-produces a Netpbm image as output. ++produces a Netpbm image as output.

    + +

    pamsistoaglyph takes a single-image stereogram + (SIS) such as those produced by

    + Common Options), pamsistoaglyph recognizes the following +-command line options: ++command line options:

    + +

    For most images, no command-line options need to be specified. The +-following options are available, however, for unusual circumstances. ++following options are available, however, for unusual circumstances.

    + +
    +-
    --invert ++
    --invert
    +
    Swap the left- and right-eye + images. pamsistoaglyph assumes that its input + represents a wall-eyed stereogram and generates the anaglyphic +@@ -71,17 +74,17 @@ following options are available, however, for unusual circumstances. + the page where it should pop out of the page (and vice versa), + this typically implies that the input image represents a + cross-eyed stereogram. Use --invert to correct +- the image depth. ++ the image depth.
    + +-
    --sep=number ++
    --sep=number
    +
    Specify the distance in pixels between the left- and right-eye + images. Essentially, this corresponds to the distance between + repetitions of the background pattern. The --sep + option should rarely be necessary + as pamsistoaglyph is fairly good at determining +- automatically the eye-separation distance. ++ automatically the eye-separation distance.
    + +-
    --minsep=number ++
    --minsep=number
    +
    This option is similar to --sep but + constrains pamsistoaglyph only to + a minimum eye-separation distance. Any distance larger +@@ -90,9 +93,9 @@ following options are available, however, for unusual circumstances. + as pamsistoaglyph is fairly good at determining + automatically the eye-separation distance. The default value for + the minimum eye-separation distance is 10% of the image width; +- this value seems to work well in practice. ++ this value seems to work well in practice.
    + +-
    --gray=number ++
    --gray=number
    +
    Limit the number of gray levels to use when searching for the + optimal eye-separation + distance. Because pamsistoaglyph looks for +@@ -103,7 +106,7 @@ following options are available, however, for unusual circumstances. + unintentional color variations (such as those caused by conversion + from a low-quality JPEG image, for example). The default of 63 + seems to work well so the --gray option should +- rarely be necessary. ++ rarely be necessary.
    +
    + + +@@ -112,22 +115,22 @@ following options are available, however, for unusual circumstances. +

    The registration algorithm used by pamsistoaglyph + was developed specifically for this program. As far as the author + knows, there are no existing algorithms for converting stereograms to +-anaglyphs. The algorithm works as follows: ++anaglyphs. The algorithm works as follows:

    + +
      +
    1. Convert the image to grayscale to increase the ability to identify +- matches. ++ matches.
    2. + +
    3. Count the number of pixels that match N pixels ahead in the +- image for all N in [1, width/2]. ++ image for all N in [1, width/2].
    4. + +
    5. Maintain a running mean (μ) and standard deviation (σ) of +- the number of matched pixels. ++ the number of matched pixels.
    6. + +
    7. Store the N corresponding to each spike in the number of + matched pixels. A spike is defined as a tally that exceeds the + mean plus one, two, or three standard deviations. Only the first +- spike of a given standard-deviation multiplier is stored. ++ spike of a given standard-deviation multiplier is stored.
    8. + +
    9. If a tally greater than μ+3σ was encountered, return the + corresponding N. If not, then if a tally greater than +@@ -138,13 +141,13 @@ anaglyphs. The algorithm works as follows: + produces the minimum average distance between matched pixels + (i.e., #matches divided by #pixels). If no + such N exceeds the minimum allowable eye-separation value, +- return zero to indicate failure. ++ return zero to indicate failure.
    10. + +
    11. If the algorithm returned zero, rerun the algorithm independently + on each row of the input image and return the median of + all N that exceed the minimum allowable eye-separation + value. If no such N exists, abort with an error +- message. ++ message.
    12. +
    + +

    HISTORY

    +@@ -156,7 +159,7 @@ in Netpbm in Release 10.47 (June 2009). +

    AUTHOR

    + +

    Copyright (C) 2009 Scott +-Pakin, scott+pbm@pakin.org. ++Pakin, scott+pbm@pakin.org.

    + + +

    SEE ALSO

    +@@ -174,13 +177,13 @@ Pakin, scott+pbm@pakin.org. +

    Table Of Contents

    + + + + +diff --git a/userguide/pamstereogram.html b/userguide/pamstereogram.html +index 759ca28..eec0e66 100644 +--- a/userguide/pamstereogram.html ++++ b/userguide/pamstereogram.html +@@ -2,13 +2,16 @@ + Pamstereogram User Manual -diff -urNp old/userguide/pnmflip.html new/userguide/pnmflip.html ---- old/userguide/pnmflip.html 2017-09-05 13:58:08.336559557 +0200 -+++ new/userguide/pnmflip.html 2017-09-05 14:07:15.065963977 +0200 -@@ -4,9 +4,11 @@ - -

    pnmflip

    -
    -+

    NAME

    +

    pamstereogram

    +-Updated: 10 May 2020 +-
    +-Table Of Contents ++ ++

    Updated: 10 May 2020

    ++ ++

    Table Of Contents

    ++ + +

    NAME

    + +-pamstereogram - create a single-image stereogram from a PAM depth map ++

    pamstereogram - create a single-image stereogram from a PAM ++depth map

    + +

    SYNOPSIS

    + +@@ -38,13 +41,13 @@ pamstereogram - create a single-image stereogram from a PAM depth map + [-randomseed=integer] + [-tileable] + [infile] +- ++

    + + + +

    DESCRIPTION

    + +-

    This program is part of Netpbm. ++

    This program is part of Netpbm.

    + +

    pamstereogram inputs a depth map (a map of the distances + from your eye of the points in a scene) and outputs a single-image +@@ -54,22 +57,22 @@ eyes. What's exciting about single-image stereograms is that they + don't require special glasses to view, although it does require a bit + of practice to train your eyes to unfocus properly. The + pamstereogram program provides a wealth of control over how the +-stereogram is generated, including the following: ++stereogram is generated, including the following:

    + + +

    The output is a PAM image on standard output. Options control +@@ -79,7 +82,7 @@ if you will use the image as input to a current Netpbm program, but + many other programs don't know what a PAM is. + +

    To make a red/green type of stereogram (that you view with 3-D +-glasses) instead, see ppm3d. ++glasses) instead, see ppm3d.

    + + +

    OPTIONS

    +@@ -87,36 +90,36 @@ glasses) instead, see ppm3d. +

    In addition to the options common to all programs based on libnetpbm + (most notably -quiet, see + Common Options), pamstereogram recognizes the following +-command line options: ++command line options:

    + +

    You may use either single or double hyphens to denote options. You + may use either whitespace or an equals sign to separate an option name +-from its value. ++from its value.

    + +
    + +-
    -verbose ++
    -verbose
    +
    Display messages about image sizes and formats and properties +-of the stereogram being generated. ++of the stereogram being generated.
    + +-
    -blackandwhite ++
    -blackandwhite
    +
    Produce a single-image random-dot black-and-white stereogram. +-This is the default. ++This is the default.
    + +-
    -grayscale +-
    Produce a single-image random-dot grayscale stereogram. ++
    -grayscale
    ++
    Produce a single-image random-dot grayscale stereogram.
    + +-
    -color +-
    Produce a single-image random-dot color stereogram. ++
    -color
    ++
    Produce a single-image random-dot color stereogram.
    + +-
    -maxval=value ++
    -maxval=value
    +
    Designate the maximum value of each gray/color component, i.e. + the color resolution. Smaller values make the output image have + smaller numbers of unique grays/colors. If you don't specify + -maxval, pamstereogram uses the maxval of the input +-image. This option has no effect with -blackandwhite. ++image. This option has no effect with -blackandwhite.
    + +-
    -patfile=pamfile ++
    -patfile=pamfile
    +
    Specify an image to use as a repeated background pattern for + the stereogram instead of a random-dot pattern. Intricate images + generally produce a crisper 3-D effect that simpler images. The +@@ -125,9 +128,9 @@ grayscale or color) as the pattern file. You cannot specify the + -patfile option along with -blackandwhite, + -grayscale, -color, or -maxval. The + -verbose option will give you information on the ideal +-dimensions of the pattern file. ++dimensions of the pattern file.

    + +-
    -xbegin=pixels ++
    -xbegin=pixels
    +
    Specify the horizontal coordinate at which to begin stereogram generation. + The background pattern will be minimally distorted at this point and more + distorted at greater distances. Consider using this in conjunction +@@ -141,7 +144,7 @@ and pamstereogram actually ignores it with respect to -texfile + +

    This option was new in Netpbm 10.71 (June 2015). + +-

    -texfile=pamfile ++
    -texfile=pamfile
    +
    Specify an image to use as the texture for a mapped-texture + stereogram. The idea is that the depth-map image provides the depth + values of the 3-D object/scene while the texture image provides the +@@ -150,10 +153,10 @@ the depth-map image. (Note that it's required to have the same + dimensions.) The texture image's background color is ignored when + blending colors. + +-

    This option was new in Netpbm 10.53 (December 2010). +- ++

    This option was new in Netpbm 10.53 (December 2010).

    ++
    + +-
    -bgcolor=color ++
    -bgcolor=color
    +
    Use color as the texture image's background color instead + of letting pamstereogram determine it automatically. Specify + the color as described for the +@@ -161,10 +164,10 @@ the color as described for the + routine. The -bgcolor option is meaningful only in conjunction + with -texfile. + +-

    This option was new in Netpbm 10.53 (December 2010). +- ++

    This option was new in Netpbm 10.53 (December 2010).

    ++
    + +-
    -smoothing=pixels ++
    -smoothing=pixels
    +
    When used without -texfile, attempt to eliminate artifacts + introduced by edges in the depth map if pixels is greater than zero. + +@@ -175,29 +178,29 @@ by the stereogram's color constraints when producing a mapped-texture + stereogram. In this case, the -smoothing option is helpful + when the texture image includes smooth color transitions (as in a + photograph) but makes crisp texture images (as in a line drawing) +-appear blurry. ++appear blurry.

    + +

    This option was new in Netpbm 10.53 (December 2010). Before +-Netpbm 10.61 (December 2012), it has no effect without -texfile. ++Netpbm 10.61 (December 2012), it has no effect without -texfile.

    ++
    + +- +-
    -xshift=pixels ++
    -xshift=pixels
    +
    Shift the pattern image (designated by -patfile) to the + right by pixels pixels (default: 0). +- +-This option is valid only along with -patfile. ++ ++This option is valid only along with -patfile.
    + +-
    -yshift pixels ++
    -yshift pixels
    +
    Shift the pattern image (designated by -patfile) + downwards by pixels pixels (default: 0). This option is +-valid only along with -patfile. ++valid only along with -patfile.
    + +-
    -magnifypat=scale ++
    -magnifypat=scale
    +
    Magnify each pixel in the pattern file or each random dot by + integral scaling factor scale. Note that + pamstereogram applies the pattern magnification + after pattern shifting (-xshift and +--yshift). ++-yshift).
    + +
    -guidebottom +
    +@@ -211,7 +214,7 @@ square. At that point, a crisp, 3-D image will appear. +

    This option was new in Netpbm 10.61 (December 2012). Before that, + the presence of -guidesize, with a positive value, has the same + effect. +- ++

    + +
    -guidetop +
    +@@ -221,7 +224,7 @@ Same as -guidebottom, except the guides go at the top of the image. + the presence of -guidesize, with a negative value, has the same + effect. + +-
    -guidesize=pixels ++
    -guidesize=pixels
    + +
    The size (width and height) of each guide box. + +@@ -236,15 +239,15 @@ too, and if you specify it with a negative value, it behaves as if you + specified -guidetop and specified guidesize with the absolute + value of that negative value. + +-
    -dpi=resolution ++
    -dpi=resolution
    +
    Specify the resolution of the output device in dots per inch. + The default is 100 DPI, which represents a fairly crisp screen + resolution. + +-

    Before Netpbm 10.53 (December 2010), the default was 96 DPI. +- ++

    Before Netpbm 10.53 (December 2010), the default was 96 DPI.

    ++
    + +-
    -crosseyed ++
    -crosseyed
    +
    Invert the gray levels in the depth map (input image) so that the 3-D + image pops out of the page where it would otherwise sink into the page and + vice versa. Some people are unable to diverge their eyes and can only cross +@@ -255,10 +258,10 @@ colors are farther from the eye. + +

    Before Netpbm 10.53 (December 2010), pamstereogram used higher + (lighter) numbers for things closer to the eye without +--crosseyed and vice versa. ++-crosseyed and vice versa.

    ++
    + +- +-
    -makemask ++
    -makemask
    +
    Instead of a stereogram, output a PAM mask image showing + coloring constraints. New pixels will be taken from the pattern + file where the mask is black. Copies of existing pixels will be +@@ -266,30 +269,30 @@ taken from the pattern file where the mask is white. The + -makemask option can be used to help create more + sophisticated pattern files (to use with -patfile) Note that + -makemask ignores -magnifypat; it always produces +-masks that assume a pattern magnification of 1. ++masks that assume a pattern magnification of 1.
    + +-
    -eyesep=inches ++
    -eyesep=inches
    +
    Specify the separation in inches between your eyes. The + default, 2.5 inches (6.4 cm), should be sufficient for most people +-and probably doesn't need to be changed. ++and probably doesn't need to be changed.
    + +-
    -depth=fraction ++
    -depth=fraction
    +
    Specify the output image's depth of field. That is, + fraction represents the fractional distance of the near + plane from the far plane. Smaller numbers make the 3-D image easier + to perceive but flatter. Larger numbers make the 3-D image more + difficult to perceive but deeper. The default, 0.3333, generally +-works fairly well. ++works fairly well.
    + +-
    -planes=near_pixels,far_pixels ++
    -planes=near_pixels,far_pixels
    +
    Explicitly specify the distance between repeated pixels in the near plane + and in the far plane. This is an alternative to + -eyesep and -depth. The following equalities hold: + +
      +-
    • eyesep = 2 * far ++
    • eyesep = 2 * far
    • +
    • depth = 2 * (farnear) / +- (2 * farnear) ++ (2 * farnear)
    • +
    + +

    The number of distinct 3-D depths is far +@@ -299,10 +302,10 @@ parameters (distance between eyes and tradeoff between perceptibility + and depth) while -planes is a more computer-centric way (pixel + distances in the resulting stereogram). + +-

    This option was new in Netpbm 10.59 (June 2012). +- ++

    This option was new in Netpbm 10.59 (June 2012).

    ++
    + +-
    -randomseed=integer ++
    -randomseed=integer
    +
    Specify a seed to be used for the random number generator. + The default is to use a seed based on the time of day, to one second + granularity. +@@ -313,18 +316,19 @@ every time you run pamstereogram. + +

    This is irrelevant if you use a pattern file (-patfile + option), because there is no random element to pamstereogram's +-behavior. ++behavior.

    + +-

    This option was new in Netpbm 10.32 (February 2006). ++

    This option was new in Netpbm 10.32 (February 2006).

    ++
    + +-
    -tileable ++
    -tileable
    + +
    Make the generated image horizontally tileable. This works by + blending a left-to-right rendering (the equivalent + of -xbegin=0) with a right-to-left rendering (the equivalent + of -xbegin=width−1). + +-

    This option was new in Netpbm 10.91 (June 2020). ++

    This option was new in Netpbm 10.91 (June 2020).

    + +
    + +@@ -333,7 +337,7 @@ of -xbegin=width−1). + +

    The only parameter, infile, is the name of an input file + that is a depth map image. If you don't specify infile, the +-input is from standard input. ++input is from standard input.

    + +

    The input is a PAM image of depth 1. Each sample represents the + distance from the eye that the 3-D image at that location should +@@ -344,10 +348,10 @@ be. Lower (darker) numbers mean further from the eye. +

    Input Images

    + +

    pamstereogram pays no attention to the image's tuple type and +-ignores all planes other than plane 0. ++ignores all planes other than plane 0.

    + +

    Like any Netpbm program, pamstereogram will accept PNM +-input as if it were the PAM equivalent. ++input as if it were the PAM equivalent.

    + +

    Mapped-texture Stereograms

    + +@@ -355,12 +359,12 @@ input as if it were the PAM equivalent. + drawn with true colors. Unlike a SIRDS or tiled-image SIS, however, + the image portrayed by an MTS is apparent in normal 2-D viewing. It + appears repeated multiple times and overlapped with itself, but it is +-not hidden. ++not hidden.

    + +

    You create an MTS with pamstereogram by passing the filename + of a PAM "texture image" with a -texfile option. A + texture image portrays the same 3-D object as the depth-map image but +-indicates the colors that the program should apply to the object. ++indicates the colors that the program should apply to the object.

    + +

    pamstereogram ignores the texture image's background color when it + overlaps copies of the 3-D object. This prevents, for example, a bright-red +@@ -370,32 +374,32 @@ object remains bright red. A consequence of this feature is that an MTS looks + best when the objects in the texture image have a crisp outline. Smooth + transitions to the background color result in unwanted color artifacts around + edges because the program ignores only exact matches with the +-background color. ++background color.

    + +

    You should specify a larger-than-normal value for -eyesep + (and/or -dpi) when producing an MTS. Otherwise, the 3-D object will + repeat so many times that most colored pixels will overlap other colored +-pixels, reducing the number of true-colored pixels that remain. ++pixels, reducing the number of true-colored pixels that remain.

    + +

    An MTS can employ a background pattern (-patfile). In this + case, pamstereogram replaces background pixels with pattern pixels in +-the final step of generating the image. ++the final step of generating the image.

    + + +

    Miscellaneous

    + +

    A good initial test is to input an image consisting of a solid + shape of distance 0 within a large field of maximum distance (e.g., a +-white square on a black background). ++white square on a black background).

    + +

    With the default values for -dpi and -eyesep, pattern +-images that are 128 pixels wide can tile seamlessly. ++images that are 128 pixels wide can tile seamlessly.

    + + +

    EXAMPLES

    + +

    Generate a SIRDS out of small, brightly colored squares and +-prepare it for display on an 87 DPI monitor: ++prepare it for display on an 87 DPI monitor:

    + +
    +     pamstereogram depthmap.pam \
    +@@ -406,7 +410,7 @@ prepare it for display on an 87 DPI monitor:
    + 

    Generate a SIS by tiling a PPM file (a prior run with + -verbose indicates how wide the pattern file should be for + seamless tiling, although any width is acceptable for producing +-SISes): ++SISes):

    + +
    +     pamstereogram depthmap.pam -patfile mypattern.ppm >3d.pam
    +@@ -416,7 +420,7 @@ SISes):
    + 

    Generate an MTS by associating colors with a depth-mapped object + (using a large eye separation to reduce the number of repetitions of + the texture image) and twice smoothing over background-colored +-speckles: ++speckles:

    + +
    +     pamstereogram depthmap.pam \
    +@@ -427,21 +431,21 @@ speckles:
    + 
    + 

    SEE ALSO

    + + + +@@ -457,24 +461,25 @@ Netpbm 10.61 (December 2012). + + +

    AUTHOR

    +-

    Copyright © 2006-2020 Scott Pakin, scott+pbm@pakin.org. ++

    Copyright © 2006-2020 Scott Pakin, scott+pbm@pakin.org.

    + +

    Table Of Contents

    +
      +-
    • SYNOPSIS +-
    • DESCRIPTION +-
    • OPTIONS +-
    • PARAMETERS ++
    • SYNOPSIS
    • ++
    • DESCRIPTION
    • ++
    • OPTIONS
    • ++
    • PARAMETERS
    • +
    • 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">octaveTable 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. - -- +-
    - - - -- +- - - - @@ -506,20 +512,20 @@ index a1ce767..0000000 - - - -- -- -- -- -- -- +- +- +- +- +- +- - - -- -- -- -- -- -- +- +- +- +- +- +- - -
    Original or Decoded? (Normalized)
    ReferenceCompressionSpeedQuality B
    Decoded100010001000969919Decoded100010001000969919
    Original88513731000912884Original88513731000912884
    - @@ -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
    QscaleI FramesP FramesB Frames
    143.246.346.5143.246.346.5
    632.634.634.3632.634.634.3
    1128.629.530.01128.629.530.0
    1626.326.828.61626.326.828.6
    2124.725.027.92124.725.027.9
    2623.523.927.52623.523.927.5
    3122.623.027.33122.623.027.3
    - -- +-
    - - - -- +- - - - - - - -- -- -- -- +- +- +- +- - - -- -- -- -- +- +- +- +- - - -- -- -- -- +- +- +- +- - - -- -- -- -- +- +- +- +- - - -- -- -- -- +- +- +- +- - - -- -- -- -- +- +- +- +- - - -- -- -- -- +- +- +- +- - -
    Qscale vs Compression
    QscaleI FramesP FramesB Frames
    12221222
    671015671015
    1111184311111843
    1615299716152997
    211941173211941173
    262456256262456256
    312873330312873330
    - - --

    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)
    TechniqueCompression1Speed 2Quality 3
    Exhaustive100010001000Exhaustive100010001000
    SubSample100824561000SubSample100824561000
    TwoLevel100932371000TwoLevel100932371000
    Logarithmic10858229998Logarithmic10858229998
    - -- +-
    - - - -- +- - - - - - - -- -- -- -- +- +- +- +- - - -- -- -- -- +- +- +- +- - - -- -- -- -- +- +- +- +- - -
    B frame Motion Vector Search (Normalized)
    TechniqueCompression1Speed2Quality3
    Exhaustive100010001000Exhaustive100010001000
    Cross29751000996Cross29751000996
    Simple9381765991Simple9381765991
    - @@ -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 TypeSizeSpeedQuality
    I frames100010001000I frames100010001000
    P frames409609969P frames409609969
    B frames72260919B frames72260919
    - @@ -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 TypeMacroblocks per second1
    HP 9000/755280HP 9000/755280
    DEC 3000/400247DEC 3000/400247
    HP 9000/750191HP 9000/750191
    Sparc 10104Sparc 10104
    DEC 500068DEC 500068
    -1A macroblock is a 16x16 pixel square @@ -1295,42 +1295,54 @@ index a1ce767..0000000 -problems. - - --

    AUTHORS

    +-

    AUTHORS

    - -- - --
    --  --

    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