texlive/source-psutils.dif

376 lines
11 KiB
Plaintext

--- utils/psutils/psutils-1.17/Makefile.unix
+++ utils/psutils/psutils-1.17/Makefile.unix 2009-08-28 14:44:14.829902235 +0000
@@ -25,10 +25,10 @@ PAPER=a4
OS = UNIX
-BINDIR = /usr/local/bin
+BINDIR = /usr/bin
SCRIPTDIR = $(BINDIR)
-INCLUDEDIR = /usr/local/share/psutils
-PERL = /usr/local/bin/perl
+INCLUDEDIR = /usr/share/psutils
+PERL = /usr/bin/perl
BINMODE = 0755
MANMODE = 0644
@@ -36,10 +36,11 @@ CHMOD = chmod
INSTALL = install -c -m $(BINMODE)
INSTALLMAN = install -c -m $(MANMODE)
MANEXT = 1
-MANDIR = /usr/local/share/man/man$(MANEXT)
+MANDIR = /usr/share/man/man$(MANEXT)
CC = gcc
-CFLAGS = -DPAPER=\"$(PAPER)\" -DUNIX -O -Wall
+CFLAGS = -DPAPER=\"$(PAPER)\" -DUNIX $(RPM_OPT_FLAGS) -pipe -Wall
+CCFLAGS = $(CFLAGS)
BIN = psbook psselect pstops epsffit psnup \
psresize
--- utils/psutils/psutils-1.17/epsffit.c
+++ utils/psutils/psutils-1.17/epsffit.c 2009-08-28 14:47:36.941903881 +0000
@@ -47,8 +47,8 @@ int main(int argc, char **argv)
int furx, fury, fllx, flly;
int showpage = 0, centre = 0, rotate = 0, aspect = 0, maximise = 0;
char buf[BUFSIZ];
- FILE *input;
- FILE *output;
+ FILE *input = stdin;
+ FILE *output = stdout;
program = *argv++; argc--;
@@ -164,9 +164,14 @@ int main(int argc, char **argv)
yoffset -= lly * yscale;
}
fputs("%%EndComments\n", output);
- if (showpage)
- fputs("save /showpage{}def /copypage{}def /erasepage{}def\n", output);
- else
+ if (showpage) {
+ fputs("/startEpsffit {\n", output);
+ fputs(" /EpsffitSave {save} def\n", output);
+ fputs(" userdict 200 dict begin\n", output);
+ fputs(" /showpage{}def /copypage{}def /erasepage{}def\n", output);
+ fputs("}def\n", output);
+ fputs("startEpsffit\n", output);
+ } else
fputs("%%BeginProcSet: epsffit 1 0\n", output);
fputs("gsave\n", output);
fprintf(output, "%.3f %.3f translate\n", xoffset, yoffset);
@@ -182,7 +187,7 @@ int main(int argc, char **argv)
if (bbfound) {
fputs("grestore\n", output);
if (showpage)
- fputs("restore showpage\n", output); /* just in case */
+ fputs("end EpsffitSave restore showpage\n", output); /* just in case */
} else
message(FATAL, "no %%%%BoundingBox:\n");
--- utils/psutils/psutils-1.17/fixmacps.pl
+++ utils/psutils/psutils-1.17/fixmacps.pl 2009-08-28 14:44:14.833901961 +0000
@@ -7,7 +7,7 @@
use File::Basename;
$line = 0; # keep line count
-$predir = `kpsewhich -progname=dvips -format="other text files" md71_0.ps`;
+$predir = `kpsewhich -progname=dvips/psutils -format="other text files" md71_0.ps`;
$dir=`dirname $predir`;
$prefix = "md";
$default = "md71_0.ps";
--- utils/psutils/psutils-1.17/getafm
+++ utils/psutils/psutils-1.17/getafm 2009-08-28 14:44:14.833901961 +0000
@@ -1,7 +1,7 @@
#!/bin/sh
if [ $# -ne 1 ]; then
- echo "usage: $0 font-name | gsnd - >font-name.afm" >&2
+ echo "usage: $0 font-name | gsnd -q - >font-name.afm" >&2
exit 1
fi
@@ -66,8 +66,9 @@ cat << EOF
(isFixedPitch)(IsFixedPitch) prany
(UnderlinePosition)dup prany
(UnderlineThickness)dup prany
- (Version)(version) prany
+ (version)(Version) prany
(Notice)dup prany
+ (Copyright)dup prany
pop
}
{
--- utils/psutils/psutils-1.17/pserror.c
+++ utils/psutils/psutils-1.17/pserror.c 2009-08-28 14:44:14.833901961 +0000
@@ -17,7 +17,7 @@ extern char *program ; /* Defined by mai
warnings, and errors sent to stderr. If called with the flags MESSAGE_EXIT
set, the routine does not return */
-#define MAX_MESSAGE 256 /* maximum formatted message length */
+#define MAX_MESSAGE 1024 /* maximum formatted message length */
#define MAX_FORMAT 16 /* maximum format length */
#define MAX_COLUMN 78 /* maximum column to print upto */
@@ -27,6 +27,7 @@ void message(int flags, char *format, ..
static int column = 0 ; /* current screen column for message wrap */
char msgbuf[MAX_MESSAGE] ; /* buffer in which to put the message */
char *bufptr = msgbuf ; /* message buffer pointer */
+ char *tail = bufptr + MAX_MESSAGE;
if ( (flags & MESSAGE_NL) && column != 0 ) { /* new line if not already */
putc('\n', stderr) ;
@@ -34,8 +35,11 @@ void message(int flags, char *format, ..
}
if ( flags & MESSAGE_PROGRAM ) {
+ const size_t len = strlen(program);
+ if (len + 2 >= tail - bufptr)
+ goto out;
strcpy(bufptr, program) ;
- bufptr += strlen(program) ;
+ bufptr += len;
*bufptr++ = ':' ;
*bufptr++ = ' ' ;
}
@@ -55,13 +59,15 @@ void message(int flags, char *format, ..
fmtbuf[index] = '\0' ;
switch (c) {
case '%':
+ if (bufptr >= tail)
+ goto out;
*bufptr++ = '%' ;
case '\0':
break ;
case 'e': case 'E': case 'f': case 'g': case 'G':
{
double d = va_arg(args, double) ;
- sprintf(bufptr, fmtbuf, d) ;
+ snprintf(bufptr, tail - bufptr, fmtbuf, d);
bufptr += strlen(bufptr) ;
}
break ;
@@ -69,17 +75,17 @@ void message(int flags, char *format, ..
case 'p': case 'u': case 'x': case 'X':
if ( longform ) {
long l = va_arg(args, long) ;
- sprintf(bufptr, fmtbuf, l) ;
+ snprintf(bufptr, tail - bufptr, fmtbuf, l);
} else {
int i = va_arg(args, int) ;
- sprintf(bufptr, fmtbuf, i) ;
+ snprintf(bufptr, tail - bufptr, fmtbuf, i);
}
bufptr += strlen(bufptr) ;
break ;
case 's':
{
char *s = va_arg(args, char *) ;
- sprintf(bufptr, fmtbuf, s) ;
+ snprintf(bufptr, tail - bufptr, fmtbuf, s);
bufptr += strlen(bufptr) ;
}
break ;
@@ -92,6 +98,8 @@ void message(int flags, char *format, ..
} while ( !done ) ;
} else if ( c == '\n' ) { /* write out message so far and reset column */
int len = bufptr - msgbuf ; /* length of current message */
+ if (bufptr >= tail)
+ goto out;
*bufptr++ = '\n' ;
*bufptr = '\0' ;
if ( column + len > MAX_COLUMN && column > 0 ) {
@@ -100,8 +108,11 @@ void message(int flags, char *format, ..
}
fputs(bufptr = msgbuf, stderr) ;
column = 0 ;
- } else
+ } else {
+ if (bufptr >= tail)
+ goto out;
*bufptr++ = c ;
+ }
}
*bufptr = '\0' ;
{
@@ -117,6 +128,7 @@ void message(int flags, char *format, ..
}
va_end(args) ;
- if ( flags & MESSAGE_EXIT ) /* don't return to program */
+out:
+ if (flags & MESSAGE_EXIT) /* don't return to program */
exit(1) ;
}
--- utils/psutils/psutils-1.17/psmerge.man
+++ utils/psutils/psutils-1.17/psmerge.man 2009-08-28 14:44:14.833901961 +0000
@@ -24,6 +24,26 @@ standard output.
.I Psmerge
will merge multiple files concatenated into a single file as if they
were in separate files.
+.SH BUGS
+.I psmerge
+is for a very specific case; it does not merge files in the general case.
+.br
+For all those cases which can not be handled by
+.I psmerge
+the program
+.I gs
+(known as ghostscript) may help:
+
+.sp 1
+.in +1c
+.nf
+ gs -dNOPAUSE -sDEVICE=pswrite -sOutputFile=out.ps \\
+ file1.ps file2.ps ... -c quit
+.fi
+.in -1c
+.sp 1
+
+This is rather slow and generates bigger output files.
.SH AUTHOR
Copyright (C) Angus J. C. Duggan 1991-1995
.SH "SEE ALSO"
@@ -31,6 +51,3 @@ Copyright (C) Angus J. C. Duggan 1991-19
.SH TRADEMARKS
.B PostScript
is a trademark of Adobe Systems Incorporated.
-.SH BUGS
-.I psmerge
-is for a very specific case; it does not merge files in the general case.
--- utils/psutils/psutils-1.17/psselect.c
+++ utils/psutils/psutils-1.17/psselect.c 2009-08-28 14:44:14.837902516 +0000
@@ -52,6 +52,9 @@ static PageRange *addrange(char *str, Pa
{
int first=0;
int sign;
+
+ if(!str) return NULL;
+
sign = (*str == '_' && ++str) ? -1 : 1;
if (isdigit(*str)) {
first = sign*atoi(str);
--- utils/psutils/psutils-1.17/psspec.c
+++ utils/psutils/psutils-1.17/psspec.c 2009-08-28 14:44:14.837902516 +0000
@@ -12,6 +12,9 @@
#include <string.h>
+/* #define SHOWPAGE_LOAD 1 */
+#undef SHOWPAGE_LOAD
+
double width = -1;
double height = -1;
--- utils/psutils/psutils-1.17/pstops.man
+++ utils/psutils/psutils-1.17/pstops.man 2009-08-28 14:44:14.837902516 +0000
@@ -86,7 +86,7 @@ the document, instead of the start.
If page \fIspec\fRs are separated by
.B \+
the pages will be merged into one page; if they are separated by
-.B \,
+.B ,
they will be on separate pages.
If there is only one page specification, with
.I pageno
--- utils/psutils/psutils-1.17/psutil.c
+++ utils/psutils/psutils-1.17/psutil.c 2009-08-28 14:44:14.837902516 +0000
@@ -44,14 +44,45 @@ static long *pageptr;
/* list of paper sizes supported */
static Paper papersizes[] = {
- { "a3", 842, 1191 }, /* 29.7cm * 42cm */
- { "a4", 595, 842 }, /* 21cm * 29.7cm */
- { "a5", 421, 595 }, /* 14.85cm * 21cm */
- { "b5", 516, 729 }, /* 18.2cm * 25.72cm */
- { "A3", 842, 1191 }, /* 29.7cm * 42cm */
- { "A4", 595, 842 }, /* 21cm * 29.7cm */
- { "A5", 421, 595 }, /* 14.85cm * 21cm */
- { "B5", 516, 729 }, /* 18.2cm * 25.72cm */
+ { "a0", 2384, 3370 },
+ { "a1", 1684, 2384 },
+ { "a2", 1191, 1684 },
+ { "a3", 842, 1191 }, /* 29.7cm * 42cm */
+ { "a4", 595, 842 }, /* 21cm * 29.7cm */
+ { "a5", 421, 595 }, /* 14.85cm * 21cm */
+ { "a6", 297, 420 },
+ { "a7", 210, 297 },
+ { "a8", 148, 210 },
+ { "a9", 105, 148 },
+ { "a10", 73, 105 },
+ { "isob0", 2835, 4008 },
+ { "b0", 2835, 4008 },
+ { "isob1", 2004, 2835 },
+ { "b1", 2004, 2835 },
+ { "isob2", 1417, 2004 },
+ { "b2", 1417, 2004 },
+ { "isob3", 1001, 1417 },
+ { "b3", 1001, 1417 },
+ { "isob4", 709, 1001 },
+ { "b4", 709, 1001 },
+ { "isob5", 499, 709 },
+ { "b5", 499, 709 },
+ { "isob6", 354, 499 },
+ { "b6", 354, 499 },
+ { "jisb0", 2920, 4127 },
+ { "jisb1", 2064, 2920 },
+ { "jisb2", 1460, 2064 },
+ { "jisb3", 1032, 1460 },
+ { "jisb4", 729, 1032 },
+ { "jisb5", 516, 729 },
+ { "jisb6", 363, 516 },
+ { "c0", 2599, 3677 },
+ { "c1", 1837, 2599 },
+ { "c2", 1298, 1837 },
+ { "c3", 918, 1298 },
+ { "c4", 649, 918 },
+ { "c5", 459, 649 },
+ { "c6", 323, 459 },
{ "letter", 612, 792 }, /* 8.5in * 11in */
{ "legal", 612, 1008 }, /* 8.5in * 14in */
{ "ledger", 1224, 792 }, /* 17in * 11in */
@@ -61,6 +92,14 @@ static Paper papersizes[] = {
{ "folio", 612, 936 }, /* 8.5in * 13in */
{ "quarto", 610, 780 }, /* 8.5in * 10.83in */
{ "10x14", 720, 1008 }, /* 10in * 14in */
+ { "archE", 2592, 3456 },
+ { "archD", 1728, 2592 },
+ { "archC", 1296, 1728 },
+ { "archB", 864, 1296 },
+ { "archA", 648, 864 },
+ { "flsa", 612, 936 }, /* U.S. foolscap */
+ { "flse", 612, 936 }, /* European foolscap */
+ { "halfletter", 396, 612 },
{ NULL, 0, 0 }
};
@@ -69,7 +108,7 @@ Paper* findpaper(char *name)
{
Paper *pp;
for (pp = papersizes; PaperName(pp); pp++) {
- if (strcmp(PaperName(pp), name) == 0) {
+ if (strncasecmp(PaperName(pp), name, strlen(PaperName(pp))) == 0) {
return pp;
}
}
@@ -88,16 +127,15 @@ FILE *seekable(FILE *fp)
#if defined(WINNT) || defined(WIN32)
struct _stat fs ;
#else
- long fpos;
+ struct stat fs;
#endif
#if defined(WINNT) || defined(WIN32)
if (_fstat(fileno(fp), &fs) == 0 && (fs.st_mode&_S_IFREG) != 0)
return (fp);
#else
- if ((fpos = ftell(fp)) >= 0)
- if (!fseek(fp, 0L, SEEK_END) && !fseek(fp, fpos, SEEK_SET))
- return (fp);
+ if (fstat(fileno(fp), &fs) == 0 && S_ISREG(fs.st_mode))
+ return (fp);
#endif
#if defined(MSDOS)