diff -ur libpaper-1.1.29/lib/paper.c libpaper-src/lib/paper.c
--- libpaper-1.1.29/lib/paper.c	2018-12-03 06:15:41.000000000 +0900
+++ libpaper-src/lib/paper.c	2024-01-07 11:32:25.000000000 +0900
@@ -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,64 +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) {
-		    free(papername);
-		    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.29/man/paperconf.1.in libpaper-src/man/paperconf.1.in
--- libpaper-1.1.29/man/paperconf.1.in	2023-03-17 22:35:38.000000000 +0900
+++ libpaper-src/man/paperconf.1.in	2024-01-07 11:36:12.000000000 +0900
@@ -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 <arrouye@debian.org>
-.SH SEE ALSO
-.BR papersize (5)
+
+Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
 
