diff options
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/psutils/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/psutils/data/paper.cfg | 4 | ||||
-rw-r--r-- | Build/source/texk/psutils/paper-size.c | 16 |
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; |