patch/patch-2.5.4-ifdef.patch

71 lines
2.4 KiB
Diff
Raw Normal View History

--- patch-2.5.4/patch.c.ifdef Tue Mar 5 09:42:45 2002
+++ patch-2.5.4/patch.c Tue Mar 5 09:42:47 2002
@@ -88,8 +88,9 @@
static char const *do_defines; /* symbol to patch using ifdef, ifndef, etc. */
static char const if_defined[] = "\n#ifdef %s\n";
-static char const not_defined[] = "#ifndef %s\n";
-static char const else_defined[] = "\n#else\n";
+static char const not_defined[] = "\n#ifndef %s\n";
+static char const elseis_defined[] = "\n#else /* %s */\n";
+static char const elsenot_defined[] = "\n#else /* not %s */\n";
static char const end_defined[] = "\n#endif /* %s */\n";
static int Argc;
@@ -1014,12 +1015,13 @@
return FALSE;
if (R_do_defines) {
if (def_state == OUTSIDE) {
- fprintf (fp, outstate->after_newline + if_defined,
+ fprintf (fp, outstate->after_newline + not_defined,
R_do_defines);
def_state = IN_IFNDEF;
}
else if (def_state == IN_IFDEF) {
- fprintf (fp, outstate->after_newline + else_defined);
+ fprintf (fp, outstate->after_newline + elsenot_defined,
+ R_do_defines);
def_state = IN_ELSE;
}
if (ferror (fp))
@@ -1038,7 +1040,8 @@
return FALSE;
if (R_do_defines) {
if (def_state == IN_IFNDEF) {
- fprintf (fp, outstate->after_newline + else_defined);
+ fprintf (fp, outstate->after_newline + elseis_defined,
+ R_do_defines);
def_state = IN_ELSE;
}
else if (def_state == OUTSIDE) {
@@ -1069,7 +1072,8 @@
return FALSE;
assert (outstate->after_newline);
if (R_do_defines) {
- fprintf (fp, not_defined, R_do_defines);
+ fprintf (fp, outstate->after_newline + not_defined,
+ R_do_defines);
if (ferror (fp))
write_fatal ();
def_state = IN_IFNDEF;
@@ -1086,7 +1090,8 @@
while (pch_char (old) == '!');
if (R_do_defines) {
- fprintf (fp, outstate->after_newline + else_defined);
+ fprintf (fp, outstate->after_newline + elseis_defined,
+ R_do_defines);
if (ferror (fp))
write_fatal ();
def_state = IN_ELSE;
@@ -1124,7 +1129,8 @@
def_state = IN_IFDEF;
}
else if (def_state == IN_IFNDEF) {
- fprintf (fp, outstate->after_newline + else_defined);
+ fprintf (fp, outstate->after_newline + elseis_defined,
+ R_do_defines);
def_state = IN_ELSE;
}
if (ferror (fp))