diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/util/profile/ChangeLog | 5 | ||||
| -rw-r--r-- | src/util/profile/prof_parse.c | 21 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index 1e4331b40..c7b4be1e1 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,5 +1,10 @@ 2004-08-27 Ken Raeburn <raeburn@mit.edu> + * prof_parse.c (parse_std_line): Rewrite handling of whitespace in + and after tag, to strip trailing whitespace (per current locale, + not just ASCII space characters), and prohibit any internal space + characters in tag names. + * profile.swg: New file. * configure.in: Look for Tcl. * Makefile.in (profile_tcl, profile_tcl.c, profile_tcl.o): New diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c index 87966f05e..042379dd2 100644 --- a/src/util/profile/prof_parse.c +++ b/src/util/profile/prof_parse.c @@ -146,13 +146,22 @@ static errcode_t parse_std_line(char *line, struct parse_state *state) cp = strchr(cp, '='); if (!cp) return PROF_RELATION_SYNTAX; + if (cp == tag) + return PROF_RELATION_SYNTAX; *cp = '\0'; - p = strchr(tag, ' '); - if (p) { - *p = '\0'; - p = skip_over_blanks(p+1); - if (p != cp) - return PROF_RELATION_SYNTAX; + p = tag; + /* Look for whitespace on left-hand side. */ + while (p < cp && !isspace((int)*p)) + p++; + if (p < cp) { + /* Found some sort of whitespace. */ + *p++ = 0; + /* If we have more non-whitespace, it's an error. */ + while (p < cp) { + if (!isspace((int)*p)) + return PROF_RELATION_SYNTAX; + p++; + } } cp = skip_over_blanks(cp+1); value = cp; |
