summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-01-25 08:25:05 +0000
committerJim Meyering <jim@meyering.net>1998-01-25 08:25:05 +0000
commit3a62f8785f05a2637016ba8a7778c4308d3cc104 (patch)
tree4c3ca934948a350c5d92a811d7dc26d53dd3fc2d /src
parent85923cb2bcf97e0c443adde0a4f4b95029846dc3 (diff)
downloadcoreutils-3a62f8785f05a2637016ba8a7778c4308d3cc104.tar.xz
(cat): Convert comma-expressions to pairs of
semicolon-terminated stmts. Add braces around compound if/else stmts.
Diffstat (limited to 'src')
-rw-r--r--src/cat.c120
1 files changed, 68 insertions, 52 deletions
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++;
+ }
+ }
}
}