From: jbj Date: Sat, 5 Sep 1998 18:20:52 +0000 (+0000) Subject: Rewrite strsep code using strtok for ANSI C portability. X-Git-Tag: rpm-4.4-release~3518 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd8f00921aa4ec5b45d0db8b3b55b8ea109f1fed;p=platform%2Fupstream%2Frpm.git Rewrite strsep code using strtok for ANSI C portability. Remove RPMVAR_SETENV for now. CVS patchset: 2278 CVS date: 1998/09/05 18:20:52 --- diff --git a/build.c b/build.c index 30fc022..ec36986 100644 --- a/build.c +++ b/build.c @@ -144,7 +144,7 @@ int build(char *arg, int buildAmount, char *passPhrase, char * rcfile, char * arch, char * os, char *buildplatforms) { - char * platform; + char *platform, *t; int rc; if (buildplatforms == NULL) { @@ -157,7 +157,9 @@ int build(char *arg, int buildAmount, char *passPhrase, printf("building these platforms: %s\n", buildplatforms); - while((platform = strsep(&buildplatforms,",")) != NULL) { + t = buildplatforms; + while((platform = strtok(t, ",")) != NULL) { + t = NULL; printf("building %s\n", platform); rpmSetVar(RPMVAR_BUILDPLATFORM,platform); diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 7283608..c179240 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -246,9 +246,8 @@ extern const struct headerSprintfExtension rpmHeaderFormats[]; #define RPMVAR_BUILDPLATFORM 46 #define RPMVAR_BUILDARCH 47 #define RPMVAR_BUILDOS 48 -#define RPMVAR_SETENV 49 -#define RPMVAR_NUM 50 /* number of RPMVAR entries */ +#define RPMVAR_NUM 49 /* number of RPMVAR entries */ char * rpmGetVar(int var); int rpmGetBooleanVar(int var); diff --git a/lib/rpmrc.c b/lib/rpmrc.c index e9325d6..35c8881 100644 --- a/lib/rpmrc.c +++ b/lib/rpmrc.c @@ -120,7 +120,9 @@ static struct rpmOption optionTable[] = { /* { "root", RPMVAR_ROOT, 0, 0, 1, 0 }, */ { "rpmdir", RPMVAR_RPMDIR, 0, 0, 1, 1 }, { "rpmfilename", RPMVAR_RPMFILENAME, 0, 1, 1, 2 }, - { "setenv", RPMVAR_SETENV, 0, 1, 0, 0 }, +#if defined(RPMVAR_SETENV) + { "setenv", RPMVAR_SETENV, 0, 1, 0. 0 }, +#endif { "signature", RPMVAR_SIGTYPE, 0, 0, 0, 0 }, { "sourcedir", RPMVAR_SOURCEDIR, 0, 0, 1, 1 }, { "specdir", RPMVAR_SPECDIR, 0, 0, 1, 1 }, @@ -651,6 +653,7 @@ static int doReadRC(int fd, char * filename) { * and run it through expandMacros() before parsing here -- all %define * lines will work just fine without adding more syntax here. */ +#if defined(RPMVAR_SETENV) case RPMVAR_SETENV: { char * macroname, *envname; @@ -684,6 +687,7 @@ static int doReadRC(int fd, char * filename) { addMacro(&globalMacroContext, start, NULL, macroname, RMIL_RPMRC); setenv(envname,start,1); } break; +#endif /* defined(RPMVAR_SETENV) */ case RPMVAR_INCLUDE: { int fdinc;