diff options
Diffstat (limited to 'bfd/doc/chew.c')
-rw-r--r-- | bfd/doc/chew.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c index 0773f9c..9ad88aa 100644 --- a/bfd/doc/chew.c +++ b/bfd/doc/chew.c @@ -265,6 +265,19 @@ skip_white_and_stars (src, idx) return idx; } +static unsigned int +skip_past_newline_1 (ptr, idx) + string_type *ptr; + unsigned int idx; +{ + while (at (ptr, idx) + && at (ptr, idx) != '\n') + idx++; + if (at (ptr, idx) == '\n') + return idx + 1; + return idx; +} + /***********************************************************************/ string_type stack[STACK]; @@ -603,10 +616,12 @@ outputdots () while (at (tos, idx)) { - if (at (tos, idx) == '\n' && at (tos, idx + 1) == '.') + /* Every iteration begins at the start of a line. */ + if (at (tos, idx) == '.') { char c; - idx += 2; + + idx++; while ((c = at (tos, idx)) && c != '\n') { @@ -626,11 +641,13 @@ outputdots () idx++; } } + if (c == '\n') + idx++; catchar (&out, '\n'); } else { - idx++; + idx = skip_past_newline_1 (tos, idx); } } @@ -1095,10 +1112,7 @@ icatstr () static void skip_past_newline () { - while (at (ptr, idx) - && at (ptr, idx) != '\n') - idx++; - idx++; + idx = skip_past_newline_1 (ptr, idx); pc++; } |