PBMPLUS, part 4 of 18

Jef Poskanzer pokey at well.UUCP
Thu Sep 14 21:24:37 AEST 1989


#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	pbm/pbmmake.c
#	pbm/pbmmake.1
#	pbm/pbmtolj.c
#	pbm/pbmtolj.1
#	pbm/pbmtomacp.c
#	pbm/pbmtomacp.1
#	pbm/pbmtoxwd.c
#	pbm/pbmtoxwd.1
#	pbm/brushtopbm.c
#	pbm/brushtopbm.1
#	pbm/libpbm1.c
#	pbm/libpbm2.c
#	pbm/libpbm3.c
#	pbm/libpbm4.c
# This archive created: Thu Sep 14 03:43:28 1989
# By:	Jef Poskanzer (Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal)
export PATH; PATH=/bin:$PATH
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/pbmmake.c'" '(2169 characters)'
if test -f 'pbm/pbmmake.c'
then
	echo shar: will not over-write existing file "'pbm/pbmmake.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/pbmmake.c'
X/* pbmmake.c - create a blank bitmap of a specified size
X**
X** Copyright (C) 1988 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#ifdef	SYSV
X#include <string.h>
X#else	SYSV
X#include <strings.h>
X#endif	SYSV
X#include "pbm.h"
X
X#define max(a,b) ((a) > (b) ? (a) : (b))
X
Xmain( argc, argv )
Xint argc;
Xchar *argv[];
X    {
X    register bit color, gray, rowcolor, *bitrow, *bP;
X    int argn, rows, cols, row, col;
X    char *usage = "[-white|-black|-gray] <width> <height>";
X
X    pm_progname = argv[0];
X
X    argn = 1;
X    color = 0;
X    gray = 0;
X
X    /* Check for flags. */
X    if ( argn < argc  && argv[argn][0] == '-' )
X	{
X	if ( strncmp(argv[argn],"-white",max(strlen(argv[argn]),2)) == 0 )
X	    color = PBM_WHITE;
X	else if ( strncmp(argv[argn],"-black",max(strlen(argv[argn]),2)) == 0 )
X	    color = PBM_BLACK;
X	else if ( strncmp(argv[argn],"-gray",max(strlen(argv[argn]),2)) == 0 ||
X	          strncmp(argv[argn],"-grey",max(strlen(argv[argn]),2)) == 0 )
X	    gray = 1;
X	else
X	    pm_usage( usage );
X	argn++;
X	}
X
X    if ( argn == argc )
X	pm_usage( usage );
X    if ( sscanf( argv[argn], "%d", &cols ) != 1 )
X	pm_usage( usage );
X    argn++;
X    if ( argn == argc )
X	pm_usage( usage );
X    if ( sscanf( argv[argn], "%d", &rows ) != 1 )
X	pm_usage( usage );
X    argn++;
X
X    if ( argn != argc )
X	pm_usage( usage );
X
X    pbm_writepbminit( stdout, cols, rows );
X    bitrow = pbm_allocrow( cols );
X
X    if ( gray )
X	rowcolor = PBM_WHITE;  /* arbitrarily make the corner white */
X    for ( row = 0; row < rows; row++ )
X	{
X	if ( gray )
X	    {
X	    color = rowcolor;
X	    rowcolor = 1 - rowcolor;
X	    }
X        for ( col = 0, bP = bitrow; col < cols; col++, bP++ )
X	    {
X	    *bP = color;
X	    if ( gray )
X		color = 1 - color;
X	    }
X	pbm_writepbmrow( stdout, bitrow, cols );
X	}
X
X    exit( 0 );
X    }
SHAR_EOF
if test 2169 -ne "`wc -c < 'pbm/pbmmake.c'`"
then
	echo shar: error transmitting "'pbm/pbmmake.c'" '(should have been 2169 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/pbmmake.1'" '(912 characters)'
if test -f 'pbm/pbmmake.1'
then
	echo shar: will not over-write existing file "'pbm/pbmmake.1'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/pbmmake.1'
X.TH pbmmake 1 "22 February 1989"
X.SH NAME
Xpbmmake - create a blank bitmap of a specified size
X.SH SYNOPSIS
Xpbmmake [-white|-black|-gray] <width> <height>
X.SH DESCRIPTION
XProduces a portable bitmap of the specified width and height.
XThe color defaults to white.
X.PP
XIn addition to the usual -white and -black, this program implements -gray.
XThis gives a simple 50% gray pattern with 1's and 0's alternating.
X.PP
XAll flags can be abbreviated to their shortest unique prefix.
X.SH "SEE ALSO"
Xpbm(5)
X.SH AUTHOR
XCopyright (C) 1989 by Jef Poskanzer.
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted, provided
Xthat the above copyright notice appear in all copies and that both that
Xcopyright notice and this permission notice appear in supporting
Xdocumentation.  This software is provided "as is" without express or
Ximplied warranty.
SHAR_EOF
if test 912 -ne "`wc -c < 'pbm/pbmmake.1'`"
then
	echo shar: error transmitting "'pbm/pbmmake.1'" '(should have been 912 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/pbmtolj.c'" '(3181 characters)'
if test -f 'pbm/pbmtolj.c'
then
	echo shar: will not over-write existing file "'pbm/pbmtolj.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/pbmtolj.c'
