diff options
author | jbj <jbj> | 2009-01-25 15:23:03 +0000 |
---|---|---|
committer | jbj <jbj> | 2009-01-25 15:23:03 +0000 |
commit | a0fbf70d53308e73e0092848d479e409b6f584c4 (patch) | |
tree | 9c203bab8d0988af2a19400884155c2aac2985dd /popt.h | |
parent | b7ef45ebb16a0371bbb8c77b9022d39948220fdc (diff) | |
download | libpopt-a0fbf70d53308e73e0092848d479e409b6f584c4.tar.gz |
- jbj: add poptReadFile routine.
Diffstat (limited to 'popt.h')
-rw-r--r-- | popt.h | 32 |
1 files changed, 23 insertions, 9 deletions
@@ -386,6 +386,29 @@ int poptAddItem(poptContext con, poptItem newItem, int flags) /*@modifies con @*/; /** \ingroup popt + * Perform sanity checks on a file path. + * @param fn file name + * @return 0 on OK, 1 on NOTOK. + */ +int poptSaneFile(const char * fn) + /*@globals errno, internalState @*/ + /*@modifies errno, internalState @*/; + +/** + * Read a file into a buffer. + * @param fn file name + * @retval *bp buffer (malloc'd) + * @retval *nbp no. of bytes in buffer (including final NUL) + * @param flags 1 to trim escaped newlines + * return 0 on success + */ +int poptReadFile(const char * fn, /*@out@*/ char ** bp, /*@out@*/ size_t * nbp, + int flags) + /*@globals errno, fileSystem, internalState @*/ + /*@modifies *bp, *nbp, errno, fileSystem, internalState @*/; +#define POPT_READFILE_TRIMNEWLINES 1 + +/** \ingroup popt * Read configuration file. * @param con context * @param fn file name to read @@ -397,15 +420,6 @@ int poptReadConfigFile(poptContext con, const char * fn) errno, fileSystem, internalState @*/; /** \ingroup popt - * Perform sanity checks on a file path. - * @param fn file path - * @return 0 on OK, 1 on NOTOK. - */ -int poptSaneFile(const char * fn) - /*@globals errno, internalState @*/ - /*@modifies errno, internalState @*/; - -/** \ingroup popt * Read configuration file(s). * Colon separated files to read, looping over poptReadConfigFile(). * Note that an '@' character preceeding a path in the list will |