Make parsing more flexible, so we don't barf over lack of spaces
authorTheodore Tso <tytso@mit.edu>
Wed, 14 Feb 1996 21:48:05 +0000 (21:48 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 14 Feb 1996 21:48:05 +0000 (21:48 +0000)
around the equals sign.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7479 dc483132-0cff-0310-8789-dd5450dbe970

src/util/profile/ChangeLog
src/util/profile/prof_parse.c
src/util/profile/test_parse.c

index 2f8620dbcb5dfb88dd7346a9add30636b51429e3..209dace7e55b4ae54485dbdec8f8da3a1383a221 100644 (file)
@@ -1,3 +1,8 @@
+Wed Feb 14 16:43:48 1996    <tytso@rsts-11.mit.edu>
+
+       * 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  <eichin@cygnus.com>
 
        * krb5.conf: use host:portnum in example files, not host,portnum.
index 121b51ddf56387de73fdbe7ad77f2dcb0f2121f9..eed309df09165f88d22aac2eeacba6ae13c99cde 100644 (file)
@@ -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);
 }
index 0e92fdaeb8d6b6730a39538235f8bd74af1dfa62..3466154010ec8455fb2bcecf1822889027a5f0b4 100644 (file)
@@ -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;
 }