summaryrefslogtreecommitdiff
path: root/Build/source/libs/paper/libpaper-1.1.24+nmu2-PATCHES/patch-02-TL
blob: 601ccb9d2525ad6f452ce6e0f28f037433ae82ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
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 <arrouye@debian.org>
-.SH SEE ALSO
-.BR papersize (5)
+
+Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>