summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-03-21 09:41:54 +0100
committerJim Meyering <meyering@redhat.com>2008-03-21 20:58:15 +0100
commit4f812540a26ad98b52fac71e54049253359caf19 (patch)
treee226ab1cba2efb0a4c20f00642244f937a671052 /src
parent6e5bbc267a65946bc5f1cfc69301c6c378c8795a (diff)
downloadcoreutils-4f812540a26ad98b52fac71e54049253359caf19.tar.xz
ptx.c readability
* src/ptx.c (copy_unescaped_string): Add braces around 80+-line single-stmt while-loop body. Signed-off-by: Jim Meyering <meyering@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/ptx.c142
1 files changed, 72 insertions, 70 deletions
diff --git a/src/ptx.c b/src/ptx.c
index 67b70c6eb..dafcbe22a 100644
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -1,5 +1,5 @@
/* Permuted index for GNU, with keywords in their context.
- Copyright (C) 1990, 1991, 1993, 1998-2007 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1991, 1993, 1998-2008 Free Software Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1988.
This program is free software: you can redistribute it and/or modify
@@ -310,91 +310,93 @@ copy_unescaped_string (const char *string)
cursor = result;
while (*string)
- if (*string == '\\')
- {
- string++;
- switch (*string)
- {
- case 'x': /* \xhhh escape, 3 chars maximum */
- value = 0;
- for (length = 0, string++;
- length < 3 && isxdigit (to_uchar (*string));
- length++, string++)
- value = value * 16 + HEXTOBIN (*string);
- if (length == 0)
- {
- *cursor++ = '\\';
- *cursor++ = 'x';
- }
- else
+ {
+ if (*string == '\\')
+ {
+ string++;
+ switch (*string)
+ {
+ case 'x': /* \xhhh escape, 3 chars maximum */
+ value = 0;
+ for (length = 0, string++;
+ length < 3 && isxdigit (to_uchar (*string));
+ length++, string++)
+ value = value * 16 + HEXTOBIN (*string);
+ if (length == 0)
+ {
+ *cursor++ = '\\';
+ *cursor++ = 'x';
+ }
+ else
+ *cursor++ = value;
+ break;
+
+ case '0': /* \0ooo escape, 3 chars maximum */
+ value = 0;
+ for (length = 0, string++;
+ length < 3 && ISODIGIT (*string);
+ length++, string++)
+ value = value * 8 + OCTTOBIN (*string);
*cursor++ = value;
- break;
+ break;
- case '0': /* \0ooo escape, 3 chars maximum */
- value = 0;
- for (length = 0, string++;
- length < 3 && ISODIGIT (*string);
- length++, string++)
- value = value * 8 + OCTTOBIN (*string);
- *cursor++ = value;
- break;
-
- case 'a': /* alert */
+ case 'a': /* alert */
#if __STDC__
- *cursor++ = '\a';
+ *cursor++ = '\a';
#else
- *cursor++ = 7;
+ *cursor++ = 7;
#endif
- string++;
- break;
-
- case 'b': /* backspace */
- *cursor++ = '\b';
- string++;
- break;
+ string++;
+ break;
- case 'c': /* cancel the rest of the output */
- while (*string)
+ case 'b': /* backspace */
+ *cursor++ = '\b';
string++;
- break;
+ break;
- case 'f': /* form feed */
- *cursor++ = '\f';
- string++;
- break;
+ case 'c': /* cancel the rest of the output */
+ while (*string)
+ string++;
+ break;
- case 'n': /* new line */
- *cursor++ = '\n';
- string++;
- break;
+ case 'f': /* form feed */
+ *cursor++ = '\f';
+ string++;
+ break;
- case 'r': /* carriage return */
- *cursor++ = '\r';
- string++;
- break;
+ case 'n': /* new line */
+ *cursor++ = '\n';
+ string++;
+ break;
- case 't': /* horizontal tab */
- *cursor++ = '\t';
- string++;
- break;
+ case 'r': /* carriage return */
+ *cursor++ = '\r';
+ string++;
+ break;
+
+ case 't': /* horizontal tab */
+ *cursor++ = '\t';
+ string++;
+ break;
- case 'v': /* vertical tab */
+ case 'v': /* vertical tab */
#if __STDC__
- *cursor++ = '\v';
+ *cursor++ = '\v';
#else
- *cursor++ = 11;
+ *cursor++ = 11;
#endif
- string++;
- break;
+ string++;
+ break;
- default:
- *cursor++ = '\\';
- *cursor++ = *string++;
- break;
- }
- }
- else
- *cursor++ = *string++;
+ default:
+ *cursor++ = '\\';
+ *cursor++ = *string++;
+ break;
+ }
+ }
+ else
+ *cursor++ = *string++;
+ }
*cursor = '\0';
return result;