summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorcwt <cwt@FreeBSD.org>1998-02-02 05:38:11 +0000
committercwt <cwt@FreeBSD.org>1998-02-02 05:38:11 +0000
commit490818046d130f0f1520df3695f71a48ebf07726 (patch)
tree9255255c30b6556e64289ec5681d85476bf18937 /contrib
parent2d4696c8a0217d673b65b4f308e71d6ae8f5ebc6 (diff)
downloadFreeBSD-src-490818046d130f0f1520df3695f71a48ebf07726.zip
FreeBSD-src-490818046d130f0f1520df3695f71a48ebf07726.tar.gz
Global v2.24
Diffstat (limited to 'contrib')
-rw-r--r--contrib/global/COPYING77
-rw-r--r--contrib/global/HISTORY68
-rw-r--r--contrib/global/INSTALL10
-rw-r--r--contrib/global/MANIFEST2
-rw-r--r--contrib/global/README7
-rw-r--r--contrib/global/VERSION2
-rw-r--r--contrib/global/btreeop/btreeop.c10
-rw-r--r--contrib/global/gctags/C.c4
-rw-r--r--contrib/global/gctags/Makefile2
-rw-r--r--contrib/global/gctags/Makefile.generic3
-rw-r--r--contrib/global/gctags/assembler.c64
-rw-r--r--contrib/global/gctags/ctags.c2
-rw-r--r--contrib/global/gctags/ctags.h5
-rw-r--r--contrib/global/global/global.c31
-rw-r--r--contrib/global/gtags/Makefile2
-rw-r--r--contrib/global/gtags/gtags.c29
-rw-r--r--contrib/global/htags/htags.12
-rw-r--r--contrib/global/htags/htags.pl11
-rw-r--r--contrib/global/lib/dbio.c8
-rw-r--r--contrib/global/lib/dbio.h2
-rw-r--r--contrib/global/lib/find.c6
-rw-r--r--contrib/global/lib/find.h4
-rw-r--r--contrib/global/lib/getdbpath.c18
-rw-r--r--contrib/global/lib/gtagsopen.c11
-rw-r--r--contrib/global/lib/locatestring.c4
-rw-r--r--contrib/global/lib/lookup.c2
-rw-r--r--contrib/global/lib/lookup.h2
-rw-r--r--contrib/global/lib/mgets.c2
-rw-r--r--contrib/global/lib/strop.c10
-rw-r--r--contrib/global/lib/strop.h4
-rw-r--r--contrib/global/lib/tab.c2
-rw-r--r--contrib/global/lib/tag.c9
-rw-r--r--contrib/global/lib/tag.h2
-rw-r--r--contrib/global/lib/test.c10
34 files changed, 320 insertions, 107 deletions
diff --git a/contrib/global/COPYING b/contrib/global/COPYING
new file mode 100644
index 0000000..fb3baa4
--- /dev/null
+++ b/contrib/global/COPYING
@@ -0,0 +1,77 @@
+
+ @@@@@@@=
+ @= @=
+ @= @=
+ @= @= @@@@@= @@@@@@= @@= @=
+ @= F o r a l l h a c k e r s. @=@= @=
+ @= @@@@@@=@= @= @= @@@@@= @= @= @=
+ @= @= @= @= @= @= @= @@@@@= @=
+ @= @= @= @= @= @= @=@= @= @=
+ @@@@@@@@= @@@@= @@@@@= @@@@@@=@@@= @@@@= @@@@@@=
+
+This software is covered by the following:
+
+ Copyright (c) 1996, 1997, 1998 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.
+
+Portions of gozilla(1) are covered by the following:
+
+ Copyright 1996 Netscape Communications Corporation, all rights reserved.
+ Created: Jamie Zawinski <jwz@netscape.com>, 24-Dec-94.
+
+ Permission to use, copy, modify, distribute, and sell this software and
+ its documentation for any purpose is hereby granted without fee, provided
+ that the above copyright notice appear in all copies and that both that
+ copyright notice and this permission notice appear in supporting documen-
+ tation. No representations are made about the suitability of this soft-
+ ware for any purpose. It is provided "as is" without express or implied
+ warranty.
+
+ Copyright 1991 by Andreas Stolcke
+ Copyright 1990 by Solbourne Computer Inc.
+ Longmont, Colorado
+
+ All Rights Reserved.
+
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose and without fee is hereby granted,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation, and that the name of Solbourne not be used
+ in advertising in publicity pertaining to distribution of the software
+ without specific, written prior permission.
+
+ ANDREAS STOLCKE AND SOLBOURNE COMPUTER INC. DISCLAIMS ALL WARRANTIES WITH
+ REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
+ CHANTABILITY AND FITNESS, IN NO EVENT SHALL ANDREAS STOLCKE OR SOL-
+ BOURNE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ SOFTWARE.
diff --git a/contrib/global/HISTORY b/contrib/global/HISTORY
index 1f26bbb..d850075 100644
--- a/contrib/global/HISTORY
+++ b/contrib/global/HISTORY
@@ -1,11 +1,11 @@
GLOBAL history
--------------
-version 1.0 initial version [21-Apr-96]
+version 1.0 Initial version [21-Apr-96]
global, gtags, btreeop, extended ctags.
-version 1.1 only bugfix [2-May-96]
+version 1.1 Only bugfix [2-May-96]
[fixed bug]
global - makes corrupted path name by conversion error.
@@ -16,7 +16,7 @@ version 1.1 only bugfix [2-May-96]
to be a function name. With the result that GRTAGS becomes
too large.
-version 1.2 support of 1.34 nvi [7-Jun-96]
+version 1.2 Support of 1.34 nvi [7-Jun-96]
[changed]
extended ctags
@@ -28,7 +28,7 @@ version 1.2 support of 1.34 nvi [7-Jun-96]
extended vi
- VI tag support.
-version 1.3 support of GTAGSLIBPATH [28-Jul-96]
+version 1.3 Support of GTAGSLIBPATH [28-Jul-96]
[changed]
global - search not only in a source tree but also in library paths
@@ -36,7 +36,7 @@ version 1.3 support of GTAGSLIBPATH [28-Jul-96]
extended ctags
- change print format a little when -x option
-version 1.4 support of yacc source file [26-Oct-96]
+version 1.4 Support of yacc source file [26-Oct-96]
[changed]
extended ctags
@@ -46,7 +46,7 @@ version 1.4 support of yacc source file [26-Oct-96]
(original only 3rd part)
* no longer considers a yacc rule to be an object.
-version 1.5 hypertext generator [12-Dec-96]
+version 1.5 Hypertext generator [12-Dec-96]
[fixed bug]
gtags - treat 'y.tab.c' as a C source.(we should treat only *.y)
@@ -58,7 +58,7 @@ version 1.5 hypertext generator [12-Dec-96]
htags - new command (hypertext generator of C source file)
gtags - error check code added.
-version 1.6 support of 1.76 nvi and reconstruction for other OS [21-Jan-97]
+version 1.6 Support of 1.76 nvi and reconstruction for other OS [21-Jan-97]
[changed]
htags - cease using <BLOCKQUOTE> because lynx doesn't understand it.
@@ -82,7 +82,7 @@ version 1.6 support of 1.76 nvi and reconstruction for other OS [21-Jan-97]
global - -a option added.
-version 1.7 make suitable for large project (mainly FreeBSD kernel) [17-Feb-97]
+version 1.7 Make suitable for large project (mainly FreeBSD kernel) [17-Feb-97]
[changed]
htags - htags no longer makes frame.html. Index.html offers frame
@@ -103,7 +103,7 @@ version 1.7 make suitable for large project (mainly FreeBSD kernel) [17-Feb-97]
- script to make all tags (GTAGS,GRTAGS,HTML) for kernel source.
(it is only for FreeBSD and Linux)
-version 1.8 fix some bugs, add options and make more portable [5-Apr-97]
+version 1.8 Fix some bugs, add options and make more portable [5-Apr-97]
[changed]
gctags, btreeop, Makefile
@@ -135,7 +135,7 @@ version 1.8 fix some bugs, add options and make more portable [5-Apr-97]
htags - -d tagdir option added.
- -w option added.
-version 1.81 make global to understand 'obj' directory [14-Apr-97]
+version 1.81 Make global to understand 'obj' directory [14-Apr-97]
[fixed bug]
extended vi
@@ -144,7 +144,7 @@ version 1.81 make global to understand 'obj' directory [14-Apr-97]
global
- can find tag file in obj directory.
-version 1.9 support of 1.79 nvi and some additional options [21-Apr-97]
+version 1.9 Support of 1.79 nvi and some additional options [21-Apr-97]
[fixed bug]
htags - doesn't keep the code formatted correctly.
@@ -268,7 +268,7 @@ version 2.1 Symbol search, incremental update and gozilla [20-Sep-97]
- gtags-find-pattern command (ESC-g) added.
It is equal to global's -g option.
-version 2.11 only bugfix [7-Nov-97]
+version 2.11 Only bugfix [7-Nov-97]
[fixed bug]
htags, gtags
@@ -291,7 +291,7 @@ version 2.2 Rewritten with C for performance [7-Dec-97]
htags - shape up anchor database.
btreeop - some options (-b, -c, -l, -p) were deleted.
-version 2.21 bugfix and slightly modified [11-Dec-97]
+version 2.21 Bugfix and slightly modified [11-Dec-97]
[fixed bug]
gtags, global
@@ -313,3 +313,45 @@ version 2.21 bugfix and slightly modified [11-Dec-97]
htags/Makefile, systags/Makefile
- ${DESTDIR}/usr/bin -> ${DESTDIR}${BINDIR}
+
+version 2.22 GRTAGS support for assembler source [26-Dec-97]
+
+ [changed]
+ gtags, gctags, htags
+ - recognize following patterns as a function reference
+ to C function xxx().
+ call EXT(xxx)
+ call _xxx
+
+ Thanks to Yamashita TAKAO for his idea.
+
+version 2.23 Bugfix and slightly modified [13-Jan-98]
+
+ [fixed bug]
+ gctags - GRTAGS support in version 2.22 doesn't work.
+
+ Thanks to Yamashita TAKAO for his bug report.
+
+ [changed]
+ gctags/Makefile, gctags/Makefile.generic
+ - -DGLOBAL -DYACC was removed.
+ gctags/ctags.h
+ - #define GLOBAL 1 and #define YACC 1 were added.
+
+ [added]
+ COPYING - Copyright notice was added.
+
+version 2.24 Only bugfix [20-Jan-98]
+
+ [fixed bug]
+ global - generates wrong path name when GTAGSROOT includes symbolic
+ links.
+
+ Thanks to Wolfgang Helbig for his bug report.
+
+ htags - cannot treat path name which includes digit as the second
+ character like 'i386'. (In fact it was expand(1)'s bug.)
+
+ Thanks to Andrew Gallatin for his bug report.
+
+ global - doesn't search 'obj' directory correctly.
diff --git a/contrib/global/INSTALL b/contrib/global/INSTALL
index 98bd20c..d958971 100644
--- a/contrib/global/INSTALL
+++ b/contrib/global/INSTALL
@@ -1,7 +1,7 @@
-Installation of GLOBAL 2.21
+Installation of GLOBAL
- 11-Dec-1997 Shigio Yamaguchi
+ 20-Jan-1998 Shigio Yamaguchi
---------------------------------------------------------------------------
Guide line (C style)
---------------------------------------------------------------------------
@@ -49,8 +49,10 @@ Install procedure
0. Extracting
- % tar xzvf global-2.21.tar.gz
- % cd global-2.21
+ % tar xzvf global-XXX.tar.gz
+ % cd global-XXX
+
+ (XXX is version number.)
1. Preparation for generic UNIX
diff --git a/contrib/global/MANIFEST b/contrib/global/MANIFEST
index 82354c9..bf01ee8 100644
--- a/contrib/global/MANIFEST
+++ b/contrib/global/MANIFEST
@@ -1,3 +1,4 @@
+COPYING Copyright notice.
HISTORY Histroy of GLOBAL.
INSTALL Installation method
MANIFEST This file.
@@ -10,6 +11,7 @@ VERSION Version number.
btreeop/ Btreeop command directory.
global/ Global command directory.
gozilla/ Gozilla command directory.
+gctags/ Extended ctags command directory.
gtags/ Gtags command directory.
htags/ Htags command directory.
systags/ Script for kernel.
diff --git a/contrib/global/README b/contrib/global/README
index f4699f2..584c818 100644
--- a/contrib/global/README
+++ b/contrib/global/README
@@ -3,15 +3,16 @@
@= @=
@= @=
@= @= @@@@@= @@@@@@= @@= @=
- @= F o r a l l h a c k e r s. version 2.21
+ @= F o r a l l h a c k e r s.
@= @@@@@@=@= @= @= @@@@@= @= @= @=
@= @= @= @= @= @= @= @@@@@= @=
@= @= @= @= @= @= @=@= @= @=
@@@@@@@@= @@@@= @@@@@= @@@@@@=@@@= @@@@= @@@@@@=
- Shigio Yamaguchi 11-Dec-97
+ Shigio Yamaguchi 20-Jan-98
- Copyright 1996, 1997 Shigio Yamaguchi All right resereved.
+ Copyright 1996, 1997, 1998
+ Shigio Yamaguchi All right resereved.
----------------------------------------------------------
Note:
diff --git a/contrib/global/VERSION b/contrib/global/VERSION
index 2ef40bd..fd6915c 100644
--- a/contrib/global/VERSION
+++ b/contrib/global/VERSION
@@ -1 +1 @@
-2.21
+2.24
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 <sys/stat.h>
+
+#include <ctype.h>
#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+
+#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/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 <ctype.h>
#include <limits.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#include "ctags.h"
+#include "lookup.h"
static int func_entry __P((void));
static void hash_entry __P((void));
diff --git a/contrib/global/gctags/Makefile b/contrib/global/gctags/Makefile
index e60217f..bdecdfb 100644
--- a/contrib/global/gctags/Makefile
+++ b/contrib/global/gctags/Makefile
@@ -1,5 +1,5 @@
PROG= gctags
-CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../lib -DGLOBAL -DYACC
+CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../lib
LDADD= $(LIBUTIL)
DPADD= $(LIBUTIL)
SRCS= C.c ctags.c fortran.c lisp.c print.c tree.c yacc.c assembler.c
diff --git a/contrib/global/gctags/Makefile.generic b/contrib/global/gctags/Makefile.generic
index 6505c67..0c463a3 100644
--- a/contrib/global/gctags/Makefile.generic
+++ b/contrib/global/gctags/Makefile.generic
@@ -1,7 +1,6 @@
PROG = gctags
-DEFS = -DGLOBAL -DYACC
CC = gcc
-CFLAGS = -O $(DEFS) -I../lib -I/usr/include/db
+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
diff --git a/contrib/global/gctags/assembler.c b/contrib/global/gctags/assembler.c
index 2cd2d07..44d5aec 100644
--- a/contrib/global/gctags/assembler.c
+++ b/contrib/global/gctags/assembler.c
@@ -35,9 +35,12 @@
static char sccsid[] = "@(#)assembler.c 8.3 (Berkeley) 6/6/97";
#endif /* LIBC_SCCS and not lint */
+#include <ctype.h>
#include <stdio.h>
#include <string.h>
+
#include "ctags.h"
+#include "lookup.h"
#ifdef GLOBAL
void
@@ -52,22 +55,51 @@ asm_entries()
if (!fgets(lbuf, sizeof(lbuf), inf))
return;
++lineno;
- /* extract only ENTRY() and ALTENTRY(). */
- if (lbuf[0] != 'E' && lbuf[0] != 'A')
- continue;
- lbp = lbuf;
- if (!strncmp(lbp, "ENTRY(", 6)) {
- lbp += 6;
- } else if (!strncmp(lbp, "ALTENTRY(", 9)) {
- lbp += 9;
- } else
- continue;
- sp = tok;
- while (*lbp && intoken(*lbp))
- *sp++ = *lbp++;
- if (*lbp != ')')
- continue;
- *sp = EOS;
+ if (rflag) {
+ /* extract only call EXT(xxx) or call _xxx */
+ lbp = lbuf;
+ while (*lbp && isspace(*lbp))
+ lbp++;
+ if (*lbp != 'c' || strncmp(lbp, "call", 4))
+ continue;
+ lbp += 4;
+ while (*lbp && isspace(*lbp))
+ lbp++;
+ sp = tok;
+ if (!strncmp(lbp, "EXT(" /* ) */, 4)) {
+ lbp += 4;
+ while (*lbp && intoken(*lbp))
+ *sp++ = *lbp++;
+ if (*lbp != /* ( */ ')')
+ continue;
+ *sp = EOS;
+ } else if (*lbp == '_') {
+ lbp++;
+ while (*lbp && intoken(*lbp))
+ *sp++ = *lbp++;
+ *sp = EOS;
+ } else
+ continue;
+ if (!lookup(tok))
+ continue;
+ } else {
+ /* extract only ENTRY() and ALTENTRY(). */
+ if (lbuf[0] != 'E' && lbuf[0] != 'A')
+ continue;
+ lbp = lbuf;
+ if (!strncmp(lbp, "ENTRY(", 6)) {
+ lbp += 6;
+ } else if (!strncmp(lbp, "ALTENTRY(", 9)) {
+ lbp += 9;
+ } else
+ continue;
+ sp = tok;
+ while (*lbp && intoken(*lbp))
+ *sp++ = *lbp++;
+ if (*lbp != /* ( */ ')')
+ continue;
+ *sp = EOS;
+ }
getline();
pfnote(tok, lineno);
}
diff --git a/contrib/global/gctags/ctags.c b/contrib/global/gctags/ctags.c
index 0253ab5..d79a348 100644
--- a/contrib/global/gctags/ctags.c
+++ b/contrib/global/gctags/ctags.c
@@ -39,7 +39,7 @@ static const char copyright[] =
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] =
- "$Id: ctags.c,v 1.3 1997/07/10 06:43:40 charnier Exp $";
+ "$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>
diff --git a/contrib/global/gctags/ctags.h b/contrib/global/gctags/ctags.h
index 7cd3733..e843032 100644
--- a/contrib/global/gctags/ctags.h
+++ b/contrib/global/gctags/ctags.h
@@ -33,6 +33,10 @@
* @(#)ctags.h 8.3 (Berkeley) 4/2/94
*/
+/* Definition for gctags */
+#define GLOBAL 1
+#define YACC 1
+
#define bool char
#define YES 1
@@ -114,5 +118,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/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 <stdio.h>
-#include <stdlib.h>
+
#include <sys/stat.h>
+
+#include <ctype.h>
#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
#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/gtags/Makefile b/contrib/global/gtags/Makefile
index 803253c..9afed80 100644
--- a/contrib/global/gtags/Makefile
+++ b/contrib/global/gtags/Makefile
@@ -1,5 +1,5 @@
PROG= gtags
-CFLAGS+=-I${.CURDIR}/../lib -DGLOBAL -DYACC
+CFLAGS+=-I${.CURDIR}/../lib
LDADD= $(LIBUTIL)
DPADD= $(LIBUTIL)
diff --git a/contrib/global/gtags/gtags.c b/contrib/global/gtags/gtags.c
index ef4a8e9..288c16c 100644
--- a/contrib/global/gtags/gtags.c
+++ b/contrib/global/gtags/gtags.c
@@ -31,9 +31,15 @@
* gtags.c 12-Dec-97
*
*/
+
+#include <sys/stat.h>
+
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
-#include <sys/stat.h>
+#include <time.h>
+#include <unistd.h>
+
#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,11 +268,11 @@ 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.
+ * GSYMS doesn't treat asembler.
*/
- if (db != GTAGS) {
+ if (db == GSYMS) {
char *p = path + strlen(path) - 1;
if ((*p == 's' || *p == 'S') && *(p - 1) == '.')
continue;
@@ -287,9 +291,8 @@ int db;
*
* r) date and time
*/
-#include <time.h>
char *
-current()
+current(void)
{
static char buf[80];
time_t tval;
diff --git a/contrib/global/htags/htags.1 b/contrib/global/htags/htags.1
index 1e14c47..e2f0355 100644
--- a/contrib/global/htags/htags.1
+++ b/contrib/global/htags/htags.1
@@ -82,7 +82,7 @@ print warning message.
.It Fl d Ar tagdir
the directory in which GTAGS and GRTAGS exist. Default is current directory.
.It Fl t Ar title
-Tile of this hypertext. Default is the last conponent of current path.
+Tile of this hypertext. Default is the last component of current path.
.It Ar dir
the directory in which hypertext generated. Default is current directory.
.Sh EXAMPLES
diff --git a/contrib/global/htags/htags.pl b/contrib/global/htags/htags.pl
index 3ac1207..e4e6de8 100644
--- a/contrib/global/htags/htags.pl
+++ b/contrib/global/htags/htags.pl
@@ -29,7 +29,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# htags.pl 31-Oct-97
+# htags.pl 20-Jan-98
#
$com = $0;
$com =~ s/.*\///;
@@ -429,7 +429,6 @@ sub makeline {
$_[0] =~ s/^$tag/<A HREF=..\/$SRCS\/$filename.html#$lno>$tag<\/A>/;
}
sub makedupindex {
- local($expand) = &'usable('expand') ? 'expand' : 'cat';
local($count) = 0;
foreach $db ('GRTAGS', 'GTAGS') {
@@ -774,10 +773,10 @@ sub makehtml {
$count++;
chop;
- s/^\.\///;
local($path) = $_;
+ $path =~ s/^\.\///;
+ print STDERR " [$count/$total] converting $path\n" if ($vflag);
$path =~ s/\//$SEP/g;
- print STDERR " [$count/$total] converting $_\n" if ($vflag);
&convert'src2html($_, "$html/$SRCS/$path.html");
}
close(FIND);
@@ -805,12 +804,12 @@ sub src2html {
#
# load tags belonging to this file.
#
- $file =~ s/^\.\///;
&anchor'load($file);
open(C, "$expand '$file' |") || &'error("cannot open file '$file'.");
#
# print the header
#
+ $file =~ s/^\.\///;
print "<HTML>\n<HEAD><TITLE>$file</TITLE></HEAD>\n";
print "<BODY><A NAME=TOP><H2>$file</H2>\n";
print &link_format(&anchor'getlinks(0));
@@ -891,7 +890,7 @@ sub src2html {
$href = "<A HREF=../$dir/$TAG.html>$TAG</A>";
}
# set tag marks and save hyperlink into @links
- if (s/\b$TAG\b/\005$count\005/) {
+ if (s/\b$TAG\b/\005$count\005/ || s/\b_$TAG\b/_\005$count\005/) {
$count++;
push(@links, $href);
} else {
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 <stdlib.h>
+#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 */
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..1e4e7cf 100644
--- a/contrib/global/lib/getdbpath.c
+++ b/contrib/global/lib/getdbpath.c
@@ -34,9 +34,14 @@
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
+
+#include <unistd.h>
#include <stdlib.h>
+
#include "die.h"
+#include "getdbpath.h"
#include "locatestring.h"
+#include "test.h"
static char *makeobjdirprefix; /* obj partition */
static char *makeobjdir; /* obj directory */
@@ -64,7 +69,7 @@ char *dbpath;
if (bsd) {
sprintf(path, "%s/%s/GTAGS", candidate, makeobjdir);
if (test("fr", path)) {
- sprintf(dbpath, "%s%s", candidate, makeobjdir);
+ sprintf(dbpath, "%s/%s", candidate, makeobjdir);
return 1;
}
sprintf(path, "%s%s/GTAGS", makeobjdirprefix, candidate);
@@ -105,27 +110,28 @@ 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))
die1("directory '%s' not found.", p);
- strcpy(root, p);
+ if (realpath(p, root) == NULL)
+ die1("cannot get real path of '%s'.", p);
/*
* 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 <sys/param.h>
-#include <fcntl.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"
-#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 <string.h>
+
+#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 <stdio.h>
+#include <stdlib.h>
+
#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 <stdlib.h>
+#include <string.h>
+
#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 <stdio.h>
+#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 <ctype.h>
+#include <string.h>
+
#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 <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <unistd.h>
+
+#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))
OpenPOWER on IntegriCloud