aboutsummaryrefslogtreecommitdiff
path: root/bfd/doc/chew.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-01-31 06:23:17 +0000
committerAlan Modra <amodra@gmail.com>2002-01-31 06:23:17 +0000
commitba994a14fdc759f4242ff0b28d5906aec87c74f9 (patch)
treeb4bdf3d0013250a7f96714bf34d6cca332f429bd /bfd/doc/chew.c
parent7148ab62129a8ea1749a142f5bf05050e8d8645e (diff)
downloadgdb-ba994a14fdc759f4242ff0b28d5906aec87c74f9.zip
gdb-ba994a14fdc759f4242ff0b28d5906aec87c74f9.tar.gz
gdb-ba994a14fdc759f4242ff0b28d5906aec87c74f9.tar.bz2
* chew.c (courierize): Don't modify @command params.
Diffstat (limited to 'bfd/doc/chew.c')
-rw-r--r--bfd/doc/chew.c48
1 files changed, 29 insertions, 19 deletions
diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c
index 843e441..42ab399 100644
--- a/bfd/doc/chew.c
+++ b/bfd/doc/chew.c
@@ -686,37 +686,47 @@ WORD (courierize)
while (at (tos, idx) && at (tos, idx) != '\n')
{
- if (at (tos, idx) == '{' && at (tos, idx + 1) == '*')
+ if (command > 1)
+ {
+ /* We are inside {} parameters of some command;
+ Just pass through until matching brace. */
+ if (at (tos, idx) == '{')
+ ++command;
+ else if (at (tos, idx) == '}')
+ --command;
+ }
+ else if (command != 0)
+ {
+ if (at (tos, idx) == '{')
+ ++command;
+ else if (!islower ((unsigned char) at (tos, idx)))
+ --command;
+ }
+ else if (at (tos, idx) == '@'
+ && islower ((unsigned char) at (tos, idx + 1)))
+ {
+ ++command;
+ }
+ else if (at (tos, idx) == '{' && at (tos, idx + 1) == '*')
{
cattext (&out, "/*");
idx += 2;
+ continue;
}
else if (at (tos, idx) == '*' && at (tos, idx + 1) == '}')
{
cattext (&out, "*/");
idx += 2;
+ continue;
}
- else if (at (tos, idx) == '{' && !command)
+ else if (at (tos, idx) == '{'
+ || at (tos, idx) == '}')
{
- cattext (&out, "@{");
- idx++;
- }
- else if (at (tos, idx) == '}' && !command)
- {
- cattext (&out, "@}");
- idx++;
- }
- else
- {
- if (at (tos, idx) == '@')
- command = 1;
- else if (isspace ((unsigned char) at (tos, idx))
- || at (tos, idx) == '}')
- command = 0;
- catchar (&out, at (tos, idx));
- idx++;
+ catchar (&out, '@');
}
+ catchar (&out, at (tos, idx));
+ idx++;
}
catchar (&out, '\n');
}