diff options
author | Jim Meyering <jim@meyering.net> | 1996-04-29 01:28:06 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-04-29 01:28:06 +0000 |
commit | 5a5938db828ab6059f7600692f5c5006873b9bcc (patch) | |
tree | 26b55b3a4384be7de67ce442e686b4d165cf9002 | |
parent | 3c57cea2ce769f8e0fdf2e65bb6ce484f60a7ae2 (diff) | |
download | coreutils-5a5938db828ab6059f7600692f5c5006873b9bcc.tar.xz |
(copy_rest): Don't copy past end of prefix. Output
trailing spaces if the prefix had any. Before, the command
perl -e 'print "| S";' |fmt -p' | '|tr '\0' @ output `|@S'.
Reported by François Pinard.
-rw-r--r-- | src/fmt.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -575,8 +575,9 @@ copy_rest (FILE *f, register int c) if (in_column > next_prefix_indent && c != '\n' && c != EOF) { put_space (next_prefix_indent); - for (s = prefix; out_column != in_column; out_column++) + for (s = prefix; out_column != in_column && *s; out_column++) putchar (*s++); + put_space (in_column - out_column); } while (c != '\n' && c != EOF) { |