summaryrefslogtreecommitdiff
path: root/print/psutils/files/patch-psutil.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-psutil.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).
Notes
Notes: svn path=/head/; revision=316401
Diffstat (limited to 'print/psutils/files/patch-psutil.c')
-rw-r--r--print/psutils/files/patch-psutil.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/print/psutils/files/patch-psutil.c b/print/psutils/files/patch-psutil.c
new file mode 100644
index 000000000000..b9529c3323f6
--- /dev/null
+++ b/print/psutils/files/patch-psutil.c
@@ -0,0 +1,58 @@
+--- psutil.c.orig 2012-03-03 03:13:21.000000000 +0900
++++ psutil.c 2012-03-03 03:20:46.000000000 +0900
+@@ -21,6 +21,11 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+
++#if defined(LIBPAPER)
++#include <math.h>
++#include <paper.h>
++#endif
++
+ #define iscomment(x,y) (strncmp(x,y,strlen(y)) == 0)
+
+ extern char *program ;
+@@ -42,6 +47,7 @@
+ static int maxpages = 100;
+ static long *pageptr;
+
++#if !defined(LIBPAPER)
+ /* list of paper sizes supported */
+ static Paper papersizes[] = {
+ { "a3", 842, 1191 }, /* 29.7cm * 42cm */
+@@ -70,6 +76,7 @@
+ Paper* findpaper(char *name)
+ {
+ Paper *pp;
++
+ for (pp = papersizes; PaperName(pp); pp++) {
+ if (strcmp(PaperName(pp), name) == 0) {
+ return pp;
+@@ -77,6 +84,27 @@
+ }
+ return (Paper *)NULL;
+ }
++#else
++static Paper pspec;
++
++Paper *findpaper(char *name)
++{
++ const struct paper *pp;
++
++ paperinit();
++ for (pp = paperfirst(); pp; pp = papernext(pp)) {
++ if (strcmp(name, papername(pp)) == 0) {
++ pspec.name = strdup(name);
++ pspec.width = round(paperpswidth(pp));
++ pspec.height = round(paperpsheight(pp));
++ return (&pspec);
++ }
++ }
++ return (NULL);
++}
++#endif
++
++
+
+ /* Make a file seekable, using temporary files if necessary */
+ FILE *seekable(FILE *fp)