* Update to 2.5.2.

* All-around clean-up.
* Fix licensing information.

Once upon a time okayed by maintainer.
This commit is contained in:
naddy 2002-07-07 17:03:36 +00:00
parent 84ff1d10fb
commit b064a31906
13 changed files with 130 additions and 308 deletions

View File

@ -1,43 +1,41 @@
# OpenBSD ports makefile for: mpage
#
# Version required: mpage 2.5
# Date created: August, 10th 1999
# Whom: Ian McWilliam
# $OpenBSD: Makefile,v 1.16 2002/03/21 21:25:50 espie Exp $
# $OpenBSD: Makefile,v 1.17 2002/07/07 17:03:36 naddy Exp $
COMMENT= "print multiple pages per sheet on PostScript printer"
DISTNAME= mpage-2.5
DISTNAME= mpage-2.5.2
CATEGORIES= print
MASTER_SITES= ftp://ftp.mesa.nl/pub/mpage/
EXTRACT_SUFX= .tgz
NEED_VERSION= 1.515
MAINTAINER= Ian McWilliam <i.mcwilliam@uws.edu.au>
# License: BSD
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_PACKAGE_CDROM= "incomplete license"
PERMIT_PACKAGE_FTP= "incomplete license"
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
FLAVORS=us_letter legal a4
FLAVOR?=a4
MASTER_SITES= ftp://ftp.mesa.nl/pub/mpage/
EXTRACT_SUFX= .tgz
FLAVORS= letter legal a4
FLAVOR?= a4
fetch-depends:
.if ${FLAVOR:L} == "us_letter"
MAKE_ENV+= PAGESIZE=PAGE_LETTER
ALL_TARGET= default
MAKE_FLAGS= CC='${CC}' CFLAGS='${CFLAGS} $${DEFS}' PREFIX='${PREFIX}'
.if ${FLAVOR:L} == "letter"
MAKE_FLAGS+= PAGESIZE=PAGE_LETTER
.elif ${FLAVOR:L} == "legal"
MAKE_ENV+= PAGESIZE=PAGE_LEGAL
MAKE_FLAGS+= PAGESIZE=PAGE_LEGAL
.elif ${FLAVOR:L} == "a4"
MAKE_ENV+= PAGESIZE=PAGE_A4
MAKE_FLAGS+= PAGESIZE=PAGE_A4
.else
@echo ""
@echo >&2 "Unknown flavor: ${FLAVOR}"
@echo >&2 "You must set ONE flavor: ${FLAVORS}"
@echo ""
@exit 1
ERRORS+= "Fatal: You must set exactly ONE flavor: ${FLAVORS}"
.endif
do-install:
${INSTALL_PROGRAM} ${WRKBUILD}/mpage ${PREFIX}/bin
${INSTALL_DATA} ${WRKSRC}/mpage.1 ${PREFIX}/man/man1
perl -pi -e 's!%%PREFIX%%!${TRUEPREFIX}!' ${PREFIX}/man/man1/mpage.1
${INSTALL_DATA_DIR} ${PREFIX}/share/mpage
${INSTALL_DATA} ${WRKSRC}/Encodings/* ${PREFIX}/share/mpage
.include <bsd.port.mk>

View File

@ -1,3 +1,3 @@
MD5 (mpage-2.5.tgz) = 503b17df96b182035c63602d850b1dec
RMD160 (mpage-2.5.tgz) = cf035f5f3c8fbe9ad448e94ab3f3f6d3811b5bc5
SHA1 (mpage-2.5.tgz) = 84253fe3551b37ca857e487a93cca7532608ed29
MD5 (mpage-2.5.2.tgz) = a79ac73c3bfe19e6cb72dcbd90a2fccc
RMD160 (mpage-2.5.2.tgz) = d647e50243604fee5ec5edd0f37557a3ae869039
SHA1 (mpage-2.5.2.tgz) = f5a18c4157798d8850ca07df0ab6cddcf6f641db

View File

@ -1,50 +0,0 @@
--- Makefile.orig Wed Nov 26 00:16:06 1997
+++ Makefile Thu Mar 15 22:21:56 2001
@@ -30,7 +30,7 @@
# Set this to an ANSI compatible C compiler (preferably gcc)
# See also system specific settings below
#CC=cc
-CC=gcc
+#CC=gcc
############################################################################
#
@@ -45,7 +45,7 @@
# PAGE_A4 for European A4
#
# PAGESIZE=PAGE_LETTER
-PAGESIZE=PAGE_A4
+# PAGESIZE=PAGE_A4
#
# Define your spooler type
@@ -55,7 +55,6 @@
SPOOL_TYPE=BSD_SPOOLER
# PREFIX=e:/usr # OS/2 type
-PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
LIBDIR=$(PREFIX)/lib
MANDIR=$(PREFIX)/man/man1
@@ -111,7 +110,10 @@
# If you are using gcc, you probably don't need to change anything here.
# Linux:
-CFLAGS = -O2 -s $(DEFS) -Wall
+#CFLAGS = -O2 -s $(DEFS) -Wall
+
+# OpenBSD:
+CFLAGS += $(DEFS)
# AIX (xlC on aix 4):
#CFLAGS = -O2 -s $(DEFS)
@@ -141,6 +143,9 @@
MOBJ = mpage$(O) glob$(O) text$(O) post$(O) file$(O) page$(O) args$(O)
SMPL = sample.c page.c glob.c args.c
SOBJ = sample$(O) page$(O) glob$(O) args$(O)
+
+all: mpage$(E) msample$(E)
+ @echo Done!
default: mpage$(E) msample$(E)
@echo Done!

View File

@ -1,20 +0,0 @@
--- mpage.1.orig Mon Aug 23 19:46:00 1999
+++ mpage.1 Mon Aug 23 19:48:14 1999
@@ -428,9 +428,9 @@
environment variables.
.SH FILES
-/bin/pr /bin/fold
+/usr/bin/pr /usr/bin/fold
.br
-/usr/tmp/mpageXXXXXX
+/tmp/mpage.XXXXXX
.SH BUGS
.PP
@@ -451,4 +451,4 @@
Mark P. Hahn (uunet!pyrdc!mark), Pyramid Technology Corporation.
-Help from many others, pleas see the CHANGES file.
+Help from many others, please see the CHANGES file.

View File

@ -1,18 +1,19 @@
--- args.c.orig Wed Nov 26 10:14:22 1997
+++ args.c Mon Dec 13 19:32:26 1999
@@ -45,6 +45,7 @@
$OpenBSD: patch-args_c,v 1.1 2002/07/07 17:03:37 naddy Exp $
--- args.c.orig Sun May 19 00:35:16 2002
+++ args.c Sun May 19 00:38:18 2002
@@ -35,6 +35,7 @@ do_args(int argc, char **argv, int envfl
int consumed;
int currarg;
int opterrors;
+ size_t len;
+ size_t len;
#define OPTARG() \
{ consumed = 1; if(*++optstr == '\0') optstr = argv[++currarg]; }
@@ -146,18 +147,17 @@
int i;
@@ -142,18 +143,17 @@ do_args(int argc, char **argv, int envfl
break;
case 'C': /* select character definitions */
consumed = 1;
+ len = (strlen(libdir) + strlen(optstr) + 2);
+ len = (strlen(libdir) + strlen(optstr) + 2);
if (*++optstr) { /* did we get a encoding name ? */
- if ((charvec_file = (char *) malloc(strlen(libdir) +
- strlen(optstr) +
@ -32,25 +33,12 @@
opt_encoding = 1;
}
}
@@ -341,10 +341,10 @@
case 'P': /* Printer */
consumed = 1;
doprint = 1;
- if (*++optstr)
+ if (*++optstr) {
if (!strcmp(optstr, "-"))
doprint = 0; /* kill MPAGE envvar que setting*/
- else {
+ } else {
printque = optstr;
}
break;
@@ -429,7 +429,7 @@
@@ -442,7 +442,7 @@ do_env()
libdir = env;
if ((env = getenv("MPAGE")) != NULL) {
- strcpy(copy, env);
+ (void)strlcpy(copy, env, sizeof(copy));
argv = slice(copy, &argc);
if (do_args(argc, argv, 1) < 0) {
fprintf(stderr, "%s: error in environment \"%s\"\n", MPAGE, env);
if ((copy = strdup(env)) == NULL) {
fprintf(stderr, "%s: Unable to alloc memory for environment args\n",
MPAGE);

View File

@ -1,15 +1,15 @@
--- file.c.orig Wed Nov 26 10:14:31 1997
+++ file.c Mon Dec 13 19:30:33 1999
@@ -24,7 +24,7 @@
*
$OpenBSD: patch-file_c,v 1.1 2002/07/07 17:03:37 naddy Exp $
--- file.c.orig Sun May 19 00:38:56 2002
+++ file.c Sun May 19 00:45:04 2002
@@ -18,6 +18,7 @@
*/
-
+#include <string.h>
#include "mpage.h"
@@ -108,10 +108,10 @@
@@ -101,10 +102,10 @@ do_pr_file(fname, asheet, outfd)
* header or not
*/
if (opt_header != NULL)
@ -22,24 +22,18 @@
asheet->sh_plength, asheet->sh_cwidth, fname);
/*
* open a pipe to the proper pr(1) command, and pr provides
@@ -145,6 +145,7 @@
char tmpfile[LINESIZE];
char buffer[LINESIZE];
int incnt, outcnt;
+ int fdd;
if (opt_pr) {
Debug(DB_STDIN, "%%do_stdin: pr option selects text\n", 0);
@@ -154,14 +155,16 @@
@@ -148,7 +149,7 @@ do_stdin(asheet, outfd)
* a temporary file; this temporary file will then
* be used as input to the do_doc routine
*/
- (void)strcpy(tmpfile, "/usr/tmp/mpageXXXXXX");
- (void)mktemp(tmpfile);
+ (void)strlcpy(tmpfile, "/tmp/mpage.XXXXXX", sizeof(tmpfile));
+
+ fdd = mkstemp(tmpfile);
+
+ (void)strlcpy(tmpfile, "/tmp/mpageXXXXXX", sizeof(tmpfile));
if ( (tmpfd = mkstemp(tmpfile)) == -1) {
fprintf(stderr, "%s: cannot create temporary file", MPAGE);
perror(MPAGE);
@@ -156,11 +157,11 @@ do_stdin(asheet, outfd)
}
close(tmpfd);
if (opt_header != NULL)
- (void)sprintf(command, "pr -l%d -w%d -h \"%s\"> %s",
+ (void)snprintf(command, sizeof(command), "pr -l%d -w%d -h \"%s\"> %s",
@ -51,24 +45,3 @@
asheet->sh_plength, asheet->sh_cwidth, tmpfile);
/*
* open a pipe to the pr(1) command which will create a
@@ -194,8 +197,11 @@
* now open the temporary file and use do_doc to
* convert it to PS
*/
- if ((fd = fopen(tmpfile, "r")) == NULL) {
+
+ if ((fd = fdopen(fdd, "r")) == NULL) {
fprintf(stderr, "%s: cannot open %s\n", MPAGE, tmpfile);
+ unlink(tmpfile);
+ close(fdd);
perror(MPAGE);
} else {
Debug(DB_STDIN, "%% got tmpfile, now do_doc\n", 0);
@@ -207,6 +213,7 @@
*/
Debug(DB_STDIN, "%% now remove '%s'\n", tmpfile);
(void)unlink(tmpfile);
+ close(fdd);
}
else {
/*

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-mpage_1,v 1.1 2002/07/07 17:03:37 naddy Exp $
--- mpage.1.orig Tue Nov 13 17:48:34 2001
+++ mpage.1 Sun May 19 01:20:08 2002
@@ -527,9 +527,9 @@ and
environment variables.
.SH FILES
-/usr/tmp/mpageXXXXXX
+/tmp/mpageXXXXXX
.br
-/usr/local/share/mpage
+%%PREFIX%%/share/mpage
.SH BUGS
.PP

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-mpage_c,v 1.1 2002/07/07 17:03:37 naddy Exp $
--- mpage.c.orig Tue Nov 13 18:04:46 2001
+++ mpage.c Sun May 19 01:00:14 2002
@@ -74,10 +74,10 @@ char **argv;
*/
if (doprint) {
if (printque != NULL)
- (void) sprintf(outcommand, "%s %s%s",
+ (void) snprintf(outcommand, sizeof(outcommand), "%s %s%s",
printprog, printarg, printque);
else
- (void) strcpy(outcommand, printprog);
+ (void) strlcpy(outcommand, printprog, sizeof(outcommand));
if ((outfd = popen(outcommand, "w")) == NULL) {
fprintf(stderr, "%s: cannot create pipe for '%s'\n",
MPAGE, outcommand);

View File

@ -1,40 +0,0 @@
--- mpage.c.orig Wed Nov 26 10:14:47 1997
+++ mpage.c Mon Dec 13 19:35:15 1999
@@ -77,10 +77,10 @@
*/
if (doprint) {
if (printque != NULL)
- (void) sprintf(outcommand, "%s %s%s",
+ (void) snprintf(outcommand, sizeof(outcommand), "%s %s%s",
printprog, printarg, printque);
else
- (void) strcpy(outcommand, printprog);
+ (void) strlcpy(outcommand, printprog, sizeof(outcommand));
if ((outfd = popen(outcommand, "w")) == NULL) {
fprintf(stderr, "%s: cannot create pipe for '%s'\n",
MPAGE, outcommand);
@@ -277,7 +277,7 @@
exit(1);
}
while (fgets(buf, LINESIZE, charfp) != NULL) {
- if (*buf != '%' && *buf != '\n')
+ if (*buf != '%' && *buf != '\n') {
if (first_encoding == -1) {
first_encoding = atoi(buf);
last_encoding = atoi(strchr(buf, ' '));
@@ -286,11 +286,12 @@
first_encoding, last_encoding);
#endif
}
- else
+ else {
fprintf(outfd, "%s", buf);
- }
+ }
+ }
}
- else { /* use internal default encoding */
+ } else { /* use internal default encoding */
int i;
first_encoding = encoding_table_first;

View File

@ -1,31 +1,22 @@
--- post.c.orig Wed Nov 26 10:20:43 1997
+++ post.c Mon Dec 13 19:36:58 1999
@@ -56,7 +56,7 @@
/*
* number of output lines on current logical page
*/
-static plcnt;
+static int plcnt;
int have_showsheet = 0;
@@ -356,6 +356,8 @@
$OpenBSD: patch-post_c,v 1.1 2002/07/07 17:03:37 naddy Exp $
--- post.c.orig Wed Nov 14 19:59:55 2001
+++ post.c Sun May 19 01:01:41 2002
@@ -353,6 +353,7 @@ ps_copyprolog(fd, outfd)
FILE *fd;
FILE *outfd;
{
+ size_t len;
+ size_t len;
+
Debug(DB_PSDOC, "%%ps_copyprolog: adding mpage prolog\n", 0);
if (!have_showsheet) {
fprintf(outfd, "/showsheet { showpage } bind def\n");
@@ -396,15 +398,17 @@
@@ -395,15 +396,17 @@ ps_copyprolog(fd, outfd)
*/
if (tex1)
free(tex1);
- tex1 = malloc(strlen(currline)+1);
- strcpy(tex1, currline);
+ len = (strlen(currline)+1);
+ tex1 = malloc(len);
+ len = strlen(currline)+1;
+ tex1 = malloc(len);
+ (void)strlcpy(tex1, currline, len);
fprintf(outfd, "%s", currline);
@ -34,13 +25,13 @@
free(tex2);
- tex2 = malloc(strlen(currline)+1);
- strcpy(tex2, currline);
+ len = (strlen(currline)+1);
+ len = strlen(currline)+1;
+ tex2 = malloc(len);
+ (void)strlcpy(tex2, currline, len);
}
}
fprintf(outfd, "%s", currline);
@@ -429,7 +433,7 @@
@@ -428,7 +431,7 @@ ps_roff_copyprolog(fd, outfd)
/* if (strcmp(currline, "xi\n") == 0) */
if (strstr(currline, "xi\n")) {
fprintf(outfd, "%%%s", currline);
@ -49,33 +40,34 @@
}
else if (strncmp(currline, "%%Page:", 7) == 0) {
fprintf(outfd, "/p { } def\n");
@@ -702,6 +706,7 @@
FILE *outfd;
@@ -1009,6 +1012,8 @@ post_one_line(line, fd, outfd, indoc, fl
int * indoc;
int flush_page;
{
+ size_t len;
Debug(DB_PSROFF, "%%post_onepage: Begin page\n", 0);
if (ps_at_trailer) {
Debug(DB_PSROFF, "%%post_onepage: still at trailer\n", 0);
@@ -754,15 +759,17 @@
+ size_t len;
+
if (strncmp(line, "%%BeginDocument", 15) == 0) {
*indoc = 1;
}
@@ -1058,15 +1063,17 @@ post_one_line(line, fd, outfd, indoc, fl
*/
if (tex1)
free(tex1);
- tex1 = malloc(strlen(currline)+1);
- strcpy(tex1, currline);
+ len = (strlen(currline)+1);
+ tex1 = malloc(len);
+ (void)strlcpy(tex1, currline, len);
fprintf(outfd, "%s", currline);
fgets(currline, LINESIZE-1, fd);
- tex1 = malloc(strlen(line)+1);
- strcpy(tex1, line);
+ len = strlen(line)+1;
+ tex1 = malloc(len);
+ (void)strlcpy(tex1, line, len);
fprintf(outfd, "%s", line);
flush_page ? memgets(line, LINESIZE-1) :
fgets(line, LINESIZE-1, fd);
if (tex2)
free(tex2);
- tex2 = malloc(strlen(currline)+1);
- strcpy(tex2, currline);
+ len = (strlen(currline)+1);
- tex2 = malloc(strlen(line)+1);
- strcpy(tex2, line);
+ len = strlen(line)+1;
+ tex2 = malloc(len);
+ (void)strlcpy(tex2, currline, len);
}
+ (void)strlcpy(tex2, line, len);
}
}
fprintf(outfd, "%s", currline);
fprintf(outfd, "%s", line);

View File

@ -1,4 +1,4 @@
Mpage reads plain text files or PostScript documents and prints them on a
PostScript printer with the text reduced in size so that several pages
appear on one sheet of paper. This is useful for viewing large printouts
on a small amount of paper.
Mpage reads plain text files or PostScript documents and prints them on a
PostScript printer with the text reduced in size so that several pages
appear on one sheet of paper. This is useful for viewing large printouts
on a small amount of paper.

View File

@ -1,9 +1,10 @@
@comment $OpenBSD: PLIST,v 1.3 2002/04/07 01:54:52 naddy Exp $
@comment $OpenBSD: PLIST,v 1.4 2002/07/07 17:03:37 naddy Exp $
bin/mpage
lib/mpage/ISO-Latin.2
lib/mpage/ISO-Latin.1
lib/mpage/ISO-8859.1
lib/mpage/ISO+STD+OTH
lib/mpage/CP850.PC
man/man1/mpage.1
@dirrm lib/mpage
share/mpage/CP850.PC
share/mpage/ISO+STD+OTH
share/mpage/ISO-8859.1
share/mpage/ISO-8859.15
share/mpage/ISO-Latin.1
share/mpage/ISO-Latin.2
@dirrm share/mpage

View File

@ -1,51 +0,0 @@
# $OpenBSD: SECURITY,v 1.1.1.1 1999/08/24 22:49:10 marc Exp $
${WRKDIR}/file.c
ports/print/mpage/patches/patch-ab was made to fix mktemp(3).
ianm@cit.nepean.uws.edu.au
--- file.c.orig Wed Nov 26 10:14:31 1997
+++ file.c Mon Aug 16 20:40:45 1999
@@ -145,6 +145,7 @@
char tmpfile[LINESIZE];
char buffer[LINESIZE];
int incnt, outcnt;
+ int fdd;
if (opt_pr) {
Debug(DB_STDIN, "%%do_stdin: pr option selects text\n", 0);
@@ -154,8 +155,10 @@
* a temporary file; this temporary file will then
* be used as input to the do_doc routine
*/
- (void)strcpy(tmpfile, "/usr/tmp/mpageXXXXXX");
- (void)mktemp(tmpfile);
+ (void)strcpy(tmpfile, "/tmp/mpage.XXXXXX");
+
+ fdd = mkstemp(tmpfile);
+
if (opt_header != NULL)
(void)sprintf(command, "pr -l%d -w%d -h \"%s\"> %s",
asheet->sh_plength, asheet->sh_cwidth,
@@ -194,8 +197,11 @@
* now open the temporary file and use do_doc to
* convert it to PS
*/
- if ((fd = fopen(tmpfile, "r")) == NULL) {
+
+ if ((fd = fdopen(fdd, "r")) == NULL) {
fprintf(stderr, "%s: cannot open %s\n", MPAGE, tmpfile);
+ unlink(tmpfile);
+ close(fdd);
perror(MPAGE);
} else {
Debug(DB_STDIN, "%% got tmpfile, now do_doc\n", 0);
@@ -207,6 +213,7 @@
*/
Debug(DB_STDIN, "%% now remove '%s'\n", tmpfile);
(void)unlink(tmpfile);
+ close(fdd);
}
else {
/*