diff -ur libpaper-1.1.24+nmu2.orig/lib/paper.c libpaper-1.1.24+nmu2/lib/paper.c --- libpaper-1.1.24+nmu2.orig/lib/paper.c 2010-04-24 14:12:11.000000000 +0200 +++ libpaper-1.1.24+nmu2/lib/paper.c 2013-10-24 15:45:37.955710461 +0200 @@ -87,24 +87,11 @@ } const char* defaultpapersizefile(void) { - return PAPERCONF; + return NULL; } const char* systempapersizefile(void) { - const char* paperconf = getenv(PAPERCONFVAR); -/* -Previously PAPERCONFVAR used to contain a paper name and PAPERSIZEVAR -contained a file path. Now they're reversed. If we don't find a '/' -in PAPERCONFVAR, fall-back to the old behaviour. -*/ - - if ((paperconf != NULL) && (strchr(paperconf, '/') == NULL)) { - paperconf = getenv(PAPERSIZEVAR); - if ((paperconf != NULL) && (strchr(paperconf, '/') == NULL)) - paperconf = NULL; - } - - return paperconf ? paperconf : defaultpapersizefile(); + return NULL; } const char* defaultpapername(void) { @@ -112,26 +99,14 @@ } char* systempapername(void) { - const char* paperconf; char* paperstr; char* paperenv; const char* paperdef; - FILE* ps; - struct stat statbuf; const struct paper* pp; - int c; - -/* -Previously PAPERSIZEVAR used to contain a file path and PAPERCONFVAR -contained a paper name. Now they're reversed. If we find a '/' in -PAPERSIZEVAR, fall-back to the old behaviour. -*/ paperenv = getenv(PAPERSIZEVAR); if ((paperenv != NULL) && (strchr(paperenv, '/') != NULL)) { - paperenv = getenv(PAPERCONFVAR); - if ((paperenv != NULL) && (strchr(paperenv, '/') != NULL)) - paperenv = NULL; + paperenv = NULL; } if (paperenv) { @@ -145,61 +120,6 @@ return strcpy(paperstr, paperenv); } - paperconf = systempapersizefile(); - if (paperconf && stat(paperconf, &statbuf) == -1) return 0; - - if (!paperconf) paperconf = defaultpapersizefile(); - - if ((stat(paperconf, &statbuf) != -1) && - (ps = fopen(paperconf, "r"))) { - - while ((c = getc(ps)) != EOF) { - if (c == '#') { - while ((c = getc(ps)) != EOF && c != '\n'); - if (c == EOF) { - break; - } - } else if (!isspace(c)) { - unsigned n = 0, m = 64; - char* papername = malloc(m * sizeof(char)); - - if (!papername) { - fclose(ps); - return 0; - } - - do { - if (n == m-1) { - char* newpaper = realloc(papername, - (m *= 2) * sizeof(char)); - if (!newpaper) { - free(papername); - fclose(ps); - return 0; - } - papername = newpaper; - } - papername[n++] = c; - } while ((c = getc(ps)) != EOF && !isspace(c)); - - papername[n] = 0; - - fclose(ps); - - paperstr = malloc((strlen(papername) + 1) * sizeof(char)); - if (! paperstr) return 0; - - strcpy(paperstr, papername); - free(papername); - - if ((pp = paperinfo(paperstr))) - return strcpy(paperstr, pp->name); - else - return paperstr; - } - } - } - paperdef = defaultpapername(); paperstr = malloc((strlen(paperdef) + 1) * sizeof(char)); diff -ur libpaper-1.1.24+nmu2.orig/man/paperconf.1.in libpaper-1.1.24+nmu2/man/paperconf.1.in --- libpaper-1.1.24+nmu2.orig/man/paperconf.1.in 2012-05-03 21:05:12.000000000 +0200 +++ libpaper-1.1.24+nmu2/man/paperconf.1.in 2013-10-25 08:27:54.783329615 +0200 @@ -1,4 +1,4 @@ -.TH PAPERCONF 1 "24 April 2001" +.TH PAPERCONF 1 "25 October 2013" .SH NAME .B paperconf \- print paper configuration information @@ -46,13 +46,10 @@ prints the name of the system- or user-specified paper, obtained by looking in order at the .B @PAPERSIZEVAR@ -environment variable, at the contents of the file specified by the -.B @PAPERCONFVAR@ -environment variable, at the contents of -.B @PAPERCONF@ +environment variable or by using -.B letter -as a fall-back value if none of the other alternatives are successful. +.B a4 +as a fall-back value. By default, width and height of the paper are printed in PostScript points. .SH OPTIONS .TP @@ -98,21 +95,9 @@ .SH ENVIRONMENT .TP 20 .B @PAPERSIZEVAR@ -Paper size to use regardless of what the papersize file contains. -.TP 20 -.B @PAPERCONFVAR@ -Full path to a file containing the paper size to use. -.SH FILES -.TP 20 -.B @PAPERCONF@ -Contains the name of the system-wide default paper size to be used -if the -.B @PAPERSIZEVAR@ -and -.B @PAPERCONFVAR@ -variables are not set. +Paper size to use. .SH AUTHOR Yves Arrouye -.SH SEE ALSO -.BR papersize (5) + +Modified for TeX Live by Peter Breitenlohner