From 7cb55de6f5fe34cf96591b368ea2596664c34a99 Mon Sep 17 00:00:00 2001 From: cwt Date: Mon, 15 Dec 1997 23:23:35 +0000 Subject: Resolve -Wall issues and be stylistic about #include directives. --- contrib/global/btreeop/btreeop.c | 10 +- contrib/global/btreeop/err.c | 217 --------------------------- contrib/global/gctags/C.c | 4 +- contrib/global/gctags/ctags.h | 1 + contrib/global/gctags/err.c | 217 --------------------------- contrib/global/global/global.c | 31 ++-- contrib/global/global/global.pl | 302 -------------------------------------- contrib/global/gtags/gtags.c | 25 ++-- contrib/global/gtags/gtags.pl | 84 ----------- contrib/global/include/ansi.h | 93 ------------ contrib/global/include/cdefs.h | 158 -------------------- contrib/global/include/err.h | 62 -------- contrib/global/lib/dbio.c | 8 +- contrib/global/lib/dbio.h | 2 +- contrib/global/lib/find.c | 6 +- contrib/global/lib/find.h | 4 +- contrib/global/lib/getdbpath.c | 13 +- contrib/global/lib/gtagsopen.c | 11 +- contrib/global/lib/locatestring.c | 4 + contrib/global/lib/lookup.c | 2 +- contrib/global/lib/lookup.h | 2 +- contrib/global/lib/mgets.c | 2 + contrib/global/lib/strop.c | 10 +- contrib/global/lib/strop.h | 4 +- contrib/global/lib/tab.c | 2 + contrib/global/lib/tag.c | 9 +- contrib/global/lib/tag.h | 2 +- contrib/global/lib/test.c | 10 +- 28 files changed, 108 insertions(+), 1187 deletions(-) delete mode 100644 contrib/global/btreeop/err.c delete mode 100644 contrib/global/gctags/err.c delete mode 100644 contrib/global/global/global.pl delete mode 100644 contrib/global/gtags/gtags.pl delete mode 100644 contrib/global/include/ansi.h delete mode 100644 contrib/global/include/cdefs.h delete mode 100644 contrib/global/include/err.h diff --git a/contrib/global/btreeop/btreeop.c b/contrib/global/btreeop/btreeop.c index b82ff58..18160fb 100644 --- a/contrib/global/btreeop/btreeop.c +++ b/contrib/global/btreeop/btreeop.c @@ -32,7 +32,13 @@ * */ #include + +#include #include +#include +#include + +#include "dbio.h" #include "global.h" char *dbdefault = "btree"; /* default database name */ @@ -87,7 +93,7 @@ char *argv[]; { char command = 'R'; char *key = NULL; - int mode; + int mode = 0; char *dbname; DBIO *dbio; int i, c; @@ -188,7 +194,7 @@ DBIO *dbio; * +------------------ * | __.VERSION 2 */ - while (p = mgets(stdin, 0, NULL)) { + while ((p = mgets(stdin, 0, NULL)) != NULL) { if (exitflag) break; c = p; diff --git a/contrib/global/btreeop/err.c b/contrib/global/btreeop/err.c deleted file mode 100644 index bd84d46..0000000 --- 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 -#include -#include -#include -#include - -#ifdef __STDC__ -#include -#else -#include -#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/C.c b/contrib/global/gctags/C.c index df8fd2f..c2d59f1 100644 --- a/contrib/global/gctags/C.c +++ b/contrib/global/gctags/C.c @@ -35,12 +35,14 @@ static char sccsid[] = "@(#)C.c 8.4 (Berkeley) 4/2/94"; #endif /* LIBC_SCCS and not lint */ +#include #include #include -#include #include +#include #include "ctags.h" +#include "lookup.h" static int func_entry __P((void)); static void hash_entry __P((void)); diff --git a/contrib/global/gctags/ctags.h b/contrib/global/gctags/ctags.h index 7cd3733..8deb2f9 100644 --- a/contrib/global/gctags/ctags.h +++ b/contrib/global/gctags/ctags.h @@ -114,5 +114,6 @@ 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 9d20812..0000000 --- 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 -#include -#include -#include -#include - -#ifdef __STDC__ -#include -#else -#include -#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/global/global.c b/contrib/global/global/global.c index 492aaef..4a92fa4 100644 --- a/contrib/global/global/global.c +++ b/contrib/global/global/global.c @@ -31,17 +31,23 @@ * global.c 7-Nov-97 * */ -#include -#include + #include + +#include #include +#include +#include +#include +#include + #include "global.h" char *progname = "global"; /* command name */ static void usage __P((void)); void main __P((int, char **)); -char *outfilter __P(()); +char *outfilter __P((void)); void completelist __P((char *, char *)); void relative_filter __P((char *, char *, char *)); void grep __P((char *)); @@ -301,7 +307,7 @@ char *argv[]; p = envbuf; while (p) { lib = p; - if (p = locatestring(p, ":", 0)) + if ((p = locatestring(p, ":", 0)) != NULL) *p++ = 0; if (!strncmp(lib, cwd, strlen(cwd)) || !strncmp(cwd, lib, strlen(lib))) continue; @@ -341,7 +347,7 @@ char *argv[]; * r) output filter */ char * -outfilter() +outfilter(void) { static char filter[MAXCOMLINE+1]; @@ -459,7 +465,7 @@ int compact; int opened = 0; char path[MAXPATHLEN+1]; char *buffer; - int line, tagline; + int line = 0, tagline = 0; FILE *ip; if (!xflag) { @@ -483,7 +489,7 @@ int compact; ; lno = p; /* lno = $3 */ sprintf(path, "%s/%s", root, file + 2); - if (ip = fopen(path, "r")) { + if ((ip = fopen(path, "r")) != NULL) { opened = 1; buffer = mgets(ip, 0, NULL); line = 1; @@ -538,7 +544,7 @@ char *s; { int c; - while (c = *s++) + while ((c = *s++) != NULL) if ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || @@ -557,7 +563,7 @@ void grep(pattern) char *pattern; { - FILE *ip, *op, *fp; + FILE *op, *fp; char *path; char edit[IDENTLEN+1]; char *buffer, *p, *e; @@ -583,11 +589,11 @@ char *pattern; if (!(op = popen(outfilter(), "w"))) die("cannot open output pipe."); count = 0; - for (findopen(); path = findread(NULL); ) { + for (findopen(); (path = findread(NULL)) != NULL; ) { if (!(fp = fopen(path, "r"))) die1("cannot open file '%s'.", path); linenum = 0; - while (buffer = mgets(fp, 0, NULL)) { + while ((buffer = mgets(fp, 0, NULL)) != NULL) { linenum++; if (regexec(&preg, buffer, 0, 0, 0) == 0) { count++; @@ -656,7 +662,6 @@ int db; if (regexp(pattern) && regcomp(&preg, pattern, REG_EXTENDED) == 0) { char prefix_buf[IDENTLEN+1]; char *prefix = (char *)0; - int presize; if (*pattern == '^' && *(p = pattern + 1) && (isalpha(*p) || *p == '_')) { prefix = prefix_buf; @@ -711,7 +716,7 @@ char *line; if (!(p = locatestring(line, "./", 0))) die("illegal tag format (path not found)."); b = buf; - while (c = *b++ = *p++) { + while ((c = *b++ = *p++) != NULL) { if (c == ' ' || c == '\t') { *(b - 1) = 0; break; diff --git a/contrib/global/global/global.pl b/contrib/global/global/global.pl deleted file mode 100644 index 571bddb..0000000 --- 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 = ; -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 () { - 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 () { - local($tag) = split; - if (! $regex || $tag =~ /$pattern/o) { - $cnt++; - print PIPEOUT $_; - } - } - close(PIPEIN); - close(PIPEOUT); - $cnt; -} diff --git a/contrib/global/gtags/gtags.c b/contrib/global/gtags/gtags.c index ef4a8e9..10d27a6 100644 --- a/contrib/global/gtags/gtags.c +++ b/contrib/global/gtags/gtags.c @@ -31,9 +31,15 @@ * gtags.c 12-Dec-97 * */ + +#include + +#include #include #include -#include +#include +#include + #include "global.h" char *progname = "gtags"; /* command name */ @@ -43,13 +49,12 @@ void main __P((int, char **)); int incremental __P((char *)); void tagadd __P((int, char *)); void createtags __P((char *, int)); -char *current __P(()); +char *current __P((void)); static int iflag; static int oflag; static int vflag; -static int Dflag; -static int Rflag; + static void usage() @@ -65,8 +70,7 @@ char *argv[]; { char dbpath[MAXPATHLEN+1]; char env[MAXENVLEN+1]; - char *path, *p; - FILE *ip; + char *p; int db; while (--argc > 0 && (++argv)[0][0] == '-') { @@ -161,7 +165,7 @@ char *dbpath; die1("stat failed '%s'.", path); gtags_mtime = sb.st_mtime; - for (findopen(); path = findread(NULL); ) { + for (findopen(); (path = findread(NULL)) != NULL; ) { if (stat(path, &sb) < 0) die1("stat failed '%s'.", path); /* @@ -235,7 +239,7 @@ char *path; p = strclose(); if (!(ip = popen(p, "r"))) die1("cannot execute '%s'.", p); - while (tagline = mgets(ip, 0, NULL)) { + while ((tagline = mgets(ip, 0, NULL)) != NULL) { p = tagline; q = key; while (*p && !isspace(*p)) @@ -264,7 +268,7 @@ int db; if (db == GRTAGS) lookupopen(dbpath); tagopen(dbpath, db, 1); - for (findopen(); path = findread(NULL); ) { + for (findopen(); (path = findread(NULL)) != NULL; ) { /* * GRTAGS and GSYMS doesn't treat asembler. */ @@ -287,9 +291,8 @@ int db; * * r) date and time */ -#include char * -current() +current(void) { static char buf[80]; time_t tval; diff --git a/contrib/global/gtags/gtags.pl b/contrib/global/gtags/gtags.pl deleted file mode 100644 index 20c5877..0000000 --- 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 () { - 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 () { - print DB; - } - close(TAGS); - } - close(DB); - close(FIND); -} -exit 0; diff --git a/contrib/global/include/ansi.h b/contrib/global/include/ansi.h deleted file mode 100644 index 2d71f77..0000000 --- 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 fe2cd66..0000000 --- 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 f03c67d..0000000 --- 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 ( and ), 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 and use it. - */ -#include -#include - -__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/dbio.c b/contrib/global/lib/dbio.c index c569782..c29a914 100644 --- a/contrib/global/lib/dbio.c +++ b/contrib/global/lib/dbio.c @@ -31,10 +31,16 @@ * dbio.c 14-Dec-97 * */ -#include +#include + #include +#include +#include +#include + #include "dbio.h" #include "die.h" +#include "test.h" DBT key; /* key of record */ DBT dat; /* data of record */ diff --git a/contrib/global/lib/dbio.h b/contrib/global/lib/dbio.h index bc0abf4..7c1994e 100644 --- a/contrib/global/lib/dbio.h +++ b/contrib/global/lib/dbio.h @@ -82,7 +82,7 @@ typedef struct { DBIO *db_open __P((char *, int, int, int)); char *db_get __P((DBIO *, char *)); void db_put __P((DBIO *, char *, char *)); -void de_del __P((DBIO *, char *)); +void db_del __P((DBIO *, char *)); char *db_first __P((DBIO *, char *, int)); char *db_next __P((DBIO *)); void db_close __P((DBIO *)); diff --git a/contrib/global/lib/find.c b/contrib/global/lib/find.c index fd3537c..6203e00 100644 --- a/contrib/global/lib/find.c +++ b/contrib/global/lib/find.c @@ -73,7 +73,7 @@ int issource(path) char *path; { - char c, *p, *q; + char *p; if (!(p = locatestring(path, ".", 2))) return 0; @@ -88,7 +88,7 @@ char *path; } void -findopen() +findopen(void) { char edit[512], *p, *q; int i, lim; @@ -158,7 +158,7 @@ int *length; return (char *)0; } void -findclose() +findclose(void) { pclose(ip); opened = 0; diff --git a/contrib/global/lib/find.h b/contrib/global/lib/find.h index c745a19..bb140e0 100644 --- a/contrib/global/lib/find.h +++ b/contrib/global/lib/find.h @@ -44,8 +44,8 @@ #endif int issource __P((char *)); -void findopen __P(()); +void findopen __P((void)); char *findread __P((int *)); -void findclose __P(()); +void findclose __P((void)); #endif /* ! _FIND_H_ */ diff --git a/contrib/global/lib/getdbpath.c b/contrib/global/lib/getdbpath.c index 9c689da..fc4b635 100644 --- a/contrib/global/lib/getdbpath.c +++ b/contrib/global/lib/getdbpath.c @@ -34,9 +34,14 @@ #include #include #include + +#include #include + #include "die.h" +#include "getdbpath.h" #include "locatestring.h" +#include "test.h" static char *makeobjdirprefix; /* obj partition */ static char *makeobjdir; /* obj directory */ @@ -105,18 +110,18 @@ char *dbpath; die("It's root directory! What are you doing?"); if (getenv("OSTYPE") && locatestring(getenv("OSTYPE"), "BSD", 0)) { - if (p = getenv("MAKEOBJDIRPREFIX")) + if ((p = getenv("MAKEOBJDIRPREFIX")) != NULL) makeobjdirprefix = p; else makeobjdirprefix = "/usr/obj"; - if (p = getenv("MAKEOBJDIR")) + if ((p = getenv("MAKEOBJDIR")) != NULL) makeobjdir = p; else makeobjdir = "obj"; bsd = 1; } - if (p = getenv("GTAGSROOT")) { + if ((p = getenv("GTAGSROOT")) != NULL) { if (*p != '/') die("GTAGSROOT must be an absolute path."); if (stat(p, &sb) || !S_ISDIR(sb.st_mode)) @@ -125,7 +130,7 @@ char *dbpath; /* * GTAGSDBPATH is meaningful only when GTAGSROOT exist. */ - if (p = getenv("GTAGSDBPATH")) { + if ((p = getenv("GTAGSDBPATH")) != NULL) { if (*p != '/') die("GTAGSDBPATH must be an absolute path."); if (stat(p, &sb) || !S_ISDIR(sb.st_mode)) diff --git a/contrib/global/lib/gtagsopen.c b/contrib/global/lib/gtagsopen.c index 2331c4b..90f0481 100644 --- a/contrib/global/lib/gtagsopen.c +++ b/contrib/global/lib/gtagsopen.c @@ -32,12 +32,17 @@ * */ #include -#include + +#include #include +#include +#include + #include "dbio.h" +#include "dbname.h" #include "die.h" +#include "gtagsopen.h" #include "makepath.h" -#include "dbname.h" #define VERSIONKEY " __.VERSION" static int support_version = 1; /* accept this format version */ @@ -82,7 +87,7 @@ int mode; * if 'format version record' is not found, it's assumed * version 1. */ - if (p = db_get(dbio, VERSIONKEY)) { + if ((p = db_get(dbio, VERSIONKEY)) != NULL) { for (p += strlen(VERSIONKEY); *p && isspace(*p); p++) ; version_number = atoi(p); diff --git a/contrib/global/lib/locatestring.c b/contrib/global/lib/locatestring.c index f2aeecf..230ccce 100644 --- a/contrib/global/lib/locatestring.c +++ b/contrib/global/lib/locatestring.c @@ -31,6 +31,10 @@ * locatestring.c 20-Oct-97 * */ +#include + +#include "locatestring.h" + /* * locatestring: locate pattern from string * diff --git a/contrib/global/lib/lookup.c b/contrib/global/lib/lookup.c index 0583d6b..d317ba6 100644 --- a/contrib/global/lib/lookup.c +++ b/contrib/global/lib/lookup.c @@ -57,7 +57,7 @@ char *name; return (p) ? 1 : 0; } void -lookupclose() +lookupclose(void) { db_close(dbio); opened = 0; diff --git a/contrib/global/lib/lookup.h b/contrib/global/lib/lookup.h index cfe8c8e..037102f 100644 --- a/contrib/global/lib/lookup.h +++ b/contrib/global/lib/lookup.h @@ -45,6 +45,6 @@ void lookupopen __P((char *)); int lookup __P((char *)); -void lookupclose __P(()); +void lookupclose __P((void)); #endif /* ! _LOOKUP_H_ */ diff --git a/contrib/global/lib/mgets.c b/contrib/global/lib/mgets.c index 880338e..2bc6099 100644 --- a/contrib/global/lib/mgets.c +++ b/contrib/global/lib/mgets.c @@ -32,6 +32,8 @@ * */ #include +#include + #include "mgets.h" #include "die.h" diff --git a/contrib/global/lib/strop.c b/contrib/global/lib/strop.c index e15db16..b024abc 100644 --- a/contrib/global/lib/strop.c +++ b/contrib/global/lib/strop.c @@ -31,8 +31,12 @@ * strop.c 20-Oct-97 * */ -#include "strop.h" +#include +#include + #include "die.h" +#include "strop.h" + /* * usage: string buffer * @@ -49,7 +53,7 @@ static int sbufsize; static int opened; void -stropen() +stropen(void) { if (opened) die("nested call to stropen."); @@ -107,7 +111,7 @@ int c; *curp = 0; } char * -strclose() +strclose(void) { opened = 0; /* diff --git a/contrib/global/lib/strop.h b/contrib/global/lib/strop.h index aa9fa68..9289566 100644 --- a/contrib/global/lib/strop.h +++ b/contrib/global/lib/strop.h @@ -43,10 +43,10 @@ #endif #endif -void stropen __P(()); +void stropen __P((void)); void strputs __P((char *)); void strnputs __P((char *, int)); void strputc __P((int)); -char *strclose __P(()); +char *strclose __P((void)); #endif /* ! _STROP_H_ */ diff --git a/contrib/global/lib/tab.c b/contrib/global/lib/tab.c index 8f5adbf..d309386 100644 --- a/contrib/global/lib/tab.c +++ b/contrib/global/lib/tab.c @@ -33,6 +33,8 @@ */ #include +#include "tab.h" + #define TABPOS(i) ((i)%8 == 0) /* * detab: convert tabs into spaces and print diff --git a/contrib/global/lib/tag.c b/contrib/global/lib/tag.c index 81d9aae..e80d634 100644 --- a/contrib/global/lib/tag.c +++ b/contrib/global/lib/tag.c @@ -31,11 +31,16 @@ * tag.c 20-Oct-97 * */ +#include +#include + #include "dbio.h" #include "die.h" #include "gtagsopen.h" -#include "tag.h" #include "locatestring.h" +#include "tab.h" +#include "tag.h" + static DBIO *dbio; static int opened; @@ -73,7 +78,7 @@ char *path; } } void -tagclose() +tagclose(void) { db_close(dbio); opened = 0; diff --git a/contrib/global/lib/tag.h b/contrib/global/lib/tag.h index b12caaa..8bac2ac 100644 --- a/contrib/global/lib/tag.h +++ b/contrib/global/lib/tag.h @@ -46,6 +46,6 @@ void tagopen __P((char *, int, int)); void tagput __P((char *, char *)); void tagdelete __P((char *)); -void tagclose __P(()); +void tagclose __P((void)); #endif /* ! _TAG_H_ */ diff --git a/contrib/global/lib/test.c b/contrib/global/lib/test.c index 99aae9d..a3b5966 100644 --- a/contrib/global/lib/test.c +++ b/contrib/global/lib/test.c @@ -31,9 +31,13 @@ * test.c 12-Dec-97 * */ -#include -#include #include +#include + +#include + +#include "test.h" + /* * test: * @@ -60,7 +64,7 @@ char *path; if (stat(path, &sb) < 0) return 0; - while (c = *flags++) { + while ((c = *flags++) != NULL) { switch (c) { case 'f': if (!S_ISREG(sb.st_mode)) -- cgit v1.1