summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-07-21 23:18:46 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-07-21 23:18:46 +0000
commit993996fe4411b46ca39bc30218a6a4bd4ee16d50 (patch)
treeec1e0db241dfe3ec909d607284bd9efceb4df292
parent1c6240a818f41bd25b3a71a099af229bddc39625 (diff)
make it less sensitive to incredibly bad indentation; shigio@wafu.netgate.net
-rw-r--r--usr.bin/ctags/C.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/usr.bin/ctags/C.c b/usr.bin/ctags/C.c
index cfb89df3b13..e6c42155e34 100644
--- a/usr.bin/ctags/C.c
+++ b/usr.bin/ctags/C.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: C.c,v 1.3 1997/06/30 06:26:33 deraadt Exp $ */
+/* $OpenBSD: C.c,v 1.4 1997/07/21 23:18:45 deraadt Exp $ */
/* $NetBSD: C.c,v 1.3 1995/03/26 20:14:02 glass Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)C.c 8.4 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: C.c,v 1.3 1997/06/30 06:26:33 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: C.c,v 1.4 1997/07/21 23:18:45 deraadt Exp $";
#endif
#endif /* not lint */
@@ -200,6 +200,21 @@ c_entries()
* reserved words.
*/
default:
+ /*
+ * to treat following function.
+ * func (arg) {
+ * ....
+ * }
+ */
+ if (c == ' ' || c == '\t') {
+ int save = c;
+ while (GETC(!=, EOF) && (c == ' ' || c == '\t'))
+ ;
+ if (c == EOF)
+ return;
+ (void)ungetc(c, inf);
+ c = save;
+ }
storec: if (!intoken(c)) {
if (sp == tok)
break;
@@ -318,6 +333,14 @@ hash_entry()
char *sp; /* buffer pointer */
char tok[MAXTOKEN]; /* storage buffer */
+ /*
+ * to treat following macro.
+ * # macro(arg) ....
+ */
+ while (GETC(!=, EOF) && (c == ' ' || c == '\t'))
+ ;
+ (void)ungetc(c, inf);
+
curline = lineno;
for (sp = tok;;) { /* get next token */
if (GETC(==, EOF))