diff options
Diffstat (limited to 'binutils-2.25/bfd/doc/chew.c')
-rw-r--r-- | binutils-2.25/bfd/doc/chew.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/binutils-2.25/bfd/doc/chew.c b/binutils-2.25/bfd/doc/chew.c index b019837b..9ad88aaa 100644 --- a/binutils-2.25/bfd/doc/chew.c +++ b/binutils-2.25/bfd/doc/chew.c @@ -1,7 +1,5 @@ /* chew - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, - 2002, 2003, 2005, 2007, 2009, 2012 - Free Software Foundation, Inc. + Copyright (C) 1990-2014 Free Software Foundation, Inc. Contributed by steve chamberlain @cygnus This file is part of BFD, the Binary File Descriptor library. @@ -267,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]; @@ -476,8 +487,10 @@ remove_noncomments (src, dst) static void print_stack_level () { - fprintf (stderr, "current string stack depth = %ld, ", tos - stack); - fprintf (stderr, "current integer stack depth = %ld\n", isp - istack); + fprintf (stderr, "current string stack depth = %ld, ", + (long) (tos - stack)); + fprintf (stderr, "current integer stack depth = %ld\n", + (long) (isp - istack)); pc++; } @@ -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++; } @@ -1564,7 +1578,7 @@ main (ac, av) if (tos != stack) { fprintf (stderr, "finishing with current stack level %ld\n", - tos - stack); + (long) (tos - stack)); return 1; } return 0; |