summaryrefslogtreecommitdiffstats
path: root/ini/ini_config.h
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-09-28 09:36:00 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-10-05 10:32:09 -0400
commite9f2a23c715cf0169e0537ab6a884c32ba5f52f5 (patch)
tree6f8c774d8942bb8b7087486fde55c0ac03d79e28 /ini/ini_config.h
parentb40f097afda4357e523e6c05fe9e81afca863c2a (diff)
downloadding-libs2-e9f2a23c715cf0169e0537ab6a884c32ba5f52f5.tar.gz
ding-libs2-e9f2a23c715cf0169e0537ab6a884c32ba5f52f5.tar.xz
ding-libs2-e9f2a23c715cf0169e0537ab6a884c32ba5f52f5.zip
INI Add config_from_fd() to ini_config
Patch adds ability to read configuration using already open file descriptor. Started by Steve G and refined a bit by me.
Diffstat (limited to 'ini/ini_config.h')
-rw-r--r--ini/ini_config.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/ini/ini_config.h b/ini/ini_config.h
index 1fee48a..5ae4981 100644
--- a/ini/ini_config.h
+++ b/ini/ini_config.h
@@ -97,23 +97,42 @@ const char *validation_error_str(int parsing_error);
/* Read configuration information from a file */
int config_from_file(const char *application, /* Name of the application - will be used as name of the collection */
- const char *config_file, /* Name of the config file - if NULL the collection will be empty */
+ const char *config_filename, /* Name of the config file - if NULL the collection will be empty */
struct collection_item **ini_config, /* If *ini_config is NULL a new ini object will be allocated, */
/* otherwise the one that is pointed to will be updated. */
int error_level, /* Error level - break for errors, warnings or best effort (don't break) */
struct collection_item **error_list); /* List of errors for a file */
+/* Read configuration information from a file descriptor */
+int config_from_fd(const char *application, /* Name of the application - will be used as name of the collection */
+ int fd, /* Previously opened file descriptor for the config file */
+ const char *config_source, /* Name of the file being parsed, for use when printing the error list */
+ struct collection_item **ini_config, /* If *ini_config is NULL a new ini object will be allocated*/
+ int error_level, /* Error level - break for errors, warnings or best effort (don't break) */
+ struct collection_item **error_list); /* List of errors for a file */
+
/* Read configuration information from a file with extra collection of line numbers */
int config_from_file_with_lines(
const char *application, /* Name of the application - will be used as name of the collection */
- const char *config_file, /* Name of the config file - if NULL the collection will be empty */
+ const char *config_filename, /* Name of the config file - if NULL the collection will be empty */
struct collection_item **ini_config, /* If *ini_config is NULL a new ini object will be allocated, */
/* otherwise the one that is pointed to will be updated. */
int error_level, /* Error level - break for errors, warnings or best effort (don't break) */
struct collection_item **error_list, /* List of errors for a file */
struct collection_item **lines); /* Collection of pairs where key is the key and value is line number */
+/* Read configuration information from a file descriptor with extra collection of line numbers */
+int config_from_fd_with_lines(
+ const char *application, /* Name of the application - will be used as name of the collection */
+ int fd, /* Previously opened file descriptor for the config file */
+ const char *config_source, /* Name of the file being parsed, for use when printing the error list */
+ struct collection_item **ini_config, /* If *ini_config is NULL a new ini object will be allocated, */
+ /* otherwise the one that is pointed to will be updated. */
+ int error_level, /* Error level - break for errors, warnings or best effort (don't break) */
+ struct collection_item **error_list, /* List of errors for a file */
+ struct collection_item **lines); /* Collection of pairs where key is the key and value is line number */
+
/* Read default config file and then overwrite it with a specific one from the directory */
int config_for_app(const char *application, /* Name of the application that will be used to get config for */