|
popt
1.16
|

Go to the source code of this file.
Functions | |
| static int | poptGlob (poptContext con, const char *pattern, int *acp, const char ***avp) |
| Return path(s) from a glob pattern. More... | |
| int | poptSaneFile (const char *fn) |
| Perform sanity checks on a file path. More... | |
| int | poptReadFile (const char *fn, char **bp, size_t *nbp, int flags) |
| Read a file into a buffer. More... | |
| static int | configAppMatch (poptContext con, const char *s) |
| Check for application match. More... | |
| static int | poptConfigLine (poptContext con, char *line) |
| int | poptReadConfigFile (poptContext con, const char *fn) |
| Read configuration file. More... | |
| int | poptReadConfigFiles (poptContext con, const char *paths) |
| Read configuration file(s). More... | |
| int | poptReadDefaultConfig (poptContext con, int useEnv) |
| Read default configuration from /etc/popt and $HOME/.popt. More... | |
| poptContext | poptFini (poptContext con) |
| Destroy context (alternative implementation). More... | |
| poptContext | poptInit (int argc, const char **argv, const struct poptOption *options, const char *configPaths) |
| Initialize popt context (alternative implementation). More... | |
|
static |
Check for application match.
| con | context |
| s | config application name return 0 if config application matches |
Definition at line 239 of file poptconfig.c.
References poptContext_s::appName.
Referenced by poptConfigLine().
|
static |
< config file failed sanity test
< don't show in help/usage
< don't show in help/usage
< don't show in help/usage
< arg will be saved as string
Definition at line 263 of file poptconfig.c.
References _isspaceptr, poptContext_s::appName, configAppMatch(), POPT_ARG_STRING, POPT_ARGFLAG_DOC_HIDDEN, POPT_ERROR_BADCONFIG, POPT_READFILE_TRIMNEWLINES, poptAddItem(), poptParseArgvString(), poptReadFile(), and stpcpy().
Referenced by poptReadConfigFile().
| poptContext poptFini | ( | poptContext | con | ) |
Destroy context (alternative implementation).
| con | context |
Definition at line 561 of file poptconfig.c.
References poptFreeContext().
Referenced by poptInit().
|
static |
Return path(s) from a glob pattern.
| con | context |
| pattern | glob pattern |
| *acp | no. of paths |
| *avp | array of paths |
Definition at line 96 of file poptconfig.c.
References POPT_ERROR_ERRNO, and xstrdup().
Referenced by poptReadConfigFiles(), and poptReadDefaultConfig().
| poptContext poptInit | ( | int | argc, |
| const char ** | argv, | ||
| const struct poptOption * | options, | ||
| const char * | configPaths | ||
| ) |
Initialize popt context (alternative implementation).
This routine does poptGetContext() and then poptReadConfigFiles().
| argc | no. of arguments |
| argv | argument array |
| options | address of popt option table |
| configPaths | colon separated file path(s) to read. |
Definition at line 567 of file poptconfig.c.
References poptFini(), poptGetContext(), and poptReadConfigFiles().
| int poptReadConfigFile | ( | poptContext | con, |
| const char * | fn | ||
| ) |
Read configuration file.
| con | context |
| fn | file name to read |
< no context
< config file failed sanity test
Definition at line 392 of file poptconfig.c.
References _isspaceptr, POPT_ERROR_BADCONFIG, POPT_ERROR_NOCONTEXT, POPT_READFILE_TRIMNEWLINES, poptConfigLine(), and poptReadFile().
Referenced by poptReadConfigFiles(), and poptReadDefaultConfig().
| int poptReadConfigFiles | ( | poptContext | con, |
| const char * | paths | ||
| ) |
Read configuration file(s).
Colon separated files to read, looping over poptReadConfigFile(). Note that an '@' character preceeding a path in the list will also perform additional sanity checks on the file before reading.
| con | context |
| paths | colon separated file name(s) to read |
< config file failed sanity test
Definition at line 447 of file poptconfig.c.
References POPT_ERROR_BADCONFIG, poptGlob(), poptReadConfigFile(), poptSaneFile(), and xstrdup().
Referenced by poptInit().
| int poptReadDefaultConfig | ( | poptContext | con, |
| int | useEnv | ||
| ) |
Read default configuration from /etc/popt and $HOME/.popt.
| con | context |
| useEnv | (unused) |
< errno set, use strerror(errno)
Definition at line 501 of file poptconfig.c.
References poptContext_s::appName, POPT_ERROR_ERRNO, poptGlob(), poptReadConfigFile(), and stpcpy().
| int poptReadFile | ( | const char * | fn, |
| char ** | bp, | ||
| size_t * | nbp, | ||
| int | flags | ||
| ) |
Read a file into a buffer.
| fn | file name |
| *bp | buffer (malloc'd) (or NULL) |
| *nbp | no. of bytes in buffer (including final NUL) (or NULL) |
| flags | 1 to trim escaped newlines return 0 on success |
< errno set, use strerror(errno)
< memory allocation failed
Definition at line 159 of file poptconfig.c.
References POPT_ERROR_ERRNO, POPT_ERROR_MALLOC, and POPT_READFILE_TRIMNEWLINES.
Referenced by poptConfigLine(), and poptReadConfigFile().
| int poptSaneFile | ( | const char * | fn | ) |
Perform sanity checks on a file path.
| fn | file name |
Definition at line 141 of file poptconfig.c.
Referenced by poptReadConfigFiles().
1.8.13