X/* pbmtolj.c - read a portable bitmap and produce a LaserJet bitmap file
X**	
X**	based on pbmtops.c
X**
X**	Michael Haberler HP Vienna mah at hpuviea.uucp
X**				   mcvax!tuvie!mah
X**	misfeatures: 
X**		no positioning
X**
X**      Bug fix Dec 12, 1988 :
X**              lines in putbit() reshuffled 
X**              now runs OK on HP-UX 6.0 with X10R4 and HP Laserjet II
X**      Bo Thide', Swedish Institute of Space Physics, Uppsala <bt at irfu.se>
X**
X** Copyright (C) 1988 by Jef Poskanzer and Michael Haberler.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#ifdef	SYSV
X#include <string.h>
X#else	SYSV
X#include <strings.h>
X#endif	SYSV
X#include "pbm.h"
X
Xint dpi = 75;
X    
Xmain( argc, argv )
Xint argc;
Xchar *argv[];
X    {
X    FILE *ifd;
X    register bit *bitrow, *bP;
X    int argn, rows, cols, format, rucols, padright, row, col;
X    char *usage = "[-r resolution] [pbmfile]\n\t\resolution = [75|100|150|300] (dpi)";
X
X    pm_progname = argv[0];
X
X    argn = 1;
X
X    /* Check for flags. */
X    if ( argc > argn )
X	{
X	if ( argv[argn][0] == '-' )
X	    {
X	    if ( strcmp( argv[argn], "-r" ) == 0 )
X		{
X		if ( argc == argn + 1 )
X		    pm_usage( usage );
X		if ( sscanf( argv[argn+1], "%d", &dpi ) != 1 )
X		    pm_usage( usage );
X		argn += 2;
X		}
X	    else
X		pm_usage( usage );
X	    }
X	}
X
X    if ( argc > argn + 1 )
X	pm_usage( usage );
X
X    if ( argc == argn + 1 )
X	ifd = pm_openr( argv[argn] );
X    else
X	ifd = stdin;
X
X    pbm_readpbminit( ifd, &cols, &rows, &format );
X    bitrow = pbm_allocrow( cols );
X
X    /* Round cols up to the nearest multiple of 8. */
X    rucols = ( cols + 7 ) / 8;
X    rucols = rucols * 8;
X    padright = rucols - cols;
X
X    putinit( );
X    for ( row = 0; row < rows; row++ )
X	{
X	pbm_readpbmrow( ifd, bitrow, cols, format );
X	/* Transfer raster graphics */
X 	printf("\033*b%dW",rucols/8);
X        for ( col = 0, bP = bitrow; col < cols; col++, bP++ )
X	    putbit( *bP );
X	for ( col = 0; col < padright; col++ )
X	    putbit( 0 );
X        }
X
X    pm_close( ifd );
X
X    putrest( );
X
X    exit( 0 );
X    }
X
X
Xint item, bitsperitem, bitshift, itemsperline, firstitem;
X
Xputinit( )
X    {
X    /* Printer reset. */
X    printf("\033E");
X
X    /* Set raster graphics resolution */
X    printf("\033*t%dR",dpi);
X
X    /* Start raster graphics, relative adressing */
X    printf("\033*r1A");
X
X    itemsperline = 0;
X    bitsperitem = 1;
X    item = 0;
X    bitshift = 7;
X    firstitem = 1;
X    }
X
Xputbit( b )
Xbit b;
X    {
X    if ( b == PBM_BLACK )
X	item += 1 << bitshift;
X    bitshift--;
X    if ( bitsperitem == 8 ) {
X	putitem( );
X        bitshift = 7;
X    }
X    bitsperitem++;
X    }
X
Xputrest( )
X    {
X    if ( bitsperitem > 1 )
X	putitem( );
X
X    /* end raster graphics */
X    printf( "\033*rB" );
X
X    /* Printer reset. */
X    printf("\033E");
X    }
X
Xputitem( )
X    {
X    putchar( item );
X    bitsperitem = 0;
X    item = 0;
X    }
SHAR_EOF
if test 3181 -ne "`wc -c < 'pbm/pbmtolj.c'`"
then
	echo shar: error transmitting "'pbm/pbmtolj.c'" '(should have been 3181 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/pbmtolj.1'" '(870 characters)'
if test -f 'pbm/pbmtolj.1'
then
	echo shar: will not over-write existing file "'pbm/pbmtolj.1'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/pbmtolj.1'
X.TH pbmtolj 1 "29 August 1988"
X.SH NAME
Xpbmtolj - convert a portable bitmap into HP LaserJet format
X.SH SYNOPSIS
Xpbmtolj [ -r <resolution> ] [ <pbmfile> ]
X.SH DESCRIPTION
XReads a portable bitmap as input.
XProduces HP LaserJet data as output.
X.PP
XThe -r flag specifies the resolution of the output device, in dpi.
XTypical values are 75, 100, 150, 300.
XThe default is 75.
X.PP
XNote that there is no ljtopbm tool.
X.SH "SEE ALSO"
Xpbm(5)
X.SH AUTHOR
XCopyright (C) 1988 by Jef Poskanzer and Michael Haberler.
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted, provided
Xthat the above copyright notice appear in all copies and that both that
Xcopyright notice and this permission notice appear in supporting
Xdocumentation.  This software is provided "as is" without express or
Ximplied warranty.
SHAR_EOF
if test 870 -ne "`wc -c < 'pbm/pbmtolj.1'`"
then
	echo shar: error transmitting "'pbm/pbmtolj.1'" '(should have been 870 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/pbmtomacp.c'" '(5888 characters)'
if test -f 'pbm/pbmtomacp.c'
then
	echo shar: will not over-write existing file "'pbm/pbmtomacp.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/pbmtomacp.c'
