From 06c82f3579a129beef83a8606658c58c649cae8c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 7 Nov 2010 18:44:02 +0000 Subject: remove trailing comment and preceding whitespace, so they do not appear as part of a variable value (from Akira) git-svn-id: svn://tug.org/texlive/trunk@20354 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 8 + Build/source/texk/kpathsea/cnf.c | 15 ++ Build/source/texk/kpathsea/doc/kpathsea.info | 214 ++++++++++++++------------- Build/source/texk/kpathsea/doc/kpathsea.texi | 44 +++--- Build/source/texk/kpathsea/texmf.cnf | 5 +- 5 files changed, 162 insertions(+), 124 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 9c5ebe79554..01c1489ae58 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,11 @@ +2010-11-07 Karl Berry + + * cnf.c (do_line): remove trailing comment and preceding + whitespace, so they do not appear as part of the value. + From Akira. + * doc/kpathsea.texi (Config files): document this. + * texmf.cnf: doc fixes. + 2010-10-02 Peter Breitenlohner * Makefile.am (libkpathsea_la_LDFLAGS): Add -no-undefined. diff --git a/Build/source/texk/kpathsea/cnf.c b/Build/source/texk/kpathsea/cnf.c index 5c11ae30d00..cb18c66ab83 100644 --- a/Build/source/texk/kpathsea/cnf.c +++ b/Build/source/texk/kpathsea/cnf.c @@ -64,6 +64,21 @@ do_line (kpathsea kpse, string line) if (*line == 0 || *line == '%' || *line == '#') return; + /* Remove trailing comment: a % or # preceded by whitespace. Also + remove any whitespace before that. For example, the value for + foo = a#b %something + is a#b. */ + value = line + strlen (line) - 1; /* start at end of line */ + while (value > line) { + if (*value == '%' || *value == '#') { + value--; /* move before comment char */ + while (ISSPACE (*value)) + *value-- = 0; /* wipe out as much preceding whitespace + continue; (and comment) as we find */ + } + value--; /* move before the new null byte */ + } + /* The variable name is everything up to the next space or = or `.'. */ start = line; while (!ISSPACE (*line) && *line != '=' && *line != '.') diff --git a/Build/source/texk/kpathsea/doc/kpathsea.info b/Build/source/texk/kpathsea/doc/kpathsea.info index def0252034c..2d4571353de 100644 --- a/Build/source/texk/kpathsea/doc/kpathsea.info +++ b/Build/source/texk/kpathsea/doc/kpathsea.info @@ -40,7 +40,7 @@ Kpathsea library This manual documents how to install and use the Kpathsea library for filename lookup. It corresponds to version 6.0.0, released in -July 2010. +November 2010. * Menu: @@ -61,7 +61,7 @@ File: kpathsea.info, Node: Introduction, Next: Installation, Prev: Top, Up: ************** This manual corresponds to version 6.0.0 of the Kpathsea library, -released in July 2010. +released in November 2010. The library's fundamental purpose is to return a filename from a list of directories specified by the user, similar to what shells do @@ -1242,10 +1242,10 @@ Also available as `http://www.tug.org/unixtex.ftp'. Email with comments or questions. The principal free TeX distribution for Unix-like systems is TeX -Live, `http://tug.org/texlive'. Its web pages describe many ways to -acquire TeX, over the Internet or on physical media, both the sources -and precompiled binaries for many systems, either standalone or as part -of various operating system distributions. +Live, on the web at `http://tug.org/texlive'. The pages there describe +many ways to acquire TeX, over the Internet or on physical media, both +the sources and precompiled binaries for many systems, either +standalone or as part of various operating system distributions. Web2C, Kpathsea, Dvips, and Dviljk are no longer released as a separate packages. Their sources are now maintained as part of TeX @@ -2018,7 +2018,13 @@ single character `0' (zero, not oh). helpful to look at the distributed `texmf.cnf', which uses or at least mentions most features. The format of `texmf.cnf' files follows: - * Comments start with `%' and continue to the end of the line. + * Comments start with `%', either at the beginning of a line or + preceded by whitespace, and continue to the end of the line. That + is, as with most shells, a `%' in the "middle" of a value does not + start a comment. Examples: + + % this is a comment + var = a%b % but the value of var will be "a%b". * Blank lines are ignored. @@ -2037,8 +2043,9 @@ mentions most features. The format of `texmf.cnf' files follows: * If `.PROGNAME' is present, the definition only applies if the program that is running is named (i.e., the last component of - `argv[0]' is) PROGNAME or `PROGNAME.exe'. This allows different - flavors of TeX to have different search paths, for example. + `argv[0]' is) PROGNAME or `PROGNAME.{exe,bat,cmd,...}'. Most + notably, this allows different flavors of TeX to have different + search paths. * VALUE may contain any characters except `%' and `@'. (These restrictions are only necessary because of the processing done on @@ -2047,7 +2054,7 @@ mentions most features. The format of `texmf.cnf' files follows: not available on the right-hand side; instead, you must use an additional variable (see below for example). A `;' in VALUE is translated to `:' if running under Unix; this is useful to write a - single `texmf.cnf' which can be used under both Unix and NT. + single `texmf.cnf' which can be used under both Unix and Windows. * All definitions are read before anything is expanded, so you can use variables before they are defined (like Make, unlike most other @@ -2063,13 +2070,12 @@ Here is a configuration file fragment illustrating most of these points: TEXINPUTS.latex2e = $latex2e_inputs TEXINPUTS.latex = $latex2e_inputs - Although this format has obvious similarities to Bourne shell -scripts--change the comment character to `#', disallow spaces around -the `=', and get rid of the `.NAME' convention, and it could be run -through the shell. But there seemed little advantage to doing this, -since all the information would have to passed back to Kpathsea and -parsed there anyway, since the `sh' process couldn't affect its -parent's environment. + This format has obvious similarities to Bourne shell scripts--change +the comment character to `#', disallow spaces around the `=', and get +rid of the `.NAME' convention, and it could be run through the shell. +However, there seemed little advantage in this, since all the +information would have to passed back to Kpathsea and parsed there +anyway, since the `sh' process couldn't affect its parent's environment. The implementation of all this is in `kpathsea/cnf.c'. @@ -3745,7 +3751,7 @@ Index * : may not be :: Searching overview. (line 13) * :: expansion: Default expansion. (line 6) * @VAR@ substitutions: Running configure. (line 6) -* \, line continuation in texmf.cnf: Config files. (line 31) +* \, line continuation in texmf.cnf: Config files. (line 37) * \openin: Searching overview. (line 31) * \special, suppressing warnings about: Suppressing warnings. (line 31) @@ -3789,13 +3795,13 @@ Index * Babel: Kpathsea application distributions. (line 28) * Bach, Johann Sebastian: Default expansion. (line 41) -* backslash-newline: Config files. (line 31) +* backslash-newline: Config files. (line 37) * bash, recommended for running configure: configure shells. (line 6) * basic glyph lookup: Basic glyph lookup. (line 6) * Berry, Karl: History. (line 12) * BIBINPUTS: Supported file formats. (line 28) -* blank lines, in texmf.cnf: Config files. (line 29) +* blank lines, in texmf.cnf: Config files. (line 35) * brace expansion: Brace expansion. (line 6) * BSD universe: Running make. (line 44) * bsh, ok with configure: configure shells. (line 14) @@ -3830,7 +3836,7 @@ Index (line 36) * cmr10, as fallback font: Fallback font. (line 15) * cmr10.vf: Searching overview. (line 31) -* cnf.c: Config files. (line 80) +* cnf.c: Config files. (line 86) * cnf.h: Programming with config files. (line 23) * code sharing: Shared library. (line 9) @@ -3873,7 +3879,7 @@ Index * configuration compiler options: configure environment. (line 23) * configuration file, source for path: Path sources. (line 17) -* configuration files as shell scripts.: Config files. (line 72) +* configuration files as shell scripts.: Config files. (line 79) * configuration of mktex scripts: mktex configuration. (line 6) * configuration of optional features: configure options. (line 16) * configure error from sed: Empty Makefiles. (line 6) @@ -3881,7 +3887,7 @@ Index * configure options for mktex scripts: mktex configuration. (line 12) * configure, running: Running configure. (line 6) * context diff: Bug checklist. (line 55) -* continuation character: Config files. (line 31) +* continuation character: Config files. (line 37) * core dumps, reporting: Bug checklist. (line 61) * CPPFLAGS: configure environment. (line 22) @@ -4072,7 +4078,7 @@ Index * HOME, as ~ expansion: Tilde expansion. (line 6) * HP-UX, compiling on: TeX or Metafont failing. (line 30) -* identifiers, characters valid in: Config files. (line 41) +* identifiers, characters valid in: Config files. (line 47) * illegal pointer combination warnings: Pointer combination warnings. (line 6) * include fontmap directive: Fontmap. (line 33) @@ -4398,7 +4404,7 @@ Index (line 17) * resolutions, last-resort: Fallback font. (line 6) * retrieving TeX: unixtex.ftp. (line 6) -* right-hand side of variable assignments: Config files. (line 49) +* right-hand side of variable assignments: Config files. (line 56) * Rokicki, Tom: History. (line 12) * root user: Tilde expansion. (line 19) * runtime configuration files: Config files. (line 6) @@ -4424,7 +4430,7 @@ Index (line 164) * sh5, ok with configure: configure shells. (line 25) * shared library, making: Shared library. (line 6) -* shell scripts as configuration files: Config files. (line 72) +* shell scripts as configuration files: Config files. (line 79) * shell variables: Variable expansion. (line 17) * shell_escape, example for code: Programming with config files. (line 10) @@ -4647,7 +4653,7 @@ Index (line 211) * whitespace, in fontmap files: Fontmap. (line 28) * whitespace, not ignored on continuation lines: Config files. - (line 31) + (line 37) * www.tug.org: unixtex.ftp. (line 6) * X11 previewer: Kpathsea application distributions. (line 25) @@ -4675,82 +4681,82 @@ Index  Tag Table: Node: Top1615 -Node: Introduction2258 -Node: History4080 -Node: Installation8172 -Node: Simple installation8962 -Node: Custom installation12545 -Node: Disk space13719 -Node: Kpathsea application distributions14603 -Node: Changing search paths15718 -Node: Default path features16900 -Node: Default path generation18983 -Node: Running configure20426 -Node: configure shells21477 -Node: configure options22529 -Node: configure environment24036 -Node: configure scenarios25838 -Node: Shared library27424 -Node: Running make28438 -Node: Installing files30485 -Node: Cleaning up32432 -Node: Filename database generation33480 -Node: mktex scripts34047 -Node: mktex configuration35324 -Node: mktex script names41143 -Node: mktex script arguments42534 -Node: Installation testing43424 -Node: Security43788 -Node: TeX directory structure46355 -Node: unixtex.ftp50777 -Node: Reporting bugs52095 -Node: Bug checklist52830 -Node: Mailing lists56527 -Node: Debugging57736 -Node: Logging62814 -Node: Common problems64684 -Node: Unable to find files65515 -Node: Slow path searching67926 -Node: Unable to generate fonts69303 -Node: TeX or Metafont failing71812 -Node: Empty Makefiles73691 -Node: XtStrings74928 -Node: dlopen75764 -Node: ShellWidgetClass76582 -Node: Pointer combination warnings78214 -Node: Path searching78603 -Node: Searching overview79250 -Node: Path sources82646 -Node: Config files83717 -Node: Path expansion87362 -Node: Default expansion88311 -Node: Variable expansion90381 -Node: Tilde expansion91784 -Node: Brace expansion92764 -Node: KPSE_DOT expansion93869 -Node: Subdirectory expansion94382 -Node: Filename database96733 -Node: ls-R97787 -Node: Filename aliases100681 -Node: Database format101859 -Node: Invoking kpsewhich102872 -Node: Path searching options103818 -Node: Specially-recognized files111982 -Node: Auxiliary tasks113338 -Node: Standard options115163 -Node: TeX support115519 -Node: Supported file formats116810 -Node: File lookup124327 -Node: Glyph lookup126076 -Node: Basic glyph lookup127200 -Node: Fontmap128079 -Node: Fallback font130696 -Node: Suppressing warnings131609 -Node: Programming132714 -Node: Programming overview133227 -Node: Calling sequence135921 -Node: Program-specific files142444 -Node: Programming with config files143467 -Node: Index144779 +Node: Introduction2262 +Node: History4088 +Node: Installation8180 +Node: Simple installation8970 +Node: Custom installation12553 +Node: Disk space13727 +Node: Kpathsea application distributions14611 +Node: Changing search paths15726 +Node: Default path features16908 +Node: Default path generation18991 +Node: Running configure20434 +Node: configure shells21485 +Node: configure options22537 +Node: configure environment24044 +Node: configure scenarios25846 +Node: Shared library27432 +Node: Running make28446 +Node: Installing files30493 +Node: Cleaning up32440 +Node: Filename database generation33488 +Node: mktex scripts34055 +Node: mktex configuration35332 +Node: mktex script names41151 +Node: mktex script arguments42542 +Node: Installation testing43432 +Node: Security43796 +Node: TeX directory structure46363 +Node: unixtex.ftp50785 +Node: Reporting bugs52119 +Node: Bug checklist52854 +Node: Mailing lists56551 +Node: Debugging57760 +Node: Logging62838 +Node: Common problems64708 +Node: Unable to find files65539 +Node: Slow path searching67950 +Node: Unable to generate fonts69327 +Node: TeX or Metafont failing71836 +Node: Empty Makefiles73715 +Node: XtStrings74952 +Node: dlopen75788 +Node: ShellWidgetClass76606 +Node: Pointer combination warnings78238 +Node: Path searching78627 +Node: Searching overview79274 +Node: Path sources82670 +Node: Config files83741 +Node: Path expansion87668 +Node: Default expansion88617 +Node: Variable expansion90687 +Node: Tilde expansion92090 +Node: Brace expansion93070 +Node: KPSE_DOT expansion94175 +Node: Subdirectory expansion94688 +Node: Filename database97039 +Node: ls-R98093 +Node: Filename aliases100987 +Node: Database format102165 +Node: Invoking kpsewhich103178 +Node: Path searching options104124 +Node: Specially-recognized files112288 +Node: Auxiliary tasks113644 +Node: Standard options115469 +Node: TeX support115825 +Node: Supported file formats117116 +Node: File lookup124633 +Node: Glyph lookup126382 +Node: Basic glyph lookup127506 +Node: Fontmap128385 +Node: Fallback font131002 +Node: Suppressing warnings131915 +Node: Programming133020 +Node: Programming overview133533 +Node: Calling sequence136227 +Node: Program-specific files142750 +Node: Programming with config files143773 +Node: Index145085  End Tag Table diff --git a/Build/source/texk/kpathsea/doc/kpathsea.texi b/Build/source/texk/kpathsea/doc/kpathsea.texi index fade566d07f..25f393ef676 100644 --- a/Build/source/texk/kpathsea/doc/kpathsea.texi +++ b/Build/source/texk/kpathsea/doc/kpathsea.texi @@ -3,7 +3,7 @@ @settitle Kpathsea: A library for path searching @set version 6.0.0 -@set month-year July 2010 +@set month-year November 2010 @copying This file documents the Kpathsea library for path searching. @@ -453,7 +453,15 @@ mentions most features. The format of @file{texmf.cnf} files follows: @itemize @bullet @item @cindex comments, in @file{texmf.cnf} -Comments start with @samp{%} and continue to the end of the line. +Comments start with @samp{%}, either at the beginning of a line or +preceded by whitespace, and continue to the end of the line. That is, +as with most shells, a @samp{%} in the ``middle'' of a value does not +start a comment. Examples: + +@example +% this is a comment +var = a%b % but the value of var will be "a%b". +@end example @item @cindex blank lines, in @file{texmf.cnf} @@ -484,20 +492,20 @@ The @var{variable} name may contain any character other than whitespace, @item If @samp{.@var{progname}} is present, the definition only applies if the program that is running is named (i.e., the last component of @code{argv[0]} is) @var{progname} or -@file{@var{progname}.exe}. This allows different flavors of @TeX{} to -have different search paths, for example. +@file{@var{progname}.@{exe,bat,cmd,...@}}. Most notably, this allows +different flavors of @TeX{} to have different search paths. @item @cindex right-hand side of variable assignments @var{value} may contain any characters except @samp{%} and @samp{@@}. -(These restrictions are only necessary because of the processing done on -@file{texmf.cnf} at build time, so you can stick those characters in -after installation if you have to.) The @samp{$@var{var}.@var{prog}} -feature is not available on the right-hand side; instead, you must use -an additional variable (see below for example). A @samp{;} in -@var{value} is translated to @samp{:} if running under Unix; this is -useful to write a single @file{texmf.cnf} which can be used under both -Unix and NT. +(These restrictions are only necessary because of the processing done +on @file{texmf.cnf} at build time, so you can stick those characters +in after installation if you have to.) The +@samp{$@var{var}.@var{prog}} feature is not available on the +right-hand side; instead, you must use an additional variable (see +below for example). A @samp{;} in @var{value} is translated to +@samp{:} if running under Unix; this is useful to write a single +@file{texmf.cnf} which can be used under both Unix and Windows. @item All definitions are read before anything is expanded, so you can use variables before they are defined (like Make, unlike most other @@ -519,12 +527,12 @@ TEXINPUTS.latex = $latex2e_inputs @cindex shell scripts as configuration files @cindex configuration files as shell scripts. -Although this format has obvious similarities to Bourne shell -scripts---change the comment character to @code{#}, disallow spaces -around the @code{=}, and get rid of the @code{.@var{name}} convention, -and it could be run through the shell. But there seemed little -advantage to doing this, since all the information would have to passed -back to Kpathsea and parsed there anyway, since the @code{sh} process +This format has obvious similarities to Bourne shell scripts---change +the comment character to @code{#}, disallow spaces around the +@code{=}, and get rid of the @code{.@var{name}} convention, and it +could be run through the shell. However, there seemed little +advantage in this, since all the information would have to passed back +to Kpathsea and parsed there anyway, since the @code{sh} process couldn't affect its parent's environment. @flindex cnf.c diff --git a/Build/source/texk/kpathsea/texmf.cnf b/Build/source/texk/kpathsea/texmf.cnf index cfd9c2319e7..836acda4072 100644 --- a/Build/source/texk/kpathsea/texmf.cnf +++ b/Build/source/texk/kpathsea/texmf.cnf @@ -81,6 +81,7 @@ TEXMFSYSCONFIG = $SELFAUTOPARENT/texmf-config % User texmf trees are allowed as follows. % This used to be HOMETEXMF. +% ~ expands to $USERPROFILE on Window, $HOME otherwise. TEXMFHOME = ~/texmf % TEXMFVAR, where texconfig stores variable runtime data. @@ -88,7 +89,7 @@ TEXMFHOME = ~/texmf % For sharing this tree with $TEXMFMAIN: % TEXMFVAR = $TEXMFMAIN % For using a separate tree: -% TEXMFVAR = ~/.texmf-var # teTeX 3.0 default +% TEXMFVAR = ~/.texmf-var % teTeX 3.0 default TEXMFVAR = ~/.texlive2010/texmf-var % TEXMFCONFIG, where texconfig stores configuration data. @@ -96,7 +97,7 @@ TEXMFVAR = ~/.texlive2010/texmf-var % For sharing this tree with $TEXMFMAIN: % TEXMFCONFIG = $TEXMFMAIN % For using a separate tree: -% TEXMFCONFIG = ~/.texmf-config # teTeX 3.0 default +% TEXMFCONFIG = ~/.texmf-config % teTeX 3.0 default % For using a separate tree: % TEXMFCONFIG = $SELFAUTOPARENT/texmf-config TEXMFCONFIG = ~/.texlive2010/texmf-config -- cgit v1.2.3