#include "system.h"#include "poptint.h"#include <sys/stat.h>

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. | |
| int | poptSaneFile (const char *fn) |
| Perform sanity checks on a file path. | |
| int | poptReadFile (const char *fn, char **bp, size_t *nbp, int flags) |
| Read a file into a buffer. | |
| static int | configAppMatch (poptContext con, const char *s) |
| Check for application match. | |
| static int | poptConfigLine (poptContext con, char *line) |
| int | poptReadConfigFile (poptContext con, const char *fn) |
| Read configuration file. | |
| int | poptReadConfigFiles (poptContext con, const char *paths) |
| Read configuration file(s). | |
| int | poptReadDefaultConfig (poptContext con, int useEnv) |
| Read default configuration from /etc/popt and $HOME/.popt. | |
| static int configAppMatch | ( | poptContext | con, | |
| const char * | s | |||
| ) | [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 int poptConfigLine | ( | poptContext | con, | |
| char * | line | |||
| ) | [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().
| static int poptGlob | ( | poptContext | con, | |
| const char * | pattern, | |||
| int * | acp, | |||
| const char *** | avp | |||
| ) | [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().
| int poptReadConfigFile | ( | poptContext | con, | |
| const char * | fn | |||
| ) |
Read configuration file.
| con | context | |
| fn | file name to read |
< config file failed sanity test
Definition at line 391 of file poptconfig.c.
References _isspaceptr, POPT_ERROR_BADCONFIG, 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 444 of file poptconfig.c.
References POPT_ERROR_BADCONFIG, poptGlob(), poptReadConfigFile(), poptSaneFile(), and xstrdup.
| int poptReadDefaultConfig | ( | poptContext | con, | |
| int | useEnv | |||
| ) |
Read default configuration from /etc/popt and $HOME/.popt.
| con | context | |
| useEnv | (unused) |
Definition at line 498 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.5.8