X/* pbmtomacp.c - read a portable bitmap and produce a MacPaint bitmap file
X**
X** Copyright (C) 1988 by Douwe vand der Schaaf.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#include "pbm.h"
X#include "macp.h"
X
X#define TRUE		1
X#define FALSE		0
X#define EQUAL		1
X#define UNEQUAL		0
X
XFILE *fdout;
Xchar *usage = "[-l left] [-r right] [-b bottom] [-t top] [pbmfile]";
X
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{ int c;
X  FILE *ifd;
X  register bit **bits, **bitsr;
X  int argn, rows, cols;
X  int left,bottom,right,top;
X  int lflg, rflg, tflg, bflg, errflg;
X  char name[100];
X
X  pm_progname = argv[0];
X
X  argn = 1;
X  fdout = stdout;
X  errflg = lflg = rflg = tflg = bflg = 0;
X
X  while ( argn < argc && argv[argn][0] == '-' )
X  { switch ( argv[argn][1] )
X    { case 'l':
X      lflg++;
X      argn++;
X      left = atoi( argv[argn] );
X      break;
X
X      case 'r':
X      rflg++;
X      argn++;
X      right = atoi( argv[argn] );
X      break;
X
X      case 't':
X      tflg++;
X      argn++;
X      top = atoi( argv[argn] );
X      break;
X
X      case 'b':
X      bflg++;
X      argn++;
X      bottom = atoi( argv[argn] );
X      break;
X
X      case '?':
X      default:
X      pm_usage( usage );
X    }
X    argn++;
X  }
X
X  if ( argn == argc )
X  { ifd = stdin;
X    strcpy( name, "noname" );
X  }
X  else
X  { ifd = pm_openr( argv[argn] );
X    strcpy( name, argv[argn] );
X  }
X
X  bitsr = pbm_readpbm( ifd, &cols, &rows );
X
X  pm_close( ifd );
X
X  bits = pbm_allocarray( MAX_COLS, MAX_LINES );
X
X  if( !lflg )
X    left = 0;
X
X  if( rflg )
X  { if( right - left >= MAX_COLS )
X      right = left + MAX_COLS - 1;
X  }
X  else
X    right = ( left + MAX_COLS > cols ) ? ( cols - 1 ) : ( left + MAX_COLS - 1 );
X
X  if( !tflg )
X    top = 0;
X
X  if( bflg )
X  { if( bottom - top >= MAX_LINES )
X      bottom = top + MAX_LINES - 1;
X  }
X  else
X    bottom = ( top + MAX_LINES > rows ) ?
X		   ( rows - 1 ) : ( top + MAX_LINES - 1 );
X  
X    if( right <= left || left < 0 || right - left + 1 > MAX_COLS )
X      pm_error("error in right (= %d) and/or left (=%d)",right,left, 0,0,0 );
X    if( bottom <= top || top < 0 || bottom - top + 1 > MAX_LINES )
X      pm_error("error in bottom (= %d) and/or top (=%d)",bottom,top, 0,0,0 );
X
X  fillbits( bits, bitsr, top, left, bottom, right );
X
X  writemacp( bits );
X
X} /* main */
X
X/* - - - - - - - - - - - - - - - - - - - - - - - - - - */
X
X/* centreer het over te zenden plaatje in het MacPaint document
X *
X * Het plaatje wordt vanaf al of niet opgegeven (left, bottom)
X * in een pbm bitmap van de juist macpaint afmetingen gezet,
X * en eventueel afgekapt.
X */
Xfillbits( bits, bitsr, top, left, bottom, right )
Xbit **bits, **bitsr;
Xint top, left, bottom, right;
X{ register bit *bi, *bir;
X  register int i, j;
X  register int bottomr, leftr, topr, rightr;
X  int width, height;
X
X  width = right - left + 1;
X  leftr = (MAX_COLS - width) / 2;
X  rightr = leftr + width - 1;
X
X  height = bottom - top + 1;
X  topr = ( MAX_LINES - height ) / 2;
X  bottomr = topr + height - 1;
X
X  for( i = 0; i < topr; i++ )
X  { bi = bits[i];
X    for( j = 0; j < MAX_COLS; j++ )
X      *bi++ = 0;
X  }
X
X  for( i = topr; i <= bottomr; i++ )
X  { bi = bits[i];
X    { for( j = 0; j < leftr; j++ )
X	*bi++ = 0;
X      bir = bitsr[ i - topr + top ];
X      for( j = leftr; j <= rightr; j++ )
X	*bi++ = bir[j - leftr + left];
X      for( j = rightr + 1; j < MAX_COLS; j++ )
X	*bi++ = 0;
X  } }
X
X  for( i = bottomr + 1; i < MAX_LINES; i++ )
X  { bi = bits[i];
X    for( j = 0; j < MAX_COLS; j++ )
X      *bi++ = 0;
X  }
X} /* fillbits */
X      
X/* - - - - - - - - - - - - - - - - - - - - - - - - - - */
X
Xwritemacp( bits )
Xbit **bits;
X{ register int i;
X  bit pb[MAX_COLS * 2];
X  int npb;
X
X  header();
X  for( i=0; i < MAX_LINES; i++ )
X  { npb = packit( pb, bits[i] );
X    sendbytes( pb, npb );
X  }
X} /* writemacp */
X
X/* - - - - - - - - - - - - - - - - - - - - - - - - - - */
X
X/* pack regel van MacPaint doc in Apple's format
X * return value = # of bytes in pb 
X */
Xint
Xpackit( pb, bits )
Xbit *pb, *bits;
X{ register int charcount, npb, newcount, flg;
X  bit temp[72];
X  bit *count, *srcb, *destb, save;
X
X  srcb = bits; destb = temp;
X  filltemp( destb, srcb );
X  srcb = temp;
X  destb = pb;
X  npb = 0;
X  charcount = BYTES_WIDE;
X  flg = EQUAL;
X  while( charcount )
X  { save = *srcb++;
X    charcount--;
X    newcount = 1;
X    while( (*srcb == save) && charcount )
X    { srcb++;
X      newcount++;
X      charcount--;
X    }
X    if( newcount > 2 )
X    { count = destb++;
X      *count = 257 - newcount;
X      *destb++ = save;
X      npb += 2;
X      flg = EQUAL;
X    }
X    else
X    { if( flg == EQUAL )
X      { count = destb++;
X	*count = newcount - 1;
X	npb++;
X      }
X      else
X	*count += newcount;
X      while( newcount-- )
X      { *destb++ = save;
X        npb++;
X      }
X      flg = UNEQUAL;
X  } }
X  return npb;
X} /* packit */
X
X/* - - - - - - - - - - - - - - - - - - - - - - - - - - */
X
Xfilltemp( dest, src )
Xbit *src, *dest;
X{ register unsigned char ch, zero, acht;
X  register int i, j;
X
X  zero = '\0';
X  acht = 8;
X  i = BYTES_WIDE;
X  while( i-- )
X  { ch = zero; 
X    j = acht;
X    while( j-- )
X    { ch <<= 1;
X      if( *src++ )
X	ch++;
X    }
X    *dest++ = ch;
X  }
X} /* filltemp */
X
X/* - - - - - - - - - - - - - - - - - - - - - - - - - - */
X
Xsendbytes( pb, npb )
Xbit *pb;
Xregister int npb;
X{ register bit *b;
X
X  b = pb;
X  while( npb-- )
X    putc( *b++, fdout );
X} /* sendbytes */
X
X/* - - - - - - - - - - - - - - - - - - - - - - - - - - */
X
Xheader()
X{ register int i;
X  register char ch;
X
X  /* header contains nothing ... */
X  ch = '\0';
X  for(i = 0; i < HEADER_LENGTH; i++ )
X    putc( ch, fdout );
X} /* header */
SHAR_EOF
if test 5888 -ne "`wc -c < 'pbm/pbmtomacp.c'`"
then
	echo shar: error transmitting "'pbm/pbmtomacp.c'" '(should have been 5888 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/pbmtomacp.1'" '(1100 characters)'
