aboutsummaryrefslogtreecommitdiff
path: root/src/util/profile/test_profile.c
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1998-11-14 03:45:05 +0000
committerTheodore Tso <tytso@mit.edu>1998-11-14 03:45:05 +0000
commit5b62e1f2ff162cc7bef392fbc85266648eb100d5 (patch)
tree8b8d3e6b29e9834a2dc0ea246b4326f4babc7896 /src/util/profile/test_profile.c
parent9c3cd8f8f10efe5c9428ad0a1ada71bae826007a (diff)
downloadkrb5-5b62e1f2ff162cc7bef392fbc85266648eb100d5.zip
krb5-5b62e1f2ff162cc7bef392fbc85266648eb100d5.tar.gz
krb5-5b62e1f2ff162cc7bef392fbc85266648eb100d5.tar.bz2
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/test_profile.c')
-rw-r--r--src/util/profile/test_profile.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/util/profile/test_profile.c b/src/util/profile/test_profile.c
index 19edbaf..4b2df6d 100644
--- a/src/util/profile/test_profile.c
+++ b/src/util/profile/test_profile.c
@@ -7,7 +7,7 @@
#include <stdlib.h>
#endif
-#include "profile.h"
+#include "prof_int.h"
#ifndef _MSDOS
#include "com_err.h"
#else
@@ -29,8 +29,10 @@ int main(argc, argv)
profile_t profile;
long retval;
char **values, **cpp;
+ const char *value;
const char **names;
char *cmd;
+ int print_value = 0;
if (argc < 3) {
fprintf(stderr, "Usage: %s filename cmd argset\n", program_name);
@@ -48,6 +50,9 @@ int main(argc, argv)
names = (const char **) argv+3;
if (!strcmp(cmd, "query")) {
retval = profile_get_values(profile, names, &values);
+ } else if (!strcmp(cmd, "query1")) {
+ retval = profile_get_value(profile, names, &value);
+ print_value++;
} else if (!strcmp(cmd, "list_sections")) {
retval = profile_get_subsection_names(profile, names, &values);
} else if (!strcmp(cmd, "list_relations")) {
@@ -60,11 +65,13 @@ int main(argc, argv)
com_err(argv[0], retval, "while getting values");
exit(1);
}
- for (cpp = values; *cpp; cpp++) {
- printf("%s\n", *cpp);
- free(*cpp);
+ if (print_value) {
+ printf("%s\n", value);
+ } else {
+ for (cpp = values; *cpp; cpp++)
+ printf("%s\n", *cpp);
+ profile_free_list(values);
}
- free(values);
profile_release(profile);
return 0;