add %patch -E
authorroot <devnull@localhost>
Wed, 30 Oct 1996 02:30:01 +0000 (02:30 +0000)
committerroot <devnull@localhost>
Wed, 30 Oct 1996 02:30:01 +0000 (02:30 +0000)
CVS patchset: 1132
CVS date: 1996/10/30 02:30:01

build/build.c

index 9daca7a..d5ac52e 100644 (file)
@@ -38,7 +38,8 @@ int execPart(Spec s, char *sb, char *name, int builddir, int test);
 static int doSetupMacro(Spec spec, StringBuf sb, char *line);
 static int doPatchMacro(Spec spec, StringBuf sb, char *line);
 static char *do_untar(Spec spec, int c);
-static char *do_patch(Spec spec, int c, int strip, char *dashb, int reverse);
+static char *do_patch(Spec spec, int c, int strip, char *dashb,
+                     int reverse, int removeEmpties);
 int isCompressed(char *file);
 static void doSweep(Spec s);
 static int doRmSource(Spec s);
@@ -417,7 +418,8 @@ static char *do_untar(Spec spec, int c)
     return buf;
 }
 
-static char *do_patch(Spec spec, int c, int strip, char *db, int reverse)
+static char *do_patch(Spec spec, int c, int strip, char *db,
+                     int reverse, int removeEmpties)
 {
     static char buf[1024];
     char file[1024];
@@ -449,6 +451,9 @@ static char *do_patch(Spec spec, int c, int strip, char *db, int reverse)
     if (reverse) {
        strcat(args, " -R");
     }
+    if (removeEmpties) {
+       strcat(args, " -E");
+    }
 
     if (isCompressed(file)) {
        sprintf(buf,
@@ -470,13 +475,13 @@ static char *do_patch(Spec spec, int c, int strip, char *db, int reverse)
 static int doPatchMacro(Spec spec, StringBuf sb, char *line)
 {
     char *opt_b;
-    int opt_P, opt_p, opt_R;
+    int opt_P, opt_p, opt_R, opt_E;
     char *s, *s1;
     char buf[1024];
     int patch_nums[1024];  /* XXX - we can only handle 1024 patches! */
     int patch_index, x;
 
-    opt_P = opt_p = opt_R = 0;
+    opt_P = opt_p = opt_R = opt_E = 0;
     opt_b = NULL;
     patch_index = 0;
 
@@ -493,6 +498,8 @@ static int doPatchMacro(Spec spec, StringBuf sb, char *line)
            opt_P = 1;
        } else if (!strcmp(s, "-R")) {
            opt_R = 1;
+       } else if (!strcmp(s, "-E")) {
+           opt_E = 1;
        } else if (!strcmp(s, "-b")) {
            /* orig suffix */
            opt_b = strtok(NULL, " \t\n");
@@ -536,7 +543,7 @@ static int doPatchMacro(Spec spec, StringBuf sb, char *line)
     /* All args processed */
 
     if (! opt_P) {
-       s = do_patch(spec, 0, opt_p, opt_b, opt_R);
+       s = do_patch(spec, 0, opt_p, opt_b, opt_R, opt_E);
        if (! s) {
            return 1;
        }
@@ -545,7 +552,7 @@ static int doPatchMacro(Spec spec, StringBuf sb, char *line)
 
     x = 0;
     while (x < patch_index) {
-       s = do_patch(spec, patch_nums[x], opt_p, opt_b, opt_R);
+       s = do_patch(spec, patch_nums[x], opt_p, opt_b, opt_R, opt_E);
        if (! s) {
            return 1;
        }