if test -f 'pbm/pbmtomacp.1'
then
	echo shar: will not over-write existing file "'pbm/pbmtomacp.1'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/pbmtomacp.1'
X.TH pbmtomacp 1 "31 August 1988"
X.SH NAME
Xpbmtomacp - convert a portable bitmap into a MacPaint file
X.SH SYNOPSIS
Xpbmtomacp [-l left] [-r right] [-b bottom] [-t top] [pbmfile]
X.SH DESCRIPTION
XReads a portable bitmap as input.
XIf no input-file is given, standard input is assumed.
XProduces a MacPaint file as output.
X.PP
XLeft, right,bottom & top let you define a square into the pbm file,
Xthat must be converted.
XDefault is the whole file.
XIf the file is too large for a MacPaint-file, the bitmap is cut to fit
Xfrom ( left, top ).
X.SH BUGS
XThe source code contains comments in a language other than English.
X.SH "SEE ALSO"
Xmacptopbm(1), pbm(5)
X.SH AUTHOR
XCopyright (C) 1988 by Douwe van der Schaaf.
XUSENET: ..!mcvax!uvapsy!vdschaaf
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted, provided
Xthat the above copyright notice appear in all copies and that both that
Xcopyright notice and this permission notice appear in supporting
Xdocumentation.  This software is provided "as is" without express or
Ximplied warranty.
SHAR_EOF
if test 1100 -ne "`wc -c < 'pbm/pbmtomacp.1'`"
then
	echo shar: error transmitting "'pbm/pbmtomacp.1'" '(should have been 1100 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/pbmtoxwd.c'" '(3500 characters)'
if test -f 'pbm/pbmtoxwd.c'
then
	echo shar: will not over-write existing file "'pbm/pbmtoxwd.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/pbmtoxwd.c'
