From cf2d23360ee1162fe86b0d284eae8e67620e309d Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Fri, 17 Jan 2014 07:18:28 +0000 Subject: psutils: Modified config file format git-svn-id: svn://tug.org/texlive/trunk@32697 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/psutils/ChangeLog | 5 +++++ Build/source/texk/psutils/data/paper.cfg | 2 +- Build/source/texk/psutils/paper-size.c | 14 ++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/psutils/ChangeLog b/Build/source/texk/psutils/ChangeLog index f3657931d28..4d9af84cf92 100644 --- a/Build/source/texk/psutils/ChangeLog +++ b/Build/source/texk/psutils/ChangeLog @@ -1,3 +1,8 @@ +2014-01-17 Peter Breitenlohner + + * paper-size.c, data/paper.cfg: Modify and document the config + file format. Close the config file. + 2014-01-16 Peter Breitenlohner Import psutils-1.23. diff --git a/Build/source/texk/psutils/data/paper.cfg b/Build/source/texk/psutils/data/paper.cfg index 35455ecc2d8..daf1447b57d 100644 --- a/Build/source/texk/psutils/data/paper.cfg +++ b/Build/source/texk/psutils/data/paper.cfg @@ -1 +1 @@ -a4 # default papersize +p a4 # default papersize diff --git a/Build/source/texk/psutils/paper-size.c b/Build/source/texk/psutils/paper-size.c index 2a0ed5b3749..0f7dae01ff9 100644 --- a/Build/source/texk/psutils/paper-size.c +++ b/Build/source/texk/psutils/paper-size.c @@ -42,13 +42,19 @@ do_init (void) if (!fp) die ("can't open config file %s", CONFIG_NAME); - while (i < MAX_PAPER - 1 && - (ch = fgetc (fp)) > 0 && ch != ' ' && ch != '\n' && ch != '\r') - default_paper[i++] = ch; + /* 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) == ' ') + while (i < MAX_PAPER - 1 && + (ch = fgetc (fp)) > 0 && ch != ' ' && ch != '\n' && ch != '\r') + default_paper[i++] = ch; default_paper[i] = 0; if (i == 0) - die ("can't read default papersize from file %s", CONFIG_NAME); + die ("can't read default papersize from file %s", fqpn); + fclose (fp); + free (fqpn); inited = 1; } -- cgit v1.2.3