home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume36
/
chiaro
/
part07
< prev
next >
Wrap
Text File
|
1993-03-25
|
57KB
|
1,512 lines
Newsgroups: comp.sources.misc
From: jwbirdsa@picarefy.picarefy.com (James W. Birdsall)
Subject: v36i077: chiaro - Image Utilities, Part07/18
Message-ID: <1993Mar25.181120.20340@sparky.imd.sterling.com>
X-Md4-Signature: b28e4d2317f642a90b3124d9241609ab
Date: Thu, 25 Mar 1993 18:11:20 GMT
Approved: kent@sparky.imd.sterling.com
Submitted-by: jwbirdsa@picarefy.picarefy.com (James W. Birdsall)
Posting-number: Volume 36, Issue 77
Archive-name: chiaro/part07
Environment: UNIX, Sun, DECstation, 3B1
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# Contents: src/chils.man src/pbm.c templates/pcix.mk
# Wrapped by kent@sparky on Thu Mar 25 11:20:03 1993
PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 7 (of 18)."'
if test -f 'src/chils.man' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/chils.man'\"
else
echo shar: Extracting \"'src/chils.man'\" \(39840 characters\)
sed "s/^X//" >'src/chils.man' <<'END_OF_FILE'
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
XNAME
X chils - specialized ls for image files
X
XSYNOPSIS
X chils [ -v ][ -f ][ -h ][ -n ][ -w[n] ][ -tformat ][ -spat-
X tern ] [ target ] [ target... ]
X
XDESCRIPTION
X Chils is a specialized ls(1)-equivalent for image files. It
X recognizes a variety of image file formats and prints out
X the file name, file format, file size, and some details of
X image size, colors, etc., depending on what information the
X format contains and how accessible it is.
X
XTARGETS
X A target is a filename or directory. Multiple targets may be
X specified on the command line. If a target is a directory,
X all files in that directory will be processed. If no targets
X are specified on the command line, all files in the current
X directory will be processed.
X
X If the format of a file is recognized, various information
X about the file will be printed to the standard output. Oth-
X erwise, no output is generated for that file unless the -v
X option has been specified.
X
XOPTIONS
X Options may not be combined. In the case of the -t and -s
X options, there cannot be a space between the option and the
X argument to the option.
X
X -v Print a line for every file checked, whether the format
X was recognized or not. If the file format was not
X recognized, a message "ERROR: file filename is of unk-
X nown format" is printed.
X
X -f Prints a list of the names of files of recognized for-
X mats (subject to selection criteria specified by other
X options) on the standard output, separated by newlines.
X The -v option is ignored and all other output is
X suppressed. This output is intended for use as a front
X end for gifstrip and other Chiaro suite programs.
X
X -h Prints a usage message.
X
X -n Chils normally removes the path, if present, from
X filenames when displaying, the better to fit everything
X on one line. This option causes chils to not remove the
X path, if present.
X
X -w[n]
X Chils normally determines the width of the screen
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 1
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X automatically, or defaults the width to 80 columns if
X it cannot get a better answer. This option overrides
X the automatic determination. If a number is not sup-
X plied, the width is set to 80 columns. If a number is
X supplied, the width is set to that value or 80, which-
X ever is greater.
X
X -tformat
X Only files of the specified format will be processed.
X Multiple -t options may be specified; files of all the
X specified types will be processed. The -v option is
X ignored. There must not be a space between the "-t" and
X the format identifier. The complete list of recognized
X format identifiers is printed out in the usage message.
X Format identifiers are case insensitive. At present,
X the following format identifiers are recognized:
X
X GIF87a GIF87a files
X GIF89a GIF89a files
X GIF Any GIF file, either GIF87a or GIF89a
X IMG_1 GEM IMG version 1 files
X IMG Any GEM IMG file
X JFIF101 JPEG File Interchange Format versions
X 1.00 and 1.01
X JFIF Any JFIF file
X SUNRAS Sun raster files
X TARGA TARGA files
X PBM_NORM Portable BitMap files, ASCII format
X PBM_RAW Portable BitMap files, raw format
X PBM Any Portable BitMap file
X PGM_NORM Portable GrayMap files, ASCII format
X PGM_RAW Portable GrayMap files, raw format
X PGM Any Portable GrayMap file
X PPM_NORM Portable PixMap files, ASCII format
X PPM_RAW Portable PixMap files, raw format
X PPM Any Portable PixMap file
X XBM X11 BitMap files
X WIN2BMP MS-Windows 2.x bitmap files
X OS2BMP11 OS/2 1.1-1.3 bitmap files
X WIN3BMP MS-Windows 3.x bitmap files
X OS2BMP20 OS/2 2.0 bitmap files
X BMP Any BMP file.
X PCX_25 PCX version 2.5 files.
X PCX_28 PCX version 2.8 files without palettes.
X PCX_28P PCX version 2.8 files with palettes.
X PCX_30 PCX version 3.0 files.
X PCX Any PCX file.
X
X -spattern
X Selects files according to a complicated Boolean search
X pattern, including search on file format, image height,
X image width, number of colors in the image, and file
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 2
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X size. Only files which meet the specified search cri-
X teria are processed. Any -t and -v options are ignored.
X There must not be a space between the "-s" and the
X search pattern, or within the search pattern. If more
X than one -s option is specified, only the last one on
X the command line will have effect. The search pattern
X may include the following operator characters:
X
X ( ) ( ) parentheses for grouping
X = = equal
X > } greater than
X < { less than
X >= }= greater or equal
X <= {= less or equal
X & + logical AND
X | , logical OR
X
X Normally, the operators in the first column should be
X used. If chils was compiled with the DOS_COMSRCH
X option, then use the operators in the second column.
X Since most of the operators are also shell metacharac-
X ters, the search pattern should be quoted:
X
X chils -s'(W>320)&(H>200)'
X
X The operator characters work on the following elements:
X
X H image height
X W image width
X C image colors
X F file size
X decimal numbers
X format identifiers as for -t
X
XCONFIGURATION
X Many image formats do not include signatures which identify
X them uniquely. The only way to identify these formats is by
X filename. Most formats have one or more extensions which are
X commonly used to identify that format. To accomodate as wide
X a variety of naming systems as possible, chils uses a confi-
X guration file which contains lists of formats and extensions
X which identify those formats. Extensions may also be
X included for those formats which have identification signa-
X tures (GIF and SUNRAS), to avoid false recognition. If
X extensions for these formats are included, only files with
X those extensions will be checked for the signature; other-
X wise all files will be checked.
X
X The configuration file must be named chils.cfg. Chils
X searches for it first in the current directory. If there is
X no such file in the current directory, chils checks for the
X existence of an environment variable CHIHOME. If it exists,
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 3
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X it is assumed to contain the directory in which the confi-
X guration file resides. Finally, chils searches in the direc-
X tory containing the chils executable. This three-layer sys-
X tem allows local configuration files which override the main
X configuration file, and allows the main configuration file
X to be anywhere, not necessarily in the directory with the
X executable. If the configuration file does not exist, a
X warning message is issued. Formats for which chils needs an
X extension list, but which do not have an entry in the confi-
X guration file, will not be processed. The default configura-
X tion file supplied with the source code contains entries for
X all formats which chils can process.
X
X Blank lines in chils.cfg are ignored. Comments begin with
X '#'. The '#' must be the first non-whitespace character on
X the line, but it does not have to be in the first column.
X Both spaces and tabs are recognized as whitespace. Comments
X are terminated by the end of the line.
X
X Each format entry consists of one line. The syntax of the
X entry is:
X
X format_name extension [[,] extension...]
X
X The format name and extensions are case sensitive. The line
X may contain leading whitespace before the format name. The
X format name must be separated from the first extension by at
X least one space or tab. There must be at least one extension
X on the line. Additional extensions may be separated by com-
X mas and/or whitespace. The entry is terminated by the end of
X the line. Warnings are generated when chils encounters an
X unrecognized format name, an entry with only a format name
X (no extension list), or a zero-length extension (caused by
X two commas in a row, for example).
X
X Format identifiers recognized by CHILS are: GIF, IMG, JFIF,
X SUNRAS, TARGA, PBM, PGM, PPM, XBM, BMP, and PCX.
X
XOUTPUT
X The output generated by chils varies according to the format
X of the image, but the meaning of some columns is constant.
X
X GIF87A -G 110871 381 x 480 @ 64 C~80 ssb28c.gif
X GIF89A -G- 2657 640 x 480 @ 16 C~1 ASnone 89aillus.gif
X GIF89A -G- 62318 640 x 480 @ 16 C~40 AS49/64 grney5.gif
X IMG_1 - 62630 960 x 960 @ 2 C~54 AS 85/85 P1 example1.img
X JFIF101 - 18314 264 x 341, 3 @ 8 C~5 AS 1/ 1 lat1.jpg
X JFIF101 - 44046 976 x 768, 1 @ 8 C~7 AS 1/ 1 slf1n.jpg
X JFIF101 - 62139 597 x 480, 3 @ 8 C~8 72 x 72 dpi jol1.jpg
X SUNRAS CV 4435 80 x 50 @ 256 C~90 ML=768 encoded.im8
X SUNRAS C- 32150 871 x 871 @ 2 C~33 jupiterc.im1
X SUNRAS SV 4800 80 x 50 @ 256 ML=768 standard.sun
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 4
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X SUNRAS S- 1568 16 x 32, 24 bit stndrd24.im24
X TARGA -UM- 4756 80 x 50 @ 246 T1 A0 type1.tga
X TARGA -UC- 1554 16 x 32, 24 bit T2 A0 type2.tga
X TARGA -UB- 186 24 x 7 @ 256 T3 A0 type3.tga
X PBM_RAW R 29 24 x 7 @ 2 feep-raw.pbm
X PGM_RAW R 180 24 x 7 @ 256 MaxVal = 255 feep-raw.pgm
X PPM_RAW R 59 4 x 4, 24 bit MaxVal = 255 feep-raw.ppm
X PBM_NORM N 355 24 x 7 @ 2 feep.pbm
X PGM_NORM N 519 24 x 7 @ 16 MaxVal = 15 feep.pgm
X PPM_NORM N 189 4 x 4 @ 4096 MaxVal = 15 feep.ppm
X XBM 182 24 x 7 @ 2 'feep' feep.xbm
X WIN3BMP -- 5078 80 x 50 @ 256 256color.bmp
X WIN3BMP -- 630 32 x 32 @ 16 argyle.bmp
X PCX_30 RC 4715 80 x 50 @ 256 C~114 CX 80,CY 50 color.pcx
X PCX_30 RC 191 24 x 7 @ 8 C~100 CX 24,CY 7 feepgray.pcx
X PCX_30 RC 152 24 x 7 @ 2 C~114 CX 24,CY 7 feepmono.pcx
X
X The first column is always the format (see the list under
X the -t option above). The second column, if present, is a
X group of flags whose meaning varies according to the image
X (see below). The third column is the filesize. Next is the
X width and the height of the image (or a reasonable approxi-
X mation) in pixels, then the number of colors in the image in
X a format which depends on the image. After that is miscel-
X laneous format-dependent information; frequently a compres-
X sion ratio is given, indicated by "C~". The last column is
X always the filename. If the filename is too long to fit on
X the line, it is put on the line immediately following, right
X justified.
X
X GIF87a
X
X GIF87A EG 53882 398 x 548 @ 16 C~49 bar4.gif
X GIF87A -G 110871 381 x 480 @ 64 C~80 ssb28c.gif
X GIF87A -- 59392 320 x 240 @ --- C~-- tt.gif
X
X The GIF87A format has two flags. The first is "E" if extra
X characters are detected on the end of the file, or "-" if
X not. The second is "G" if the file contains a global color
X table, or "-" if not. Note that the "E" flag is only a quick
X and dirty check for extra characters on the end of the file.
X If the last character of the file is the GIF Terminator, "-"
X is displayed; if it is not, "E" is displayed. This check
X will be fooled if the file contains extra characters which
X happen to end with the GIF Terminator character. Gifstrip
X and gifcheck offer reliable detection of extra characters
X (and, in the case of gifstrip, removal thereof).
X
X The width and height displayed are for the logical screen,
X not the actual image. Typically the image or images in the
X file will be the same size as the logical screen, but this
X is not required. Unfortunately, it is not possible to
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 5
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X extract the size of the actual image or images without pars-
X ing much of the file, which is beyond the scope of chils.
X
X The number of colors shown is the size of the global color
X table, or "---" if there is no global color table. Images
X typically do not use all the colors in the global color
X table; the number should be regarded as an upper limit on
X the colors in the actual image rather than the actual fig-
X ure. Gifcheck can determine the number of unique colors
X actually used.
X
X The only format-dependent display is the compression ratio.
X "--" is displayed if no global color table is present, since
X the calculation relies on the size of that table. The
X compression ratio is calculated by multiplying the height by
X the width, then multiplying that result by the number of
X bits required to represent the colors in the image (based on
X the size of the global color table), and dividing by 8 to
X obtain the number of bytes which the image data would occupy
X when uncompressed. Finally, the present file size is divided
X by the computed uncompressed size, which yields the size of
X the compressed image as a percentage of the uncompressed
X size. Note that the value displayed may be radically
X incorrect if the file contains multiple images, if the file
X contains extension blocks, if the image uses a local color
X table, if the image is smaller than the logical screen size,
X or if there are very many extra characters on the end of the
X file.
X
X GIF89a
X
X GIF89A -G- 2657 640 x 480 @ 16 C~1 ASnone 89aillus.gif
X GIF89A -G- 62318 640 x 480 @ 16 C~40 AS49/64 grney5.gif
X
X The GIF89A format has three flags. The first is "E" if extra
X characters are detected on the end of the file, or "-" if
X not. The second is "G" if the file contains a global color
X table, or "-" if not. The third is "S" if the global color
X table is sorted in order of decreasing importance, or "-" if
X not. Note that the "E" flag is only a quick and dirty check
X for extra characters on the end of the file. If the last
X character of the file is the GIF Terminator, "-" is
X displayed; if it is not, "E" is displayed. This check will
X be fooled if the file contains extra characters which happen
X to end with the GIF Terminator character. Gifstrip and
X gifcheck offer reliable detection of extra characters (and,
X in the case of gifstrip, removal thereof).
X
X The width and height displayed are for the logical screen,
X not the actual image. Typically the image or images in the
X file will be the same size as the logical screen, but this
X is not required. Unfortunately, it is not possible to
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 6
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X extract the size of the actual image or images without pars-
X ing much of the file, which is beyond the scope of chils.
X
X The number of colors shown is the size of the global color
X table, or "---" if there is no global color table. Images
X typically do not use all the colors in the global color
X table; the number should be regarded as an upper limit on
X the number of colors in the actual image rather than the
X actual figure. Gifcheck can determine the number of unique
X colors actually used.
X
X Format-dependent displays for GIF89a are the compression
X ratio and aspect ratio, in that order.
X
X If no global color table is present, "--" is displayed for
X the compression ratio, since the calculation relies on the
X size of that table. The compression ratio is calculated by
X multiplying the height by the width, then multiplying that
X result by the number of bits required to represent the
X colors in the image (based on the size of the global color
X table), and dividing by 8 to obtain the number of bytes
X which the image data would occupy when uncompressed.
X Finally, the present file size is divided by the computed
X uncompressed size, which yields the size of the compressed
X image as a percentage of the uncompressed size. Note that
X the value displayed may be radically incorrect if the file
X contains multiple images, if the file contains extension
X blocks, if the image uses a local color table, if the image
X is smaller than the logical screen size, or if there are
X very many extra characters on the end of the file.
X
X The aspect ratio is given in 64ths. If there is no aspect
X ratio, "none" is displayed.
X
X IMG_1
X
X IMG_1 - 62630 960 x 960 @ 2 C~54 AS 85/85 P1 example1.img
X
X Note that there are many file formats named "IMG", a situa-
X tion which is confusing at best. Chils recognizes only the
X GEM IMG format.
X
X The IMG_1 format has one flag. It is "L" if the IMG header
X is extended (to contain a palette, for example), or "-" if
X the header is of normal length.
X
X The maximum number of colors in the file is calculated from
X the number of bit planes; the actual number of colors used
X may be less than the number shown.
X
X Format-dependent displays for IMG_1 are the compression
X ratio, aspect ratio, and pattern length, in that order.
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 7
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X The compression ratio is computed by multiplying the height
X by the width, then multiplying that result by the number of
X bit planes, and dividing by 8 to obtain the number of bytes
X which the image data would occupy when uncompressed.
X Finally, the present file size minus the header length is
X divided by the computed uncompressed size, which yields the
X size of the compressed image as a percentage of the
X uncompressed size. The compression ratio is reasonably accu-
X rate. Since the header length is known accurately, that
X number is subtracted from the filesize to get a more accu-
X rate compressed size. The compression ratio will only be
X incorrect if there are junk characters on the end of the
X file.
X
X The aspect ratio is always present. The numbers also
X represent the width and height, respectively, of a pixel, in
X microns. 85 microns is approximately equivalent to 300 pix-
X els per inch.
X
X The pattern length in pixels is used when decompressing the
X image.
X
X JFIF1.01
X
X JFIF101 - 18314 264 x 341, 3 @ 8 C~5 AS 1/ 1 lat1.jpg
X JFIF101 - 44046 976 x 768, 1 @ 8 C~7 AS 1/ 1 slf1n.jpg
X JFIF101 - 62139 597 x 480, 3 @ 8 C~8 72 x 72 dpi jol1.jpg
X
X The JFIF 1.0 and 1.01 formats differ minimally; chils treats
X them as identical.
X
X The JFIF101 format has one flag. It is "T" if a thumbnail
X image is present in the file, or "-" if not.
X
X The number of colors is expressed as the number of "com-
X ponents" (usually 3 or 1) by the number of bits per com-
X ponent (usually 8). Images with three components are full-
X color, while images with one are, by convention, grayscale.
X
X Format-dependent displays for JFIF101 are the compression
X ratio and aspect ratio or pixel density, in that order.
X
X The compression ratio is computed by multiplying the height
X by the width, then multiplying that result by the number of
X components times the bits per component, and dividing by 8
X to obtain the number of bytes which the image data would
X occupy when uncompressed. Finally, the present file size is
X divided by the computed uncompressed size, which yields the
X size of the compressed image as a percentage of the
X uncompressed size. Note that the image itself is actually
X compressed even more than shown, since the present file size
X includes all the headers and other, non-image information
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 8
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X present in the file.
X
X JFIF101 files contain either an aspect ratio or a pixel den-
X sity. If an aspect ratio is present, it is expressed as a
X fraction. If pixel density is present instead, it is
X displayed as the horizontal density by the vertical density
X followed by the units, which are either "dpi" (pixels/dots
X per inch) or "dpcm" (pixels/dots per centimeter).
X
X SUNRAS
X
X SUNRAS CV 4435 80 x 50 @ 256 C~90 ML=768 encoded.im8
X SUNRAS C- 32150 871 x 871 @ 2 C~33 jupiterc.im1
X SUNRAS SV 4800 80 x 50 @ 256 ML=768 standard.sun
X SUNRAS S- 1568 16 x 32, 24 bit stndrd24.im24
X
X Sun Raster files are a format developed by Sun Microsystems
X for use on their workstations.
X
X The SUNRAS format has two flags. The first is "O" for 'old'
X format files (left over from ancient versions of SunOS), "S"
X for standard files, "C" for compressed files, "R" for 24-bit
X files with reversed color-component order, "T" for "tiff <->
X standard rasterfile" (don't ask me), "I" for "iff (TAAC for-
X mat) <-> standard rasterfile" (again, don't ask me), and "E"
X for 'experimental' formats. The second flag is "-" if the
X file does not have a colormap, "V" if the colormap is in
X 'vector' format (all red components grouped together, all
X green components grouped together in the same order, etc.),
X or "R" if the colormap is in 'raw' format (usually RGB tri-
X ples).
X
X The number of colors is expressed either as a number or as
X the number of bits per pixel, depending on which fits in the
X available space. In the case of a plain number, not all
X colors may be used; the number should be regarded as an
X upper limit on the number of colors in the actual image
X rather than the actual figure.
X
X Format-dependent displays for SUNRAS are the compression
X ratio (if a compressed format) and the length of the color-
X map in bytes (if a colormap is present), in that order.
X
X The compression ratio is computed by multiplying the height
X by the width, then multiplying that result by the number of
X bits per pixel, and dividing by 8 to obtain the number of
X bytes which the image data would occupy when uncompressed.
X Finally, the size of the compressed data (maintained in the
X file header) is divided by the computed uncompressed size,
X which yields the size of the compressed image as a percen-
X tage of the uncompressed size. The compression ratio is
X accurate unless the file is corrupted.
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 9
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X If a colormap is present, the length in bytes is displayed
X as "ML=nnn".
X
X TARGA
X
X TARGA -UM- 4756 80 x 50 @ 246 T1 A0 type1.tga
X TARGA -UC- 1554 16 x 32, 24 bit T2 A0 type2.tga
X TARGA -UB- 186 24 x 7 @ 256 T3 A0 type3.tga
X
X The Targa format was developed by AT&T in conjunction with
X their TrueVision graphics hardware.
X
X The TARGA format has four flags. The first is "-" if the
X file contains an image or "N" if not. The second is "-" for
X no image, "U" for an uncompressed image, "R" for a
X runlength-encoded image, or "C" for an LZW-compressed image.
X The third is "-" for no image, "M" for a colormapped image,
X "B" for a grayscale image, or "C" for a full-color image.
X The fourth flag indicates the scan-line interleave of the
X image: "-" for noninterleaved, "2" or "4" for two- or four-
X way interleaving, or "R" for a reserved value.
X
X The number of colors is expressed either as a number or as
X the number of bits per pixel. If the image is colormapped,
X the length of the colormap is displayed. If the image is not
X colormapped (either grayscale or full-color), either a
X number or the number of bits is displayed depending on which
X fits in the available space. In the case of a plain number,
X not all colors may be used; the number should be regarded as
X an upper limit on the number of colors in the actual image
X rather than the actual figure.
X
X Format-dependent displays for TARGA are the compression
X ratio (if a runlength-encoded or LZW-compressed format), the
X format type "Tn", the number of attribute bits per pixel
X "An", "M" if an unnecessary colormap is included in the
X file, and "I" if the file has an ID field.
X
X The compression ratio is computed by multiplying the height
X by the width, then multiplying that result by the number of
X bits per pixel, and dividing by 8 to obtain the number of
X bytes which the image data would occupy when uncompressed.
X Finally, the present file size minus the header, ID field,
X and colormap lengths is divided by the computed uncompressed
X size, which yields the size of the compressed image as a
X percentage of the uncompressed size. The compression ratio
X should be accurate unless the file is corrupted or there are
X junk characters on the end of the file.
X
X PBM, PGM, PPM, PBM_RAW, PGM_RAW, PPM_RAW
X
X PBM_RAW R 29 24 x 7 @ 2 feep-raw.pbm
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 10
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X PGM_RAW R 180 24 x 7 @ 256 MaxVal = 255 feep-raw.pgm
X PPM_RAW R 59 4 x 4, 24 bit MaxVal = 255 feep-raw.ppm
X PBM_NORM N 355 24 x 7 @ 2 feep.pbm
X PGM_NORM N 519 24 x 7 @ 16 MaxVal = 15 feep.pgm
X PPM_NORM N 189 4 x 4 @ 4096 MaxVal = 15 feep.ppm
X
X These formats were developed by Jef Poskanzer for his Port-
X able Bitmap (later Portable Bitmap Plus) package. The for-
X mats were designed to be easily transferable between
X machines and easily usable on widely differing machines.
X There are three basic types, PBM (Portable BitMap, black and
X white only), PGM (Portable GrayMap, grayscale), and PPM
X (Portable PixMap, full-color), each of which comes in two
X varieties, normal (all data is represented as ASCII text)
X and raw (the image data is stored as packed bytes.) Chils
X handles all six permutations.
X
X These formats have only one flag, which is "R" for a raw
X file and "N" for a normal file, and is redundant.
X
X The number of colors is expressed either as a number or as
X the number of bits per pixel. For PBM and PGM images, it is
X always a number (always 2 for PBM). For PPM images, it is
X either a number or the number of bits depending on which
X fits in the available space. In the case of a plain number,
X not all colors may be used; the number should be regarded as
X an upper limit on the number of colors in the actual image
X rather than the actual figure.
X
X There are no format-dependent displays for PBM; PGM and PPM
X display the maximum value that a pixel may take (usually a
X power of 2 minus 1).
X
X XBM
X
X XBM 182 24 x 7 @ 2 'feep' feep.xbm
X
X The XBM (X BitMap) format is used by the X Window system
X developed at MIT. The format is designed for easy incor-
X poration into C-language programs and all data is
X represented as ASCII text.
X
X The XBM format has no flags.
X
X The number of colors is always 2, black and white.
X
X Format-dependent displays for XBM are the name of the image,
X which is encoded into the file.
X
X WIN2BMP
X
X WIN2BMP - 630 32 x 32 @ 16 argh.bmp
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 11
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X The WIN2BMP format is an obsolete format used by MS-Windows
X 2.x.
X
X The WIN2BMP format has one flag, which is "D" if the bitmap
X resource is discardable or "-" if it is not.
X
X The number of colors is expressed either as a number or as
X the number of bits per pixel, depending on which fits in the
X available space. In the case of a plain number, not all
X colors may be used; the number should be regarded as an
X upper limit on the number of colors in the actual image
X rather than the actual figure.
X
X There are no format-dependent displays for WIN2BMP.
X
X OS2BMP11
X
X OS2BMP11 - 5078 80 x 50 @ 256 256color.bmp
X
X The OS2BMP11 format is used by OS/2 1.1-1.3. The WIN3BMP and
X OS2BMP20 formats are loosely based on it.
X
X The OS2BMP11 format has one flag, which is "E" if the file
X size in the header does not match the present file size or
X "-" if it does.
X
X The number of colors is expressed either as a number or as
X the number of bits per pixel, depending on which fits in the
X available space. In the case of a plain number, not all
X colors may be used; the number should be regarded as an
X upper limit on the number of colors in the actual image
X rather than the actual figure.
X
X There are no format-dependent displays for OS2BMP11.
X
X WIN3BMP
X
X WIN3BMP -- 5078 80 x 50 @ 256 256color.bmp
X WIN3BMP -- 630 32 x 32 @ 16 argyle.bmp
X
X The WIN3BMP format is used by MS-Windows 3.x. It is loosely
X based on the OS2BMP11 format and the OS2BMP20 format is
X based on it.
X
X The WIN3BMP format has two flags. The first one is "E" if
X the file size in the header does not match the present file
X size or "-" if it does. The second one is "-" for an
X uncompressed file, "4" if 4-bit run-length compression is
X used, or "8" if 8-bit run-length compression is used.
X
X The number of colors is expressed either as a number or as
X the number of bits per pixel, depending on which fits in the
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 12
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X available space. In the case of a plain number, not all
X colors may be used; the number should be regarded as an
X upper limit on the number of colors in the actual image
X rather than the actual figure.
X
X Format-dependent displays for WIN3BMP are the compression
X ratio (for compressed files), the horizontal and vertical
X resolution (if present) and the number of important colors
X (if present and different from the number of colors in the
X colormap) "Innn".
X
X The compression ratio is computed by multiplying the height
X by the width, then multiplying that result by the number of
X bits per pixel, and dividing by 8 to obtain the number of
X bytes which the image data would occupy when uncompressed.
X Finally, the size of the compressed data (maintained in the
X file header) is divided by the computed uncompressed size,
X which yields the size of the compressed image as a percen-
X tage of the uncompressed size. The compression ratio is
X accurate unless the file is corrupted.
X
X The horizontal and vertical resolution are in pixels per
X meter, displayed as "Xnnn,Ynnn".
X
X OS2BMP20
X
X OS2BMP20 --R- 5078 80 x 50 @ 256 256color.bmp
X
X The OS2BMP20 format is used by OS/2 2.0. It is an extension
X of the WIN3BMP format.
X
X The OS2BMP20 format has four flags. The first one is "E" if
X the file size in the header does not match the present file
X size or "-" if it does. The second one is "-" for an
X uncompressed file or "C" for a compressed file. The third
X one relates to the colormap format and should always be "R".
X The fourth one is "H" if a halftoning algorithm is speci-
X fied, "-" otherwise.
X
X The number of colors is expressed either as a number or as
X the number of bits per pixel, depending on which fits in the
X available space. In the case of a plain number, not all
X colors may be used; the number should be regarded as an
X upper limit on the number of colors in the actual image
X rather than the actual figure.
X
X Format-dependent displays for OS2BMP20 are the compression
X ratio (for compressed files), the horizontal and vertical
X resolution (if present) and the number of important colors
X (if present and different from the number of colors in the
X colormap) "Innn".
X
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 13
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X The compression ratio is computed by multiplying the height
X by the width, then multiplying that result by the number of
X bits per pixel, and dividing by 8 to obtain the number of
X bytes which the image data would occupy when uncompressed.
X Finally, the size of the compressed data (maintained in the
X file header) is divided by the computed uncompressed size,
X which yields the size of the compressed image as a percen-
X tage of the uncompressed size. The compression ratio is
X accurate unless the file is corrupted.
X
X The horizontal and vertical resolution are displayed as
X "Xnnn,Ynnn dp?", where '?' should always be 'm' (for dots
X per meter).
X
X PCX
X
X PCX_30 RC 4715 80 x 50 @ 256 C~114 CX 80,CY 50 color.pcx
X PCX_30 RC 191 24 x 7 @ 8 C~100 CX 24,CY 7 feepgray.pcx
X PCX_30 RC 152 24 x 7 @ 2 C~114 CX 24,CY 7 feepmono.pcx
X
X The PCX format was created by the ZSoft Corporation. Chils
X recognizes PCX_25 (version 2.5), PCX_28 (version 2.8 without
X palette), PCX_28P (version 2.8 with palette), and PCX_30
X (version 3.0).
X
X The PCX format has two flags. The first one should always be
X "R", indicating that the file is run-length encoded. The
X second one is "G" if the palette should be interpreted as
X grayscale or "C" if it should be interpreted as color.
X
X The number of colors is expressed either as a number or as
X the number of bits per pixel, depending on which fits in the
X available space. In the case of a plain number, not all
X colors may be used; the number should be regarded as an
X upper limit on the number of colors in the actual image
X rather than the actual figure.
X
X Format-dependent displays for PCX are the compression ratio
X and the horizontal and vertical resolution of the file crea-
X tor, in that order.
X
X The compression ratio is computed by multiplying the height
X by the width, then multiplying that result by the number of
X bits per pixel, and dividing by 8 to obtain the number of
X bytes which the image data would occupy when uncompressed.
X Finally, the present file size minus the length of the PCX
X header is divided by the computed uncompressed size, which
X yields the size of the compressed image as a percentage of
X the uncompressed size. The compression ratio should be accu-
X rate unless the file has extra characters (such as a 256-
X color palette) on the end.
X
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 14
X
X
X
X
X
X
XCHILS(1) USER COMMANDS CHILS(1)
X
X
X
X The horizontal and vertical resolution are displayed as
X "CXnnn,CYnnn". Unfortunately, it is not clear what these
X values mean.
X
XCOPYRIGHT
X Chils is copyright 1993 by James W. Birdsall, all rights
X reserved.
X
X The Graphics Interchange Format(c) is the Copyright property
X of CompuServe Incorporated. GIF(sm) is a Service Mark pro-
X perty of CompuServe Incorporated.
X
X SunOS is a trademark of Sun Microsystems Inc.
X
X Targa and TrueVision are probably trademarks of AT&T.
X
X MS-Windows is probably a trademark of Microsoft.
X
X OS/2 is a registered trademark of IBM.
X
X Other terms in this document may be trademarks or service
X marks of or copyright by various corporations and organiza-
X tions.
X
XAUTHOR
X James W. Birdsall
X support@picarefy.com
X uunet!uw-coco!amc-gw!picarefy!support
X CompuServe: 71261,1731
X GEnie: J.BIRDSALL2
X
XFILES
X chils.cfg Configuration file
X
XSEE ALSO
X gifstrip(1), gifcheck(1)
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
XSun Release Last change: $Date: 1993/03/18 21:18:21 $ 15
X
X
X
END_OF_FILE
if test 39840 -ne `wc -c <'src/chils.man'`; then
echo shar: \"'src/chils.man'\" unpacked with wrong size!
fi
# end of 'src/chils.man'
fi
if test -f 'src/pbm.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/pbm.c'\"
else
echo shar: Extracting \"'src/pbm.c'\" \(12731 characters\)
sed "s/^X//" >'src/pbm.c' <<'END_OF_FILE'
X/***************************************************************************
X* PBM.C *
X* MODULE: PNM *
X* OS: UNIX *
X* *
X* Copyright (c) 1993 James W. Birdsall. All Rights Reserved. *
X* *
X* $Id: pbm.c,v 1.1 1993/03/02 00:58:52 jwbirdsa Exp $
X* *
X* This file contains functions to process PBM format files. *
X* Functions: *
X* pbm_verify - checks filename to see if it is an PBM file *
X* pbm_getheader - extracts header data from PBM file *
X* *
X* pbm_errstring - converts error code into message *
X* *
X***************************************************************************/
X
X#include "config.h"
X
X/*
X** system includes <>
X*/
X
X#include <stdio.h>
X#ifndef NO_STDLIB
X#include <stdlib.h>
X#endif
X#ifndef NO_STR_INC
X#ifdef STRING_PLURAL
X#include <strings.h>
X#else
X#include <string.h>
X#endif
X#endif
X
X
X/*
X** custom includes ""
X*/
X
X#include "depend.h"
X#include "formats.h"
X#include "token.h"
X#include "pnm.h"
X
X
X/*
X** local #defines
X*/
X
X/*
X** misc: copyright strings, version macros, etc.
X*/
X
X/*
X** typedefs
X*/
X
X/*
X** global variables
X*/
X
X/*
X** static globals
X*/
X
Xstatic char CONST rcsid[] = "$Id: pbm.c,v 1.1 1993/03/02 00:58:52 jwbirdsa Exp $";
X
X
X/*
X** function prototypes
X*/
X
X#ifdef NO_STDLIB
Xextern long atol();
X#endif
X
X#ifdef NO_STR_INC
Xextern char *strrchr();
Xextern int strcmp();
X#endif
X
X
X/*
X** functions
X*/
X
X
X/***************************************************************************
X* FUNCTION: pbm_verify *
X* *
X* DESCRIPTION: *
X* *
X* Verifies that a file is an PBM file by checking filename against *
X* list of extensions. Reads PBM magic number from start of file. *
X* *
X* ENTRY: *
X* *
X* filename - name of file to be verified *
X* version - pointer to unsigned long in which format/version value *
X* is returned *
X* exts - array of string pointers, list of extensions for PBM *
X* files *
X* *
X* EXIT: *
X* *
X* Returns an error/status code. *
X* *
X* CONSTRAINTS/SIDE EFFECTS: *
X* *
X***************************************************************************/
XULONG
X#ifdef __STDC__
Xpbm_verify(char *filename, ULONG *version, char **exts)
X#else
Xpbm_verify(filename, version, exts)
Xchar *filename;
XULONG *version;
Xchar **exts;
X#endif
X{
X char *extptr;
X int loop;
X FILE *pbmfile;
X int magic;
X ULONG retval;
X
X /* Search for '.' marking extension. */
X
X extptr = strrchr(filename, '.');
X if (NULL == extptr)
X {
X /* No extension, cannot classify. */
X
X *version = PBM_NOT;
X return 0;
X }
X extptr++;
X
X /* Now we have the extension, check against list. */
X
X for (loop = 0; exts[loop] != NULL; loop++)
X {
X /* Case-sensitive string compare. */
X
X if (strcmp(extptr, exts[loop]) == 0)
X {
X /* Match, so break out of loop. */
X
X break;
X }
X }
X
X /* Check exit from loop. */
X
X if (NULL == exts[loop])
X {
X /* No match, return. */
X
X *version = PBM_NOT;
X return 0;
X }
X
X /* Extension is valid for type PBM, so process accordingly. */
X
X if ((pbmfile = fopen(filename, FOPEN_READ_BINARY)) == (FILE *) NULL)
X {
X return PBM_FILEERR_E;
X }
X
X /* Read magic number, first character. */
X
X if ((magic = fgetc(pbmfile)) == EOF)
X {
X *version = PBM_NOT;
X retval = (feof(pbmfile) ? ST_SUCCESS : PBM_FILEERR_E);
X fclose(pbmfile);
X return retval;
X }
X if (magic != PNM_MAGIC)
X {
X *version = PBM_NOT;
X fclose(pbmfile);
X return ST_SUCCESS;
X }
X
X /* Read magic number, second character. */
X
X if ((magic = fgetc(pbmfile)) == EOF)
X {
X *version = PBM_NOT;
X retval = (feof(pbmfile) ? ST_SUCCESS : PBM_FILEERR_E);
X fclose(pbmfile);
X return retval;
X }
X if ((magic != PBM_MAGIC_NORM) && (magic != PBM_MAGIC_RAW))
X {
X *version = PBM_NOT;
X fclose(pbmfile);
X return ST_SUCCESS;
X }
X
X /* Set version according to second character of magic number. */
X
X *version = ((PBM_MAGIC_NORM == magic) ? PBM_NORM : PBM_RAW);
X
X /* Close file. */
X
X if (fclose(pbmfile))
X {
X return PBM_FILEERR_E;
X }
X
X /* Return OK. */
X
X return 0;
X} /* end of pbm_verify() */
X
X
X/***************************************************************************
X* FUNCTION: pbm_getheader *
X* *
X* DESCRIPTION: *
X* *
X* Assumes that file is an PBM file. Reads header from file, extracts *
X* data into PBM_HDR structure. *
X* *
X* ENTRY: *
X* *
X* infile - file to be processed *
X* results - pointer to PBM_HDR structure in which data from header *
X* is returned *
X* *
X* EXIT: *
X* *
X* Returns an error/status code. *
X* *
X* CONSTRAINTS/SIDE EFFECTS: *
X* *
X* Leaves file pointing to beginning of image data. *
X* *
X***************************************************************************/
XULONG
X#ifdef __STDC__
Xpbm_getheader(FILE *infile, PBM_HDR *results)
X#else
Xpbm_getheader(infile, results)
XFILE *infile;
XPBM_HDR *results;
X#endif
X{
X char *token;
X ULONG status;
X
X /* Make sure we're at beginning of file. */
X
X if (fseek(infile, 0L, SEEK_SET))
X {
X return PBM_FILEERR_E;
X }
X
X /* Get first token, should be magic number. */
X
X if ((token = fm_token(infile)) == NULL)
X {
X return PBM_FILEERR_E;
X }
X if ((token[0] != PNM_MAGIC) ||
X ((token[1] != PBM_MAGIC_NORM) && (token[1] != PBM_MAGIC_RAW)))
X {
X return PBM_NOTPBM_E;
X }
X results->version = ((PBM_MAGIC_NORM == token[1]) ? PBM_NORM : PBM_RAW);
X free(token);
X
X /* Search for next token that is not a comment. */
X
X if ((token = fm_token(infile)) == NULL)
X {
X return PBM_FILEERR_E;
X }
X while ('#' == token[0])
X {
X free(token);
X if ((status = fm_eol(infile)) != ST_SUCCESS)
X {
X return ((FM_EOF_W == status) ? PBM_UNEOF_E : PBM_FILEERR_E);
X }
X if ((token = fm_token(infile)) == NULL)
X {
X return PBM_FILEERR_E;
X }
X }
X
X /* Got a token that is not a comment. Should be width of image. */
X
X if ((results->imwid = (ULONG) atol(token)) == 0L)
X {
X /* Something is wrong. Shouldn't be zero width. */
X
X free(token);
X results->version = PBM_NOT;
X return PBM_NOTPBM_E;
X }
X free(token);
X
X /* Search for next token that is not a comment. */
X
X if ((token = fm_token(infile)) == NULL)
X {
X return PBM_FILEERR_E;
X }
X while ('#' == token[0])
X {
X free(token);
X if ((status = fm_eol(infile)) != ST_SUCCESS)
X {
X return ((FM_EOF_W == status) ? PBM_UNEOF_E : PBM_FILEERR_E);
X }
X if ((token = fm_token(infile)) == NULL)
X {
X return PBM_FILEERR_E;
X }
X }
X
X /* Got a token that is not a comment. Should be height of image. */
X
X if ((results->imhi = (ULONG) atol(token)) == 0L)
X {
X /* Something is wrong. Shouldn't be zero height. */
X
X free(token);
X results->version = PBM_NOT;
X return PBM_NOTPBM_E;
X }
X free(token);
X
X /*
X ** Set file to point to start of data. Search for next token that
X ** is not a comment.
X */
X
X if ((token = fm_token(infile)) == NULL)
X {
X return PBM_FILEERR_E;
X }
X while ('#' == token[0])
X {
X free(token);
X if ((status = fm_eol(infile)) != ST_SUCCESS)
X {
X return ((FM_EOF_W == status) ? PBM_UNEOF_E : PBM_FILEERR_E);
X }
X if ((token = fm_token(infile)) == NULL)
X {
X return PBM_FILEERR_E;
X }
X }
X free(token);
X
X /* Return OK. */
X
X return 0;
X} /* end of pbm_getheader() */
X
X
X/***************************************************************************
X* FUNCTION: pbm_errstring *
X* *
X* DESCRIPTION: *
X* *
X* Returns a string corresponding to an error code. *
X* *
X* ENTRY: *
X* *
X* errcode - error code to be translated *
X* *
X* EXIT: *
X* *
X* Returns a pointer to the appropriate string, or NULL if there is *
X* no appropriate string. *
X* *
X* CONSTRAINTS/SIDE EFFECTS: *
X* *
X***************************************************************************/
Xchar *
X#ifdef __STDC__
Xpbm_errstring(ULONG errcode)
X#else
Xpbm_errstring(errcode)
XULONG errcode;
X#endif
X{
X char *temp;
X
X /* If error code not from this module, return NULL. */
X
X if ((errcode & ST_MOD_MASK) != PBM_MODULE)
X {
X return NULL;
X }
X
X /* Process by code. */
X
X switch (ERRSEV(errcode))
X {
X case ERRSEV(PBM_NOTPBM_E):
X temp = "File is not a PBM format file.";
X break;
X case ERRSEV(PBM_FILEERR_E):
X temp = "Error accessing file.";
X break;
X case ERRSEV(PBM_UNEOF_E):
X temp = "Unexpected End of File";
X break;
X
X default:
X temp = NULL;
X break;
X }
X
X return temp;
X} /* end of pbm_errstring() */
X
END_OF_FILE
if test 12731 -ne `wc -c <'src/pbm.c'`; then
echo shar: \"'src/pbm.c'\" unpacked with wrong size!
fi
# end of 'src/pbm.c'
fi
if test -f 'templates/pcix.mk' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'templates/pcix.mk'\"
else
echo shar: Extracting \"'templates/pcix.mk'\" \(256 characters\)
sed "s/^X//" >'templates/pcix.mk' <<'END_OF_FILE'
X#
X# Makefile template for PC/IX 1.0 and 1.1 using the stock compiler.
X#
X
XCC = cc
XCFLAGS = -O -c
XCINC =
X
XLINK = ld
XLFLAGS = -i
XLOBJS = /lib/crt0.o
XLLIBS = -lc -ltermcap
X
XO = o
XEXE =
X
XLN = ln
XCP = cp
XRM = rm -f
X
XPOST_CHILS =
XPOST_GIFSTRIP =
XPOST_GIFCHECK =
X
END_OF_FILE
if test 256 -ne `wc -c <'templates/pcix.mk'`; then
echo shar: \"'templates/pcix.mk'\" unpacked with wrong size!
fi
# end of 'templates/pcix.mk'
fi
echo shar: End of archive 7 \(of 18\).
cp /dev/null ark7isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 18 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still must unpack the following archives:
echo " " ${MISSING}
fi
exit 0
exit 0 # Just in case...