X/* pbmtoxwd.c - read a portable bitmap and produce an X11 window dump
X**
X** Copyright (C) 1988 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#ifdef	SYSV
X#include <string.h>
X#define index strchr
X#else	SYSV
X#include <strings.h>
X#endif	SYSV
X#include "pbm.h"
X#include "x11wd.h"
X
Xmain( argc, argv )
Xint argc;
Xchar *argv[];
X    {
X    FILE *ifd;
X    register bit *bitrow, *bP;
X    int rows, cols, format, padright, row, col;
X    char name[100], *cp;
X
X    pm_progname = argv[0];
X
X    if ( argc > 2 )
X	pm_usage( "[pbmfile]" );
X
X    if ( argc == 2 )
X	{
X	ifd = pm_openr( argv[1] );
X	strcpy( name, argv[1] );
X	if ( strcmp( name, "-" ) == 0 )
X	    strcpy( name, "noname" );
X
X	if ( ( cp = index( name, '.' ) ) != 0 )
X	    *cp = '\0';
X	}
X    else
X	{
X	ifd = stdin;
X	strcpy( name, "noname" );
X	}
X
X    pbm_readpbminit( ifd, &cols, &rows, &format );
X    bitrow = pbm_allocrow( cols );
X    
X    /* Compute padding to round cols up to the nearest multiple of 32. */
X    padright = ( ( cols + 31 ) / 32 ) * 32 - cols;
X
X    putinit( cols, rows, name );
X    for ( row = 0; row < rows; row++ )
X	{
X	pbm_readpbmrow( ifd, bitrow, cols, format );
X        for ( col = 0, bP = bitrow; col < cols; col++, bP++ )
X	    putbit( *bP );
X	for ( col = 0; col < padright; col++ )
X	    putbit( 0 );
X        }
X
X    if ( ifd != stdin )
X	fclose( ifd );
X
X    putrest( );
X
X    exit( 0 );
X    }
X
X
Xlong item;
Xint bitsperitem, bitshift;
X
X
Xputinit( cols, rows, name )
Xint cols, rows;
Xchar *name;
X    {
X    X11WDFileHeader h11;
X    X11XColor color;
X
X    h11.header_size = sizeof(h11) + (strlen(name) + 1) * sizeof(char);
X    h11.file_version = X11WD_FILE_VERSION;
X    h11.pixmap_format = ZPixmap;
X    h11.pixmap_depth = 1;
X    h11.pixmap_width = cols;
X    h11.pixmap_height = rows;
X    h11.xoffset = 0;
X    h11.byte_order = MSBFirst;
X    h11.bitmap_unit = 32;
X    h11.bitmap_bit_order = MSBFirst;
X    h11.bitmap_pad = 32;
X    h11.bits_per_pixel = 1;
X    h11.bytes_per_line = ( ( cols + 31 ) / 32 ) * 4;
X    h11.visual_class = 0;
X    h11.red_mask = 0;
X    h11.green_mask = 0;
X    h11.blue_mask = 0;
X    h11.bits_per_rgb = 1;
X    h11.colormap_entries = 2;
X    h11.ncolors = 2;
X    h11.window_width = cols;
X    h11.window_height = rows;
X    h11.window_x = 0;			/* arbitrary */
X    h11.window_y = 0;			/* arbitrary */
X    h11.window_bdrwidth = 0;
X    fwrite( &h11, sizeof(h11), 1, stdout );
X
X    fwrite( name, sizeof(char), strlen(name) + 1, stdout );
X
X    color.pixel = 0;
X    color.red = 65535;
X    color.green = 65535;
X    color.blue = 65535;
X    color.flags = 7;
X    color.pad = 0;
X    fwrite( &color, sizeof(color), 1, stdout );
X    color.pixel = 1;
X    color.red = 0;
X    color.green = 0;
X    color.blue = 0;
X    fwrite( &color, sizeof(color), 1, stdout );
X
X    item = 0;
X    bitsperitem = 0;
X    bitshift = 31;
X    }
X
Xputbit( b )
Xbit b;
X    {
X    if ( bitsperitem == 32 )
X	putitem( );
X    bitsperitem++;
X    if ( b == PBM_BLACK )
X	item += 1 << bitshift;
X    bitshift--;
X    }
X
Xputrest( )
X    {
X    if ( bitsperitem > 0 )
X	putitem( );
X    }
X
Xputitem( )
X    {
X    fwrite( &item, sizeof(item), 1, stdout );
X    item = 0;
X    bitsperitem = 0;
X    bitshift = 31;
X    }
SHAR_EOF
if test 3500 -ne "`wc -c < 'pbm/pbmtoxwd.c'`"
then
	echo shar: error transmitting "'pbm/pbmtoxwd.c'" '(should have been 3500 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/pbmtoxwd.1'" '(756 characters)'
if test -f 'pbm/pbmtoxwd.1'
then
	echo shar: will not over-write existing file "'pbm/pbmtoxwd.1'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/pbmtoxwd.1'
X.TH pbmtoxwd 1 "31 August 1988"
X.SH NAME
Xpbmtoxwd - convert a portable bitmap into an X11 window dump
X.SH SYNOPSIS
Xpbmtoxwd [pbmfile]
X.SH DESCRIPTION
XReads a portable bitmap as input.
XProduces an X11 window dump as output.
XThis window dump can be displayed using the xwud tool.
X.SH "SEE ALSO"
Xxwdtopbm(1), pbm(5), ppmtoxwd(1), xwdtoppm(1)
X.SH AUTHOR
XCopyright (C) 1988 by Jef Poskanzer.
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted, provided
Xthat the above copyright notice appear in all copies and that both that
Xcopyright notice and this permission notice appear in supporting
Xdocumentation.  This software is provided "as is" without express or
Ximplied warranty.
SHAR_EOF
if test 756 -ne "`wc -c < 'pbm/pbmtoxwd.1'`"
then
	echo shar: error transmitting "'pbm/pbmtoxwd.1'" '(should have been 756 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/brushtopbm.c'" '(2237 characters)'
if test -f 'pbm/brushtopbm.c'
then
	echo shar: will not over-write existing file "'pbm/brushtopbm.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/brushtopbm.c'
