diff options
author | Carlos Perelló MarÃn <carlos@gnome.org> | 2003-10-19 16:10:32 +0000 |
---|---|---|
committer | Carlos Perelló Marín <carlos@src.gnome.org> | 2003-10-19 16:10:32 +0000 |
commit | e08096f464bc32e1695493d23a72da9e58b14b61 (patch) | |
tree | acb8e9155b51036faffecfea60d99fc6aca1682f /support/poptconfig.c | |
parent | ad87f865578a31c085b031ec46808f057949a671 (diff) | |
download | shared-mime-info-e08096f464bc32e1695493d23a72da9e58b14b61.tar.gz |
libgtop-GNOME-2-0-branch moved to HEAD.
2003-10-19 Carlos Perelló MarÃn <carlos@gnome.org>
* libgtop-GNOME-2-0-branch moved to HEAD.
svn path=/trunk/; revision=3059
Diffstat (limited to 'support/poptconfig.c')
-rw-r--r-- | support/poptconfig.c | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/support/poptconfig.c b/support/poptconfig.c index 7a1a4c2b..4c14ed22 100644 --- a/support/poptconfig.c +++ b/support/poptconfig.c @@ -2,7 +2,39 @@ file accompanying popt source distributions, available from ftp://ftp.redhat.com/pub/code/popt */ -#include "system.h" +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX +# pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#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> + +#ifndef _AIX +# if HAVE_ALLOCA_H +# include <alloca.h> +# endif +#endif + +#include "popt-gnome.h" #include "poptint.h" static void configLine(poptContext con, char * line) { @@ -36,19 +68,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 +101,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 +139,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; |