[comp.sources.misc] v17i035: psnup - N-up Postscript printing, Patch01

clewis@ferret (Chris Lewis) (03/09/91)

Submitted-by: Chris Lewis <clewis@ferret.ocunix.on.ca>
Posting-number: Volume 17, Issue 35
Archive-name: psnup/patch01
Patch-To: psnup: Volume 16, Issue 104

This is the first patch for psnup. Please apply it by changing 
directory to the directory containing the psnup distribution. 
Unshar the patch file and then apply the patch by typing:
	
	patch -N -p < psnup.patch1

The psnup program takes arbitrary postscript as input, and wraps it
with additional postscript to implement n-up printing.  The input
postscript is taken from the file arguments, or stdin if no arguments
are specified.  The output is sent to stdout.

Chris
--------
#! /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".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of shell archive."
# Contents:  psnup.patch1
# Wrapped by kent@sparky on Fri Mar  8 22:45:26 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'psnup.patch1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'psnup.patch1'\"
else
echo shar: Extracting \"'psnup.patch1'\" \(5359 characters\)
sed "s/^X//" >'psnup.patch1' <<'END_OF_FILE'
X*** orig/README	Fri Feb 22 11:03:09 1991
X--- README	Fri Feb 22 11:32:19 1991
X***************
X*** 1,3 ****
X--- 1,38 ----
X+ 			PSNUP README Patch 1
X+ 
X+ 			Chris Lewis
X+ 
X+ This release is a combination of two things: a generalized n-up processor
X+ for postscript files, plus a shell wrapper script and manual page.
X+ Ned Batchelder wrote the postscript n-up handling and postscript
X+ compressor program, and I wrote the shell wrapper script and manual page.
X+ I include the original README from Ned Batchelder below.  Note, however,
X+ that the psnup shell script performs the parameter substitution that Ned
X+ refers to.  Therefore, you don't have to do anything to the nup.* stuff.
X+ 
X+ Patch 1 note: I'm more than a little embarrassed about the difficulties
X+ in the shell script and manual page.  That's what comes of not testing
X+ the final version.  In particular, the manual page did not make it clear
X+ that the origin for "-s" is 0 not 1, and the default should be 0 not 1,
X+ and that the -r & -R implementation was reversed.  Hence the fixes to
X+ psnup.sh and psnup.1.  As well, there was a bug in psc.c in that the
X+ return from getchar() was defined as a char, which can cause infinite
X+ loops on some machines.
X+ 
X+ Other changes include this little note in the README (because some people
X+ were editting nup.* directly, which they don't need to) and a removal
X+ of the "%!" from nup.post.ps.
X+ 
X+ Psroff (CAT & ditroff -2- HPLJ/ditroff/Postscript) has been
X+ modified to utilize the nup.epi and nup.pro files.  So, you'll want
X+ to keep this if you intend to use psroff.  Psroff 3.0 will be released
X+ soon.
X+ 
X+ And finally, like all n-up programs, it is possible for it to be fooled.
X+ Nup does what it does by redefining a few operators, such as initgraphics.
X+ Be aware that some applications (tpscript seems to be one of them) will
X+ foul up nup's definitions, and the results will not be what you intended.
X+ -------------------------------------------
X  	Nup is designed to be used as a wrap around any PostScript file.
X  Simply prepend nup.pre.ps, and append nup.post.ps, and it should work. There
X  are three tokens in nup.pre.ps which need to be changed before sending it to
X*** orig/nup.post.ps	Fri Feb 22 11:03:13 1991
X--- nup.post.ps	Fri Feb 22 11:07:06 1991
X***************
X*** 1,4 ****
X! %! nup.post.ps -- Postlude for n-up printing. $Revision: 4.2 $
X  %
X  % Ned Batchelder, University of Pennsylvania
X  % ned@UPenn.CSnet
X--- 1,4 ----
X! % nup.post.ps -- Postlude for n-up printing. $Revision: 4.2 $
X  %
X  % Ned Batchelder, University of Pennsylvania
X  % ned@UPenn.CSnet
X*** orig/psc.c	Fri Feb 22 11:03:18 1991
X--- psc.c	Sat Feb 16 22:49:00 1991
X***************
X*** 33,39 ****
X  	int	inhex = 0;	/* Are we in a hex string? */
X  	int	column = 0;	/* Counts output columns to keep lines short */
X  	int	keepch = 0;	/* For breaking strings */
X! 	char	c;		/* The current character */
X  
X  # define put(c)		{putchar(c); column++;}
X  
X--- 33,39 ----
X  	int	inhex = 0;	/* Are we in a hex string? */
X  	int	column = 0;	/* Counts output columns to keep lines short */
X  	int	keepch = 0;	/* For breaking strings */
X! 	int	c;		/* The current character */
X  
X  # define put(c)		{putchar(c); column++;}
X  
X*** orig/psnup.1	Fri Feb 22 11:03:20 1991
X--- psnup.1	Mon Feb 18 21:38:35 1991
X***************
X*** 42,53 ****
X  The
X  .BI -s n
X  option indicates which spot the first page of output occurs in.
X  .P
X  The defaults are:
X  .BR -p2 ,
X! .BR -r ,
X  and
X! .BR -s1 ,
X  .P
X  .B Psnup
X  tries very hard to retain a trailing control-D if the file has
X--- 42,54 ----
X  The
X  .BI -s n
X  option indicates which spot the first page of output occurs in.
X+ The first spot on the page is 0.
X  .P
X  The defaults are:
X  .BR -p2 ,
X! .BR -R ,
X  and
X! .BR -s0 .
X  .P
X  .B Psnup
X  tries very hard to retain a trailing control-D if the file has
X*** orig/psnup.sh	Fri Feb 22 11:03:21 1991
X--- psnup.sh	Fri Feb 22 11:32:50 1991
X***************
X*** 9,18 ****
X  rm -f /tmp/?$$
X  
X  pages=2
X! #	Default is reversed for use with psroff with psxlate in the
X! #	pipeline to reverse pages.
X! reverse=true
X! start=1
X  
X  for i
X  do
X--- 9,17 ----
X  rm -f /tmp/?$$
X  
X  pages=2
X! #	Default is nonreversed for use with forward printing printers.
X! reverse=false
X! start=0
X  
X  for i
X  do
X***************
X*** 19,29 ****
X      case $i in
X  	-p2 | -p4 | -p8 | -p16)
X  	    pages=`echo $i | sed -e 's/^..//'`
X- 	    if [ -z "$pages" -o -n "`echo $pages | sed -e 's/[0-9]*//'`" ]
X- 	    then
X- 		echo "$0: Non-numeric pages per sheet option $i" >&2
X- 		exit 1
X- 	    fi
X  	    ;;
X  	-p*)
X  	    echo "$0: -p option ($i) must be 2, 4, 8 or 16" >&2
X--- 18,23 ----
X***************
X*** 30,39 ****
X  	    exit 1
X  	    ;;
X  	-r)
X! 	    reverse=false
X  	    ;;
X  	-R)
X! 	    reverse=true
X  	    ;;
X  	-s*)
X  	    start=`echo $i | sed -e 's/^..//'`
X--- 24,33 ----
X  	    exit 1
X  	    ;;
X  	-r)
X! 	    reverse=true
X  	    ;;
X  	-R)
X! 	    reverse=false
X  	    ;;
X  	-s*)
X  	    start=`echo $i | sed -e 's/^..//'`
X***************
X*** 54,62 ****
X      esac
X      shift
X  done
X! if [ $start -gt $pages ]
X  then
X!     echo "$0: start option (-s$start) must be <= pages/sheet (-p$pages)" \
X  	>&2
X      exit 1
X  fi
X--- 48,56 ----
X      esac
X      shift
X  done
X! if [ $start -ge $pages ]
X  then
X!     echo "$0: start option (-s$start) must be < pages/sheet (-p$pages)" \
X  	>&2
X      exit 1
X  fi
X
END_OF_FILE
if test 5359 -ne `wc -c <'psnup.patch1'`; then
    echo shar: \"'psnup.patch1'\" unpacked with wrong size!
fi
# end of 'psnup.patch1'
fi
echo shar: End of shell archive.
exit 0
exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.