X/* brushtopbm.c - read a doodle brush file and write a portable bitmap
X**
X** Copyright (C) 1988 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#include "pbm.h"
X
Xmain( argc, argv )
Xint argc;
Xchar *argv[];
X    {
X    FILE *ifd;
X    register bit *bitrow, *bP;
X    bit getbit();
X    int rows, cols, padright, row, col;
X
X    pm_progname = argv[0];
X
X    if ( argc > 2 )
X	pm_usage( "[brushfile]" );
X
X    if ( argc == 2 )
X	ifd = pm_openr( argv[1] );
X    else
X	ifd = stdin;
X
X    getinit( ifd, &cols, &rows );
X
X    pbm_writepbminit( stdout, cols, rows );
X    bitrow = pbm_allocrow( cols );
X
X    /* Compute padding to round cols up to the next multiple of 16. */
X    padright = ( ( cols + 15 ) / 16 ) * 16 - cols;
X
X    for ( row = 0; row < rows; row++ )
X	{
X	/* Get data. */
X        for ( col = 0, bP = bitrow; col < cols; col++, bP++ )
X	    *bP = getbit( ifd );
X	/* Discard line padding. */
X        for ( col = 0; col < padright; col++ )
X	    (void) getbit( ifd );
X	/* Write row. */
X	pbm_writepbmrow( stdout, bitrow, cols );
X	}
X
X    pm_close( ifd );
X    
X    exit( 0 );
X    }
X
X
Xint item, bitsperitem, bitshift;
X
Xgetinit( file, colp, rowp )
XFILE *file;
Xint *colp, *rowp;
X    {
X    int i;
X
X    if ( getc( file ) != 1 )
X	pm_error( "bad magic number 1", 0,0,0,0,0 );
X    if ( getc( file ) != 0 )
X	pm_error( "bad magic number 2", 0,0,0,0,0 );
X    *colp = getc( file ) << 8;
X    *colp += getc( file );
X    *rowp = getc( file ) << 8;
X    *rowp += getc( file );
X    bitsperitem = 8;
X
X    /* Junk rest of header. */
X    for ( i = 0; i < 10; i++ )  /* 10 is just a guess at the header size */
X	(void) getc( file );
X    }
X
Xbit
Xgetbit( file )
XFILE *file;
X    {
X    bit b;
X
X    if ( bitsperitem == 8 )
X	{
X	item = getc( file );
X	bitsperitem = 0;
X	bitshift = 7;
X	}
X    bitsperitem++;
X    b = ( ( item >> bitshift) & 1 ) ? PBM_WHITE : PBM_BLACK;
X    bitshift--;
X    return b;
X    }
SHAR_EOF
if test 2237 -ne "`wc -c < 'pbm/brushtopbm.c'`"
then
	echo shar: error transmitting "'pbm/brushtopbm.c'" '(should have been 2237 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/brushtopbm.1'" '(731 characters)'
if test -f 'pbm/brushtopbm.1'
then
	echo shar: will not over-write existing file "'pbm/brushtopbm.1'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/brushtopbm.1'
X.TH brushtopbm 1 "28 August 1988"
X.SH NAME
Xbrushtopbm - convert a doodle brush file into a portable bitmap
X.SH SYNOPSIS
Xbrushtopbm [brushfile]
X.SH DESCRIPTION
XReads a Xerox doodle brush file as input.
XProduces a portable bitmap as output.
X.PP
XNote that there is currently no pbmtobrush tool.
X.SH "SEE ALSO"
Xpbm(5)
X.SH AUTHOR
XCopyright (C) 1988 by Jef Poskanzer.
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted, provided
Xthat the above copyright notice appear in all copies and that both that
Xcopyright notice and this permission notice appear in supporting
Xdocumentation.  This software is provided "as is" without express or
Ximplied warranty.
SHAR_EOF
if test 731 -ne "`wc -c < 'pbm/brushtopbm.1'`"
then
	echo shar: error transmitting "'pbm/brushtopbm.1'" '(should have been 731 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/libpbm1.c'" '(2712 characters)'
if test -f 'pbm/libpbm1.c'
then
	echo shar: will not over-write existing file "'pbm/libpbm1.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/libpbm1.c'
X/* libpbm1.c - pbm utility library part 1
X**
X** Copyright (C) 1988 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#include <varargs.h>
X#include "pbm.h"
X#include "libpbm.h"
X
X/* Variable-sized arrays. */
X
Xchar *
Xpm_allocrow( cols, size )
Xint cols;
X    {
X    register char *itrow;
X
X    itrow = (char *) malloc( cols * size );
X    if ( itrow == (char *) 0 )
X	pm_error( "out of memory allocating a row", 0,0,0,0,0 );
X    return itrow;
X    }
X
Xvoid
Xpm_freerow( itrow )
Xchar *itrow;
X    {
X    free( itrow );
X    }
X
X
Xchar **
Xpm_allocarray( cols, rows, size )
Xint cols, rows;
Xint size;
X    {
X    char **its;
X    int i;
X
X    its = (char **) malloc( rows * sizeof(char *) );
X    if ( its == (char **) 0 )
X	pm_error( "out of memory allocating an array", 0,0,0,0,0 );
X    its[0] = (char *) malloc( rows * cols * size );
X    if ( its[0] == (char *) 0 )
X	pm_error( "out of memory allocating an array", 0,0,0,0,0 );
X    for ( i = 1; i < rows; i++ )
X	its[i] = &(its[0][i * cols * size]);
X    return its;
X    }
X
Xvoid
Xpm_freearray( its, rows )
Xchar **its;
Xint rows;
X    {
X    free( its[0] );
X    free( its );
X    }
X
X
X/* Error handling. */
X
Xchar *pm_progname;
X
X/* I'd use varargs here, but it can't be done portably, because (a) vfprintf()
X** is not very widespread, and (b) varargs itself is not powerful enough to
X** allow me to include a portable vfprintf().
X**
X** So instead, we have the gross hack of a fixed number of args.
X*/
X
Xvoid
Xpm_message( fmt, v1, v2, v3, v4, v5 )
Xchar *fmt;
Xchar *v1, *v2, *v3, *v4, *v5;
X    {
X    fprintf( stderr, "%s: ", pm_progname );
X    fprintf( stderr, fmt, v1, v2, v3, v4, v5 );
X    fputc( '\n', stderr );
X    }
X
Xvoid
Xpm_error( fmt, v1, v2, v3, v4, v5 )
Xchar *fmt;
Xchar *v1, *v2, *v3, *v4, *v5;
X    {
X    pm_message( fmt, v1, v2, v3, v4, v5 );
X    exit( 1 );
X    }
X
Xvoid
Xpm_usage( usage )
Xchar *usage;
X    {
X    fprintf( stderr, "usage:  %s %s\n", pm_progname, usage );
X    exit( 1 );
X    }
X
X
X/* File open/close that handles "-" as stdin and checks errors. */
X
XFILE *
Xpm_openr( name )
Xchar *name;
X    {
X    FILE *f;
X
X    if ( strcmp( name, "-" ) == 0 )
X	f = stdin;
X    else
X	{
X	f = fopen( name, "r" );
X	if ( f == NULL )
X	    {
X	    perror( name );
X	    exit( 1 );
X	    }
X	}
X    return f;
X    }
X
Xvoid
Xpm_close( f )
XFILE *f;
X    {
X    if ( f != stdin )
X	if ( fclose( f ) != 0 )
X	    perror( "closing file" );
X    }
SHAR_EOF
if test 2712 -ne "`wc -c < 'pbm/libpbm1.c'`"
then
	echo shar: error transmitting "'pbm/libpbm1.c'" '(should have been 2712 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/libpbm2.c'" '(2705 characters)'
