| 1 |
/* variable.h: declare variable expander. |
| 2 |
|
| 3 |
Copyright 1993, 1995, 2008, 2019 Karl Berry. |
| 4 |
|
| 5 |
This library is free software; you can redistribute it and/or |
| 6 |
modify it under the terms of the GNU Lesser General Public |
| 7 |
License as published by the Free Software Foundation; either |
| 8 |
version 2.1 of the License, or (at your option) any later version. |
| 9 |
|
| 10 |
This library is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
Lesser General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU Lesser General Public License |
| 16 |
along with this library; if not, see <http://www.gnu.org/licenses/>. */ |
| 17 |
|
| 18 |
#ifndef KPATHSEA_VARIABLE_H |
| 19 |
#define KPATHSEA_VARIABLE_H |
| 20 |
|
| 21 |
#include <kpathsea/c-proto.h> |
| 22 |
#include <kpathsea/types.h> |
| 23 |
|
| 24 |
|
| 25 |
#ifdef __cplusplus |
| 26 |
extern "C" { |
| 27 |
#endif |
| 28 |
|
| 29 |
/* Return the (variable-expanded) environment variable value or config |
| 30 |
file value, or NULL. */ |
| 31 |
extern KPSEDLL string kpathsea_var_value (kpathsea kpse, const_string var); |
| 32 |
|
| 33 |
/* Expand $VAR, ${VAR}, and ~ references in SRC, returning the (always newly |
| 34 |
dynamically-allocated) result. An unterminated ${ or any other |
| 35 |
character following $ produce error messages, and that part of SRC is |
| 36 |
ignored. In the $VAR form, the variable name consists of consecutive |
| 37 |
letters, digits, and underscores. In the ${VAR} form, the variable |
| 38 |
name consists of whatever is between the braces. |
| 39 |
|
| 40 |
In any case, ``expansion'' means calling `getenv'; if the variable is not |
| 41 |
set, look in texmf.cnf files for a definition. If not set there, either, |
| 42 |
the expansion of a $FOO construct is its literal text ("$FOO"), while |
| 43 |
the expansion of a ${BAR} construct is the empty string. This is so |
| 44 |
at least some file names containing $ characters will work. */ |
| 45 |
extern KPSEDLL string kpathsea_var_expand (kpathsea kpse, const_string src); |
| 46 |
|
| 47 |
#if defined (KPSE_COMPAT_API) |
| 48 |
extern KPSEDLL string kpse_var_value (const_string var); |
| 49 |
extern KPSEDLL string kpse_var_expand (const_string src); |
| 50 |
#endif |
| 51 |
|
| 52 |
#ifdef __cplusplus |
| 53 |
} |
| 54 |
#endif |
| 55 |
|
| 56 |
#endif /* not KPATHSEA_VARIABLE_H */ |