summaryrefslogtreecommitdiff
path: root/Build/source/libs/paper/libpaper-1.1.24+nmu2-PATCHES/patch-02-TL
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/paper/libpaper-1.1.24+nmu2-PATCHES/patch-02-TL')
-rw-r--r--Build/source/libs/paper/libpaper-1.1.24+nmu2-PATCHES/patch-02-TL120
1 files changed, 120 insertions, 0 deletions
diff --git a/Build/source/libs/paper/libpaper-1.1.24+nmu2-PATCHES/patch-02-TL b/Build/source/libs/paper/libpaper-1.1.24+nmu2-PATCHES/patch-02-TL
new file mode 100644
index 00000000000..c83c09fe847
--- /dev/null
+++ b/Build/source/libs/paper/libpaper-1.1.24+nmu2-PATCHES/patch-02-TL
@@ -0,0 +1,120 @@
+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));
+