From 3a62f8785f05a2637016ba8a7778c4308d3cc104 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 25 Jan 1998 08:25:05 +0000 Subject: (cat): Convert comma-expressions to pairs of semicolon-terminated stmts. Add braces around compound if/else stmts. --- src/cat.c | 120 +++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 68 insertions(+), 52 deletions(-) (limited to 'src/cat.c') diff --git a/src/cat.c b/src/cat.c index e5cd91174..4f054d3ce 100644 --- a/src/cat.c +++ b/src/cat.c @@ -1,5 +1,5 @@ /* cat -- concatenate files and print on the standard output. - Copyright (C) 88, 90, 91, 95, 96, 1997 Free Software Foundation, Inc. + Copyright (C) 88, 90, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -381,60 +381,76 @@ cat ( /* If quoting, i.e. at least one of -v, -e, or -t specified, scan for chars that need conversion. */ if (quote) - for (;;) - { - if (ch >= 32) - { - if (ch < 127) - *bpout++ = ch; - else if (ch == 127) - *bpout++ = '^', - *bpout++ = '?'; - else - { - *bpout++ = 'M', + { + for (;;) + { + if (ch >= 32) + { + if (ch < 127) + *bpout++ = ch; + else if (ch == 127) + { + *bpout++ = '^'; + *bpout++ = '?'; + } + else + { + *bpout++ = 'M'; *bpout++ = '-'; - if (ch >= 128 + 32) - if (ch < 128 + 127) - *bpout++ = ch - 128; + if (ch >= 128 + 32) + { + if (ch < 128 + 127) + *bpout++ = ch - 128; + else + { + *bpout++ = '^'; + *bpout++ = '?'; + } + } else - *bpout++ = '^', - *bpout++ = '?'; - else - *bpout++ = '^', - *bpout++ = ch - 128 + 64; - } - } - else if (ch == '\t' && output_tabs) - *bpout++ = '\t'; - else if (ch == '\n') - { - newlines = -1; - break; - } - else - *bpout++ = '^', - *bpout++ = ch + 64; - - ch = *bpin++; - } + { + *bpout++ = '^'; + *bpout++ = ch - 128 + 64; + } + } + } + else if (ch == '\t' && output_tabs) + *bpout++ = '\t'; + else if (ch == '\n') + { + newlines = -1; + break; + } + else + { + *bpout++ = '^'; + *bpout++ = ch + 64; + } + + ch = *bpin++; + } + } else - /* Not quoting, neither of -v, -e, or -t specified. */ - for (;;) - { - if (ch == '\t' && !output_tabs) - *bpout++ = '^', - *bpout++ = ch + 64; - else if (ch != '\n') - *bpout++ = ch; - else - { - newlines = -1; - break; - } - - ch = *bpin++; - } + { + /* Not quoting, neither of -v, -e, or -t specified. */ + for (;;) + { + if (ch == '\t' && !output_tabs) + { + *bpout++ = '^'; + *bpout++ = ch + 64; + } + else if (ch != '\n') + *bpout++ = ch; + else + { + newlines = -1; + break; + } + + ch = *bpin++; + } + } } } -- cgit v1.2.3-54-g00ecf