psutils-1.17.orig/0002755000064100006410000000000012016123102012150 5ustar ejbejbpsutils-1.17.orig/LICENSE0000644000064100006410000000433606311361112013167 0ustar ejbejb PS Utilities Package The constituent files of this package listed below are copyright (C) 1991-1995 Angus J. C. Duggan. LICENSE Makefile.msc Makefile.nt Makefile.os2 Makefile.unix README config.h descrip.mms epsffit.c epsffit.man extractres.man extractres.pl fixdlsrps.man fixdlsrps.pl fixfmps.man fixfmps.pl fixmacps.man fixmacps.pl fixpsditps.man fixpsditps.pl fixpspps.man fixpspps.pl fixscribeps.man fixscribeps.pl fixtpps.man fixtpps.pl fixwfwps.man fixwfwps.pl fixwpps.man fixwpps.pl fixwwps.man fixwwps.pl getafm getafm.man includeres.man includeres.pl maketext patchlev.h psbook.c psbook.man pserror.c pserror.h psmerge.man psmerge.pl psnup.c psnup.man psresize.c psresize.man psselect.c psselect.man psspec.c psspec.h pstops.c pstops.man psutil.c psutil.h showchar They may be copied and used for any purpose (including distribution as part of a for-profit product), provided: 1) The original attribution of the programs is clearly displayed in the product and/or documentation, even if the programs are modified and/or renamed as part of the product. 2) The original source code of the programs is provided free of charge (except for reasonable distribution costs). For a definition of reasonable distribution costs, see the Gnu General Public License or Larry Wall's Artistic License (provided with the Perl 4 kit). The GPL and Artistic License in NO WAY affect this license; they are merely used as examples of the spirit in which it is intended. 3) These programs are provided "as-is". No warranty or guarantee of their fitness for any particular task is provided. Use of these programs is completely at your own risk. Basically, I don't mind how you use the programs so long as you acknowledge the author, and give people the originals if they want them. The included files, md68_0.ps and md71_0.ps (and their uuencoded forms) are (to the best of my knowledge) copyright Apple Computer, Inc. AJCD 4/4/95 psutils-1.17.orig/Makefile.unix0000644000064100006410000001501106311361113014575 0ustar ejbejb# Makefile for PS utilities release 1 patchlevel 17 # # Copyright (C) Angus J. C. Duggan 1991-1996 # See file LICENSE for details. # # updated AJCD 3/1/96 # # Multiple makefiles for different OSes are generated from a single master # now. # # There are so many incompatible makes around that putting all of the # non-standard targets explicitly seems to be the only way of ensuring # portability. # epsffit fits an epsf file to a given bounding box # psbook rearranges pages into signatures # psselect selects page ranges # pstops performs general page rearrangement and merging # psnup puts multiple logical pages on one physical page # psresize scales and moves pages to fit on different paper sizes PAPER=a4 # Makefile for PSUtils under Unix OS = UNIX BINDIR = /usr/local/bin SCRIPTDIR = $(BINDIR) INCLUDEDIR = /usr/local/share/psutils PERL = /usr/local/bin/perl BINMODE = 0755 MANMODE = 0644 CHMOD = chmod INSTALL = install -c -m $(BINMODE) INSTALLMAN = install -c -m $(MANMODE) MANEXT = 1 MANDIR = /usr/local/share/man/man$(MANEXT) CC = gcc CFLAGS = -DPAPER=\"$(PAPER)\" -DUNIX -O -Wall BIN = psbook psselect pstops epsffit psnup \ psresize SHELLSCRIPTS = getafm showchar PERLSCRIPTS = fixfmps fixmacps fixpsditps fixpspps \ fixtpps fixwfwps fixwpps fixscribeps fixwwps \ fixdlsrps extractres includeres psmerge MANPAGES = psbook.$(MANEXT) psselect.$(MANEXT) pstops.$(MANEXT) epsffit.$(MANEXT) psnup.$(MANEXT) \ psresize.$(MANEXT) psmerge.$(MANEXT) fixscribeps.$(MANEXT) getafm.$(MANEXT) \ fixdlsrps.$(MANEXT) fixfmps.$(MANEXT) fixmacps.$(MANEXT) fixpsditps.$(MANEXT) \ fixpspps.$(MANEXT) fixtpps.$(MANEXT) fixwfwps.$(MANEXT) fixwpps.$(MANEXT) \ fixwwps.$(MANEXT) extractres.$(MANEXT) includeres.$(MANEXT) INCLUDES = md68_0.ps md71_0.ps all: $(BIN) $(PERLSCRIPTS) $(MANPAGES) $(SHELLSCRIPTS) psutil.o: psutil.h patchlev.h pserror.h psutil.c psspec.o: psutil.h patchlev.h psspec.h pserror.h psspec.c pserror.o: psutil.h patchlev.h pserror.h pserror.c epsffit.o: epsffit.c pserror.h patchlev.h epsffit: epsffit.o pserror.o $(CC) $(CCFLAGS) -o epsffit pserror.o epsffit.o psnup: psnup.o psutil.o psspec.o pserror.o $(CC) $(CCFLAGS) -o psnup psutil.o psspec.o pserror.o psnup.o psnup.o: psutil.h patchlev.h psspec.h pserror.h psnup.c psresize: psresize.o psutil.o pserror.o psspec.o $(CC) $(CCFLAGS) -o psresize psutil.o psspec.o pserror.o psresize.o psresize.o: psutil.h patchlev.h psspec.h pserror.h psresize.c psbook: psbook.o psutil.o pserror.o $(CC) $(CCFLAGS) -o psbook psutil.o pserror.o psbook.o psbook.o: psutil.h patchlev.h pserror.h psbook.c psselect: psselect.o psutil.o pserror.o $(CC) $(CCFLAGS) -o psselect psutil.o pserror.o psselect.o psselect.o: psutil.h patchlev.h pserror.h psselect.c pstops: pstops.o psutil.o psspec.o pserror.o $(CC) $(CCFLAGS) -o pstops psutil.o psspec.o pserror.o pstops.o pstops.o: psutil.h patchlev.h psspec.h pserror.h pstops.c getafm: getafm.sh cp $? $@ showchar: showchar.sh cp $? $@ psmerge: psmerge.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixfmps: fixfmps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixmacps: fixmacps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) INCLUDE=$(INCLUDEDIR) $? > $@ $(CHMOD) $(BINMODE) $@ fixpsditps: fixpsditps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixpspps: fixpspps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixscribeps: fixscribeps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixtpps: fixtpps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixwfwps: fixwfwps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixwpps: fixwpps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixwwps: fixwwps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixdlsrps: fixdlsrps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ extractres: extractres.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ includeres: includeres.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) INCLUDE=$(INCLUDEDIR) $? > $@ $(CHMOD) $(BINMODE) $@ epsffit.$(MANEXT): epsffit.man $(PERL) maketext MAN="$(MANPAGES)" $? > $@ psnup.$(MANEXT): psnup.man $(PERL) maketext MAN="$(MANPAGES)" PAPER=$(PAPER) $? > $@ psresize.$(MANEXT): psresize.man $(PERL) maketext MAN="$(MANPAGES)" PAPER=$(PAPER) $? > $@ psbook.$(MANEXT): psbook.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ psselect.$(MANEXT): psselect.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ pstops.$(MANEXT): pstops.man $(PERL) maketext "MAN=$(MANPAGES)" PAPER=$(PAPER) $? > $@ psmerge.$(MANEXT): psmerge.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixfmps.$(MANEXT): fixfmps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixmacps.$(MANEXT): fixmacps.man $(PERL) maketext "MAN=$(MANPAGES)" INCLUDE=$(INCLUDEDIR) $? > $@ fixpsditps.$(MANEXT): fixpsditps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixpspps.$(MANEXT): fixpspps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixscribeps.$(MANEXT): fixscribeps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixtpps.$(MANEXT): fixtpps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixwfwps.$(MANEXT): fixwfwps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixwpps.$(MANEXT): fixwpps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixwwps.$(MANEXT): fixwwps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixdlsrps.$(MANEXT): fixdlsrps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ extractres.$(MANEXT): extractres.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ includeres.$(MANEXT): includeres.man $(PERL) maketext "MAN=$(MANPAGES)" INCLUDE=$(INCLUDEDIR) $? > $@ getafm.$(MANEXT): getafm.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ clean: rm -f *.o veryclean realclean: clean rm -f $(BIN) $(PERLSCRIPTS) $(MANPAGES) install: install.bin install.script install.man install.include install.bin: $(BIN) -mkdir $(BINDIR) @for i in $(BIN); do \ echo Installing $$i; \ $(INSTALL) $$i $(BINDIR); \ done install.script: $(PERLSCRIPTS) $(SHELLSCRIPTS) -mkdir $(SCRIPTDIR) @for i in $(PERLSCRIPTS) $(SHELLSCRIPTS); do \ echo Installing $$i; \ $(INSTALL) $$i $(SCRIPTDIR); \ done install.include: $(INCLUDES) -mkdir $(INCLUDEDIR) @for i in $(INCLUDES); do \ echo Installing $$i; \ $(INSTALLMAN) $$i $(INCLUDEDIR); \ done install.man: $(MANPAGES) -mkdir $(MANDIR) @for i in $(MANPAGES); do \ echo Installing manual page for $$i; \ $(INSTALLMAN) $$i $(MANDIR)/$$i; \ done psutils-1.17.orig/Makefile.msc0000644000064100006410000000536706311361112014410 0ustar ejbejb# Makefile for PS utilities release 1 patchlevel 17 # # Copyright (C) Angus J. C. Duggan 1991-1996 # See file LICENSE for details. # # updated AJCD 3/1/96 # # Multiple makefiles for different OSes are generated from a single master # now. # # There are so many incompatible makes around that putting all of the # non-standard targets explicitly seems to be the only way of ensuring # portability. # epsffit fits an epsf file to a given bounding box # psbook rearranges pages into signatures # psselect selects page ranges # pstops performs general page rearrangement and merging # psnup puts multiple logical pages on one physical page # psresize scales and moves pages to fit on different paper sizes PAPER=a4 # Makefile for PSUtils under MSDOS OS = DOS BINDIR = \psutils SCRIPTDIR = $(BINDIR) INCLUDEDIR = \psutils\include # Flags for Microsoft C/C++ Compiler CC = cl CFLAGS = -DPAPER=\"$(PAPER)\" -DMSDOS -W4 -Zi -Ox BIN = psbook.exe psselect.exe pstops.exe epsffit.exe psnup.exe \ psresize.exe SHELLSCRIPTS = PERLSCRIPTS = \ \ MANPAGES = \ \ \ \ INCLUDES = md68_0.ps md71_0.ps all: $(BIN) $(PERLSCRIPTS) $(MANPAGES) $(SHELLSCRIPTS) psutil.obj: psutil.h patchlev.h pserror.h psutil.c psspec.obj: psutil.h patchlev.h psspec.h pserror.h psspec.c pserror.obj: psutil.h patchlev.h pserror.h pserror.c epsffit.obj: epsffit.c pserror.h patchlev.h epsffit.exe: epsffit.obj pserror.obj link -out:epsffit.exe pserror.obj epsffit.obj psnup.exe: psnup.obj psutil.obj psspec.obj pserror.obj link -out:psnup.exe psutil.obj psspec.obj pserror.obj psnup.obj psnup.obj: psutil.h patchlev.h psspec.h pserror.h psnup.c psresize.exe: psresize.obj psutil.obj pserror.obj psspec.obj link -out:psresize.exe psutil.obj psspec.obj pserror.obj psresize.obj psresize.obj: psutil.h patchlev.h psspec.h pserror.h psresize.c psbook.exe: psbook.obj psutil.obj pserror.obj link -out:psbook.exe psutil.obj pserror.obj psbook.obj psbook.obj: psutil.h patchlev.h pserror.h psbook.c psselect.exe: psselect.obj psutil.obj pserror.obj link -out:psselect.exe psutil.obj pserror.obj psselect.obj psselect.obj: psutil.h patchlev.h pserror.h psselect.c pstops.exe: pstops.obj psutil.obj psspec.obj pserror.obj link -out:pstops.exe psutil.obj psspec.obj pserror.obj pstops.obj pstops.obj: psutil.h patchlev.h psspec.h pserror.h pstops.c clean: del *.obj veryclean realclean: clean del $(BIN) $(PERLSCRIPTS) $(MANPAGES) install: install.bin install.script install.include install.bin: $(BIN) -mkdir $(BINDIR) @for %1 in ( $(BIN) ) do copy %1 $(BINDIR) install.script: $(PERLSCRIPTS) -mkdir $(SCRIPTDIR) @for %1 in ( $(PERLSCRIPTS) ) do copy %1 $(SCRIPTDIR) install.include: $(INCLUDES) -mkdir $(INCLUDEDIR) @for %1 in ( $(INCLUDES) ) do copy %1 $(INCLUDEDIR) psutils-1.17.orig/Makefile.bcc0000644000064100006410000000534706311361112014353 0ustar ejbejb# Makefile for PS utilities release 1 patchlevel 17 # # Copyright (C) Angus J. C. Duggan 1991-1996 # See file LICENSE for details. # # updated AJCD 3/1/96 # # Multiple makefiles for different OSes are generated from a single master # now. # # There are so many incompatible makes around that putting all of the # non-standard targets explicitly seems to be the only way of ensuring # portability. # epsffit fits an epsf file to a given bounding box # psbook rearranges pages into signatures # psselect selects page ranges # pstops performs general page rearrangement and merging # psnup puts multiple logical pages on one physical page # psresize scales and moves pages to fit on different paper sizes PAPER=a4 # Makefile for PSUtils under MSDOS OS = DOS BINDIR = \psutils SCRIPTDIR = $(BINDIR) INCLUDEDIR = \psutils\include # Flags for Borland C Compiler CC = bcc CFLAGS = -DPAPER="$(PAPER)" -DMSDOS -w -v -O BIN = psbook.exe psselect.exe pstops.exe epsffit.exe psnup.exe \ psresize.exe SHELLSCRIPTS = PERLSCRIPTS = \ \ MANPAGES = \ \ \ \ INCLUDES = md68_0.ps md71_0.ps all: $(BIN) $(PERLSCRIPTS) $(MANPAGES) $(SHELLSCRIPTS) psutil.obj: psutil.h patchlev.h pserror.h psutil.c psspec.obj: psutil.h patchlev.h psspec.h pserror.h psspec.c pserror.obj: psutil.h patchlev.h pserror.h pserror.c epsffit.obj: epsffit.c pserror.h patchlev.h epsffit.exe: epsffit.obj pserror.obj $(CC) -e epsffit.exe pserror.obj epsffit.obj psnup.exe: psnup.obj psutil.obj psspec.obj pserror.obj $(CC) -e psnup.exe psutil.obj psspec.obj pserror.obj psnup.obj psnup.obj: psutil.h patchlev.h psspec.h pserror.h psnup.c psresize.exe: psresize.obj psutil.obj pserror.obj psspec.obj $(CC) -e psresize.exe psutil.obj psspec.obj pserror.obj psresize.obj psresize.obj: psutil.h patchlev.h psspec.h pserror.h psresize.c psbook.exe: psbook.obj psutil.obj pserror.obj $(CC) -e psbook.exe psutil.obj pserror.obj psbook.obj psbook.obj: psutil.h patchlev.h pserror.h psbook.c psselect.exe: psselect.obj psutil.obj pserror.obj $(CC) -e psselect.exe psutil.obj pserror.obj psselect.obj psselect.obj: psutil.h patchlev.h pserror.h psselect.c pstops.exe: pstops.obj psutil.obj psspec.obj pserror.obj $(CC) -e pstops.exe psutil.obj psspec.obj pserror.obj pstops.obj pstops.obj: psutil.h patchlev.h psspec.h pserror.h pstops.c clean: del *.obj veryclean realclean: clean del $(BIN) $(PERLSCRIPTS) $(MANPAGES) install: install.bin install.script install.include install.bin: $(BIN) -mkdir $(BINDIR) @for %1 in ( $(BIN) ) do copy %1 $(BINDIR) install.script: $(PERLSCRIPTS) -mkdir $(SCRIPTDIR) @for %1 in ( $(PERLSCRIPTS) ) do copy %1 $(SCRIPTDIR) install.include: $(INCLUDES) -mkdir $(INCLUDEDIR) @for %1 in ( $(INCLUDES) ) do copy %1 $(INCLUDEDIR) psutils-1.17.orig/Makefile.sc0000644000064100006410000000534306311361113014226 0ustar ejbejb# Makefile for PS utilities release 1 patchlevel 17 # # Copyright (C) Angus J. C. Duggan 1991-1996 # See file LICENSE for details. # # updated AJCD 3/1/96 # # Multiple makefiles for different OSes are generated from a single master # now. # # There are so many incompatible makes around that putting all of the # non-standard targets explicitly seems to be the only way of ensuring # portability. # epsffit fits an epsf file to a given bounding box # psbook rearranges pages into signatures # psselect selects page ranges # pstops performs general page rearrangement and merging # psnup puts multiple logical pages on one physical page # psresize scales and moves pages to fit on different paper sizes PAPER=a4 # Makefile for PSUtils under MSDOS OS = DOS BINDIR = \psutils SCRIPTDIR = $(BINDIR) INCLUDEDIR = \psutils\include # Flags for Symantec C Compiler CC = sc CFLAGS = -DPAPER=\"$(PAPER)\" -DMSDOS -g BIN = psbook.exe psselect.exe pstops.exe epsffit.exe psnup.exe \ psresize.exe SHELLSCRIPTS = PERLSCRIPTS = \ \ MANPAGES = \ \ \ \ INCLUDES = md68_0.ps md71_0.ps all: $(BIN) $(PERLSCRIPTS) $(MANPAGES) $(SHELLSCRIPTS) psutil.obj: psutil.h patchlev.h pserror.h psutil.c psspec.obj: psutil.h patchlev.h psspec.h pserror.h psspec.c pserror.obj: psutil.h patchlev.h pserror.h pserror.c epsffit.obj: epsffit.c pserror.h patchlev.h epsffit.exe: epsffit.obj pserror.obj $(CC) -oEXE(epsffit) pserror.obj epsffit.obj psnup.exe: psnup.obj psutil.obj psspec.obj pserror.obj $(CC) -oEXE(psnup) psutil.obj psspec.obj pserror.obj psnup.obj psnup.obj: psutil.h patchlev.h psspec.h pserror.h psnup.c psresize.exe: psresize.obj psutil.obj pserror.obj psspec.obj $(CC) -oEXE(psresize) psutil.obj psspec.obj pserror.obj psresize.obj psresize.obj: psutil.h patchlev.h psspec.h pserror.h psresize.c psbook.exe: psbook.obj psutil.obj pserror.obj $(CC) -oEXE(psbook) psutil.obj pserror.obj psbook.obj psbook.obj: psutil.h patchlev.h pserror.h psbook.c psselect.exe: psselect.obj psutil.obj pserror.obj $(CC) -oEXE(psselect) psutil.obj pserror.obj psselect.obj psselect.obj: psutil.h patchlev.h pserror.h psselect.c pstops.exe: pstops.obj psutil.obj psspec.obj pserror.obj $(CC) -oEXE(pstops) psutil.obj psspec.obj pserror.obj pstops.obj pstops.obj: psutil.h patchlev.h psspec.h pserror.h pstops.c clean: del *.obj veryclean realclean: clean del $(BIN) $(PERLSCRIPTS) $(MANPAGES) install: install.bin install.script install.include install.bin: $(BIN) -mkdir $(BINDIR) @for %1 in ( $(BIN) ) do copy %1 $(BINDIR) install.script: $(PERLSCRIPTS) -mkdir $(SCRIPTDIR) @for %1 in ( $(PERLSCRIPTS) ) do copy %1 $(SCRIPTDIR) install.include: $(INCLUDES) -mkdir $(INCLUDEDIR) @for %1 in ( $(INCLUDES) ) do copy %1 $(INCLUDEDIR) psutils-1.17.orig/Makefile.wat0000644000064100006410000000543106311361113014412 0ustar ejbejb# Makefile for PS utilities release 1 patchlevel 17 # # Copyright (C) Angus J. C. Duggan 1991-1996 # See file LICENSE for details. # # updated AJCD 3/1/96 # # Multiple makefiles for different OSes are generated from a single master # now. # # There are so many incompatible makes around that putting all of the # non-standard targets explicitly seems to be the only way of ensuring # portability. # epsffit fits an epsf file to a given bounding box # psbook rearranges pages into signatures # psselect selects page ranges # pstops performs general page rearrangement and merging # psnup puts multiple logical pages on one physical page # psresize scales and moves pages to fit on different paper sizes PAPER=a4 # Makefile for PSUtils under MSDOS OS = DOS BINDIR = \psutils SCRIPTDIR = $(BINDIR) INCLUDEDIR = \psutils\include # Flags for Watcom C Compiler CC = wcc386 CFLAGS = -dPAPER=\"$(PAPER)\" -dMSDOS -zq -oxt BIN = psbook.exe psselect.exe pstops.exe epsffit.exe psnup.exe \ psresize.exe SHELLSCRIPTS = PERLSCRIPTS = \ \ MANPAGES = \ \ \ \ INCLUDES = md68_0.ps md71_0.ps all: $(BIN) $(PERLSCRIPTS) $(MANPAGES) $(SHELLSCRIPTS) psutil.obj: psutil.h patchlev.h pserror.h psutil.c psspec.obj: psutil.h patchlev.h psspec.h pserror.h psspec.c pserror.obj: psutil.h patchlev.h pserror.h pserror.c epsffit.obj: epsffit.c pserror.h patchlev.h epsffit.exe: epsffit.obj pserror.obj wcc386 -epsffite=epsffit.exe pserror.obj epsffit.obj psnup.exe: psnup.obj psutil.obj psspec.obj pserror.obj wcc386 -psnupe=psnup.exe psutil.obj psspec.obj pserror.obj psnup.obj psnup.obj: psutil.h patchlev.h psspec.h pserror.h psnup.c psresize.exe: psresize.obj psutil.obj pserror.obj psspec.obj wcc386 -psresizee=psresize.exe psutil.obj psspec.obj pserror.obj psresize.obj psresize.obj: psutil.h patchlev.h psspec.h pserror.h psresize.c psbook.exe: psbook.obj psutil.obj pserror.obj wcc386 -psbooke=psbook.exe psutil.obj pserror.obj psbook.obj psbook.obj: psutil.h patchlev.h pserror.h psbook.c psselect.exe: psselect.obj psutil.obj pserror.obj wcc386 -psselecte=psselect.exe psutil.obj pserror.obj psselect.obj psselect.obj: psutil.h patchlev.h pserror.h psselect.c pstops.exe: pstops.obj psutil.obj psspec.obj pserror.obj wcc386 -pstopse=pstops.exe psutil.obj psspec.obj pserror.obj pstops.obj pstops.obj: psutil.h patchlev.h psspec.h pserror.h pstops.c clean: del *.obj veryclean realclean: clean del $(BIN) $(PERLSCRIPTS) $(MANPAGES) install: install.bin install.script install.include install.bin: $(BIN) -mkdir $(BINDIR) @for %1 in ( $(BIN) ) do copy %1 $(BINDIR) install.script: $(PERLSCRIPTS) -mkdir $(SCRIPTDIR) @for %1 in ( $(PERLSCRIPTS) ) do copy %1 $(SCRIPTDIR) install.include: $(INCLUDES) -mkdir $(INCLUDEDIR) @for %1 in ( $(INCLUDES) ) do copy %1 $(INCLUDEDIR) psutils-1.17.orig/Makefile.nt0000644000064100006410000000762506311361112014246 0ustar ejbejb# Makefile for PS utilities release 1 patchlevel 17 # # Copyright (C) Angus J. C. Duggan 1991-1996 # See file LICENSE for details. # # updated AJCD 3/1/96 # # Multiple makefiles for different OSes are generated from a single master # now. # # There are so many incompatible makes around that putting all of the # non-standard targets explicitly seems to be the only way of ensuring # portability. # epsffit fits an epsf file to a given bounding box # psbook rearranges pages into signatures # psselect selects page ranges # pstops performs general page rearrangement and merging # psnup puts multiple logical pages on one physical page # psresize scales and moves pages to fit on different paper sizes PAPER=a4 # Makefile for PSUtils under Windows NT, Microsoft C/C++ Compiler OS = WINNT BINDIR = \psutils SCRIPTDIR = $(BINDIR) INCLUDEDIR = \psutils\include PERL = perl CFLAGS = -DPAPER=\"$(PAPER)\" -DWINNT /W4 BIN = psbook.exe psselect.exe pstops.exe epsffit.exe psnup.exe \ psresize.exe SHELLSCRIPTS = PERLSCRIPTS = fixfmps.cmd fixmacps.cmd fixpsditps.cmd fixpspps.cmd \ fixtpps.cmd fixwfwps.cmd fixwpps.cmd fixscribeps.cmd fixwwps.cmd \ fixdlsrps.cmd extractres.cmd includeres.cmd psmerge.cmd MANPAGES = \ \ \ \ INCLUDES = md68_0.ps md71_0.ps all: $(BIN) $(PERLSCRIPTS) $(MANPAGES) $(SHELLSCRIPTS) psutil.obj: psutil.h patchlev.h pserror.h psutil.c psspec.obj: psutil.h patchlev.h psspec.h pserror.h psspec.c pserror.obj: psutil.h patchlev.h pserror.h pserror.c epsffit.obj: epsffit.c pserror.h patchlev.h epsffit.exe: epsffit.obj pserror.obj link -out:epsffit.exe pserror.obj epsffit.obj psnup.exe: psnup.obj psutil.obj psspec.obj pserror.obj link -out:psnup.exe psutil.obj psspec.obj pserror.obj psnup.obj psnup.obj: psutil.h patchlev.h psspec.h pserror.h psnup.c psresize.exe: psresize.obj psutil.obj pserror.obj psspec.obj link -out:psresize.exe psutil.obj psspec.obj pserror.obj psresize.obj psresize.obj: psutil.h patchlev.h psspec.h pserror.h psresize.c psbook.exe: psbook.obj psutil.obj pserror.obj link -out:psbook.exe psutil.obj pserror.obj psbook.obj psbook.obj: psutil.h patchlev.h pserror.h psbook.c psselect.exe: psselect.obj psutil.obj pserror.obj link -out:psselect.exe psutil.obj pserror.obj psselect.obj psselect.obj: psutil.h patchlev.h pserror.h psselect.c pstops.exe: pstops.obj psutil.obj psspec.obj pserror.obj link -out:pstops.exe psutil.obj psspec.obj pserror.obj pstops.obj pstops.obj: psutil.h patchlev.h psspec.h pserror.h pstops.c psmerge.cmd: psmerge.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ fixfmps.cmd: fixfmps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ fixmacps.cmd: fixmacps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) INCLUDE=$(INCLUDEDIR) $? > $@ fixpsditps.cmd: fixpsditps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ fixpspps.cmd: fixpspps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ fixscribeps.cmd: fixscribeps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ fixtpps.cmd: fixtpps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ fixwfwps.cmd: fixwfwps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ fixwpps.cmd: fixwpps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ fixwwps.cmd: fixwwps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ fixdlsrps.cmd: fixdlsrps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ extractres.cmd: extractres.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ includeres.cmd: includeres.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) INCLUDE=$(INCLUDEDIR) $? > $@ clean: del *.obj veryclean realclean: clean del $(BIN) $(PERLSCRIPTS) $(MANPAGES) install: install.bin install.script install.include install.bin: $(BIN) -mkdir $(BINDIR) @for %1 in ( $(BIN) ) do copy %1 $(BINDIR) install.script: $(PERLSCRIPTS) -mkdir $(SCRIPTDIR) @for %1 in ( $(PERLSCRIPTS) ) do copy %1 $(SCRIPTDIR) install.include: $(INCLUDES) -mkdir $(INCLUDEDIR) @for %1 in ( $(INCLUDES) ) do copy %1 $(INCLUDEDIR) psutils-1.17.orig/Makefile.os20000644000064100006410000001536506311361112014330 0ustar ejbejb# Makefile for PS utilities release 1 patchlevel 17 # # Copyright (C) Angus J. C. Duggan 1991-1996 # See file LICENSE for details. # # updated AJCD 3/1/96 # # Multiple makefiles for different OSes are generated from a single master # now. # # There are so many incompatible makes around that putting all of the # non-standard targets explicitly seems to be the only way of ensuring # portability. # epsffit fits an epsf file to a given bounding box # psbook rearranges pages into signatures # psselect selects page ranges # pstops performs general page rearrangement and merging # psnup puts multiple logical pages on one physical page # psresize scales and moves pages to fit on different paper sizes PAPER=a4 # Makefile for PSUtils under OS/2, GCC C Compiler OS = OS2 BINDIR = \psutils SCRIPTDIR = $(BINDIR) INCLUDEDIR = /lib/psutils PERL = perl5 BINMODE = 0755 MANMODE = 0644 CHMOD = chmod INSTALL = install -c -m $(BINMODE) INSTALLMAN = install -c -m $(MANMODE) MANEXT = 1 MANDIR = /man/man$(MANEXT) CC = gcc CFLAGS = -DPAPER=\"$(PAPER)\" -DOS2 -Wall -O2 -Zomf -Zmtd -s -Zlinker /PM:VIO .c.obj: $(CC) -o $*.obj $(CFLAGS) -c $< BIN = psbook.exe psselect.exe pstops.exe epsffit.exe psnup.exe \ psresize.exe SHELLSCRIPTS = getafm.cmd showchar.cmd PERLSCRIPTS = fixfmps.cmd fixmacps.cmd fixpsditps.cmd fixpspps.cmd \ fixtpps.cmd fixwfwps.cmd fixwpps.cmd fixscribeps.cmd fixwwps.cmd \ fixdlsrps.cmd extractres.cmd includeres.cmd psmerge.cmd MANPAGES = psbook.$(MANEXT) psselect.$(MANEXT) pstops.$(MANEXT) epsffit.$(MANEXT) psnup.$(MANEXT) \ psresize.$(MANEXT) psmerge.$(MANEXT) fixscribeps.$(MANEXT) getafm.$(MANEXT) \ fixdlsrps.$(MANEXT) fixfmps.$(MANEXT) fixmacps.$(MANEXT) fixpsditps.$(MANEXT) \ fixpspps.$(MANEXT) fixtpps.$(MANEXT) fixwfwps.$(MANEXT) fixwpps.$(MANEXT) \ fixwwps.$(MANEXT) extractres.$(MANEXT) includeres.$(MANEXT) INCLUDES = md68_0.ps md71_0.ps all: $(BIN) $(PERLSCRIPTS) $(MANPAGES) $(SHELLSCRIPTS) psutil.obj: psutil.h patchlev.h pserror.h psutil.c psspec.obj: psutil.h patchlev.h psspec.h pserror.h psspec.c pserror.obj: psutil.h patchlev.h pserror.h pserror.c epsffit.obj: epsffit.c pserror.h patchlev.h epsffit.exe: epsffit.obj pserror.obj $(CC) $(CFLAGS) -o epsffit pserror.obj epsffit.obj psnup.exe: psnup.obj psutil.obj psspec.obj pserror.obj $(CC) $(CFLAGS) -o psnup psutil.obj psspec.obj pserror.obj psnup.obj psnup.obj: psutil.h patchlev.h psspec.h pserror.h psnup.c psresize.exe: psresize.obj psutil.obj pserror.obj psspec.obj $(CC) $(CFLAGS) -o psresize psutil.obj psspec.obj pserror.obj psresize.obj psresize.obj: psutil.h patchlev.h psspec.h pserror.h psresize.c psbook.exe: psbook.obj psutil.obj pserror.obj $(CC) $(CFLAGS) -o psbook psutil.obj pserror.obj psbook.obj psbook.obj: psutil.h patchlev.h pserror.h psbook.c psselect.exe: psselect.obj psutil.obj pserror.obj $(CC) $(CFLAGS) -o psselect psutil.obj pserror.obj psselect.obj psselect.obj: psutil.h patchlev.h pserror.h psselect.c pstops.exe: pstops.obj psutil.obj psspec.obj pserror.obj $(CC) $(CFLAGS) -o pstops psutil.obj psspec.obj pserror.obj pstops.obj pstops.obj: psutil.h patchlev.h psspec.h pserror.h pstops.c getafm.cmd: getafm.sh echo extproc sh $(BINDIR)/$@ >$@ head -n 2 $? >>$@ echo shift >>$@ tail -n +2 $? >>$@ showchar.cmd: showchar.sh echo extproc sh $(BINDIR)/$@ >$@ head -n 5 $? >>$@ echo shift >>$@ tail -n +5 $? >>$@ psmerge.cmd: psmerge.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixfmps.cmd: fixfmps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixmacps.cmd: fixmacps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) INCLUDE=$(INCLUDEDIR) $? > $@ $(CHMOD) $(BINMODE) $@ fixpsditps.cmd: fixpsditps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixpspps.cmd: fixpspps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixscribeps.cmd: fixscribeps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixtpps.cmd: fixtpps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixwfwps.cmd: fixwfwps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixwpps.cmd: fixwpps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixwwps.cmd: fixwwps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixdlsrps.cmd: fixdlsrps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ extractres.cmd: extractres.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ includeres.cmd: includeres.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) INCLUDE=$(INCLUDEDIR) $? > $@ $(CHMOD) $(BINMODE) $@ epsffit.$(MANEXT): epsffit.man $(PERL) maketext MAN="$(MANPAGES)" $? > $@ psnup.$(MANEXT): psnup.man $(PERL) maketext MAN="$(MANPAGES)" PAPER=$(PAPER) $? > $@ psresize.$(MANEXT): psresize.man $(PERL) maketext MAN="$(MANPAGES)" PAPER=$(PAPER) $? > $@ psbook.$(MANEXT): psbook.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ psselect.$(MANEXT): psselect.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ pstops.$(MANEXT): pstops.man $(PERL) maketext "MAN=$(MANPAGES)" PAPER=$(PAPER) $? > $@ psmerge.$(MANEXT): psmerge.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixfmps.$(MANEXT): fixfmps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixmacps.$(MANEXT): fixmacps.man $(PERL) maketext "MAN=$(MANPAGES)" INCLUDE=$(INCLUDEDIR) $? > $@ fixpsditps.$(MANEXT): fixpsditps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixpspps.$(MANEXT): fixpspps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixscribeps.$(MANEXT): fixscribeps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixtpps.$(MANEXT): fixtpps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixwfwps.$(MANEXT): fixwfwps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixwpps.$(MANEXT): fixwpps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixwwps.$(MANEXT): fixwwps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixdlsrps.$(MANEXT): fixdlsrps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ extractres.$(MANEXT): extractres.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ includeres.$(MANEXT): includeres.man $(PERL) maketext "MAN=$(MANPAGES)" INCLUDE=$(INCLUDEDIR) $? > $@ getafm.$(MANEXT): getafm.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ clean: RM *.obj veryclean realclean: clean RM $(BIN) $(PERLSCRIPTS) $(MANPAGES) install: install.bin install.script install.include install.man install.bin: $(BIN) -mkdir $(BINDIR) @for %1 in ( $(BIN) ) do copy %1 $(BINDIR) install.script: $(PERLSCRIPTS) -mkdir $(SCRIPTDIR) @for %1 in ( $(PERLSCRIPTS) ) do copy %1 $(SCRIPTDIR) install.include: $(INCLUDES) -mkdir $(INCLUDEDIR) @for %1 in ( $(INCLUDES) ) do copy %1 $(INCLUDEDIR) install.man: $(MANPAGES) -mkdir $(MANDIR) @for %1 in ( $(MANPAGES) ); do copy %1 $(MANDIR) psutils-1.17.orig/maketext0000755000064100006410000000347106311361113013732 0ustar ejbejbeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # maketext: perl filter to substitute names in scripts and man pages. %change = (); # names -> substitutions # get release and patchlevel for all scripts open(H, "patchlev.h") || die "can't open patchlev.h"; while() { $change{$1} = $2 if /^\#define\s*(\S*)\s*(\S*)/; } close(H); $os = "" ; %perlstart = ("UNIX", "\#!PERL\neval 'exec perl -S \$0 \"\$\@\"'\n\tif \$running_under_some_shell;\n", "DOS", "\@rem = '-*- Perl -*-\n\@echo off\nPERL -S %0.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9\ngoto endofperl\n';\n", "WINNT", "\@rem = '-*- Perl -*-\n\@echo off\nPERL -S %0.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9\ngoto endofperl\n';\n", "OS2", "extproc PERL -x\n\#! PERL\n", "", "PSUTILS MAKEFILE CONFIGURATION ERROR") ; %perlend = ("UNIX", "", "DOS", "__END__\n:endofperl\n", "WINNT", "__END__\n:endofperl\n", "OS2", "\# End of Script", "", "PSUTILS MAKEFILE CONFIGURATION ERROR"); foreach (@ARGV) { if (/MAN=(.*)/) { # name.ext name.ext -> name(ext), name(ext) local(@man) = split(' ', $1); $change{"MAN"} = join(", ", grep(s/\.(.)/($1)/, @man)); } elsif (/OS=(.*)/) { # set operating system name $os = $1 ; } elsif (/PERL=(.*)/) { # substitute name for value local($perl) = $1 ; $change{"PERL"} = $perlstart{$os} ; $change{"END"} = $perlend{$os} ; $change{"PERL"} =~ s/PERL/$perl/g ; $change{"END"} =~ s/PERL/$perl/g ; } elsif (/(.*)=(.*)/) { # substitute name for value $change{$1} = $2; } else { # open file and substitute local(@change) = keys %change; open(FILE, $_) || die "can't open $_"; while ($line = ) { grep($line =~ s/\@$_\@/$change{$_}/g, @change); print $line; } close(FILE); } } psutils-1.17.orig/README0000644000064100006410000002553406311361121013045 0ustar ejbejbPostScript Utilities Angus Duggan 9th March 1997 This archive contains some utilities for manipulating PostScript documents. Page selection and rearrangement are supported, including arrangement into signatures for booklet printing, and page merging for n-up printing. ENVIRONMENT These utilities have been compiled and run on Sun-3 and Sun-4 machines under SunOS Solaris 2.3, Solaris 2.1, 4.1.3, 4.1.2, 4.1.1 and 4.0.1, HP9000/375 machines under HPUX 7.0 and HPUX 8.0, Sequent Symmetry machines under Dynix 3.1.4 and PTX 3.2.0, IBM RS/6000, VAX/VMS, Decstation 3100 machines under Ultrix 4.0, SGI 4k5 under Irix 4.1 and 5.2, and x86 machines under MSDOS 6.0 and Windows NT 3.5 and 4.0. FILES The files contained are: -rw-r--r-- 1 angus 2317 Jun 19 1995 LICENSE -rw-r--r-- 1 angus 2899 Mar 09 09:26 Makefile.bcc -rw-r--r-- 1 angus 2915 Mar 09 09:26 Makefile.msc -rw-r--r-- 1 angus 4135 Mar 09 09:26 Makefile.nt -rw-r--r-- 1 angus 7146 Mar 09 09:26 Makefile.os2 -rw-r--r-- 1 angus 2895 Mar 09 09:26 Makefile.sc -rw-r--r-- 1 angus 6913 Mar 09 09:26 Makefile.unix -rw-r--r-- 1 angus 11345 Mar 09 09:20 README -rw-r--r-- 1 angus 678 Nov 02 1995 config.h -rw-r--r-- 1 angus 2373 Jun 19 1995 descrip.mms -rw-r--r-- 1 angus 5773 Mar 14 1996 epsffit.c -rw-r--r-- 1 angus 1291 Nov 02 1995 epsffit.man -rw-r--r-- 1 angus 1236 Nov 02 1995 extractres.man -rw-r--r-- 1 angus 2780 Nov 02 1995 extractres.pl -rw-r--r-- 1 angus 561 Nov 02 1995 fixdlsrps.man -rw-r--r-- 1 angus 1554 Nov 02 1995 fixdlsrps.pl -rw-r--r-- 1 angus 527 Nov 02 1995 fixfmps.man -rw-r--r-- 1 angus 556 Nov 02 1995 fixfmps.pl -rw-r--r-- 1 angus 644 Nov 02 1995 fixmacps.man -rw-r--r-- 1 angus 2170 Nov 02 1995 fixmacps.pl -rw-r--r-- 1 angus 556 Nov 02 1995 fixpsditps.man -rw-r--r-- 1 angus 655 Nov 02 1995 fixpsditps.pl -rw-r--r-- 1 angus 523 Nov 02 1995 fixpspps.man -rw-r--r-- 1 angus 1298 Nov 02 1995 fixpspps.pl -rw-r--r-- 1 angus 531 Nov 02 1995 fixscribeps.man -rw-r--r-- 1 angus 434 Nov 02 1995 fixscribeps.pl -rw-r--r-- 1 angus 553 Nov 02 1995 fixtpps.man -rw-r--r-- 1 angus 663 Nov 02 1995 fixtpps.pl -rw-r--r-- 1 angus 547 Nov 02 1995 fixwfwps.man -rw-r--r-- 1 angus 826 Nov 02 1995 fixwfwps.pl -rw-r--r-- 1 angus 533 Nov 02 1995 fixwpps.man -rw-r--r-- 1 angus 699 Nov 02 1995 fixwpps.pl -rw-r--r-- 1 angus 531 Nov 02 1995 fixwwps.man -rw-r--r-- 1 angus 383 Nov 02 1995 fixwwps.pl -rw-r--r-- 1 angus 711 Apr 06 1995 getafm.man -rwxr-xr-x 1 angus 6482 Jun 19 1995 getafm.sh -rw-r--r-- 1 angus 1107 Nov 02 1995 includeres.man -rw-r--r-- 1 angus 1435 Nov 02 1995 includeres.pl -rw-r--r-- 1 angus 1901 Jan 03 1996 maketext -rw-r--r-- 1 angus 31406 Jun 19 1995 md68_0.ps -rw-r--r-- 1 angus 35734 Jun 19 1995 md71_0.ps -rw-r--r-- 1 angus 132 Nov 02 1995 patchlev.h -rw-r--r-- 1 angus 2875 Nov 02 1995 psbook.c -rw-r--r-- 1 angus 1156 Nov 02 1995 psbook.man -rw-r--r-- 1 angus 3201 Nov 02 1995 pserror.c -rw-r--r-- 1 angus 561 Nov 02 1995 pserror.h -rw-r--r-- 1 angus 957 Nov 02 1995 psmerge.man -rw-r--r-- 1 angus 2028 Nov 02 1995 psmerge.pl -rw-r--r-- 1 angus 10396 Nov 02 1995 psnup.c -rw-r--r-- 1 angus 4002 Nov 02 1995 psnup.man -rw-r--r-- 1 angus 5379 Nov 02 1995 psresize.c -rw-r--r-- 1 angus 1696 Nov 02 1995 psresize.man -rw-r--r-- 1 angus 6096 Jun 05 1996 psselect.c -rw-r--r-- 1 angus 2117 Mar 09 09:12 psselect.man -rw-r--r-- 1 angus 7784 Dec 06 1995 psspec.c -rw-r--r-- 1 angus 877 Feb 21 1996 psspec.h -rw-r--r-- 1 angus 5159 Nov 02 1995 pstops.c -rw-r--r-- 1 angus 4091 Nov 02 1995 pstops.man -rw-r--r-- 1 angus 9323 Mar 04 13:41 psutil.c -rw-r--r-- 1 angus 1494 Nov 02 1995 psutil.h -rwxr-xr-x 1 angus 2685 Jun 19 1995 showchar.sh PROGRAMS psbook rearranges pages into signatures psselect selects pages and page ranges pstops performs general page rearrangement and selection psnup put multiple pages per physical sheet of paper psresize alter document paper size epsffit fits an EPSF file to a given bounding box psselect in modeled after Chris Torek's dviselect program, and pstops is modeled after Tom Rokicki's dvidvi program. psbook is modeled on my own dvibook program, which borrows heavily from Chris Torek's dviselect. SCRIPTS getafm (sh) outputs PostScript to retrieve AFM file from printer showchar (sh) outputs PostScript to draw a character with metric info fixdlsrps (perl) filter to fix DviLaser/PS output so that PSUtils works fixfmps (perl) filter to fix framemaker documents so that psselect etc. work fixmacps (perl) filter to fix Macintosh documents with saner version of md fixpsditps (perl) filter to fix Transcript psdit documents to work with PSUtils fixpspps (perl) filter to fix PSPrint PostScript so that psselect etc. work fixscribeps (perl) filter to fix Scribe PostScript so that psselect etc. work fixtpps (perl) filter to fix Troff Tpscript documents fixwfwps (perl) filter to fix Word for Windows documents for PSUtils fixwpps (perl) filter to fix WordPerfect documents for PSUtils fixwwps (perl) filter to fix Windows Write documents for PSUtils extractres (perl) filter to extract resources from PostScript files includeres (perl) filter to include resources into PostScript files psmerge (perl) hack script to merge multiple PostScript files INSTALLATION UUdecode md71_0.uue and md68_0.uue (if supplied encoded). Copy the most appropriate makefile to "Makefile", and edit the copy to put in required paths for BINDIR, SCRIPTDIR, MANDIR, INCLUDEDIR, and PERL. Alter values of MANEXT to put the manual pages in a different section if desired, change PAPER to set the default paper size, "make", and "make install". BUGS The utilities don't check for PS-Adobe-?.? conformance; they assume documents conform. Utilities need an extra save/restore around whole document on a SPARCPrinter with NeWSPrint 1.0, because of bugs in the xnews server. Bug fixes and suggestions to angus@harlequin.co.uk UPDATES The definitive archive sites for PSUtils updates are ftp.dcs.ed.ac.uk, in the directory pub/ajcd/, and ftp.tardis.ed.ac.uk, in the directory users/ajcd. The latest version will be in psutils.tar.gz older versions may also be in psutils-*.tar.gz NOTE This is an interim release; these utilities are currently being re-written from scratch, with a full DSC-3.0 parser and more extraction, merging, and inclusion options included. WINDOWS USERS *Please* make sure that you have selected "Generate DSC Comments" in your printer driver setup. These utilities need DSC comments to tell where page boundaries are. DVIPS USERS The latest versions of dvips have changed the default setting of the DSC comment flag; you must generate with DSC comments for PSUtils to work. ACKNOWLEDGEMENTS Bug fixes and suggestions for improvements to PSUtils have come from many people, including: Brian Colfer brianc@labmed.ucsf.edu Charles A. Finnell finnell@org.mitre.lear Conrad Kimball cek@com.boeing.sdc J.W.Hawtin Jochen Schwarze schwarze@de.isa Ken Carpenter khc@edu.ksu.eece Kristian Jorg etxkrjg@se.ericsson.solsta Larry Weissman larryw@nsr.bioeng.washington.edu Michael L. Brown brown@wi.extrel.com Hunter Goatley goathunter@wkuvx1.bitnet John Interrante interran@uluru.Stanford.edu Maurizio Cremonesi MAUCREM@imiclvx.earn Matthew Stier Matthew.Stier@East.Sun.com Gerry Pratt cca13@seq1.kl.ac.uk Robert Joop rj@rainbow.in-berlin.de Johan Vromans jv@mh.nl Bryan Faubion bryanf@tc.fluke.com Chris Ritson C.R.Ritson@ncl.ac.uk Michele Marziani MARZIANI@VAXFE.INFN.IT Michael I. Schwartz mschwart@diana.cair.du.edu Chris Ritson C.R.Ritson@newcastle.ac.uk Joerg Eisenreich Anreas Borchert borchert@mathematik.uni-ulm.de Mike Coleman Dale Scheetz dwarf@polaris.net Yves Arrouye arrouye@marin.fdn.fr (Apologies to anyone who I have left out, it was not intentional.) NEWS Patchlevel 11 contains some significant enhancements to PSUtils, in preparation for the eventual release of version 2 (don't hold your breath waiting for it). These include: * Specify paper sizes by name for pstops and psnup. * Psnup re-written in C to be much more versatile (do any number n-up). * Epsffit can input broken %%BoundingBox comments which use real numbers. * Should work on MSDOS and VMS machines as well as Unix. * Accept more DSC compliant documents (Page labels are better supported). Patchlevel 12 was a bug-fix release. * Long standing fixmacps bug fixed. * fixwfwps fixes WFW EPSF files as well as DSC files. * md71_0.ps and md68_0.ps files were automatically uudecoded. Patchlevel 13 contained two new scripts for resource management, and fixes to the Makefile, page labels, and output chaining. * Epsffit can output to a file as well as standard output. * extractres takes resources out of PostScript files and saves them * includeres puts resources from a resource library into PostScript files. * maketext script is now used to do substitutions in Perl scripts and man pages * page labels in psnup and pstops now show where pages came from. * page labels in psbook and psselect fixed. * prologues fixed to be extractable and re-usable * Makefile doesn't use SUFFIXES any more * pstops and psnup output can now be chained through each other. * psresize alters the paper size used by a document * patchlevel.h shortened to patchlev.h as a concession to MSDOS * psnup now has -n nup form for compatibility with other n-up programs Patchlevel 14 has some minor bug fixes. * psselect can take end-relative page ranges * Makefiles restructured to generate machine specific versions from one source * MSDOS, Windows NT and OS/2 support * corrections to psbook output for empty pages when rearranging pstops output Patchlevel 15 was a stabilisation release * All code converted to ANSI C, improved error and warning procedures * Portability fixes in the Makefiles * psnup can take different sized input and output pages * Minor fixes to fixwpps script * psselect reversed pages fixed * maketext and fix scripts updated for Perl 5 Patchlevel 16 was a minor bugfix release * Piped output and input works correctly in NT Patchlevel 17 had some minor bugfixes and improvements * Trailer information now put before %%EOF comments if no %%Trailer * psselect can now add blank pages. * Piped input works in Linux psutils-1.17.orig/config.h0000644000064100006410000000121006311361104013565 0ustar ejbejb/* * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * OS specific configuration for PSUtils */ #if defined(MSDOS) || defined(WINNT) #define TMPDIR "\\tmp" #define OPEN_READ "rb" #define OPEN_WRITE "wb" #include #include #else /* ! MSDOS && ! WINNT */ #if defined(OS2) #define TMPDIR "." #define OPEN_READ "rb" #define OPEN_WRITE "wb" #else /* ! OS2 */ #define OPEN_READ "r" #define OPEN_WRITE "w" #ifdef VMS #define unlink delete #define TMPDIR "/tmp" #else /* assumes UNIX-like OS */ #include #define TMPDIR "/tmp" #endif /* ! VMS */ #endif /* ! OS2 */ #endif /* ! MSDOS && ! WINNT */ psutils-1.17.orig/descrip.mms0000644000064100006410000000440606311361104014330 0ustar ejbejb# # VMS MMS build file for PS utilities # # Hunter Goatley, 16-MAR-1993 14:47 # CFLAGS = /NOLIST/OBJECT=$(MMS$TARGET) LFLAGS = /NOTRACE/EXEC=$(MMS$TARGET) .IFDEF __ALPHA__ #If building with Alpha cross-compilers, OBJ OPTIONS_FILE = #... is defined already LINKOPT = CFLAGS = /NOLIST/OBJECT=$(MMS$TARGET)/STANDARD=VAXC .ELSE OBJ = .OBJ EXE = .EXE OPTIONS_FILE = ,VAXC.OPT LINKOPT = $(options_file)/OPTIONS .ENDIF # epsffit fits an epsf file to a given bounding box # psbook rearranges pages into signatures # psselect selects page ranges # pstops performs general page rearrangement and merging # psnup puts multiple logical pages on one physical page all : psbook$(exe), psselect$(exe), pstops$(exe), epsffit$(exe), psnup$(exe), psresize$(exe) @ write sys$output "PSUTILS build complete" epsffit$(exe) : epsffit$(obj), pserror$(obj) $(LINK)$(LFLAGS) epsffit$(obj),pserror$(obj)$(linkopt) psnup$(exe) : psnup$(obj), psutil$(obj), psspec$(obj), pserror$(obj) $(LINK)$(LFLAGS) psnup$(obj),psutil$(obj),psspec$(obj),pserror$(obj)$(linkopt) psresize$(exe) : psresize$(obj), psutil$(obj), psspec$(obj), pserror$(obj) $(LINK)$(LFLAGS) psresize$(obj),psutil$(obj),psspec$(obj),pserror$(obj)$(linkopt) psbook$(exe) : psbook$(obj), psutil$(obj)$(options_file), pserror$(obj) $(LINK)$(LFLAGS) psbook$(obj),psutil$(obj),pserror$(obj)$(linkopt) psselect$(exe) : psselect$(obj), psutil$(obj), pserror$(obj) $(LINK)$(LFLAGS) psselect$(obj),psutil$(obj),pserror$(obj)$(linkopt) pstops$(exe) : pstops$(obj), psutil$(obj), psspec$(obj), pserror$(obj) $(LINK)$(LFLAGS) pstops$(obj),psutil$(obj),psspec$(obj),pserror$(obj)$(linkopt) psnup$(obj) : psnup.c, psutil.h patchlev.h psspec.h pserror.h psresize$(obj) : psresize.c, psutil.h patchlev.h psspec.h pserror.h psbook$(obj) : psbook.c, psutil.h patchlev.h pserror.h pstops$(obj) : pstops.c, psutil.h patchlev.h psspec.h pserror.h psutil$(obj) : psutil.c, psutil.h patchlev.h pserror.h psselect$(obj) : psselect.c, psutil.h patchlev.h pserror.h psspec$(obj) : psspec.c, psutil.h patchlev.h psspec.h pserror.h clean : delete/log *$(obj);*,psnup$(exe);*,psresize$(exe);*,psbook$(exe);*,- psselect$(exe);*,pstops$(exe);*,epsffit$(exe);* psutils-1.17.orig/epsffit.c0000644000064100006410000001272006311361104013763 0ustar ejbejb/* epsffit.c * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * fit epsf file into constrained size * Usage: * epsffit [-c] [-r] [-a] [-s] llx lly urx ury [infile [outfile]] * -c centres the image in the bounding box given * -r rotates the image by 90 degrees anti-clockwise * -a alters the aspect ratio to fit the bounding box * -s adds a showpage at the end of the image * * Added filename spec (from Larry Weissman) 5 Feb 93 * Accepts double %%BoundingBox input, outputs proper BB, 4 Jun 93. (I don't * like this; developers should read the Big Red Book before writing code which * outputs PostScript. */ #include #include #include #include #include "pserror.h" #include "patchlev.h" #include "config.h" #define MIN(x,y) ((x) > (y) ? (y) : (x)) #define MAX(x,y) ((x) > (y) ? (x) : (y)) char *program; static void usage(void) { fprintf(stderr, "%s release %d patchlevel %d\n", program, RELEASE, PATCHLEVEL); fprintf(stderr, "Copyright (C) Angus J. C. Duggan, 1991-1995. See file LICENSE for details.\n"); fprintf(stderr, "Usage: %s [-c] [-r] [-a] [-s] llx lly urx ury [infile [outfile]]\n", program); exit(1); } void main(int argc, char **argv) { int bbfound = 0; /* %%BoundingBox: found */ int urx, ury, llx, lly; int furx, fury, fllx, flly; int showpage = 0, centre = 0, rotate = 0, aspect = 0, maximise = 0; char buf[BUFSIZ]; FILE *input; FILE *output; program = *argv++; argc--; while (argc > 0 && argv[0][0] == '-') { switch (argv[0][1]) { case 'c': centre = 1; break; case 's': showpage = 1; break; case 'r': rotate = 1; break; case 'a': aspect = 1; break; case 'm': maximise = 1; break; case 'v': default: usage(); } argc--; argv++; } if (argc < 4 || argc > 6) usage(); fllx = atoi(argv[0]); flly = atoi(argv[1]); furx = atoi(argv[2]); fury = atoi(argv[3]); if (argc > 4) { if(!(input = fopen(argv[4], OPEN_READ))) message(FATAL, "can't open input file %s\n", argv[4]); } else { #if defined(MSDOS) || defined(WINNT) int fd = fileno(stdin) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't reset stdin to binary mode\n"); #endif input = stdin ; } if (argc > 5) { if(!(output = fopen(argv[5], OPEN_WRITE))) message(FATAL, "can't open output file %s\n", argv[5]); } else { #if defined(MSDOS) || defined(WINNT) int fd = fileno(stdout) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't reset stdout to binary mode\n"); #endif output = stdout ; } while (fgets(buf, BUFSIZ, input)) { if (buf[0] == '%' && (buf[1] == '%' || buf[1] == '!')) { /* still in comment section */ if (!strncmp(buf, "%%BoundingBox:", 14)) { double illx, illy, iurx, iury; /* input bbox parameters */ if (sscanf(buf, "%%%%BoundingBox:%lf %lf %lf %lf\n", &illx, &illy, &iurx, &iury) == 4) { bbfound = 1; llx = (int)illx; /* accept doubles, but convert to int */ lly = (int)illy; urx = (int)(iurx+0.5); ury = (int)(iury+0.5); } } else if (!strncmp(buf, "%%EndComments", 13)) { strcpy(buf, "\n"); /* don't repeat %%EndComments */ break; } else fputs(buf, output); } else break; } if (bbfound) { /* put BB, followed by scale&translate */ int fwidth, fheight; double xscale, yscale; double xoffset = fllx, yoffset = flly; double width = urx-llx, height = ury-lly; if (maximise) if ((width > height && fury-flly > furx-fllx) || (width < height && fury-flly < furx-fllx)) rotate = 1; if (rotate) { fwidth = fury - flly; fheight = furx - fllx; } else { fwidth = furx - fllx; fheight = fury - flly; } xscale = fwidth/width; yscale = fheight/height; if (!aspect) { /* preserve aspect ratio ? */ xscale = yscale = MIN(xscale,yscale); } width *= xscale; /* actual width and height after scaling */ height *= yscale; if (centre) { if (rotate) { xoffset += (fheight - height)/2; yoffset += (fwidth - width)/2; } else { xoffset += (fwidth - width)/2; yoffset += (fheight - height)/2; } } fprintf(output, "%%%%BoundingBox: %d %d %d %d\n", (int)xoffset, (int)yoffset, (int)(xoffset+(rotate ? height : width)), (int)(yoffset+(rotate ? width : height))); if (rotate) { /* compensate for original image shift */ xoffset += height + lly * yscale; /* displacement for rotation */ yoffset -= llx * xscale; } else { xoffset -= llx * xscale; yoffset -= lly * yscale; } fputs("%%EndComments\n", output); if (showpage) fputs("save /showpage{}def /copypage{}def /erasepage{}def\n", output); else fputs("%%BeginProcSet: epsffit 1 0\n", output); fputs("gsave\n", output); fprintf(output, "%.3f %.3f translate\n", xoffset, yoffset); if (rotate) fputs("90 rotate\n", output); fprintf(output, "%.3f %.3f scale\n", xscale, yscale); if (!showpage) fputs("%%EndProcSet\n", output); } do { fputs(buf, output); } while (fgets(buf, BUFSIZ, input)); if (bbfound) { fputs("grestore\n", output); if (showpage) fputs("restore showpage\n", output); /* just in case */ } else message(FATAL, "no %%%%BoundingBox:\n"); exit(0); } psutils-1.17.orig/epsffit.man0000644000064100006410000000233006311361104014310 0ustar ejbejb.TH EPSFFIT 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME epsffit \- fit encapsulated PostScript file (EPSF) into constrained size .SH SYNOPSIS .B epsffit [ .B \-c ] [ .B \-r ] [ .B \-a ] [ .B \-m ] [ .B \-s ] .I "llx lly urx ury" [ .B infile [ .B outfile ] ] .SH DESCRIPTION .I Epsffit fits an EPSF file (encapsulated PostScript) to a given bounding box. The coordinates of the box are given by \fB(llx,lly)\fR for the lower left, and \fB(urx,ury)\fR for the upper right, in PostScript units (points). .PP If no input or output files are specified, .I epsffit read from the standard input and writes to the standard output. .SH OPTIONS .IP \fB\-c\fP 1i Center the image in the given bounding box. .IP \fB\-r\fP 1i Rotate the image by 90 degrees counter-clockwise. .IP \fB\-a\fP 1i Adjust the aspect ratio to fit the bounding box. The default is to preserve the aspect ratio. .IP \fB\-m\fP 1i Rotates the image to maximise the size if it would fit the specified bounding box better. .IP \fB\-s\fP 1i Add a \fIshowpage\fP at the end of the file to force the image to print. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. psutils-1.17.orig/extractres.man0000644000064100006410000000224506311361105015042 0ustar ejbejb.TH EXTRACTRES 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME extractres \- filter to extract resources from a PostScript document .SH SYNOPSIS .B extractres [ .B \-m ] < .I document.ps > .I output.ps .SH DESCRIPTION .I Extractres extracts resources (fonts, procsets, patterns, files, etc) appearing in a PostScript document, and puts appropriate .I %%IncludeResource comments in the document prologue. The extracted resources are written to files with the same name as the resource, and an appropriate extension. The pipeline .sp .ce extractres file.ps | includeres >out.ps .sp will move all resources appearing in a document to the document prologue, removing redundant copies. The output file can then be put through page re-arrangement filters such as .I psnup or .I pstops safely. .PP The .B \-m option combines the resources of the same name into one file; this must be used for some programs which download fonts a bit at a time. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. .SH BUGS .I extractres does not alter the .I %%DocumentSuppliedResources comments. psutils-1.17.orig/extractres.pl0000644000064100006410000000517406311361105014706 0ustar ejbejb@PERL@ # extractres: extract resources from PostScript file # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. $prog = ($0 =~ s=.*/==); %resources = (); # list of resources included %merge = (); # list of resources extracted this time %extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns "pattern", ".pat", "form", ".frm", "encoding", ".enc"); %type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", "%%BeginFont:", "font"); # resource types while (@ARGV) { $_ = shift; if (/^-m(erge)?$/) { $merge = 1; } elsif (/^-/) { print STDERR "Usage: $prog [-merge] [file]\n"; exit 1; } else { unshift(@ARGV, $_); last; } } if (defined($ENV{TMPDIR})) { # set body file name $body = "$ENV{TMPDIR}/body$$.ps"; } else { $body = "body$$.ps"; } open(BODY, $body) && die "Temporary file $body already exists"; open(BODY, ">$body") || die "Can't write file $body"; sub filename { # make filename for resource in @_ local($name); foreach (@_) { # sanitise name s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; $name .= $_; } $name =~ s@.*/@@; # drop directories die "Filename not found for resource ", join(" ", @_), "\n" if $name =~ /^$/; $name; } $output = STDOUT; # start writing header out while (<>) { if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) { local($comment, @res) = split(/\s+/); # look at resource type local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); local($name) = &filename(@res, $extn{$type}); # make file name $saveout = $output; if (!$resources{$name}) { print "%%IncludeResource: $type ", join(" ", @res), "\n"; if (!open(RES, $name)) { open(RES, ">$name") || die "Can't write file $name"; $resources{$name} = $name; $merge{$name} = $merge; $output = RES; } else { # resource already exists close(RES); undef $output; } } elsif ($merge{$name}) { open(RES, ">>$name") || die "Can't append to file $name"; $output = RES; } else { # resource already included undef $output; } } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) { if (defined $output) { print $output $_; close($output); } $output = $saveout; next; } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) { $output = BODY; } print $output $_ if defined $output; } close(BODY); # close body output file open(BODY, $body); # reopen body for input while () { # print it all print $_; } close(BODY); unlink($body); # dispose of body file @END@ psutils-1.17.orig/fixdlsrps.man0000644000064100006410000000103106311361105014664 0ustar ejbejb.TH FIXDLSRPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME fixdlsrps \- filter to fix DviLaser/PS documents to work with PSUtils .SH SYNOPSIS .B fixdlsrps < .I dvilaser.ps > .I Fixed.ps .SH DESCRIPTION .I Fixdlsrps is a .I perl filter which "fixes" PostScript generated from the DviLaser/PS driver so that it works correctly with Angus Duggan's .B psutils package. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. psutils-1.17.orig/fixdlsrps.pl0000644000064100006410000000273406311361105014537 0ustar ejbejb@PERL@ # fixdlsrps: fix DviLaser/PS document to work with PSUtils # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. $nesting = 0; $page = 1; $infont = 0; @fonts = (); @body = (); $header = 1; while (<>) { if (/^XP/) { $infont++; push(@fonts, $_); $infont-- if /PXL.*RP/ || /DN?F.*RP/; } elsif ($infont) { push(@fonts, $_); $infont-- if /PXL.*RP/ || /DN?F.*RP/; } elsif ((/^%%EndSetup/ || /^%%Page:/) && $header) { print @body; @body = ("%%EndSetup\n"); $header = 0; } elsif (/^%%EndProlog/ && !$nesting) { push(@body, "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef/XP{}def/RP{}def", "/DoInitialScaling{72.0 Resolution div dup scale}bdef end\n", $_); } elsif (/^%%BeginPageSetup/ && !$nesting) { push(@body, "%%Page: $page $page\n", $_, "Resolution 72 div dup scale Magnification 1000 div dup scale\n", "/DocumentInitState where {\n", "/DocumentInitState [ matrix currentmatrix currentlinewidth", " currentlinecap currentlinejoin currentdash currentgray", " currentmiterlimit] cvx put}if\n"); $page++; } elsif (/^%%BeginDocument:/ || /^%%BeginBinary:/ || /^%%BeginFile:/) { push(@body, $_); $nesting++; } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { push(@body, $_); $nesting--; } elsif (!/^%%PageBoundingBox:/ && !/^%%Page:/) { push(@body, $_); } } print @fonts; print @body; exit 0; @END@ psutils-1.17.orig/fixfmps.man0000644000064100006410000000076706311361105014341 0ustar ejbejb.TH FIXFMPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME fixfmps \- filter to fix Framemaker documents so PSUtils work .SH SYNOPSIS .B fixfmps < .I Framemaker.ps > .I Fixed.ps .SH DESCRIPTION .I Fixfmps is a .I perl filter which "fixes" PostScript from Framemaker so that it works correctly with Angus Duggan's .B psutils package. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. psutils-1.17.orig/fixfmps.pl0000644000064100006410000000102706311361106014170 0ustar ejbejb@PERL@ # fixfmps: get conforming PostScript out of FrameMaker version 2 file # move all FMDEFINEFONTs to start of pages # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. %fonts=(); while (<>) { if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) { $fonts{$1} = $_; } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) { print $_, join('',values(%fonts)); } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) { print "$1pop$2\n"; } else { print $_; } } @END@ psutils-1.17.orig/fixpsditps.man0000644000064100006410000000102406311361106015046 0ustar ejbejb.TH FIXPSDITPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME fixpsditps \- filter to fix Transcript psdit documents so PSUtils work .SH SYNOPSIS .B fixpsditps < .I psdit.ps > .I Fixed.ps .SH DESCRIPTION .I Fixpsditps is a .I perl filter which "fixes" PostScript from Transcript's psdit program so that it works correctly with Angus Duggan's .B psutils package. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. psutils-1.17.orig/fixpsditps.pl0000644000064100006410000000116606311361106014715 0ustar ejbejb@PERL@ # fixpsditps: fix psdit output for use in psutils # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. $nesting = 0; while (<>) { if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) { print "/p{pop showpage pagesave restore}def\n"; } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/ ) { print $_; $nesting++; } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { print $_; $nesting--; } elsif (/^%%Page:/ && $nesting == 0) { print $_; print "xi\n"; } elsif (! /^xi$/) { print $_; } } @END@ psutils-1.17.orig/fixpspps.man0000644000064100006410000000076306311361107014537 0ustar ejbejb.TH FIXPSPPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME fixpspps \- filter to fix PSPrint PostScript so PSUtils work .SH SYNOPSIS .B fixpspps < .I PSPrint.ps > .I Fixed.ps .SH DESCRIPTION .I Fixpspps is a .I perl filter which "fixes" PostScript from PSPrint so that it works correctly with Angus Duggan's .B psutils package. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. psutils-1.17.orig/fixpspps.pl0000644000064100006410000000233006311361107014367 0ustar ejbejb@PERL@ # mangle PostScript produced by PSPrint to make it almost conforming # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. $header = 1; $ignore = 0; $verbose = 0; @body = (); %fonts = (); $font = ""; $inchar = 0; @char = (); while (<>) { if (/^\@end$/) { $ignore = 1; } elsif (/^[0-9]+ \@bop0$/) { $ignore = 0; $header = 1; } elsif ($header) { if (/^\/([a-z.0-9]+) \@newfont$/) { if (! defined($fonts{$1})) { $fonts{$1} = 1; print; } elsif ($verbose) { print STDERR "$font already defined\n"; } } elsif (/^([a-z.0-9]+) sf$/) { $font = $1; print; } elsif (/^\[ .I Fixed.ps .SH DESCRIPTION .I Fixscribeps is a .I perl filter which "fixes" PostScript from Scribe so that it works correctly with Angus Duggan's .B psutils package. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. psutils-1.17.orig/fixscribeps.pl0000644000064100006410000000063706311361107015044 0ustar ejbejb@PERL@ # fixscribeps: get conforming PostScript out of Scribe # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. $inepsf = 0; $epsfn = 0; while (<>) { if (/^([0-9]+ [0-9]+ [0-9]+ PB) (%!.*)/) { print "$1\n%%BeginDocument: Scribe-EPSF $epsfn 0\n$2\n"; $inepsf++; } elsif (/^ PE/ && $inepsf) { print "%%EndDocument\n", $_; } else { print $_; } } @END@ psutils-1.17.orig/fixtpps.man0000644000064100006410000000102106311361107014344 0ustar ejbejb.TH FIXTPPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME fixtpps \- filter to fix Tpscript documents to work with PSUtils .SH SYNOPSIS .B fixtpps < .I Tpscript.ps > .I Fixed.ps .SH DESCRIPTION .I Fixtpps is a .I perl filter which "fixes" PostScript generated from the Troff Tpscript driver so that it works correctly with Angus Duggan's .B psutils package. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. psutils-1.17.orig/fixtpps.pl0000644000064100006410000000117306311361110014206 0ustar ejbejb@PERL@ # fixtpps: fix tpscript document to work with PSUtils # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. $nesting = 0; $header = 1; while (<>) { if (/^%%Page:/ && $nesting == 0) { print $_; print "save home\n"; $header = 0; } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { print $_; $nesting++; } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { print $_; $nesting--; } elsif (/save home/) { s/save home//; print $_; } elsif (!$header || (! /^save$/ && ! /^home$/)) { print $_; } } @END@ psutils-1.17.orig/fixwfwps.man0000644000064100006410000000101306311361110014517 0ustar ejbejb.TH FIXWFWPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME fixwfwps \- filter to fix Word for Windows documents so PSUtils work .SH SYNOPSIS .B fixwfwps < .I WordforWindows.ps > .I Fixed.ps .SH DESCRIPTION .I Fixwfwps is a .I perl filter which "fixes" PostScript from Word for Windows so that it works correctly with Angus Duggan's .B psutils package. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. psutils-1.17.orig/fixwfwps.pl0000644000064100006410000000143106311361110014363 0ustar ejbejb@PERL@ # fixwfwps: fix Word for windows PostScript for printing. # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. $nesting = 0; while (<>) { tr/\000-\010\012-\014\016-\037//d; foreach (grep($_ ne "", split("\015"))) { s!/SVDoc\s+save\s+def!!g; s!SVDoc\s+restore!!g; if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) { print "$1\n"; $wfwepsf = 1; } elsif (/^SS\s*$/ && $wfwepsf) { print "%%Page: $wfwepsf $wfwepsf\n"; $wfwepsf++; print "$_\n"; } elsif (/^%MSEPS Preamble/) { print "%%BeginDocument: (Included EPSF)\n"; print "$_\n"; $nesting++; } elsif (/^%MSEPS Trailer/) { $nesting--; print "$_\n"; print "%%EndDocument\n"; } elsif (! /^%%BoundingBox/) { print "$_\n"; } } } @END@ psutils-1.17.orig/fixwpps.man0000644000064100006410000000077506311361110014360 0ustar ejbejb.TH FIXWPPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME fixwpps \- filter to fix WP documents so PSUtils work .SH SYNOPSIS .B fixwpps < .I WordPerfect.ps > .I Fixed.ps .SH DESCRIPTION .I Fixwpps is a .I perl filter which "fixes" PostScript from WordPerfect 5.0 and 5.1 so that it works correctly with Angus Duggan's .B psutils package. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. psutils-1.17.orig/fixwpps.pl0000644000064100006410000000123406311361110014207 0ustar ejbejb@PERL@ # fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. $page = 1; $nesting = 0; while (<>) { s/([^\/]_t)([0-9]+)/\1 \2/g; # fix wp 5.0 bug if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) { print $_; } elsif (/^(.*)(_bp.*)$/) { print "$1\n" if $1 ne ""; print "%%Page: $page $page\n"; print "$2\n"; $page++; $nesting++; } elsif (/_ep$/) { print $_; $nesting--; } elsif (/^(.*)(_ed.*)/) { print "$1\n" if $1 ne ""; print "%%Trailer:\n"; print "$2\n"; } else { print $_; } } @END@ psutils-1.17.orig/fixwwps.man0000644000064100006410000000077306311361111014366 0ustar ejbejb.TH FIXWWPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME fixwwps \- filter to fix Windows Write documents so PSUtils work .SH SYNOPSIS .B fixwwps < .I WinWrite.ps > .I Fixed.ps .SH DESCRIPTION .I Fixwwps is a .I perl filter which "fixes" PostScript from Windows Write so that it works correctly with Angus Duggan's .B psutils package. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. psutils-1.17.orig/fixwwps.pl0000644000064100006410000000055306311361111014222 0ustar ejbejb@PERL@ # fixwwps: get semi-conforming PostScript out of Windows Write file # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. $page = 1; while (<>) { if (/^(%!.*) EPSF-\d.\d/) { print $1, "\n"; } elsif (/^SS/) { print "%%Page: $page $page\n"; print $_; $page++; } else { print $_; } } @END@ psutils-1.17.orig/getafm.sh0000644000064100006410000001375406311361111013764 0ustar ejbejb#!/bin/sh if [ $# -ne 1 ]; then echo "usage: $0 font-name | gsnd - >font-name.afm" >&2 exit 1 fi cat << EOF %! % produce .afm for $1 % (c) 1993 by Robert Joop % inspired by two other versions of this theme which are % getafm 1.00 (c) AJCD % and getafm.ps by an unknown author, % modified by J. Daniel Smith % Metrics dictionary code added by AJCD, 7/6/93 /getafmdict 100 dict dup begin /buf 256 string def /buf2 16 string def /prany % dict dictname printname -> dict { 2 index 2 index cvn known { print % printname ( ) print 1 index exch cvn get = } { (Comment /FontInfo contains no /) print 2 copy eq { = % printname pop % dictname } { exch print % dictname (, therefore no ) print = % printname } ifelse } ifelse } bind def /printfontname { (FontName)dup prany } bind def /printfontinfo { dup /FontInfo known { dup /FontInfo get (FullName)dup prany (FamilyName)dup prany (Weight)dup prany (ItalicAngle)dup prany (isFixedPitch)(IsFixedPitch) prany (UnderlinePosition)dup prany (UnderlineThickness)dup prany (Version)(version) prany (Notice)dup prany pop } { (Comment Font lacks a /FontInfo!)= } ifelse } bind def /prbbox % llx lly urx ury -> - { 4 1 roll 3 1 roll exch % swap top 4 elements 4 { ( ) print buf cvs print } repeat } bind def /getbbox % fontdict chardict character -> fontdict chardict llx lly urx ury { gsave 2 index setfont 0 0 moveto false charpath flattenpath pathbbox grestore } bind def /printmiscinfo { dup /FontBBox known { (FontBBox) print dup /FontBBox get aload pop prbbox ()= } { (Comment missing required /FontBBox)= quit } ifelse 2 copy exch get dup /H known 1 index /x known and 1 index /d known and 1 index /p known and dup /looksRoman exch def { (CapHeight ) print (H) getbbox ceiling cvi = pop pop pop (XHeight ) print (x) getbbox ceiling cvi = pop pop pop (Ascender ) print (d) getbbox ceiling cvi = pop pop pop (Descender ) print (p) getbbox pop pop floor cvi = pop } { (Comment font doesn't contain H, x, d and p; therefore no CapHeight, XHeight, Ascender and Descender)= } ifelse pop dup /Encoding get [ [ (ISOLatin1Encoding) /ISOLatin1Encoding ] [ (AdobeStandardEncoding) /StandardEncoding ] ] { aload pop dup where { exch get 2 index eq { (EncodingScheme ) print buf cvs = } { pop } ifelse } { pop pop } ifelse } forall pop } bind def /printcharmetric { % chardictname fontdict charnamedict encoding charindex charname 4 index dup length dict dup begin exch { 1 index /FID ne 2 index /UniqueID ne and { 1 index /Encoding eq { 256 array copy } if def } { pop pop } ifelse } forall end dup /Encoding get 32 3 index put /f2 exch definefont setfont (C ) print 1 index buf cvs print ( ; WX ) print % Metrics entries are: % 1 number: which is the character width % an array of 2 numbers: which are the left sidebearing and width % an array of 4 numbers: x & y left sidebearing, width and height dup 5 index % /charname fontdict dup /Metrics known { /Metrics get exch 2 copy known { get dup type /arraytype eq { dup length 2 eq {1 get} {2 get} ifelse } if round cvi buf cvs print } { pop pop ( ) stringwidth pop round cvi buf cvs print } ifelse } { pop pop ( ) stringwidth pop round cvi buf cvs print } ifelse ( ; N ) print dup buf cvs print ( ; B) print gsave newpath 0 0 moveto ( ) true charpath flattenpath pathbbox grestore 2 { ceiling cvi 4 1 roll } repeat 2 { floor cvi 4 1 roll } repeat prbbox looksRoman { [ [ /f [ /i /f /l ] ] [ /ff [ /i /l ] ] ] { aload pop 1 index 3 index eq { { 1 index buf cvs length 1 index buf2 cvs dup length 2 index add buf 4 2 roll putinterval buf 0 3 -1 roll getinterval dup cvn 7 index exch known { exch ( ; L ) print buf2 cvs print ( ) print print } { pop pop } ifelse } forall pop } { pop pop } ifelse } forall } if pop ( ;)= } bind def /printcharmetrics { (StartCharMetrics ) print 2 copy exch get length 1 sub buf cvs = 256 dict dup begin 1 index /Encoding get { null def } forall end % chardictname fontdict charnamedict 1 index /Encoding get 0 1 255 { % encoding index 2 copy get dup /.notdef eq { pop } { printcharmetric } ifelse pop % index } for -1 3 index 5 index get { pop dup /.notdef eq { pop } { % chardictname fontdict charnamedict encoding charindex charname dup 4 index exch known { pop } { printcharmetric } ifelse } ifelse } forall % charnamedict encoding index pop pop pop (EndCharMetrics)= } bind def /printfontmetrics { (StartFontMetrics 3.0)= (Comment Produced by getafm 3.0 (which is by rj@rainbow.in-berlin.de))= printfontname printfontinfo printmiscinfo printcharmetrics (EndFontMetrics)= } bind def end def /getafm { getafmdict begin save exch findfont 1000 scalefont null [ /CharDefs /CharData /CharProcs /CharStrings ] { 2 index 1 index known { exch } if pop } forall dup null eq { (can't find dictionary with character data!)= quit } if exch % dictname fontdict printfontmetrics pop pop restore end } bind def /$1 getafm EOF psutils-1.17.orig/getafm.man0000644000064100006410000000130706311361111014114 0ustar ejbejb.TH GETAFM 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME getafm \- create an AFM file for a PostScript font. .SH SYNOPSIS .B getafm .I FontName > .I output.ps .SH DESCRIPTION .I Getafm generates a PostScript file which prints an AFM file for a font to the printer's output channel. The output of .I getafm should be sent to a printer, or to GhostScript. For example, .sp .ce getafm Times-Roman | gsnd - >Times-Roman.afm .sp .SH AUTHOR Robert Joop (rj@rainbow.in-berlin.de), Angus Duggan .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. .SH BUGS Kerning information is not generated by .I getafm; it is best to use original AFM files if possible. psutils-1.17.orig/includeres.man0000644000064100006410000000205106311361111015003 0ustar ejbejb.TH INCLUDERES 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME includeres \- filter to include resources in a PostScript document .SH SYNOPSIS .B includeres < .I document.ps > .I output.ps .SH DESCRIPTION .I Includeres includes resources (fonts, procsets, patterns, files, etc) in place of .I %%IncludeResource comments in a PostScript document. The resources are searched for in the current directory and the system default directory under the resource name, and with an appropriate extension. The pipeline .sp .ce extractres file.ps | includeres >out.ps .sp will move all resources appearing in a document to the document prologue, removing redundant copies. The output file can then be put through page re-arrangement filters such as .I psnup or .I pstops safely. .SH FILES @INCLUDE@ - system resource directory. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. .SH BUGS .I includeres does not alter the .I %%DocumentNeededResources comments. psutils-1.17.orig/includeres.pl0000644000064100006410000000255506311361112014655 0ustar ejbejb@PERL@ # includeres: include resources in PostScript file # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. $prog = ($0 =~ s=.*/==); %extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns "pattern", ".pat", "form", ".frm", "encoding", ".enc"); %type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset", "%%BeginFont:", "font"); # resource types sub filename { # make filename for resource in @_ local($name); foreach (@_) { # sanitise name s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g; $name .= $_; } $name =~ s@.*/@@; # drop directories die "Filename not found for resource ", join(" ", @_), "\n" if $name =~ /^$/; $name; } while (<>) { if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) { local($comment, @res) = split(/\s+/); local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res); local($name) = &filename(@res); local($inc) = "@INCLUDE@"; # system include directory if (open(RES, $name) || open(RES, "$name$extn{$type}") || open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) { while () { print $_; } close(RES); } else { print "%%IncludeResource: ", join(" ", $type, @res), "\n"; print STDERR "Resource $name not found\n"; } } else { print $_; } } @END@ psutils-1.17.orig/psmerge.man0000644000064100006410000000163106311361116014320 0ustar ejbejb.TH PSMERGE 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME psmerge \- filter to merge several PostScript files into one .SH SYNOPSIS .B psmerge [ .B \-o\fIout.ps\fB ] [ .I file.ps ... ] .SH DESCRIPTION .I Psmerge merges PostScript documents into a single document. It only works in the specific case the the files were created using the same application, with the same device setup and resources (fonts, procsets, patterns, files, etc) loaded. If the .B \-o option is used, output will be sent to the file named, otherwise it will go to standard output. .I Psmerge will merge multiple files concatenated into a single file as if they were in separate files. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. .SH BUGS .I psmerge is for a very specific case; it does not merge files in the general case. psutils-1.17.orig/psmerge.pl0000644000064100006410000000362706311361116014167 0ustar ejbejb@PERL@ # psmerge: merge PostScript files produced by same application and setup # usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ... # # Copyright (C) Angus J. C. Duggan 1991-1995 # See file LICENSE for details. $prog = ($0 =~ s=.*/==); while ($ARGV[0] =~ /^-/) { $_ = shift; if (/^-o(.+)/) { if (!close(STDOUT) || !open(STDOUT, ">$1")) { print STDERR "$prog: can't open $1 for output\n"; exit 1; } } elsif (/^-t(horough)?$/) { $thorough = 1; } else { print STDERR "Usage: $prog [-oout] [-thorough] file...\n"; exit 1; } } $page = 0; $first = 1; $nesting = 0; @header = (); $header = 1; @trailer = (); $trailer = 0; @pages = (); @body = (); @resources = (); $inresource = 0; while (<>) { if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) { $inresource = 1; push(@resources, $_); } elsif ($inresource) { push(@resources, $_); $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/; } elsif (/^%%Page:/ && $nesting == 0) { $header = $trailer = 0; push(@pages, join("", @body)) if @body; $page++; @body = ("%%Page: ($page) $page\n"); } elsif (/^%%Trailer/ && $nesting == 0) { push(@trailer, $_); push(@pages, join("", @body)) if @body; @body = (); $trailer = 1; $header = 0; } elsif ($header) { push(@trailer, $_); push(@pages, join("", @body)) if @body; @body = (); $trailer = 1; $header = 0; } elsif ($trailer) { if (/^%!/ || /%%EOF/) { $trailer = $first = 0; } elsif ($first) { push(@trailer, $_); } } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) { push(@body, $_); $nesting++; } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) { push(@body, $_); $nesting--; } else { print $_ if $print; } } print @trailer; exit 0; @END@ psutils-1.17.orig/patchlev.h0000644000064100006410000000017606311361115014142 0ustar ejbejb/* * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. */ #define RELEASE 1 #define PATCHLEVEL 17 psutils-1.17.orig/psbook.c0000644000064100006410000000531406311361115013623 0ustar ejbejb/* psbook.c * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * rearrange pages in conforming PS file for printing in signatures * * Usage: * psbook [-q] [-s] [infile [outfile]] */ #include "psutil.h" #include "pserror.h" #include "patchlev.h" char *program ; int pages ; int verbose ; FILE *infile ; FILE *outfile ; char pagelabel[BUFSIZ] ; int pageno ; static void usage(void) { fprintf(stderr, "%s release %d patchlevel %d\n", program, RELEASE, PATCHLEVEL); fprintf(stderr, "Copyright (C) Angus J. C. Duggan, 1991-1995. See file LICENSE for details.\n"); fprintf(stderr, "Usage: %s [-q] [-s] [infile [outfile]]\n", program); fprintf(stderr, " must be positive and divisible by 4\n"); fflush(stderr); exit(1); } void main(int argc, char *argv[]) { int signature = 0; int currentpg, maxpage; infile = stdin; outfile = stdout; verbose = 1; for (program = *argv++; --argc; argv++) { if (argv[0][0] == '-') { switch (argv[0][1]) { case 's': /* signature size */ signature = atoi(*argv+2); if (signature < 1 || signature % 4) usage(); break; case 'q': /* quiet */ verbose = 0; break; case 'v': /* version */ default: usage(); } } else if (infile == stdin) { if ((infile = fopen(*argv, OPEN_READ)) == NULL) message(FATAL, "can't open input file %s\n", *argv); } else if (outfile == stdout) { if ((outfile = fopen(*argv, OPEN_WRITE)) == NULL) message(FATAL, "can't open output file %s\n", *argv); } else usage(); } #if defined(MSDOS) || defined(WINNT) if ( infile == stdin ) { int fd = fileno(stdin) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't open input file %s\n", argv[4]); } if ( outfile == stdout ) { int fd = fileno(stdout) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't reset stdout to binary mode\n"); } #endif if ((infile=seekable(infile))==NULL) message(FATAL, "can't seek input\n"); scanpages(); if (!signature) signature = maxpage = pages+(4-pages%4)%4; else maxpage = pages+(signature-pages%signature)%signature; /* rearrange pages */ writeheader(maxpage); writeprolog(); writesetup(); for (currentpg = 0; currentpg < maxpage; currentpg++) { int actualpg = currentpg - currentpg%signature; switch(currentpg%4) { case 0: case 3: actualpg += signature-1-(currentpg%signature)/2; break; case 1: case 2: actualpg += (currentpg%signature)/2; break; } if (actualpg < pages) writepage(actualpg); else writeemptypage(); } writetrailer(); exit(0); } psutils-1.17.orig/psbook.man0000644000064100006410000000213206311361115014147 0ustar ejbejb.TH PSBOOK 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME psbook \- rearrange pages in PostScript file into signatures .SH SYNOPSIS .B psbook [ .B \-q ] [ .B \-s\fIsignature\fR ] [ .I infile [ .I outfile ] ] .SH DESCRIPTION .I Psbook rearranges pages from a PostScript document into ``signatures'' for printing books or booklets, creating a new PostScript file. The input PostScript file should follow the Adobe Document Structuring Conventions. .PP The .I \-s option selects the size of signature which will be used. The signature size is the number of sides which will be folded and bound together; the number given should be a multiple of four. The default is to use one signature for the whole file. Extra blank sides will be added if the file does not contain a multiple of four pages. .PP Psbook normally prints the page numbers of the pages rearranged; the .I \-q option suppresses this. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. .SH BUGS .I Psbook does not accept all DSC comments. psutils-1.17.orig/pserror.c0000644000064100006410000000600706311361115014022 0ustar ejbejb/* pserror.c * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * Warnings and errors for PS programs */ extern char *program ; /* Defined by main program, giving program name */ #include "psutil.h" #include "pserror.h" #include "patchlev.h" #include /* Message functions; there is a single are varargs functions for messages, warnings, and errors sent to stderr. If called with the flags MESSAGE_EXIT set, the routine does not return */ #define MAX_MESSAGE 256 /* maximum formatted message length */ #define MAX_FORMAT 16 /* maximum format length */ #define MAX_COLUMN 78 /* maximum column to print upto */ void message(int flags, char *format, ...) { va_list args ; static column = 0 ; /* current screen column for message wrap */ char msgbuf[MAX_MESSAGE] ; /* buffer in which to put the message */ char *bufptr = msgbuf ; /* message buffer pointer */ if ( (flags & MESSAGE_NL) && column != 0 ) { /* new line if not already */ putc('\n', stderr) ; column = 0 ; } if ( flags & MESSAGE_PROGRAM ) { strcpy(bufptr, program) ; bufptr += strlen(program) ; *bufptr++ = ':' ; *bufptr++ = ' ' ; } va_start(args, format) ; if ( format != NULL ) { char c ; while ( (c = *format++) != '\0' ) { if (c == '%') { int done, longform, index ; char fmtbuf[MAX_FORMAT] ; longform = index = 0 ; fmtbuf[index++] = c ; do { done = 1 ; fmtbuf[index++] = c = *format++ ; fmtbuf[index] = '\0' ; switch (c) { case '%': *bufptr++ = '%' ; case '\0': break ; case 'e': case 'E': case 'f': case 'g': case 'G': { double d = va_arg(args, double) ; sprintf(bufptr, fmtbuf, d) ; bufptr += strlen(bufptr) ; } break ; case 'c': case 'd': case 'i': case 'o': case 'p': case 'u': case 'x': case 'X': if ( longform ) { long l = va_arg(args, long) ; sprintf(bufptr, fmtbuf, l) ; } else { int i = va_arg(args, int) ; sprintf(bufptr, fmtbuf, i) ; } bufptr += strlen(bufptr) ; break ; case 's': { char *s = va_arg(args, char *) ; sprintf(bufptr, fmtbuf, s) ; bufptr += strlen(bufptr) ; } break ; case 'l': longform = 1 ; /* FALLTHRU */ default: done = 0 ; } } while ( !done ) ; } else if ( c == '\n' ) { /* write out message so far and reset column */ int len = bufptr - msgbuf ; /* length of current message */ *bufptr++ = '\n' ; *bufptr = '\0' ; if ( column + len > MAX_COLUMN && column > 0 ) { putc('\n', stderr) ; column = 0 ; } fputs(bufptr = msgbuf, stderr) ; column = 0 ; } else *bufptr++ = c ; } *bufptr = '\0' ; { int len = bufptr - msgbuf ; /* length of current message */ if ( column + len > MAX_COLUMN && column > 0 ) { putc('\n', stderr) ; column = 0 ; } fputs(msgbuf, stderr) ; column += len ; } fflush(stderr) ; } va_end(args) ; if ( flags & MESSAGE_EXIT ) /* don't return to program */ exit(1) ; } psutils-1.17.orig/pserror.h0000644000064100006410000000103506311361116014024 0ustar ejbejb/* pserror.h * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * Header file for external functions in pserror.c */ #include /* message flags */ #define MESSAGE_NL 1 /* Newline before message if necessary */ #define MESSAGE_PROGRAM 2 /* announce program name */ #define MESSAGE_EXIT 4 /* do not return */ /* message types */ #define FATAL (MESSAGE_EXIT|MESSAGE_PROGRAM|MESSAGE_NL) #define WARN (MESSAGE_NL|MESSAGE_PROGRAM) #define LOG 0 extern void message(int flags, char *format, ...) ; psutils-1.17.orig/psnup.man0000644000064100006410000000740206311361116014025 0ustar ejbejb.TH PSNUP 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME psnup \- multiple pages per sheet .SH SYNOPSIS .B psnup [ .B \-w\fIwidth\fR ] [ .B \-h\fIheight\fR ] [ .B \-p\fIpaper\fR ] [ .B \-W\fIwidth\fR ] [ .B \-H\fIheight\fR ] [ .B \-P\fIpaper\fR ] [ .B \-l ] [ .B \-r ] [ .B \-f ] [ .B \-c ] [ .B \-m\fImargin\fR ] [ .B \-b\fIborder\fR ] [ .B \-d\fIlwidth\fR ] [ .B \-s\fIscale\fR ] [ .B \-\fInup\fR ] [ .B \-q ] [ .I infile [ .I outfile ] ] .SH DESCRIPTION .I Psnup puts multiple logical pages onto each physical sheet of paper. The input PostScript file should follow the Adobe Document Structuring Conventions. .PP The .I \-w option gives the paper width, and the .I \-h option gives the paper height, normally specified in .B "cm" or .B "in" to convert PostScript's points (1/72 of an inch) to centimeters or inches. The .I \-p option can be used as an alternative, to set the paper size to .B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto or .B 10x14. The default paper size is .B @PAPER@. The .I \-W, \-H, and .I \-P options set the input paper size, if it is different from the output size. This makes it easy to impose pages of one size on a different size of paper. .PP The .I \-l option should be used for pages which are in landscape orientation (rotated 90 degrees anticlockwise). The .I \-r option should be used for pages which are in seascape orientation (rotated 90 degrees clockwise), and the .I \-f option should be used for pages which have the width and height interchanged, but are not rotated. .PP .I Psnup normally uses `row-major' layout, where adjacent pages are placed in rows across the paper. The .I \-c option changes the order to `column-major', where successive pages are placed in columns down the paper. .PP A margin to leave around the whole page can be specified with the .I \-m option. This is useful for sheets of `thumbnail' pages, because the normal page margins are reduced by putting multiple pages on a single sheet. .PP The .I \-b option is used to specify an additional margin around each page on a sheet. .PP The .I \-d option draws a line around the border of each page, of the specified width. If the \fIlwidth\fR parameter is omitted, a default linewidth of 1 point is assumed. The linewidth is relative to the original page dimensions, \fIi.e.\fR it is scaled down with the rest of the page. .PP The scale chosen by .I psnup can be overridden with the .I \-s option. This is useful to merge pages which are already reduced. .PP The .I \-\fInup\fR option selects the number of logical pages to put on each sheet of paper. This can be any whole number; .I psnup tries to optimise the layout so that the minimum amount of space is wasted. If .I psnup cannot find a layout within its tolerance limit, it will abort with an error message. The alternative form .I \i \fInup\fR can also be used, for compatibility with other n-up programs. .PP .I Psnup normally prints the page numbers of the pages re-arranged; the .I \-q option suppresses this. .SH EXAMPLES The potential use of this utility is varied but one particular use is in conjunction with .I psbook(1). For example, using groff to create a PostScript document and lpr as the .SM UNIX print spooler a typical command line might look like this: .sp groff -Tps -ms \fIfile\fP | psbook | psnup -2 | lpr .sp Where file is a 4 page document this command will result in a two page document printing two pages of \fIfile\fP per page and rearranges the page order to match the input pages 4 and 1 on the first output page and pages 2 then 3 of the input document on the second output page. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. .SH BUGS .I Psnup does not accept all DSC comments. psutils-1.17.orig/psnup.c0000644000064100006410000002351406311361116013476 0ustar ejbejb/* psnup.c * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * put multiple pages onto one physical sheet of paper * * Usage: * psnup [-q] [-w] [-h] [-ppaper] [-b] [-m] * [-l] [-c] [-f] [-sscale] [-d] [-nup] [in [out]] * -w sets the paper width * -h sets the paper height * -ppaper sets the paper size (width and height) by name * -W sets the input paper width, if different from output * -H sets the input paper height, if different from output * -Ppaper sets the input paper size, if different from output * -m sets the margin around the paper * -b sets the border around each page * -sscale alters the scale at which the pages are displayed * -l used if pages are in landscape orientation (rot left) * -r used if pages are in seascape orientation (rot right) * -c for column-major layout * -f for flipped (wider than tall) pages * -d to draw the page boundaries */ #include "psutil.h" #include "psspec.h" #include "pserror.h" #include "patchlev.h" char *program ; int pages ; int verbose ; FILE *infile ; FILE *outfile ; char pagelabel[BUFSIZ] ; int pageno ; static void usage(void) { fprintf(stderr, "%s release %d patchlevel %d\n", program, RELEASE, PATCHLEVEL); fprintf(stderr, "Copyright (C) Angus J. C. Duggan, 1991-1995. See file LICENSE for details.\n"); fprintf(stderr, "Usage: %s [-q] [-wwidth] [-hheight] [-ppaper] [-Wwidth] [-Hheight] [-Ppaper] [-l] [-r] [-c] [-f] [-mmargin] [-bborder] [-dlwidth] [-sscale] [-nup] [infile [outfile]]\n", program); fflush(stderr); exit(1); } static void argerror(void) { message(FATAL, "bad dimension\n"); } #define MIN(x,y) ((x) > (y) ? (y) : (x)) #define MAX(x,y) ((x) > (y) ? (x) : (y)) /* return next larger exact divisor of number, or 0 if none. There is probably * a much more efficient method of doing this, but the numbers involved are * small, so it's not a big loss. */ static int nextdiv(int n, int m) { while (++n <= m) { if (m%n == 0) return (n); } return (0); } void main(int argc, char *argv[]) { int horiz, vert, rotate, column, flip, leftright, topbottom; int nup = 1; double draw = 0; /* draw page borders */ double scale; /* page scale */ double uscale = 0; /* user supplied scale */ double ppwid, pphgt; /* paper dimensions */ double margin, border; /* paper & page margins */ double vshift, hshift; /* page centring shifts */ double iwidth, iheight ; /* input paper size */ double tolerance = 100000; /* layout tolerance */ Paper *paper; #ifdef PAPER if ( (paper = findpaper(PAPER)) != (Paper *)0 ) { width = (double)PaperWidth(paper); height = (double)PaperHeight(paper); } #endif margin = border = vshift = hshift = column = flip = 0; leftright = topbottom = 1; iwidth = iheight = -1 ; infile = stdin; outfile = stdout; verbose = 1; for (program = *argv++; --argc; argv++) { if (argv[0][0] == '-') { switch (argv[0][1]) { case 'q': /* quiet */ verbose = 0; break; case 'd': /* draw borders */ if (argv[0][2]) draw = singledimen(*argv+2, argerror, usage); else draw = 1; break; case 'l': /* landscape (rotated left) */ column = !column; topbottom = !topbottom; break; case 'r': /* seascape (rotated right) */ column = !column; leftright = !leftright; break; case 'f': /* flipped */ flip = 1; break; case 'c': /* column major layout */ column = !column; break; case 'w': /* page width */ width = singledimen(*argv+2, argerror, usage); break; case 'W': /* input page width */ iwidth = singledimen(*argv+2, argerror, usage); break; case 'h': /* page height */ height = singledimen(*argv+2, argerror, usage); break; case 'H': /* input page height */ iheight = singledimen(*argv+2, argerror, usage); break; case 'm': /* margins around whole page */ margin = singledimen(*argv+2, argerror, usage); break; case 'b': /* border around individual pages */ border = singledimen(*argv+2, argerror, usage); break; case 't': /* layout tolerance */ tolerance = atof(*argv+2); break; case 's': /* override scale */ uscale = atof(*argv+2); break; case 'p': /* output (and by default input) paper type */ if ( (paper = findpaper(*argv+2)) != (Paper *)0 ) { width = (double)PaperWidth(paper); height = (double)PaperHeight(paper); } else message(FATAL, "paper size '%s' not recognised\n", *argv+2); break; case 'P': /* paper type */ if ( (paper = findpaper(*argv+2)) != (Paper *)0 ) { iwidth = (double)PaperWidth(paper); iheight = (double)PaperHeight(paper); } else message(FATAL, "paper size '%s' not recognised\n", *argv+2); break; case 'n': /* n-up, for compatibility with other psnups */ if (argc >= 2) { argv++; argc--; if ((nup = atoi(*argv)) < 1) message(FATAL, "-n %d too small\n", nup); } else message(FATAL, "argument expected for -n\n"); break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': nup = atoi(*argv+1); break; case 'v': /* version */ default: usage(); } } else if (infile == stdin) { if ((infile = fopen(*argv, OPEN_READ)) == NULL) message(FATAL, "can't open input file %s\n", *argv); } else if (outfile == stdout) { if ((outfile = fopen(*argv, OPEN_WRITE)) == NULL) message(FATAL, "can't open output file %s\n", *argv); } else usage(); } #if defined(MSDOS) || defined(WINNT) if ( infile == stdin ) { int fd = fileno(stdin) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't open input file %s\n", argv[4]); } if ( outfile == stdout ) { int fd = fileno(stdout) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't reset stdout to binary mode\n"); } #endif if ((infile=seekable(infile))==NULL) message(FATAL, "can't seek input\n"); if (width <= 0 || height <= 0) message(FATAL, "page width and height must be set\n"); /* subtract paper margins from height & width */ ppwid = width - margin*2; pphgt = height - margin*2; if (ppwid <= 0 || pphgt <= 0) message(FATAL, "paper margins are too large\n"); /* set default values of input height & width */ if ( iwidth > 0 ) width = iwidth ; if ( iheight > 0 ) height = iheight ; /* Finding the best layout is an optimisation problem. We try all of the * combinations of width*height in both normal and rotated form, and * minimise the wasted space. */ { double best = tolerance; int hor; for (hor = 1; hor; hor = nextdiv(hor, nup)) { int ver = nup/hor; /* try normal orientation first */ double scl = MIN(pphgt/(height*ver), ppwid/(width*hor)); double optim = (ppwid-scl*width*hor)*(ppwid-scl*width*hor) + (pphgt-scl*height*ver)*(pphgt-scl*height*ver); if (optim < best) { best = optim; /* recalculate scale to allow for internal borders */ scale = MIN((pphgt-2*border*ver)/(height*ver), (ppwid-2*border*hor)/(width*hor)); hshift = (ppwid/hor - width*scale)/2; vshift = (pphgt/ver - height*scale)/2; horiz = hor; vert = ver; rotate = flip; } /* try rotated orientation */ scl = MIN(pphgt/(width*hor), ppwid/(height*ver)); optim = (pphgt-scl*width*hor)*(pphgt-scl*width*hor) + (ppwid-scl*height*ver)*(ppwid-scl*height*ver); if (optim < best) { best = optim; /* recalculate scale to allow for internal borders */ scale = MIN((pphgt-2*border*hor)/(width*hor), (ppwid-2*border*ver)/(height*ver)); hshift = (ppwid/ver - height*scale)/2; vshift = (pphgt/hor - width*scale)/2; horiz = ver; vert = hor; rotate = !flip; } } /* fail if nothing better than worst tolerance was found */ if (best == tolerance) message(FATAL, "can't find acceptable layout for %d-up\n", nup); } if (flip) { /* swap width & height for clipping */ double tmp = width; width = height; height = tmp; } if (rotate) { /* rotate leftright and topbottom orders */ int tmp = topbottom; topbottom = !leftright; leftright = tmp; column = !column; } /* now construct specification list and run page rearrangement procedure */ { int page = 0; PageSpec *specs, *tail; tail = specs = newspec(); while (page < nup) { int up, across; /* page index */ if (column) { if (leftright) /* left to right */ across = page/vert; else /* right to left */ across = horiz-1-page/vert; if (topbottom) /* top to bottom */ up = vert-1-page%vert; else /* bottom to top */ up = page%vert; } else { if (leftright) /* left to right */ across = page%horiz; else /* right to left */ across = horiz-1-page%horiz; if (topbottom) /* top to bottom */ up = vert-1-page/horiz; else /* bottom to top */ up = page/horiz; } if (rotate) { tail->xoff = margin + (across+1)*ppwid/horiz - hshift; tail->rotate = 90; tail->flags |= ROTATE; } else { tail->xoff = margin + across*ppwid/horiz + hshift; } tail->pageno = page; if (uscale > 0) tail->scale = uscale; else tail->scale = scale; tail->flags |= SCALE; tail->yoff = margin + up*pphgt/vert + vshift; tail->flags |= OFFSET; if (++page < nup) { tail->flags |= ADD_NEXT; tail->next = newspec(); tail = tail->next; } } pstops(nup, 1, 0, specs, draw); /* do page rearrangement */ } exit(0); } psutils-1.17.orig/psresize.c0000644000064100006410000001211706311361117014173 0ustar ejbejb/* psresize.c * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * alter pagesize of document * * Usage: * psresize [-q] [-w] [-h] [-ppaper] [-W] [-H] * [-Ppaper] [in [out]] * -w sets the output paper width * -h sets the output paper height * -ppaper sets the output paper size (width and height) by name * -W sets the input paper width * -H sets the input paper height * -Ppaper sets the input paper size (width and height) by name */ #include "psutil.h" #include "psspec.h" #include "pserror.h" #include "patchlev.h" char *program ; int pages ; int verbose ; FILE *infile ; FILE *outfile ; char pagelabel[BUFSIZ] ; int pageno ; static void usage(void) { fprintf(stderr, "%s release %d patchlevel %d\n", program, RELEASE, PATCHLEVEL); fprintf(stderr, "Copyright (C) Angus J. C. Duggan, 1991-1995. See file LICENSE for details.\n"); fprintf(stderr, "Usage: %s [-q] [-wwidth] [-hheight] [-ppaper] [-Wwidth] [-Hheight] [-Ppaper] [infile [outfile]]\n", program); fflush(stderr); exit(1); } static void argerror(void) { message(FATAL, "bad dimension\n"); } #define MIN(x,y) ((x) > (y) ? (y) : (x)) #define MAX(x,y) ((x) > (y) ? (x) : (y)) void main(int argc, char *argv[]) { double scale, rscale; /* page scale */ double waste, rwaste; /* amount wasted */ double vshift, hshift; /* page centring shifts */ int rotate; double inwidth = -1; double inheight = -1; Paper *paper; PageSpec *specs; #ifdef PAPER if ( (paper = findpaper(PAPER)) != (Paper *)0 ) { inwidth = width = (double)PaperWidth(paper); inheight = height = (double)PaperHeight(paper); } #endif vshift = hshift = 0; rotate = 0; infile = stdin; outfile = stdout; verbose = 1; for (program = *argv++; --argc; argv++) { if (argv[0][0] == '-') { switch (argv[0][1]) { case 'q': /* quiet */ verbose = 0; break; case 'w': /* page width */ width = singledimen(*argv+2, argerror, usage); break; case 'h': /* page height */ height = singledimen(*argv+2, argerror, usage); break; case 'p': /* paper type */ if ( (paper = findpaper(*argv+2)) != (Paper *)0 ) { width = (double)PaperWidth(paper); height = (double)PaperHeight(paper); } else message(FATAL, "paper size '%s' not recognised\n", *argv+2); break; case 'W': /* input page width */ inwidth = singledimen(*argv+2, argerror, usage); break; case 'H': /* input page height */ inheight = singledimen(*argv+2, argerror, usage); break; case 'P': /* input paper type */ if ( (paper = findpaper(*argv+2)) != (Paper *)0 ) { inwidth = (double)PaperWidth(paper); inheight = (double)PaperHeight(paper); } else message(FATAL, "paper size '%s' not recognised\n", *argv+2); break; case 'v': /* version */ default: usage(); } } else if (infile == stdin) { if ((infile = fopen(*argv, OPEN_READ)) == NULL) message(FATAL, "can't open input file %s\n", *argv); } else if (outfile == stdout) { if ((outfile = fopen(*argv, OPEN_WRITE)) == NULL) message(FATAL, "can't open output file %s\n", *argv); } else usage(); } #if defined(MSDOS) || defined(WINNT) if ( infile == stdin ) { int fd = fileno(stdin) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't open input file %s\n", argv[4]); } if ( outfile == stdout ) { int fd = fileno(stdout) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't reset stdout to binary mode\n"); } #endif if ((infile=seekable(infile))==NULL) message(FATAL, "can't seek input\n"); if (width <= 0 || height <= 0) message(FATAL, "output page width and height must be set\n"); if (inwidth <= 0 || inheight <= 0) message(FATAL, "input page width and height must be set\n"); /* try normal orientation first */ scale = MIN(width/inwidth, height/inheight); waste = (width-scale*inwidth)*(width-scale*inwidth) + (height-scale*inheight)*(height-scale*inheight); hshift = (width - inwidth*scale)/2; vshift = (height - inheight*scale)/2; /* try rotated orientation */ rscale = MIN(height/inwidth, width/inheight); rwaste = (height-scale*inwidth)*(height-scale*inwidth) + (width-scale*inheight)*(width-scale*inheight); if (rwaste < waste) { double tmp = width; scale = rscale; hshift = (width + inheight*scale)/2; vshift = (height - inwidth*scale)/2; rotate = 1; width = height; height = tmp; } width /= scale; height /= scale; /* now construct specification list and run page rearrangement procedure */ specs = newspec(); if (rotate) { specs->rotate = 90; specs->flags |= ROTATE; } specs->pageno = 0; specs->scale = scale; specs->flags |= SCALE; specs->xoff = hshift; specs->yoff = vshift; specs->flags |= OFFSET; pstops(1, 1, 0, specs, 0.0); /* do page rearrangement */ exit(0); } psutils-1.17.orig/psresize.man0000644000064100006410000000311706311361117014524 0ustar ejbejb.TH PSRESIZE 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME psresize \- multiple pages per sheet .SH SYNOPSIS .B psresize [ .B \-w\fIwidth\fR ] [ .B \-h\fIheight\fR ] [ .B \-p\fIpaper\fR ] [ .B \-W\fIwidth\fR ] [ .B \-H\fIheight\fR ] [ .B \-P\fIpaper\fR ] [ .B \-q ] [ .I infile [ .I outfile ] ] .SH DESCRIPTION .I Psresize rescales and centres a document on a different size of paper. The input PostScript file should follow the Adobe Document Structuring Conventions. .PP The .I \-w option gives the output paper width, and the .I \-h option gives the output paper height, normally specified in .B "cm" or .B "in" to convert PostScript's points (1/72 of an inch) to centimeters or inches. The .I \-p option can be used as an alternative, to set the output paper size to .B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto or .B 10x14. The default output paper size is .B @PAPER@. .PP The .I \-W option gives the input paper width, and the .I \-H option gives the input paper height. The .I \-P option can be used as an alternative, to set the input paper size. The default input paper size is .B @PAPER@. .PP .I Psresize normally prints the page numbers of the pages output; the .I \-q option suppresses this. .SH EXAMPLES The following command can be used to convert a document on A4 size paper to letter size paper: .sp psresize -PA4 -pletter in.ps out.ps .sp .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. .SH BUGS .I Psresize does not accept all DSC comments. psutils-1.17.orig/psselect.c0000644000064100006410000001334106311361117014151 0ustar ejbejb/* psselect.c * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * rearrange pages in conforming PS file for printing in signatures * * Usage: * psselect [-q] [-e] [-o] [-r] [-p] [infile [outfile]] */ #include "psutil.h" #include "pserror.h" #include "patchlev.h" char *program ; int pages ; int verbose ; FILE *infile ; FILE *outfile ; char pagelabel[BUFSIZ] ; int pageno ; static void usage(void) { fprintf(stderr, "%s release %d patchlevel %d\n", program, RELEASE, PATCHLEVEL); fprintf(stderr, "Copyright (C) Angus J. C. Duggan, 1991-1995. See file LICENSE for details.\n"); fprintf(stderr, "Usage: %s [-q] [-e] [-o] [-r] [-p] [infile [outfile]]\n", program); fflush(stderr); exit(1); } typedef struct pgrange { int first, last; struct pgrange *next; } PageRange ; static PageRange *makerange(int beg, int end, PageRange *next) { PageRange *new; if ((new = (PageRange *)malloc(sizeof(PageRange))) == NULL) message(FATAL, "out of memory\n"); new->first = beg; new->last = end; new->next = next; return (new); } static PageRange *addrange(char *str, PageRange *rp) { int first=0; int sign; sign = (*str == '_' && ++str) ? -1 : 1; if (isdigit(*str)) { first = sign*atoi(str); while (isdigit(*str)) str++; } switch (*str) { case '\0': if (first || sign < 0) return (makerange(first, first, rp)); break; case ',': if (first || sign < 0) return (addrange(str+1, makerange(first, first, rp))); break; case '-': case ':': str++; sign = (*str == '_' && ++str) ? -1 : 1; if (!first) first = 1; if (isdigit(*str)) { int last = sign*atoi(str); while (isdigit(*str)) str++; switch (*str) { case '\0': return (makerange(first, last, rp)); case ',': return (addrange(str+1, makerange(first, last, rp))); } } else if (*str == '\0') return (makerange(first, -1, rp)); else if (*str == ',') return (addrange(str+1, makerange(first, -1, rp))); } message(FATAL, "invalid page range\n"); return (PageRange *)0 ; } void main(int argc, char *argv[]) { int currentpg, maxpage = 0; int even = 0, odd = 0, reverse = 0; int pass, all; PageRange *pagerange = NULL; infile = stdin; outfile = stdout; verbose = 1; for (program = *argv++; --argc; argv++) { if (argv[0][0] == '-') { switch (argv[0][1]) { case 'e': /* even pages */ even = 1; break; case 'o': /* odd pages */ odd = 1; break; case 'r': /* reverse */ reverse = 1; break; case 'p': /* page spec */ pagerange = addrange(*argv+2, pagerange); break; case 'q': /* quiet */ verbose = 0; break; case 'v': /* version */ default: usage(); } } else if (pagerange == NULL && !reverse && !even && !odd) { pagerange = addrange(*argv, NULL); } else if (infile == stdin) { if ((infile = fopen(*argv, OPEN_READ)) == NULL) message(FATAL, "can't open input file %s\n", *argv); } else if (outfile == stdout) { if ((outfile = fopen(*argv, OPEN_WRITE)) == NULL) message(FATAL, "can't open output file %s\n", *argv); } else usage(); } #if defined(MSDOS) || defined(WINNT) if ( infile == stdin ) { int fd = fileno(stdin) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't open input file %s\n", argv[4]); } if ( outfile == stdout ) { int fd = fileno(stdout) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't reset stdout to binary mode\n"); } #endif if ((infile=seekable(infile))==NULL) message(FATAL, "can't seek input\n"); scanpages(); /* select all pages or all in range if odd or even not set */ all = !(odd || even); /* add default page range */ if (!pagerange) pagerange = makerange(1, -1, NULL); /* reverse page list if not reversing pages (list constructed bottom up) */ if (!reverse) { PageRange *revlist = NULL; PageRange *next = NULL; while (pagerange) { next = pagerange->next; pagerange->next = revlist; revlist = pagerange; pagerange = next; } pagerange = revlist; } else { /* swap start & end if reversing */ PageRange *r; for (r = pagerange; r; r = r->next) { int temp = r->last; r->last = r->first; r->first = temp; } } { /* adjust for end-relative pageranges */ PageRange *r; for (r = pagerange; r; r = r->next) { if (r->first < 0) { r->first += pages + 1; if (r->first < 1) r->first = 1; } if (r->last < 0) { r->last += pages + 1; if (r->last < 1) r->last = 1; } } } /* count pages on first pass, select pages on second pass */ for (pass = 0; pass < 2; pass++) { PageRange *r; if (pass) { /* write header on second pass */ writeheader(maxpage); writeprolog(); writesetup(); } for (r = pagerange; r; r = r->next) { if (r->last < r->first) { for (currentpg = r->first; currentpg >= r->last; currentpg--) { if (currentpg == 0 || (currentpg <= pages && ((currentpg&1) ? (odd || all) : (even || all)))) { if (pass) { if (currentpg) writepage(currentpg-1); else writeemptypage() ; } else maxpage++; } } } else { for (currentpg = r->first; currentpg <= r->last; currentpg++) { if (currentpg == 0 || (currentpg <= pages && ((currentpg&1) ? (odd || all) : (even || all)))) { if (pass) { if (currentpg) writepage(currentpg-1); else writeemptypage() ; } else maxpage++; } } } } } writetrailer(); exit(0); } psutils-1.17.orig/psselect.man0000644000064100006410000000376106311361117014507 0ustar ejbejb.TH PSSELECT 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME psselect \- select pages from a PostScript file .SH SYNOPSIS .B psselect [ .B \-q ] [ .B \-e ] [ .B \-o ] [ .B \-r ] [ .B \-p\fIpages\fR ] [ .I pages ] [ .I infile [ .I outfile ] ] .SH DESCRIPTION .I Psselect selects pages from a PostScript document, creating a new PostScript file. The input PostScript file should follow the Adobe Document Structuring Conventions. .PP The .I \-e option selects all of the even pages; it may be used in conjunction with the other page selection options to select the even pages from a range of pages. .PP The .I \-o option selects all of the odd pages; it may be used in conjunction with the other page selection options. .PP The .I \-p\fIpages\fR option specifies the pages which are to be selected. .I Pages is a comma separated list of page ranges, each of which may be a page number, or a page range of the form \fIfirst\fR-\fIlast\fR. If \fIfirst\fR is omitted, the first page is assumed, and if \fIlast\fR is omitted, the last page is assumed. The prefix character `_' indicates that the page number is relative to the end of the document, counting backwards. If just this character with no page number is used, a blank page will be inserted. .PP The .I \-r option causes .I psselect to output the selected pages in reverse order. .PP Psselect normally prints the page numbers of the pages rearranged; the .I \-q option suppresses this. .PP If any of the .I \-r, \-e, or .I \-o options are specified, the page range must be given with the .I \-p option. This is for backwards compatibility with previous versions. .SH NOTES The page number given to .I psselect is the number of the page counting from the start or end of the file, starting at one. The actual page number in the document may be different. .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. .SH BUGS .I Psselect does not accept all DSC comments. psutils-1.17.orig/psspec.c0000644000064100006410000001655706311361120013632 0ustar ejbejb/* psspec.c * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * page spec routines for page rearrangement */ #include "psutil.h" #include "psspec.h" #include "pserror.h" #include "patchlev.h" #include double width = -1; double height = -1; /* create a new page spec */ PageSpec *newspec(void) { PageSpec *temp = (PageSpec *)malloc(sizeof(PageSpec)); if (temp == NULL) message(FATAL, "out of memory\n"); temp->reversed = temp->pageno = temp->flags = temp->rotate = 0; temp->scale = 1; temp->xoff = temp->yoff = 0; temp->next = NULL; return (temp); } /* dimension parsing routines */ int parseint(char **sp, void (*errorfn)(void)) { char *s = *sp; int num = atoi(s); while (isdigit(*s)) s++; if (*sp == s) (*errorfn)() ; *sp = s; return (num); } double parsedouble(char **sp, void (*errorfn)(void)) { char *s = *sp; double num = atof(s); while (isdigit(*s) || *s == '-' || *s == '.') s++; if (*sp == s) (*errorfn)() ; *sp = s; return (num); } double parsedimen(char **sp, void (*errorfn)(void)) { double num = parsedouble(sp, errorfn); char *s = *sp; if (strncmp(s, "pt", 2) == 0) { s += 2; } else if (strncmp(s, "in", 2) == 0) { num *= 72; s += 2; } else if (strncmp(s, "cm", 2) == 0) { num *= 28.346456692913385211; s += 2; } else if (strncmp(s, "mm", 2) == 0) { num *= 2.8346456692913385211; s += 2; } else if (*s == 'w') { if (width < 0) message(FATAL, "width not initialised\n"); num *= width; s++; } else if (*s == 'h') { if (height < 0) message(FATAL, "height not initialised\n"); num *= height; s++; } *sp = s; return (num); } double singledimen(char *str, void (*errorfn)(void), void (*usagefn)(void)) { double num = parsedimen(&str, errorfn); if (*str) (*usagefn)(); return (num); } static char *prologue[] = { /* PStoPS procset */ #ifndef SHOWPAGE_LOAD "userdict begin", "[/showpage/erasepage/copypage]{dup where{pop dup load", /* prevent */ " type/operatortype eq{1 array cvx dup 0 3 index cvx put", /* binding */ " bind def}{pop}ifelse}{pop}ifelse}forall", /* in prolog */ #else "userdict begin", "[/showpage/copypage/erasepage]{dup 10 string cvs dup", " length 6 add string dup 0 (PStoPS) putinterval dup", " 6 4 -1 roll putinterval 2 copy cvn dup where", " {pop pop pop}{exch load def}ifelse cvx cvn 1 array cvx", " dup 0 4 -1 roll put def}forall", #endif "[/letter/legal/executivepage/a4/a4small/b5/com10envelope", /* nullify */ " /monarchenvelope/c5envelope/dlenvelope/lettersmall/note", /* paper */ " /folio/quarto/a5]{dup where{dup wcheck{exch{}put}", /* operators */ " {pop{}def}ifelse}{pop}ifelse}forall", "/setpagedevice {pop}bind 1 index where{dup wcheck{3 1 roll put}", " {pop def}ifelse}{def}ifelse", "/PStoPSmatrix matrix currentmatrix def", "/PStoPSxform matrix def/PStoPSclip{clippath}def", "/defaultmatrix{PStoPSmatrix exch PStoPSxform exch concatmatrix}bind def", "/initmatrix{matrix defaultmatrix setmatrix}bind def", "/initclip[{matrix currentmatrix PStoPSmatrix setmatrix", " [{currentpoint}stopped{$error/newerror false put{newpath}}", " {/newpath cvx 3 1 roll/moveto cvx 4 array astore cvx}ifelse]", " {[/newpath cvx{/moveto cvx}{/lineto cvx}", " {/curveto cvx}{/closepath cvx}pathforall]cvx exch pop}", " stopped{$error/errorname get/invalidaccess eq{cleartomark", " $error/newerror false put cvx exec}{stop}ifelse}if}bind aload pop", " /initclip dup load dup type dup/operatortype eq{pop exch pop}", " {dup/arraytype eq exch/packedarraytype eq or", " {dup xcheck{exch pop aload pop}{pop cvx}ifelse}", " {pop cvx}ifelse}ifelse", " {newpath PStoPSclip clip newpath exec setmatrix} bind aload pop]cvx def", "/initgraphics{initmatrix newpath initclip 1 setlinewidth", " 0 setlinecap 0 setlinejoin []0 setdash 0 setgray", " 10 setmiterlimit}bind def", "end", NULL }; void pstops(int modulo, int pps, int nobind, PageSpec *specs, double draw) { int thispg, maxpage; int pageindex = 0; char **pro; scanpages(); maxpage = ((pages+modulo-1)/modulo)*modulo; /* rearrange pages: doesn't cope properly with loaded definitions */ writeheader((maxpage/modulo)*pps); #ifndef SHOWPAGE_LOAD writestring("%%BeginProcSet: PStoPS"); #else writestring("%%BeginProcSet: PStoPS-spload"); #endif if (nobind) writestring("-nobind"); writestring(" 1 15\n"); for (pro = prologue; *pro; pro++) { writestring(*pro); writestring("\n"); } if (nobind) /* desperation measures */ writestring("/bind{}def\n"); writestring("%%EndProcSet\n"); /* save transformation from original to current matrix */ if (writepartprolog()) { writestring("userdict/PStoPSxform PStoPSmatrix matrix currentmatrix\n"); writestring(" matrix invertmatrix matrix concatmatrix\n"); writestring(" matrix invertmatrix put\n"); } writesetup(); for (thispg = 0; thispg < maxpage; thispg += modulo) { int add_last = 0; PageSpec *ps; for (ps = specs; ps != NULL; ps = ps->next) { int actualpg; int add_next = ((ps->flags & ADD_NEXT) != 0); if (ps->reversed) actualpg = maxpage-thispg-modulo+ps->pageno; else actualpg = thispg+ps->pageno; if (actualpg < pages) seekpage(actualpg); if (!add_last) { /* page label contains original pages */ PageSpec *np = ps; char *eob = pagelabel; char sep = '('; do { *eob++ = sep; if (np->reversed) sprintf(eob, "%d", maxpage-thispg-modulo+np->pageno); else sprintf(eob, "%d", thispg+np->pageno); eob = eob + strlen(eob); sep = ','; } while ((np->flags & ADD_NEXT) && (np = np->next)); strcpy(eob, ")"); writepageheader(pagelabel, ++pageindex); } writestring("userdict/PStoPSsaved save put\n"); if (ps->flags & GSAVE) { char buffer[BUFSIZ]; writestring("PStoPSmatrix setmatrix\n"); if (ps->flags & OFFSET) { sprintf(buffer, "%f %f translate\n", ps->xoff, ps->yoff); writestring(buffer); } if (ps->flags & ROTATE) { sprintf(buffer, "%d rotate\n", ps->rotate); writestring(buffer); } if (ps->flags & SCALE) { sprintf(buffer, "%f dup scale\n", ps->scale); writestring(buffer); } writestring("userdict/PStoPSmatrix matrix currentmatrix put\n"); if (width > 0 && height > 0) { char buffer[BUFSIZ]; writestring("userdict/PStoPSclip{0 0 moveto\n"); sprintf(buffer, " %f 0 rlineto 0 %f rlineto -%f 0 rlineto\n", width, height, width); writestring(buffer); writestring(" closepath}put initclip\n"); if (draw > 0) { sprintf(buffer, "gsave clippath 0 setgray %f setlinewidth stroke grestore\n", draw); writestring(buffer); } } } if (add_next) { #ifndef SHOWPAGE_LOAD writestring("/showpage{}def/copypage{}def/erasepage{}def\n"); #else writestring("/PStoPSshowpage{}store/PStoPScopypage{}store/PStoPSerasepage{}store\n"); #endif } if (actualpg < pages) { writepagesetup(); writestring("PStoPSxform concat\n"); writepagebody(actualpg); } else { writestring("PStoPSxform concat\n"); writestring("showpage\n"); } writestring("PStoPSsaved restore\n"); add_last = add_next; } } writetrailer(); } psutils-1.17.orig/psspec.h0000644000064100006410000000151706311361120013625 0ustar ejbejb/* psspec.h * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * routines for page rearrangement specs */ /* pagespec flags */ #define ADD_NEXT (0x01) #define ROTATE (0x02) #define SCALE (0x04) #define OFFSET (0x08) #define GSAVE (ROTATE|SCALE|OFFSET) typedef struct pagespec { int reversed, pageno, flags, rotate; double xoff, yoff, scale; struct pagespec *next; } PageSpec ; extern double width, height; extern PageSpec *newspec(void); extern int parseint(char **sp, void (*errorfn)(void)); extern double parsedouble(char **sp, void (*errorfn)(void)); extern double parsedimen(char **sp, void (*errorfn)(void)); extern double singledimen(char *str, void (*errorfn)(void), void (*usagefn)(void)); extern void pstops(int modulo, int pps, int nobind, PageSpec *specs, double draw); psutils-1.17.orig/pstops.c0000644000064100006410000001154106311361120013651 0ustar ejbejb/* pstops.c * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * rearrange pages in conforming PS file for printing in signatures * * Usage: * pstops [-q] [-b] [-d] [-w] [-h] [-ppaper] [infile [outfile]] */ #include "psutil.h" #include "psspec.h" #include "pserror.h" #include "patchlev.h" char *program ; int pages ; int verbose ; FILE *infile ; FILE *outfile ; char pagelabel[BUFSIZ] ; int pageno ; void usage(void) { fprintf(stderr, "%s release %d patchlevel %d\n", program, RELEASE, PATCHLEVEL); fprintf(stderr, "Copyright (C) Angus J. C. Duggan, 1991-1995. See file LICENSE for details.\n"); fprintf(stderr, "Usage: %s [-q] [-b] [-wwidth] [-hheight] [-dlwidth] [-ppaper] [infile [outfile]]\n", program); fflush(stderr); exit(1); } static void argerror(void) { fprintf(stderr, "%s: page specification error:\n", program); fprintf(stderr, " = [modulo:]\n"); fprintf(stderr, " = [-]pageno[@scale][L|R|U][(xoff,yoff)][,spec|+spec]\n"); fprintf(stderr, " modulo>=1, 0<=pagenoreversed = !tail->reversed; break; case '@': if (num < 0) argerror(); tail->scale *= parsedouble(&str, argerror); tail->flags |= SCALE; break; case 'l': case 'L': tail->rotate += 90; tail->flags |= ROTATE; break; case 'r': case 'R': tail->rotate -= 90; tail->flags |= ROTATE; break; case 'u': case 'U': tail->rotate += 180; tail->flags |= ROTATE; break; case '(': tail->xoff += parsedimen(&str, argerror); if (*str++ != ',') argerror(); tail->yoff += parsedimen(&str, argerror); if (*str++ != ')') argerror(); tail->flags |= OFFSET; break; case '+': tail->flags |= ADD_NEXT; case ',': if (num < 0 || num >= modulo) argerror(); if ((tail->flags & ADD_NEXT) == 0) pagesperspec++; tail->pageno = num; tail->next = newspec(); tail = tail->next; num = -1; break; default: argerror(); } other = 1; } } if (num >= modulo) argerror(); else if (num >= 0) tail->pageno = num; return (head); } void main(int argc, char *argv[]) { PageSpec *specs = NULL; int nobinding = 0; double draw = 0; Paper *paper; #ifdef PAPER if ( (paper = findpaper(PAPER)) != (Paper *)0 ) { width = (double)PaperWidth(paper); height = (double)PaperHeight(paper); } #endif infile = stdin; outfile = stdout; verbose = 1; for (program = *argv++; --argc; argv++) { if (argv[0][0] == '-') { switch (argv[0][1]) { case 'q': /* quiet */ verbose = 0; break; case 'd': /* draw borders */ if (argv[0][2]) draw = singledimen(*argv+2, argerror, usage); else draw = 1; break; case 'b': /* no bind operator */ nobinding = 1; break; case 'w': /* page width */ width = singledimen(*argv+2, argerror, usage); break; case 'h': /* page height */ height = singledimen(*argv+2, argerror, usage); break; case 'p': /* paper type */ if ( (paper = findpaper(*argv+2)) != (Paper *)0 ) { width = (double)PaperWidth(paper); height = (double)PaperHeight(paper); } else message(FATAL, "paper size '%s' not recognised\n", *argv+2); break; case 'v': /* version */ usage(); default: if (specs == NULL) specs = parsespecs(*argv); else usage(); } } else if (specs == NULL) specs = parsespecs(*argv); else if (infile == stdin) { if ((infile = fopen(*argv, OPEN_READ)) == NULL) message(FATAL, "can't open input file %s\n", *argv); } else if (outfile == stdout) { if ((outfile = fopen(*argv, OPEN_WRITE)) == NULL) message(FATAL, "can't open output file %s\n", *argv); } else usage(); } if (specs == NULL) usage(); #if defined(MSDOS) || defined(WINNT) if ( infile == stdin ) { int fd = fileno(stdin) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't open input file %s\n", argv[4]); } if ( outfile == stdout ) { int fd = fileno(stdout) ; if ( setmode(fd, O_BINARY) < 0 ) message(FATAL, "can't reset stdout to binary mode\n"); } #endif if ((infile=seekable(infile))==NULL) message(FATAL, "can't seek input\n"); pstops(modulo, pagesperspec, nobinding, specs, draw); exit(0); } psutils-1.17.orig/pstops.man0000644000064100006410000000752506311361120014211 0ustar ejbejb.TH PSTOPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@" .SH NAME pstops \- shuffle pages in a PostScript file .SH SYNOPSIS .B pstops [ .B \-q ] [ .B \-b ] [ .B \-w\fIwidth\fR ] [ .B \-h\fIheight\fR ] [ .B \-p\fIpaper\fR ] [ .B \-d\fIlwidth\fR ] .I pagespecs [ .I infile [ .I outfile ] ] .SH DESCRIPTION .I Pstops rearranges pages from a PostScript document, creating a new PostScript file. The input PostScript file should follow the Adobe Document Structuring Conventions. .I Pstops can be used to perform a large number of arbitrary re-arrangements of Documents, including arranging for printing 2-up, 4-up, booklets, reversing, selecting front or back sides of documents, scaling, etc. .PP .I pagespecs follow the syntax: .RS .TP 12 .I pagespecs .I = [modulo:]specs .TP .I specs .I = spec[+specs][,specs] .TP .I spec .I = [-]pageno[L][R][U][@scale][(xoff,yoff)] .RE .sp .I modulo is the number of pages in each block. The value of .I modulo should be greater than 0; the default value is 1. .I specs are the page specifications for the pages in each block. The value of the .I pageno in each .I spec should be between 0 (for the first page in the block) and \fImodulo\fR-1 (for the last page in each block) inclusive. The optional dimensions .I xoff and .I yoff shift the page by the specified amount. .I xoff and .I yoff are in PostScript's points, but may be followed by the units .B "cm" or .B "in" to convert to centimetres or inches, or the flag .B "w" or .B "h" to specify as a multiple of the width or height. The optional parameters \fIL\fR, \fIR\fR, and \fIU\fR rotate the page left, right, or upside-down. The optional .I scale parameter scales the page by the fraction specified. If the optional minus sign is specified, the page is relative to the end of the document, instead of the start. If page \fIspec\fRs are separated by .B \+ the pages will be merged into one page; if they are separated by .B \, they will be on separate pages. If there is only one page specification, with .I pageno zero, the \fIpageno\fR may be omitted. The shift, rotation, and scaling are performed in that order regardless of which order they appear on the command line. .PP The .I \-w option gives the width which is used by the .B "w" dimension specifier, and the .I \-h option gives the height which is used by the .B "h" dimension specifier. These dimensions are also used (after scaling) to set the clipping path for each page. The .I \-p option can be used as an alternative, to set the paper size to .B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto or .B 10x14. The default paper size is .B @PAPER@. .PP The .I \-b option prevents any .B bind operators in the PostScript prolog from binding. This may be needed in cases where complex multi-page re-arrangements are being done. .PP The .I \-d option draws a line around the border of each page, of the specified width. If the \fIlwidth\fR parameter is omitted, a default linewidth of 1 point is assumed. The linewidth is relative to the original page dimensions, \fIi.e.\fR it is scaled up or down with the rest of the page. .PP Pstops normally prints the page numbers of the pages re-arranged; the .I \-q option suppresses this. .SH EXAMPLES This section contains some sample re-arrangements. To put two pages on one sheet (of A4 paper), the pagespec to use is: .sp .ce 2:0L@.7(21cm,0)+1L@.7(21cm,14.85cm) .sp To select all of the odd pages in reverse order, use: .sp .ce 2:-0 .sp To re-arrange pages for printing 2-up booklets, use .sp .ce 4:-3L@.7(21cm,0)+0L@.7(21cm,14.85cm) .sp for the front sides, and .sp .ce 4:1L@.7(21cm,0)+-2L@.7(21cm,14.85cm) .sp for the reverse sides (or join them with a comma for duplex printing). .SH AUTHOR Copyright (C) Angus J. C. Duggan 1991-1995 .SH "SEE ALSO" @MAN@ .SH TRADEMARKS .B PostScript is a trademark of Adobe Systems Incorporated. .SH BUGS .I Pstops does not accept all DSC comments. psutils-1.17.orig/psutil.c0000644000064100006410000002142306311361120013641 0ustar ejbejb/* psutil.c * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * utilities for PS programs */ /* * AJCD 6/4/93 * Changed to using ftell() and fseek() only (no length calculations) * Hunter Goatley 31-MAY-1993 23:33 * Fixed VMS support. * Hunter Goatley 2-MAR-1993 14:41 * Added VMS support. */ #include "psutil.h" #include "pserror.h" #include "patchlev.h" #include #include #include #define iscomment(x,y) (strncmp(x,y,strlen(y)) == 0) extern char *program ; extern int pages; extern int verbose; extern FILE *infile; extern FILE *outfile; extern char pagelabel[BUFSIZ]; extern int pageno; static char buffer[BUFSIZ]; static long bytes = 0; static long pagescmt = 0; static long headerpos = 0; static long endsetup = 0; static long beginprocset = 0; /* start of pstops procset */ static long endprocset = 0; static int outputpage = 0; static int maxpages = 100; static long *pageptr; /* list of paper sizes supported */ static Paper papersizes[] = { { "a3", 842, 1191 }, /* 29.7cm * 42cm */ { "a4", 595, 842 }, /* 21cm * 29.7cm */ { "a5", 421, 595 }, /* 14.85cm * 21cm */ { "b5", 516, 729 }, /* 18.2cm * 25.72cm */ { "A3", 842, 1191 }, /* 29.7cm * 42cm */ { "A4", 595, 842 }, /* 21cm * 29.7cm */ { "A5", 421, 595 }, /* 14.85cm * 21cm */ { "B5", 516, 729 }, /* 18.2cm * 25.72cm */ { "letter", 612, 792 }, /* 8.5in * 11in */ { "legal", 612, 1008 }, /* 8.5in * 14in */ { "ledger", 1224, 792 }, /* 17in * 11in */ { "tabloid", 792, 1224 }, /* 11in * 17in */ { "statement", 396, 612 }, /* 5.5in * 8.5in */ { "executive", 540, 720 }, /* 7.6in * 10in */ { "folio", 612, 936 }, /* 8.5in * 13in */ { "quarto", 610, 780 }, /* 8.5in * 10.83in */ { "10x14", 720, 1008 }, /* 10in * 14in */ { NULL, 0, 0 } }; /* return pointer to paper size struct or NULL */ Paper* findpaper(char *name) { Paper *pp; for (pp = papersizes; PaperName(pp); pp++) { if (strcmp(PaperName(pp), name) == 0) { return pp; } } return (Paper *)NULL; } /* Make a file seekable, using temporary files if necessary */ FILE *seekable(FILE *fp) { #ifndef MSDOS FILE *ft; long r, w ; #endif char *p; char buffer[BUFSIZ] ; #if defined(WINNT) struct _stat fs ; #else long fpos; #endif #if defined(WINNT) if (_fstat(fileno(fp), &fs) == 0 && (fs.st_mode&_S_IFREG) != 0) return (fp); #else if ((fpos = ftell(fp)) >= 0) if (!fseek(fp, 0L, SEEK_END) && !fseek(fp, fpos, SEEK_SET)) return (fp); #endif #if defined(MSDOS) message(FATAL, "input is not seekable\n"); return (NULL) ; #else if ((ft = tmpfile()) == NULL) return (NULL); while ((r = fread(p = buffer, sizeof(char), BUFSIZ, fp)) > 0) { do { if ((w = fwrite(p, sizeof(char), r, ft)) == 0) return (NULL) ; p += w ; r -= w ; } while (r > 0) ; } if (!feof(fp)) return (NULL) ; /* discard the input file, and rewind the temporary */ (void) fclose(fp); if (fseek(ft, 0L, SEEK_SET) != 0) return (NULL) ; return (ft); #endif } /* copy input file from current position upto new position to output file */ static int fcopy(long upto) { long here = ftell(infile); while (here < upto) { if ((fgets(buffer, BUFSIZ, infile) == NULL) || (fputs(buffer, outfile) == EOF)) return(0); here = ftell(infile); bytes += strlen(buffer); } return (1); } /* build array of pointers to start/end of pages */ void scanpages(void) { register char *comment = buffer+2; register int nesting = 0; register long int record; if ((pageptr = (long *)malloc(sizeof(long)*maxpages)) == NULL) message(FATAL, "out of memory\n"); pages = 0; fseek(infile, 0L, SEEK_SET); while (record = ftell(infile), fgets(buffer, BUFSIZ, infile) != NULL) if (*buffer == '%') { if (buffer[1] == '%') { if (nesting == 0 && iscomment(comment, "Page:")) { if (pages >= maxpages-1) { maxpages *= 2; if ((pageptr = (long *)realloc((char *)pageptr, sizeof(long)*maxpages)) == NULL) message(FATAL, "out of memory\n"); } pageptr[pages++] = record; } else if (headerpos == 0 && iscomment(comment, "Pages:")) pagescmt = record; else if (headerpos == 0 && iscomment(comment, "EndComments")) headerpos = ftell(infile); else if (iscomment(comment, "BeginDocument") || iscomment(comment, "BeginBinary") || iscomment(comment, "BeginFile")) nesting++; else if (iscomment(comment, "EndDocument") || iscomment(comment, "EndBinary") || iscomment(comment, "EndFile")) nesting--; else if (nesting == 0 && iscomment(comment, "EndSetup")) endsetup = record; else if (nesting == 0 && iscomment(comment, "BeginProlog")) headerpos = ftell(infile); else if (nesting == 0 && iscomment(comment, "BeginProcSet: PStoPS")) beginprocset = record; else if (beginprocset && !endprocset && iscomment(comment, "EndProcSet")) endprocset = ftell(infile); else if (nesting == 0 && (iscomment(comment, "Trailer") || iscomment(comment, "EOF"))) { fseek(infile, record, SEEK_SET); break; } } else if (headerpos == 0 && buffer[1] != '!') headerpos = record; } else if (headerpos == 0) headerpos = record; pageptr[pages] = ftell(infile); if (endsetup == 0 || endsetup > pageptr[0]) endsetup = pageptr[0]; } /* seek a particular page */ void seekpage(int p) { fseek(infile, pageptr[p], SEEK_SET); if (fgets(buffer, BUFSIZ, infile) != NULL && iscomment(buffer, "%%Page:")) { char *start, *end; for (start = buffer+7; isspace(*start); start++); if (*start == '(') { int paren = 1; for (end = start+1; paren > 0; end++) switch (*end) { case '\0': message(FATAL, "Bad page label while seeking page %d\n", p); case '(': paren++; break; case ')': paren--; break; } } else for (end = start; !isspace(*end); end++); strncpy(pagelabel, start, end-start); pagelabel[end-start] = '\0'; pageno = atoi(end); } else message(FATAL, "I/O error seeking page %d\n", p); } /* Output routines. These all update the global variable bytes with the number * of bytes written */ void writestring(char *s) { fputs(s, outfile); bytes += strlen(s); } /* write page comment */ void writepageheader(char *label, int page) { if (verbose) message(LOG, "[%d] ", page); sprintf(buffer, "%%%%Page: %s %d\n", label, ++outputpage); writestring(buffer); } /* search for page setup */ void writepagesetup(void) { char buffer[BUFSIZ]; if (beginprocset) { for (;;) { if (fgets(buffer, BUFSIZ, infile) == NULL) message(FATAL, "I/O error reading page setup %d\n", outputpage); if (!strncmp(buffer, "PStoPSxform", 11)) break; if (fputs(buffer, outfile) == EOF) message(FATAL, "I/O error writing page setup %d\n", outputpage); bytes += strlen(buffer); } } } /* write the body of a page */ void writepagebody(int p) { if (!fcopy(pageptr[p+1])) message(FATAL, "I/O error writing page %d\n", outputpage); } /* write a whole page */ void writepage(int p) { seekpage(p); writepageheader(pagelabel, p+1); writepagebody(p); } /* write from start of file to end of header comments */ void writeheader(int p) { fseek(infile, 0L, SEEK_SET); if (pagescmt) { if (!fcopy(pagescmt) || fgets(buffer, BUFSIZ, infile) == NULL) message(FATAL, "I/O error in header\n"); sprintf(buffer, "%%%%Pages: %d 0\n", p); writestring(buffer); } if (!fcopy(headerpos)) message(FATAL, "I/O error in header\n"); } /* write prologue to end of setup section excluding PStoPS procset */ int writepartprolog(void) { if (beginprocset && !fcopy(beginprocset)) message(FATAL, "I/O error in prologue\n"); if (endprocset) fseek(infile, endprocset, SEEK_SET); writeprolog(); return !beginprocset; } /* write prologue up to end of setup section */ void writeprolog(void) { if (!fcopy(endsetup)) message(FATAL, "I/O error in prologue\n"); } /* write from end of setup to start of pages */ void writesetup(void) { if (!fcopy(pageptr[0])) message(FATAL, "I/O error in prologue\n"); } /* write trailer */ void writetrailer(void) { fseek(infile, pageptr[pages], SEEK_SET); while (fgets(buffer, BUFSIZ, infile) != NULL) { writestring(buffer); } if (verbose) message(LOG, "Wrote %d pages, %ld bytes\n", outputpage, bytes); } /* write a page with nothing on it */ void writeemptypage(void) { if (verbose) message(LOG, "[*] "); sprintf(buffer, "%%%%Page: * %d\n", ++outputpage); writestring(buffer); if (beginprocset) writestring("PStoPSxform concat\n"); writestring("showpage\n"); } psutils-1.17.orig/psutil.h0000644000064100006410000000264206311361120013650 0ustar ejbejb/* psutil.h * Copyright (C) Angus J. C. Duggan 1991-1995 * See file LICENSE for details. * * utilities for PS programs */ #include #include #include #include "config.h" /* types for describing document; this is a step towards version 2 */ typedef long Fileptr ; /* paper size structure; configurability and proper paper resources will have to wait until version 2 */ typedef struct papersize { char *name; /* name of paper size */ int width, height; /* width, height in points */ } Paper ; #define PaperName(p) ((p)->name) #define PaperWidth(p) ((p)->width) #define PaperHeight(p) ((p)->height) /* Definitions for functions found in psutil.c */ extern Paper *findpaper(char *name); extern FILE *seekable(FILE *fp); extern void writepage(int p); extern void seekpage(int p); extern void writepageheader(char *label, int p); extern void writepagesetup(void); extern void writepagebody(int p); extern void writeheader(int p); extern int writepartprolog(void); extern void writeprolog(void); extern void writesetup(void); extern void writetrailer(void); extern void writeemptypage(void); extern void scanpages(void); extern void writestring(char *s); /* These variables are imported from the client program (e.g. psbook, psnup, etc.) */ extern char *program ; extern int pages; extern int verbose; extern FILE *infile; extern FILE *outfile; extern char pagelabel[BUFSIZ]; extern int pageno; psutils-1.17.orig/showchar.sh0000644000064100006410000000500706311361121014330 0ustar ejbejb#!/bin/sh # showchar: show character with information # usage: # showchar Font-Name Char-Name | lpr -Pprinter if [ $# != 2 ]; then echo "Usage: `basename $0` Font-Name Char-Name" >&2 exit 1 fi cat < $@ $(CHMOD) $(BINMODE) $@ fixfmps: fixfmps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixmacps: fixmacps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) INCLUDE=$(INCLUDEDIR) $? > $@ $(CHMOD) $(BINMODE) $@ fixpsditps: fixpsditps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixpspps: fixpspps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixscribeps: fixscribeps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixtpps: fixtpps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixwfwps: fixwfwps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixwpps: fixwpps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixwwps: fixwwps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ fixdlsrps: fixdlsrps.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ extractres: extractres.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) $? > $@ $(CHMOD) $(BINMODE) $@ includeres: includeres.pl $(PERL) maketext OS=$(OS) PERL=$(PERL) INCLUDE=$(INCLUDEDIR) $? > $@ $(CHMOD) $(BINMODE) $@ epsffit.$(MANEXT): epsffit.man $(PERL) maketext MAN="$(MANPAGES)" $? > $@ psnup.$(MANEXT): psnup.man $(PERL) maketext MAN="$(MANPAGES)" PAPER=$(PAPER) $? > $@ psresize.$(MANEXT): psresize.man $(PERL) maketext MAN="$(MANPAGES)" PAPER=$(PAPER) $? > $@ psbook.$(MANEXT): psbook.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ psselect.$(MANEXT): psselect.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ pstops.$(MANEXT): pstops.man $(PERL) maketext "MAN=$(MANPAGES)" PAPER=$(PAPER) $? > $@ psmerge.$(MANEXT): psmerge.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixfmps.$(MANEXT): fixfmps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixmacps.$(MANEXT): fixmacps.man $(PERL) maketext "MAN=$(MANPAGES)" INCLUDE=$(INCLUDEDIR) $? > $@ fixpsditps.$(MANEXT): fixpsditps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixpspps.$(MANEXT): fixpspps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixscribeps.$(MANEXT): fixscribeps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixtpps.$(MANEXT): fixtpps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixwfwps.$(MANEXT): fixwfwps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixwpps.$(MANEXT): fixwpps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixwwps.$(MANEXT): fixwwps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ fixdlsrps.$(MANEXT): fixdlsrps.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ extractres.$(MANEXT): extractres.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ includeres.$(MANEXT): includeres.man $(PERL) maketext "MAN=$(MANPAGES)" INCLUDE=$(INCLUDEDIR) $? > $@ getafm.$(MANEXT): getafm.man $(PERL) maketext "MAN=$(MANPAGES)" $? > $@ clean: rm -f *.o veryclean realclean: clean rm -f $(BIN) $(PERLSCRIPTS) $(MANPAGES) install: install.bin install.script install.man install.include install.bin: $(BIN) -mkdir $(BINDIR) @for i in $(BIN); do \ echo Installing $$i; \ $(INSTALL) $$i $(BINDIR); \ done install.script: $(PERLSCRIPTS) $(SHELLSCRIPTS) -mkdir $(SCRIPTDIR) @for i in $(PERLSCRIPTS) $(SHELLSCRIPTS); do \ echo Installing $$i; \ $(INSTALL) $$i $(SCRIPTDIR); \ done install.include: $(INCLUDES) -mkdir $(INCLUDEDIR) @for i in $(INCLUDES); do \ echo Installing $$i; \ $(INSTALLMAN) $$i $(INCLUDEDIR); \ done install.man: $(MANPAGES) -mkdir $(MANDIR) @for i in $(MANPAGES); do \ echo Installing manual page for $$i; \ $(INSTALLMAN) $$i $(MANDIR)/$$i; \ done psutils-1.17.orig/getafm0000644000064100006410000001375406325156510013365 0ustar ejbejb#!/bin/sh if [ $# -ne 1 ]; then echo "usage: $0 font-name | gsnd - >font-name.afm" >&2 exit 1 fi cat << EOF %! % produce .afm for $1 % (c) 1993 by Robert Joop % inspired by two other versions of this theme which are % getafm 1.00 (c) AJCD % and getafm.ps by an unknown author, % modified by J. Daniel Smith % Metrics dictionary code added by AJCD, 7/6/93 /getafmdict 100 dict dup begin /buf 256 string def /buf2 16 string def /prany % dict dictname printname -> dict { 2 index 2 index cvn known { print % printname ( ) print 1 index exch cvn get = } { (Comment /FontInfo contains no /) print 2 copy eq { = % printname pop % dictname } { exch print % dictname (, therefore no ) print = % printname } ifelse } ifelse } bind def /printfontname { (FontName)dup prany } bind def /printfontinfo { dup /FontInfo known { dup /FontInfo get (FullName)dup prany (FamilyName)dup prany (Weight)dup prany (ItalicAngle)dup prany (isFixedPitch)(IsFixedPitch) prany (UnderlinePosition)dup prany (UnderlineThickness)dup prany (Version)(version) prany (Notice)dup prany pop } { (Comment Font lacks a /FontInfo!)= } ifelse } bind def /prbbox % llx lly urx ury -> - { 4 1 roll 3 1 roll exch % swap top 4 elements 4 { ( ) print buf cvs print } repeat } bind def /getbbox % fontdict chardict character -> fontdict chardict llx lly urx ury { gsave 2 index setfont 0 0 moveto false charpath flattenpath pathbbox grestore } bind def /printmiscinfo { dup /FontBBox known { (FontBBox) print dup /FontBBox get aload pop prbbox ()= } { (Comment missing required /FontBBox)= quit } ifelse 2 copy exch get dup /H known 1 index /x known and 1 index /d known and 1 index /p known and dup /looksRoman exch def { (CapHeight ) print (H) getbbox ceiling cvi = pop pop pop (XHeight ) print (x) getbbox ceiling cvi = pop pop pop (Ascender ) print (d) getbbox ceiling cvi = pop pop pop (Descender ) print (p) getbbox pop pop floor cvi = pop } { (Comment font doesn't contain H, x, d and p; therefore no CapHeight, XHeight, Ascender and Descender)= } ifelse pop dup /Encoding get [ [ (ISOLatin1Encoding) /ISOLatin1Encoding ] [ (AdobeStandardEncoding) /StandardEncoding ] ] { aload pop dup where { exch get 2 index eq { (EncodingScheme ) print buf cvs = } { pop } ifelse } { pop pop } ifelse } forall pop } bind def /printcharmetric { % chardictname fontdict charnamedict encoding charindex charname 4 index dup length dict dup begin exch { 1 index /FID ne 2 index /UniqueID ne and { 1 index /Encoding eq { 256 array copy } if def } { pop pop } ifelse } forall end dup /Encoding get 32 3 index put /f2 exch definefont setfont (C ) print 1 index buf cvs print ( ; WX ) print % Metrics entries are: % 1 number: which is the character width % an array of 2 numbers: which are the left sidebearing and width % an array of 4 numbers: x & y left sidebearing, width and height dup 5 index % /charname fontdict dup /Metrics known { /Metrics get exch 2 copy known { get dup type /arraytype eq { dup length 2 eq {1 get} {2 get} ifelse } if round cvi buf cvs print } { pop pop ( ) stringwidth pop round cvi buf cvs print } ifelse } { pop pop ( ) stringwidth pop round cvi buf cvs print } ifelse ( ; N ) print dup buf cvs print ( ; B) print gsave newpath 0 0 moveto ( ) true charpath flattenpath pathbbox grestore 2 { ceiling cvi 4 1 roll } repeat 2 { floor cvi 4 1 roll } repeat prbbox looksRoman { [ [ /f [ /i /f /l ] ] [ /ff [ /i /l ] ] ] { aload pop 1 index 3 index eq { { 1 index buf cvs length 1 index buf2 cvs dup length 2 index add buf 4 2 roll putinterval buf 0 3 -1 roll getinterval dup cvn 7 index exch known { exch ( ; L ) print buf2 cvs print ( ) print print } { pop pop } ifelse } forall pop } { pop pop } ifelse } forall } if pop ( ;)= } bind def /printcharmetrics { (StartCharMetrics ) print 2 copy exch get length 1 sub buf cvs = 256 dict dup begin 1 index /Encoding get { null def } forall end % chardictname fontdict charnamedict 1 index /Encoding get 0 1 255 { % encoding index 2 copy get dup /.notdef eq { pop } { printcharmetric } ifelse pop % index } for -1 3 index 5 index get { pop dup /.notdef eq { pop } { % chardictname fontdict charnamedict encoding charindex charname dup 4 index exch known { pop } { printcharmetric } ifelse } ifelse } forall % charnamedict encoding index pop pop pop (EndCharMetrics)= } bind def /printfontmetrics { (StartFontMetrics 3.0)= (Comment Produced by getafm 3.0 (which is by rj@rainbow.in-berlin.de))= printfontname printfontinfo printmiscinfo printcharmetrics (EndFontMetrics)= } bind def end def /getafm { getafmdict begin save exch findfont 1000 scalefont null [ /CharDefs /CharData /CharProcs /CharStrings ] { 2 index 1 index known { exch } if pop } forall dup null eq { (can't find dictionary with character data!)= quit } if exch % dictname fontdict printfontmetrics pop pop restore end } bind def /$1 getafm EOF psutils-1.17.orig/showchar0000644000064100006410000000500706325156510013730 0ustar ejbejb#!/bin/sh # showchar: show character with information # usage: # showchar Font-Name Char-Name | lpr -Pprinter if [ $# != 2 ]; then echo "Usage: `basename $0` Font-Name Char-Name" >&2 exit 1 fi cat <