home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume35
/
psutils
/
patch01
/
Patch1.7-1.8
Wrap
Text File
|
1993-03-04
|
19KB
|
650 lines
diff -c -r +new-file psutils-dist/LICENSE psutils/LICENSE
*** psutils-dist/LICENSE Mon Feb 8 11:33:39 1993
--- psutils/LICENSE Wed Feb 10 13:59:08 1993
***************
*** 1,13 ****
PS Utilities Package
! The constituent files of this package listed below are copyright (C) 1991,1992
! Angus J. C. Duggan.
! Makefile README buffer.c epsffit.c fixfmps
! fixmacps fixpspps getafm magic.c psbook.1
! psbook.c psnup psnup.1 psselect.1 psselect.c
! pstops.1 pstops.c psutil.c psutil.h showchar
They may be copied and used for any purpose (including distribution as part of
a for-profit product), provided:
--- 1,14 ----
PS Utilities Package
! The constituent files of this package listed below are copyright (C) 1991,
! 1992, 1993 Angus J. C. Duggan.
! LICENSE Makefile README epsffit.c fixfmps
! fixmacps fixpsditps fixpspps fixwfwps fixwpps
! getafm patchlevel.h psbook.1 psbook.c psnup.1
! psnup.sh psselect.1 psselect.c pstops.1 pstops.c
! psutil.c psutil.h showchar
They may be copied and used for any purpose (including distribution as part of
a for-profit product), provided:
***************
*** 33,36 ****
The included files appledict.ps, md68.0.ps and md71.0.ps are (to the best of my
knowledge) copyright Apple Computer, Inc.
! AJCD 25/3/92
--- 34,37 ----
The included files appledict.ps, md68.0.ps and md71.0.ps are (to the best of my
knowledge) copyright Apple Computer, Inc.
! AJCD 10/1/93
diff -c -r +new-file psutils-dist/Makefile psutils/Makefile
*** psutils-dist/Makefile Mon Feb 8 11:33:32 1993
--- psutils/Makefile Wed Feb 10 14:49:22 1993
***************
*** 1,6 ****
# Makefile for PS utilities
! CFLAGS=-O
# epsffit fits an epsf file to a given bounding box
# psbook rearranges pages into signatures
--- 1,12 ----
# Makefile for PS utilities
! CFLAGS=-g
! INSTALL=install -c -m 0755
! INSTALLMAN=install -c -m 0644
! BINDIR=/usr/local/bin
! MANDIR=/usr/local/share/man/man1
! MANEXT=1
! PAPER=a4
# epsffit fits an epsf file to a given bounding box
# psbook rearranges pages into signatures
***************
*** 7,14 ****
# psselect selects page ranges
# pstops performs general page rearrangement and merging
! all: psbook psselect pstops epsffit
epsffit: epsffit.c
$(CC) $(CFLAGS) -o epsffit epsffit.c
--- 13,23 ----
# psselect selects page ranges
# pstops performs general page rearrangement and merging
! ALL = psbook psselect pstops epsffit psnup
! ALLPLUS = $(ALL) fixfmps fixmacps fixpsditps fixpspps fixwfwps fixwpps
+ all: $(ALL)
+
epsffit: epsffit.c
$(CC) $(CFLAGS) -o epsffit epsffit.c
***************
*** 29,33 ****
psselect.c: psutil.h patchlevel.h
clean:
! rm -f *.o psbook psselect pstops epsffit
--- 38,64 ----
psselect.c: psutil.h patchlevel.h
+ psnup: psnup.sh patchlevel.h
+ r=`sed -n -e "s/^#define RELEASE \([0-9][0-9]*\)/\1/p" <patchlevel.h`; \
+ p=`sed -n -e "s/^#define PATCHLEVEL \([0-9][0-9]*\)/\1/p" <patchlevel.h`; \
+ sed -e "s/@PATCHLEVEL@/$$p/" -e "s/@RELEASE@/$$r/" -e "s/@PAPER@/$(PAPER)/" psnup.sh >psnup; \
+ chmod 755 psnup
+
clean:
! rm -f *.o
!
! veryclean: clean
! rm -f $(ALL)
!
! install:
! @for i in $(ALLPLUS); do \
! echo Installing $$i; \
! $(INSTALL) $$i $(BINDIR); \
! done
!
! installman:
! @for i in $(ALL); do \
! echo Installing manual page for $$i; \
! $(INSTALLMAN) $$i.1 $(MANDIR)/$$i.$(MANEXT); \
! done
!
diff -c -r +new-file psutils-dist/Manifest psutils/Manifest
*** psutils-dist/Manifest Mon Feb 8 11:33:40 1993
--- psutils/Manifest Wed Feb 10 12:52:15 1993
***************
*** 2,9 ****
Makefile
Manifest
README
! patchlevel.h
! appledict.ps
epsffit.c
fixfmps
fixmacps
--- 2,8 ----
Makefile
Manifest
README
! epsffit.1
epsffit.c
fixfmps
fixmacps
***************
*** 14,23 ****
getafm
md68.0.ps
md71.0.ps
psbook.1
psbook.c
- psnup
psnup.1
psselect.1
psselect.c
pstops.1
--- 13,23 ----
getafm
md68.0.ps
md71.0.ps
+ patchlevel.h
psbook.1
psbook.c
psnup.1
+ psnup.sh
psselect.1
psselect.c
pstops.1
diff -c -r +new-file psutils-dist/README psutils/README
*** psutils-dist/README Mon Feb 8 11:33:18 1993
--- psutils/README Thu Feb 11 09:27:14 1993
***************
*** 59,65 ****
showchar (sh) outputs PostScript to draw a character with metric info
fixfmps (perl) filter to fix framemaker documents so that psselect etc. work
fixwpps (perl) filter to fix WordPerfect documents so that psselect etc. work
! fixwpps (perl) filter to fix Word for Windows documents for psutils
fixmacps (perl) filter to fix Macintosh documents with saner version of md
fixpsditps (perl) filter to fix Transcript psdit documents to work with psutils
fixpspps (perl) filter to fix PSPrint PostScript so that psselect etc. work
--- 59,65 ----
showchar (sh) outputs PostScript to draw a character with metric info
fixfmps (perl) filter to fix framemaker documents so that psselect etc. work
fixwpps (perl) filter to fix WordPerfect documents so that psselect etc. work
! fixwfwps (perl) filter to fix Word for Windows documents for psutils
fixmacps (perl) filter to fix Macintosh documents with saner version of md
fixpsditps (perl) filter to fix Transcript psdit documents to work with psutils
fixpspps (perl) filter to fix PSPrint PostScript so that psselect etc. work
***************
*** 83,86 ****
--- 83,103 ----
This is an interim release; these utilities are currently being re-written
from scratch, with a full DSC-3.0 parser and more extraction, merging, and
inclusion options included.
+
+ ACKNOWLEDGEMENTS
+
+ Bug fixes and suggestions for improvements to PSUtils have come from many
+ people, including:
+
+ Brian Colfer brianc@labmed.ucsf.edu
+ Charles A. Finnell finnell@org.mitre.lear
+ Conrad Kimball cek@com.boeing.sdc
+ J.W.Hawtin
+ Jochen Schwarze schwarze@de.isa
+ Ken Carpenter khc@edu.ksu.eece
+ Kristian Jorg etxkrjg@se.ericsson.solsta
+ Larry Weissman larryw@nsr.bioeng.washington.edu
+ Michael L. Brown brown%uucp.vidiot@edu.wisc.cs
+
+ (Apologies to anyone who I have left out.)
diff -c -r +new-file psutils-dist/epsffit.1 psutils/epsffit.1
*** psutils-dist/epsffit.1
--- psutils/epsffit.1 Mon Feb 8 10:35:42 1993
***************
*** 0 ****
--- 1,47 ----
+ .TH EPSFFIT 1
+ .SH NAME
+ epsffit \- fit encapsulated PostScript file (EPSF) into constrained size
+ .SH SYNOPSIS
+ .B epsffit
+ [
+ .B \-c
+ ]
+ [
+ .B \-r
+ ]
+ [
+ .B \-a
+ ]
+ [
+ .B \-s
+ ]
+ .I "llx lly urx ury"
+ [
+ .B file
+ ]
+ .SH DESCRIPTION
+ .I Epsffit
+ fits an EPSF file (encapsulated PostScript) to a given bounding box.
+ The coordinates of the box are given by \fB(llx,lly)\fR for the lower
+ left, and \fB(urx,ury)\fR for the upper right, in PostScript units (points).
+ .PP
+ If no file is specified,
+ .I epsffit
+ uses the standard input. Output is always to the standard output.
+ .SH OPTIONS
+ .IP \fB\-c\fP 1i
+ Center the image in the given bounding box.
+ .IP \fB\-r\fP 1i
+ Rotate the image by 90 degrees counter-clockwise.
+ .IP \fB\-a\fP 1i
+ Adjust the aspect ratio to fit the bounding box. The default is to preserve
+ the aspect ratio.
+ .IP \fB\-s\fP 1i
+ Add a \fIshowpage\fP at the end of the file to force the image to print.
+ .SH AUTHOR
+ Angus Duggan
+ .SH "SEE ALSO"
+ psbook(1), psselect(1)
+ .SH TRADEMARKS
+ .B PostScript
+ is a trademark of Adobe Systems Incorporated.
diff -c -r +new-file psutils-dist/epsffit.c psutils/epsffit.c
*** psutils-dist/epsffit.c Mon Feb 8 11:33:40 1993
--- psutils/epsffit.c Wed Feb 10 12:47:28 1993
***************
*** 2,12 ****
* AJCD 6 Dec 90
* fit epsf file into constrained size
* Usage:
! * epsffit [-c] [-r] [-a] [-s] llx lly urx ury
* -c centres the image in the bounding box given
* -r rotates the image by 90 degrees anti-clockwise
* -a alters the aspect ratio to fit the bounding box
* -s adds a showpage at the end of the image
*/
#include <stdio.h>
--- 2,14 ----
* AJCD 6 Dec 90
* fit epsf file into constrained size
* Usage:
! * epsffit [-c] [-r] [-a] [-s] llx lly urx ury [file]
* -c centres the image in the bounding box given
* -r rotates the image by 90 degrees anti-clockwise
* -a alters the aspect ratio to fit the bounding box
* -s adds a showpage at the end of the image
+ *
+ * Added filename spec (from Larry Weissman) 5 Feb 93
*/
#include <stdio.h>
***************
*** 21,27 ****
usage()
{
fprintf(stderr, "%s release %d patchlevel %d\n", prog, RELEASE, PATCHLEVEL);
! fprintf(stderr, "Usage: %s [-c] [-r] [-a] [-s] llx lly urx ury\n", prog);
exit(1);
}
--- 23,30 ----
usage()
{
fprintf(stderr, "%s release %d patchlevel %d\n", prog, RELEASE, PATCHLEVEL);
! fprintf(stderr, "Usage: %s [-c] [-r] [-a] [-s] llx lly urx ury [file]\n",
! prog);
exit(1);
}
***************
*** 29,40 ****
int argc;
char **argv;
{
- int fit[4], i;
int bbfound = 0; /* %%BoundingBox: found */
int urx, ury, llx, lly;
int furx, fury, fllx, flly, fwidth, fheight;
int showpage = 0, centre = 0, rotate = 0, aspect = 0;
char buf[BUFSIZ];
prog = *argv++; argc--;
--- 32,43 ----
int argc;
char **argv;
{
int bbfound = 0; /* %%BoundingBox: found */
int urx, ury, llx, lly;
int furx, fury, fllx, flly, fwidth, fheight;
int showpage = 0, centre = 0, rotate = 0, aspect = 0;
char buf[BUFSIZ];
+ FILE *input = stdin;
prog = *argv++; argc--;
***************
*** 51,57 ****
argv++;
}
! if (argc != 4) usage();
fllx = atoi(argv[0]);
flly = atoi(argv[1]);
furx = atoi(argv[2]);
--- 54,60 ----
argv++;
}
! if (argc < 4) usage();
fllx = atoi(argv[0]);
flly = atoi(argv[1]);
furx = atoi(argv[2]);
***************
*** 63,70 ****
fwidth = furx - fllx;
fheight = fury - flly;
}
! while (fgets(buf, BUFSIZ, stdin)) {
if (buf[0] == '%' && (buf[1] == '%' || buf[1] == '!')) {
/* still in comment section */
if (!strncmp(buf, "%%BoundingBox:", 14)) {
--- 66,79 ----
fwidth = furx - fllx;
fheight = fury - flly;
}
+ if (argc > 4) {
+ if(!(input = fopen(argv[4],"r"))) {
+ fprintf(stderr, "%s: Cannot open %s\n", prog, argv[4]);
+ exit(1);
+ }
+ }
! while (fgets(buf, BUFSIZ, input)) {
if (buf[0] == '%' && (buf[1] == '%' || buf[1] == '!')) {
/* still in comment section */
if (!strncmp(buf, "%%BoundingBox:", 14)) {
***************
*** 120,126 ****
}
do {
fputs(buf,stdout);
! } while (fgets(buf, BUFSIZ, stdin));
if (bbfound) {
puts("grestore");
if (showpage)
--- 129,135 ----
}
do {
fputs(buf,stdout);
! } while (fgets(buf, BUFSIZ, input));
if (bbfound) {
puts("grestore");
if (showpage)
diff -c -r +new-file psutils-dist/fixfmps psutils/fixfmps
*** psutils-dist/fixfmps Mon Feb 8 11:33:41 1993
--- psutils/fixfmps Wed Feb 10 14:38:18 1993
***************
*** 2,7 ****
--- 2,11 ----
# fixfmps: get conforming PostScript out of FrameMaker file
# move all FMDEFINEFONTs to start of pages
+ # feed this into perl
+ eval 'exec perl -S $0 "$@"'
+ if $running_under_some_shell;
+
%fonts=();
while (<>) {
diff -c -r +new-file psutils-dist/fixmacps psutils/fixmacps
*** psutils-dist/fixmacps Mon Feb 8 11:33:41 1993
--- psutils/fixmacps Wed Feb 10 14:38:06 1993
***************
*** 1,6 ****
--- 1,10 ----
#!/usr/local/bin/perl
# fixmacps: swap to sanitised appledict
+ # feed this into perl
+ eval 'exec perl -S $0 "$@"'
+ if $running_under_some_shell;
+
$line = 0; # keep line count
$dir = "/usr/local/share/tex/dvips";
$prefix = "md";
***************
*** 15,20 ****
--- 19,26 ----
}
}
+ %fonts = ();
+
while (<>) {
if (/^%!/) {
if (! $line) {
***************
*** 52,61 ****
print "%!\n" if !$line;
print;
}
} else {
if (! $ignore) {
! print "%!\n" if !$line;
! print;
}
}
$line++;
--- 58,75 ----
print "%!\n" if !$line;
print;
}
+ } elsif (/^%%Page:/) {
+ print $_;
+ print values(%fonts);
} else {
if (! $ignore) {
! if (/^\{\}mark .*rf$/) {
! $fonts{$_} = $_;
! print;
! } else {
! print "%!\n" if !$line;
! print;
! }
}
}
$line++;
diff -c -r +new-file psutils-dist/fixpsditps psutils/fixpsditps
*** psutils-dist/fixpsditps Mon Feb 8 11:33:42 1993
--- psutils/fixpsditps Wed Feb 10 14:38:26 1993
***************
*** 1,6 ****
--- 1,10 ----
#!/usr/local/bin/perl
# fixpsditps: fix psdit output for use in psutils
+ # feed this into perl
+ eval 'exec perl -S $0 "$@"'
+ if $running_under_some_shell;
+
while (<>) {
if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) {
print STDOUT "/p{pop showpage pagesave restore}def\n";
diff -c -r +new-file psutils-dist/fixpspps psutils/fixpspps
*** psutils-dist/fixpspps Mon Feb 8 11:33:42 1993
--- psutils/fixpspps Wed Feb 10 14:38:35 1993
***************
*** 1,6 ****
--- 1,10 ----
#!/usr/local/bin/perl
# mangle PostScript produced by PSPrint to make it almost conforming
+ # feed this into perl
+ eval 'exec perl -S $0 "$@"'
+ if $running_under_some_shell;
+
$header = 1; $ignore = 0;
$verbose = 0;
@body = ();
diff -c -r +new-file psutils-dist/fixwfwps psutils/fixwfwps
*** psutils-dist/fixwfwps Mon Feb 8 11:33:43 1993
--- psutils/fixwfwps Wed Feb 10 14:38:45 1993
***************
*** 1,6 ****
--- 1,10 ----
#!/usr/local/bin/perl
# fixwfwps: fix Word for windows PostScript for printing.
+ # feed this into perl
+ eval 'exec perl -S $0 "$@"'
+ if $running_under_some_shell;
+
while (<>) {
tr/\000-\011\013-\037//d;
if (/^(%!PS-Adobe-[0-9]*\.[0-9]*) EPSF-/) {
diff -c -r +new-file psutils-dist/fixwpps psutils/fixwpps
*** psutils-dist/fixwpps Mon Feb 8 11:33:26 1993
--- psutils/fixwpps Wed Feb 10 14:38:53 1993
***************
*** 1,6 ****
--- 1,10 ----
#!/usr/local/bin/perl
# fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file
+ # feed this into perl
+ eval 'exec perl -S $0 "$@"'
+ if $running_under_some_shell;
+
$page = 1;
while (<>) {
s/(_[a-zA-Z]+)([0-9]+)/\1 \2/g;
diff -c -r +new-file psutils-dist/patchlevel.h psutils/patchlevel.h
*** psutils-dist/patchlevel.h Mon Feb 8 11:33:44 1993
--- psutils/patchlevel.h Wed Feb 10 12:47:18 1993
***************
*** 1,2 ****
#define RELEASE 1
! #define PATCHLEVEL 7
--- 1,2 ----
#define RELEASE 1
! #define PATCHLEVEL 8
diff -c -r +new-file psutils-dist/psnup.sh psutils/psnup.sh
*** psutils-dist/psnup.sh
--- psutils/psnup.sh Wed Feb 10 14:14:49 1993
***************
*** 0 ****
--- 1,93 ----
+ #!/bin/sh
+ # psnup: put multiple pages onto one physical sheet of paper.
+ # usage:
+ # psnup [-w<dim>] [-h<dim>] [-ppaper] [-l] [-2|-4|-8|-9] [file...]
+ # -w<dim> sets the paper width
+ # -h<dim> sets the paper height
+ # -ppaper sets the paper size (width and height) by name
+ # -l is used if the pages are in landscape orientation
+
+ io= landscape=0 nup=1 width= height= paper=@PAPER@
+
+ while test $# != 0
+ do case "$1" in
+ -w*) width=$1 ; paper= ;;
+ -h*) height=$1 ; paper= ;;
+ -p*) paper=`echo "$1" | sed "s/^-.//"` ;;
+ -m*) margins=`echo "$1" | sed "s/^-.//"` ;; # not implemented yet
+ -l) landscape=1 ;;
+ -2) nup=2 ;;
+ -4) nup=4 ;;
+ -8) nup=8 ;;
+ -9) nup=9 ;;
+ -s*) xscale=`echo "$1" | sed "s/^-./@/"` ;;
+ -v) echo "psnup release @RELEASE@ patchlevel @PATCHLEVEL@" ; exit 1 ;;
+ *) io="$io $1"
+ esac
+ shift
+ done
+
+ tscale=@.707 # scale for twoup
+ fscale=@.5 # scale for fourup
+ escale=@.3536 # scale for eightup
+ nscale=@.333 # scale for nineup
+
+ case "$paper" in
+ a3|A3) width=-w29.7cm height=-h42cm ;;
+ a4|A4) width=-w21cm height=-h29.7cm ;;
+ a5|A5) width=-w14.85cm height=-h21cm ;;
+ letter) width=-w8.5in height=-h11in tscale=@.648 escale=@.324 ;;
+ esac
+
+ scale= offset=
+ case "$nup" in
+ 2) scale=$tscale
+ if [ $landscape = 0 ]
+ then offset="(1w,0) (1w,.5h)"
+ else offset="(0,.5h) (0,0)"
+ fi
+ landscape=`expr 1 - $landscape` ;;
+ 4) scale=$fscale
+ if [ $landscape = 0 ]
+ then offset="(0,.5h) (.5w,.5h) (0,0) (.5w,0)"
+ else offset="(.5w,0) (.5w,.5h) (1w,0) (1w,.5h)"
+ fi ;;
+ 8) scale=$escale
+ if [ $landscape = 0 ]
+ then offset="(.5w,0) (.5w,.25h) (.5w,.5h) (.5w,.75h)\
+ (1w,0) (1w,.25h) (1w,.5h) (1w,.75h)"
+ else offset="(0,.75h) (.5w,.75h) (0,.5h) (.5w,.5h)\
+ (0,.25h) (.5w,.25h) (0,0) (.5w,0)"
+ fi
+ landscape=`expr 1 - $landscape` ;;
+ 9) scale=$nscale
+ if [ $landscape = 0 ]
+ then offset="(0,.666h) (.333w,.666h) (.666w,.666h)\
+ (0,.333h) (.333w,.333h) (.666w,.333h)\
+ (0,0) (.333w,0) (.666w,0)"
+ else offset="(.333w,0) (.333w,.333h) (.333w,.666h)\
+ (.666w,0) (.666w,.333h) (.666w,.666h)\
+ (1w,0) (1w,.333h) (1w,.666h)"
+ fi ;;
+ esac
+
+ if [ "X$xscale" != "X" ]
+ then scale=$xscale
+ fi
+
+ if [ $landscape = 0 ]
+ then rotate=
+ else rotate=L
+ fi
+
+ options= sep= page=0
+
+ set ""${offset}
+ while [ $page -lt $nup ]
+ do options="$options${sep}$page$rotate$scale$1"
+ sep=+
+ page=`expr $page + 1`
+ shift
+ done
+
+ pstops $width $height "$nup:$options" $io