diff options
author | Theodore Tso <tytso@mit.edu> | 1998-12-04 08:19:28 +0000 |
---|---|---|
committer | Theodore Tso <tytso@mit.edu> | 1998-12-04 08:19:28 +0000 |
commit | 76540e7ffa010351d43e2717aaf755863284c807 (patch) | |
tree | ffd8931a4c10ff39f78e0d77beb199536ca2f6cd /src/util/profile | |
parent | 33bf778b7c5efa1cf6f08cad6e307511ba6a88c7 (diff) | |
download | krb5-76540e7ffa010351d43e2717aaf755863284c807.tar.gz krb5-76540e7ffa010351d43e2717aaf755863284c807.tar.xz krb5-76540e7ffa010351d43e2717aaf755863284c807.zip |
prof_get.c: Add new public profile_iterator functions for iterating
over values found in the profile file.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11062 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/profile')
-rw-r--r-- | src/util/profile/ChangeLog | 5 | ||||
-rw-r--r-- | src/util/profile/prof_get.c | 28 | ||||
-rw-r--r-- | src/util/profile/prof_int.h | 13 | ||||
-rw-r--r-- | src/util/profile/prof_tree.c | 2 | ||||
-rw-r--r-- | src/util/profile/profile.hin | 19 |
5 files changed, 62 insertions, 5 deletions
diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index a0a48dad3e..554357a584 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,3 +1,8 @@ +1998-12-04 Theodore Ts'o <tytso@rsts-11.mit.edu> + + * prof_get.c: Add new public profile_iterator functions for + iterating over values found in the profile file. + 1998-11-17 Theodore Ts'o <tytso@rsts-11.mit.edu> * prof_get.c (profile_get_values): If there are no relations diff --git a/src/util/profile/prof_get.c b/src/util/profile/prof_get.c index 7f1d3c5ce4..ff07bc3ef2 100644 --- a/src/util/profile/prof_get.c +++ b/src/util/profile/prof_get.c @@ -344,3 +344,31 @@ cleanup: end_list(&values, 0); return retval; } + +errcode_t profile_iterator_create(profile, names, flags, ret_iter) + profile_t profile; + const char **names; + int flags; + void **ret_iter; +{ + return profile_node_iterator_create(profile, names, flags, ret_iter); +} + +void profile_iterator_free(iter_p) + void **iter_p; +{ + profile_node_iterator_free(iter_p); +} + +errcode_t profile_iterator(iter_p, ret_name, ret_value) + void **iter_p; + char **ret_name, **ret_value; +{ + return profile_node_iterator(iter_p, 0, ret_name, ret_value); +} + +void profile_release_string(str) + char *str; +{ + free(str); +} diff --git a/src/util/profile/prof_int.h b/src/util/profile/prof_int.h index 99d7fc1ae6..1a0304f4c8 100644 --- a/src/util/profile/prof_int.h +++ b/src/util/profile/prof_int.h @@ -62,7 +62,7 @@ struct _profile_t { typedef struct _profile_t *profile_t; /* - * Used by the profile node iterator in prof_tre.c + * Used by the profile iterator in prof_get.c */ #define PROFILE_ITER_LIST_SECTION 0x0001 #define PROFILE_ITER_SECTIONS_ONLY 0x0002 @@ -70,7 +70,6 @@ typedef struct _profile_t *profile_t; #define PROFILE_ITER_FINAL_SEEN 0x0100 - /* profile_parse.c */ errcode_t profile_parse_file @@ -181,3 +180,13 @@ errcode_t profile_get_relation_names errcode_t profile_get_subsection_names PROTOTYPE((profile_t profile, const char **names, char ***ret_names)); +errcode_t profile_iterator_create + PROTOTYPE((profile_t profile, const char **names, + int flags, void **ret_iter)); + +void profile_iterator_free PROTOTYPE((void **iter_p)); + +errcode_t profile_iterator + PROTOTYPE((void **iter_p, char **ret_name, char **ret_value)); + +void profile_release_string PROTOTYPE((char *str)); diff --git a/src/util/profile/prof_tree.c b/src/util/profile/prof_tree.c index 3bb05d29ff..ddfa08f440 100644 --- a/src/util/profile/prof_tree.c +++ b/src/util/profile/prof_tree.c @@ -531,5 +531,3 @@ get_new_file: *ret_value = p->value; return 0; }; - - diff --git a/src/util/profile/profile.hin b/src/util/profile/profile.hin index 42dc7fa2ab..8984570f31 100644 --- a/src/util/profile/profile.hin +++ b/src/util/profile/profile.hin @@ -18,7 +18,6 @@ #define NEAR #endif - typedef struct _profile_t *profile_t; #if !defined(PROTOTYPE) @@ -29,6 +28,13 @@ typedef struct _profile_t *profile_t; #endif #endif +/* + * Used by the profile iterator in prof_get.c + */ +#define PROFILE_ITER_LIST_SECTION 0x0001 +#define PROFILE_ITER_SECTIONS_ONLY 0x0002 +#define PROFILE_ITER_RELATIONS_ONLY 0x0004 + long profile_init PROTOTYPE ((const char **filenames, profile_t *ret_profile)); @@ -59,4 +65,15 @@ long profile_get_relation_names long profile_get_subsection_names PROTOTYPE((profile_t profile, const char **names, char ***ret_names)); +long profile_iterator_create + PROTOTYPE((profile_t profile, const char **names, + int flags, void **ret_iter)); + +void profile_iterator_free PROTOTYPE((void **iter_p)); + +long profile_iterator + PROTOTYPE((void **iter_p, char **ret_name, char **ret_value)); + +void profile_release_string PROTOTYPE((char *str)); + #endif /* _KRB5_PROFILE_H */ |