if test -f 'pbm/libpbm2.c'
then
	echo shar: will not over-write existing file "'pbm/libpbm2.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/libpbm2.c'
X/* libpbm2.c - pbm utility library part 2
X**
X** Copyright (C) 1988 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#include "pbm.h"
X#include "libpbm.h"
X
Xstatic bit
Xpbm_getbit( file )
XFILE *file;
X    {
X    register char ch;
X
X    do
X	{
X	ch = pbm_getc( file );
X	}
X    while ( ch == ' ' || ch == '\t' || ch == '\n' );
X
X    if ( ch != '0' && ch != '1' )
X	pm_error( "junk in file where bits should be", 0,0,0,0,0 );
X
X    return ( ch == '1' ) ? 1 : 0;
X    }
X
Xint
Xpbm_readmagicnumber( file )
XFILE *file;
X    {
X    int ich1, ich2;
X
X    ich1 = getc( file );
X    if ( ich1 == EOF )
X	pm_error( "premature EOF reading magic number", 0,0,0,0,0 );
X    ich2 = getc( file );
X    if ( ich2 == EOF )
X	pm_error( "premature EOF reading magic number", 0,0,0,0,0 );
X    return ich1 * 256 + ich2;
X    }
X
Xvoid
Xpbm_readpbminitrest( file, colsP, rowsP )
XFILE *file;
Xint *colsP, *rowsP;
X    {
X    /* Read size. */
X    *colsP = pbm_getint( file );
X    *rowsP = pbm_getint( file );
X    }
X
Xvoid
Xpbm_readpbminit( file, colsP, rowsP, formatP )
XFILE *file;
Xint *colsP, *rowsP, *formatP;
X    {
X    /* Check magic number. */
X    *formatP = pbm_readmagicnumber( file );
X    switch ( *formatP )
X	{
X        case PBM_FORMAT:
X        case RPBM_FORMAT:
X	pbm_readpbminitrest( file, colsP, rowsP );
X	break;
X
X	default:
X	pm_error( "bad magic number - not a pbm file", 0,0,0,0,0 );
X	}
X    }
X
Xvoid
Xpbm_readpbmrow( file, bitrow, cols, format )
XFILE *file;
Xbit *bitrow;
Xint cols, format;
X    {
X    register int col, bitshift;
X    register unsigned char item;
X    register bit *bP;
X
X    switch ( format )
X	{
X	case PBM_FORMAT:
X	for ( col = 0, bP = bitrow; col < cols; col++, bP++ )
X	    *bP = pbm_getbit( file );
X	break;
X
X	case RPBM_FORMAT:
X	bitshift = -1;
X	for ( col = 0, bP = bitrow; col < cols; col++, bP++ )
X	    {
X	    if ( bitshift == -1 )
X		{
X		item = pbm_getrawbyte( file );
X		bitshift = 7;
X		}
X	    *bP = ( item >> bitshift ) & 1;
X	    bitshift--;
X	    }
X	break;
X
X	default:
X	pm_error( "can't happen", 0,0,0,0,0 );
X	}
X    }
X
Xbit **
Xpbm_readpbm( file, colsP, rowsP )
XFILE *file;
Xint *colsP, *rowsP;
X    {
X    register bit **bits;
X    int format, row;
X
X    pbm_readpbminit( file, colsP, rowsP, &format );
X
X    bits = pbm_allocarray( *colsP, *rowsP );
X
X    for ( row = 0; row < *rowsP; row++ )
X	pbm_readpbmrow( file, bits[row], *colsP, format );
X
X    return bits;
X    }
SHAR_EOF
if test 2705 -ne "`wc -c < 'pbm/libpbm2.c'`"
then
	echo shar: error transmitting "'pbm/libpbm2.c'" '(should have been 2705 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/libpbm3.c'" '(2245 characters)'
