summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/cnf.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/kpathsea/cnf.c')
-rw-r--r--Build/source/texk/kpathsea/cnf.c15
1 files changed, 15 insertions, 0 deletions
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 != '.')