diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-18 06:59:19 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-18 06:59:19 +0000 |
commit | 7887cea99911ffdceaf8033c738b38b8ea9329cc (patch) | |
tree | ed58b03e5114161567409a2137870f052143bae0 | |
parent | 3ba3e2cc4b63fa16707f51e735e751e62dd9526e (diff) |
This commit was manufactured by cvs2svn to create tagvendor/global/3.4.2
'global-vendor-v3_4_2'.
Notes
Notes:
svn path=/vendor/global/dist/; revision=42788
svn path=/vendor/global/3.4.2/; revision=42790; tag=vendor/global/3.4.2
37 files changed, 0 insertions, 4609 deletions
diff --git a/contrib/global/Makefile.generic b/contrib/global/Makefile.generic deleted file mode 100644 index 2f947bc1fbdc..000000000000 --- a/contrib/global/Makefile.generic +++ /dev/null @@ -1,33 +0,0 @@ -SUBDIR= lib global gtags gctags btreeop htags systags -BINDIR= /usr/bin # EDIT THIS -MANDIR= /usr/man # EDIT THIS - -all: - @for d in $(SUBDIR); do \ - set -e; (cd $$d; echo '===>' $$d; make $(MFLAGS)) ;\ - done -install: - @for d in $(SUBDIR); do \ - set -e; (cd $$d; echo '===>' $$d; make $(MFLAGS) BINDIR=$(BINDIR) MANDIR=$(MANDIR) install) ;\ - done -gen: - @if [ ! -f Makefile.generic ]; then \ - echo "Error: generic makefile not found."; exit 1; \ - fi - mv Makefile Makefile.bsd && mv Makefile.generic Makefile - for d in $(SUBDIR); do \ - (cd $$d && mv Makefile Makefile.bsd && mv Makefile.generic Makefile) ;\ - done -bsd: - @if [ ! -f Makefile.bsd ]; then \ - echo "Error: BSD style makefile not found."; exit 1; \ - fi - mv Makefile Makefile.generic; mv Makefile.bsd Makefile - for d in $(SUBDIR); do \ - (cd $$d && mv Makefile Makefile.generic && mv Makefile.bsd Makefile) ;\ - done -clean: - @for d in $(SUBDIR); do \ - (cd $$d; echo '===>' $$d; make $(MFLAGS) clean) ;\ - done - diff --git a/contrib/global/PROBLEMS b/contrib/global/PROBLEMS deleted file mode 100644 index e30e7e0d3b1e..000000000000 --- a/contrib/global/PROBLEMS +++ /dev/null @@ -1,38 +0,0 @@ -GLOBAL cannot recognize following macros and functions. - -1. Macro which doesn't end with ';'. - - GLOBAL cannot recognize func() after M(a), because M(a) seems to be - function definition. - - #define M(a) static char *string = a; - - M(a) - - func() { - ... - } - - It should be follows. - - #define M(a) static char *string = a - - M(a); - - func() { - ... - } - -2. Macro which is a renamed function. - - #define func _func - - _func() { - ... - } - main() { - func(); - } - - In fact, main() calls _func() instead of func() but GLOBAL cannot - recognize it. diff --git a/contrib/global/btreeop/Makefile.generic b/contrib/global/btreeop/Makefile.generic deleted file mode 100644 index b30213f0f856..000000000000 --- a/contrib/global/btreeop/Makefile.generic +++ /dev/null @@ -1,20 +0,0 @@ -PROG = btreeop -CC = gcc -LIBS = -L../lib -lutil -ldb -CFLAGS = -O -I../lib -I/usr/include/db -DEPLIBS= ../lib/libutil.a -OBJS = btreeop.o -BINDIR = /usr/bin -MANDIR = /usr/man - -all: $(PROG) - -$(PROG): $(OBJS) $(DEPLIBS) - $(CC) -o $(PROG) $(OBJS) $(LIBS) -install: - cp $(PROG) $(BINDIR) - chmod 755 $(BINDIR)/$(PROG) - cp $(PROG).1 $(MANDIR)/man1 - chmod 644 $(MANDIR)/man1/$(PROG).1 -clean: - rm -f $(PROG) $(OBJS) diff --git a/contrib/global/btreeop/err.c b/contrib/global/btreeop/err.c deleted file mode 100644 index bd84d4613d9e..000000000000 --- a/contrib/global/btreeop/err.c +++ /dev/null @@ -1,217 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <err.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#ifdef __STDC__ -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -/* extern char *__progname; Program name, from crt0. */ -char *progname = "btreeop"; - -static FILE *err_file; /* file to use for error output */ -static void (*err_exit)(int); - -void -err_set_file(void *fp) -{ - if (fp) - err_file = fp; - else - err_file = stderr; -} - -void -err_set_exit(void (*ef)(int)) -{ - err_exit = ef; -} - -void -#ifdef __STDC__ -err(int eval, const char *fmt, ...) -#else -err(eval, fmt, va_alist) - int eval; - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - verr(eval, fmt, ap); - va_end(ap); -} - -void -verr(eval, fmt, ap) - int eval; - const char *fmt; - va_list ap; -{ - int sverrno; - - sverrno = errno; - if (! err_file) - err_set_file((FILE *)0); - (void)fprintf(err_file, "%s: ", progname); - if (fmt != NULL) { - (void)vfprintf(err_file, fmt, ap); - (void)fprintf(err_file, ": "); - } - (void)fprintf(err_file, "%s\n", strerror(sverrno)); - if(err_exit) - err_exit(eval); - exit(eval); -} - -void -#if __STDC__ -errx(int eval, const char *fmt, ...) -#else -errx(eval, fmt, va_alist) - int eval; - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - verrx(eval, fmt, ap); - va_end(ap); -} - -void -verrx(eval, fmt, ap) - int eval; - const char *fmt; - va_list ap; -{ - if (! err_file) - err_set_file((FILE *)0); - (void)fprintf(err_file, "%s: ", progname); - if (fmt != NULL) - (void)vfprintf(err_file, fmt, ap); - (void)fprintf(err_file, "\n"); - if (err_exit) - err_exit(eval); - exit(eval); -} - -void -#if __STDC__ -warn(const char *fmt, ...) -#else -warn(fmt, va_alist) - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - vwarn(fmt, ap); - va_end(ap); -} - -void -vwarn(fmt, ap) - const char *fmt; - va_list ap; -{ - int sverrno; - - sverrno = errno; - if (! err_file) - err_set_file((FILE *)0); - (void)fprintf(err_file, "%s: ", progname); - if (fmt != NULL) { - (void)vfprintf(err_file, fmt, ap); - (void)fprintf(err_file, ": "); - } - (void)fprintf(err_file, "%s\n", strerror(sverrno)); -} - -void -#ifdef __STDC__ -warnx(const char *fmt, ...) -#else -warnx(fmt, va_alist) - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#ifdef __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - vwarnx(fmt, ap); - va_end(ap); -} - -void -vwarnx(fmt, ap) - const char *fmt; - va_list ap; -{ - if (! err_file) - err_set_file((FILE *)0); - (void)fprintf(err_file, "%s: ", progname); - if (fmt != NULL) - (void)vfprintf(err_file, fmt, ap); - (void)fprintf(err_file, "\n"); -} diff --git a/contrib/global/gctags/Makefile.generic b/contrib/global/gctags/Makefile.generic deleted file mode 100644 index 0c463a3aff92..000000000000 --- a/contrib/global/gctags/Makefile.generic +++ /dev/null @@ -1,19 +0,0 @@ -PROG = gctags -CC = gcc -CFLAGS = -O -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/man - -all: $(PROG) - -$(PROG): $(OBJS) - $(CC) -o $(PROG) $(OBJS) $(LIBS) -install: - cp $(PROG) $(BINDIR) - chmod 755 $(BINDIR)/$(PROG) - cp $(PROG).1 $(MANDIR)/man1 - chmod 644 $(MANDIR)/man1/$(PROG).1 -clean: - rm -f $(PROG) $(OBJS) diff --git a/contrib/global/gctags/ctags.c b/contrib/global/gctags/ctags.c deleted file mode 100644 index d79a348ef4d4..000000000000 --- a/contrib/global/gctags/ctags.c +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Copyright (c) 1987, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1987, 1993, 1994\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = - "$Id: ctags.c,v 1.1.1.2 1997/12/15 23:08:35 cwt Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <limits.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> - -#include "ctags.h" -#ifdef GLOBAL -#include "lookup.h" -#include "die.h" -#endif - -/* - * ctags: create a tags file - */ - -NODE *head; /* head of the sorted binary tree */ - - /* boolean "func" (see init()) */ -bool _wht[256], _etk[256], _itk[256], _btk[256], _gd[256]; - -FILE *inf; /* ioptr for current input file */ -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 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 GLOBAL -int Dflag; /* -D: allow duplicate entrys */ -int rflag; /* -r: function reference */ -int sflag; /* -s: collect symbols */ -#endif -#ifdef YACC -int yaccfile; /* yacc file */ -#endif - -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 *)); -void main __P((int, char **)); -static void usage __P((void)); - -void -main(argc, argv) - int argc; - char **argv; -{ - static char *outfile = "tags"; /* output file */ - int aflag; /* -a: append to tags */ - int uflag; /* -u: update tags */ - int exit_val; /* exit value */ - int step; /* step through args */ - int ch; /* getopts char */ - char cmd[100]; /* too ugly to explain */ - extern char *optarg; - extern int optind; - - aflag = uflag = NO; -#ifdef GLOBAL - while ((ch = getopt(argc, argv, "BDFacdef:rstuwvx")) != -1) -#else - while ((ch = getopt(argc, argv, "BFadf:tuwvx")) != -1) -#endif - switch(ch) { - case 'B': - searchar = '?'; - break; -#ifdef GLOBAL - case 'D': - Dflag++; - break; -#endif - 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 GLOBAL - case 'e': - eflag++; - break; -#endif - case 'f': - outfile = optarg; - break; -#ifdef GLOBAL - case 'r': - rflag++; - break; -#endif - case 't': - tflag++; - break; - case 'u': - uflag++; - break; - case 'w': - wflag++; - break; - case 'v': - vflag++; - case 'x': - xflag++; - break; - case '?': - default: - usage(); - } - argv += optind; - argc -= optind; - if (!argc) - usage(); -#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"))) { - fprintf(stderr, "%s: %s cannot open\n", progname, argv[step]); - exit_val = 1; - } - else { - curfile = argv[step]; - find_entries(argv[step]); - (void)fclose(inf); - } - - if (head) - if (xflag) { - put_entries(head); -#ifdef GLOBAL - if (cflag) - compact_print("", 0, "");/* flush last record */ -#endif - } else { - if (uflag) { - for (step = 0; step < argc; step++) { - (void)sprintf(cmd, - "mv %s OTAGS; fgrep -v '\t%s\t' OTAGS >%s; rm OTAGS", - outfile, argv[step], - outfile); - system(cmd); - } - ++aflag; - } - if (!(outf = fopen(outfile, aflag ? "a" : "w"))) { - fprintf(stderr, "%s: %s cannot open\n", progname, outfile); - exit(exit_val); - } - put_entries(head); - (void)fclose(outf); - if (uflag) { - (void)sprintf(cmd, "sort -o %s %s", - outfile, outfile); - system(cmd); - } - } -#ifdef GLOBAL - if (rflag) - lookupclose(); -#endif - exit(exit_val); -} - -static void -usage() -{ - (void)fprintf(stderr, -#ifdef GLOBAL - "usage: gctags [-BDFacderstuvwx] [-f tagsfile] file ...\n"); -#else - "usage: ctags [-BFadtuwvx] [-f tagsfile] file ...\n"); -#endif - exit(1); -} - -/* - * init -- - * this routine sets up the boolean psuedo-functions which work by - * setting boolean flags dependent upon the corresponding character. - * Every char which is NOT in that string is false with respect to - * the pseudo-function. Therefore, all of the array "_wht" is NO - * by default and then the elements subscripted by the chars in - * CWHITE are set to YES. Thus, "_wht" of a char is YES if it is in - * the string CWHITE, else NO. - */ -void -init() -{ - int i; - unsigned char *sp; - - for (i = 0; i < 256; i++) { - _wht[i] = _etk[i] = _itk[i] = _btk[i] = NO; - _gd[i] = YES; - } -#define CWHITE " \f\t\n" - for (sp = (unsigned char *)CWHITE; *sp; sp++) /* white space chars */ - _wht[*sp] = YES; -#define CTOKEN " \t\n\"'#()[]{}=-+%*/&|^~!<>;,.:?" - for (sp = (unsigned char *)CTOKEN; *sp; sp++) /* token ending chars */ - _etk[*sp] = YES; -#define CINTOK "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz0123456789" - for (sp = (unsigned char *)CINTOK; *sp; sp++) /* valid in-token chars */ - _itk[*sp] = YES; -#define CBEGIN "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" - for (sp = (unsigned char *)CBEGIN; *sp; sp++) /* token starting chars */ - _btk[*sp] = YES; -#define CNOTGD ",;" - for (sp = (unsigned char *)CNOTGD; *sp; sp++) /* invalid after-function chars */ - _gd[*sp] = NO; -} - -/* - * find_entries -- - * this routine opens the specified file and calls the function - * which searches the file. - */ -void -find_entries(file) - char *file; -{ - char *cp; - - lineno = 0; /* should be 1 ?? KB */ - if ((cp = strrchr(file, '.')) != NULL) { - if (cp[1] == 'l' && !cp[2]) { - int c; - -#ifdef GLOBAL - if (rflag) - fprintf(stderr, "-r option is ignored in lisp file (Warning only)\n"); -#endif - for (;;) { - if (GETC(==, EOF)) - return; - if (!iswhite(c)) { - rewind(inf); - break; - } - } -#define LISPCHR ";([" -/* lisp */ if (strchr(LISPCHR, c)) { - l_entries(); - return; - } -/* lex */ else { - /* - * we search all 3 parts of a lex file - * for C references. This may be wrong. - */ - toss_yysec(); - (void)strcpy(lbuf, "%%$"); - pfnote("yylex", lineno); - rewind(inf); - } - } -/* yacc */ else if (cp[1] == 'y' && !cp[2]) { -#ifdef YACC - /* - * we search all part of a yacc file for C references. - * but ignore yacc rule tags. - */ - yaccfile = YES; - c_entries(); - return; -#endif - /* - * we search only the 3rd part of a yacc file - * for C references. This may be wrong. - */ - toss_yysec(); - (void)strcpy(lbuf, "%%$"); - pfnote("yyparse", lineno); - y_entries(); - } -#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 GLOBAL - if (rflag) - fprintf(stderr, "-r option is ignored in fortran file (Warning only)\n"); -#endif - if (PF_funcs()) - return; - rewind(inf); - } - } -#ifdef YACC - yaccfile = NO; -#endif -/* C */ c_entries(); -} diff --git a/contrib/global/gctags/ctags.h b/contrib/global/gctags/ctags.h deleted file mode 100644 index e843032e4239..000000000000 --- a/contrib/global/gctags/ctags.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 1987, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ctags.h 8.3 (Berkeley) 4/2/94 - */ - -/* Definition for gctags */ -#define GLOBAL 1 -#define YACC 1 - -#define bool char - -#define YES 1 -#define NO 0 -#define EOS '\0' - -#define ENDLINE 50 /* max length of pattern */ -#define MAXTOKEN 250 /* max size of single token */ - -#ifndef LINE_MAX -#define LINE_MAX 2048 -#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 */ -#define intoken(arg) (_itk[(unsigned)arg]) /* T if char can be in token */ -#define endtoken(arg) (_etk[(unsigned)arg]) /* T if char ends tokens */ -#define isgood(arg) (_gd[(unsigned)arg]) /* T if char can be after ')' */ - -typedef struct nd_st { /* sorting structure */ - struct nd_st *left, - *right; /* left and right sons */ - char *entry, /* function or type name */ - *file, /* file name */ - *pat; /* search pattern */ - int lno; /* for -x option */ - bool been_warned; /* set if noticed dup */ -} NODE; - -extern char *curfile; /* current input file name */ -extern NODE *head; /* head of the sorted binary tree */ -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 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 */ -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 */ -extern int wflag; /* -w: suppress warnings */ -extern int xflag; /* -x: cxref style output */ -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__ -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -int cicmp __P((char *)); -void getline __P((void)); -void pfnote __P((char *, int)); -int skip_key __P((int)); -void put_entries __P((NODE *)); -void toss_yysec __P((void)); -void l_entries __P((void)); -void y_entries __P((void)); -int PF_funcs __P((void)); -void c_entries __P((void)); -void skip_comment __P((void)); -#ifdef GLOBAL -void asm_entries __P((void)); -void compact_print __P((char *, int, char *)); -int portable_getc __P((FILE *)); -#endif diff --git a/contrib/global/gctags/err.c b/contrib/global/gctags/err.c deleted file mode 100644 index 9d20812fed86..000000000000 --- a/contrib/global/gctags/err.c +++ /dev/null @@ -1,217 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include <err.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#ifdef __STDC__ -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -/* extern char *__progname; Program name, from crt0. */ -char *progname = "gctags"; - -static FILE *err_file; /* file to use for error output */ -static void (*err_exit)(int); - -void -err_set_file(void *fp) -{ - if (fp) - err_file = fp; - else - err_file = stderr; -} - -void -err_set_exit(void (*ef)(int)) -{ - err_exit = ef; -} - -void -#ifdef __STDC__ -err(int eval, const char *fmt, ...) -#else -err(eval, fmt, va_alist) - int eval; - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - verr(eval, fmt, ap); - va_end(ap); -} - -void -verr(eval, fmt, ap) - int eval; - const char *fmt; - va_list ap; -{ - int sverrno; - - sverrno = errno; - if (! err_file) - err_set_file((FILE *)0); - (void)fprintf(err_file, "%s: ", progname); - if (fmt != NULL) { - (void)vfprintf(err_file, fmt, ap); - (void)fprintf(err_file, ": "); - } - (void)fprintf(err_file, "%s\n", strerror(sverrno)); - if(err_exit) - err_exit(eval); - exit(eval); -} - -void -#if __STDC__ -errx(int eval, const char *fmt, ...) -#else -errx(eval, fmt, va_alist) - int eval; - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - verrx(eval, fmt, ap); - va_end(ap); -} - -void -verrx(eval, fmt, ap) - int eval; - const char *fmt; - va_list ap; -{ - if (! err_file) - err_set_file((FILE *)0); - (void)fprintf(err_file, "%s: ", progname); - if (fmt != NULL) - (void)vfprintf(err_file, fmt, ap); - (void)fprintf(err_file, "\n"); - if (err_exit) - err_exit(eval); - exit(eval); -} - -void -#if __STDC__ -warn(const char *fmt, ...) -#else -warn(fmt, va_alist) - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - vwarn(fmt, ap); - va_end(ap); -} - -void -vwarn(fmt, ap) - const char *fmt; - va_list ap; -{ - int sverrno; - - sverrno = errno; - if (! err_file) - err_set_file((FILE *)0); - (void)fprintf(err_file, "%s: ", progname); - if (fmt != NULL) { - (void)vfprintf(err_file, fmt, ap); - (void)fprintf(err_file, ": "); - } - (void)fprintf(err_file, "%s\n", strerror(sverrno)); -} - -void -#ifdef __STDC__ -warnx(const char *fmt, ...) -#else -warnx(fmt, va_alist) - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#ifdef __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - vwarnx(fmt, ap); - va_end(ap); -} - -void -vwarnx(fmt, ap) - const char *fmt; - va_list ap; -{ - if (! err_file) - err_set_file((FILE *)0); - (void)fprintf(err_file, "%s: ", progname); - if (fmt != NULL) - (void)vfprintf(err_file, fmt, ap); - (void)fprintf(err_file, "\n"); -} diff --git a/contrib/global/gctags/fortran.c b/contrib/global/gctags/fortran.c deleted file mode 100644 index 2a33aff1f2df..000000000000 --- a/contrib/global/gctags/fortran.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 1987, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)fortran.c 8.3 (Berkeley) 4/2/94"; -#endif /* LIBC_SCCS and not lint */ - -#include <ctype.h> -#include <limits.h> -#include <stdio.h> -#include <string.h> - -#include "ctags.h" - -static void takeprec __P((void)); - -char *lbp; /* line buffer pointer */ - -int -PF_funcs() -{ - bool pfcnt; /* pascal/fortran functions found */ - char *cp; - char tok[MAXTOKEN]; - - for (pfcnt = NO;;) { - lineftell = ftell(inf); - if (!fgets(lbuf, sizeof(lbuf), inf)) - return (pfcnt); - ++lineno; - lbp = lbuf; - if (*lbp == '%') /* Ratfor escape to fortran */ - ++lbp; - for (; isspace(*lbp); ++lbp) - continue; - if (!*lbp) - continue; - switch (*lbp | ' ') { /* convert to lower-case */ - case 'c': - if (cicmp("complex") || cicmp("character")) - takeprec(); - break; - case 'd': - if (cicmp("double")) { - for (; isspace(*lbp); ++lbp) - continue; - if (!*lbp) - continue; - if (cicmp("precision")) - break; - continue; - } - break; - case 'i': - if (cicmp("integer")) - takeprec(); - break; - case 'l': - if (cicmp("logical")) - takeprec(); - break; - case 'r': - if (cicmp("real")) - takeprec(); - break; - } - for (; isspace(*lbp); ++lbp) - continue; - if (!*lbp) - continue; - switch (*lbp | ' ') { - case 'f': - if (cicmp("function")) - break; - continue; - case 'p': - if (cicmp("program") || cicmp("procedure")) - break; - continue; - case 's': - if (cicmp("subroutine")) - break; - default: - continue; - } - for (; isspace(*lbp); ++lbp) - continue; - if (!*lbp) - continue; - for (cp = lbp + 1; *cp && intoken(*cp); ++cp) - continue; - if (cp == lbp + 1) - continue; - *cp = EOS; - (void)strcpy(tok, lbp); - getline(); /* process line for ex(1) */ - pfnote(tok, lineno); - pfcnt = YES; - } - /*NOTREACHED*/ -} - -/* - * cicmp -- - * do case-independent strcmp - */ -int -cicmp(cp) - char *cp; -{ - int len; - char *bp; - - for (len = 0, bp = lbp; *cp && (*cp &~ ' ') == (*bp++ &~ ' '); - ++cp, ++len) - continue; - if (!*cp) { - lbp += len; - return (YES); - } - return (NO); -} - -static void -takeprec() -{ - for (; isspace(*lbp); ++lbp) - continue; - if (*lbp == '*') { - for (++lbp; isspace(*lbp); ++lbp) - continue; - if (!isdigit(*lbp)) - --lbp; /* force failure */ - else - while (isdigit(*++lbp)) - continue; - } -} diff --git a/contrib/global/gctags/lisp.c b/contrib/global/gctags/lisp.c deleted file mode 100644 index ebf51841eb3b..000000000000 --- a/contrib/global/gctags/lisp.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1987, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)lisp.c 8.3 (Berkeley) 4/2/94"; -#endif /* LIBC_SCCS and not lint */ - -#include <ctype.h> -#include <limits.h> -#include <stdio.h> -#include <string.h> - -#include "ctags.h" - -/* - * lisp tag functions - * just look for (def or (DEF - */ -void -l_entries() -{ - int special; - char *cp; - char savedc; - char tok[MAXTOKEN]; - - for (;;) { - lineftell = ftell(inf); - if (!fgets(lbuf, sizeof(lbuf), inf)) - return; - ++lineno; - lbp = lbuf; - if (!cicmp("(def")) - continue; - special = NO; - switch(*lbp | ' ') { - case 'm': - if (cicmp("method")) - special = YES; - break; - case 'w': - if (cicmp("wrapper") || cicmp("whopper")) - special = YES; - } - for (; !isspace(*lbp); ++lbp) - continue; - for (; isspace(*lbp); ++lbp) - continue; - for (cp = lbp; *cp && *cp != '\n'; ++cp) - continue; - *cp = EOS; - if (special) { - if (!(cp = strchr(lbp, ')'))) - continue; - for (; cp >= lbp && *cp != ':'; --cp) - continue; - if (cp < lbp) - continue; - lbp = cp; - for (; *cp && *cp != ')' && *cp != ' '; ++cp) - continue; - } - else - for (cp = lbp + 1; - *cp && *cp != '(' && *cp != ' '; ++cp) - continue; - savedc = *cp; - *cp = EOS; - (void)strcpy(tok, lbp); - *cp = savedc; - getline(); - pfnote(tok, lineno); - } - /*NOTREACHED*/ -} diff --git a/contrib/global/gctags/print.c b/contrib/global/gctags/print.c deleted file mode 100644 index ff81a9b33cc1..000000000000 --- a/contrib/global/gctags/print.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 1987, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)print.c 8.3 (Berkeley) 4/2/94"; -#endif /* LIBC_SCCS and not lint */ - -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include "die.h" -#include "ctags.h" - -/* - * getline -- - * get the line the token of interest occurred on, - * prepare it for printing. - */ -void -getline() -{ - long saveftell; - int c; - int cnt; - char *cp; - - saveftell = ftell(inf); - (void)fseek(inf, lineftell, SEEK_SET); - if (xflag) - for (cp = lbuf; GETC(!=, EOF) && c != '\n'; *cp++ = c) - continue; - /* - * do all processing here, so we don't step through the - * line more than once; means you don't call this routine - * unless you're sure you've got a keeper. - */ - else for (cnt = 0, cp = lbuf; GETC(!=, EOF) && cnt < ENDLINE; ++cnt) { - if (c == '\\') { /* backslashes */ - if (cnt > ENDLINE - 2) - break; - *cp++ = '\\'; *cp++ = '\\'; - ++cnt; - } - else if (c == (int)searchar) { /* search character */ - if (cnt > ENDLINE - 2) - break; - *cp++ = '\\'; *cp++ = c; - ++cnt; - } - else if (c == '\n') { /* end of keep */ - *cp++ = '$'; /* can find whole line */ - break; - } - else - *cp++ = c; - } - *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 - */ -void -put_entries(node) - NODE *node; -{ - - if (node->left) - put_entries(node->left); - 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 GLOBAL - /* separate 'entry' and 'lno' */ - if (strlen(node->entry) >= 16 && node->lno >= 1000) - printf("%-16s %4d %-16s %s\n", - node->entry, node->lno, node->file, node->pat); - else /* for compatibility */ -#endif - printf("%-16s%4d %-16s %s\n", - node->entry, node->lno, node->file, node->pat); - else - fprintf(outf, "%s\t%s\t%c^%s%c\n", - node->entry, node->file, searchar, node->pat, searchar); - if (node->right) - put_entries(node->right); -} diff --git a/contrib/global/gctags/test/ctags.test b/contrib/global/gctags/test/ctags.test deleted file mode 100644 index 1f334ac2b8b1..000000000000 --- a/contrib/global/gctags/test/ctags.test +++ /dev/null @@ -1,67 +0,0 @@ -int bar = (1 + 5); - -FOO("here is a #define test: ) {"); -char sysent[20]; -int nsysent = sizeof (sysent) / sizeof (sysent[0]); -/* - * now is the time for a comment. - * four lines in length... - */struct struct_xtra{int list;};r4(x,y){};typedef struct{int bar;}struct_xxe; -#define FOO BAR -struct struct_three { - int list; -}; -#define SINGLE -int BAD(); -enum color {red, green, gold, brown}; -char qq[] = " quote(one,two) {int bar;} "; -typedef struct { - int bar; - struct struct_two { - int foo; - union union_3 { - struct struct_three entry; - char size[25]; - }; - struct last { - struct struct_three xentry; - char list[34]; - }; - }; -} struct_one; -#define TWOLINE ((MAXLIST + FUTURE + 15) \ - / (time_to_live ? 3 : 4)) -#if (defined(BAR)) -int bar; -#endif -#define MULTIPLE {\ - multiple(one,two); \ - lineno++; \ - callroute(one,two); \ -} -#if defined(BAR) -int bar; -#endif -union union_one { - struct struct_three s3; - char foo[25]; -}; -#define XYZ(A,B) (A + B / 2) * (3 - 26 + l_lineno) -routine1(one,two) /* comments here are fun... */ - struct { - int entry; - char bar[34]; - } *one; - char two[10]; -{ -typedef unsigned char u_char; - register struct buf *bp; - five(one,two); -} - routine2 (one,two) { puts("hello\n"); } - routine3 -(one, -two) { puts("world\n"); } -routine4(int one, char (*two)(void)) /* test ANSI arguments */ -{ -} diff --git a/contrib/global/gctags/tree.c b/contrib/global/gctags/tree.c deleted file mode 100644 index 94362cd7a75e..000000000000 --- a/contrib/global/gctags/tree.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1987, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)tree.c 8.3 (Berkeley) 4/2/94"; -#endif /* LIBC_SCCS and not lint */ - -#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 *)); -static void free_tree __P((NODE *)); - -/* - * pfnote -- - * enter a new node in the tree - */ -void -pfnote(name, ln) - char *name; - int ln; -{ - NODE *np; - char *fp; - char nbuf[MAXTOKEN]; - - /*NOSTRICT*/ - if (!(np = (NODE *)malloc(sizeof(NODE)))) { - fprintf(stderr, "too many entries to sort\n"); - put_entries(head); - free_tree(head); - /*NOSTRICT*/ - if (!(head = np = (NODE *)malloc(sizeof(NODE)))) - die("out of space"); - } - if (!xflag && !strcmp(name, "main")) { - if (!(fp = strrchr(curfile, '/'))) - fp = curfile; - else - ++fp; - (void)sprintf(nbuf, "M%s", fp); - fp = strrchr(nbuf, '.'); - if (fp && !fp[2]) - *fp = EOS; - name = nbuf; - } - if (!(np->entry = strdup(name))) - die("out of space"); - np->file = curfile; - np->lno = ln; - np->left = np->right = 0; - if (!(np->pat = strdup(lbuf))) - die("out of space"); - if (!head) - head = np; - else - add_node(np, head); -} - -static void -add_node(node, cur_node) - NODE *node, - *cur_node; -{ - int dif; - - dif = strcmp(node->entry, cur_node->entry); -#ifdef GLOBAL - if (!Dflag && !dif) /* -D option allows duplicate entries. */ -#else - if (!dif) -#endif - { - if (node->file == cur_node->file) { - if (!wflag) - fprintf(stderr, "Duplicate entry in file %s, line %d: %s\nSecond entry ignored\n", node->file, lineno, node->entry); - return; - } - if (!cur_node->been_warned) - if (!wflag) - fprintf(stderr, "Duplicate entry in files %s and %s: %s (Warning only)\n", node->file, cur_node->file, node->entry); - cur_node->been_warned = YES; - } - else if (dif < 0) - if (cur_node->left) - add_node(node, cur_node->left); - else - cur_node->left = node; - else if (cur_node->right) - add_node(node, cur_node->right); - else - cur_node->right = node; -} - -static void -free_tree(node) - NODE *node; -{ - while (node) { - if (node->right) - free_tree(node->right); - free(node); - node = node->left; - } -} diff --git a/contrib/global/gctags/yacc.c b/contrib/global/gctags/yacc.c deleted file mode 100644 index 9dcdd5afc24a..000000000000 --- a/contrib/global/gctags/yacc.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 1987, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)yacc.c 8.3 (Berkeley) 4/2/94"; -#endif /* LIBC_SCCS and not lint */ - -#include <ctype.h> -#include <limits.h> -#include <stdio.h> -#include <string.h> - -#include "ctags.h" - -/* - * y_entries: - * find the yacc tags and put them in. - */ -void -y_entries() -{ - int c; - char *sp; - bool in_rule; - char tok[MAXTOKEN]; - - in_rule = NO; - - while (GETC(!=, EOF)) - switch (c) { - case '\n': - SETLINE; - /* FALLTHROUGH */ - case ' ': - case '\f': - case '\r': - case '\t': - break; - case '{': - if (skip_key('}')) - in_rule = NO; - break; - case '\'': - case '"': - if (skip_key(c)) - in_rule = NO; - break; - case '%': - if (GETC(==, '%')) - return; - (void)ungetc(c, inf); - break; - case '/': - if (GETC(==, '*')) - skip_comment(); - else - (void)ungetc(c, inf); - break; - case '|': - case ';': - in_rule = NO; - break; - default: - if (in_rule || (!isalpha(c) && c != '.' && c != '_')) - break; - sp = tok; - *sp++ = c; - while (GETC(!=, EOF) && (intoken(c) || c == '.')) - *sp++ = c; - *sp = EOS; - getline(); /* may change before ':' */ - while (iswhite(c)) { - if (c == '\n') - SETLINE; - if (GETC(==, EOF)) - return; - } - if (c == ':') { - pfnote(tok, lineno); - in_rule = YES; - } - else - (void)ungetc(c, inf); - } -} - -/* - * toss_yysec -- - * throw away lines up to the next "\n%%\n" - */ -void -toss_yysec() -{ - int c; /* read character */ - int state; - - /* - * state == 0 : waiting - * state == 1 : received a newline - * state == 2 : received first % - * state == 3 : recieved second % - */ - lineftell = ftell(inf); - for (state = 0; GETC(!=, EOF);) - switch (c) { - case '\n': - ++lineno; - lineftell = ftell(inf); - if (state == 3) /* done! */ - return; - state = 1; /* start over */ - break; - case '%': - if (state) /* if 1 or 2 */ - ++state; /* goto 3 */ - break; - default: - state = 0; /* reset */ - break; - } -} diff --git a/contrib/global/global/Makefile.generic b/contrib/global/global/Makefile.generic deleted file mode 100644 index ca10a60896d5..000000000000 --- a/contrib/global/global/Makefile.generic +++ /dev/null @@ -1,20 +0,0 @@ -PROG = global -CC = gcc -LIBS = -L../lib -lutil -ldb -CFLAGS = -O -I../lib -I/usr/include/db -DEPLIBS= ../lib/libutil.a -OBJS = global.o -BINDIR = /usr/bin -MANDIR = /usr/man - -all: $(PROG) - -$(PROG): $(OBJS) $(DEPLIBS) - $(CC) -o $(PROG) $(OBJS) $(LIBS) -install: - cp $(PROG) $(BINDIR) - chmod 755 $(BINDIR)/$(PROG) - cp $(PROG).1 $(MANDIR)/man1 - chmod 644 $(MANDIR)/man1/$(PROG).1 -clean: - rm -f $(PROG) $(OBJS) diff --git a/contrib/global/global/global.pl b/contrib/global/global/global.pl deleted file mode 100644 index 571bddb2bce6..000000000000 --- a/contrib/global/global/global.pl +++ /dev/null @@ -1,302 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. All advertising materials mentioning features or use of this software -# must display the following acknowledgement: -# This product includes software developed by Shigio Yamaguchi. -# 4. Neither the name of the author nor the names of any co-contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# global.pl 7-Jul-97 -# -sub getcwd { - local($dir); - chop($dir = `/bin/pwd`); - $dir; -} -sub regexp { - $_[0] =~ /[][.*\^\$+?|(){}\\]/; # include regular expression ? -} -$com = $0; -$com =~ s/.*\///; -$usage = "usage:\t$com [-a][-r][-x] pattern\n\t$com -c [name]\n\t$com [-a] -f file\n"; -$ENV{'PATH'} = '/bin:/usr/bin'; -# -# options check -# -while ($ARGV[0] =~ /^-/) { - $opt = shift; - if ($opt =~ /a/) { $aflag = 1; } - if ($opt =~ /c/) { $cflag = 1; } - if ($opt =~ /f/) { $fflag = 1; } - if ($opt =~ /r/) { $rflag = 1; } - if ($opt =~ /x/) { $xflag = 1; } -} -# -f option is valid when it is only one except for -a and -x option -if ($fflag && ($cflag || $rflag)) { - $fflag = 0; -} -# -c option is valid when it is only one -if ($cflag && ($aflag || $fflag || $rflag || $xflag)) { - $cflag = 0; -} -if (@ARGV == 0) { - die($usage) if (! $cflag); -} -if ($cflag && ®exp($ARGV[0])) { - die "$com: regular expression not allowed with -c option.\n"; -} -$ARGV[0] =~ s/^[ \t]+//; # remove leading blanks -# -# get $dbpath and $root -# -local($dbpath, $root) = &getdbpath(); -# -# recognize format version of GTAGS. 'format version record' is saved as a -# META record in GTAGS and GRTAGS. if 'format version record' is not found, -# it's assumed version 1. - $support_version = 1; # accept this format version -# -open(GTAGS, "btreeop -K ' __.VERSION' $dbpath/GTAGS |") || die "$com: GTAGS not found.\n"; -$rec = <GTAGS>; -close(GTAGS); -if ($rec =~ /^ __\.VERSION[ \t]+([0-9]+)$/) { - $format_version = $1; -} else { - $format_version = 1; -} -if ($format_version > $support_version) { - die "$com: GTAGS seems new format. Please install the latest GLOBAL.\n"; -} -# -# complete function name -# -if ($cflag) { - open(PIPEIN, "btreeop -L $dbpath/GTAGS |") || die "$com: btreeop cannot exec.\n"; - while (<PIPEIN>) { - print if (@ARGV == 0 || $_ =~ /^$ARGV[0]/o); - } - close(PIPEIN); - exit(0); -} -# -# make path filter. -# -if ($aflag) { - @com = ("-e 's!\\.!$root!'"); # absolute -} else { - @com = &relative_filter($root); # relative -} -# -# print function definitions. -# -if ($fflag) { - if (! -f $ARGV[0]) { die "$com: file '$ARGV[0]' not exist.\n"; } - $path = &realpath($ARGV[0]); - $path =~ s/^$root/./; - chdir($root) || die "$com: cannot move to directory '$root'.\n"; - system("gctags -Dex '$path' | sort +1n -2 | sed @com"); - exit(0); -} -# -# search in current source tree. -# -$cnt = &search($ARGV[0], $dbpath, @com); -# -# search in library path. -# -if ($cnt == 0 && ! ®exp($ARGV[0]) && ! $rflag && defined($ENV{'GTAGSLIBPATH'})) { - local($cwd) = &getcwd; - foreach $lib (split(':', $ENV{'GTAGSLIBPATH'})) { - next unless (-f "$lib/GTAGS"); - next if ($dbpath eq $lib); - chdir($lib) || die "$com: cannot chdir to $lib.\n"; - $root = $dbpath = &getcwd; - if ($aflag) { - @com = ("-e 's!\\.!$root!'"); - } else { - $common = &common($root, $cwd); - $up = $root; - $up =~ s/$common//; - $down = $cwd; - $down =~ s/$common//; - $down =~ s![^/]+!..!g; - next if ($down eq '' || $up eq ''); - @com = ("-e 's!\\./!$down/$up/!'"); - } - $cnt = &search($ARGV[0], $dbpath, @com); - last if ($cnt > 0); - } - chdir($cwd) || die "$com: cannot return current directory.\n"; -} -exit(0); -# -# realpath: get absolute path name -# -# r) absolute path -# -sub realpath { - local($path) = @_; - local($dirname, $basename); - if ($path =~ m!^(.*)/([^/]*)$!) { - $dirname = $1; - $basename = $2; - } else { - $dirname = '.'; - $basename = $path; - } - local($cwd) = &getcwd; - chdir($dirname) || die "$com: cannot move to '$dirname'.\n"; - $path = &getcwd . '/' . $basename; - chdir($cwd) || die "$com: cannot return to '$cwd'.\n"; - $path; -} -# -# getdbpath: get dbpath and root directory -# -# r) ($dbpath, $root) -# -sub getdbpath { - local($dbpath, $root); - local($cwd) = &getcwd; - - if (defined($ENV{'GTAGSROOT'})) { - $dbpath = $root = $ENV{'GTAGSROOT'}; - if (defined($ENV{'GTAGSDBPATH'})) { - $dbpath = $ENV{'GTAGSDBPATH'}; - } - $root =~ /^\// || die "$com: GTAGSROOT must be an absolute path.\n"; - $dbpath =~ /^\// || die "$com: GTAGSDBPATH must be an absolute path.\n"; - chdir($root) || die "$com: directory $root not found.\n"; - $root = &getcwd; - chdir($cwd); - chdir($dbpath) || die "$com: directory $dbpath not found.\n"; - $dbpath = &getcwd; - if ($cwd !~ /^$root/) { - die "$com: you must be under GTAGSROOT.\n"; - } - } - if (!$root) { - local($gtags) = 'GTAGS'; - while (! -r $gtags && ! -r "obj/$gtags") { - if (&getcwd =~ m!^/$!) { die "$com: $gtags not found.\n"; } - chdir('..'); - } - $dbpath = $root = &getcwd; - $dbpath = "$dbpath/obj" if (! -r $gtags); - } - chdir($cwd) || die "$com: cannot return current directory.\n"; - ($dbpath, $root); -} -# -# relative_filter: make relative path filter -# -# i) $root the root directory of source tree -# r) @com sed command list -# -sub relative_filter { - local($root) = @_; - local($cwd) = &getcwd; - local($cur) = $cwd; - - $cur =~ s!$root!!; - $cur =~ s!^/!!; - local(@step) = split('/', $cur); - local($downpath) = '\\.\\./' x @step; - local(@com); - push(@com, "-e 's!\\./!$downpath!'"); - foreach $step (@step) { - push(@com, "-e 's!\\.\\./$step/!!'"); - } - chdir($cwd) || die "$com: cannot return current directory.\n"; - @com; -} -# -# common: extract a common part of two paths. -# -# i) $p1, $p2 paths -# r) common part -# -sub common { - local($p1, $p2) = @_; - local(@p1, @p2, @common, $common); - - @p1 = split('/', $p1); - @p2 = split('/', $p2); - while (@p1 && @p2 && $p1[0] eq $p2[0]) { - push(@common, shift @p1); - shift @p2; - } - $common = join('/', @common); - $common .= '/'; - $common; -} -# -# search: search specified function -# -# i) $pattern search pattern -# i) $dbpath where GTAGS exist -# i) @com sed's command -# gi) $xflag -x option -# gi) $rflag -r option -# r) count of output lines -# -sub search { - local($pattern, $dbpath, @com) = @_; - local($regex, $gtags, $outfilter, $infilter); - # - # make input filter - # - $gtags = ($rflag) ? 'GRTAGS' : 'GTAGS'; - if ($regex = ®exp($pattern)) { # regular expression - $infilter = "btreeop $dbpath/$gtags |"; - } else { - $infilter = "btreeop -K '$pattern' $dbpath/$gtags |"; - } - # - # make output filter - # gtags fields is same to ctags -x format. - # 0:tag, 1:lineno, 2:filename, 3: pattern. - # - if ($xflag) { - $outfilter = "| sort +0 -1 +2 -3 +1n -2"; - } else { - $outfilter = "| awk '{print \$3}' | sort | uniq"; - } - $outfilter .= "| sed @com"; - open(PIPEIN, $infilter) || die "$com: database not found.\n"; - open(PIPEOUT, $outfilter) || die "$com: pipe cannot open.\n"; - local($cnt) = 0; - while (<PIPEIN>) { - local($tag) = split; - if (! $regex || $tag =~ /$pattern/o) { - $cnt++; - print PIPEOUT $_; - } - } - close(PIPEIN); - close(PIPEOUT); - $cnt; -} diff --git a/contrib/global/gtags/Makefile.generic b/contrib/global/gtags/Makefile.generic deleted file mode 100644 index 415d30fb2762..000000000000 --- a/contrib/global/gtags/Makefile.generic +++ /dev/null @@ -1,20 +0,0 @@ -PROG = gtags -CC = gcc -LIBS = -L../lib -lutil -ldb -CFLAGS = -O -I../lib -I/usr/include/db -DEPLIBS= ../lib/libutil.a -OBJS = gtags.o -BINDIR = /usr/bin -MANDIR = /usr/man - -all: $(PROG) - -$(PROG): $(OBJS) $(DEPLIBS) - $(CC) -o $(PROG) $(OBJS) $(LIBS) -install: - cp $(PROG) $(BINDIR) - chmod 755 $(BINDIR)/$(PROG) - cp $(PROG).1 $(MANDIR)/man1 - chmod 644 $(MANDIR)/man1/$(PROG).1 -clean: - rm -f $(PROG) $(OBJS) diff --git a/contrib/global/gtags/gtags.pl b/contrib/global/gtags/gtags.pl deleted file mode 100644 index 20c5877f05ce..000000000000 --- a/contrib/global/gtags/gtags.pl +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. All advertising materials mentioning features or use of this software -# must display the following acknowledgement: -# This product includes software developed by Shigio Yamaguchi. -# 4. Neither the name of the author nor the names of any co-contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# gtags.pl 5-Jul-97 -# -$com = $0; -$com =~ s/.*\///; -$usage = "usage: $com [-e][-s][dbpath]"; -$ENV{'PATH'} = '/bin:/usr/bin'; -# -# ctags flag -# -$eflag = $sflag = ''; -while ($ARGV[0] =~ /^-/) { - $opt = shift; - if ($opt =~ /[^-es]/) { die "$usage\n"; } - if ($opt =~ /e/) { $eflag = 'e'; } - if ($opt =~ /s/) { $sflag = 's'; } -} -$dbpath = '.'; -$dbpath = $ARGV[0] if ($ARGV[0]); -if (-f "$dbpath/GTAGS" && -f "$dbpath/GRTAGS") { - if (! -w "$dbpath/GTAGS") { - die "$com: cannot write to GTAGS.\n"; - } elsif (! -w "$dbpath/GRTAGS") { - die "$com: cannot write to GRTAGS.\n"; - } -} elsif (! -w "$dbpath") { - die "$com: cannot write to the directory '$dbpath'.\n" -} -# -# make global database -# -foreach $db ('GTAGS', 'GRTAGS') { - # currently only *.c *.h *.y are supported. - # *.s *.S is valid only when -s option specified. - open(FIND, "find . -type f -name '*.[chysS]' -print |") || die "$com: cannot exec find.\n"; - open(DB, "|btreeop -C $dbpath/$db") || die "$com: cannot create db file '$dbpath/$db'.\n"; - while (<FIND>) { - chop; - next if /(y\.tab\.c|y\.tab\.h)$/; - next if /(\/SCCS\/|\/RCS\/)/; - next if (/\.[sS]$/ && (!$sflag || $db eq 'GRTAGS')); - - $flag = ($db eq 'GRTAGS') ? "${eflag}Dxr" : "${eflag}Dx"; - $ENV{'GTAGDBPATH'} = $dbpath; - open(TAGS, "gctags -$flag $_ |") || die "$com: cannot read '$_'.\n"; - while (<TAGS>) { - print DB; - } - close(TAGS); - } - close(DB); - close(FIND); -} -exit 0; diff --git a/contrib/global/htags/Makefile.generic b/contrib/global/htags/Makefile.generic deleted file mode 100644 index d782f43d8374..000000000000 --- a/contrib/global/htags/Makefile.generic +++ /dev/null @@ -1,11 +0,0 @@ -PROG = htags -BINDIR = /usr/bin -MANDIR = /usr/man - -all: -install: - cp $(PROG).pl $(BINDIR)/$(PROG) - chmod 755 $(BINDIR)/$(PROG) - cp $(PROG).1 $(MANDIR)/man1 - chmod 644 $(MANDIR)/man1/$(PROG).1 -clean: diff --git a/contrib/global/include/ansi.h b/contrib/global/include/ansi.h deleted file mode 100644 index 2d71f774de2c..000000000000 --- a/contrib/global/include/ansi.h +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ansi.h 8.2 (Berkeley) 1/4/94 - * $Id: ansi.h,v 1.10 1996/05/01 00:47:05 bde Exp $ - */ - -#ifndef _MACHINE_ANSI_H_ -#define _MACHINE_ANSI_H_ - -/* - * Types which are fundamental to the implementation and must be declared - * in more than one standard header are defined here. Standard headers - * then use: - * #ifdef _BSD_SIZE_T_ - * typedef _BSD_SIZE_T_ size_t; - * #undef _BSD_SIZE_T_ - * #endif - */ -#define _BSD_CLOCK_T_ unsigned long /* clock() */ -#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ -#define _BSD_RUNE_T_ _BSD_CT_RUNE_T_ /* rune_t (see below) */ -#define _BSD_SIZE_T_ unsigned int /* sizeof() */ -#define _BSD_SSIZE_T_ int /* byte count or error */ -#define _BSD_TIME_T_ long /* time() */ -#define _BSD_WCHAR_T_ _BSD_CT_RUNE_T_ /* wchar_t (see below) */ - -/* - * Types which are fundamental to the implementation and must be used - * in more than one standard header although they are only declared in - * one (perhaps nonstandard) header are defined here. Standard headers - * use _BSD_XXX_T_ without undef'ing it. - */ -#define _BSD_CT_RUNE_T_ int /* arg type for ctype funcs */ -#define _BSD_OFF_T_ long long /* file offset */ -#define _BSD_PID_T_ int /* process [group] */ -#define _BSD_VA_LIST_ char * /* va_list */ - -/* - * The rune type is declared to be an ``int'' instead of the more natural - * ``unsigned long'' or ``long''. Two things are happening here. It is not - * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, - * it looks like 10646 will be a 31 bit standard. This means that if your - * ints cannot hold 32 bits, you will be in trouble. The reason an int was - * chosen over a long is that the is*() and to*() routines take ints (says - * ANSI C), but they use _BSD_CT_RUNE_T_ instead of int. By changing it - * here, you lose a bit of ANSI conformance, but your programs will still - * work. - */ - -/* - * Frequencies of the clock ticks reported by clock() and times(). They - * are the same as stathz for bogus historical reasons. They should be - * 1e6 because clock() and times() are implemented using getrusage() and - * there is no good reason why they should be less accurate. There is - * the bad reason that (broken) programs might not like clock_t or - * CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough - * to hold the required 24 hours worth of ticks if the frequency is - * 1000000ul, and ``unsigned long long'' would be nonstandard). - */ -#define _BSD_CLK_TCK_ 128 -#define _BSD_CLOCKS_PER_SEC_ 128 - -#endif /* !_MACHINE_ANSI_H_ */ diff --git a/contrib/global/include/cdefs.h b/contrib/global/include/cdefs.h deleted file mode 100644 index fe2cd6605f84..000000000000 --- a/contrib/global/include/cdefs.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Berkeley Software Design, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 - * $Id: cdefs.h,v 1.11 1996/08/18 16:14:03 peter Exp $ - */ - -#ifndef _SYS_CDEFS_H_ -#define _SYS_CDEFS_H_ - -#if defined(__cplusplus) -#define __BEGIN_DECLS extern "C" { -#define __END_DECLS }; -#else -#define __BEGIN_DECLS -#define __END_DECLS -#endif - -/* - * The __CONCAT macro is used to concatenate parts of symbol names, e.g. - * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. - * The __CONCAT macro is a bit tricky -- make sure you don't put spaces - * in between its arguments. __CONCAT can also concatenate double-quoted - * strings produced by the __STRING macro, but this only works with ANSI C. - */ -#if defined(__STDC__) || defined(__cplusplus) -#define __P(protos) protos /* full-blown ANSI C */ -#define __CONCAT1(x,y) x ## y -#define __CONCAT(x,y) __CONCAT1(x,y) -#define __STRING(x) #x - -#define __const const /* define reserved names to standard */ -#define __signed signed -#define __volatile volatile -#if defined(__cplusplus) -#define __inline inline /* convert to C++ keyword */ -#else -#ifndef __GNUC__ -#define __inline /* delete GCC keyword */ -#endif /* !__GNUC__ */ -#endif /* !__cplusplus */ - -#else /* !(__STDC__ || __cplusplus) */ -#define __P(protos) () /* traditional C preprocessor */ -#define __CONCAT(x,y) x/**/y -#define __STRING(x) "x" - -#ifndef __GNUC__ -#define __const /* delete pseudo-ANSI C keywords */ -#define __inline -#define __signed -#define __volatile -/* - * In non-ANSI C environments, new programs will want ANSI-only C keywords - * deleted from the program and old programs will want them left alone. - * When using a compiler other than gcc, programs using the ANSI C keywords - * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. - * When using "gcc -traditional", we assume that this is the intent; if - * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. - */ -#ifndef NO_ANSI_KEYWORDS -#define const /* delete ANSI C keywords */ -#define inline -#define signed -#define volatile -#endif /* !NO_ANSI_KEYWORDS */ -#endif /* !__GNUC__ */ -#endif /* !(__STDC__ || __cplusplus) */ - -/* - * GCC1 and some versions of GCC2 declare dead (non-returning) and - * pure (no side effects) functions using "volatile" and "const"; - * unfortunately, these then cause warnings under "-ansi -pedantic". - * GCC2.5 uses a new, peculiar __attribute__((attrs)) style. All of - * these work for GNU C++ (modulo a slight glitch in the C++ grammar - * in the distribution version of 2.5.5). - */ -#if __GNUC__ < 2 -#define __dead -#define __dead2 -#define __pure -#define __pure2 -#define __unused -#define __attribute__(x) -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ < 5 -#define __dead __volatile -#define __dead2 -#define __pure __const -#define __pure2 -#define __unused -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 -#define __dead -#define __dead2 __attribute__((__noreturn__)) -#define __pure -#define __pure2 __attribute__((__const__)) -#define __unused -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3 -#define __dead -#define __dead2 __attribute__((__noreturn__)) -#define __pure -#define __pure2 __attribute__((__const__)) -#define __unused __attribute__((__unused__)) -#endif - -#ifdef __GNUC__ -#ifdef __STDC__ -#define __weak_reference(sym,alias) \ - __asm__(".stabs \"_" #alias "\",11,0,0,0"); \ - __asm__(".stabs \"_" #sym "\",1,0,0,0") -#define __warn_references(sym,msg) \ - __asm__(".stabs \"" msg "\",30,0,0,0"); \ - __asm__(".stabs \"_" #sym "\",1,0,0,0") -#else -#define __weak_reference(sym,alias) \ - __asm__(".stabs \"_/**/alias\",11,0,0,0"); \ - __asm__(".stabs \"_/**/sym\",1,0,0,0") -#define __warn_references(sym,msg) \ - __asm__(".stabs msg,30,0,0,0"); \ - __asm__(".stabs \"_/**/sym\",1,0,0,0") -#endif -#endif - -#endif /* !_SYS_CDEFS_H_ */ diff --git a/contrib/global/include/err.h b/contrib/global/include/err.h deleted file mode 100644 index f03c67d45a46..000000000000 --- a/contrib/global/include/err.h +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)err.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _ERR_H_ -#define _ERR_H_ - -/* - * Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two - * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one - * of them here we may collide with the utility's includes. It's unreasonable - * for utilities to have to include one of them to include err.h, so we get - * _BSD_VA_LIST_ from <machine/ansi.h> and use it. - */ -#include <ansi.h> -#include <cdefs.h> - -__BEGIN_DECLS -void err __P((int, const char *, ...)) __dead2; -void verr __P((int, const char *, _BSD_VA_LIST_)) __dead2; -void errx __P((int, const char *, ...)) __dead2; -void verrx __P((int, const char *, _BSD_VA_LIST_)) __dead2; -void warn __P((const char *, ...)); -void vwarn __P((const char *, _BSD_VA_LIST_)); -void warnx __P((const char *, ...)); -void vwarnx __P((const char *, _BSD_VA_LIST_)); -void err_set_file __P((void *)); -void err_set_exit __P((void (*)(int))); -__END_DECLS - -#endif /* !_ERR_H_ */ diff --git a/contrib/global/lib/Makefile.generic b/contrib/global/lib/Makefile.generic deleted file mode 100644 index 2cd87fbd2e21..000000000000 --- a/contrib/global/lib/Makefile.generic +++ /dev/null @@ -1,14 +0,0 @@ -LIB = libutil.a -CC = gcc -AR = ar -CFLAGS = -O -I../lib -I/usr/include/db -OBJS = tag.o tab.o strop.o mgets.o lookup.o gtagsopen.o getdbpath.o \ - find.o dbname.o dbio.o test.o makepath.o locatestring.o -all: $(LIB) - -$(LIB): $(OBJS) - $(AR) cq $(LIB) $(OBJS) -install: - @echo -n -clean: - rm -f $(LIB) $(OBJS) diff --git a/contrib/global/lib/dbio.c b/contrib/global/lib/dbio.c deleted file mode 100644 index c29a91477bdb..000000000000 --- a/contrib/global/lib/dbio.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redilogibution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redilogibutions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redilogibutions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the dilogibution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * dbio.c 14-Dec-97 - * - */ -#include <sys/stat.h> - -#include <fcntl.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include "dbio.h" -#include "die.h" -#include "test.h" - -DBT key; /* key of record */ -DBT dat; /* data of record */ -/* - * db_open: open db database. - * - * i) dbname database name - * i) mode 0: read only, 1: write only, 2: read & write - * i) perm file permission - * i) flags - * DBIO_DUP: allow duplicate records. - * DBIO_REMOVE: remove on closed. - * r) descripter for db_xxx() - * - * db_open leaves database permission 0600. please chmod(2) to make public. - */ -DBIO * -db_open(dbname, mode, perm, flags) -char *dbname; -int mode; -int perm; -int flags; -{ - DB *db; - int rw; - BTREEINFO info; - DBIO *dbio; - - /* - * setup argments. - */ - if (mode == 0) - rw = O_RDONLY; - else if (mode == 1) - rw = O_RDWR|O_CREAT|O_TRUNC; - else if (mode == 2) - rw = O_RDWR; - else - die("db_open illegal mode."); - info.flags = (flags & DBIO_DUP) ? R_DUP : 0; - info.cachesize = 500000; - info.maxkeypage = 0; - info.minkeypage = 0; - info.psize = 0; - info.compare = NULL; - info.prefix = NULL; - info.lorder = LITTLE_ENDIAN; - - /* - * if unlink do job normally, those who already open tag file can use - * it until closing. - */ - if (mode == 1 && test("f", dbname)) - (void)unlink(dbname); - db = dbopen(dbname, rw, 0600, DB_BTREE, &info); - if (!db) - die1("db_open failed (dbname = %s).", dbname); - if (!(dbio = (DBIO *)malloc(sizeof(DBIO)))) - die("short of memory."); - strcpy(dbio->dbname, dbname); - dbio->db = db; - dbio->openflags = flags; - dbio->perm = (mode == 1) ? perm : 0; - dbio->lastkey = (char *)0; - dbio->lastdat = (char *)0; - - return dbio; -} -/* - * db_get: get data by a key. - * - * i) dbio descripter - * i) k key - * r) pointer to data - */ -char * -db_get(dbio, k) -DBIO *dbio; -char *k; -{ - DB *db = dbio->db; - int status; - - key.data = k; - key.size = strlen(k)+1; - - status = (*db->get)(db, &key, &dat, 0); - dbio->lastkey = (char *)key.data; - dbio->lastdat = (char *)dat.data; - switch (status) { - case RET_SUCCESS: - break; - case RET_ERROR: - die("db_get failed."); - case RET_SPECIAL: - return((char *)0); - } - return((char *)dat.data); -} -/* - * db_put: put data by a key. - * - * i) dbio descripter - * i) k key - * i) d data - */ -void -db_put(dbio, k, d) -DBIO *dbio; -char *k; -char *d; -{ - DB *db = dbio->db; - int status; - - if (strlen(k) > MAXKEYLEN) - die("primary key too long."); - key.data = k; - key.size = strlen(k)+1; - dat.data = d; - dat.size = strlen(d)+1; - - status = (*db->put)(db, &key, &dat, 0); - switch (status) { - case RET_SUCCESS: - break; - case RET_ERROR: - case RET_SPECIAL: - die("db_put failed."); - } -} -/* - * db_del: delete record by a key. - * - * i) dbio descripter - * i) k key - */ -void -db_del(dbio, k) -DBIO *dbio; -char *k; -{ - DB *db = dbio->db; - int status; - - if (k) { - key.data = k; - key.size = strlen(k)+1; - status = (*db->del)(db, &key, 0); - } else - status = (*db->del)(db, &key, R_CURSOR); - if (status == RET_ERROR) - die("db_del failed."); -} -/* - * db_first: get first record. - * - * i) dbio dbio descripter - * i) k key - * !=NULL: indexed read by key - * ==NULL: sequential read - * i) flags following db_next call take over this. - * DBIO_KEY read key part - * DBIO_PREFIX prefix read - * DBIO_SKIPMETA skip META record - * only valied when sequential read - * r) data - */ -char * -db_first(dbio, k, flags) -DBIO *dbio; -char *k; -int flags; -{ - DB *db = dbio->db; - int status; - - if (flags & DBIO_PREFIX && !k) - flags &= ~DBIO_PREFIX; - if (flags & DBIO_SKIPMETA && k) - flags &= ~DBIO_SKIPMETA; - if (k) { - if (strlen(k) > MAXKEYLEN) - die("primary key too long."); - strcpy(dbio->key, k); - key.data = k; - key.size = strlen(k); - /* - * includes NULL character unless prefix read. - */ - if (!(flags & DBIO_PREFIX)) - key.size++; - dbio->keylen = key.size; - status = (*db->seq)(db, &key, &dat, R_CURSOR); - } else { - dbio->keylen = dbio->key[0] = 0; - for (status = (*db->seq)(db, &key, &dat, R_FIRST); - status == RET_SUCCESS && - flags & DBIO_SKIPMETA && - *((char *)dat.data) == ' '; - status = (*db->seq)(db, &key, &dat, R_NEXT)) - ; - } - dbio->lastkey = (char *)key.data; - dbio->lastdat = (char *)dat.data; - switch (status) { - case RET_SUCCESS: - break; - case RET_ERROR: - die("db_first failed."); - case RET_SPECIAL: - return ((char *)0); - } - dbio->ioflags = flags; - if (flags & DBIO_PREFIX) { - if (strncmp((char *)key.data, dbio->key, dbio->keylen)) - return (char *)0; - } else if (dbio->keylen) { - if (strcmp((char *)key.data, dbio->key)) - return (char *)0; - } - if (flags & DBIO_KEY) { - strcpy(dbio->prev, (char *)key.data); - return (char *)key.data; - } - return ((char *)dat.data); -} -/* - * db_next: get next record. - * - * i) dbio dbio descripter - * r) data - */ -char * -db_next(dbio) -DBIO *dbio; -{ - DB *db = dbio->db; - int flags = dbio->ioflags; - int status; - - while ((status = (*db->seq)(db, &key, &dat, R_NEXT)) == RET_SUCCESS) { - if (flags & DBIO_SKIPMETA) { - if (*((char *)dat.data) == ' ') - continue; - } - if (flags & DBIO_KEY) { - if (!strcmp(dbio->prev, (char *)key.data)) - continue; - if (strlen((char *)key.data) > MAXKEYLEN) - die("primary key too long."); - strcpy(dbio->prev, (char *)key.data); - } - dbio->lastkey = (char *)key.data; - dbio->lastdat = (char *)dat.data; - if (flags & DBIO_PREFIX) { - if (strncmp((char *)key.data, dbio->key, dbio->keylen)) - return (char *)0; - } else if (dbio->keylen) { - if (strcmp((char *)key.data, dbio->key)) - return (char *)0; - } - return (flags & DBIO_KEY) ? (char *)key.data : (char *)dat.data; - } - if (status == RET_ERROR) - die("db_next failed."); - return (char *)0; -} -/* - * db_close: close db - * - * i) dbio dbio descripter - */ -void -db_close(dbio) -DBIO *dbio; -{ - DB *db = dbio->db; - (void)db->close(db); - if (dbio->openflags & DBIO_REMOVE) - (void)unlink(dbio->dbname); - else if (dbio->perm && chmod(dbio->dbname, dbio->perm) < 0) - die("cannot change file mode."); - (void)free(dbio); -} diff --git a/contrib/global/lib/dbio.h b/contrib/global/lib/dbio.h deleted file mode 100644 index 7c1994e86d69..000000000000 --- a/contrib/global/lib/dbio.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redilogibution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redilogibutions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redilogibutions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the dilogibution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * dbio.h 14-Dec-97 - * - */ -#ifndef _DBIO_H_ -#define _DBIO_H_ - -#include <db.h> -#include <sys/param.h> - -#ifndef LITTLE_ENDIAN -#define LITTLE_ENDIAN 1234 -#endif -#ifndef BIG_ENDIAN -#define BIG_ENDIAN 4321 -#endif - -#define MAXKEYLEN 300 - -typedef struct { - DB *db; /* descripter of DB */ - char dbname[MAXPATHLEN+1]; /* dbname */ - char key[MAXKEYLEN+1]; /* key */ - int keylen; /* key length */ - char prev[MAXKEYLEN+1]; /* previous key value */ - char *lastkey; /* the key of last located record */ - char *lastdat; /* the data of last located record */ - int openflags; /* flags of db_open() */ - int ioflags; /* flags of db_first() */ - int perm; /* file permission */ -} DBIO; - -/* - * openflags - */ -#define DBIO_DUP 1 /* allow duplicate records */ -#define DBIO_REMOVE 2 /* remove file when closed */ -/* - * ioflags - */ -#define DBIO_KEY 1 /* read key part */ -#define DBIO_PREFIX 2 /* prefixed read */ -#define DBIO_SKIPMETA 4 /* skip META record */ - -#ifndef __P -#if defined(__STDC__) -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -DBIO *db_open __P((char *, int, int, int)); -char *db_get __P((DBIO *, char *)); -void db_put __P((DBIO *, char *, char *)); -void db_del __P((DBIO *, char *)); -char *db_first __P((DBIO *, char *, int)); -char *db_next __P((DBIO *)); -void db_close __P((DBIO *)); -#endif /* _DBIO_H_ */ diff --git a/contrib/global/lib/dbname.c b/contrib/global/lib/dbname.c deleted file mode 100644 index 1e68b3a2bf4a..000000000000 --- a/contrib/global/lib/dbname.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * dbname.c 20-Oct-97 - * - */ -#include "dbname.h" - -static char *tagslist[] = {"GTAGS", "GRTAGS", "GSYMS"}; -/* - * dbname: return db name - * - * i) db 0: GTAGS, 1: GRTAGS, 2: GSYMS - * r) dbname - */ -char * -dbname(db) -int db; -{ - return tagslist[db]; -} diff --git a/contrib/global/lib/dbname.h b/contrib/global/lib/dbname.h deleted file mode 100644 index 17eba363eda4..000000000000 --- a/contrib/global/lib/dbname.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * dbname.h 16-Oct-97 - * - */ - -#ifndef _DBNAME_H_ -#define _DBNAME_H_ - -#ifndef __P -#if defined(__STDC__) -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -#define GTAGS 0 -#define GRTAGS 1 -#define GSYMS 2 -#define GTAGLIM 3 - -char *dbname __P((int)); - -#endif /* ! _DBNAME_H_ */ diff --git a/contrib/global/lib/gtagsopen.c b/contrib/global/lib/gtagsopen.c deleted file mode 100644 index 90f0481603f5..000000000000 --- a/contrib/global/lib/gtagsopen.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * gtagsopen.c 20-Oct-97 - * - */ -#include <sys/param.h> - -#include <ctype.h> -#include <db.h> -#include <fcntl.h> -#include <stdlib.h> - -#include "dbio.h" -#include "dbname.h" -#include "die.h" -#include "gtagsopen.h" -#include "makepath.h" - -#define VERSIONKEY " __.VERSION" -static int support_version = 1; /* accept this format version */ - -/* - * gtagsopen: open global database. - * - * i) dbpath dbpath directory - * i) db GTAGS, GRTAGS, GSYMS - * i) mode 0: read only - * 1: write only - * 2: read and write - * r) DB structure - * - * when error occurred, gtagopen doesn't return. - */ -DBIO * -gtagsopen(dbpath, db, mode) -char *dbpath; -int db; -int mode; -{ - DBIO *dbio; - int version_number; - char *p; - - /* - * allow duplicate records. - */ - dbio = db_open(makepath(dbpath, dbname(db)), mode, 0644, DBIO_DUP); - if (dbio == NULL) { - if (mode == 1) - die1("cannot make database (%s).", makepath(dbpath, dbname(db))); - die1("database not found (%s).", makepath(dbpath, dbname(db))); - } - if (mode == 1) { - /* nothing to do now */ - } else { - /* - * recognize format version of GTAGS. 'format version record' - * is saved as a META record in GTAGS and GRTAGS. - * if 'format version record' is not found, it's assumed - * version 1. - */ - if ((p = db_get(dbio, VERSIONKEY)) != NULL) { - for (p += strlen(VERSIONKEY); *p && isspace(*p); p++) - ; - version_number = atoi(p); - } else - version_number = 1; - if (version_number > support_version) - die("GTAGS seems new format. Please install the latest GLOBAL."); - } - return dbio; -} diff --git a/contrib/global/lib/gtagsopen.h b/contrib/global/lib/gtagsopen.h deleted file mode 100644 index 2afb2ab56892..000000000000 --- a/contrib/global/lib/gtagsopen.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * gtagsopen.h 16-Oct-97 - * - */ - -#ifndef _GTAGSOPEN_H_ -#define _GTAGSOPEN_H_ -#include "dbio.h" - -DBIO *gtagsopen __P((char *, int, int)); - -#endif /* ! _GTAGSOPEN_H_ */ diff --git a/contrib/global/lib/lookup.c b/contrib/global/lib/lookup.c deleted file mode 100644 index d317ba6f3434..000000000000 --- a/contrib/global/lib/lookup.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * lookup.c 20-Oct-97 - * - */ -#include "gtagsopen.h" -#include "lookup.h" -#include "dbio.h" -#include "die.h" -#include "dbname.h" - -static DBIO *dbio; -static int opened; - -void -lookupopen(dbpath) -char *dbpath; -{ - if (opened) - die("nested call to lookupopen."); - opened = 1; - dbio = gtagsopen(dbpath, GTAGS, 0); -} -int -lookup(name) -char *name; -{ - char *p = db_get(dbio, name); - return (p) ? 1 : 0; -} -void -lookupclose(void) -{ - db_close(dbio); - opened = 0; -} diff --git a/contrib/global/lib/lookup.h b/contrib/global/lib/lookup.h deleted file mode 100644 index 037102f53600..000000000000 --- a/contrib/global/lib/lookup.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * lookup.h 16-Oct-97 - * - */ - -#ifndef _LOOKUP_H_ -#define _LOOKUP_H_ - -#ifndef __P -#if defined(__STDC__) -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -void lookupopen __P((char *)); -int lookup __P((char *)); -void lookupclose __P((void)); - -#endif /* ! _LOOKUP_H_ */ diff --git a/contrib/global/lib/strop.c b/contrib/global/lib/strop.c deleted file mode 100644 index b024abca8371..000000000000 --- a/contrib/global/lib/strop.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * strop.c 20-Oct-97 - * - */ -#include <stdlib.h> -#include <string.h> - -#include "die.h" -#include "strop.h" - -/* - * usage: string buffer - * - * stropen(); - * for (s = string; *s; s++) - * strputc(*s); - * s = strclose(); - */ -#define EXPANDSIZE 80 -static char *sbuf; -static char *endp; -static char *curp; -static int sbufsize; -static int opened; - -void -stropen(void) -{ - if (opened) - die("nested call to stropen."); - opened = 1; - /* - * allocate initial buffer. - */ - if (!sbuf) - if (!(sbuf = (char *)malloc(sbufsize + 1))) - die("short of memory."); - curp = sbuf; - endp = sbuf + sbufsize; - *curp = 0; -} -void -strputs(s) -char *s; -{ - int length = strlen(s); - - strnputs(s, length); -} -void -strnputs(s, length) -char *s; -int length; -{ - if (curp + length > endp) { - int count = curp - sbuf; - - sbufsize += (length > EXPANDSIZE) ? length : EXPANDSIZE; - if (!(sbuf = (char *)realloc(sbuf, sbufsize + 1))) - die("short of memory."); - curp = sbuf + count; - endp = sbuf + sbufsize; - } - strncpy(curp, s, length); - curp += length; - *curp = 0; -} -void -strputc(c) -int c; -{ - if (curp + 1 > endp) { - int count = curp - sbuf; - - sbufsize += EXPANDSIZE; - if (!(sbuf = (char *)realloc(sbuf, sbufsize + 1))) - die("short of memory."); - curp = sbuf + count; - endp = sbuf + sbufsize; - } - *curp++ = c; - *curp = 0; -} -char * -strclose(void) -{ - opened = 0; - /* - * doesn't free area in current implementation. - */ - return sbuf; -} diff --git a/contrib/global/lib/strop.h b/contrib/global/lib/strop.h deleted file mode 100644 index 9289566d0097..000000000000 --- a/contrib/global/lib/strop.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * strop.h 16-Oct-97 - * - */ - -#ifndef _STROP_H_ -#define _STROP_H_ - -#ifndef __P -#if defined(__STDC__) -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -void stropen __P((void)); -void strputs __P((char *)); -void strnputs __P((char *, int)); -void strputc __P((int)); -char *strclose __P((void)); - -#endif /* ! _STROP_H_ */ diff --git a/contrib/global/lib/tag.c b/contrib/global/lib/tag.c deleted file mode 100644 index e80d634c2708..000000000000 --- a/contrib/global/lib/tag.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * tag.c 20-Oct-97 - * - */ -#include <ctype.h> -#include <string.h> - -#include "dbio.h" -#include "die.h" -#include "gtagsopen.h" -#include "locatestring.h" -#include "tab.h" -#include "tag.h" - - -static DBIO *dbio; -static int opened; - -void -tagopen(dbpath, db, mode) -char *dbpath; -int db; -int mode; -{ - if (opened) - die("nested call to tagopen."); - opened = 1; - dbio = gtagsopen(dbpath, db, mode); -} -void -tagput(entry, record) -char *entry; -char *record; -{ - entab(record); - db_put(dbio, entry, record); -} -void -tagdelete(path) -char *path; -{ - char *p; - int length = strlen(path); - - for (p = db_first(dbio, NULL, DBIO_SKIPMETA); p; p = db_next(dbio)) { - p = locatestring(p, "./", 0); - if (!strncmp(p, path, length) && isspace(*(p + length))) - db_del(dbio, NULL); - } -} -void -tagclose(void) -{ - db_close(dbio); - opened = 0; -} diff --git a/contrib/global/lib/tag.h b/contrib/global/lib/tag.h deleted file mode 100644 index 8bac2ac2f9b6..000000000000 --- a/contrib/global/lib/tag.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * tag.h 16-Oct-97 - * - */ - -#ifndef _TAG_H_ -#define _TAG_H_ - -#ifndef __P -#if defined(__STDC__) -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -void tagopen __P((char *, int, int)); -void tagput __P((char *, char *)); -void tagdelete __P((char *)); -void tagclose __P((void)); - -#endif /* ! _TAG_H_ */ diff --git a/contrib/global/nvi-1.34.diff b/contrib/global/nvi-1.34.diff deleted file mode 100644 index f289e9a8fa98..000000000000 --- a/contrib/global/nvi-1.34.diff +++ /dev/null @@ -1,900 +0,0 @@ -diff -c -r -N /usr/src/usr.bin/vi/USD.doc/vi.man/vi.1 ./USD.doc/vi.man/vi.1 -*** /usr/src/usr.bin/vi/USD.doc/vi.man/vi.1 Wed Aug 17 08:36:39 1994 ---- ./USD.doc/vi.man/vi.1 Sat Dec 14 11:54:14 1996 -*************** -*** 39,59 **** - .Nd text editors - .Sh SYNOPSIS - .Nm \&ex -! .Op Fl eFRrsv - .Op Fl c Ar cmd - .Op Fl t Ar tag - .Op Fl w Ar size - .\".Op Fl X Ar \&aw - .Op Ar "file ..." - .Nm \&vi -! .Op Fl eFRrv - .Op Fl c Ar cmd - .Op Fl t Ar tag - .Op Fl w Ar size - .\".Op Fl X Ar \&aw - .Op Ar "file ..." - .Nm view -! .Op Fl eFRrv - .Op Fl c Ar cmd - .Op Fl t Ar tag - .Op Fl w Ar size ---- 39,59 ---- - .Nd text editors - .Sh SYNOPSIS - .Nm \&ex -! .Op Fl eFGRrsv - .Op Fl c Ar cmd - .Op Fl t Ar tag - .Op Fl w Ar size - .\".Op Fl X Ar \&aw - .Op Ar "file ..." - .Nm \&vi -! .Op Fl eFGRrv - .Op Fl c Ar cmd - .Op Fl t Ar tag - .Op Fl w Ar size - .\".Op Fl X Ar \&aw - .Op Ar "file ..." - .Nm view -! .Op Fl eFGRrv - .Op Fl c Ar cmd - .Op Fl t Ar tag - .Op Fl w Ar size -*************** -*** 124,129 **** ---- 124,131 ---- - Don't copy the entire file when first starting to edit. - (The default is to make a copy in case someone else modifies - the file during your edit session.) -+ .It Fl G -+ Start editing in gtags mode, as if the gtagsmode option was set. - .It Fl R - Start editing in read-only mode, as if the command name was - .Nm view , -*************** -*** 377,382 **** ---- 379,385 ---- - Move the cursor down - .Li count - lines to the first nonblank character of that line. -+ In gtags select mode, <control-M> select current line as a tag. - .It Sy "[count] <control-P>" - .It Sy "[count] k" - Move the cursor up -*************** -*** 402,408 **** - .Nm \&ex - commands or cancel partial commands. - .It Sy "<control-]>" -! Push a tag reference onto the tag stack. - .It Sy "<control-^>" - Switch to the most recently edited file. - .It Sy "[count] <space>" ---- 405,412 ---- - .Nm \&ex - commands or cancel partial commands. - .It Sy "<control-]>" -! Push a tag reference onto the tag stack. In gtagsmode, if at the first column -! of line, locate function references otherwise function definitions. - .It Sy "<control-^>" - Switch to the most recently edited file. - .It Sy "[count] <space>" -*************** -*** 780,785 **** ---- 784,793 ---- - Grow or shrink the current screen. - .It Sy "rew[ind][!]" - Rewind the argument list. -+ .It Sy "rta[g][!] tagstring" -+ Edit the file refering the specified tag. (Only in gtagsmode) -+ .It Sy "se[lect]" -+ Select a tag from gtags list. - .It Sy "se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]" - Display or set editor options. - .It Sy "sh[ell]" -*************** -*** 901,906 **** ---- 909,916 ---- - style) expressions. - .It Sy "flash [on]" - Flash the screen instead of beeping the keyboard on error. -+ .It Sy "gtagsmode, gt [off]" -+ Use GTAGS and GRTAGS instead of tags. - .It Sy "hardtabs, ht [8]" - Set the spacing between hardware tab settings. - .It Sy "ignorecase, ic [off]" -diff -c -r -N /usr/src/usr.bin/vi/common/Makefile ./common/Makefile -*** /usr/src/usr.bin/vi/common/Makefile Mon Sep 12 07:01:45 1994 ---- ./common/Makefile Sat Dec 14 11:55:27 1996 -*************** -*** 9,15 **** - LINKS+= ${BINDIR}/${VI} ${BINDIR}/view - MAN1= ${.CURDIR}/../USD.doc/vi.man/vi.1 - -! CFLAGS+=-I. -I${.CURDIR} - DPADD+= ${LIBCURSES} ${LIBTERMCAP} ${LIBUTIL} - LDADD+= -lcurses -ltermcap -lutil - ---- 9,15 ---- - LINKS+= ${BINDIR}/${VI} ${BINDIR}/view - MAN1= ${.CURDIR}/../USD.doc/vi.man/vi.1 - -! CFLAGS+=-I. -I${.CURDIR} -DGTAGS - DPADD+= ${LIBCURSES} ${LIBTERMCAP} ${LIBUTIL} - LDADD+= -lcurses -ltermcap -lutil - -diff -c -r -N /usr/src/usr.bin/vi/common/exf.c ./common/exf.c -*** /usr/src/usr.bin/vi/common/exf.c Tue May 30 15:35:44 1995 ---- ./common/exf.c Sat Dec 14 11:54:15 1996 -*************** -*** 156,162 **** ---- 156,169 ---- - * Required FRP initialization; the only flag we keep is the - * cursor information. - */ -+ #ifdef GTAGS -+ /* -+ * we must keep gtagstmp information too. -+ */ -+ F_CLR(frp, ~(FR_CURSORSET|FR_GTAGSTMP)); -+ #else - F_CLR(frp, ~FR_CURSORSET); -+ #endif - - /* - * Required EXF initialization: -*************** -*** 290,295 **** ---- 297,305 ---- - * an error. - */ - if (rcv_name == NULL) -+ #ifdef GTAGS -+ if (!F_ISSET(frp, FR_GTAGSTMP)) -+ #endif - switch (file_lock(oname, - &ep->fcntl_fd, ep->db->fd(ep->db), 0)) { - case LOCK_FAILED: -diff -c -r -N /usr/src/usr.bin/vi/common/gs.h ./common/gs.h -*** /usr/src/usr.bin/vi/common/gs.h Wed Aug 17 08:36:42 1994 ---- ./common/gs.h Sat Dec 14 11:54:15 1996 -*************** -*** 48,53 **** ---- 48,56 ---- - - sigset_t blockset; /* Signal mask. */ - -+ #ifdef GTAGS -+ char *gtagstmp; /* gtagstmp made by -t option */ -+ #endif - #ifdef DEBUG - FILE *tracefp; /* Trace file pointer. */ - #endif -diff -c -r -N /usr/src/usr.bin/vi/common/main.c ./common/main.c -*** /usr/src/usr.bin/vi/common/main.c Tue May 30 15:35:45 1995 ---- ./common/main.c Sat Dec 14 11:54:15 1996 -*************** -*** 98,103 **** ---- 98,106 ---- - SCR *sp; - u_int flags, saved_vi_mode; - int ch, eval, flagchk, readonly, silent, snapshot; -+ #ifdef GTAGS -+ int gtags = 0; -+ #endif - char *excmdarg, *myname, *p, *tag_f, *trace_f, *wsizearg; - char path[MAXPATHLEN]; - -*************** -*** 134,140 **** ---- 137,147 ---- - excmdarg = tag_f = trace_f = wsizearg = NULL; - silent = 0; - snapshot = 1; -+ #ifdef GTAGS -+ while ((ch = getopt(argc, argv, "c:eFGRrsT:t:vw:X:")) != EOF) -+ #else - while ((ch = getopt(argc, argv, "c:eFRrsT:t:vw:X:")) != EOF) -+ #endif - switch (ch) { - case 'c': /* Run the command. */ - excmdarg = optarg; -*************** -*** 146,151 **** ---- 153,163 ---- - case 'F': /* No snapshot. */ - snapshot = 0; - break; -+ #ifdef GTAGS -+ case 'G': /* gtags mode. */ -+ gtags = 1; -+ break; -+ #endif - case 'R': /* Readonly. */ - readonly = 1; - break; -*************** -*** 245,250 **** ---- 257,266 ---- - goto err; - if (readonly) /* Global read-only bit. */ - O_SET(sp, O_READONLY); -+ #ifdef GTAGS -+ if (gtags) /* Global gtags bit. */ -+ O_SET(sp, O_GTAGSMODE); -+ #endif - if (silent) { /* Ex batch mode. */ - O_CLR(sp, O_AUTOPRINT); - O_CLR(sp, O_PROMPT); -*************** -*** 515,520 **** ---- 531,539 ---- - LIST_INIT(&gp->cutq); - LIST_INIT(&gp->seqq); - -+ #ifdef GTAGS -+ gp->gtagstmp = NULL; -+ #endif - /* Set a flag if we're reading from the tty. */ - if (isatty(STDIN_FILENO)) - F_SET(gp, G_STDIN_TTY); -*************** -*** 554,559 **** ---- 573,584 ---- - SCR *sp; - char *tty; - -+ #ifdef GTAGS -+ if (gp->gtagstmp) { -+ if (!strncmp(gp->gtagstmp, _PATH_GTAGSTMP, strlen(_PATH_GTAGSTMP))) -+ (void)unlink(gp->gtagstmp); -+ } -+ #endif - /* Default buffer storage. */ - (void)text_lfree(&gp->dcb_store.textq); - -diff -c -r -N /usr/src/usr.bin/vi/common/msg.c ./common/msg.c -*** /usr/src/usr.bin/vi/common/msg.c Thu Aug 18 10:10:54 1994 ---- ./common/msg.c Sat Dec 14 11:54:15 1996 -*************** -*** 338,343 **** ---- 338,352 ---- - #else - pid = ""; - #endif -+ #ifdef GTAGS -+ if (F_ISSET(sp->frp, FR_GTAGSTMP)) { -+ if (file_lline(sp, ep, &last)) { -+ return (1); -+ } -+ msgq(sp, M_INFO, "[GTAGS SELECT MODE] %d lines", last); -+ return (0); -+ } -+ #endif - /* - * See nvi/exf.c:file_init() for a description of how and - * when the read-only bit is set. -diff -c -r -N /usr/src/usr.bin/vi/common/options.c ./common/options.c -*** /usr/src/usr.bin/vi/common/options.c Tue May 30 15:35:46 1995 ---- ./common/options.c Sat Dec 14 11:54:15 1996 -*************** -*** 103,108 **** ---- 103,112 ---- - {"extended", NULL, OPT_0BOOL, 0}, - /* O_FLASH HPUX */ - {"flash", NULL, OPT_1BOOL, 0}, -+ #ifdef GTAGS -+ /* O_GTAGSMODE SPECIAL */ -+ {"gtagsmode", NULL, OPT_0BOOL, 0}, -+ #endif - /* O_HARDTABS 4BSD */ - {"hardtabs", NULL, OPT_NUM, 0}, - /* O_IGNORECASE 4BSD */ -*************** -*** 228,233 **** ---- 232,240 ---- - {"eb", O_ERRORBELLS}, /* 4BSD */ - {"ed", O_EDCOMPATIBLE}, /* 4BSD */ - {"ex", O_EXRC}, /* System V (undocumented) */ -+ #ifdef GTAGS -+ {"gt", O_GTAGSMODE}, /* Special */ -+ #endif - {"ht", O_HARDTABS}, /* 4BSD */ - {"ic", O_IGNORECASE}, /* 4BSD */ - {"li", O_LINES}, /* 4.4BSD */ -diff -c -r -N /usr/src/usr.bin/vi/common/pathnames.h ./common/pathnames.h -*** /usr/src/usr.bin/vi/common/pathnames.h Wed Aug 17 08:36:43 1994 ---- ./common/pathnames.h Sat Dec 14 11:54:15 1996 -*************** -*** 43,45 **** ---- 43,48 ---- - #define _PATH_TAGS "tags" - #define _PATH_TMP "/tmp" - #define _PATH_TTY "/dev/tty" -+ #ifdef GTAGS -+ #define _PATH_GTAGSTMP "/var/tmp/gtags" -+ #endif -diff -c -r -N /usr/src/usr.bin/vi/common/screen.h ./common/screen.h -*** /usr/src/usr.bin/vi/common/screen.h Wed Aug 17 08:36:43 1994 ---- ./common/screen.h Sat Dec 14 11:54:15 1996 -*************** -*** 87,92 **** ---- 87,95 ---- - #define FR_TMPEXIT 0x100 /* Modified temporary file, no exit. */ - #define FR_TMPFILE 0x200 /* If file has no name. */ - #define FR_UNLOCKED 0x400 /* File couldn't be locked. */ -+ #ifdef GTAGS -+ #define FR_GTAGSTMP 0x800 /* File is gtags temporary file. */ -+ #endif - u_int16_t flags; - }; - -diff -c -r -N /usr/src/usr.bin/vi/ex/ex_tag.c ./ex/ex_tag.c -*** /usr/src/usr.bin/vi/ex/ex_tag.c Thu Aug 18 10:13:20 1994 ---- ./ex/ex_tag.c Sat Dec 14 11:54:15 1996 -*************** -*** 64,69 **** ---- 64,72 ---- - #include "vi.h" - #include "excmd.h" - #include "tag.h" -+ #ifdef GTAGS -+ #include "pathnames.h" -+ #endif - - static char *binary_search __P((char *, char *, char *)); - static int compare __P((char *, char *, char *)); -*************** -*** 71,76 **** ---- 74,288 ---- - static int search __P((SCR *, char *, char *, char **)); - static int tag_get __P((SCR *, char *, char **, char **, char **)); - -+ #ifdef DEBUG -+ void -+ trace(fp) -+ FILE *fp; -+ { -+ SCR *sp; -+ TAG *tp; -+ FREF *frp; -+ int scr, fref, tag; -+ -+ fprintf(fp, "------------------------------------\n"); -+ scr = 0; -+ for (sp = __global_list->dq.cqh_first; sp != (void *)&__global_list->dq; sp = sp->q.cqe_next) { -+ fprintf(fp, "screen %d {\n", ++scr); -+ fref = 0; -+ for (frp = sp->frefq.cqh_first; -+ frp != (FREF *)&sp->frefq; frp = frp->q.cqe_next) { -+ fprintf(fp, " FREF %d ", ++fref); -+ if (F_ISSET(frp, FR_GTAGSTMP)) -+ fprintf(fp, "<%s>\n", frp->name); -+ else -+ fprintf(fp, "%s\n", frp->name); -+ } -+ tag = 0; -+ if (!EXP(sp)) -+ continue; -+ fprintf(fp, " ................................\n"); -+ for (tp = EXP(sp)->tagq.tqh_first; tp != NULL; tp = tp->q.tqe_next) { -+ fprintf(fp, " TAG %d ", ++tag); -+ if (F_ISSET(tp->frp, FR_GTAGSTMP)) -+ fprintf(fp, "<%s>\n", tp->frp->name); -+ else -+ fprintf(fp, "%s\n", tp->frp->name); -+ } -+ fprintf(fp, "}\n"); -+ } -+ fprintf(fp, "------------------------------------\n"); -+ } -+ #endif -+ #ifdef GTAGS -+ /* -+ * getentry -- -+ * get tag information from current line. -+ * -+ * gtags temporary file format. -+ * <tag> <lineno> <file> <image> -+ * -+ * sample. -+ * +------------------------------------------------ -+ * |main 30 main.c main(argc, argv) -+ * |func 21 subr.c func(arg) -+ */ -+ static int -+ getentry(buf, tag, file, line) -+ char *buf, *tag, *file, *line; -+ { -+ char *p; -+ -+ p = tag; -+ while (*buf && !isspace(*buf)) /* tag name */ -+ *p++ = *buf++; -+ *p = 0; -+ while (*buf && isspace(*buf)) /* skip blanks */ -+ buf++; -+ p = line; -+ while (*buf && !isspace(*buf)) /* line no */ -+ *p++ = *buf++; -+ *p = 0; -+ while (*buf && isspace(*buf)) /* skip blanks */ -+ buf++; -+ p = file; -+ while (*buf && !isspace(*buf)) /* file name */ -+ *p++ = *buf++; -+ *p = 0; -+ -+ /* value check */ -+ if (strlen(tag) && strlen(line) && strlen(file) && atoi(line) > 0) -+ return 1; /* OK */ -+ return 0; /* ERROR */ -+ } -+ -+ /* -+ * gtag_get -- -+ * Get a gtag from the GTAGS files. -+ */ -+ static int -+ gtag_get(sp, ref, gtagselect, tag, tagp, filep, searchp) -+ SCR *sp; -+ int ref; -+ int *gtagselect; -+ char *tag, **tagp, **filep, **searchp; -+ { -+ static char name[80], file[200], line[10], gtagstmp[80]; -+ char command[200]; -+ char buf[BUFSIZ+1]; -+ FILE *fp; -+ -+ sprintf(gtagstmp, "%s.XXXXXXXX", _PATH_GTAGSTMP); -+ if (mktemp(gtagstmp) == 0) { -+ msgq(sp, M_ERR, "cannot generate temporary file name"); -+ return (1); -+ } -+ sprintf(command, "global -%s '%s' > %s; chmod 600 %s", -+ ref ? "rx" : "x", tag, gtagstmp, gtagstmp); -+ if (system(command)) { -+ msgq(sp, M_ERR, "cannot exec global"); -+ goto err; -+ } -+ if (!(fp = fopen(gtagstmp, "r"))) { -+ msgq(sp, M_ERR, "tag file cannot open."); -+ goto err; -+ } -+ if (!(fgets(buf, BUFSIZ, fp))) { -+ msgq(sp, M_ERR, "%s: tag not found", tag); -+ fclose(fp); -+ goto err; -+ } -+ -+ if (getentry(buf, name, file, line) == 0) { -+ msgq(sp, M_ERR, "%s: illegal tag entry", tag); -+ fclose(fp); -+ goto err; -+ } -+ -+ if (!(fgets(buf, BUFSIZ, fp))) { /* just one line */ -+ fclose(fp); -+ (void)unlink(gtagstmp); -+ *gtagselect = 0; /* go to user's file immediately */ -+ *tagp = strdup(name); -+ *filep = file; -+ *searchp = line; -+ if (*tagp == NULL) { -+ msgq(sp, M_SYSERR, NULL); -+ return (1); -+ } -+ return (0); -+ } -+ fclose(fp); -+ *gtagselect = 1; /* go to gtags select mode */ -+ *tagp = strdup(name); -+ *filep = gtagstmp; -+ *searchp = "1"; -+ if (*tagp == NULL) { -+ msgq(sp, M_SYSERR, NULL); -+ return (1); -+ } -+ return (0); -+ err: -+ (void)unlink(gtagstmp); -+ return (1); -+ } -+ -+ /* -+ * ex_gtagselect -- -+ * The tag code can be entered from gtag select mode. -+ */ -+ int -+ ex_gtagselect(sp, ep, cmdp) -+ SCR *sp; -+ EXF *ep; -+ EXCMDARG *cmdp; -+ { -+ if (!F_ISSET(sp->frp, FR_GTAGSTMP)) { -+ msgq(sp, M_ERR, "illegal tag entry"); -+ return (1); -+ } -+ cmdp->cmd = &cmds[C_TAG]; -+ cmdp->flags |= (E_GTAGSELECT|E_FORCE); -+ return ex_tagpush(sp, ep, cmdp); -+ } -+ -+ /* -+ * should_delete -- -+ * 1: should delete, 0: should not delete -+ */ -+ int -+ should_delete(gtagstmp) -+ char *gtagstmp; -+ { -+ SCR *sp; -+ TAG *tp; -+ int tagcnt = 0; -+ -+ /* make sure */ -+ if (strncmp(gtagstmp, _PATH_GTAGSTMP, strlen(_PATH_GTAGSTMP))) -+ return 0; -+ /* this gtag is generated by -t option. don't delete here */ -+ if (__global_list->gtagstmp && !strcmp(gtagstmp, __global_list->gtagstmp)) -+ return 0; -+ -+ for (sp = __global_list->dq.cqh_first; sp != (void *)&__global_list->dq; sp = sp->q.cqe_next) { -+ if (!EXP(sp)) -+ continue; -+ for (tp = EXP(sp)->tagq.tqh_first; tp != NULL; tp = tp->q.tqe_next) { -+ if (!tp->frp || !F_ISSET(tp->frp, FR_GTAGSTMP)) -+ continue; -+ if (!strcmp(tp->frp->name, gtagstmp)) -+ ++tagcnt; -+ } -+ } -+ if (tagcnt == 1) -+ return 1; -+ if (tagcnt > 1) -+ return 0; -+ /* IMPOSSIBLE */ -+ return 0; -+ } -+ #endif -+ - /* - * ex_tagfirst -- - * The tag code can be entered from main, i.e. "vi -t tag". -*************** -*** 86,96 **** ---- 298,317 ---- - u_int flags; - int sval; - char *p, *tag, *name, *search; -+ #ifdef GTAGS -+ int gtagselect = 0; -+ #endif - - /* Taglength may limit the number of characters. */ - if ((tl = O_VAL(sp, O_TAGLENGTH)) != 0 && strlen(tagarg) > tl) - tagarg[tl] = '\0'; - -+ #ifdef GTAGS -+ if (O_ISSET(sp, O_GTAGSMODE)) { -+ if (gtag_get(sp, 0, >agselect, tagarg, &tag, &name, &search)) -+ return (1); -+ } else -+ #endif - /* Get the tag information. */ - if (tag_get(sp, tagarg, &tag, &name, &search)) - return (1); -*************** -*** 106,111 **** ---- 327,336 ---- - * The historic tags file format (from a long, long time ago...) - * used a line number, not a search string. I got complaints, so - * people are still using the format. -+ #ifdef GTAGS -+ * Yes, gtags use the old format. Search string is very flexible -+ * but is not suitable to treat duplicate entries. -+ #endif - */ - if (isdigit(search[0])) { - m.lno = atoi(search); -*************** -*** 132,137 **** ---- 357,371 ---- - frp->lno = m.lno; - frp->cno = m.cno; - F_SET(frp, FR_CURSORSET); -+ #ifdef GTAGS -+ if (gtagselect) { -+ F_SET(frp, FR_GTAGSTMP); -+ if (!(sp->gp->gtagstmp = strdup(name))) { -+ msgq(sp, M_SYSERR, NULL); -+ return (1); -+ } -+ } -+ #endif - - /* Might as well make this the default tag. */ - if ((EXP(sp)->tlast = strdup(tagarg)) == NULL) { -*************** -*** 142,153 **** ---- 376,399 ---- - } - - /* Free a tag or tagf structure from a queue. */ -+ #ifdef GTAGS - #define FREETAG(tp) { \ -+ if (F_ISSET(tp->frp, FR_GTAGSTMP)) \ -+ if (should_delete(tp->frp->name)) \ -+ unlink(tp->frp->name); \ - TAILQ_REMOVE(&exp->tagq, (tp), q); \ - if ((tp)->search != NULL) \ - free((tp)->search); \ - FREE((tp), sizeof(TAGF)); \ - } -+ #else -+ #define FREETAG(tp) { \ -+ TAILQ_REMOVE(&exp->tagq, (tp), q); \ -+ if ((tp)->search != NULL) \ -+ free((tp)->search); \ -+ FREE((tp), sizeof(TAGF)); \ -+ } -+ #endif - #define FREETAGF(tfp) { \ - TAILQ_REMOVE(&exp->tagfq, (tfp), q); \ - free((tfp)->name); \ -*************** -*** 182,189 **** ---- 428,464 ---- - int sval; - long tl; - char *name, *p, *search, *tag; -+ #ifdef GTAGS -+ int gtagselect = 0; -+ char *line; -+ size_t len; -+ char tagbuf[80], namebuf[200], linebuf[10]; -+ #endif - - exp = EXP(sp); -+ #ifdef GTAGS -+ /* -+ * Enter from gtag select mode. -+ * get tag information from current line. -+ */ -+ if (F_ISSET(cmdp, E_GTAGSELECT)) { -+ if ((line = file_gline(sp, ep, sp->lno, &len)) == NULL) { -+ GETLINE_ERR(sp, sp->lno); -+ return (1); -+ } -+ if (getentry(line, tagbuf, namebuf, linebuf) == 0) { -+ msgq(sp, M_ERR, "illegal tag entry"); -+ return (1); -+ } -+ if (!(tag = strdup(tagbuf))) { -+ msgq(sp, M_SYSERR, NULL); -+ return (1); -+ } -+ name = namebuf; -+ search = linebuf; -+ goto getfref; -+ } -+ #endif - switch (cmdp->argc) { - case 1: - if (exp->tlast != NULL) -*************** -*** 207,216 **** ---- 482,504 ---- - if ((tl = O_VAL(sp, O_TAGLENGTH)) != 0 && strlen(exp->tlast) > tl) - exp->tlast[tl] = '\0'; - -+ #ifdef GTAGS -+ if (O_ISSET(sp, O_GTAGSMODE)) { -+ if (gtag_get(sp, F_ISSET(cmdp->cmd, E_REFERENCE), >agselect, -+ exp->tlast, &tag, &name, &search)) -+ return (1); -+ } else if (F_ISSET(cmdp->cmd, E_REFERENCE)) { -+ msgq(sp, M_ERR, "Please set gtagsmode"); -+ return (1); -+ } else -+ #endif - /* Get the tag information. */ - if (tag_get(sp, exp->tlast, &tag, &name, &search)) - return (1); - -+ #ifdef GTAGS -+ getfref: -+ #endif - /* Get the (possibly new) FREF structure. */ - if ((frp = file_add(sp, name)) == NULL) - goto err; -*************** -*** 305,310 **** ---- 593,603 ---- - sp->cno = m.cno; - break; - } -+ #ifdef GTAGS -+ if (gtagselect) { -+ F_SET(frp, FR_GTAGSTMP); -+ } -+ #endif - return (0); - } - -*************** -*** 490,495 **** ---- 783,793 ---- - for (cnt = 1, tp = exp->tagq.tqh_first; tp != NULL; - ++cnt, tp = tp->q.tqe_next) { - len = strlen(name = tp->frp->name); /* The original name. */ -+ #ifdef GTAGS -+ if (F_ISSET(tp->frp, FR_GTAGSTMP)) { -+ (void)ex_printf(EXCOOKIE, "%2d [GTAGS]\n", cnt); -+ } else -+ #endif - if (len > maxlen || len + tp->slen > sp->cols) - if (tp == NULL || tp->search == NULL) - (void)ex_printf(EXCOOKIE, -diff -c -r -N /usr/src/usr.bin/vi/ex/excmd.c ./ex/excmd.c -*** /usr/src/usr.bin/vi/ex/excmd.c Thu Aug 18 10:13:29 1994 ---- ./ex/excmd.c Sat Dec 14 11:54:15 1996 -*************** -*** 319,324 **** ---- 319,331 ---- - "!", - "rew[ind][!]", - "re-edit all the files in the file argument list"}, -+ #ifdef GTAGS -+ /* C_RTAG */ -+ {"rtag", ex_tagpush, E_NOGLOBAL|E_REFERENCE, -+ "!w1o", -+ "rta[g][!] [string]", -+ "edit the file containing the tag"}, -+ #endif - /* C_SUBSTITUTE */ - {"substitute", ex_substitute, E_ADDR2|E_NORC, - "s", -*************** -*** 329,334 **** ---- 336,348 ---- - "!f1o", - "sc[ript][!] [file]", - "run a shell in a screen"}, -+ #ifdef GTAGS -+ /* C_GTAGSELECT */ -+ {"select", ex_gtagselect, E_NOGLOBAL, -+ "", -+ "sel[ect]", -+ "edit the file containing the tag"}, -+ #endif - /* C_SET */ - {"set", ex_set, E_NOGLOBAL, - "wN", -diff -c -r -N /usr/src/usr.bin/vi/ex/excmd.h.stub ./ex/excmd.h.stub -*** /usr/src/usr.bin/vi/ex/excmd.h.stub Wed Aug 17 08:36:28 1994 ---- ./ex/excmd.h.stub Sat Dec 14 11:54:15 1996 -*************** -*** 69,74 **** ---- 69,79 ---- - #define E_NORC 0x0800000 /* Not from a .exrc or EXINIT. */ - #define E_ZERO 0x1000000 /* 0 is a legal addr1. */ - #define E_ZERODEF 0x2000000 /* 0 is default addr1 of empty files. */ -+ -+ #ifdef GTAGS -+ #define E_REFERENCE 0x4000000 /* locate function references */ -+ #define E_GTAGSELECT 0x8000000 /* current line is gtags entry */ -+ #endif - u_int32_t flags; - char *syntax; /* Syntax script. */ - char *usage; /* Usage line. */ -*************** -*** 234,239 **** ---- 239,245 ---- - EXPROTO(ex_fg); - EXPROTO(ex_file); - EXPROTO(ex_global); -+ EXPROTO(ex_gtagselect); - EXPROTO(ex_help); - EXPROTO(ex_insert); - EXPROTO(ex_join); -diff -c -r -N /usr/src/usr.bin/vi/svi/svi_refresh.c ./svi/svi_refresh.c -*** /usr/src/usr.bin/vi/svi/svi_refresh.c Tue May 30 15:35:56 1995 ---- ./svi/svi_refresh.c Sat Dec 14 11:54:16 1996 -*************** -*** 725,731 **** ---- 725,736 ---- - EXF *ep; - { - size_t cols, curlen, endpoint, len, midpoint; -+ #ifdef GTAGS -+ char *p, buf[30]; -+ recno_t last; -+ #else - char *p, buf[20]; -+ #endif - - /* Clear the mode line. */ - MOVE(sp, INFOLINE(sp), 0); -*************** -*** 746,751 **** ---- 751,765 ---- - - curlen = 0; - if (sp->q.cqe_next != (void *)&sp->gp->dq) { -+ #ifdef GTAGS -+ if (F_ISSET(sp->frp, FR_GTAGSTMP)) { -+ if (file_lline(sp, ep, &last)) { -+ return (1); -+ } -+ sprintf(buf, "[GTAGS SELECT MODE] %d lines", last); -+ p = buf; -+ } else { -+ #endif - for (p = sp->frp->name; *p != '\0'; ++p); - while (--p > sp->frp->name) { - if (*p == '/') { -*************** -*** 758,764 **** - break; - } - } -! - MOVE(sp, INFOLINE(sp), 0); - standout(); - for (; *p != '\0'; ++p) ---- 772,780 ---- - break; - } - } -! #ifdef GTAGS -! } -! #endif - MOVE(sp, INFOLINE(sp), 0); - standout(); - for (; *p != '\0'; ++p) -diff -c -r -N /usr/src/usr.bin/vi/vi/v_ex.c ./vi/v_ex.c -*** /usr/src/usr.bin/vi/vi/v_ex.c Thu Aug 18 10:15:03 1994 ---- ./vi/v_ex.c Sat Dec 14 11:54:16 1996 -*************** -*** 298,303 **** ---- 298,308 ---- - ARGS *ap[2], a; - EXCMDARG cmd; - -+ #ifdef GTAGS -+ if (O_ISSET(sp, O_GTAGSMODE) && vp->m_start.cno == 0) -+ excmd(&cmd, C_RTAG, 0, OOBLNO, 0, 0, ap, &a, vp->keyword); -+ else -+ #endif - excmd(&cmd, C_TAG, 0, OOBLNO, 0, 0, ap, &a, vp->keyword); - return (sp->s_ex_cmd(sp, ep, &cmd, &vp->m_final)); - } -diff -c -r -N /usr/src/usr.bin/vi/vi/v_scroll.c ./vi/v_scroll.c -*** /usr/src/usr.bin/vi/vi/v_scroll.c Thu Aug 18 10:15:15 1994 ---- ./vi/v_scroll.c Sat Dec 14 11:54:16 1996 -*************** -*** 255,260 **** ---- 255,269 ---- - EXF *ep; - VICMDARG *vp; - { -+ #ifdef GTAGS -+ EXCMDARG cmd; -+ -+ if (F_ISSET(sp->frp, FR_GTAGSTMP)) { -+ memset(&cmd, 0, sizeof(EXCMDARG)); -+ cmd.cmd = &cmds[C_GTAGSELECT]; -+ return (sp->s_ex_cmd(sp, ep, &cmd, &vp->m_final)); -+ } -+ #endif - /* - * If it's a script window, exec the line, - * otherwise it's the same as v_down(). diff --git a/contrib/global/systags/Makefile.generic b/contrib/global/systags/Makefile.generic deleted file mode 100644 index a1a5ca6df113..000000000000 --- a/contrib/global/systags/Makefile.generic +++ /dev/null @@ -1,8 +0,0 @@ -PROG = systags -BINDIR = /usr/bin - -all: -install: - cp $(PROG).sh $(BINDIR)/$(PROG) - chmod 755 $(BINDIR)/$(PROG) -clean: |