Commit a92fa608 by Bruce Korb Committed by Bruce Korb

buglet & relaxed rules

From-SVN: r33877
parent be1bb652
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
(LABEL_NUSES, LABEL_REFS): Likewise. (LABEL_NUSES, LABEL_REFS): Likewise.
* unroll.c (copy_loop_body): Don't copy NOTE_INSN_DELETED_LABEL. * unroll.c (copy_loop_body): Don't copy NOTE_INSN_DELETED_LABEL.
2000-05-12 Bruce Korb <bkorb@gnu.org>
* fixinc/fixfixes.c(format_write): buglet & relaxed rules
2000-05-12 Zack Weinberg <zack@wolery.cumb.org> 2000-05-12 Zack Weinberg <zack@wolery.cumb.org>
* fixinc/fixfixes.c (IO_use_fix, IO_defn_fix, CTRL_use_fix, * fixinc/fixfixes.c (IO_use_fix, IO_defn_fix, CTRL_use_fix,
......
...@@ -127,32 +127,54 @@ format_write (format, text, av) ...@@ -127,32 +127,54 @@ format_write (format, text, av)
tCC* text; tCC* text;
regmatch_t av[]; regmatch_t av[];
{ {
tCC *p, *str;
int c; int c;
size_t len;
while ((c = (unsigned)*(format++)) != NUL) {
for (p = 0; *p; p++) {
c = *p; if (c != '%') {
if (c != '%') { putchar(c);
putchar(c); continue;
continue; }
}
c = (unsigned)*(format++);
c = *++p;
if (c == '%') { /*
putchar(c); * IF the character following a '%' is not a digit,
continue; * THEN we will always emit a '%' and we may or may
} else if (c < '0' || c > '9') { * not emit the following character. We will end on
abort(); * a NUL and we will emit only one of a pair of '%'.
} */
if (! isdigit( c )) {
c -= '0'; putchar( '%' );
str = text + av[c].rm_so; switch (c) {
len = av[c].rm_eo - av[c].rm_so; case NUL:
fwrite(str, len, 1, stdout); return;
case '%':
break;
default:
putchar(c);
}
}
/*
* Emit the matched subexpression numbered 'c'.
* IF, of course, there was such a match...
*/
else {
regmatch_t* pRM = av + (c - (unsigned)'0');
size_t len;
if (pRM->rm_so < 0)
continue;
len = pRM->rm_eo - pRM->rm_so;
if (len > 0)
fwrite(text + pRM->rm_so, len, 1, stdout);
}
} }
} }
FIX_PROC_HEAD( format_fix ) FIX_PROC_HEAD( format_fix )
{ {
tSCC zBad[] = "fixincl error: `%s' needs %s c_fix_arg\n"; tSCC zBad[] = "fixincl error: `%s' needs %s c_fix_arg\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment