summaryrefslogtreecommitdiff
path: root/print/psutils
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>1998-11-11 11:42:57 +0000
committeragc <agc@pkgsrc.org>1998-11-11 11:42:57 +0000
commit88071d16b70c408afc5d655fe9aa5d107fbcf53b (patch)
tree83bbd53c2e90b2b520a22c2557cc24299e425e40 /print/psutils
parentae0a7520f1ee054234a6f8e437d1f9e75336b938 (diff)
downloadpkgsrc-88071d16b70c408afc5d655fe9aa5d107fbcf53b.tar.gz
Read the config file only where necessary.
Cross-reference setpapersize(1) from the relevant man pages.
Diffstat (limited to 'print/psutils')
-rw-r--r--print/psutils/patches/patch-aa17
-rw-r--r--print/psutils/patches/patch-ab39
-rw-r--r--print/psutils/patches/patch-ac39
-rw-r--r--print/psutils/patches/patch-ad39
-rw-r--r--print/psutils/patches/patch-ae17
-rw-r--r--print/psutils/patches/patch-af28
-rw-r--r--print/psutils/patches/patch-ag17
7 files changed, 184 insertions, 12 deletions
diff --git a/print/psutils/patches/patch-aa b/print/psutils/patches/patch-aa
index e794e1714a3..da87cec9193 100644
--- a/print/psutils/patches/patch-aa
+++ b/print/psutils/patches/patch-aa
@@ -1,4 +1,4 @@
-$NetBSD: patch-aa,v 1.1 1998/11/09 18:02:36 agc Exp $
+$NetBSD: patch-aa,v 1.2 1998/11/11 11:42:57 agc Exp $
Read default papersize from a configuration file at run-time.
If it's not in the correct format, or it's not found, default to
@@ -14,12 +14,12 @@ the papersize that was compiled in.
#include <sys/stat.h>
#define iscomment(x,y) (strncmp(x,y,strlen(y)) == 0)
-@@ -64,12 +65,68 @@
+@@ -64,10 +65,62 @@
{ NULL, 0, 0 }
};
+/* bounds-checking strncpy */
-+static char *
++char *
+strnncpy(char *to, size_t tosize, char *from, size_t cc)
+{
+ size_t len;
@@ -36,7 +36,7 @@ the papersize that was compiled in.
+#include <ctype.h>
+
+/* read PAPERSIZE from file */
-+static int
++int
+readconfig(char *name, size_t namesize)
+{
+ FILE *fp;
@@ -73,14 +73,7 @@ the papersize that was compiled in.
Paper* findpaper(char *name)
{
Paper *pp;
-+ char papersize[BUFSIZ];
+
-+ if (!readconfig(papersize, sizeof(papersize))) {
-+ (void) strnncpy(papersize, sizeof(papersize), name, strlen(name));
-+ }
for (pp = papersizes; PaperName(pp); pp++) {
-- if (strcmp(PaperName(pp), name) == 0) {
-+ if (strcmp(PaperName(pp), papersize) == 0) {
+ if (strcmp(PaperName(pp), name) == 0) {
return pp;
- }
- }
diff --git a/print/psutils/patches/patch-ab b/print/psutils/patches/patch-ab
new file mode 100644
index 00000000000..ed9354566b4
--- /dev/null
+++ b/print/psutils/patches/patch-ab
@@ -0,0 +1,39 @@
+$NetBSD: patch-ab,v 1.1 1998/11/11 11:42:57 agc Exp $
+
+Read papersize from a config file, rather than using a compiled-in default.
+
+--- psnup.c 1998/11/11 09:37:52 1.1
++++ psnup.c 1998/11/11 10:25:45
+@@ -22,6 +22,8 @@
+ * -f for flipped (wider than tall) pages
+ * -d<wid> to draw the page boundaries
+ */
++#include <sys/types.h>
++#include <sys/param.h>
+
+ #include "psutil.h"
+ #include "psspec.h"
+@@ -79,13 +81,21 @@
+ double iwidth, iheight ; /* input paper size */
+ double tolerance = 100000; /* layout tolerance */
+ Paper *paper;
++ char papersize[BUFSIZ];
+
+ #ifdef PAPER
+- if ( (paper = findpaper(PAPER)) != (Paper *)0 ) {
++#if (defined(BSD) && BSD >= 199306)
++ if (!readconfig(papersize, sizeof(papersize))) {
++ (void) strnncpy(papersize, sizeof(papersize), PAPER, strlen(PAPER));
++ }
++#else
++ (void) strnncpy(papersize, sizeof(papersize), PAPER, strlen(PAPER));
++#endif /* BSD */
++ if ( (paper = findpaper(papersize)) != (Paper *)0 ) {
+ width = (double)PaperWidth(paper);
+ height = (double)PaperHeight(paper);
+ }
+-#endif
++#endif /* PAPER */
+
+ margin = border = vshift = hshift = column = flip = 0;
+ leftright = topbottom = 1;
diff --git a/print/psutils/patches/patch-ac b/print/psutils/patches/patch-ac
new file mode 100644
index 00000000000..3b5d713275c
--- /dev/null
+++ b/print/psutils/patches/patch-ac
@@ -0,0 +1,39 @@
+$NetBSD: patch-ac,v 1.1 1998/11/11 11:42:57 agc Exp $
+
+Read papersize from a config file, rather than using a compiled-in default.
+
+--- psresize.c 1998/11/11 09:37:52 1.1
++++ psresize.c 1998/11/11 10:31:11
+@@ -14,6 +14,8 @@
+ * -H<dim> sets the input paper height
+ * -Ppaper sets the input paper size (width and height) by name
+ */
++#include <sys/types.h>
++#include <sys/param.h>
+
+ #include "psutil.h"
+ #include "psspec.h"
+@@ -56,13 +58,21 @@
+ double inheight = -1;
+ Paper *paper;
+ PageSpec *specs;
++ char papersize[BUFSIZ];
+
+ #ifdef PAPER
+- if ( (paper = findpaper(PAPER)) != (Paper *)0 ) {
++#if (defined(BSD) && BSD >= 199306)
++ if (!readconfig(papersize, sizeof(papersize))) {
++ (void) strnncpy(papersize, sizeof(papersize), PAPER, strlen(PAPER));
++ }
++#else
++ (void) strnncpy(papersize, sizeof(papersize), PAPER, strlen(PAPER));
++#endif /* BSD */
++ if ( (paper = findpaper(papersize)) != (Paper *)0 ) {
+ inwidth = width = (double)PaperWidth(paper);
+ inheight = height = (double)PaperHeight(paper);
+ }
+-#endif
++#endif /* PAPER */
+
+ vshift = hshift = 0;
+ rotate = 0;
diff --git a/print/psutils/patches/patch-ad b/print/psutils/patches/patch-ad
new file mode 100644
index 00000000000..8732a4643d6
--- /dev/null
+++ b/print/psutils/patches/patch-ad
@@ -0,0 +1,39 @@
+$NetBSD: patch-ad,v 1.1 1998/11/11 11:42:58 agc Exp $
+
+Read papersize from a config file, rather than using a compiled-in default.
+
+--- pstops.c 1998/11/11 09:37:52 1.1
++++ pstops.c 1998/11/11 10:27:21
+@@ -7,6 +7,8 @@
+ * Usage:
+ * pstops [-q] [-b] [-d] [-w<dim>] [-h<dim>] [-ppaper] <pagespecs> [infile [outfile]]
+ */
++#include <sys/types.h>
++#include <sys/param.h>
+
+ #include "psutil.h"
+ #include "psspec.h"
+@@ -118,13 +120,21 @@
+ int nobinding = 0;
+ double draw = 0;
+ Paper *paper;
++ char papersize[BUFSIZ];
+
+ #ifdef PAPER
+- if ( (paper = findpaper(PAPER)) != (Paper *)0 ) {
++#if (defined(BSD) && BSD >= 199306)
++ if (!readconfig(papersize, sizeof(papersize))) {
++ (void) strnncpy(papersize, sizeof(papersize), PAPER, strlen(PAPER));
++ }
++#else
++ (void) strnncpy(papersize, sizeof(papersize), PAPER, strlen(PAPER));
++#endif /* BSD */
++ if ( (paper = findpaper(papersize)) != (Paper *)0 ) {
+ width = (double)PaperWidth(paper);
+ height = (double)PaperHeight(paper);
+ }
+-#endif
++#endif /* PAPER */
+
+ infile = stdin;
+ outfile = stdout;
diff --git a/print/psutils/patches/patch-ae b/print/psutils/patches/patch-ae
new file mode 100644
index 00000000000..46e51b18e58
--- /dev/null
+++ b/print/psutils/patches/patch-ae
@@ -0,0 +1,17 @@
+$NetBSD: patch-ae,v 1.1 1998/11/11 11:42:58 agc Exp $
+
+Cross reference the setpapersize(1) utility.
+
+--- psnup.man 1998/11/11 10:17:17 1.1
++++ psnup.man 1998/11/11 10:59:00
+@@ -64,7 +64,9 @@
+ .B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto
+ or
+ .B 10x14.
+-The default paper size is
++The default paper size can be configured using the
++setpapersize(1)
++utility, which takes precedence over the compiled-in default of
+ .B @PAPER@.
+ The
+ .I \-W, \-H,
diff --git a/print/psutils/patches/patch-af b/print/psutils/patches/patch-af
new file mode 100644
index 00000000000..66f60ba1425
--- /dev/null
+++ b/print/psutils/patches/patch-af
@@ -0,0 +1,28 @@
+$NetBSD: patch-af,v 1.1 1998/11/11 11:42:58 agc Exp $
+
+Cross reference the setpapersize(1) utility.
+
+--- psresize.man 1998/11/11 10:17:17 1.1
++++ psresize.man 1998/11/11 10:59:40
+@@ -45,7 +45,9 @@
+ .B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto
+ or
+ .B 10x14.
+-The default output paper size is
++The default output paper size can be configured using the
++setpapersize(1)
++utility, which takes precedence over the compiled-in default of
+ .B @PAPER@.
+ .PP
+ The
+@@ -56,7 +58,9 @@
+ The
+ .I \-P
+ option can be used as an alternative, to set the input paper size.
+-The default input paper size is
++The default input paper size can be configured using the
++setpapersize(1)
++utility, which takes precedence over the compiled-in default of
+ .B @PAPER@.
+ .PP
+ .I Psresize
diff --git a/print/psutils/patches/patch-ag b/print/psutils/patches/patch-ag
new file mode 100644
index 00000000000..deee6911421
--- /dev/null
+++ b/print/psutils/patches/patch-ag
@@ -0,0 +1,17 @@
+$NetBSD: patch-ag,v 1.1 1998/11/11 11:42:58 agc Exp $
+
+Cross reference the setpapersize(1) utility.
+
+--- pstops.man 1998/11/11 10:17:17 1.1
++++ pstops.man 1998/11/11 11:00:10
+@@ -111,7 +111,9 @@
+ .B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto
+ or
+ .B 10x14.
+-The default paper size is
++The default paper size can be configured using the
++setpapersize(1)
++utility, which takes precedence over the compiled-in default of
+ .B @PAPER@.
+ .PP
+ The