Rewrite strsep code using strtok for ANSI C portability.
authorjbj <devnull@localhost>
Sat, 5 Sep 1998 18:20:52 +0000 (18:20 +0000)
committerjbj <devnull@localhost>
Sat, 5 Sep 1998 18:20:52 +0000 (18:20 +0000)
Remove RPMVAR_SETENV for now.

CVS patchset: 2278
CVS date: 1998/09/05 18:20:52

build.c
lib/rpmlib.h
lib/rpmrc.c

diff --git a/build.c b/build.c
index 30fc022..ec36986 100644 (file)
--- 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);
index 7283608..c179240 100644 (file)
@@ -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);
index e9325d6..35c8881 100644 (file)
@@ -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;