diff options
| author | Theodore Tso <tytso@mit.edu> | 1998-11-14 03:45:05 +0000 |
|---|---|---|
| committer | Theodore Tso <tytso@mit.edu> | 1998-11-14 03:45:05 +0000 |
| commit | 5b62e1f2ff162cc7bef392fbc85266648eb100d5 (patch) | |
| tree | 8b8d3e6b29e9834a2dc0ea246b4326f4babc7896 /src/util/profile/prof_parse.c | |
| parent | 9c3cd8f8f10efe5c9428ad0a1ada71bae826007a (diff) | |
| download | krb5-5b62e1f2ff162cc7bef392fbc85266648eb100d5.tar.gz krb5-5b62e1f2ff162cc7bef392fbc85266648eb100d5.tar.xz krb5-5b62e1f2ff162cc7bef392fbc85266648eb100d5.zip | |
Makefile.in: Set the myfulldir and mydir variables (which are relative
to buildtop and thisconfigdir, respectively.)
configure.in: Build the test script prtest for doing regression test
suites of the profile library.
prof_err.et (PROF_MAGIC_ITERATOR): Add a new error code for the magic
number for the iterator structure.
prof_file.c (profile_update_file): Increment the update serial number
when the profile file is re-read.
prof_tree.c (profile_make_node_final, profile_is_node_final): Add a
new attribute for a node, which is whether or not the node is "final".
This controls whether or not the next profile file should be searched
when looking up a key which matches the section named by the node.
(profile_node_iterator_create, profile_node_iterator_free,
profile_node_iterator): New functions which take a profile_t and
returns all of the names or values for a particular search key. This
iterator follows the rules of doing multiple profile file lookups
using the "final node" marker to stop searching subsequent profile
files.
prof_parse.c (parse_std_line): Add support for marking top level
sections, subsections, and individual nodes as final, using the '*'
character.
(dump_profile_to_file): Print finalized sections with the '*'
character.
prof_get.c: Update routines to use the iterators provided by
prof_tree.c.
prof_int.c: Add upd_serial member to the prf_file_t structure. Define
the symbolic flags used by the profile node iterator. Add function
declarations for profile_make_node_final, profile_is_node_final,
profile_node_iterator_create, profile_node_iterator_free,
profile_node_iterator, and profile_get_value.
test_profile.c: Add the query1 command which tests profile_get_value.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11038 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/profile/prof_parse.c')
| -rw-r--r-- | src/util/profile/prof_parse.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c index cc7e36b8f..833f80d35 100644 --- a/src/util/profile/prof_parse.c +++ b/src/util/profile/prof_parse.c @@ -89,6 +89,7 @@ static errcode_t parse_std_line(line, state) char *cp, ch, *tag, *value; char *p; errcode_t retval; + struct profile_node *node; int do_subsection = 0; void *iter = 0; @@ -125,6 +126,10 @@ static errcode_t parse_std_line(line, state) * Finish off the rest of the line. */ cp = p+1; + if (*cp == '*') { + profile_make_node_final(state->current_section); + cp++; + } if (*cp) return PROF_SECTION_SYNTAX; return 0; @@ -132,6 +137,8 @@ static errcode_t parse_std_line(line, state) if (ch == '}') { if (state->group_level == 0) return PROF_EXTRA_CBRACE; + if (*(cp+1) == '*') + profile_make_node_final(state->current_section); retval = profile_get_node_parent(state->current_section, &state->current_section); if (retval) @@ -170,15 +177,24 @@ static errcode_t parse_std_line(line, state) *cp-- = 0; } if (do_subsection) { + p = strchr(tag, '*'); + if (p) + *p = '\0'; retval = profile_add_node(state->current_section, tag, 0, &state->current_section); if (retval) return retval; - + if (p) + profile_make_node_final(state->current_section); state->group_level++; return 0; } - profile_add_node(state->current_section, tag, value, 0); + p = strchr(tag, '*'); + if (p) + *p = '\0'; + profile_add_node(state->current_section, tag, value, &node); + if (p) + profile_make_node_final(node); return 0; } @@ -384,7 +400,8 @@ void dump_profile_to_file(root, level, dstfile) if (level == 0) { /* [xxx] */ for (i=0; i < level; i++) fprintf(dstfile, "\t"); - fprintf(dstfile, "[%s]%s", name, EOL); + fprintf(dstfile, "[%s]%s%s", name, + profile_is_node_final(p) ? "*" : "", EOL); dump_profile_to_file(p, level+1, dstfile); fprintf(dstfile, EOL); } else { /* xxx = { ... } */ @@ -394,7 +411,8 @@ void dump_profile_to_file(root, level, dstfile) dump_profile_to_file(p, level+1, dstfile); for (i=0; i < level; i++) fprintf(dstfile, "\t"); - fprintf(dstfile, "}%s", EOL); + fprintf(dstfile, "}%s%s", + profile_is_node_final(p) ? "*" : "", EOL); } } while (iter != 0); } |
