summaryrefslogtreecommitdiff
path: root/print/psutils/files/patch-pstops.c
diff options
context:
space:
mode:
authorHiroki Sato <hrs@FreeBSD.org>2013-04-24 04:13:09 +0000
committerHiroki Sato <hrs@FreeBSD.org>2013-04-24 04:13:09 +0000
commit5f8eb67e3760459c0834c08f36d9e502d3388e3a (patch)
treeb0094c17ab958c91c23c0e89d3bb437c5adf6982 /print/psutils/files/patch-pstops.c
parent- Add patch to prevent deletion of /dev/null (diff)
Merge print/psutils-a4 and print/psutils-letter into a single port
print/psutils. The default paper size in the programs can be set via libpaper ($PAPERSIZE or etc/papersize configuration file).
Diffstat (limited to 'print/psutils/files/patch-pstops.c')
-rw-r--r--print/psutils/files/patch-pstops.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/print/psutils/files/patch-pstops.c b/print/psutils/files/patch-pstops.c
new file mode 100644
index 000000000000..d21fab8774eb
--- /dev/null
+++ b/print/psutils/files/patch-pstops.c
@@ -0,0 +1,53 @@
+--- pstops.c.orig 1997-03-12 07:53:04.000000000 +0900
++++ pstops.c 2012-03-03 03:04:32.000000000 +0900
+@@ -13,6 +13,10 @@
+ #include "pserror.h"
+ #include "patchlev.h"
+
++#if defined(LIBPAPER)
++#include <paper.h>
++#endif
++
+ char *program ;
+ int pages ;
+ int verbose ;
+@@ -112,19 +116,27 @@
+ return (head);
+ }
+
+-void main(int argc, char *argv[])
++int main(int argc, char *argv[])
+ {
+ PageSpec *specs = NULL;
+ int nobinding = 0;
+ double draw = 0;
+ Paper *paper;
++ char *name;
+
++#if defined(LIBPAPER)
++ name = (char *)systempapername();
++ if (name == NULL)
++ name = (char *)defaultpapername();
++#else
+ #ifdef PAPER
+- if ( (paper = findpaper(PAPER)) != (Paper *)0 ) {
+- width = (double)PaperWidth(paper);
+- height = (double)PaperHeight(paper);
+- }
++ name = PAPER;
++#endif
+ #endif
++ if ((paper = findpaper(name)) != NULL) {
++ width = (double)PaperWidth(paper);
++ height = (double)PaperHeight(paper);
++ }
+
+ infile = stdin;
+ outfile = stdout;
+@@ -194,5 +206,5 @@
+
+ pstops(modulo, pagesperspec, nobinding, specs, draw);
+
+- exit(0);
++ return (0);
+ }