From 01f49f47431347b02b4dd153b0b11f19d6ab6f1d Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 14 Feb 1996 21:48:05 +0000 Subject: [PATCH] Make parsing more flexible, so we don't barf over lack of spaces around the equals sign. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7479 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/profile/ChangeLog | 5 +++++ src/util/profile/prof_parse.c | 28 ++++++++++++---------------- src/util/profile/test_parse.c | 4 ++++ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index 2f8620dbc..209dace7e 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,3 +1,8 @@ +Wed Feb 14 16:43:48 1996 + + * prof_parse.c (parse_std_line): Make parsing more flexible, so we + don't barf over lack of spaces around the equals sign. + Tue Dec 12 19:18:14 1995 Mark Eichin * krb5.conf: use host:portnum in example files, not host,portnum. diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c index 121b51ddf..eed309df0 100644 --- a/src/util/profile/prof_parse.c +++ b/src/util/profile/prof_parse.c @@ -110,14 +110,18 @@ static errcode_t parse_std_line(line, state) /* * Parse the relations */ - p = strchr(cp, ' '); - if (!p) - return PROF_RELATION_SYNTAX; - *p = '\0'; tag = cp; - cp = skip_over_blanks(p+1); - if (*cp != '=') + cp = strchr(cp, '='); + if (!cp) 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; + } cp = skip_over_blanks(cp+1); value = cp; if (value[0] == 0) { @@ -260,16 +264,13 @@ void dump_profile_to_file(root, level, dstfile) &name, &p); if (retval) break; - if (level == 0) /* [xxx] */ - { + if (level == 0) { /* [xxx] */ for (i=0; i < level; i++) fprintf(dstfile, "\t"); fprintf(dstfile, "[%s]\r", name); dump_profile_to_file(p, level+1, dstfile); fprintf(dstfile, "\r"); - } - else if (level == 1) /* xxx = { ... } */ - { + } else { /* xxx = { ... } */ for (i=0; i < level; i++) fprintf(dstfile, "\t"); fprintf(dstfile, "%s = {\r", name); @@ -278,10 +279,5 @@ void dump_profile_to_file(root, level, dstfile) fprintf(dstfile, "\t"); fprintf(dstfile, "}\r"); } - else /* +xxx+ */ - { - /* don't know what comes next, this should get someones attention */ - fprintf(dstfile, "+%s+"); - } } while (iter != 0); } diff --git a/src/util/profile/test_parse.c b/src/util/profile/test_parse.c index 0e92fdaeb..346615401 100644 --- a/src/util/profile/test_parse.c +++ b/src/util/profile/test_parse.c @@ -51,6 +51,10 @@ int main(argc, argv) printf("\n\nDebugging dump.\n"); dump_profile(root, 0); +#if 1 profile_free_node(root); +#else + dump_profile_to_file(root, 0, stdout); +#endif return 0; } -- 2.26.2