diff options
Diffstat (limited to 'support/poptconfig.c')
-rw-r--r-- | support/poptconfig.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/support/poptconfig.c b/support/poptconfig.c index 2b442641..7a1a4c2b 100644 --- a/support/poptconfig.c +++ b/support/poptconfig.c @@ -2,22 +2,7 @@ file accompanying popt source distributions, available from ftp://ftp.redhat.com/pub/code/popt */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <ctype.h> -#include <errno.h> -#include <fcntl.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#if HAVE_ALLOCA_H -# include <alloca.h> -#endif - -#include "popt-gnome.h" +#include "system.h" #include "poptint.h" static void configLine(poptContext con, char * line) { @@ -51,19 +36,19 @@ static void configLine(poptContext con, char * line) { shortName = opt[1]; if (!strcmp(entryType, "alias")) { - if (poptParseArgvString(line, &alias.argc, (char ***)&alias.argv)) return; + if (poptParseArgvString(line, &alias.argc, &alias.argv)) return; alias.longName = longName, alias.shortName = shortName; poptAddAlias(con, alias, 0); } else if (!strcmp(entryType, "exec")) { - con->execs = realloc(con->execs, + con->execs = realloc(con->execs, sizeof(*con->execs) * (con->numExecs + 1)); if (longName) - con->execs[con->numExecs].longName = strdup(longName); + con->execs[con->numExecs].longName = xstrdup(longName); else con->execs[con->numExecs].longName = NULL; con->execs[con->numExecs].shortName = shortName; - con->execs[con->numExecs].script = strdup(line); + con->execs[con->numExecs].script = xstrdup(line); con->numExecs++; } @@ -84,7 +69,7 @@ int poptReadConfigFile(poptContext con, const char * fn) { } fileLength = lseek(fd, 0, SEEK_END); - lseek(fd, 0, 0); + (void) lseek(fd, 0, 0); file = alloca(fileLength + 1); if (read(fd, file, fileLength) != fileLength) { @@ -122,13 +107,14 @@ int poptReadConfigFile(poptContext con, const char * fn) { break; default: *dst++ = *chptr++; + break; } } return 0; } -int poptReadDefaultConfig(poptContext con, int useEnv) { +int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv) { char * fn, * home; int rc; |