pkgsrc/print/psutils/patches/patch-ab

49 lines
1.4 KiB
Text

$NetBSD: patch-ab,v 1.2 2011/08/02 17:05:48 joerg Exp $
Read papersize from a config file, rather than using a compiled-in default.
--- psnup.c.orig 1997-03-11 22:53:02.000000000 +0000
+++ psnup.c
@@ -22,6 +22,9 @@
* -f for flipped (wider than tall) pages
* -d<wid> to draw the page boundaries
*/
+#include <sys/types.h>
+#include <sys/param.h>
+#include <string.h>
#include "psutil.h"
#include "psspec.h"
@@ -66,7 +69,7 @@ static int nextdiv(int n, int m)
return (0);
}
-void main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
int horiz, vert, rotate, column, flip, leftright, topbottom;
int nup = 1;
@@ -79,13 +82,21 @@ void main(int argc, char *argv[])
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;