if test -f 'pbm/libpbm3.c'
then
	echo shar: will not over-write existing file "'pbm/libpbm3.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/libpbm3.c'
X/* libpbm3.c - pbm utility library part 3
X**
X** Copyright (C) 1988 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#include "pbm.h"
X#include "libpbm.h"
X
Xvoid
Xpbm_writepbminit( file, cols, rows )
XFILE *file;
Xint cols, rows;
X    {
X#ifdef PBMPLUS_RAWBITS
X    fprintf( file, "%c%c\n%d %d\n", PBM_MAGIC1, RPBM_MAGIC2, cols, rows );
X#else PBMPLUS_RAWBITS
X    fprintf( file, "%c%c\n%d %d\n", PBM_MAGIC1, PBM_MAGIC2, cols, rows );
X#endif PBMPLUS_RAWBITS
X    }
X
Xvoid
Xpbm_writepbmrow( file, bitrow, cols )
XFILE *file;
Xbit *bitrow;
Xint cols;
X    {
X#ifdef PBMPLUS_RAWBITS
X    register int col, bitshift;
X    register unsigned char item;
X    register bit *bP;
X
X    bitshift = 7;
X    item = 0;
X    for ( col = 0, bP = bitrow; col < cols; col++, bP++ )
X	{
X	if ( *bP )
X	    item += 1 << bitshift;
X	bitshift--;
X	if ( bitshift == -1 )
X	    {
X	    if ( putc( item, file ) == EOF )
X		{
X		perror( "pbm_writepbmrow" );
X		exit( 1 );
X		}
X	    bitshift = 7;
X	    item = 0;
X	    }
X	}
X    if ( bitshift != 7 )
X	if ( putc( item, file ) == EOF )
X	    {
X	    perror( "pbm_writepbmrow" );
X	    exit( 1 );
X	    }
X#else PBMPLUS_RAWBITS
X    register int col, charcount;
X    register bit *bP;
X
X    charcount = 0;
X    for ( col = 0, bP = bitrow; col < cols; col++, bP++ )
X	{
X	if ( charcount >= 70 )
X	    {
X	    if ( putc( '\n', file ) == EOF )
X		{
X		perror( "pbm_writepbmrow" );
X		exit( 1 );
X		}
X	    charcount = 0;
X	    }
X	if ( putc( *bP ? '1' : '0', file ) == EOF )
X	    {
X	    perror( "pbm_writepbmrow" );
X	    exit( 1 );
X	    }
X	charcount++;
X	}
X    if ( putc( '\n', file ) == EOF )
X	{
X	perror( "pbm_writepbmrow" );
X	exit( 1 );
X	}
X#endif PBMPLUS_RAWBITS
X    }
X
Xvoid
Xpbm_writepbm( file, bits, cols, rows )
XFILE *file;
Xbit **bits;
Xint cols, rows;
X    {
X    int row;
X
X    pbm_writepbminit( file, cols, rows );
X
X    for ( row = 0; row < rows; row++ )
X	pbm_writepbmrow( file, bits[row], cols );
X    }
SHAR_EOF
if test 2245 -ne "`wc -c < 'pbm/libpbm3.c'`"
then
	echo shar: error transmitting "'pbm/libpbm3.c'" '(should have been 2245 characters)'
fi
fi # end of overwriting check
if test ! -d 'pbm'
then
	echo shar: creating directory "'pbm'"
	mkdir 'pbm'
fi
echo shar: extracting "'pbm/libpbm4.c'" '(1553 characters)'
if test -f 'pbm/libpbm4.c'
then
	echo shar: will not over-write existing file "'pbm/libpbm4.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pbm/libpbm4.c'
X/* libpbm4.c - pbm utility library part 4
X**
X** Copyright (C) 1988 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#include "pbm.h"
X#include "libpbm.h"
X
Xchar
Xpbm_getc( file )
XFILE *file;
X    {
X    register int ich;
X    register char ch;
X
X    ich = getc( file );
X    if ( ich == EOF )
X	pm_error( "premature EOF", 0,0,0,0,0 );
X    ch = (char) ich;
X    
X    if ( ch == '#' )
X	{
X	do
X	    {
X	    ich = getc( file );
X	    if ( ich == EOF )
X		pm_error( "premature EOF", 0,0,0,0,0 );
X	    ch = (char) ich;
X	    }
X	while ( ch != '\n' );
X	}
X
X    return ch;
X    }
X
Xunsigned char
Xpbm_getrawbyte( file )
XFILE *file;
X    {
X    register int iby;
X
X    iby = getc( file );
X    if ( iby == EOF )
X	pm_error( "premature EOF", 0,0,0,0,0 );
X    return (unsigned char) iby;
X    }
X
Xint
Xpbm_getint( file )
XFILE *file;
X    {
X    register char ch;
X    register int i;
X
X    do
X	{
X	ch = pbm_getc( file );
X	}
X    while ( ch == ' ' || ch == '\t' || ch == '\n' );
X
X    if ( ch < '0' || ch > '9' )
X	pm_error( "junk in file where an integer should be", 0,0,0,0,0 );
X
X    i = 0;
X    do
X	{
X	i = i * 10 + ch - '0';
X	ch = pbm_getc( file );
X        }
X    while ( ch >= '0' && ch <= '9' );
X
X    return i;
X    }
SHAR_EOF
if test 1553 -ne "`wc -c < 'pbm/libpbm4.c'`"
then
	echo shar: error transmitting "'pbm/libpbm4.c'" '(should have been 1553 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0



More information about the Alt.sources mailing list