summaryrefslogtreecommitdiff
path: root/support/poptconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'support/poptconfig.c')
-rw-r--r--support/poptconfig.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/support/poptconfig.c b/support/poptconfig.c
index 7a1a4c2..2b44264 100644
--- a/support/poptconfig.c
+++ b/support/poptconfig.c
@@ -2,7 +2,22 @@
file accompanying popt source distributions, available from
ftp://ftp.redhat.com/pub/code/popt */
-#include "system.h"
+#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 "poptint.h"
static void configLine(poptContext con, char * line) {
@@ -36,19 +51,19 @@ static void configLine(poptContext con, char * line) {
shortName = opt[1];
if (!strcmp(entryType, "alias")) {
- if (poptParseArgvString(line, &alias.argc, &alias.argv)) return;
+ if (poptParseArgvString(line, &alias.argc, (char ***)&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 = xstrdup(longName);
+ con->execs[con->numExecs].longName = strdup(longName);
else
con->execs[con->numExecs].longName = NULL;
con->execs[con->numExecs].shortName = shortName;
- con->execs[con->numExecs].script = xstrdup(line);
+ con->execs[con->numExecs].script = strdup(line);
con->numExecs++;
}
@@ -69,7 +84,7 @@ int poptReadConfigFile(poptContext con, const char * fn) {
}
fileLength = lseek(fd, 0, SEEK_END);
- (void) lseek(fd, 0, 0);
+ lseek(fd, 0, 0);
file = alloca(fileLength + 1);
if (read(fd, file, fileLength) != fileLength) {
@@ -107,14 +122,13 @@ int poptReadConfigFile(poptContext con, const char * fn) {
break;
default:
*dst++ = *chptr++;
- break;
}
}
return 0;
}
-int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv) {
+int poptReadDefaultConfig(poptContext con, int useEnv) {
char * fn, * home;
int rc;