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);
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];
if (reverse) {
strcat(args, " -R");
}
+ if (removeEmpties) {
+ strcat(args, " -E");
+ }
if (isCompressed(file)) {
sprintf(buf,
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;
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");
/* 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;
}
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;
}