home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume41 / psutils / patch01 next >
Encoding:
Text File  |  1993-12-04  |  85.2 KB  |  2,766 lines

  1. Newsgroups: comp.sources.misc
  2. From: angus@harlequin.co.uk (Angus Duggan)
  3. Subject: v41i029:  psutils - Postscript document manipulation tools, Patch01
  4. Message-ID: <1993Dec4.180102.18886@sparky.sterling.com>
  5. X-Md4-Signature: 80a21b8422ef14a0f9bc74c106081bac
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Sat, 4 Dec 1993 18:01:02 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: angus@harlequin.co.uk (Angus Duggan)
  12. Posting-number: Volume 41, Issue 29
  13. Archive-name: psutils/patch01
  14. Environment: UNIX, VMS, msdos
  15. Patch-To: psutils: Volume 39, Issue 93-96
  16.  
  17. This patch takes PSUtils to patchlevel 13. The main features of this patch
  18. are:
  19.  
  20. Patchlevel 13 contains two new scripts for resource management, a program for
  21. page resizing, and fixes to the Makefile, page labels, and output chaining.
  22.  
  23. * Epsffit can output to a file as well as standard output.
  24. * extractres takes resources out of PostScript files and saves them
  25. * includeres puts resources from a resource library into PostScript files.
  26. * maketext script is now used to do substitutions in Perl scripts and man pages
  27. * page labels in psnup and pstops are now show where pages came from.
  28. * page labels in psbook and psselect fixed.
  29. * prologues fixed to be extractable and re-usable
  30. * Makefile doesn't use SUFFIXES any more
  31. * pstops and psnup output can now be chained through each other.
  32. * psresize alters the paper size used by a document
  33. * patchlevel.h shortened to patchlev.h as a concession to MSDOS
  34. * psnup now has -n nup form for compatibility with other n-up programs
  35.  
  36. a.
  37. --
  38. Angus Duggan, Harlequin Ltd., Barrington Hall,    | INET: angus@harlequin.co.uk
  39. Barrington, Cambridge CB2 5RG, U.K.        | PHONE: +44(0)223 872522
  40.  
  41. diff -cr +new-file psutils-dist/LICENSE psutils-next/LICENSE
  42. *** psutils-dist/LICENSE    Mon Nov 29 10:34:21 1993
  43. --- psutils-next/LICENSE    Mon Nov 29 18:50:38 1993
  44. ***************
  45. *** 4,17 ****
  46.   The constituent files of this package listed below are copyright (C) 1991,
  47.   1992, 1993 Angus J. C. Duggan.
  48.   
  49. ! LICENSE         Makefile        Manifest        README          epsffit.c
  50. ! epsffit.man     fixfmps.man     fixfmps.pl      fixmacps.man    fixmacps.pl
  51. ! fixpsditps.man  fixpsditps.pl   fixpspps.man    fixpspps.pl     fixtpps.man
  52. ! fixtpps.pl      fixwfwps.man    fixwfwps.pl     fixwpps.man     fixwpps.pl
  53. ! fixwwps.man     fixwwps.pl      getafm.man      patchlevel.h    psbook.c
  54. ! psbook.man      psnup.c         psnup.man       psselect.c      psselect.man
  55. ! psspec.c        psspec.h        pstops.c        pstops.man      psutil.c
  56. ! psutil.h        showchar
  57.   
  58.   They may be copied and used for any purpose (including distribution as part of
  59.   a for-profit product), provided:
  60. --- 4,19 ----
  61.   The constituent files of this package listed below are copyright (C) 1991,
  62.   1992, 1993 Angus J. C. Duggan.
  63.   
  64. ! LICENSE        Makefile    Manifest    README        epsffit.c
  65. ! epsffit.man    extractres.man    extractres.pl    fixdlsrps.man    fixdlsrps.pl
  66. ! fixfmps.man    fixfmps.pl    fixmacps.man    fixmacps.pl    fixpsditps.man
  67. ! fixpsditps.pl    fixpspps.man    fixpspps.pl    fixtpps.man    fixtpps.pl
  68. ! fixwfwps.man    fixwfwps.pl    fixwpps.man    fixwpps.pl    fixwwps.man
  69. ! fixwwps.pl    getafm.man    includeres.man    includeres.pl    maketext
  70. ! patchlev.h    psbook.c    psbook.man    psnup.c        psnup.man
  71. ! psresize.c    psresize.man    psselect.c    psselect.man    psspec.c
  72. ! psspec.h    pstops.c    pstops.man    psutil.c    psutil.h
  73. ! showchar
  74.   
  75.   They may be copied and used for any purpose (including distribution as part of
  76.   a for-profit product), provided:
  77. ***************
  78. *** 37,40 ****
  79.   The included files, md68_0.ps and md71_0.ps (and their uuencoded forms) are
  80.   (to the best of my knowledge) copyright Apple Computer, Inc.
  81.   
  82. !                                                                 AJCD 7/6/93
  83. --- 39,42 ----
  84.   The included files, md68_0.ps and md71_0.ps (and their uuencoded forms) are
  85.   (to the best of my knowledge) copyright Apple Computer, Inc.
  86.   
  87. !                                                                 AJCD 29/11/93
  88. diff -cr +new-file psutils-dist/Makefile psutils-next/Makefile
  89. *** psutils-dist/Makefile    Mon Nov 29 10:34:22 1993
  90. --- psutils-next/Makefile    Mon Nov 29 17:38:33 1993
  91. ***************
  92. *** 1,4 ****
  93. --- 1,9 ----
  94.   # Makefile for PS utilities
  95. + # updated AJCD 23/9/93
  96. + #
  97. + # This Makefile is rather revolting; unfortunately, there are so many
  98. + # incompatible makes around that putting all of the non-standard targets
  99. + # explicitly seems to be the only way of ensuring portability.
  100.   
  101.   BINMODE=0755
  102.   MANMODE=0644
  103. ***************
  104. *** 5,22 ****
  105.   CHMOD=chmod
  106.   INSTALL=install -c -m $(BINMODE)
  107.   INSTALLMAN=install -c -m $(MANMODE)
  108.   BINDIR=/usr/local/bin
  109.   SCRIPTDIR=$(BINDIR)
  110.   MANDIR=/usr/local/share/man/man1
  111.   MANEXT=1
  112.   PAPER=a4
  113. ! INCLUDEDIR=/usr/local/share/tex/dvips
  114.   PERL=/usr/local/bin/perl
  115.   
  116.   # CFLAGS variable controls compilation. Add following flags if necessary:
  117.   #    -DVMS    if compiling under VMS
  118.   #    -DMSDOS    if compiling under MSDOS
  119. ! CFLAGS=-g -DPAPER=\"$(PAPER)\"
  120.   
  121.   # epsffit fits an epsf file to a given bounding box
  122.   # psbook rearranges pages into signatures
  123. --- 10,28 ----
  124.   CHMOD=chmod
  125.   INSTALL=install -c -m $(BINMODE)
  126.   INSTALLMAN=install -c -m $(MANMODE)
  127.   BINDIR=/usr/local/bin
  128.   SCRIPTDIR=$(BINDIR)
  129.   MANDIR=/usr/local/share/man/man1
  130.   MANEXT=1
  131.   PAPER=a4
  132. ! INCLUDEDIR=/usr/local/share/psutils
  133.   PERL=/usr/local/bin/perl
  134.   
  135.   # CFLAGS variable controls compilation. Add following flags if necessary:
  136.   #    -DVMS    if compiling under VMS
  137.   #    -DMSDOS    if compiling under MSDOS
  138. ! CFLAGS=-DPAPER=\"$(PAPER)\"
  139.   
  140.   # epsffit fits an epsf file to a given bounding box
  141.   # psbook rearranges pages into signatures
  142. ***************
  143. *** 23,124 ****
  144.   # psselect selects page ranges
  145.   # pstops performs general page rearrangement and merging
  146.   # psnup puts multiple logical pages on one physical page
  147.   
  148. ! # definitions for Unix
  149.   exe =
  150.   obj = .o
  151. ! BIN = psbook psselect pstops epsffit psnup
  152.   SHELLSCRIPTS = getafm
  153.   PERLSCRIPTS = fixfmps fixmacps fixpsditps fixpspps fixtpps fixwfwps fixwpps \
  154. !               fixwwps
  155.   INCLUDES = md68_0.ps md71_0.ps
  156.   MANPAGES = psbook.$(MANEXT) psselect.$(MANEXT) pstops.$(MANEXT) \
  157. !            epsffit.$(MANEXT) psnup.$(MANEXT) getafm.$(MANEXT) \
  158. !            fixfmps.$(MANEXT) fixmacps.$(MANEXT) fixpsditps.$(MANEXT) \
  159. !            fixpspps.$(MANEXT) fixtpps.$(MANEXT) fixwfwps.$(MANEXT) \
  160. !            fixwpps.$(MANEXT) fixwwps.$(MANEXT)
  161.   RM = rm -f
  162.   
  163.   # Definitions for MSDOS
  164.   #exe = .exe
  165.   #obj = .obj
  166. ! #BIN = psbook$(exe) psselect$(exe) pstops$(exe) epsffit$(exe) psnup$(exe)
  167.   #PERLSCRIPTS =
  168.   #INCLUDES =
  169.   #MANPAGES =
  170.   #RM = del
  171.   
  172. ! .SUFFIXES: .man .$(MANEXT)
  173.   
  174. ! .man.$(MANEXT):
  175. !     R=`sed -n "s/.*RELEASE *//p" patchlevel.h`; \
  176. !     P=`sed -n "s/.*PATCHLEVEL *//p" patchlevel.h`; \
  177. !     M=`echo $(MANPAGES) | sed -e "s/\.$(MANEXT)/($(MANEXT)),/g" -e "s/, *$$//"`; \
  178. !     sed -e "s/@PL@/$$P/" -e "s/@REL@/$$R/" -e "s/@MAN@/$$M/" \
  179. !         -e "s/@PAPER@/$(PAPER)/" $< >$@
  180.   
  181. ! all: $(BIN) $(PERLSCRIPTS) $(MANPAGES)
  182.   
  183.   epsffit$(exe): epsffit.c
  184.       $(CC) $(CFLAGS) -o epsffit$(exe) epsffit.c
  185.   
  186.   psnup$(exe): psnup$(obj) psutil$(obj) psspec$(obj)
  187.       $(CC) $(CFLAGS) -o psnup$(exe) psutil$(obj) psspec$(obj) psnup$(obj)
  188.   
  189.   psbook$(exe): psbook$(obj) psutil$(obj)
  190.       $(CC) $(CFLAGS) -o psbook$(exe) psutil$(obj) psbook$(obj)
  191.   
  192. ! psselect$(exe): psselect$(obj) psutil$(obj)
  193. !     $(CC) $(CFLAGS) -o psselect$(exe) psutil$(obj) psselect$(obj)
  194.   
  195. ! pstops$(exe): pstops$(obj) psutil$(obj) psspec$(obj)
  196. !     $(CC) $(CFLAGS) -o pstops$(exe) psutil$(obj) psspec$(obj) pstops$(obj)
  197.   
  198. ! psnup$(obj): psutil.h patchlevel.h psspec.h psnup.c
  199.   
  200. ! psbook$(obj): psutil.h patchlevel.h psbook.c
  201.   
  202. ! pstops$(obj): psutil.h patchlevel.h psspec.h pstops.c
  203.   
  204. ! psselect$(obj): psutil.h patchlevel.h psselect.c
  205.   
  206. ! psutil$(obj): psutil.h patchlevel.h psutil.c
  207.   
  208. ! psspec$(obj): psutil.h patchlevel.h psspec.h psspec.c
  209.   
  210.   fixfmps: fixfmps.pl
  211. !     sed -e "s%@PERL@%$(PERL)%" $? >$@; \
  212.       $(CHMOD) $(BINMODE) $@
  213.   
  214.   fixmacps: fixmacps.pl
  215. !     sed -e "s%@PERL@%$(PERL)%" \
  216. !         -e "s%@INCLUDE@%$(INCLUDEDIR)%" $? >$@; \
  217.       $(CHMOD) $(BINMODE) $@
  218.   
  219.   fixpsditps: fixpsditps.pl
  220. !     sed -e "s%@PERL@%$(PERL)%" $? >$@; \
  221.       $(CHMOD) $(BINMODE) $@
  222.   
  223.   fixpspps: fixpspps.pl
  224. !     sed -e "s%@PERL@%$(PERL)%" $? >$@; \
  225.       $(CHMOD) $(BINMODE) $@
  226.   
  227.   fixtpps: fixtpps.pl
  228. !     sed -e "s%@PERL@%$(PERL)%" $? >$@; \
  229.       $(CHMOD) $(BINMODE) $@
  230.   
  231.   fixwfwps: fixwfwps.pl
  232. !     sed -e "s%@PERL@%$(PERL)%" $? >$@; \
  233.       $(CHMOD) $(BINMODE) $@
  234.   
  235.   fixwpps: fixwpps.pl
  236. !     sed -e "s%@PERL@%$(PERL)%" $? >$@; \
  237.       $(CHMOD) $(BINMODE) $@
  238.   
  239.   fixwwps: fixwwps.pl
  240. !     sed -e "s%@PERL@%$(PERL)%" $? >$@; \
  241.       $(CHMOD) $(BINMODE) $@
  242.   
  243.   clean:
  244.       $(RM) *$(obj)
  245.   
  246. --- 29,197 ----
  247.   # psselect selects page ranges
  248.   # pstops performs general page rearrangement and merging
  249.   # psnup puts multiple logical pages on one physical page
  250. + # psresize scales and moves pages to fit on different paper sizes
  251. + # Do NOT leave "obj" undefined in the definitions below, or "make clean" will
  252. + # remove ALL of the files.
  253.   
  254. ! # definitions for Unix:
  255.   exe =
  256.   obj = .o
  257. ! BIN = psbook psselect pstops epsffit psnup psresize
  258.   SHELLSCRIPTS = getafm
  259.   PERLSCRIPTS = fixfmps fixmacps fixpsditps fixpspps fixtpps fixwfwps fixwpps \
  260. !               fixwwps fixdlsrps extractres includeres
  261.   INCLUDES = md68_0.ps md71_0.ps
  262.   MANPAGES = psbook.$(MANEXT) psselect.$(MANEXT) pstops.$(MANEXT) \
  263. !        epsffit.$(MANEXT) psnup.$(MANEXT) psresize.$(MANEXT) \
  264. !        getafm.$(MANEXT) fixdlsrps.$(MANEXT) fixfmps.$(MANEXT) \
  265. !        fixmacps.$(MANEXT) fixpsditps.$(MANEXT) fixpspps.$(MANEXT) \
  266. !        fixtpps.$(MANEXT) fixwfwps.$(MANEXT) fixwpps.$(MANEXT) \
  267. !        fixwwps.$(MANEXT) extractres.$(MANEXT) includeres.$(MANEXT)
  268.   RM = rm -f
  269.   
  270.   # Definitions for MSDOS
  271.   #exe = .exe
  272.   #obj = .obj
  273. ! #BIN = psbook$(exe) psselect$(exe) pstops$(exe) epsffit$(exe) psnup$(exe) \
  274. ! #      psresize$(exe)
  275.   #PERLSCRIPTS =
  276.   #INCLUDES =
  277.   #MANPAGES =
  278.   #RM = del
  279.   
  280. ! all: $(BIN) $(PERLSCRIPTS) $(MANPAGES)
  281.   
  282. ! psutil$(obj): psutil.h patchlev.h psutil.c
  283.   
  284. ! psspec$(obj): psutil.h patchlev.h psspec.h psspec.c
  285.   
  286.   epsffit$(exe): epsffit.c
  287.       $(CC) $(CFLAGS) -o epsffit$(exe) epsffit.c
  288.   
  289. + epsffit.$(MANEXT): epsffit.man
  290. +     ./maketext MAN="$(MANPAGES)" $? > $@
  291.   psnup$(exe): psnup$(obj) psutil$(obj) psspec$(obj)
  292.       $(CC) $(CFLAGS) -o psnup$(exe) psutil$(obj) psspec$(obj) psnup$(obj)
  293.   
  294. + psnup$(obj): psutil.h patchlev.h psspec.h psnup.c
  295. + psnup.$(MANEXT): psnup.man
  296. +     ./maketext MAN="$(MANPAGES)" PAPER=$(PAPER) $? > $@
  297. + psresize$(exe): psresize$(obj) psutil$(obj) psspec$(obj)
  298. +     $(CC) $(CFLAGS) -o psresize$(exe) psutil$(obj) psspec$(obj) psresize$(obj)
  299. + psresize$(obj): psutil.h patchlev.h psspec.h psresize.c
  300. + psresize.$(MANEXT): psresize.man
  301. +     ./maketext MAN="$(MANPAGES)" PAPER=$(PAPER) $? > $@
  302.   psbook$(exe): psbook$(obj) psutil$(obj)
  303.       $(CC) $(CFLAGS) -o psbook$(exe) psutil$(obj) psbook$(obj)
  304.   
  305. ! psbook$(obj): psutil.h patchlev.h psbook.c
  306.   
  307. ! psbook.$(MANEXT): psbook.man
  308. !     ./maketext "MAN=$(MANPAGES)" $? > $@
  309.   
  310. ! psselect$(exe): psselect$(obj) psutil$(obj)
  311. !     $(CC) $(CFLAGS) -o psselect$(exe) psutil$(obj) psselect$(obj)
  312.   
  313. ! psselect$(obj): psutil.h patchlev.h psselect.c
  314.   
  315. ! psselect.$(MANEXT): psselect.man
  316. !     ./maketext "MAN=$(MANPAGES)" $? > $@
  317.   
  318. ! pstops$(exe): pstops$(obj) psutil$(obj) psspec$(obj)
  319. !     $(CC) $(CFLAGS) -o pstops$(exe) psutil$(obj) psspec$(obj) pstops$(obj)
  320.   
  321. ! pstops$(obj): psutil.h patchlev.h psspec.h pstops.c
  322.   
  323. ! pstops.$(MANEXT): pstops.man
  324. !     ./maketext "MAN=$(MANPAGES)" PAPER=$(PAPER) $? > $@
  325.   
  326.   fixfmps: fixfmps.pl
  327. !     ./maketext PERL=$(PERL) $? >$@;
  328.       $(CHMOD) $(BINMODE) $@
  329.   
  330. + fixfmps.$(MANEXT): fixfmps.man
  331. +     ./maketext "MAN=$(MANPAGES)" $? > $@
  332.   fixmacps: fixmacps.pl
  333. !     ./maketext PERL=$(PERL) INCLUDE=$(INCLUDEDIR) $? >$@;
  334.       $(CHMOD) $(BINMODE) $@
  335.   
  336. + fixmacps.$(MANEXT): fixmacps.man
  337. +     ./maketext "MAN=$(MANPAGES)" INCLUDE=$(INCLUDEDIR) $? > $@
  338.   fixpsditps: fixpsditps.pl
  339. !     ./maketext PERL=$(PERL) $? >$@;
  340.       $(CHMOD) $(BINMODE) $@
  341.   
  342. + fixpsditps.$(MANEXT): fixpsditps.man
  343. +     ./maketext "MAN=$(MANPAGES)" $? > $@
  344.   fixpspps: fixpspps.pl
  345. !     ./maketext PERL=$(PERL) $? >$@;
  346.       $(CHMOD) $(BINMODE) $@
  347.   
  348. + fixpspps.$(MANEXT): fixpspps.man
  349. +     ./maketext "MAN=$(MANPAGES)" $? > $@
  350.   fixtpps: fixtpps.pl
  351. !     ./maketext PERL=$(PERL) $? >$@;
  352.       $(CHMOD) $(BINMODE) $@
  353.   
  354. + fixtpps.$(MANEXT): fixtpps.man
  355. +     ./maketext "MAN=$(MANPAGES)" $? > $@
  356.   fixwfwps: fixwfwps.pl
  357. !     ./maketext PERL=$(PERL) $? >$@;
  358.       $(CHMOD) $(BINMODE) $@
  359.   
  360. + fixwfwps.$(MANEXT): fixwfwps.man
  361. +     ./maketext "MAN=$(MANPAGES)" $? > $@
  362.   fixwpps: fixwpps.pl
  363. !     ./maketext PERL=$(PERL) $? >$@;
  364.       $(CHMOD) $(BINMODE) $@
  365.   
  366. + fixwpps.$(MANEXT): fixwpps.man
  367. +     ./maketext "MAN=$(MANPAGES)" $? > $@
  368.   fixwwps: fixwwps.pl
  369. !     ./maketext PERL=$(PERL) $? >$@;
  370. !     $(CHMOD) $(BINMODE) $@
  371. ! fixwwps.$(MANEXT): fixwwps.man
  372. !     ./maketext "MAN=$(MANPAGES)" $? > $@
  373. ! fixdlsrps: fixdlsrps.pl
  374. !     ./maketext PERL=$(PERL) $? >$@;
  375.       $(CHMOD) $(BINMODE) $@
  376.   
  377. + fixdlsrps.$(MANEXT): fixdlsrps.man
  378. +     ./maketext "MAN=$(MANPAGES)" $? > $@
  379. + extractres: extractres.pl
  380. +     ./maketext PERL=$(PERL) $? >$@;
  381. +     $(CHMOD) $(BINMODE) $@
  382. + extractres.$(MANEXT): extractres.man
  383. +     ./maketext "MAN=$(MANPAGES)" $? > $@
  384. + includeres: includeres.pl
  385. +     ./maketext PERL=$(PERL) INCLUDE=$(INCLUDEDIR) $? >$@;
  386. +     $(CHMOD) $(BINMODE) $@
  387. + includeres.$(MANEXT): includeres.man
  388. +     ./maketext "MAN=$(MANPAGES)" INCLUDE=$(INCLUDEDIR) $? > $@
  389. + getafm.$(MANEXT): getafm.man
  390. +     ./maketext "MAN=$(MANPAGES)" $? > $@
  391.   clean:
  392.       $(RM) *$(obj)
  393.   
  394. ***************
  395. *** 150,153 ****
  396.           echo Installing manual page for $$i; \
  397.           $(INSTALLMAN) $$i $(MANDIR)/$$i; \
  398.       done
  399. --- 223,225 ----
  400. diff -cr +new-file psutils-dist/Manifest psutils-next/Manifest
  401. *** psutils-dist/Manifest    Mon Nov 29 10:34:24 1993
  402. --- psutils-next/Manifest    Mon Nov 29 18:47:08 1993
  403. ***************
  404. *** 1,12 ****
  405. --- 1,17 ----
  406.   LICENSE
  407.   Makefile
  408.   Manifest
  409. + maketext
  410.   README
  411.   descrip.mms
  412.   epsffit.c
  413.   epsffit.man
  414. + extractres.man
  415. + extractres.pl
  416.   fixfmps.man
  417.   fixfmps.pl
  418. + fixdlsrps.man
  419. + fixdlsrps.pl
  420.   fixmacps.man
  421.   fixmacps.pl
  422.   fixpsditps.man
  423. ***************
  424. *** 23,35 ****
  425.   fixwwps.pl
  426.   getafm
  427.   getafm.man
  428.   md68_0.uue
  429.   md71_0.uue
  430. ! patchlevel.h
  431.   psbook.c
  432.   psbook.man
  433.   psnup.c
  434.   psnup.man
  435.   psselect.c
  436.   psselect.man
  437.   psspec.c
  438. --- 28,44 ----
  439.   fixwwps.pl
  440.   getafm
  441.   getafm.man
  442. + includeres.man
  443. + includeres.pl
  444.   md68_0.uue
  445.   md71_0.uue
  446. ! patchlev.h
  447.   psbook.c
  448.   psbook.man
  449.   psnup.c
  450.   psnup.man
  451. + psresize.c
  452. + psresize.man
  453.   psselect.c
  454.   psselect.man
  455.   psspec.c
  456. diff -cr +new-file psutils-dist/README psutils-next/README
  457. *** psutils-dist/README    Mon Nov 29 10:34:24 1993
  458. --- psutils-next/README    Mon Nov 29 20:54:17 1993
  459. ***************
  460. *** 1,4 ****
  461. ! PostScript Utilities            Angus Duggan                7 June 1993
  462.   
  463.   This shar file contains some utilities for manipulating PostScript documents.
  464.   Page selection and rearrangement are supported, including arrangement into
  465. --- 1,4 ----
  466. ! PostScript Utilities            Angus Duggan               29 November 1993
  467.   
  468.   This shar file contains some utilities for manipulating PostScript documents.
  469.   Page selection and rearrangement are supported, including arrangement into
  470. ***************
  471. *** 15,61 ****
  472.   FILES
  473.   
  474.   The files contained are:
  475. ! -rw-r--r--  1 ajcd         1945 Jun  7 15:40 LICENSE
  476. ! -rw-r--r--  1 ajcd         3367 Jun  7 11:30 Makefile
  477. ! -rw-r--r--  1 ajcd          432 Jun  7 11:33 Manifest
  478. ! -rw-r--r--  1 ajcd         6295 Jun  7 15:40 README
  479. ! -rw-r--r--  1 ajcd         1864 Jun  5 16:31 descrip.mms
  480. ! -rw-r--r--  1 ajcd         4431 Jun  5 11:05 epsffit.c
  481. ! -rw-r--r--  1 ajcd         1045 Jun  7 11:01 epsffit.man
  482. ! -rw-r--r--  1 ajcd          538 Apr  9 22:33 fixfmps.man
  483. ! -rw-r--r--  1 ajcd          419 Apr  9 17:14 fixfmps.pl
  484. ! -rw-r--r--  1 ajcd          559 Apr  9 22:35 fixmacps.man
  485. ! -rw-r--r--  1 ajcd         1751 Jun  7 11:30 fixmacps.pl
  486. ! -rw-r--r--  1 ajcd          564 Apr  9 22:35 fixpsditps.man
  487. ! -rw-r--r--  1 ajcd          596 Apr  9 17:15 fixpsditps.pl
  488. ! -rw-r--r--  1 ajcd          533 Apr  9 22:35 fixpspps.man
  489. ! -rw-r--r--  1 ajcd         1236 Apr  9 17:15 fixpspps.pl
  490. ! -rw-r--r--  1 ajcd          551 Apr  9 22:32 fixtpps.man
  491. ! -rw-r--r--  1 ajcd          602 Apr  9 22:31 fixtpps.pl
  492. ! -rw-r--r--  1 ajcd          556 Apr  9 22:36 fixwfwps.man
  493. ! -rw-r--r--  1 ajcd          318 Apr  9 17:15 fixwfwps.pl
  494. ! -rw-r--r--  1 ajcd          544 Apr  9 22:36 fixwpps.man
  495. ! -rw-r--r--  1 ajcd          669 May  5 13:54 fixwpps.pl
  496. ! -rw-r--r--  1 ajcd          542 Apr 22 12:38 fixwwps.man
  497. ! -rw-r--r--  1 ajcd          364 Apr 22 12:37 fixwwps.pl
  498. ! -rwxr-xr-x  1 ajcd         6124 Jun  7 15:25 getafm
  499. ! -rw-r--r--  1 ajcd          702 Jun  7 15:38 getafm.man
  500. ! -rw-r--r--  1 ajcd        42798 May  6 09:16 md68_0.uue
  501. ! -rw-r--r--  1 ajcd        48726 May  6 09:16 md71_0.uue
  502. ! -rw-r--r--  1 ajcd           40 Apr  9 21:03 patchlevel.h
  503. ! -rw-r--r--  1 ajcd         2155 Jun  4 15:23 psbook.c
  504. ! -rw-r--r--  1 ajcd         1059 Mar 31 15:33 psbook.man
  505. ! -rw-r--r--  1 ajcd         6967 Jun  7 10:29 psnup.c
  506. ! -rw-r--r--  1 ajcd         2578 Jun  7 11:28 psnup.man
  507. ! -rw-r--r--  1 ajcd         5298 Jun  4 15:24 psselect.c
  508. ! -rw-r--r--  1 ajcd         1893 Mar 31 15:33 psselect.man
  509. ! -rw-r--r--  1 ajcd         6682 Jun  5 16:49 psspec.c
  510. ! -rw-r--r--  1 ajcd          604 Jun  5 13:38 psspec.h
  511. ! -rw-r--r--  1 ajcd         4215 Jun  5 13:04 pstops.c
  512. ! -rw-r--r--  1 ajcd         3512 Jun  7 10:43 pstops.man
  513. ! -rw-r--r--  1 ajcd         8195 Jun  5 16:43 psutil.c
  514. ! -rw-r--r--  1 ajcd          988 Jun  5 14:48 psutil.h
  515. ! -rwxr-xr-x  1 ajcd         2552 Feb 10 12:47 showchar
  516.   
  517.   PROGRAMS
  518.   
  519. --- 15,70 ----
  520.   FILES
  521.   
  522.   The files contained are:
  523. ! -rw-r--r--  1 angus        1919 Nov 29 18:50 LICENSE
  524. ! -rw-r--r--  1 angus        6003 Nov 29 17:38 Makefile
  525. ! -rw-r--r--  1 angus         559 Nov 29 18:47 Manifest
  526. ! -rw-r--r--  1 angus        8354 Nov 29 20:52 README
  527. ! -rw-r--r--  1 angus        2083 Nov 29 20:44 descrip.mms
  528. ! -rw-r--r--  1 angus        5013 Nov 29 17:02 epsffit.c
  529. ! -rw-r--r--  1 angus        1210 Nov 27 14:28 epsffit.man
  530. ! -rw-r--r--  1 angus        1159 Nov 27 14:28 extractres.man
  531. ! -rw-r--r--  1 angus        2687 Nov 19 22:14 extractres.pl
  532. ! -rw-r--r--  1 angus         507 Nov 27 14:28 fixdlsrps.man
  533. ! -rw-r--r--  1 angus        1220 Nov 20 00:30 fixdlsrps.pl
  534. ! -rw-r--r--  1 angus         473 Nov 27 14:28 fixfmps.man
  535. ! -rw-r--r--  1 angus         431 Oct 27 18:07 fixfmps.pl
  536. ! -rw-r--r--  1 angus         587 Nov 27 14:28 fixmacps.man
  537. ! -rw-r--r--  1 angus        2043 Oct 27 18:07 fixmacps.pl
  538. ! -rw-r--r--  1 angus         502 Nov 27 14:28 fixpsditps.man
  539. ! -rw-r--r--  1 angus         596 Oct 27 18:07 fixpsditps.pl
  540. ! -rw-r--r--  1 angus         469 Nov 27 14:28 fixpspps.man
  541. ! -rw-r--r--  1 angus        1236 Oct 27 18:07 fixpspps.pl
  542. ! -rw-r--r--  1 angus         499 Nov 27 14:28 fixtpps.man
  543. ! -rw-r--r--  1 angus         602 Oct 27 18:07 fixtpps.pl
  544. ! -rw-r--r--  1 angus         493 Nov 27 14:28 fixwfwps.man
  545. ! -rw-r--r--  1 angus         794 Nov  9 22:57 fixwfwps.pl
  546. ! -rw-r--r--  1 angus         479 Nov 27 14:28 fixwpps.man
  547. ! -rw-r--r--  1 angus         669 Oct 27 18:07 fixwpps.pl
  548. ! -rw-r--r--  1 angus         477 Nov 27 14:29 fixwwps.man
  549. ! -rw-r--r--  1 angus         364 Oct 27 18:07 fixwwps.pl
  550. ! -rw-r--r--  1 angus        6124 Oct 27 18:08 getafm
  551. ! -rw-r--r--  1 angus         711 Nov 27 14:29 getafm.man
  552. ! -rw-r--r--  1 angus        1035 Nov 27 14:29 includeres.man
  553. ! -rw-r--r--  1 angus        1392 Nov 19 21:10 includeres.pl
  554. ! -rwxr-xr-x  1 angus         901 Nov 29 17:02 maketext
  555. ! -rw-r--r--  1 angus       30969 Oct 27 18:08 md68_0.ps
  556. ! -rw-r--r--  1 angus       35273 Oct 27 18:08 md71_0.ps
  557. ! -rw-r--r--  1 angus          40 Oct 27 18:09 patchlev.h
  558. ! -rw-r--r--  1 angus        2168 Nov 29 17:02 psbook.c
  559. ! -rw-r--r--  1 angus        1084 Nov 27 14:29 psbook.man
  560. ! -rw-r--r--  1 angus        8793 Nov 29 17:23 psnup.c
  561. ! -rw-r--r--  1 angus        3565 Nov 29 20:52 psnup.man
  562. ! -rw-r--r--  1 angus        4808 Nov 29 20:19 psresize.c
  563. ! -rw-r--r--  1 angus        1585 Nov 29 20:28 psresize.man
  564. ! -rw-r--r--  1 angus        5310 Nov 29 17:03 psselect.c
  565. ! -rw-r--r--  1 angus        1920 Nov 27 14:29 psselect.man
  566. ! -rw-r--r--  1 angus        7393 Nov 29 20:18 psspec.c
  567. ! -rw-r--r--  1 angus         602 Oct 27 18:09 psspec.h
  568. ! -rw-r--r--  1 angus        4386 Nov 29 17:03 pstops.c
  569. ! -rw-r--r--  1 angus        3895 Nov 27 14:09 pstops.man
  570. ! -rw-r--r--  1 angus        9697 Nov 29 19:39 psutil.c
  571. ! -rw-r--r--  1 angus        1071 Nov 27 13:19 psutil.h
  572. ! -rw-r--r--  1 angus        2567 Oct 27 18:09 showchar
  573.   
  574.   PROGRAMS
  575.   
  576. ***************
  577. *** 63,68 ****
  578. --- 72,78 ----
  579.   psselect        selects pages and page ranges
  580.   pstops          performs general page rearrangement and selection
  581.   psnup           put multiple pages per physical sheet of paper
  582. + psresize        alter document paper size
  583.   epsffit         fits an EPSF file to a given bounding box
  584.   
  585.   psselect in modeled after Chris Torek's dviselect program, and pstops is
  586. ***************
  587. *** 73,78 ****
  588. --- 83,89 ----
  589.   
  590.   getafm   (sh)   outputs PostScript to retrieve AFM file from printer
  591.   showchar (sh)   outputs PostScript to draw a character with metric info
  592. + fixdlsrps (perl) filter to fix DviLaser/PS output so that PSUtils works
  593.   fixfmps  (perl) filter to fix framemaker documents so that psselect etc. work
  594.   fixmacps (perl) filter to fix Macintosh documents with saner version of md
  595.   fixpsditps (perl) filter to fix Transcript psdit documents to work with PSUtils
  596. ***************
  597. *** 81,92 ****
  598.   fixwfwps (perl) filter to fix Word for Windows documents for PSUtils
  599.   fixwpps  (perl) filter to fix WordPerfect documents for PSUtils
  600.   fixwwps  (perl) filter to fix Windows Write documents for PSUtils
  601.   
  602.   INSTALLATION
  603.   
  604. ! UUdecode md71_0.uue and md68_0.uue (if supplied encoded), edit Makefile to put
  605. ! in required paths and CFLAGS (-DSYSV for System V machines, -DMSDOS for
  606. ! Messy-DOS, -DVMS for VMS), "make", and "make install".
  607.   
  608.   BUGS
  609.   
  610. --- 92,107 ----
  611.   fixwfwps (perl) filter to fix Word for Windows documents for PSUtils
  612.   fixwpps  (perl) filter to fix WordPerfect documents for PSUtils
  613.   fixwwps  (perl) filter to fix Windows Write documents for PSUtils
  614. + extractres (perl) filter to extract resources from PostScript files
  615. + includeres (perl) filter to include resources into PostScript files
  616.   
  617.   INSTALLATION
  618.   
  619. ! UUdecode md71_0.uue and md68_0.uue (if supplied encoded). Edit Makefile to put
  620. ! in required paths for BINDIR, SCRIPTDIR, MANDIR, INCLUDEDIR, an PERL. Alter
  621. ! values of MANEXT to put the manual pages in a different section if desired,
  622. ! change PAPER to set the default paper size, and CFLAGS (-DSYSV for System V
  623. ! machines, -DMSDOS for Messy-DOS, -DVMS for VMS). "make", and "make install".
  624.   
  625.   BUGS
  626.   
  627. ***************
  628. *** 94,100 ****
  629.   conform. Utilities need an extra save/restore around whole document on a
  630.   SPARCPrinter with NeWSPrint 1.0, because of bugs in the xnews server.
  631.   
  632. ! Bug fixes and suggestions to ajcd@dcs.ed.ac.uk
  633.   
  634.   NOTE
  635.   
  636. --- 109,115 ----
  637.   conform. Utilities need an extra save/restore around whole document on a
  638.   SPARCPrinter with NeWSPrint 1.0, because of bugs in the xnews server.
  639.   
  640. ! Bug fixes and suggestions to angus@harlequin.co.uk
  641.   
  642.   NOTE
  643.   
  644. ***************
  645. *** 122,127 ****
  646. --- 137,143 ----
  647.           Matthew Stier           Matthew.Stier@East.Sun.com
  648.           Gerry Pratt             cca13@seq1.kl.ac.uk
  649.           Robert Joop             rj@rainbow.in-berlin.de
  650. +     Johan Vromans        jv@mh.nl
  651.   
  652.   (Apologies to anyone who I have left out.)
  653.   
  654. ***************
  655. *** 136,138 ****
  656. --- 152,176 ----
  657.   * Epsffit can input broken %%BoundingBox comments which use real numbers.
  658.   * Should work on MSDOS and VMS machines as well as Unix.
  659.   * Accept more DSC compliant documents (Page labels are better supported).
  660. + Patchlevel 12 was a bug-fix release.
  661. + * Long standing fixmacps bug fixed.
  662. + * fixwfwps fixes WFW EPSF files as well as DSC files.
  663. + * md71_0.ps and md68_0.ps files were automatically uudecoded.
  664. + Patchlevel 13 contained two new scripts for resource management, and fixes to
  665. + the Makefile, page labels, and output chaining.
  666. + * Epsffit can output to a file as well as standard output.
  667. + * extractres takes resources out of PostScript files and saves them
  668. + * includeres puts resources from a resource library into PostScript files.
  669. + * maketext script is now used to do substitutions in Perl scripts and man pages
  670. + * page labels in psnup and pstops are now show where pages came from.
  671. + * page labels in psbook and psselect fixed.
  672. + * prologues fixed to be extractable and re-usable
  673. + * Makefile doesn't use SUFFIXES any more
  674. + * pstops and psnup output can now be chained through each other.
  675. + * psresize alters the paper size used by a document
  676. + * patchlevel.h shortened to patchlev.h as a concession to MSDOS
  677. + * psnup now has -n nup form for compatibility with other n-up programs
  678. diff -cr +new-file psutils-dist/descrip.mms psutils-next/descrip.mms
  679. *** psutils-dist/descrip.mms    Mon Nov 29 10:34:25 1993
  680. --- psutils-next/descrip.mms    Mon Nov 29 20:44:00 1993
  681. ***************
  682. *** 23,29 ****
  683.   # pstops performs general page rearrangement and merging
  684.   # psnup puts multiple logical pages on one physical page
  685.   
  686. ! all : psbook$(exe), psselect$(exe), pstops$(exe), epsffit$(exe), psnup$(exe)
  687.           @ write sys$output "PSUTILS build complete"
  688.   
  689.   epsffit$(exe) : epsffit$(obj)$(options_file)
  690. --- 23,29 ----
  691.   # pstops performs general page rearrangement and merging
  692.   # psnup puts multiple logical pages on one physical page
  693.   
  694. ! all : psbook$(exe), psselect$(exe), pstops$(exe), epsffit$(exe), psnup$(exe), psresize$(exe)
  695.           @ write sys$output "PSUTILS build complete"
  696.   
  697.   epsffit$(exe) : epsffit$(obj)$(options_file)
  698. ***************
  699. *** 32,37 ****
  700. --- 32,40 ----
  701.   psnup$(exe) :   psnup$(obj), psutil$(obj), psspec$(obj)
  702.           $(LINK)$(LFLAGS) psnup$(obj),psutil$(obj),psspec$(obj)$(linkopt)
  703.   
  704. + psresize$(exe) :   psresize$(obj), psutil$(obj), psspec$(obj)
  705. +         $(LINK)$(LFLAGS) psresize$(obj),psutil$(obj),psspec$(obj)$(linkopt)
  706.   psbook$(exe) :  psbook$(obj), psutil$(obj)$(options_file)
  707.           $(LINK)$(LFLAGS) psbook$(obj),psutil$(obj)$(linkopt)
  708.   
  709. ***************
  710. *** 41,60 ****
  711.   pstops$(exe) :  pstops$(obj), psutil$(obj), psspec$(obj)
  712.           $(LINK)$(LFLAGS) pstops$(obj),psutil$(obj),psspec$(obj)$(linkopt)
  713.   
  714. ! psnup$(obj)  : psnup.c, psutil.h patchlevel.h psspec.h
  715.   
  716. ! psbook$(obj) : psbook.c, psutil.h patchlevel.h
  717.   
  718. ! pstops$(obj) : pstops.c, psutil.h patchlevel.h psspec.h
  719.   
  720. ! psutil$(obj) : psutil.c, psutil.h patchlevel.h
  721.   
  722. ! psselect$(obj) : psselect.c, psutil.h patchlevel.h
  723.   
  724. ! psspec$(obj) : psspec.c, psutil.h patchlevel.h psspec.h
  725.   
  726.   clean :
  727. !         delete/log *$(obj);*,psnup$(exe);*,psbook$(exe);*,-
  728.                   psselect$(exe);*,pstops$(exe);*,epsffit$(exe);*
  729.   
  730.   
  731. --- 44,65 ----
  732.   pstops$(exe) :  pstops$(obj), psutil$(obj), psspec$(obj)
  733.           $(LINK)$(LFLAGS) pstops$(obj),psutil$(obj),psspec$(obj)$(linkopt)
  734.   
  735. ! psnup$(obj)  : psnup.c, psutil.h patchlev.h psspec.h
  736. ! psresize$(obj)  : psresize.c, psutil.h patchlev.h psspec.h
  737.   
  738. ! psbook$(obj) : psbook.c, psutil.h patchlev.h
  739.   
  740. ! pstops$(obj) : pstops.c, psutil.h patchlev.h psspec.h
  741.   
  742. ! psutil$(obj) : psutil.c, psutil.h patchlev.h
  743.   
  744. ! psselect$(obj) : psselect.c, psutil.h patchlev.h
  745.   
  746. ! psspec$(obj) : psspec.c, psutil.h patchlev.h psspec.h
  747.   
  748.   clean :
  749. !         delete/log *$(obj);*,psnup$(exe);*,psresize$(exe);*,psbook$(exe);*,-
  750.                   psselect$(exe);*,pstops$(exe);*,epsffit$(exe);*
  751.   
  752.   
  753. diff -cr +new-file psutils-dist/epsffit.c psutils-next/epsffit.c
  754. *** psutils-dist/epsffit.c    Mon Nov 29 10:34:39 1993
  755. --- psutils-next/epsffit.c    Mon Nov 29 17:02:05 1993
  756. ***************
  757. *** 2,8 ****
  758.    * AJCD 6 Dec 90
  759.    * fit epsf file into constrained size
  760.    * Usage:
  761. !  *       epsffit [-c] [-r] [-a] [-s] llx lly urx ury [file]
  762.    *               -c centres the image in the bounding box given
  763.    *               -r rotates the image by 90 degrees anti-clockwise
  764.    *               -a alters the aspect ratio to fit the bounding box
  765. --- 2,8 ----
  766.    * AJCD 6 Dec 90
  767.    * fit epsf file into constrained size
  768.    * Usage:
  769. !  *       epsffit [-c] [-r] [-a] [-s] llx lly urx ury [infile [outfile]]
  770.    *               -c centres the image in the bounding box given
  771.    *               -r rotates the image by 90 degrees anti-clockwise
  772.    *               -a alters the aspect ratio to fit the bounding box
  773. ***************
  774. *** 16,22 ****
  775.   
  776.   #include <stdio.h>
  777.   #include <ctype.h>
  778. ! #include "patchlevel.h"
  779.   
  780.   #define min(x,y) ((x) > (y) ? (y) : (x))
  781.   #define max(x,y) ((x) > (y) ? (x) : (y))
  782. --- 16,22 ----
  783.   
  784.   #include <stdio.h>
  785.   #include <ctype.h>
  786. ! #include "patchlev.h"
  787.   
  788.   #define min(x,y) ((x) > (y) ? (y) : (x))
  789.   #define max(x,y) ((x) > (y) ? (x) : (y))
  790. ***************
  791. *** 26,32 ****
  792.   void usage()
  793.   {
  794.      fprintf(stderr, "%s release %d patchlevel %d\n", prog, RELEASE, PATCHLEVEL);
  795. !    fprintf(stderr, "Usage: %s [-c] [-r] [-a] [-s] llx lly urx ury [file]\n",
  796.          prog);
  797.      exit(1);
  798.   }
  799. --- 26,32 ----
  800.   void usage()
  801.   {
  802.      fprintf(stderr, "%s release %d patchlevel %d\n", prog, RELEASE, PATCHLEVEL);
  803. !    fprintf(stderr, "Usage: %s [-c] [-r] [-a] [-s] llx lly urx ury [infile [outfile]]\n",
  804.          prog);
  805.      exit(1);
  806.   }
  807. ***************
  808. *** 41,46 ****
  809. --- 41,47 ----
  810.      int showpage = 0, centre = 0, rotate = 0, aspect = 0, maximise = 0;
  811.      char buf[BUFSIZ];
  812.      FILE *input = stdin;
  813. +    FILE *output = stdout;
  814.   
  815.      prog = *argv++; argc--;
  816.   
  817. ***************
  818. *** 58,64 ****
  819.         argv++;
  820.      }
  821.   
  822. !    if (argc < 4) usage();
  823.      fllx = atoi(argv[0]);
  824.      flly = atoi(argv[1]);
  825.      furx = atoi(argv[2]);
  826. --- 59,65 ----
  827.         argv++;
  828.      }
  829.   
  830. !    if (argc < 4 || argc > 6) usage();
  831.      fllx = atoi(argv[0]);
  832.      flly = atoi(argv[1]);
  833.      furx = atoi(argv[2]);
  834. ***************
  835. *** 65,75 ****
  836.      fury = atoi(argv[3]);
  837.   
  838.      if (argc > 4) {
  839. !       if(!(input = fopen(argv[4],"r"))) {
  840. !      fprintf(stderr, "%s: Cannot open %s\n", prog, argv[4]);
  841.        exit(1);
  842.         }
  843.      }
  844.   
  845.      while (fgets(buf, BUFSIZ, input)) {
  846.         if (buf[0] == '%' && (buf[1] == '%' || buf[1] == '!')) {
  847. --- 66,82 ----
  848.      fury = atoi(argv[3]);
  849.   
  850.      if (argc > 4) {
  851. !       if(!(input = fopen(argv[4], "r"))) {
  852. !      fprintf(stderr, "%s: can't open input file %s\n", prog, argv[4]);
  853.        exit(1);
  854.         }
  855.      }
  856. +    if (argc > 5) {
  857. +       if(!(output = fopen(argv[5], "w"))) {
  858. +      fprintf(stderr, "%s: can't open output file %s\n", prog, argv[5]);
  859. +      exit(1);
  860. +       }
  861. +    }
  862.   
  863.      while (fgets(buf, BUFSIZ, input)) {
  864.         if (buf[0] == '%' && (buf[1] == '%' || buf[1] == '!')) {
  865. ***************
  866. *** 87,93 ****
  867.        } else if (!strncmp(buf, "%%EndComments", 13)) {
  868.           strcpy(buf, "\n"); /* don't repeat %%EndComments */
  869.           break;
  870. !      } else fputs(buf,stdout);
  871.         } else break;
  872.      }
  873.   
  874. --- 94,100 ----
  875.        } else if (!strncmp(buf, "%%EndComments", 13)) {
  876.           strcpy(buf, "\n"); /* don't repeat %%EndComments */
  877.           break;
  878. !      } else fputs(buf, output);
  879.         } else break;
  880.      }
  881.   
  882. ***************
  883. *** 127,133 ****
  884.           yoffset += (fheight - height)/2;
  885.        }
  886.         }
  887. !       printf("%%%%BoundingBox: %d %d %d %d\n", (int)xoffset, (int)yoffset,
  888.            (int)(xoffset+(rotate ? height : width)),
  889.            (int)(yoffset+(rotate ? width : height)));
  890.         if (rotate) {  /* compensate for original image shift */
  891. --- 134,141 ----
  892.           yoffset += (fheight - height)/2;
  893.        }
  894.         }
  895. !       fprintf(output, 
  896. !           "%%%%BoundingBox: %d %d %d %d\n", (int)xoffset, (int)yoffset,
  897.            (int)(xoffset+(rotate ? height : width)),
  898.            (int)(yoffset+(rotate ? width : height)));
  899.         if (rotate) {  /* compensate for original image shift */
  900. ***************
  901. *** 137,162 ****
  902.        xoffset -= llx * xscale;
  903.        yoffset -= lly * yscale;
  904.         }
  905. !       puts("%%EndComments");
  906.         if (showpage)
  907. !      puts("save /showpage{}def /copypage{}def /erasepage{}def");
  908.         else
  909. !      puts("%%BeginProcSet: epsffit 1 0");
  910. !       puts("gsave");
  911. !       printf("%.3lf %.3lf translate\n", xoffset, yoffset);
  912.         if (rotate)
  913. !      puts("90 rotate");
  914. !       printf("%.3lf %.3lf scale\n", xscale, yscale);
  915.         if (!showpage)
  916. !      puts("%%EndProcSet");
  917.      }
  918.      do {
  919. !       fputs(buf,stdout);
  920.      } while (fgets(buf, BUFSIZ, input));
  921.      if (bbfound) {
  922. !       puts("grestore");
  923.         if (showpage)
  924. !      puts("restore showpage"); /* just in case */
  925.      } else {
  926.         fprintf(stderr, "%s: no %%%%BoundingBox:\n", prog);
  927.         exit(1);
  928. --- 145,170 ----
  929.        xoffset -= llx * xscale;
  930.        yoffset -= lly * yscale;
  931.         }
  932. !       fputs("%%EndComments\n", output);
  933.         if (showpage)
  934. !      fputs("save /showpage{}def /copypage{}def /erasepage{}def\n", output);
  935.         else
  936. !      fputs("%%BeginProcSet: epsffit 1 0\n", output);
  937. !       fputs("gsave\n", output);
  938. !       fprintf(output, "%.3lf %.3lf translate\n", xoffset, yoffset);
  939.         if (rotate)
  940. !      fputs("90 rotate\n", output);
  941. !       fprintf(output, "%.3lf %.3lf scale\n", xscale, yscale);
  942.         if (!showpage)
  943. !      fputs("%%EndProcSet\n", output);
  944.      }
  945.      do {
  946. !       fputs(buf, output);
  947.      } while (fgets(buf, BUFSIZ, input));
  948.      if (bbfound) {
  949. !       fputs("grestore\n", output);
  950.         if (showpage)
  951. !      fputs("restore showpage\n", output); /* just in case */
  952.      } else {
  953.         fprintf(stderr, "%s: no %%%%BoundingBox:\n", prog);
  954.         exit(1);
  955. diff -cr +new-file psutils-dist/epsffit.man psutils-next/epsffit.man
  956. *** psutils-dist/epsffit.man    Mon Nov 29 10:34:25 1993
  957. --- psutils-next/epsffit.man    Sat Nov 27 14:28:24 1993
  958. ***************
  959. *** 1,4 ****
  960. ! .TH EPSFFIT 1 "PSUtils Release @REL@ Patchlevel @PL@"
  961.   .SH NAME
  962.   epsffit \- fit encapsulated PostScript file (EPSF) into constrained size
  963.   .SH SYNOPSIS
  964. --- 1,4 ----
  965. ! .TH EPSFFIT 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  966.   .SH NAME
  967.   epsffit \- fit encapsulated PostScript file (EPSF) into constrained size
  968.   .SH SYNOPSIS
  969. ***************
  970. *** 16,23 ****
  971.   ]
  972.   .I "llx lly urx ury"
  973.   [
  974. ! .B file
  975. ! ]
  976.   .SH DESCRIPTION
  977.   .I Epsffit
  978.   fits an EPSF file (encapsulated PostScript) to a given bounding box.
  979. --- 16,25 ----
  980.   ]
  981.   .I "llx lly urx ury"
  982.   [
  983. ! .B infile
  984. ! [
  985. ! .B outfile
  986. ! ] ]
  987.   .SH DESCRIPTION
  988.   .I Epsffit
  989.   fits an EPSF file (encapsulated PostScript) to a given bounding box.
  990. ***************
  991. *** 24,32 ****
  992.   The coordinates of the box are given by \fB(llx,lly)\fR for the lower
  993.   left, and \fB(urx,ury)\fR for the upper right, in PostScript units (points).
  994.   .PP
  995. ! If no file is specified,
  996.   .I epsffit
  997. ! uses the standard input. Output is always to the standard output.
  998.   .SH OPTIONS
  999.   .IP \fB\-c\fP 1i
  1000.   Center the image in the given bounding box.
  1001. --- 26,34 ----
  1002.   The coordinates of the box are given by \fB(llx,lly)\fR for the lower
  1003.   left, and \fB(urx,ury)\fR for the upper right, in PostScript units (points).
  1004.   .PP
  1005. ! If no input or output files are specified,
  1006.   .I epsffit
  1007. ! read from the standard input and writes to the standard output.
  1008.   .SH OPTIONS
  1009.   .IP \fB\-c\fP 1i
  1010.   Center the image in the given bounding box.
  1011. diff -cr +new-file psutils-dist/extractres.man psutils-next/extractres.man
  1012. *** psutils-dist/extractres.man
  1013. --- psutils-next/extractres.man    Sat Nov 27 14:28:29 1993
  1014. ***************
  1015. *** 0 ****
  1016. --- 1,47 ----
  1017. + .TH EXTRACTRES 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1018. + .SH NAME
  1019. + extractres \- filter to extract resources from a PostScript document
  1020. + .SH SYNOPSIS
  1021. + .B extractres 
  1022. + [
  1023. + .B \-m
  1024. + ] < 
  1025. + .I document.ps
  1026. + >
  1027. + .I output.ps
  1028. + .SH DESCRIPTION
  1029. + .I Extractres
  1030. + extracts resources (fonts, procsets, patterns, files, etc) appearing in a
  1031. + PostScript document, and puts appropriate
  1032. + .I %%IncludeResource
  1033. + comments in the document prologue. The extracted resources are written to
  1034. + files with the same name as the resource, and an appropriate extension. The
  1035. + pipeline
  1036. + .sp
  1037. + .ce
  1038. + extractres file.ps | includeres >out.ps
  1039. + .sp
  1040. + will move all resources appearing in a document to the document prologue,
  1041. + removing redundant copies. The output file can then be put through page
  1042. + re-arrangement filters such as
  1043. + .I psnup
  1044. + or 
  1045. + .I pstops
  1046. + safely.
  1047. + .PP
  1048. + The
  1049. + .B \-m
  1050. + option combines the resources of the same name into one file; this must be
  1051. + used for some programs which download fonts a bit at a time.
  1052. + .SH AUTHOR
  1053. + Angus Duggan
  1054. + .SH "SEE ALSO"
  1055. + @MAN@
  1056. + .SH TRADEMARKS
  1057. + .B PostScript
  1058. + is a trademark of Adobe Systems Incorporated.
  1059. + .SH BUGS
  1060. + .I extractres
  1061. + does not alter the
  1062. + .I %%DocumentSuppliedResources
  1063. + comments.
  1064. diff -cr +new-file psutils-dist/extractres.pl psutils-next/extractres.pl
  1065. *** psutils-dist/extractres.pl
  1066. --- psutils-next/extractres.pl    Fri Nov 19 22:14:33 1993
  1067. ***************
  1068. *** 0 ****
  1069. --- 1,97 ----
  1070. + #!@PERL@
  1071. + # extractres: extract resources from PostScript file
  1072. + #
  1073. + # feed this into perl
  1074. + eval 'exec perl -S $0 "$@"'
  1075. +    if $running_under_some_shell;
  1076. + $prog = ($0 =~ s=.*/==);
  1077. + %resources = ();        # list of resources included
  1078. + %merge = ();            # list of resources extracted this time
  1079. + %extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns
  1080. +      "pattern", ".pat", "form", ".frm", "encoding", ".enc");
  1081. + %type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset",
  1082. +      "%%BeginFont:", "font"); # resource types
  1083. + while (@ARGV) {
  1084. +    $_ = shift;
  1085. +    if (/^-m(erge)?$/) { $merge = 1; }
  1086. +    elsif (/^-/) {
  1087. +       print STDERR "Usage: $prog [-merge] [file]\n";
  1088. +       exit 1;
  1089. +    } else {
  1090. +       unshift(@ARGV, $_);
  1091. +       last;
  1092. +    }
  1093. + }
  1094. + if (defined($ENV{TMPDIR})) {    # set body file name
  1095. +    $body = "$ENV{TMPDIR}/body$$.ps";
  1096. + } else {
  1097. +    $body = "body$$.ps";
  1098. + }
  1099. + open(BODY, $body) && die "Temporary file $body already exists";
  1100. + open(BODY, ">$body") || die "Can't write file $body";
  1101. + sub filename {            # make filename for resource in @_
  1102. +    local($name);
  1103. +    foreach (@_) {        # sanitise name
  1104. +       s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g;
  1105. +       $name .= $_;
  1106. +    }
  1107. +    $name =~ s@.*/@@;        # drop directories
  1108. +    die "Filename not found for resource ", join(" ", @_), "\n"
  1109. +       if $name =~ /^$/;
  1110. +    $name;
  1111. + }
  1112. + $output = STDOUT;        # start writing header out
  1113. + while (<>) {
  1114. +    if (/^%%BeginResource:/ || /^%%BeginFont:/ || /^%%BeginProcSet:/) {
  1115. +       local($comment, @res) = split(/\s+/); # look at resource type
  1116. +       local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res);
  1117. +       local($name) = &filename(@res, $extn{$type}); # make file name
  1118. +       $saveout = $output;
  1119. +       if (!$resources{$name}) {
  1120. +      print "%%IncludeResource: $type ", join(" ", @res), "\n";
  1121. +      if (!open(RES, $name)) {
  1122. +         open(RES, ">$name") || die "Can't write file $name";
  1123. +         $resources{$name} = $name;
  1124. +         $merge{$name} = $merge;
  1125. +         $output = RES;
  1126. +      } else {        # resource already exists
  1127. +         close(RES);
  1128. +         undef $output;
  1129. +      }
  1130. +       } elsif ($merge{$name}) {
  1131. +      open(RES, ">>$name") || die "Can't append to file $name";
  1132. +      $output = RES;
  1133. +       } else {            # resource already included
  1134. +      undef $output;
  1135. +       }
  1136. +    } elsif (/^%%EndResource/ || /^%%EndFont/ || /^%%EndProcSet/) {
  1137. +       if (defined $output) {
  1138. +      print $output $_;
  1139. +      close($output);
  1140. +       }
  1141. +       $output = $saveout;
  1142. +       next;
  1143. +    } elsif ((/^%%EndProlog/ || /^%%BeginSetup/ || /^%%Page:/)) {
  1144. +       $output = BODY;
  1145. +    }
  1146. +    print $output $_
  1147. +       if defined $output;
  1148. + }
  1149. + close(BODY);            # close body output file
  1150. + open(BODY, $body);        # reopen body for input
  1151. + while (<BODY>) {        # print it all
  1152. +    print $_;
  1153. + }
  1154. + close(BODY);
  1155. + unlink($body);            # dispose of body file
  1156. diff -cr +new-file psutils-dist/fixdlsrps.man psutils-next/fixdlsrps.man
  1157. *** psutils-dist/fixdlsrps.man
  1158. --- psutils-next/fixdlsrps.man    Sat Nov 27 14:28:33 1993
  1159. ***************
  1160. *** 0 ****
  1161. --- 1,24 ----
  1162. + .TH FIXDLSRPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1163. + .SH NAME
  1164. + fixdlsrps \- filter to fix DviLaser/PS documents to work with PSUtils
  1165. + .SH SYNOPSIS
  1166. + .B fixdlsrps 
  1167. + < 
  1168. + .I dvilaser.ps
  1169. + >
  1170. + .I Fixed.ps
  1171. + .SH DESCRIPTION
  1172. + .I Fixdlsrps
  1173. + is a 
  1174. + .I perl 
  1175. + filter which "fixes" PostScript generated from the DviLaser/PS driver so
  1176. + that it works correctly with Angus Duggan's
  1177. + .B psutils
  1178. + package.
  1179. + .SH AUTHOR
  1180. + Angus Duggan
  1181. + .SH "SEE ALSO"
  1182. + @MAN@
  1183. + .SH TRADEMARKS
  1184. + .B PostScript
  1185. + is a trademark of Adobe Systems Incorporated.
  1186. diff -cr +new-file psutils-dist/fixdlsrps.pl psutils-next/fixdlsrps.pl
  1187. *** psutils-dist/fixdlsrps.pl
  1188. --- psutils-next/fixdlsrps.pl    Sat Nov 20 00:30:00 1993
  1189. ***************
  1190. *** 0 ****
  1191. --- 1,48 ----
  1192. + #!@PERL@
  1193. + # fixdlsrps: fix DviLaser/PS document to work with PSUtils
  1194. + # feed this into perl
  1195. + eval 'exec perl -S $0 "$@"'
  1196. +    if $running_under_some_shell;
  1197. + $nesting = 0;
  1198. + $page = 1;
  1199. + $infont = 0;
  1200. + @fonts = ();
  1201. + while (<>) {
  1202. +    if (/^XP/) {
  1203. +       print $_;
  1204. +       $infont++;
  1205. +       push(@fonts, $_);
  1206. +       $infont-- if /PXL.*RP/;
  1207. +    } elsif ($infont) {
  1208. +       print $_;
  1209. +       push(@fonts, $_);
  1210. +       $infont-- if /PXL.*RP/;
  1211. +    } elsif (/^%%EndProlog/ && !$nesting) {
  1212. +       print "\$DviLaser begin/GlobalMode{}bdef/LocalMode{}bdef\
  1213. + /RES{/Resolution xdef/PxlResolution xdef\
  1214. +   /RasterScaleFactor PxlResolution Resolution div def\
  1215. +   InitialMatrix setmatrix 72.0 Resolution div dup scale}bdef\
  1216. + /DoInitialScaling{}bdef end\n";
  1217. +       print "\$DviLaser begin /XP {} def /RP {} def end\n";
  1218. +       print $_;
  1219. +    } elsif (/^%%BeginPageSetup/ && !$nesting) {
  1220. +       print "%%Page: $page $page\n";
  1221. +       $page++;
  1222. +       print $_;
  1223. +    } elsif (/^%%EndPageSetup/ && !$nesting) {
  1224. +       print @fonts;
  1225. +       print $_;
  1226. +    } elsif (/^%%BeginDocument/ || /^%%BeginBinary/) {
  1227. +       print $_;
  1228. +       $nesting++;
  1229. +    } elsif (/^%%EndDocument/ || /^%%EndBinary/) {
  1230. +       print $_;
  1231. +       $nesting--;
  1232. +    } elsif (!/^%%PageBoundingBox:/) {
  1233. +       print $_;
  1234. +    }
  1235. + }
  1236. diff -cr +new-file psutils-dist/fixfmps.man psutils-next/fixfmps.man
  1237. *** psutils-dist/fixfmps.man    Mon Nov 29 10:34:25 1993
  1238. --- psutils-next/fixfmps.man    Sat Nov 27 14:28:36 1993
  1239. ***************
  1240. *** 1,4 ****
  1241. ! .TH FIXFMPS 1 "PSUtils Release @REL@ Patchlevel @PL@"
  1242.   .SH NAME
  1243.   fixfmps \- filter to fix Framemaker documents so PSUtils work
  1244.   .SH SYNOPSIS
  1245. --- 1,4 ----
  1246. ! .TH FIXFMPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1247.   .SH NAME
  1248.   fixfmps \- filter to fix Framemaker documents so PSUtils work
  1249.   .SH SYNOPSIS
  1250. diff -cr +new-file psutils-dist/fixfmps.pl psutils-next/fixfmps.pl
  1251. *** psutils-dist/fixfmps.pl    Mon Nov 29 10:34:26 1993
  1252. --- psutils-next/fixfmps.pl    Wed Oct 27 18:07:31 1993
  1253. ***************
  1254. *** 1,5 ****
  1255.   #!@PERL@
  1256. ! # fixfmps: get conforming PostScript out of FrameMaker file
  1257.   # move all FMDEFINEFONTs to start of pages
  1258.   
  1259.   # feed this into perl
  1260. --- 1,5 ----
  1261.   #!@PERL@
  1262. ! # fixfmps: get conforming PostScript out of FrameMaker version 2 file
  1263.   # move all FMDEFINEFONTs to start of pages
  1264.   
  1265.   # feed this into perl
  1266. ***************
  1267. *** 11,17 ****
  1268.   while (<>) {
  1269.      if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) {
  1270.         $fonts{$1} = $_;
  1271. !    } elsif (/^[0-9]+ [0-9]+ [0-9]+ FMBEGINPAGE$/) {
  1272.         print $_, join('',values(%fonts));
  1273.      } else {
  1274.         print $_;
  1275. --- 11,17 ----
  1276.   while (<>) {
  1277.      if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) {
  1278.         $fonts{$1} = $_;
  1279. !    } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) {
  1280.         print $_, join('',values(%fonts));
  1281.      } else {
  1282.         print $_;
  1283. diff -cr +new-file psutils-dist/fixmacps.man psutils-next/fixmacps.man
  1284. *** psutils-dist/fixmacps.man    Mon Nov 29 10:34:27 1993
  1285. --- psutils-next/fixmacps.man    Sat Nov 27 14:28:40 1993
  1286. ***************
  1287. *** 1,4 ****
  1288. ! .TH FIXMACPS 1 "PSUtils Release @REL@ Patchlevel @PL@"
  1289.   .SH NAME
  1290.   fixmacps \- filter to fix Macintosh documents with saner version of md
  1291.   .SH SYNOPSIS
  1292. --- 1,4 ----
  1293. ! .TH FIXMACPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1294.   .SH NAME
  1295.   fixmacps \- filter to fix Macintosh documents with saner version of md
  1296.   .SH SYNOPSIS
  1297. ***************
  1298. *** 15,20 ****
  1299. --- 15,23 ----
  1300.   that it works correctly with Angus Duggan's
  1301.   .B psutils
  1302.   package.
  1303. + .SH FILES
  1304. + @INCLUDE@/md68_0.ps, @INCLUDE@/md71_0.ps - sanitised versions of the md
  1305. + prologue.
  1306.   .SH AUTHOR
  1307.   Angus Duggan
  1308.   .SH "SEE ALSO"
  1309. diff -cr +new-file psutils-dist/fixmacps.pl psutils-next/fixmacps.pl
  1310. *** psutils-dist/fixmacps.pl    Mon Nov 29 10:34:27 1993
  1311. --- psutils-next/fixmacps.pl    Wed Oct 27 18:07:36 1993
  1312. ***************
  1313. *** 27,34 ****
  1314.         if (! $line) {
  1315.        print;
  1316.         }
  1317. !    } elsif (/^%%BeginProcSet: "?\(AppleDict md\)"? ([0-9]+) ([0-9]+)$/) {
  1318. !       local($mdv, $mdr) = ($1, $2);
  1319.         if (open(SANE, "<$dir/$prefix${mdv}_$mdr.ps") ||
  1320.         open(SANE, "<$dir/$default")) {
  1321.        $sane = <SANE>;
  1322. --- 27,34 ----
  1323.         if (! $line) {
  1324.        print;
  1325.         }
  1326. !    } elsif (/^%%(Begin|Include)ProcSet: "?\(AppleDict md\)"? ([0-9]+) ([0-9]+)$/) {
  1327. !       local($inc, $mdv, $mdr) = ($1, $2, $3);
  1328.         if (open(SANE, "<$dir/$prefix${mdv}_$mdr.ps") ||
  1329.         open(SANE, "<$dir/$default")) {
  1330.        $sane = <SANE>;
  1331. ***************
  1332. *** 35,41 ****
  1333.        local($snv, $snr) =
  1334.           $sane =~ /^%%BeginProcSet: \(AppleDict md\) ([0-9]+) ([0-9]+)$/;
  1335.        if ($mdv == $snv && $mdr == $snr) {
  1336. !         $ignore = 1;
  1337.        } else {
  1338.           print STDERR "Unrecognised AppleDict version $mdv $mdr\n";
  1339.           print "%!\n" if !$line;
  1340. --- 35,52 ----
  1341.        local($snv, $snr) =
  1342.           $sane =~ /^%%BeginProcSet: \(AppleDict md\) ([0-9]+) ([0-9]+)$/;
  1343.        if ($mdv == $snv && $mdr == $snr) {
  1344. !          if ( $inc eq "Include" ) {
  1345. !          print STDERR "Inserting ProcSet \"(AppleDict md)\" $snv $snr\n";
  1346. !          print $sane;
  1347. !          while(<SANE>) {
  1348. !              print;
  1349. !          }
  1350. !          close(SANE);
  1351. !          }
  1352. !          else {
  1353. !          print STDERR "Substituting ProcSet \"(AppleDict md)\" $snv $snr\n";
  1354. !          $ignore = 1;
  1355. !          }
  1356.        } else {
  1357.           print STDERR "Unrecognised AppleDict version $mdv $mdr\n";
  1358.           print "%!\n" if !$line;
  1359. diff -cr +new-file psutils-dist/fixpsditps.man psutils-next/fixpsditps.man
  1360. *** psutils-dist/fixpsditps.man    Mon Nov 29 10:34:28 1993
  1361. --- psutils-next/fixpsditps.man    Sat Nov 27 14:28:44 1993
  1362. ***************
  1363. *** 1,4 ****
  1364. ! .TH FIXPSDITPS 1 "PSUtils Release @REL@ Patchlevel @PL@"
  1365.   .SH NAME
  1366.   fixpsditps \- filter to fix Transcript psdit documents so PSUtils work
  1367.   .SH SYNOPSIS
  1368. --- 1,4 ----
  1369. ! .TH FIXPSDITPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1370.   .SH NAME
  1371.   fixpsditps \- filter to fix Transcript psdit documents so PSUtils work
  1372.   .SH SYNOPSIS
  1373. diff -cr +new-file psutils-dist/fixpspps.man psutils-next/fixpspps.man
  1374. *** psutils-dist/fixpspps.man    Mon Nov 29 10:34:29 1993
  1375. --- psutils-next/fixpspps.man    Sat Nov 27 14:28:47 1993
  1376. ***************
  1377. *** 1,4 ****
  1378. ! .TH FIXPSPPS 1 "PSUtils Release @REL@ Patchlevel @PL@"
  1379.   .SH NAME
  1380.   fixpspps \- filter to fix PSPrint PostScript so PSUtils work
  1381.   .SH SYNOPSIS
  1382. --- 1,4 ----
  1383. ! .TH FIXPSPPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1384.   .SH NAME
  1385.   fixpspps \- filter to fix PSPrint PostScript so PSUtils work
  1386.   .SH SYNOPSIS
  1387. diff -cr +new-file psutils-dist/fixtpps.man psutils-next/fixtpps.man
  1388. *** psutils-dist/fixtpps.man    Mon Nov 29 10:34:29 1993
  1389. --- psutils-next/fixtpps.man    Sat Nov 27 14:28:51 1993
  1390. ***************
  1391. *** 1,4 ****
  1392. ! .TH FIXTPPS 1 "PSUtils Release @REL@ Patchlevel @PL@"
  1393.   .SH NAME
  1394.   fixtpps \- filter to fix Tpscript documents to work with PSUtils
  1395.   .SH SYNOPSIS
  1396. --- 1,4 ----
  1397. ! .TH FIXTPPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1398.   .SH NAME
  1399.   fixtpps \- filter to fix Tpscript documents to work with PSUtils
  1400.   .SH SYNOPSIS
  1401. diff -cr +new-file psutils-dist/fixwfwps.man psutils-next/fixwfwps.man
  1402. *** psutils-dist/fixwfwps.man    Mon Nov 29 10:34:30 1993
  1403. --- psutils-next/fixwfwps.man    Sat Nov 27 14:28:55 1993
  1404. ***************
  1405. *** 1,4 ****
  1406. ! .TH FIXWFWPS 1 "PSUtils Release @REL@ Patchlevel @PL@"
  1407.   .SH NAME
  1408.   fixwfwps \- filter to fix Word for Windows documents so PSUtils work
  1409.   .SH SYNOPSIS
  1410. --- 1,4 ----
  1411. ! .TH FIXWFWPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1412.   .SH NAME
  1413.   fixwfwps \- filter to fix Word for Windows documents so PSUtils work
  1414.   .SH SYNOPSIS
  1415. diff -cr +new-file psutils-dist/fixwfwps.pl psutils-next/fixwfwps.pl
  1416. *** psutils-dist/fixwfwps.pl    Mon Nov 29 10:34:31 1993
  1417. --- psutils-next/fixwfwps.pl    Tue Nov  9 22:57:05 1993
  1418. ***************
  1419. *** 5,22 ****
  1420.   eval 'exec perl -S $0 "$@"'
  1421.      if $running_under_some_shell;
  1422.   
  1423.   while (<>) {
  1424. !    tr/\000-\011\013-\037//d;
  1425. !    s!/SVDoc\s+save\s+def!!g;
  1426. !    s!SVDoc\s+restore!!g;
  1427. !    if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/) {
  1428. !       print "$1\n";
  1429. !       $wfwepsf = 1;
  1430. !    } elsif (/^SS\s*$/ && $wfwepsf) {
  1431. !       print "%%Page: $wfwepsf $wfwepsf\n";
  1432. !       $wfwepsf++;
  1433. !       print $_;
  1434. !    } elsif (! /^%%BoundingBox/) {
  1435. !       print $_;
  1436.      }
  1437.   }
  1438. --- 5,33 ----
  1439.   eval 'exec perl -S $0 "$@"'
  1440.      if $running_under_some_shell;
  1441.   
  1442. + $nesting = 0;
  1443.   while (<>) {
  1444. !    tr/\000-\010\012-\014\016-\037//d;
  1445. !    foreach (grep($_ ne "", split("\015"))) {
  1446. !       s!/SVDoc\s+save\s+def!!g;
  1447. !       s!SVDoc\s+restore!!g;
  1448. !       if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) {
  1449. !      print "$1\n";
  1450. !      $wfwepsf = 1;
  1451. !       } elsif (/^SS\s*$/ && $wfwepsf) {
  1452. !      print "%%Page: $wfwepsf $wfwepsf\n";
  1453. !      $wfwepsf++;
  1454. !      print "$_\n";
  1455. !       } elsif (/^%MSEPS Preamble/) {
  1456. !      print "%%BeginDocument: (Included EPSF)\n";
  1457. !      print "$_\n";
  1458. !      $nesting++;
  1459. !       } elsif (/^%MSEPS Trailer/) {
  1460. !      $nesting--;
  1461. !      print "$_\n";
  1462. !      print "%%EndDocument\n";
  1463. !       } elsif (! /^%%BoundingBox/) {
  1464. !      print "$_\n";
  1465. !       }
  1466.      }
  1467.   }
  1468. diff -cr +new-file psutils-dist/fixwpps.man psutils-next/fixwpps.man
  1469. *** psutils-dist/fixwpps.man    Mon Nov 29 10:34:31 1993
  1470. --- psutils-next/fixwpps.man    Sat Nov 27 14:28:59 1993
  1471. ***************
  1472. *** 1,4 ****
  1473. ! .TH FIXWPPS 1 "PSUtils Release @REL@ Patchlevel @PL@"
  1474.   .SH NAME
  1475.   fixwpps \- filter to fix WP documents so PSUtils work
  1476.   .SH SYNOPSIS
  1477. --- 1,4 ----
  1478. ! .TH FIXWPPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1479.   .SH NAME
  1480.   fixwpps \- filter to fix WP documents so PSUtils work
  1481.   .SH SYNOPSIS
  1482. diff -cr +new-file psutils-dist/fixwwps.man psutils-next/fixwwps.man
  1483. *** psutils-dist/fixwwps.man    Mon Nov 29 10:34:32 1993
  1484. --- psutils-next/fixwwps.man    Sat Nov 27 14:29:03 1993
  1485. ***************
  1486. *** 1,4 ****
  1487. ! .TH FIXWWPS 1 "PSUtils Release @REL@ Patchlevel @PL@"
  1488.   .SH NAME
  1489.   fixwwps \- filter to fix Windows Write documents so PSUtils work
  1490.   .SH SYNOPSIS
  1491. --- 1,4 ----
  1492. ! .TH FIXWWPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1493.   .SH NAME
  1494.   fixwwps \- filter to fix Windows Write documents so PSUtils work
  1495.   .SH SYNOPSIS
  1496. diff -cr +new-file psutils-dist/getafm.man psutils-next/getafm.man
  1497. *** psutils-dist/getafm.man    Mon Nov 29 10:34:33 1993
  1498. --- psutils-next/getafm.man    Sat Nov 27 14:29:07 1993
  1499. ***************
  1500. *** 1,4 ****
  1501. ! .TH GETAFM 1 "PSUtils Release @REL@ Patchlevel @PL@"
  1502.   .SH NAME
  1503.   getafm \- create an AFM file for a PostScript font.
  1504.   .SH SYNOPSIS
  1505. --- 1,4 ----
  1506. ! .TH GETAFM 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1507.   .SH NAME
  1508.   getafm \- create an AFM file for a PostScript font.
  1509.   .SH SYNOPSIS
  1510. ***************
  1511. *** 5,11 ****
  1512.   .B getafm 
  1513.   .I FontName
  1514.   >
  1515. ! .I fontname.afm
  1516.   .SH DESCRIPTION
  1517.   .I Getafm
  1518.   generates a PostScript file which prints an AFM file for a font to the
  1519. --- 5,11 ----
  1520.   .B getafm 
  1521.   .I FontName
  1522.   >
  1523. ! .I output.ps
  1524.   .SH DESCRIPTION
  1525.   .I Getafm
  1526.   generates a PostScript file which prints an AFM file for a font to the
  1527. diff -cr +new-file psutils-dist/includeres.man psutils-next/includeres.man
  1528. *** psutils-dist/includeres.man
  1529. --- psutils-next/includeres.man    Sat Nov 27 14:29:11 1993
  1530. ***************
  1531. *** 0 ****
  1532. --- 1,42 ----
  1533. + .TH INCLUDERES 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1534. + .SH NAME
  1535. + includeres \- filter to include resources in a PostScript document
  1536. + .SH SYNOPSIS
  1537. + .B includeres 
  1538. + < 
  1539. + .I document.ps
  1540. + >
  1541. + .I output.ps
  1542. + .SH DESCRIPTION
  1543. + .I Includeres
  1544. + includes resources (fonts, procsets, patterns, files, etc) in place of
  1545. + .I %%IncludeResource
  1546. + comments in a PostScript document. The resources are searched for in the
  1547. + current directory and the system default directory under the resource name,
  1548. + and with an appropriate extension.
  1549. + The pipeline
  1550. + .sp
  1551. + .ce
  1552. + extractres file.ps | includeres >out.ps
  1553. + .sp
  1554. + will move all resources appearing in a document to the document prologue,
  1555. + removing redundant copies. The output file can then be put through page
  1556. + re-arrangement filters such as
  1557. + .I psnup
  1558. + or 
  1559. + .I pstops
  1560. + safely.
  1561. + .SH FILES
  1562. + @INCLUDE@ - system resource directory.
  1563. + .SH AUTHOR
  1564. + Angus Duggan
  1565. + .SH "SEE ALSO"
  1566. + @MAN@
  1567. + .SH TRADEMARKS
  1568. + .B PostScript
  1569. + is a trademark of Adobe Systems Incorporated.
  1570. + .SH BUGS
  1571. + .I includeres
  1572. + does not alter the
  1573. + .I %%DocumentNeededResources
  1574. + comments.
  1575. diff -cr +new-file psutils-dist/includeres.pl psutils-next/includeres.pl
  1576. *** psutils-dist/includeres.pl
  1577. --- psutils-next/includeres.pl    Fri Nov 19 21:10:43 1993
  1578. ***************
  1579. *** 0 ****
  1580. --- 1,47 ----
  1581. + #!@PERL@
  1582. + # includeres: include resources in PostScript file
  1583. + #
  1584. + # feed this into perl
  1585. + eval 'exec perl -S $0 "$@"'
  1586. +    if $running_under_some_shell;
  1587. + $prog = ($0 =~ s=.*/==);
  1588. + %extn = ("font", ".pfa", "file", ".ps", "procset", ".ps", # resource extns
  1589. +      "pattern", ".pat", "form", ".frm", "encoding", ".enc");
  1590. + %type = ("%%BeginFile:", "file", "%%BeginProcSet:", "procset",
  1591. +      "%%BeginFont:", "font"); # resource types
  1592. + sub filename {            # make filename for resource in @_
  1593. +    local($name);
  1594. +    foreach (@_) {        # sanitise name
  1595. +       s/[!()\$\#*&\\\|\`\'\"\~\{\}\[\]\<\>\?]//g;
  1596. +       $name .= $_;
  1597. +    }
  1598. +    $name =~ s@.*/@@;        # drop directories
  1599. +    die "Filename not found for resource ", join(" ", @_), "\n"
  1600. +       if $name =~ /^$/;
  1601. +    $name;
  1602. + }
  1603. + while (<>) {
  1604. +    if (/^%%IncludeResource:/ || /^%%IncludeFont:/ || /^%%IncludeProcSet:/) {
  1605. +       local($comment, @res) = split(/\s+/);
  1606. +       local($type) = defined($type{$comment}) ? $type{$comment} : shift(@res);
  1607. +       local($name) = &filename(@res);
  1608. +       local($inc) = "@INCLUDE@"; # system include directory
  1609. +       if (open(RES, $name) || open(RES, "$name$extn{$type}") ||
  1610. +       open(RES, "$inc/$name") || open(RES, "$inc/$name$extn{$type}")) {
  1611. +      while (<RES>) {
  1612. +         print $_;
  1613. +      }
  1614. +      close(RES);
  1615. +       } else {
  1616. +      print "%%IncludeResource: ", join(" ", $type, @res), "\n";
  1617. +      print STDERR "Resource $name not found\n";
  1618. +       }
  1619. +    } else {
  1620. +       print $_;
  1621. +    }
  1622. + }
  1623. diff -cr +new-file psutils-dist/maketext psutils-next/maketext
  1624. *** psutils-dist/maketext
  1625. --- psutils-next/maketext    Mon Nov 29 17:02:24 1993
  1626. ***************
  1627. *** 0 ****
  1628. --- 1,32 ----
  1629. + eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
  1630. +    & eval 'exec perl -S $0 $argv:q'
  1631. +    if 0;
  1632. + # maketext: perl filter to substitute names in scripts and man pages.
  1633. + %change = ();            # names -> substitutions
  1634. + # get release and patchlevel for all scripts
  1635. + open(H, "patchlev.h") || die "can't open patchlev.h";
  1636. + while(<H>) {
  1637. +    $change{$1} = $2 if /^\#define\s*(\S*)\s*(\S*)/;
  1638. + }
  1639. + close(H);
  1640. + foreach (@ARGV) {
  1641. +    if (/MAN=(.*)/) {        # name.ext name.ext -> name(ext), name(ext)
  1642. +       local(@man) = split(' ', $1);
  1643. +       $change{MAN} = join(", ", grep(s/\.(.)/($1)/, @man));
  1644. +    } elsif (/(.*)=(.*)/) {    # substitute name for value
  1645. +       $change{$1} = $2;
  1646. +    } else {            # open file and substitute
  1647. +       local(@change) = keys %change;
  1648. +       open(FILE, $_) || die "can't open $_";
  1649. +       while ($line = <FILE>) {
  1650. +      grep($line =~ s/@$_@/$change{$_}/g, @change);
  1651. +      print $line;
  1652. +       }
  1653. +       close(FILE);
  1654. +    }
  1655. + }
  1656. diff -cr +new-file psutils-dist/md68_0.ps psutils-next/md68_0.ps
  1657. *** psutils-dist/md68_0.ps    Mon Nov 29 10:34:44 1993
  1658. --- psutils-next/md68_0.ps    Wed Oct 27 18:08:15 1993
  1659. ***************
  1660. *** 81,88 ****
  1661.   2t astore pop/pnsh xdf/pnsv xdf gw
  1662.   /sfl fg 5 get 0 ne def array astore exch setdash setlinejoin setlinecap
  1663.   setlinewidth setgray moveto}bdf
  1664. ! /fc{save vmstatus exch sub 50000 lt
  1665. ! {(%%[|0|]%%)=print flush}if pop restore}bdf
  1666.   /tc{32768 div add 3 1 roll 32768 div add 2t astore pop}bdf
  1667.   /3a [0 0 0] def
  1668.   /2t 2 array def
  1669. --- 81,87 ----
  1670.   2t astore pop/pnsh xdf/pnsv xdf gw
  1671.   /sfl fg 5 get 0 ne def array astore exch setdash setlinejoin setlinecap
  1672.   setlinewidth setgray moveto}bdf
  1673. ! /fc{}bdf
  1674.   /tc{32768 div add 3 1 roll 32768 div add 2t astore pop}bdf
  1675.   /3a [0 0 0] def
  1676.   /2t 2 array def
  1677. diff -cr +new-file psutils-dist/md71_0.ps psutils-next/md71_0.ps
  1678. *** psutils-dist/md71_0.ps    Mon Nov 29 10:34:46 1993
  1679. --- psutils-next/md71_0.ps    Wed Oct 27 18:08:47 1993
  1680. ***************
  1681. *** 84,91 ****
  1682.   astore pop 2t astore pop/pnsh xdf/pnsv xdf gw
  1683.   /sfl fg 5 get 0 ne def array astore exch setdash setlinejoin setlinecap 
  1684.   setlinewidth 4colors{mysetcmykcolor}{setrgbcolor}ifelse moveto}bdf
  1685. ! /fc{save vmstatus exch sub 50000 lt
  1686. ! {(%%[|0|]%%)=print flush}if pop restore}bdf
  1687.   /tc{32768 div add 3 1 roll 32768 div add 2t astore pop}bdf
  1688.   /3a [0 0 0] def
  1689.   /2t 2 array def
  1690. --- 84,90 ----
  1691.   astore pop 2t astore pop/pnsh xdf/pnsv xdf gw
  1692.   /sfl fg 5 get 0 ne def array astore exch setdash setlinejoin setlinecap 
  1693.   setlinewidth 4colors{mysetcmykcolor}{setrgbcolor}ifelse moveto}bdf
  1694. ! /fc{}bdf
  1695.   /tc{32768 div add 3 1 roll 32768 div add 2t astore pop}bdf
  1696.   /3a [0 0 0] def
  1697.   /2t 2 array def
  1698. diff -cr +new-file psutils-dist/patchlev.h psutils-next/patchlev.h
  1699. *** psutils-dist/patchlev.h
  1700. --- psutils-next/patchlev.h    Wed Oct 27 18:09:11 1993
  1701. ***************
  1702. *** 0 ****
  1703. --- 1,2 ----
  1704. + #define RELEASE 1
  1705. + #define PATCHLEVEL 13
  1706. diff -cr +new-file psutils-dist/patchlevel.h psutils-next/patchlevel.h
  1707. *** psutils-dist/patchlevel.h    Mon Nov 29 10:34:33 1993
  1708. --- psutils-next/patchlevel.h
  1709. ***************
  1710. *** 1,2 ****
  1711. - #define RELEASE 1
  1712. - #define PATCHLEVEL 12
  1713. --- 0 ----
  1714. diff -cr +new-file psutils-dist/psbook.c psutils-next/psbook.c
  1715. *** psutils-dist/psbook.c    Mon Nov 29 10:34:34 1993
  1716. --- psutils-next/psbook.c    Mon Nov 29 17:02:42 1993
  1717. ***************
  1718. *** 7,13 ****
  1719.    */
  1720.   
  1721.   #include "psutil.h"
  1722. ! #include "patchlevel.h"
  1723.   
  1724.   void usage()
  1725.   {
  1726. --- 7,13 ----
  1727.    */
  1728.   
  1729.   #include "psutil.h"
  1730. ! #include "patchlev.h"
  1731.   
  1732.   void usage()
  1733.   {
  1734. ***************
  1735. *** 72,78 ****
  1736.   
  1737.      /* rearrange pages */
  1738.      writeheader(maxpage);
  1739. !    writeprolog("");
  1740.      for (currentpg = 0; currentpg < maxpage; currentpg++) {
  1741.         int actualpg = currentpg - currentpg%signature;
  1742.         switch(currentpg%4) {
  1743. --- 72,79 ----
  1744.   
  1745.      /* rearrange pages */
  1746.      writeheader(maxpage);
  1747. !    writeprolog();
  1748. !    writesetup();
  1749.      for (currentpg = 0; currentpg < maxpage; currentpg++) {
  1750.         int actualpg = currentpg - currentpg%signature;
  1751.         switch(currentpg%4) {
  1752. diff -cr +new-file psutils-dist/psbook.man psutils-next/psbook.man
  1753. *** psutils-dist/psbook.man    Mon Nov 29 10:34:34 1993
  1754. --- psutils-next/psbook.man    Sat Nov 27 14:29:17 1993
  1755. ***************
  1756. *** 1,4 ****
  1757. ! .TH PSBOOK 1 "PSUtils Release @REL@ Patchlevel @PL@"
  1758.   .SH NAME
  1759.   psbook \- rearrange pages in PostScript file into signatures
  1760.   .SH SYNOPSIS
  1761. --- 1,4 ----
  1762. ! .TH PSBOOK 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1763.   .SH NAME
  1764.   psbook \- rearrange pages in PostScript file into signatures
  1765.   .SH SYNOPSIS
  1766. diff -cr +new-file psutils-dist/psnup.c psutils-next/psnup.c
  1767. *** psutils-dist/psnup.c    Mon Nov 29 10:34:40 1993
  1768. --- psutils-next/psnup.c    Mon Nov 29 17:23:21 1993
  1769. ***************
  1770. *** 4,10 ****
  1771.    *
  1772.    * Usage:
  1773.    *      psnup [-q] [-w<dim>] [-h<dim>] [-ppaper] [-b<dim>] [-m<dim>]
  1774. !  *            [-l] [-c] [-f] [-sscale] [-d] [-nup] [in [out]]
  1775.    *              -w<dim> sets the paper width
  1776.    *              -h<dim> sets the paper height
  1777.    *              -ppaper sets the paper size (width and height) by name
  1778. --- 4,10 ----
  1779.    *
  1780.    * Usage:
  1781.    *      psnup [-q] [-w<dim>] [-h<dim>] [-ppaper] [-b<dim>] [-m<dim>]
  1782. !  *            [-l] [-c] [-f] [-sscale] [-d<wid>] [-nup] [in [out]]
  1783.    *              -w<dim> sets the paper width
  1784.    *              -h<dim> sets the paper height
  1785.    *              -ppaper sets the paper size (width and height) by name
  1786. ***************
  1787. *** 15,26 ****
  1788.    *              -r      used if pages are in seascape orientation (rot right)
  1789.    *         -c    for column-major layout
  1790.    *        -f    for flipped (wider than tall) pages
  1791. !  *         -d    to draw the page boundaries
  1792.    */
  1793.   
  1794.   #include "psutil.h"
  1795.   #include "psspec.h"
  1796. ! #include "patchlevel.h"
  1797.   
  1798.   void usage()
  1799.   {
  1800. --- 15,26 ----
  1801.    *              -r      used if pages are in seascape orientation (rot right)
  1802.    *         -c    for column-major layout
  1803.    *        -f    for flipped (wider than tall) pages
  1804. !  *         -d<wid>    to draw the page boundaries
  1805.    */
  1806.   
  1807.   #include "psutil.h"
  1808.   #include "psspec.h"
  1809. ! #include "patchlev.h"
  1810.   
  1811.   void usage()
  1812.   {
  1813. diff -cr +new-file psutils-dist/psnup.man psutils-next/psnup.man
  1814. *** psutils-dist/psnup.man    Mon Nov 29 10:34:35 1993
  1815. --- psutils-next/psnup.man    Mon Nov 29 20:52:03 1993
  1816. ***************
  1817. *** 1,4 ****
  1818. ! .TH PSNUP 1 "PSUtils Release @REL@ Patchlevel @PL@"
  1819.   .SH NAME
  1820.   psnup \- multiple pages per sheet
  1821.   .SH SYNOPSIS
  1822. --- 1,4 ----
  1823. ! .TH PSNUP 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  1824.   .SH NAME
  1825.   psnup \- multiple pages per sheet
  1826.   .SH SYNOPSIS
  1827. ***************
  1828. *** 110,116 ****
  1829.   tries to optimise the layout so that the minimum amount of space is wasted. If
  1830.   .I psnup
  1831.   cannot find a layout within its tolerance limit, it will abort with an error
  1832. ! message.
  1833.   .PP
  1834.   .I Psnup
  1835.   normally prints the page numbers of the pages re-arranged; the
  1836. --- 110,118 ----
  1837.   tries to optimise the layout so that the minimum amount of space is wasted. If
  1838.   .I psnup
  1839.   cannot find a layout within its tolerance limit, it will abort with an error
  1840. ! message. The alternative form
  1841. ! .I \i \fInup\fR
  1842. ! can also be used, for compatibility with other n-up programs.
  1843.   .PP
  1844.   .I Psnup
  1845.   normally prints the page numbers of the pages re-arranged; the
  1846. diff -cr +new-file psutils-dist/psresize.c psutils-next/psresize.c
  1847. *** psutils-dist/psresize.c
  1848. --- psutils-next/psresize.c    Mon Nov 29 20:19:18 1993
  1849. ***************
  1850. *** 0 ****
  1851. --- 1,183 ----
  1852. + /* psresize.c
  1853. +  * AJCD 29/11/93
  1854. +  * alter pagesize of document
  1855. +  *
  1856. +  * Usage:
  1857. +  *      psresize [-q] [-w<dim>] [-h<dim>] [-ppaper] [-W<dim>] [-H<dim>]
  1858. +  *            [-Ppaper] [in [out]]
  1859. +  *              -w<dim> sets the output paper width
  1860. +  *              -h<dim> sets the output paper height
  1861. +  *              -ppaper sets the output paper size (width and height) by name
  1862. +  *              -W<dim> sets the input paper width
  1863. +  *              -H<dim> sets the input paper height
  1864. +  *              -Ppaper sets the input paper size (width and height) by name
  1865. +  */
  1866. + #include "psutil.h"
  1867. + #include "psspec.h"
  1868. + #include "patchlev.h"
  1869. + void usage()
  1870. + {
  1871. +    fprintf(stderr, "%s release %d patchlevel %d\n", prog, RELEASE, PATCHLEVEL);
  1872. +    fprintf(stderr, "Usage: %s [-q] [-wwidth] [-hheight] [-ppaper] [-Wwidth] [-Hheight] [-Ppaper] [infile [outfile]]\n",
  1873. +        prog);
  1874. +    fflush(stderr);
  1875. +    exit(1);
  1876. + }
  1877. + void argerror()
  1878. + {
  1879. +    fprintf(stderr, "%s: bad dimension\n", prog);
  1880. +    fflush(stderr);
  1881. +    exit(1);
  1882. + }
  1883. + #define min(x,y) ((x) > (y) ? (y) : (x))
  1884. + #define max(x,y) ((x) > (y) ? (x) : (y))
  1885. + main(argc, argv)
  1886. +      int argc;
  1887. +      char *argv[];
  1888. + {
  1889. +    double scale, rscale;            /* page scale */
  1890. +    double waste, rwaste;            /* amount wasted */
  1891. +    double vshift, hshift;            /* page centring shifts */
  1892. +    int rotate;
  1893. +    double inwidth = -1;
  1894. +    double inheight = -1;
  1895. +    struct papersize *paper;
  1896. +    struct pagespec *specs;
  1897. + #ifdef PAPER
  1898. +    if (paper = findpaper(PAPER)) {
  1899. +       inwidth = width = (double)paper->width;
  1900. +       inheight = height = (double)paper->height;
  1901. +    }
  1902. + #endif
  1903. +    vshift = hshift = 0;
  1904. +    rotate = 0;
  1905. +    infile = stdin;
  1906. +    outfile = stdout;
  1907. +    verbose = 1;
  1908. +    for (prog = *argv++; --argc; argv++) {
  1909. +       if (argv[0][0] == '-') {
  1910. +      switch (argv[0][1]) {
  1911. +      case 'q':    /* quiet */
  1912. +         verbose = 0;
  1913. +         break;
  1914. +      case 'w':    /* page width */
  1915. +         width = singledimen(*argv+2);
  1916. +         break;
  1917. +      case 'h':    /* page height */
  1918. +         height = singledimen(*argv+2);
  1919. +         break;
  1920. +      case 'p':    /* paper type */
  1921. +         if (paper = findpaper(*argv+2)) {
  1922. +            width = (double)paper->width;
  1923. +            height = (double)paper->height;
  1924. +         } else {
  1925. +            fprintf(stderr, "%s: paper size '%s' not recognised\n",
  1926. +                prog, *argv+2);
  1927. +            fflush(stderr);
  1928. +            exit(1);
  1929. +         }
  1930. +         break;
  1931. +      case 'W':    /* input page width */
  1932. +         inwidth = singledimen(*argv+2);
  1933. +         break;
  1934. +      case 'H':    /* input page height */
  1935. +         inheight = singledimen(*argv+2);
  1936. +         break;
  1937. +      case 'P':    /* input paper type */
  1938. +         if (paper = findpaper(*argv+2)) {
  1939. +            inwidth = (double)paper->width;
  1940. +            inheight = (double)paper->height;
  1941. +         } else {
  1942. +            fprintf(stderr, "%s: paper size '%s' not recognised\n",
  1943. +                prog, *argv+2);
  1944. +            fflush(stderr);
  1945. +            exit(1);
  1946. +         }
  1947. +         break;
  1948. +      case 'v':    /* version */
  1949. +      default:
  1950. +         usage();
  1951. +      }
  1952. +       } else if (infile == stdin) {
  1953. +      if ((infile = fopen(*argv, "r")) == NULL) {
  1954. +         fprintf(stderr, "%s: can't open input file %s\n", prog, *argv);
  1955. +         fflush(stderr);
  1956. +         exit(1);
  1957. +      }
  1958. +       } else if (outfile == stdout) {
  1959. +      if ((outfile = fopen(*argv, "w")) == NULL) {
  1960. +         fprintf(stderr, "%s: can't open output file %s\n", prog, *argv);
  1961. +         fflush(stderr);
  1962. +         exit(1);
  1963. +      }
  1964. +       } else usage();
  1965. +    }
  1966. +    if ((infile=seekable(infile))==NULL) {
  1967. +       fprintf(stderr, "%s: can't seek input\n", prog);
  1968. +       fflush(stderr);
  1969. +       exit(1);
  1970. +    }
  1971. +    if (width <= 0 || height <= 0) {
  1972. +       fprintf(stderr, "%s: output page width and height must be set\n", prog);
  1973. +       fflush(stderr);
  1974. +       exit(1);
  1975. +    }
  1976. +    if (inwidth <= 0 || inheight <= 0) {
  1977. +       fprintf(stderr, "%s: input page width and height must be set\n", prog);
  1978. +       fflush(stderr);
  1979. +       exit(1);
  1980. +    }
  1981. +    /* try normal orientation first */
  1982. +    scale = min(width/inwidth, height/inheight);
  1983. +    waste = (width-scale*inwidth)*(width-scale*inwidth) +
  1984. +       (height-scale*inheight)*(height-scale*inheight);
  1985. +    hshift = (width - inwidth*scale)/2;
  1986. +    vshift = (height - inheight*scale)/2;
  1987. +    /* try rotated orientation */
  1988. +    rscale = min(height/inwidth, width/inheight);
  1989. +    rwaste = (height-scale*inwidth)*(height-scale*inwidth) +
  1990. +       (width-scale*inheight)*(width-scale*inheight);
  1991. +    if (rwaste < waste) {
  1992. +       double tmp = width;
  1993. +       scale = rscale;
  1994. +       hshift = (width + inheight*scale)/2;
  1995. +       vshift = (height - inwidth*scale)/2;
  1996. +       rotate = 1;
  1997. +       width = height;
  1998. +       height = tmp;
  1999. +    }
  2000. +    width /= scale;
  2001. +    height /= scale;
  2002. +    /* now construct specification list and run page rearrangement procedure */
  2003. +    specs = newspec();
  2004. +    if (rotate) {
  2005. +       specs->rotate = 90;
  2006. +       specs->flags |= ROTATE;
  2007. +    }
  2008. +    specs->pageno = 0;
  2009. +    specs->scale = scale;
  2010. +    specs->flags |= SCALE;
  2011. +    specs->xoff = hshift;
  2012. +    specs->yoff = vshift;
  2013. +    specs->flags |= OFFSET;
  2014. +       
  2015. +    pstops(1, 1, 0, specs, 0.0);        /* do page rearrangement */
  2016. +    exit(0);
  2017. + }
  2018. diff -cr +new-file psutils-dist/psresize.man psutils-next/psresize.man
  2019. *** psutils-dist/psresize.man
  2020. --- psutils-next/psresize.man    Mon Nov 29 20:28:44 1993
  2021. ***************
  2022. *** 0 ****
  2023. --- 1,81 ----
  2024. + .TH PSRESIZE 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  2025. + .SH NAME
  2026. + psresize \- multiple pages per sheet
  2027. + .SH SYNOPSIS
  2028. + .B psresize
  2029. + [
  2030. + .B \-w\fIwidth\fR
  2031. + ] [
  2032. + .B \-h\fIheight\fR
  2033. + ] [
  2034. + .B \-p\fIpaper\fR
  2035. + ] [
  2036. + .B \-W\fIwidth\fR
  2037. + ] [
  2038. + .B \-H\fIheight\fR
  2039. + ] [
  2040. + .B \-P\fIpaper\fR
  2041. + ] [
  2042. + .B \-q
  2043. + ] [
  2044. + .I infile
  2045. + [
  2046. + .I outfile
  2047. + ] ]
  2048. + .SH DESCRIPTION
  2049. + .I Psresize
  2050. + rescales and centres a document on a different size of paper.
  2051. + The input PostScript file should follow the Adobe Document Structuring
  2052. + Conventions.
  2053. + .PP
  2054. + The
  2055. + .I \-w
  2056. + option gives the output paper width, and the
  2057. + .I \-h
  2058. + option gives the output paper height, normally specified in
  2059. + .B "cm"
  2060. + or
  2061. + .B "in"
  2062. + to convert 
  2063. + PostScript's points (1/72 of an inch)
  2064. + to centimeters or inches.
  2065. + The 
  2066. + .I \-p
  2067. + option can be used as an alternative, to set the output paper size to
  2068. + .B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto
  2069. + or
  2070. + .B 10x14.
  2071. + The default output paper size is
  2072. + .B @PAPER@.
  2073. + .PP
  2074. + The
  2075. + .I \-W
  2076. + option gives the input paper width, and the
  2077. + .I \-H
  2078. + option gives the input paper height.
  2079. + The 
  2080. + .I \-P
  2081. + option can be used as an alternative, to set the input paper size.
  2082. + The default input paper size is
  2083. + .B @PAPER@.
  2084. + .PP
  2085. + .I Psresize
  2086. + normally prints the page numbers of the pages output; the
  2087. + .I \-q
  2088. + option suppresses this.
  2089. + .SH EXAMPLES
  2090. + The following command can be used to convert a document on A4 size paper to
  2091. + letter size paper:
  2092. + .sp
  2093. + psresize -PA4 -pletter in.ps out.ps
  2094. + .sp
  2095. + .SH AUTHOR
  2096. + Angus Duggan
  2097. + .SH "SEE ALSO"
  2098. + @MAN@
  2099. + .SH TRADEMARKS
  2100. + .B PostScript
  2101. + is a trademark of Adobe Systems Incorporated.
  2102. + .SH BUGS
  2103. + .I Psresize
  2104. + does not accept all DSC comments.
  2105. diff -cr +new-file psutils-dist/psselect.c psutils-next/psselect.c
  2106. *** psutils-dist/psselect.c    Mon Nov 29 10:34:41 1993
  2107. --- psutils-next/psselect.c    Mon Nov 29 17:03:13 1993
  2108. ***************
  2109. *** 7,13 ****
  2110.    */
  2111.   
  2112.   #include "psutil.h"
  2113. ! #include "patchlevel.h"
  2114.   
  2115.   void usage()
  2116.   {
  2117. --- 7,13 ----
  2118.    */
  2119.   
  2120.   #include "psutil.h"
  2121. ! #include "patchlev.h"
  2122.   
  2123.   void usage()
  2124.   {
  2125. ***************
  2126. *** 167,173 ****
  2127.      for (pass = 0; pass < 2; pass++) {
  2128.         if (pass) {                           /* write header on second pass */
  2129.        writeheader(maxpage);
  2130. !      writeprolog("");
  2131.         }
  2132.         if (pagerange) {
  2133.        range *r;
  2134. --- 167,174 ----
  2135.      for (pass = 0; pass < 2; pass++) {
  2136.         if (pass) {                           /* write header on second pass */
  2137.        writeheader(maxpage);
  2138. !      writeprolog();
  2139. !      writesetup();
  2140.         }
  2141.         if (pagerange) {
  2142.        range *r;
  2143. diff -cr +new-file psutils-dist/psselect.man psutils-next/psselect.man
  2144. *** psutils-dist/psselect.man    Mon Nov 29 10:34:35 1993
  2145. --- psutils-next/psselect.man    Sat Nov 27 14:29:29 1993
  2146. ***************
  2147. *** 1,4 ****
  2148. ! .TH PSSELECT 1 "PSUtils Release @REL@ Patchlevel @PL@"
  2149.   .SH NAME
  2150.   psselect \- select pages from a PostScript file
  2151.   .SH SYNOPSIS
  2152. --- 1,4 ----
  2153. ! .TH PSSELECT 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  2154.   .SH NAME
  2155.   psselect \- select pages from a PostScript file
  2156.   .SH SYNOPSIS
  2157. diff -cr +new-file psutils-dist/psspec.c psutils-next/psspec.c
  2158. *** psutils-dist/psspec.c    Mon Nov 29 10:34:41 1993
  2159. --- psutils-next/psspec.c    Mon Nov 29 20:18:09 1993
  2160. ***************
  2161. *** 5,11 ****
  2162.   
  2163.   #include "psutil.h"
  2164.   #include "psspec.h"
  2165. ! #include "patchlevel.h"
  2166.   
  2167.   double width = -1;
  2168.   double height = -1;
  2169. --- 5,11 ----
  2170.   
  2171.   #include "psutil.h"
  2172.   #include "psspec.h"
  2173. ! #include "patchlev.h"
  2174.   
  2175.   double width = -1;
  2176.   double height = -1;
  2177. ***************
  2178. *** 99,104 ****
  2179. --- 99,144 ----
  2180.      return (num);
  2181.   }
  2182.   
  2183. + static char *prologue[] = { /* PStoPS procset */
  2184. + #ifndef SHOWPAGE_LOAD
  2185. +    "userdict begin",
  2186. +    "[/showpage/erasepage/copypage]{dup where{pop dup load",    /* prevent */
  2187. +    " type/operatortype eq{1 array cvx dup 0 3 index cvx put",    /* binding */
  2188. +    " bind def}{pop}ifelse}{pop}ifelse}forall",            /* in prolog */
  2189. + #else
  2190. +    "[/showpage/copypage/erasepage]{dup 10 string cvs dup",
  2191. +    " length 6 add string dup 0 (PStoPS) putinterval dup",
  2192. +    " 6 4 -1 roll putinterval 2 copy cvn dup where",
  2193. +    " {pop pop pop}{exch load def}ifelse cvx cvn 1 array cvx",
  2194. +    " dup 0 4 -1 roll put def}forall",
  2195. + #endif
  2196. +    "[/letter/legal/executivepage/a4/a4small/b5/com10envelope",    /* nullify */
  2197. +    " /monarchenvelope/c5envelope/dlenvelope/lettersmall/note",    /* paper */
  2198. +    " /folio/quarto/a5]{dup where{dup wcheck{exch{}put}",    /* operators */
  2199. +    " {pop{}def}ifelse}{pop}ifelse}forall",
  2200. +    "/PStoPSmatrix matrix currentmatrix def",
  2201. +    "/PStoPSxform matrix def/PStoPSclip{clippath}def",
  2202. +    "/defaultmatrix{PStoPSmatrix exch PStoPSxform exch concatmatrix}bind def",
  2203. +    "/initmatrix{matrix defaultmatrix setmatrix}bind def",
  2204. +    "/initclip[{matrix currentmatrix PStoPSmatrix setmatrix",
  2205. +    " [{currentpoint}stopped{$error/newerror false put{newpath}}",
  2206. +    " {/newpath cvx 3 1 roll/moveto cvx 4 array astore cvx}ifelse]",
  2207. +    " {[/newpath cvx{/moveto cvx}{/lineto cvx}",
  2208. +    " {/curveto cvx}{/closepath cvx}pathforall]cvx exch pop}",
  2209. +    " stopped{$error/errorname get/invalidaccess eq{cleartomark",
  2210. +    " $error/newerror false put cvx exec}{stop}ifelse}if}bind aload pop",
  2211. +    " /initclip dup load dup type dup/operatortype eq{pop exch pop}",
  2212. +    " {dup/arraytype eq exch/packedarraytype eq or",
  2213. +    "  {dup xcheck{exch pop aload pop}{pop cvx}ifelse}",
  2214. +    "  {pop cvx}ifelse}ifelse",
  2215. +    " {newpath PStoPSclip clip newpath exec setmatrix} bind aload pop]cvx def",
  2216. +    "/initgraphics{initmatrix newpath initclip 1 setlinewidth",
  2217. +    " 0 setlinecap 0 setlinejoin []0 setdash 0 setgray",
  2218. +    " 10 setmiterlimit}bind def",
  2219. +    "end",
  2220. +    NULL
  2221. +    };
  2222.   void pstops(modulo, pps, nobind, specs, draw)
  2223.        int modulo, pps, nobind;
  2224.        double draw;
  2225. ***************
  2226. *** 106,111 ****
  2227. --- 146,152 ----
  2228.   {
  2229.      int thispg, maxpage;
  2230.      int pageindex = 0;
  2231. +    char **pro;
  2232.   
  2233.      scanpages();
  2234.   
  2235. ***************
  2236. *** 113,175 ****
  2237.   
  2238.      /* rearrange pages: doesn't cope properly with loaded definitions */
  2239.      writeheader((maxpage/modulo)*pps);
  2240. -    writestring("%%BeginProcSet: pstops");
  2241. -    if (width > 0 && height > 0)
  2242. -       writestring("-clip");
  2243. -    if (nobind)
  2244. -       writestring("-nobind");
  2245. - #ifdef SHOWPAGE_LOAD
  2246. -    writestring("-spload");
  2247. - #endif
  2248. -    writestring(" 1 0\n");
  2249.   #ifndef SHOWPAGE_LOAD
  2250. !    writestring("[/showpage/erasepage/copypage]{dup where{pop dup load\n");
  2251. !    writestring(" type/operatortype eq{1 array cvx dup 0 3 index cvx put\n");
  2252. !    writestring(" bind def}{pop}ifelse}{pop}ifelse}forall\n");
  2253.   #else
  2254. !    writestring("[/showpage/copypage/erasepage]{dup 10 string cvs dup\n");
  2255. !    writestring(" length 6 add string dup 0 (pstops) putinterval dup\n");
  2256. !    writestring(" 6 4 -1 roll putinterval 2 copy cvn dup where\n");
  2257. !    writestring(" {pop pop pop}{exch load def}ifelse cvx cvn 1 array cvx\n");
  2258. !    writestring(" dup 0 4 -1 roll put def}forall\n");
  2259.   #endif
  2260. !    writestring("[/letter/legal/executivepage/a4/a4small/b5/com10envelope\n");
  2261. !    writestring(" /monarchenvelope/c5envelope/dlenvelope/lettersmall/note\n");
  2262. !    writestring(" /folio/quarto/a5]{dup where{dup wcheck{exch{}put}\n");
  2263. !    writestring(" {pop{}def}ifelse}{pop}ifelse}forall\n");
  2264. !    writestring("/lcvx{dup load dup type dup/operatortype eq{pop exch pop}\n");
  2265. !    writestring(" {/arraytype eq{dup xcheck{exch pop aload pop}\n");
  2266. !    writestring(" {pop cvx}ifelse}{pop cvx}ifelse}ifelse}bind def\n");
  2267. !    writestring("/pstopsmatrix matrix currentmatrix def\n");
  2268. !    writestring("/pstopsxform matrix def\n");
  2269. !    writestring("/defaultmatrix{pstopsmatrix exch pstopsxform exch concatmatrix}bind def\n");
  2270. !    writestring("/initmatrix{matrix defaultmatrix setmatrix}bind def\n");
  2271. !    writestring("/pathtoproc{[{currentpoint}stopped{$error/newerror false\n");
  2272. !    writestring(" put{newpath}}{/newpath cvx 3 1 roll/moveto cvx 4 array\n");
  2273. !    writestring(" astore cvx}ifelse]{[/newpath cvx{/moveto cvx}{/lineto cvx}\n");
  2274. !    writestring(" {/curveto cvx}{/closepath cvx}pathforall]cvx exch pop}\n");
  2275. !    writestring(" stopped{$error/errorname get/invalidaccess eq{cleartomark\n");
  2276. !    writestring(" $error/newerror false put cvx exec}{stop}ifelse}if}def\n");
  2277. !    if (width > 0 && height > 0) {
  2278. !       char buffer[BUFSIZ];
  2279. !       writestring("/initclip[/matrix lcvx/currentmatrix lcvx/pstopsmatrix cvx/setmatrix lcvx\n");
  2280. !       writestring(" /pathtoproc lcvx/initclip lcvx/newpath lcvx\n");
  2281. !       writestring(" 0 0 /moveto lcvx");
  2282. !       sprintf(buffer,
  2283. !           " %lf 0/rlineto lcvx\n 0 %lf/rlineto lcvx -%lf 0/rlineto lcvx\n",
  2284. !           width, height, width);
  2285. !       writestring(buffer);
  2286. !       writestring(" /closepath lcvx/clip lcvx\n");
  2287. !       writestring(" /newpath lcvx/exec lcvx/setmatrix lcvx]cvx def\n");
  2288.      }
  2289. -    writestring("/initgraphics{initmatrix newpath initclip 1 setlinewidth\n");
  2290. -    writestring(" 0 setlinecap 0 setlinejoin []0 setdash 0 setgray\n");
  2291. -    writestring(" 10 setmiterlimit}bind def\n");
  2292.      if (nobind) /* desperation measures */
  2293.         writestring("/bind{}def\n");
  2294.      writestring("%%EndProcSet\n");
  2295.      /* save transformation from original to current matrix */
  2296. !    writeprolog("/pstopsxform pstopsmatrix matrix currentmatrix matrix invertmatrix matrix concatmatrix matrix invertmatrix store\n");
  2297.      for (thispg = 0; thispg < maxpage; thispg += modulo) {
  2298.         int add_last = 0;
  2299.         struct pagespec *ps;
  2300. --- 154,181 ----
  2301.   
  2302.      /* rearrange pages: doesn't cope properly with loaded definitions */
  2303.      writeheader((maxpage/modulo)*pps);
  2304.   #ifndef SHOWPAGE_LOAD
  2305. !    writestring("%%BeginProcSet: PStoPS");
  2306.   #else
  2307. !    writestring("%%BeginProcSet: PStoPS-spload");
  2308.   #endif
  2309. !    if (nobind)
  2310. !       writestring("-nobind");
  2311. !    writestring(" 1 13\n");
  2312. !    for (pro = prologue; *pro; pro++) {
  2313. !       writestring(*pro);
  2314. !       writestring("\n");
  2315.      }
  2316.      if (nobind) /* desperation measures */
  2317.         writestring("/bind{}def\n");
  2318.      writestring("%%EndProcSet\n");
  2319.      /* save transformation from original to current matrix */
  2320. !    if (writepartprolog()) {
  2321. !       writestring("userdict/PStoPSxform PStoPSmatrix matrix currentmatrix\n");
  2322. !       writestring(" matrix invertmatrix matrix concatmatrix\n");
  2323. !       writestring(" matrix invertmatrix put\n");
  2324. !    }
  2325. !    writesetup();
  2326.      for (thispg = 0; thispg < maxpage; thispg += modulo) {
  2327.         int add_last = 0;
  2328.         struct pagespec *ps;
  2329. ***************
  2330. *** 182,194 ****
  2331.           actualpg = thispg+ps->pageno;
  2332.        if (actualpg < pages)
  2333.           seekpage(actualpg);
  2334. !      if (!add_last) {
  2335. !         writepageheader("pstops", ++pageindex);
  2336.        }
  2337. !      writestring("/pstopssaved save def\n");
  2338.        if (ps->flags & GSAVE) {
  2339.           char buffer[BUFSIZ];
  2340. !         writestring("pstopsmatrix setmatrix\n");
  2341.           if (ps->flags & OFFSET) {
  2342.              sprintf(buffer, "%lf %lf translate\n", ps->xoff, ps->yoff);
  2343.              writestring(buffer);
  2344. --- 188,213 ----
  2345.           actualpg = thispg+ps->pageno;
  2346.        if (actualpg < pages)
  2347.           seekpage(actualpg);
  2348. !      if (!add_last) {    /* page label contains original pages */
  2349. !         struct pagespec *np = ps;
  2350. !         char *eob = pagelabel;
  2351. !         char sep = '(';
  2352. !         do {
  2353. !            *eob++ = sep;
  2354. !            if (np->reversed)
  2355. !           sprintf(eob, "%d", maxpage-thispg-modulo+np->pageno);
  2356. !            else
  2357. !           sprintf(eob, "%d", thispg+np->pageno);
  2358. !            eob = eob + strlen(eob);
  2359. !            sep = ',';
  2360. !         } while ((np->flags & ADD_NEXT) && (np = np->next));
  2361. !         strcpy(eob, ")");
  2362. !         writepageheader(pagelabel, ++pageindex);
  2363.        }
  2364. !      writestring("userdict/PStoPSsaved save put\n");
  2365.        if (ps->flags & GSAVE) {
  2366.           char buffer[BUFSIZ];
  2367. !         writestring("PStoPSmatrix setmatrix\n");
  2368.           if (ps->flags & OFFSET) {
  2369.              sprintf(buffer, "%lf %lf translate\n", ps->xoff, ps->yoff);
  2370.              writestring(buffer);
  2371. ***************
  2372. *** 201,228 ****
  2373.              sprintf(buffer, "%lf dup scale\n", ps->scale);
  2374.              writestring(buffer);
  2375.           }
  2376.           if (width > 0 && height > 0) {
  2377. !            writestring("/pstopsmatrix matrix currentmatrix def\n");
  2378. !            writestring("initclip\n");
  2379.              if (draw > 0) {
  2380.             sprintf(buffer, "gsave clippath 0 setgray %lf setlinewidth stroke grestore\n", draw);
  2381.             writestring(buffer);
  2382.              }
  2383.           }
  2384. -         writestring("pstopsxform concat\n");
  2385.        }
  2386.        if (add_next) {
  2387.   #ifndef SHOWPAGE_LOAD
  2388.           writestring("/showpage{}def/copypage{}def/erasepage{}def\n");
  2389.   #else
  2390. !         writestring("/pstopsshowpage{}def/pstopscopypage{}def/pstopserasepage{}def\n");
  2391.   #endif
  2392.        }
  2393. !      if (actualpg < pages)
  2394.           writepagebody(actualpg);
  2395. !      else
  2396.           writestring("showpage\n");
  2397. !      writestring("pstopssaved restore\n");
  2398.        add_last = add_next;
  2399.         }
  2400.      }
  2401. --- 220,253 ----
  2402.              sprintf(buffer, "%lf dup scale\n", ps->scale);
  2403.              writestring(buffer);
  2404.           }
  2405. +         writestring("userdict/PStoPSmatrix matrix currentmatrix put\n");
  2406.           if (width > 0 && height > 0) {
  2407. !            char buffer[BUFSIZ];
  2408. !            writestring("userdict/PStoPSclip{0 0 moveto\n");
  2409. !            sprintf(buffer, " %lf 0 rlineto 0 %lf rlineto -%lf 0 rlineto\n",
  2410. !                width, height, width);
  2411. !            writestring(buffer);
  2412. !            writestring(" closepath}put initclip\n");
  2413.              if (draw > 0) {
  2414.             sprintf(buffer, "gsave clippath 0 setgray %lf setlinewidth stroke grestore\n", draw);
  2415.             writestring(buffer);
  2416.              }
  2417.           }
  2418.        }
  2419.        if (add_next) {
  2420.   #ifndef SHOWPAGE_LOAD
  2421.           writestring("/showpage{}def/copypage{}def/erasepage{}def\n");
  2422.   #else
  2423. !         writestring("/PStoPSshowpage{}store/PStoPScopypage{}store/PStoPSerasepage{}store\n");
  2424.   #endif
  2425.        }
  2426. !      if (actualpg < pages) {
  2427. !         writepagesetup();
  2428. !         writestring("PStoPSxform concat\n");
  2429.           writepagebody(actualpg);
  2430. !      } else
  2431.           writestring("showpage\n");
  2432. !      writestring("PStoPSsaved restore\n");
  2433.        add_last = add_next;
  2434.         }
  2435.      }
  2436. diff -cr +new-file psutils-dist/pstops.c psutils-next/pstops.c
  2437. *** psutils-dist/pstops.c    Mon Nov 29 10:34:42 1993
  2438. --- psutils-next/pstops.c    Mon Nov 29 17:03:47 1993
  2439. ***************
  2440. *** 8,14 ****
  2441.   
  2442.   #include "psutil.h"
  2443.   #include "psspec.h"
  2444. ! #include "patchlevel.h"
  2445.   
  2446.   void usage()
  2447.   {
  2448. --- 8,14 ----
  2449.   
  2450.   #include "psutil.h"
  2451.   #include "psspec.h"
  2452. ! #include "patchlev.h"
  2453.   
  2454.   void usage()
  2455.   {
  2456. diff -cr +new-file psutils-dist/pstops.man psutils-next/pstops.man
  2457. *** psutils-dist/pstops.man    Mon Nov 29 10:34:37 1993
  2458. --- psutils-next/pstops.man    Sat Nov 27 14:09:59 1993
  2459. ***************
  2460. *** 1,4 ****
  2461. ! .TH PSTOPS 1 "PSUtils Release @REL@ Patchlevel @PL@"
  2462.   .SH NAME
  2463.   pstops \- shuffle pages in a PostScript file
  2464.   .SH SYNOPSIS
  2465. --- 1,4 ----
  2466. ! .TH PSTOPS 1 "PSUtils Release @RELEASE@ Patchlevel @PATCHLEVEL@"
  2467.   .SH NAME
  2468.   pstops \- shuffle pages in a PostScript file
  2469.   .SH SYNOPSIS
  2470. diff -cr +new-file psutils-dist/psutil.c psutils-next/psutil.c
  2471. *** psutils-dist/psutil.c    Mon Nov 29 10:34:42 1993
  2472. --- psutils-next/psutil.c    Mon Nov 29 19:39:51 1993
  2473. ***************
  2474. *** 13,19 ****
  2475.    */
  2476.   #define LOCAL
  2477.   #include "psutil.h"
  2478. ! #include "patchlevel.h"
  2479.   
  2480.   #ifdef VMS
  2481.   #include <file.h>
  2482. --- 13,19 ----
  2483.    */
  2484.   #define LOCAL
  2485.   #include "psutil.h"
  2486. ! #include "patchlev.h"
  2487.   
  2488.   #ifdef VMS
  2489.   #include <file.h>
  2490. ***************
  2491. *** 31,36 ****
  2492. --- 31,38 ----
  2493.   static long pagescmt = 0;
  2494.   static long headerpos = 0;
  2495.   static long endsetup = 0;
  2496. + static long beginprocset = 0;        /* start of pstops procset */
  2497. + static long endprocset = 0;
  2498.   static int outputpage = 0;
  2499.   static int maxpages = 100;
  2500.   static long *pageptr;
  2501. ***************
  2502. *** 119,124 ****
  2503. --- 121,127 ----
  2504.   #endif
  2505.   }
  2506.   
  2507.   /* copy input file from current position upto new position to output file */
  2508.   static int fcopy(upto)
  2509.        long upto;
  2510. ***************
  2511. *** 176,181 ****
  2512. --- 179,190 ----
  2513.              nesting--;
  2514.           else if (nesting == 0 && iscomment(comment, "EndSetup"))
  2515.              endsetup = record;
  2516. +         else if (nesting == 0 &&
  2517. +                iscomment(comment, "BeginProcSet: PStoPS"))
  2518. +            beginprocset = record;
  2519. +         else if (beginprocset && !endprocset &&
  2520. +              iscomment(comment, "EndProcSet"))
  2521. +            endprocset = ftell(infile);
  2522.           else if (nesting == 0 && iscomment(comment, "Trailer")) {
  2523.              fseek(infile, record, 0);
  2524.              break;
  2525. ***************
  2526. *** 217,222 ****
  2527. --- 226,232 ----
  2528.         } else
  2529.        for (end = start; !isspace(*end); end++);
  2530.         strncpy(pagelabel, start, end-start);
  2531. +       pagelabel[end-start] = '\0';
  2532.         pageno = atoi(end);
  2533.      } else {
  2534.         fprintf(stderr, "%s: I/O error seeking page %d\n", prog, p);
  2535. ***************
  2536. *** 234,239 ****
  2537. --- 244,250 ----
  2538.      bytes += strlen(s);
  2539.   }
  2540.   
  2541. + /* write page comment */
  2542.   void writepageheader(label, page)
  2543.        char *label;
  2544.        int page;
  2545. ***************
  2546. *** 246,251 ****
  2547. --- 257,288 ----
  2548.      writestring(buffer);
  2549.   }
  2550.   
  2551. + /* search for page setup */
  2552. + void writepagesetup()
  2553. + {
  2554. +    char buffer[BUFSIZ];
  2555. +    if (beginprocset) {
  2556. +       for (;;) {
  2557. +      if (fgets(buffer, BUFSIZ, infile) == NULL) {
  2558. +         fprintf(stderr, "%s: I/O error reading page setup %d\n", prog,
  2559. +             outputpage);
  2560. +         fflush(stderr);
  2561. +         exit(1);
  2562. +      }
  2563. +      if (!strncmp(buffer, "PStoPSxform", 11))
  2564. +         break;
  2565. +      if (fputs(buffer, outfile) == EOF) {
  2566. +         fprintf(stderr, "%s: I/O error writing page setup %d\n", prog,
  2567. +             outputpage);
  2568. +         fflush(stderr);
  2569. +         exit(1);
  2570. +      }
  2571. +      bytes += strlen(buffer);
  2572. +       }
  2573. +    }
  2574. + }
  2575. + /* write the body of a page */
  2576.   void writepagebody(p)
  2577.        int p;
  2578.   {
  2579. ***************
  2580. *** 256,261 ****
  2581. --- 293,299 ----
  2582.      }
  2583.   }
  2584.   
  2585. + /* write a whole page */
  2586.   void writepage(p)
  2587.        int p;
  2588.   {
  2589. ***************
  2590. *** 264,269 ****
  2591. --- 302,308 ----
  2592.      writepagebody(p);
  2593.   }
  2594.   
  2595. + /* write from start of file to end of header comments */
  2596.   void writeheader(p)
  2597.        int p;
  2598.   {
  2599. ***************
  2600. *** 284,292 ****
  2601.      }
  2602.   }
  2603.   
  2604.   
  2605. ! void writeprolog(setup)
  2606. !      char *setup;
  2607.   {
  2608.      if (!fcopy(endsetup)) {
  2609.         fprintf(stderr, "%s: I/O error in prologue\n", prog);
  2610. --- 323,344 ----
  2611.      }
  2612.   }
  2613.   
  2614. + /* write prologue to end of setup section excluding PStoPS procset */
  2615. + int writepartprolog()
  2616. + {
  2617. +    if (beginprocset && !fcopy(beginprocset)) {
  2618. +       fprintf(stderr, "%s: I/O error in prologue\n", prog);
  2619. +       fflush(stderr);
  2620. +       exit(1);
  2621. +    }
  2622. +    if (endprocset)
  2623. +       fseek(infile, endprocset, 0);
  2624. +    writeprolog();
  2625. +    return !beginprocset;
  2626. + }
  2627.   
  2628. ! /* write prologue up to end of setup section */
  2629. ! void writeprolog()
  2630.   {
  2631.      if (!fcopy(endsetup)) {
  2632.         fprintf(stderr, "%s: I/O error in prologue\n", prog);
  2633. ***************
  2634. *** 293,299 ****
  2635.         fflush(stderr);
  2636.         exit(1);
  2637.      }
  2638. !    writestring(setup);
  2639.      if (!fcopy(pageptr[0])) {
  2640.         fprintf(stderr, "%s: I/O error in prologue\n", prog);
  2641.         fflush(stderr);
  2642. --- 345,355 ----
  2643.         fflush(stderr);
  2644.         exit(1);
  2645.      }
  2646. ! }
  2647. ! /* write from end of setup to start of pages */
  2648. ! void writesetup()
  2649. ! {
  2650.      if (!fcopy(pageptr[0])) {
  2651.         fprintf(stderr, "%s: I/O error in prologue\n", prog);
  2652.         fflush(stderr);
  2653. ***************
  2654. *** 331,337 ****
  2655.      pos += len;
  2656.   }
  2657.   
  2658.   void writeemptypage()
  2659.   {
  2660.      if (verbose)
  2661. --- 387,393 ----
  2662.      pos += len;
  2663.   }
  2664.   
  2665. ! /* write a page with nothing on it */
  2666.   void writeemptypage()
  2667.   {
  2668.      if (verbose)
  2669. diff -cr +new-file psutils-dist/psutil.h psutils-next/psutil.h
  2670. *** psutils-dist/psutil.h    Mon Nov 29 10:34:37 1993
  2671. --- psutils-next/psutil.h    Sat Nov 27 13:19:14 1993
  2672. ***************
  2673. *** 32,40 ****
  2674. --- 32,43 ----
  2675.   LOCAL void writepage();
  2676.   LOCAL void seekpage();
  2677.   LOCAL void writepageheader();
  2678. + LOCAL void writepagesetup();
  2679.   LOCAL void writepagebody();
  2680.   LOCAL void writeheader();
  2681. + LOCAL int writepartprolog();
  2682.   LOCAL void writeprolog();
  2683. + LOCAL void writesetup();
  2684.   LOCAL void writetrailer();
  2685.   LOCAL void writeemptypage();
  2686.   LOCAL void scanpages();
  2687.  
  2688. exit 0 # Just in case...
  2689.