summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-01-18 12:18:03 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-01-18 12:18:03 +0000
commitfcc5958e3f9d8af7d005395de3976398453b7888 (patch)
tree0cabed109746694544291ab15d98cccfd7055002 /Build/source
parentde3b07ea3448cc045b7580f8bc24d577aa2b893d (diff)
psutils: Allow comments in config file
git-svn-id: svn://tug.org/texlive/trunk@32712 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/psutils/ChangeLog4
-rw-r--r--Build/source/texk/psutils/data/paper.cfg4
-rw-r--r--Build/source/texk/psutils/paper-size.c16
3 files changed, 19 insertions, 5 deletions
diff --git a/Build/source/texk/psutils/ChangeLog b/Build/source/texk/psutils/ChangeLog
index 4d9af84cf92..d0bf508992f 100644
--- a/Build/source/texk/psutils/ChangeLog
+++ b/Build/source/texk/psutils/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-18 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * paper-size.c, data/paper.cfg: Allow comments in config file.
+
2014-01-17 Peter Breitenlohner <peb@mppmu.mpg.de>
* paper-size.c, data/paper.cfg: Modify and document the config
diff --git a/Build/source/texk/psutils/data/paper.cfg b/Build/source/texk/psutils/data/paper.cfg
index daf1447b57d..49a6aebe8d6 100644
--- a/Build/source/texk/psutils/data/paper.cfg
+++ b/Build/source/texk/psutils/data/paper.cfg
@@ -1 +1,3 @@
-p a4 # default papersize
+# default papersize
+p a4
+# more comment
diff --git a/Build/source/texk/psutils/paper-size.c b/Build/source/texk/psutils/paper-size.c
index 0f7dae01ff9..0781d2394ad 100644
--- a/Build/source/texk/psutils/paper-size.c
+++ b/Build/source/texk/psutils/paper-size.c
@@ -20,7 +20,7 @@
#include <paper.h>
#define CONFIG_NAME "paper.cfg"
-#define MAX_PAPER 16
+#define MAX_PAPER 16 /* sufficient for "halfexecutive" */
static char default_paper[MAX_PAPER];
static void
@@ -43,9 +43,17 @@ do_init (void)
die ("can't open config file %s", CONFIG_NAME);
/* In order to specify PAPER as default papersize the config file must
- contain 'p PAPER', optionally followed by a space or end of line
- and a comment. */
- if (fgetc (fp) == 'p' && fgetc (fp) == ' ')
+ contain a line 'p PAPER'. */
+ ch = fgetc (fp);
+ /* skip comment lines */
+ while (ch > 0 && ch != 'p') {
+ while (ch > 0 && ch != '\n' && ch != '\r')
+ ch = fgetc (fp);
+ while (ch == '\n' || ch == '\r')
+ ch = fgetc (fp);
+ }
+ /* read default papersize */
+ if (ch == 'p' && fgetc (fp) == ' ')
while (i < MAX_PAPER - 1 &&
(ch = fgetc (fp)) > 0 && ch != ' ' && ch != '\n' && ch != '\r')
default_paper[i++] = ch;