$NetBSD: patch-ad,v 1.2 2011/08/02 17:05:48 joerg Exp $ Read papersize from a config file, rather than using a compiled-in default. --- pstops.c.orig 1997-03-11 22:53:04.000000000 +0000 +++ pstops.c @@ -7,6 +7,9 @@ * Usage: * pstops [-q] [-b] [-d] [-w] [-h] [-ppaper] [infile [outfile]] */ +#include +#include +#include #include "psutil.h" #include "psspec.h" @@ -112,19 +115,27 @@ static PageSpec *parsespecs(char *str) 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 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;