Lines Matching refs:profile
2 * profile.c -- A simple configuration file parsing "library in a file"
4 * The profile library was originally written by Theodore Ts'o in 1995
72 #include "profile.h"
85 * This is the structure which stores the profile information for a
104 * The profile flags
121 * Used by the profile iterator in prof_get.c
151 /* profile parser declarations */
209 (prf_file_t profile);
211 static errcode_t profile_get_value(profile_t profile, const char *name,
302 profile_t profile;
307 profile = malloc(sizeof(struct _profile_t));
308 if (!profile)
310 memset(profile, 0, sizeof(struct _profile_t));
311 profile->magic = PROF_MAGIC_PROFILE;
312 last = &profile->first_file;
314 /* if the filenames list is not specified return an empty profile */
347 if (!profile->first_file) {
348 profile_release(profile);
354 *ret_profile = profile;
358 profile_release(profile);
363 profile_release(profile_t profile)
367 if (!profile || profile->magic != PROF_MAGIC_PROFILE)
370 for (p = profile->first_file; p; p = next) {
374 profile->magic = 0;
375 free(profile);
381 * then def_string parameter will be parsed and used as the profile
384 errcode_t profile_set_default(profile_t profile, const char *def_string)
393 if (!def_string || !profile || profile->magic != PROF_MAGIC_PROFILE)
396 for (prf = profile->first_file; prf; prf = prf->next) {
452 * prof_file.c ---- routines that manipulate an individual profile file.
561 * profile file if it changes.
611 /* Begin the profile parser */
1029 * this file; all of the other profile routines build, access, and
1111 * the profile are true. If not, we have a programming bug somewhere,
1267 profile_t profile;
1279 profile_iterator_create(profile_t profile, const char *const *names, int flags,
1285 if (profile == 0)
1287 if (profile->magic != PROF_MAGIC_PROFILE)
1301 iter->profile = profile;
1304 iter->file = profile->first_file;
1452 * querying items from the profile.
1460 errcode_t profile_get_value(profile_t profile, const char *name,
1474 if ((retval = profile_iterator_create(profile, names,
1493 profile_get_string(profile_t profile, const char *name, const char *subname,
1500 if (profile) {
1501 retval = profile_get_value(profile, name, subname,
1521 profile_get_integer(profile_t profile, const char *name, const char *subname,
1530 if (profile == 0)
1533 retval = profile_get_value(profile, name, subname, subsubname, &value);
1562 profile_get_uint(profile_t profile, const char *name, const char *subname,
1572 if (profile == 0)
1575 retval = profile_get_value(profile, name, subname, subsubname, &value);
1638 profile_get_boolean(profile_t profile, const char *name, const char *subname,
1644 if (profile == 0) {
1649 retval = profile_get_value(profile, name, subname, subsubname, &value);
1698 * test_profile.c --- testing program for the profile routine
1709 static void do_cmd(profile_t profile, char **argv)
1724 retval = profile_get_values(profile, names, &values);
1741 retval = profile_get_value(profile, name, subname,
1745 retval = profile_get_subsection_names(profile, names,
1749 retval = profile_get_relation_names(profile, names,
1754 (profile->first_file->root, stdout);
1757 retval = profile_clear_relation(profile, names);
1759 retval = profile_update_relation(profile, names+2,
1764 (profile->first_file->root);
1767 retval = profile_rename_section(profile, names+1, *names);
1772 retval = profile_add_relation(profile, names+1, value);
1774 retval = profile_flush(profile);
1795 static void do_batchmode(profile_t profile)
1810 do_cmd(profile, argv);
1814 profile_release(profile);
1830 profile_t profile;
1843 retval = profile_init_path(argv[1], &profile);
1845 com_err(program_name, retval, "while initializing profile");
1848 retval = profile_set_default(profile, default_str);
1856 do_batchmode(profile);
1858 do_cmd(profile, argv+2);
1859 profile_release(profile);