summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-01-14 01:58:42 +0000
committerKarl Berry <karl@freefriends.org>2008-01-14 01:58:42 +0000
commitecc9d846a4ae0df37f0d33bddc91056c691e4417 (patch)
treebcd43653eefe2acfa8b4317d6a60fae49c4782f7 /Build
parent13e12240ca1e2232a10f302e2d030e8eeaa1354b (diff)
make --var-value do ~ expansion
git-svn-id: svn://tug.org/texlive/trunk@6223 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog4
-rw-r--r--Build/source/texk/kpathsea/kpathsea.info42
-rw-r--r--Build/source/texk/kpathsea/kpathsea.texi4
-rw-r--r--Build/source/texk/kpathsea/variable.c34
-rw-r--r--Build/source/texk/kpathsea/variable.h11
5 files changed, 54 insertions, 41 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 15aff986899..97d4136d09e 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,5 +1,9 @@
2008-01-14 Karl Berry <karl@tug.org>
+ * variable.c (kpse_var_value): also do ~ expansion.
+ * variable.h: adjust comments.
+ * kpathsea.texi (Auxiliary tasks): document this.
+
* tilde.c (HOMEVAR): new #define; "USERPROFILE" on Windows,
"HOME" else.
* tilde.h: adjust comments.
diff --git a/Build/source/texk/kpathsea/kpathsea.info b/Build/source/texk/kpathsea/kpathsea.info
index a50692f7aab..e85d2ae2abb 100644
--- a/Build/source/texk/kpathsea/kpathsea.info
+++ b/Build/source/texk/kpathsea/kpathsea.info
@@ -2756,7 +2756,9 @@ lookup:
* `--debug=NUM' sets the debugging options to NUM. *Note
Debugging::.
- * `--var-value=VARIABLE' output the value of VARIABLE.
+ * `--var-value=VARIABLE' outputs the value of VARIABLE, expanding
+ `$' (*note Variable expansion:: and `~' (*note Tilde expansion::)
+ constructs, but not performing other expansions.
* `--expand-braces=STRING' outputs the variable and brace expansion
of STRING. *Note Path expansion::.
@@ -3508,9 +3510,9 @@ Index
* --enable-shared: configure options. (line 27)
* --engine=NAME: Path searching options.
(line 20)
-* --expand-braces=STRING: Auxiliary tasks. (line 14)
-* --expand-path=STRING: Auxiliary tasks. (line 22)
-* --expand-var=STRING: Auxiliary tasks. (line 17)
+* --expand-braces=STRING: Auxiliary tasks. (line 16)
+* --expand-path=STRING: Auxiliary tasks. (line 24)
+* --expand-var=STRING: Auxiliary tasks. (line 19)
* --format=NAME: Path searching options.
(line 25)
* --help: Standard options. (line 8)
@@ -3524,7 +3526,7 @@ Index
(line 120)
* --progname=NAME: Path searching options.
(line 129)
-* --show-path=NAME: Auxiliary tasks. (line 39)
+* --show-path=NAME: Auxiliary tasks. (line 41)
* --srcdir, for building multiple architectures: configure scenarios.
(line 18)
* --var-value=VARIABLE: Auxiliary tasks. (line 12)
@@ -4641,20 +4643,20 @@ Node: Database format106913
Node: Invoking kpsewhich107926
Node: Path searching options108803
Node: Auxiliary tasks113270
-Node: Standard options114944
-Node: TeX support115264
-Node: Supported file formats116555
-Node: File lookup123703
-Node: Glyph lookup124994
-Node: Basic glyph lookup126121
-Node: Fontmap127000
-Node: Fallback font129617
-Node: Suppressing warnings130582
-Node: Programming131687
-Node: Programming overview132200
-Node: Calling sequence134476
-Node: Program-specific files139505
-Node: Programming with config files140543
-Node: Index141843
+Node: Standard options115080
+Node: TeX support115400
+Node: Supported file formats116691
+Node: File lookup123839
+Node: Glyph lookup125130
+Node: Basic glyph lookup126257
+Node: Fontmap127136
+Node: Fallback font129753
+Node: Suppressing warnings130718
+Node: Programming131823
+Node: Programming overview132336
+Node: Calling sequence134612
+Node: Program-specific files139641
+Node: Programming with config files140679
+Node: Index141979

End Tag Table
diff --git a/Build/source/texk/kpathsea/kpathsea.texi b/Build/source/texk/kpathsea/kpathsea.texi
index afadd5953d8..faf9b0d1850 100644
--- a/Build/source/texk/kpathsea/kpathsea.texi
+++ b/Build/source/texk/kpathsea/kpathsea.texi
@@ -1220,7 +1220,9 @@ lookup:
@item
@opindex --var-value=@var{variable}
-@samp{--var-value=@var{variable}} output the value of @var{variable}.
+@samp{--var-value=@var{variable}} outputs the value of @var{variable},
+expanding @samp{$} (@pxref{Variable expansion} and @samp{~} (@pxref{Tilde
+expansion}) constructs, but not performing other expansions.
@item
@opindex --expand-braces=@var{string}
diff --git a/Build/source/texk/kpathsea/variable.c b/Build/source/texk/kpathsea/variable.c
index 079850386a7..2e581f1bf9f 100644
--- a/Build/source/texk/kpathsea/variable.c
+++ b/Build/source/texk/kpathsea/variable.c
@@ -1,7 +1,7 @@
/* variable.c: variable expansion.
- Copyright 1997, 99, 2001, 02, 05 Olaf Weber.
- Copyright 1993, 94, 95, 96 Karl Berry.
+ Copyright 1993, 1994, 1995, 1996, 2008 Karl Berry.
+ Copyright 1997, 1999, 2001, 2002, 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -12,18 +12,16 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-*/
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, see <http://www.gnu.org/licenses/>. */
#include <kpathsea/config.h>
#include <kpathsea/c-ctype.h>
#include <kpathsea/cnf.h>
#include <kpathsea/fn.h>
+#include <kpathsea/tilde.h>
#include <kpathsea/variable.h>
@@ -34,28 +32,38 @@ kpse_var_value P1C(const_string, var)
{
string vtry, ret;
- assert(kpse_program_name);
+ assert (kpse_program_name);
/* First look for VAR.progname. */
- vtry = concat3(var, ".", kpse_program_name);
+ vtry = concat3 (var, ".", kpse_program_name);
ret = getenv (vtry);
free (vtry);
if (!ret || !*ret) {
/* Now look for VAR_progname. */
- vtry = concat3(var, "_", kpse_program_name);
+ vtry = concat3 (var, "_", kpse_program_name);
ret = getenv (vtry);
free (vtry);
}
+ /* Just plain VAR. */
if (!ret || !*ret)
ret = getenv (var);
+ /* Not in the environment; check a config file. */
if (!ret || !*ret)
ret = kpse_cnf_get (var);
- if (ret)
- ret = kpse_var_expand (ret);
+ /* We have a value; do variable and tilde expansion. We want to use ~
+ in the cnf files, to adapt nicely to Windows and to avoid extra /'s
+ (see tilde.c), but we also want kpsewhich -var-value=foo to not
+ have any literal ~ characters, so our shell scripts don't have to
+ worry about doing the ~ expansion. */
+ if (ret) {
+ string tmp = kpse_var_expand (ret);
+ ret = kpse_tilde_expand (tmp);
+ free (tmp);
+ }
#ifdef KPSE_DEBUG
if (KPSE_DEBUG_P (KPSE_DEBUG_VARS))
diff --git a/Build/source/texk/kpathsea/variable.h b/Build/source/texk/kpathsea/variable.h
index 07d549852c6..f16df71abbc 100644
--- a/Build/source/texk/kpathsea/variable.h
+++ b/Build/source/texk/kpathsea/variable.h
@@ -1,6 +1,6 @@
/* variable.h: Declare variable expander.
- Copyright (C) 1993, 95 Karl Berry.
+ Copyright (C) 1993, 1995, 2008 Karl Berry.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -12,11 +12,8 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-*/
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, see <http://www.gnu.org/licenses/>. */
#ifndef KPATHSEA_VARIABLE_H
#define KPATHSEA_VARIABLE_H
@@ -29,7 +26,7 @@
file value, or NULL. */
extern KPSEDLL string kpse_var_value P1H(const_string var);
-/* Expand $VAR and ${VAR} references in SRC, returning the (always newly
+/* Expand $VAR, ${VAR}, and ~ references in SRC, returning the (always newly
dynamically-allocated) result. An unterminated ${ or any other
character following $ produce error messages, and that part of SRC is
ignored. In the $VAR form, the variable name consists of consecutive