diff options
Diffstat (limited to 'contrib/global/gctags')
-rw-r--r-- | contrib/global/gctags/C.c | 128 | ||||
-rw-r--r-- | contrib/global/gctags/Makefile | 6 | ||||
-rw-r--r-- | contrib/global/gctags/Makefile.generic | 15 | ||||
-rw-r--r-- | contrib/global/gctags/assembler.c | 2 | ||||
-rw-r--r-- | contrib/global/gctags/ctags.c | 135 | ||||
-rw-r--r-- | contrib/global/gctags/ctags.h | 17 | ||||
-rw-r--r-- | contrib/global/gctags/gctags.1 | 12 | ||||
-rw-r--r-- | contrib/global/gctags/print.c | 60 | ||||
-rw-r--r-- | contrib/global/gctags/tree.c | 12 |
9 files changed, 231 insertions, 156 deletions
diff --git a/contrib/global/gctags/C.c b/contrib/global/gctags/C.c index 87652b5..df8fd2f 100644 --- a/contrib/global/gctags/C.c +++ b/contrib/global/gctags/C.c @@ -46,7 +46,7 @@ static int func_entry __P((void)); static void hash_entry __P((void)); static void skip_string __P((int)); static int str_entry __P((int)); -#ifdef GTAGS +#ifdef GLOBAL static int cmp __P((const void *, const void *)); static int isstatement __P((char *)); static void define_line __P((void)); @@ -116,7 +116,7 @@ c_entries() */ if (--level < 0) level = 0; -#ifdef GTAGS +#ifdef GLOBAL /* * -e flag force a function to end when a '}' appear * at column 0. If -e flag not specified, all functions @@ -192,7 +192,7 @@ c_entries() /* * if we have a current token, parenthesis on * level zero indicates a function. -#ifdef GTAGS +#ifdef GLOBAL * in the case of rflag == 1, if we have a current token, * parenthesis on level > zero indicates a function reference. #endif @@ -201,10 +201,14 @@ c_entries() #endif */ case '(': +#ifdef GLOBAL + if (sflag) + break; +#endif #ifdef YACC if (inyacc == NO) #endif -#ifdef GTAGS +#ifdef GLOBAL if (!rflag && !level && token) #else if (!level && token) @@ -222,7 +226,7 @@ c_entries() */ getline(); curline = lineno; -#ifdef GTAGS +#ifdef GLOBAL /* to make sure. */ if (!isstatement(tok)) #endif @@ -232,13 +236,14 @@ c_entries() } break; } -#ifdef GTAGS +#ifdef GLOBAL else if (rflag && level && token) { if (sp != tok) *sp = EOS; - getline(); - if (!isstatement(tok) && isdefined(tok)) + if (!isstatement(tok) && lookup(tok)) { + getline(); pfnote(tok, lineno); + } break; } #endif @@ -305,13 +310,7 @@ c_entries() * reserved words. */ default: -#ifdef BUGFIX - /* - * to treat following function. - * func (arg) { - * .... - * } - */ + /* ignore whitespace */ if (c == ' ' || c == '\t') { int save = c; while (GETC(!=, EOF) && (c == ' ' || c == '\t')) @@ -321,12 +320,39 @@ c_entries() (void)ungetc(c, inf); c = save; } -#endif storec: if (!intoken(c)) { if (sp == tok) break; *sp = EOS; -#ifdef GTAGS +#ifdef GLOBAL + /* ignore assembler in C source */ + if (!memcmp(tok, "_asm",4)) { + while (GETC(!=, EOF) && (c == ' ' || c == '\t')) + ; + if (c == EOF) + return; + if (c == '{') { + while (GETC(!=, EOF) && c != '}') { + if (c == '\n') + SETLINE; + } + } else { + while (GETC(!=, EOF) && c != '\n') + ; + if (c == '\n') + SETLINE; + } + if (c == EOF) + return; + break; + } + if (sflag) { + if (!isstatement(tok)) { + getline(); + pfnote(tok, lineno); + } + break; + } if (!memcmp(tok, "extern",7)) { while (GETC(!=, EOF) && c != ';') { if (c == '\n') @@ -367,6 +393,18 @@ c_entries() *sp++ = c; token = YES; } +#ifdef GLOBAL + /* skip hex number */ + else if (sp == tok && c == '0') { + if (GETC(==, 'x') || c == 'X') { + while (GETC(!=, EOF) && isxdigit(c)) + ; + if (c == EOF) + return; + } + (void)ungetc(c, inf); + } +#endif continue; /* end of default */ } /* end of switch */ @@ -454,15 +492,10 @@ hash_entry() char *sp; /* buffer pointer */ char tok[MAXTOKEN]; /* storage buffer */ -#ifdef BUGFIX - /* - * to treat following macro. - * # macro(arg) .... - */ + /* ignore leading whitespace */ while (GETC(!=, EOF) && (c == ' ' || c == '\t')) ; (void)ungetc(c, inf); -#endif curline = lineno; for (sp = tok;;) { /* get next token */ if (GETC(==, EOF)) @@ -472,8 +505,16 @@ hash_entry() *sp++ = c; } *sp = EOS; +#ifdef GLOBAL + if (sflag && memcmp(tok, "include", 7)) { + (void)ungetc(c, inf); + define_line(); + return; + } +#endif if (memcmp(tok, "define", 6)) /* only interested in #define's */ goto skip; + for (;;) { /* this doesn't handle "#define \n" */ if (GETC(==, EOF)) return; @@ -492,12 +533,12 @@ hash_entry() break; } *sp = EOS; -#ifdef GTAGS +#ifdef GLOBAL if (rflag) { /* * #define XXX\n */ - if (c == '\n' || (c == '\r' && GETC(==, '\n'))) { + if (c == '\n') { SETLINE; return; } @@ -531,19 +572,13 @@ hash_entry() } skip: if (c == '\n') { /* get rid of rest of define */ SETLINE -#ifdef MODIFY - if (*(sp - 1) == '\r') { - if (*(sp - 2) != '\\') - return; - } else -#endif if (*(sp - 1) != '\\') return; } (void)skip_key('\n'); } -#ifdef GTAGS +#ifdef GLOBAL /* sorted by alphabet */ static struct words { char *name; @@ -619,12 +654,20 @@ define_line() goto endtok; case '\\': - if (GETC(==, '\n') || (c == '\r' && GETC(==, '\n'))) { + if (GETC(==, '\n')) { SETLINE; } continue; case '\n': + if (sflag && token) { + if (sp != tok) + *sp = EOS; + if (!isstatement(tok)) { + getline(); + pfnote(tok, lineno); + } + } SETLINE; return; endtok: if (sp > tok) { @@ -651,11 +694,13 @@ define_line() goto storec; case '(': + if (sflag) + break; if (token) { if (sp != tok) *sp = EOS; getline(); - if (!isstatement(tok) && isdefined(tok)) + if (!isstatement(tok) && lookup(tok)) pfnote(tok, lineno); break; } @@ -670,6 +715,13 @@ storec: if (!intoken(c)) { break; *sp = EOS; sp = tok; + if (sflag) { + if (!isstatement(tok)) { + getline(); + pfnote(tok, lineno); + } + break; + } } else if (sp != tok || begtoken(c)) { *sp++ = c; @@ -774,10 +826,6 @@ skip_string(key) case '\\': /* a backslash escapes anything */ skip = !skip; /* we toggle in case it's "\\" */ break; -#ifdef MODIFY - case '\r': - break; -#endif case '\n': SETLINE; /*FALLTHROUGH*/ @@ -823,10 +871,6 @@ skip_key(key) (void)ungetc(c, inf); c = '/'; goto norm; -#ifdef MODIFY - case '\r': - break; -#endif case '\n': SETLINE; /*FALLTHROUGH*/ diff --git a/contrib/global/gctags/Makefile b/contrib/global/gctags/Makefile index 2e3401f..e60217f 100644 --- a/contrib/global/gctags/Makefile +++ b/contrib/global/gctags/Makefile @@ -1,7 +1,7 @@ -# @(#)Makefile 8.1 (Berkeley) 6/6/93 - PROG= gctags -CFLAGS+=-I${.CURDIR} -DGTAGS -DBUGFIX -DMODIFY -DYACC +CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../lib -DGLOBAL -DYACC +LDADD= $(LIBUTIL) +DPADD= $(LIBUTIL) SRCS= C.c ctags.c fortran.c lisp.c print.c tree.c yacc.c assembler.c .include <bsd.prog.mk> diff --git a/contrib/global/gctags/Makefile.generic b/contrib/global/gctags/Makefile.generic index 59c2172..6505c67 100644 --- a/contrib/global/gctags/Makefile.generic +++ b/contrib/global/gctags/Makefile.generic @@ -1,14 +1,11 @@ -# @(#)Makefile 29-Dec-96 - PROG = gctags -DEFS = -DGTAGS -DBUGFIX -DMODIFY -DYACC +DEFS = -DGLOBAL -DYACC CC = gcc -#WARN = -Wall -Wparentheses -Wstrict-prototypes -Wmissing-prototypes -CFLAGS = -O $(DEFS) -I../include -LIBS = -ldb -OBJS = C.o ctags.o fortran.o lisp.o print.o tree.o yacc.o assembler.o err.o +CFLAGS = -O $(DEFS) -I../lib -I/usr/include/db +LIBS = -L../lib -lutil -ldb +OBJS = C.o assembler.o ctags.o fortran.o lisp.o print.o tree.o yacc.o BINDIR = /usr/bin -MANDIR = /usr/share/man +MANDIR = /usr/man all: $(PROG) @@ -20,4 +17,4 @@ install: cp $(PROG).1 $(MANDIR)/man1 chmod 644 $(MANDIR)/man1/$(PROG).1 clean: - rm -f $(PROG) $(OBJS) GTAGS GRTAGS + rm -f $(PROG) $(OBJS) diff --git a/contrib/global/gctags/assembler.c b/contrib/global/gctags/assembler.c index 2ae468d..2cd2d07 100644 --- a/contrib/global/gctags/assembler.c +++ b/contrib/global/gctags/assembler.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)assembler.c 8.3 (Berkeley) 6/6/97"; #include <string.h> #include "ctags.h" -#ifdef GTAGS +#ifdef GLOBAL void asm_entries() { diff --git a/contrib/global/gctags/ctags.c b/contrib/global/gctags/ctags.c index 5924cca..0253ab5 100644 --- a/contrib/global/gctags/ctags.c +++ b/contrib/global/gctags/ctags.c @@ -42,7 +42,6 @@ static const char rcsid[] = "$Id: ctags.c,v 1.3 1997/07/10 06:43:40 charnier Exp $"; #endif /* LIBC_SCCS and not lint */ -#include <err.h> #include <limits.h> #include <stdio.h> #include <string.h> @@ -50,6 +49,10 @@ static const char rcsid[] = #include <unistd.h> #include "ctags.h" +#ifdef GLOBAL +#include "lookup.h" +#include "die.h" +#endif /* * ctags: create a tags file @@ -66,17 +69,21 @@ FILE *outf; /* ioptr for tags file */ long lineftell; /* ftell after getc( inf ) == '\n' */ int lineno; /* line number of current line */ +#ifdef GLOBAL +int cflag; /* -c: compact index */ +#endif int dflag; /* -d: non-macro defines */ -#ifdef GTAGS +#ifdef GLOBAL int eflag; /* -e: '{' at 0 column force function end */ #endif int tflag; /* -t: create tags for typedefs */ int vflag; /* -v: vgrind style index output */ int wflag; /* -w: suppress warnings */ int xflag; /* -x: cxref style output */ -#ifdef GTAGS +#ifdef GLOBAL int Dflag; /* -D: allow duplicate entrys */ int rflag; /* -r: function reference */ +int sflag; /* -s: collect symbols */ #endif #ifdef YACC int yaccfile; /* yacc file */ @@ -85,6 +92,7 @@ int yaccfile; /* yacc file */ char *curfile; /* current input file name */ char searchar = '/'; /* use /.../ searches by default */ char lbuf[LINE_MAX]; +char *progname = "gctags"; /* program name */ void init __P((void)); void find_entries __P((char *)); @@ -107,8 +115,8 @@ main(argc, argv) extern int optind; aflag = uflag = NO; -#ifdef GTAGS - while ((ch = getopt(argc, argv, "BDFadef:rtuwvxy")) != -1) +#ifdef GLOBAL + while ((ch = getopt(argc, argv, "BDFacdef:rstuwvx")) != -1) #else while ((ch = getopt(argc, argv, "BFadf:tuwvx")) != -1) #endif @@ -116,7 +124,7 @@ main(argc, argv) case 'B': searchar = '?'; break; -#ifdef GTAGS +#ifdef GLOBAL case 'D': Dflag++; break; @@ -124,13 +132,23 @@ main(argc, argv) case 'F': searchar = '/'; break; +#ifdef GLOBAL + case 's': + sflag++; + break; +#endif case 'a': aflag++; break; +#ifdef GLOBAL + case 'c': + cflag++; + break; +#endif case 'd': dflag++; break; -#ifdef GTAGS +#ifdef GLOBAL case 'e': eflag++; break; @@ -138,7 +156,7 @@ main(argc, argv) case 'f': outfile = optarg; break; -#ifdef GTAGS +#ifdef GLOBAL case 'r': rflag++; break; @@ -165,15 +183,22 @@ main(argc, argv) argc -= optind; if (!argc) usage(); -#ifdef GTAGS - if (rflag) - gtagopen(); +#ifdef GLOBAL + if (sflag && rflag) + die("-s and -r conflict."); + if (rflag) { + char *dbpath; + + if (!(dbpath = getenv("GTAGSDBPATH"))) + dbpath = "."; + lookupopen(dbpath); + } #endif init(); for (exit_val = step = 0; step < argc; ++step) if (!(inf = fopen(argv[step], "r"))) { - warnx("%s cannot open", argv[step]); + fprintf(stderr, "%s: %s cannot open\n", progname, argv[step]); exit_val = 1; } else { @@ -183,9 +208,13 @@ main(argc, argv) } if (head) - if (xflag) + if (xflag) { put_entries(head); - else { +#ifdef GLOBAL + if (cflag) + compact_print("", 0, "");/* flush last record */ +#endif + } else { if (uflag) { for (step = 0; step < argc; step++) { (void)sprintf(cmd, @@ -197,7 +226,7 @@ main(argc, argv) ++aflag; } if (!(outf = fopen(outfile, aflag ? "a" : "w"))) { - warnx("%s cannot open", outfile); + fprintf(stderr, "%s: %s cannot open\n", progname, outfile); exit(exit_val); } put_entries(head); @@ -208,9 +237,9 @@ main(argc, argv) system(cmd); } } -#ifdef GTAGS +#ifdef GLOBAL if (rflag) - gtagclose(); + lookupclose(); #endif exit(exit_val); } @@ -219,10 +248,10 @@ static void usage() { (void)fprintf(stderr, -#ifdef GTAGS - "usage: gctags [-BDFadrtuwvx] [-f tagsfile] file ...\n"); +#ifdef GLOBAL + "usage: gctags [-BDFacderstuvwx] [-f tagsfile] file ...\n"); #else - "usage: gctags [-BFadtuwvx] [-f tagsfile] file ...\n"); + "usage: ctags [-BFadtuwvx] [-f tagsfile] file ...\n"); #endif exit(1); } @@ -280,7 +309,7 @@ find_entries(file) if (cp[1] == 'l' && !cp[2]) { int c; -#ifdef GTAGS +#ifdef GLOBAL if (rflag) fprintf(stderr, "-r option is ignored in lisp file (Warning only)\n"); #endif @@ -327,14 +356,14 @@ find_entries(file) pfnote("yyparse", lineno); y_entries(); } -#ifdef GTAGS +#ifdef GLOBAL /* assembler */ else if ((cp[1] == 's' || cp[1] == 'S') && !cp[2]) { asm_entries(); return; } #endif /* fortran */ else if ((cp[1] != 'c' && cp[1] != 'h') && !cp[2]) { -#ifdef GTAGS +#ifdef GLOBAL if (rflag) fprintf(stderr, "-r option is ignored in fortran file (Warning only)\n"); #endif @@ -348,63 +377,3 @@ find_entries(file) #endif /* C */ c_entries(); } - -#ifdef GTAGS -#include <db.h> -DB *db; - -void -gtagopen() -{ - BTREEINFO info; - char *env; - char dbname[200]; - - strcpy(dbname, "."); - if ((env = getenv("GTAGDBPATH"))) { - strcpy(dbname, env); - } - strcat(dbname, "/GTAGS"); - - info.flags = 0; - info.cachesize = 500000; - info.maxkeypage = 0; - info.minkeypage = 0; - info.psize = 0; - info.compare = 0; - info.prefix = 0; - info.lorder = 0; - -#define O_RDONLY 0x0000 /* open for reading only */ - db = dbopen(dbname, O_RDONLY, 0, DB_BTREE, &info); - if (db == 0) - errx(1, "GTAGS file needed"); -} -int -isdefined(skey) -char *skey; -{ - DBT dat, key; - int status; - - key.data = skey; - key.size = strlen(skey)+1; - - status = (*db->get)(db, &key, &dat, 0); - switch (status) { - case RET_SUCCESS: - return(1); /* exist */ - case RET_ERROR: - errx(1, "db->get failed"); - case RET_SPECIAL: /* not exist */ - break; - } - return 0; -} -void -gtagclose() -{ - if (db->close(db)) - errx(1, "GTAGS cannot close.(dbclose)"); -} -#endif diff --git a/contrib/global/gctags/ctags.h b/contrib/global/gctags/ctags.h index b1bb287..7cd3733 100644 --- a/contrib/global/gctags/ctags.h +++ b/contrib/global/gctags/ctags.h @@ -47,7 +47,11 @@ #endif #define SETLINE {++lineno;lineftell = ftell(inf);} +#ifdef GLOBAL +#define GETC(op,exp) ((((c = getc(inf)) == '\r') ? (c = getc(inf)) : c) op (int)exp) +#else #define GETC(op,exp) ((c = getc(inf)) op (int)exp) +#endif #define iswhite(arg) (_wht[(unsigned)arg]) /* T if char is white */ #define begtoken(arg) (_btk[(unsigned)arg]) /* T if char can start token */ @@ -71,11 +75,13 @@ extern FILE *inf; /* ioptr for current input file */ extern FILE *outf; /* ioptr for current output file */ extern long lineftell; /* ftell after getc( inf ) == '\n' */ extern int lineno; /* line number of current line */ -#ifdef GTAGS +#ifdef GLOBAL +extern int cflag; /* -c: compact index */ extern int eflag; /* -e: '{' at 0 column force function end */ extern int Dflag; /* -D: allow duplicate entrys */ extern int rflag; /* -r: function reference */ -#endif /* GTAGS */ +extern int sflag; /* -s: collect symbols */ +#endif extern int dflag; /* -d: non-macro defines */ extern int tflag; /* -t: create tags for typedefs */ extern int vflag; /* -v: vgrind style index output */ @@ -85,6 +91,7 @@ extern bool _wht[], _etk[], _itk[], _btk[], _gd[]; extern char lbuf[LINE_MAX]; extern char *lbp; extern char searchar; /* ex search character */ +extern char *progname; /* program name */ #ifndef __P #ifdef __STDC__ @@ -105,9 +112,7 @@ void y_entries __P((void)); int PF_funcs __P((void)); void c_entries __P((void)); void skip_comment __P((void)); -#ifdef GTAGS +#ifdef GLOBAL void asm_entries __P((void)); -void gtagopen __P((void)); -int isdefined __P((char *)); -void gtagclose __P((void)); +int portable_getc __P((FILE *)); #endif diff --git a/contrib/global/gctags/gctags.1 b/contrib/global/gctags/gctags.1 index 2d55d52..ed95875 100644 --- a/contrib/global/gctags/gctags.1 +++ b/contrib/global/gctags/gctags.1 @@ -39,7 +39,7 @@ .Nd create a tags file (special command for GLOBAL) .Sh SYNOPSIS .Nm gctags -.Op Fl BDFadertuwvx +.Op Fl BDFacderstuvwx .Op Fl f Ar tagsfile .Ar name ... .Sh DESCRIPTION @@ -77,6 +77,8 @@ use forward searching patterns append to .Ar tags file. +.It Fl c +print with compact format. It is valid only with -x option. .It Fl d create tags for .Li #defines @@ -88,11 +90,13 @@ force a function to end when reach a '}' at the first column. (C source only) .It Fl f place the tag descriptions in a file called .Ar tagsfile . -The default behavior is to place them in a file called +The default behaviour is to place them in a file called .Ar tags . .It Fl r locate function references instead of function definitions. GTAGS file is needed at the current directory. (C source only) +.It Fl s +collect symbols except for functions. .It Fl t create tags for typedefs, structs, unions, and enums. .It Fl u @@ -184,7 +188,7 @@ tags file for GLOBAL .El .Sh DIAGNOSTICS .Nm Gctags -exits with a value of 1 if an error occurred, 0 otherwise. +exits with a non 0 value if an error occurred, 0 otherwise. Duplicate objects are not considered errors. .Sh SEE ALSO .Xr btreeop 1 , @@ -234,4 +238,4 @@ kernel source. .Sh HISTORY The .Nm -command appeared in FreeBSD 2.2. +command appeared in FreeBSD 2.2.2. diff --git a/contrib/global/gctags/print.c b/contrib/global/gctags/print.c index 692d36b..ff81a9b3 100644 --- a/contrib/global/gctags/print.c +++ b/contrib/global/gctags/print.c @@ -41,6 +41,7 @@ static char sccsid[] = "@(#)print.c 8.3 (Berkeley) 4/2/94"; #include <string.h> #include <unistd.h> +#include "die.h" #include "ctags.h" /* @@ -59,7 +60,7 @@ getline() saveftell = ftell(inf); (void)fseek(inf, lineftell, SEEK_SET); if (xflag) - for (cp = lbuf; GETC(!=, '\n'); *cp++ = c) + for (cp = lbuf; GETC(!=, EOF) && c != '\n'; *cp++ = c) continue; /* * do all processing here, so we don't step through the @@ -89,7 +90,58 @@ getline() *cp = EOS; (void)fseek(inf, saveftell, SEEK_SET); } +#ifdef GLOBAL +void +compact_print(entry, lno, file) +char *entry; +int lno; +char *file; +{ + static int first = 1; + static char p_entry[128]; + static char p_file[1024]; + static int p_lno; + static char *buf; + static int bufsize = 512; + static char *p; + if (first) { + if (!(buf = (char *)malloc(bufsize))) + die("short of memory."); + buf[0] = 0; + p = buf; + first = 0; + } + if (strcmp(p_entry, entry) || strcmp(p_file, file)) { + if (buf[0]) + printf("%s\n", buf); + if (!entry[0]) /* flush */ + return; + strcpy(p_entry, entry); + strcpy(p_file, file); + p_lno = lno; + buf[0] = 0; + sprintf(buf, "%s %s %d", entry, file, lno); + p = buf; + p += strlen(p); + } else { + if (p_lno > lno) + die("impossible!"); + if (p_lno < lno) { + if (buf + bufsize < p + 10) { + int offset = p - buf; + bufsize *= 2; + if (!(buf = (char *)realloc(buf, bufsize))) + die("short of memory."); + p = buf + offset; + } + sprintf(p, ",%d", lno); + p += strlen(p); + p_lno = lno; + } + } +} +#endif /* * put_entries -- * write out the tags @@ -104,8 +156,12 @@ put_entries(node) if (vflag) printf("%s %s %d\n", node->entry, node->file, (node->lno + 63) / 64); +#ifdef GLOBAL + else if (xflag && cflag) + compact_print(node->entry, node->lno, node->file); +#endif else if (xflag) -#ifdef MODIFY +#ifdef GLOBAL /* separate 'entry' and 'lno' */ if (strlen(node->entry) >= 16 && node->lno >= 1000) printf("%-16s %4d %-16s %s\n", diff --git a/contrib/global/gctags/tree.c b/contrib/global/gctags/tree.c index 4d6f858..94362cd 100644 --- a/contrib/global/gctags/tree.c +++ b/contrib/global/gctags/tree.c @@ -35,12 +35,12 @@ static char sccsid[] = "@(#)tree.c 8.3 (Berkeley) 4/2/94"; #endif /* LIBC_SCCS and not lint */ -#include <err.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "die.h" #include "ctags.h" static void add_node __P((NODE *, NODE *)); @@ -61,12 +61,12 @@ pfnote(name, ln) /*NOSTRICT*/ if (!(np = (NODE *)malloc(sizeof(NODE)))) { - warnx("too many entries to sort"); + fprintf(stderr, "too many entries to sort\n"); put_entries(head); free_tree(head); /*NOSTRICT*/ if (!(head = np = (NODE *)malloc(sizeof(NODE)))) - errx(1, "out of space"); + die("out of space"); } if (!xflag && !strcmp(name, "main")) { if (!(fp = strrchr(curfile, '/'))) @@ -80,12 +80,12 @@ pfnote(name, ln) name = nbuf; } if (!(np->entry = strdup(name))) - errx(1, "out of space"); + die("out of space"); np->file = curfile; np->lno = ln; np->left = np->right = 0; if (!(np->pat = strdup(lbuf))) - errx(1, "out of space"); + die("out of space"); if (!head) head = np; else @@ -100,7 +100,7 @@ add_node(node, cur_node) int dif; dif = strcmp(node->entry, cur_node->entry); -#ifdef GTAGS +#ifdef GLOBAL if (!Dflag && !dif) /* -D option allows duplicate entries. */ #else if (!dif) |