summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/global/COPYING80
-rw-r--r--contrib/global/FAQ67
-rwxr-xr-xcontrib/global/FREEBSD-upgrade36
-rw-r--r--contrib/global/HISTORY565
-rw-r--r--contrib/global/INSTALL221
-rw-r--r--contrib/global/MANIFEST24
-rw-r--r--contrib/global/Makefile3
-rw-r--r--contrib/global/Makefile.inc16
-rw-r--r--contrib/global/README972
-rw-r--r--contrib/global/VERSION1
-rw-r--r--contrib/global/btreeop/Makefile3
-rw-r--r--contrib/global/btreeop/btreeop.1172
-rw-r--r--contrib/global/btreeop/btreeop.c369
-rw-r--r--contrib/global/dbpatches/README37
-rw-r--r--contrib/global/dbpatches/patch.1.219
-rw-r--r--contrib/global/dbpatches/patch.1.337
-rw-r--r--contrib/global/dbpatches/patch.1.422
-rw-r--r--contrib/global/gctags/C.c477
-rw-r--r--contrib/global/gctags/C.h92
-rw-r--r--contrib/global/gctags/Makefile4
-rw-r--r--contrib/global/gctags/assembler.c137
-rw-r--r--contrib/global/gctags/gctags.1143
-rw-r--r--contrib/global/gctags/gctags.c181
-rw-r--r--contrib/global/gctags/gctags.h91
-rw-r--r--contrib/global/gctags/java.c240
-rw-r--r--contrib/global/gctags/java.h91
-rw-r--r--contrib/global/gctags/test/ctags.test67
-rw-r--r--contrib/global/global.conf157
-rw-r--r--contrib/global/global/Makefile3
-rw-r--r--contrib/global/global/global.1195
-rw-r--r--contrib/global/global/global.c907
-rw-r--r--contrib/global/gozilla/Imakefile24
-rw-r--r--contrib/global/gozilla/gozilla.c228
-rw-r--r--contrib/global/gozilla/gozilla.man145
-rw-r--r--contrib/global/gozilla/remote.c717
-rw-r--r--contrib/global/gozilla/vroot.h119
-rw-r--r--contrib/global/gtags.el368
-rw-r--r--contrib/global/gtags/Makefile3
-rw-r--r--contrib/global/gtags/gtags.1105
-rw-r--r--contrib/global/gtags/gtags.c489
-rw-r--r--contrib/global/htags/Makefile7
-rw-r--r--contrib/global/htags/htags.1139
-rw-r--r--contrib/global/htags/htags.pl1595
-rw-r--r--contrib/global/lib/Makefile9
-rw-r--r--contrib/global/lib/conf.c308
-rw-r--r--contrib/global/lib/conf.h54
-rw-r--r--contrib/global/lib/dbop.c332
-rw-r--r--contrib/global/lib/dbop.h88
-rw-r--r--contrib/global/lib/defined.c66
-rw-r--r--contrib/global/lib/defined.h48
-rw-r--r--contrib/global/lib/die.h53
-rw-r--r--contrib/global/lib/find.c445
-rw-r--r--contrib/global/lib/find.h51
-rw-r--r--contrib/global/lib/getdbpath.c154
-rw-r--r--contrib/global/lib/getdbpath.h49
-rw-r--r--contrib/global/lib/global.h57
-rw-r--r--contrib/global/lib/gparam.h44
-rw-r--r--contrib/global/lib/gtagsop.c644
-rw-r--r--contrib/global/lib/gtagsop.h109
-rw-r--r--contrib/global/lib/locatestring.c75
-rw-r--r--contrib/global/lib/locatestring.h53
-rw-r--r--contrib/global/lib/makepath.c67
-rw-r--r--contrib/global/lib/makepath.h48
-rw-r--r--contrib/global/lib/mgets.c137
-rw-r--r--contrib/global/lib/mgets.h52
-rw-r--r--contrib/global/lib/pathop.c155
-rw-r--r--contrib/global/lib/pathop.h59
-rw-r--r--contrib/global/lib/strbuf.c137
-rw-r--r--contrib/global/lib/strbuf.h82
-rw-r--r--contrib/global/lib/strmake.c59
-rw-r--r--contrib/global/lib/strmake.h48
-rw-r--r--contrib/global/lib/tab.c120
-rw-r--r--contrib/global/lib/tab.h50
-rw-r--r--contrib/global/lib/test.c96
-rw-r--r--contrib/global/lib/test.h48
-rw-r--r--contrib/global/lib/token.c293
-rw-r--r--contrib/global/lib/token.h75
-rw-r--r--contrib/global/lib/usable.c70
-rw-r--r--contrib/global/lib/usable.h48
-rw-r--r--contrib/global/nvi-1.66.diff673
-rw-r--r--contrib/global/nvi-1.79.diff674
-rw-r--r--contrib/global/systags/Makefile5
-rwxr-xr-xcontrib/global/systags/systags.sh247
83 files changed, 0 insertions, 15250 deletions
diff --git a/contrib/global/COPYING b/contrib/global/COPYING
deleted file mode 100644
index a13b649..0000000
--- a/contrib/global/COPYING
+++ /dev/null
@@ -1,80 +0,0 @@
-
- @@@@@@@=)))
- @=))) @=))) @=)))
- @=))) @=)))
- @=))) @=))) @@@@@=)@@@@@@=))) @@=) @=)))
- @=))F o r a l l)) h a c k e r s.))) @=@=))@=)))
- @=))) @@@@@@=@=)))@=))) @=)@@@@@=)))@= @=))@=)))
- @=))) @=))@=)))@=))) @=)@=)))@=)@@@@@=))@=)))
- @=))) @=))@=)))@=))) @=)@=)))@=@=)))@=))@=)))
- @@@@@@@@=)))@@@@=)@@@@@=)@@@@@@=@@@=)@@@@=)@@@@@@=)))
-
-
-
-This software is covered by the followings:
-
- 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):
-
- 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/FAQ b/contrib/global/FAQ
deleted file mode 100644
index 01697ff..0000000
--- a/contrib/global/FAQ
+++ /dev/null
@@ -1,67 +0,0 @@
-
-Frequentry Asked Questions about GLOBAL.
-
-----------------------------------------------------------------------------
-Q1. Htags(1) aborts by short of memory. Why? Any workaround?
-
- % htags
- Out of memory!
- % _
-
-A1. It seems that Perl4 leaks memory. If you use that version of perl,
- then you had better to use Perl5. This works well.
-
-----------------------------------------------------------------------------
-Q2. Global(1) and btreeop(1) sometimes core dumps when using a large tag file.
- Any workaround?
-
-A2. Btree(3) core dumps with a certain data set.
- Please apply the patches in this package. See ./dbpatches/README.
-
-----------------------------------------------------------------------------
-Q3. GLOBAL skip some functions.
- For example, GLOBAL skip the function 'func' in this example.
-
- #define M(a) static char *string = a;
-
- M(a)
-
- func() { <= GLOBAL skip func().
- ...
- }
-
-A3. GLOBAL cannot recognize that pattern, because M(a) seems to be
- a function definition.
-
- It should be follows.
-
- #define M(a) static char *string = a
-
- M(a); <= end with ';'
-
- func() {
- ...
- }
-
- Otherwise, you can tell gtags(1) that by listing the macros in
- '.notfunction' file in current directory.
-
- [.notfunction]
- +---------------
- |M
- |...
-
-----------------------------------------------------------------------------
-Q4. I have set up 'global.conf' to use emacs's ctags command with GLOBAL
- but I cannot use htags.
-
- % gtags
- % htags
- htags: GTAGS and GRTAGS not found. Please make them.
- % ls G*
- GPATH GTAGS
-
-A4. Emacs's ctags cannot locate function referencies. So, gtags cannot make
- GRTAGS tag file with it. With the result that you cannot use htags and
- global's -r option.
-----------------------------------------------------------------------------
diff --git a/contrib/global/FREEBSD-upgrade b/contrib/global/FREEBSD-upgrade
deleted file mode 100755
index bf345b7..0000000
--- a/contrib/global/FREEBSD-upgrade
+++ /dev/null
@@ -1,36 +0,0 @@
-GLOBAL
-
-This directory contains virgin sources of the original distribution files on
-a "vendor" branch. Do not, under any circumstances, attempt to upgrade the
-files in this directory via patches and a cvs commit. New versions or
-official-patch versions must be imported.
-
-Before attempting an upgrade, please read the section entitled "Contributed
-Software" in the FreeBSD Handbook (from which this file is derived.) New
-releases of the source should be imported onto the vendor branch and merged
-with the FreeBSD-customized sources that live on the main branch.
-
-To upgrade to a newer version, when it is available:
- 1. Unpack the new version into an empty directory.
- [Do not make ANY changes to the files.]
-
- 2. Remove any files that don't apply to FreeBSD.
-
- 3. Use the command:
- cvs import -m 'Virgin import of GLOBAL v<version>' \
- src/contrib/global GLOBAL v<version>
-
- 4. Follow the instructions printed out in step 3 to resolve any
- conflicts between local FreeBSD changes and the newer version.
-
-Do not, under any circumstances, deviate from this procedure.
-
-To make local changes, simply patch and commit to the main branch (aka HEAD).
-Never make local changes on the GLOBAL vendor branch.
-
-Please submit changes to GLOBAL's author, Shigio Yamaguchi
-<shigio@tamacom.com> for inclusion in his next release. The most recent
-release of GLOBAL is available at the author's web page:
-http://www.tamacom.com/global/
-
-cwt@freebsd.org - July 1997
diff --git a/contrib/global/HISTORY b/contrib/global/HISTORY
deleted file mode 100644
index 2b8072a..0000000
--- a/contrib/global/HISTORY
+++ /dev/null
@@ -1,565 +0,0 @@
-
-GLOBAL history
---------------
-
-version 1.0 Initial version [21-Apr-96]
-
- global, gtags, btreeop, extended ctags.
-
- Thanks to Sadaichi Hayashida. Generating relative path is his idea.
-
-version 1.1 Only bugfix [2-May-96]
-
- [fixed bug]
- global - makes corrupted path name by conversion error.
- - description of exit code in online manual is mistaken.
- btreeop - cannot treat a long line over BUFSIZ. With the result
- that gtags fails.
- extended ctags - when using -r option, considers a reserved word
- to be a function name. With the result that GRTAGS becomes
- too large.
-
-version 1.2 Support of 1.34 nvi [7-Jun-96]
-
- [changed]
- extended ctags
- - change to use bsearch(3) for searching reserved words.
- - change to consider '__P' as a reserved word.
- - unify the original patch (included in version1.0) and
- the bugfix patch (included in version1.1).
- [added]
- extended vi
- - VI tag support.
-
-version 1.3 Support of GTAGSLIBPATH [28-Jul-96]
-
- [changed]
- global - search not only in a source tree but also in library paths
- specified by environment variable GTAGSLIBPATH.
- extended ctags
- - change print format a little when -x option
-
-version 1.4 Support of yacc source file [26-Oct-96]
-
- [changed]
- extended ctags
- - support of yacc source file.
- - this version of ctags is NOT COMPATIBLE with original one.
- * search all part of a yacc file for C functions.
- (original only 3rd part)
- * no longer considers a yacc rule to be an object.
-
-version 1.5 Hypertext generator [12-Dec-96]
-
- [fixed bug]
- gtags - treat 'y.tab.c' as a C source.(we should treat only *.y)
- extended vi
- - free stack memory. free(3) in FreeBSD 2.1.5R seems to
- show a warning message when receive stack address.
- So it spoils the screen.
- [added]
- 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]
-
- [changed]
- htags - cease using <BLOCKQUOTE> because lynx doesn't understand it.
- global,htags
- - replace 'sort -u' with 'sort | uniq' for compatibility reason.
- [fixed bug]
- global - makes illegal path name when using GTAGSLIBPATH.
- gtags - error message mistaken.
- [added]
- nvi-1.76.diff
- - patch for nvi 1.76 to make extended vi.
- gctags - this is the same with extended ctags in older version.
- now GLOBAL includes BSD ctags in it. so no longer has
- patch file (ctags.diff).
- (I brought original ctags from FreeBSD 2.1.5R)
-
- Thanks to
- Gary Kline
- Hideki Mori
- for their advice.
-
- global - -a option added.
-
-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
- function too.
- - works MUCH faster than previous version.
- [fixed bug]
- htags - generate path name including '&param'. (It means special
- charactor in hypertertext.)
- So, changed internal separator from '&' to '|'.
- [added]
- gtags - -s option added. If specified, gtags extract ENTRY() and
- ALTENTRY() from *.[sS] files.
- htags - support one level nested index. It's always valid for file
- index when directories found, and valid for function index
- only when -a option specified.
- - -v and -t option added.
- systags.sh
- - 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]
-
- [changed]
- gctags, btreeop, Makefile
- - modify for generic UNIX (Linux, Solaris)
- - modify to quiet compiler.
-
- Many thanks to
- A.E. Brouwer
- Oleg Checkulaev
- Emile Heyns
-
- gctags - modify to treat '\r' at the end of line.
- htags - changed internal separator from '|' to ' '.
- because some OS cannot treat '|' in a path.
- [fixed bug]
- htags - regard a part of path in #include as a reserved word.
- - generate illegal links when same tags exist in a line.
- - insufficient comment detection.
-
- Thanks to Jeffrey Friedl. I took his code for complete
- comment detection.
-
- gctags - regard function name as a definition in extern statement.
- - skip macro(no argment) body when -r specified.
- gctags, htags
- - regard 'entry' as a reserved word.
- [added]
- global - -c (complete) option added.
- htags - -d tagdir option added.
- - -w option added.
-
-version 1.81 Make global to understand 'obj' directory [14-Apr-97]
-
- [fixed bug]
- extended vi
- - doesn't hand '\' in a pattern to global.
- [changed]
- global
- - can find tag file in obj directory.
-
-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.
- So, changed to convert tabs in source files into spaces.
- (expand(1) needed)
-
- Thanks to Andy Newman for his bug report and fix method.
-
- - cannot print error message correctly.
- [changed]
- gctags, btreeop
- - modify for SunOS 4.1.3.
-
- Thanks to Yoshiharu Ito for his information.
-
- [added]
- btreeop - META record is available.
- (It will be used in the furture.)
- - -A and -D option added.
- (It will be used in the future.)
- global - 'format version record' is available.
- (It will be used in the furture.)
- htags - use temporary directory specified by TMPDIR environment
- variable.
- - -l option added.
-
- Thanks to Jeff Trawick. This option is his idea.
-
- nvi-1.79.diff
- - patch for nvi 1.79 to make extended vi.
-
-version 2.0 Support of Emacs and CGI Form [7-Jul-97]
-
- [fixed bug]
- gtags, htags
- - treat files under 'RCS/' or 'SCCS/' directory.
- global - allow relative path of GTAGSDBPATH and GTAGSROOT.
- htags - illegal tag generated when no definition found.
- [changed]
- htags - changed not to print line number by default.
- If you need it, -n option should be specified.
- - added the command name to error message.
- - avoid sort(1)'s bug.
- - changed for performance.
- systags - use -n, -f option for htags by default.
- doesn't use -w option for htags by default.
- gtags - rewritten with perl.
- gtags, gctags
- - move some code for assembler source from gtags to gctags.
- gtags, htags, global
- - restrict PATH to '/bin:/usr/bin'.
- btreeop - expand tabs into spaces of output.
- [deleted]
- nvi-1.76.diff
- [added]
- gtags.el- emacs support (emulation of 1.34 nvi) added.
- htags - hyperlink for include files added.
- - check if GTAGS is the latest one.
- - -f option added.
- With this option, you can use input form and dynamic
- index. (You need to setup httpd server for it.)
- - -n option added.
- global - -f option added.
- btreeop - -L option added.
-
-version 2.1 Symbol search, incremental update and gozilla [20-Sep-97]
-
- [changed]
- gtags - -e option and -s option were deleted.
- These options become default, so you need not to specify
- them. Gtags accepts these options for compatibility but
- no effect.
- global - understand 'obj'(MAKEOBJDIR) directory and '/usr/obj'
- (MAKEOBJDIRPREFIX) directory of BSD build system.
-
- Thanks to Jordan K. Hubbard. This is his idea.
-
- gctags, btreeop
- - remove <err.h> for portability. (Sorry, Philippe...)
- btreeop - output procedure rewritten.
- detab() + fprintf -> detab_print()
- gtags, htags, global
- - don't restrict PATH to '/bin:/usr/bin' like version 1.9
- and the former.
- [fixed bug]
- gctags - cannot treat files which include '\r'.
-
- Thanks to Christoph Conrad for his bug report.
-
- - is disturbed by '_asm' statement.
- - write buffer beyoned the end when source file doesn't
- end with '\n'. It brings segmentation fault.
- gtags.el- ESC-r command doesn't work.
- htags - has a security hole in global.cgi.
- btreeop - corrupt database when interrupted.
- all command
- - description of exit code in online manual is fixed.
- [added]
- gozilla
- - new command.
- gtags, gctags, global
- - can locate specified symbol other than function name
- using GSYMS tag file.
- btreeop - support secondary key.
- Optional key number added to -K option and -D option.
- - -k option added.(prefix read)
- global
- - -g option added.(grep pattern)
-
- Thanks to Hideaki Okada for his advice.
-
- - -s option added.(symbol search)
- - -i option added.(incremental update)
- - -l option added.(search only under current directory)
- - -v option added.(verbose mode)
- gtags - -i option added.(incremental update)
- - -v option added.(verbose mode)
- - -o option added.(stop making GSYMS tag file)
- gtags.el- gtags-find-symbol command (ESC-s) added.
- It is equal to global's -s option.
- - gtags-find-pattern command (ESC-g) added.
- It is equal to global's -g option.
-
-version 2.11 Only bugfix [7-Nov-97]
-
- [fixed bug]
- htags, gtags
- - cannot treat symbolic link.
-
- Thanks to Yoshiharu Ito for his bug report.
-
- Makefile.generic
- - doens't work on Debian GNU/Linux.
-
- Thanks to Y.Yoshinaga for his patch.
-
-version 2.2 Rewritten with C for performance [7-Dec-97]
-
- [changed]
- gtags, global, gozilla
- - rewritten with C.
- global - adopted POSIX regular expression (extension) instead of
- perl's one.
- htags - shape up anchor database.
- btreeop - some options (-b, -c, -l, -p) were deleted.
-
-version 2.21 Bugfix and slightly modified [11-Dec-97]
-
- [fixed bug]
- gtags, global
- - doesn't skip RCS, SCCS, y.tab.c, y.tab.h.
- global - generates illegal path name when using GTAGSLIBPATH
- with -a option.
- [changed]
- lib/Makefile.generic
- - MANDIR = /usr/share/man -> MANDIR = /usr/man
- - replace `lorder $(OBJS) | tsort -q` to already sorted list.
- for S.u.S.E Linux 5.1.
-
- Thanks to Christoph Conrad for his information.
-
- gtags, lib/test.c
- - some change for Solaris environment.
-
- Thanks to Yamashita TAKAO for his information.
-
- 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.
-
-version 3.0 configuration file and compact format. [25-Jun-98]
-
- [fixed bug]
- gozilla - leaks memory.
- gctags - -s option pick up symbols which belongs to GTAGS or GRTAGS.
- global - cannot treat file which doesn't end with '\n'.
- gtags - incremental update cannot detect removed files.
- (GPATH file added.)
- - make corrupted tag files.
- (dbpatches/README added.)
-
- Thanks to Van Trinh for his bug report and information.
-
- htags - cannot be viewed by IE 5.0 because illegal <NOFRAME> tag.
-
- Thanks to Yoshida Masato for his bug report and fix patch.
-
- [changed]
- gctags - -c option removed. These code was moved to gtags.
- (It was needed for supporting plugged-in parser.)
- global - -f option excute tag command instead of reading tag file.
- (It became very faster than previous version.)
- gtags.el- check whether or not user want to use tag name completion.
- htags - URL of GLOBAL home page changed.
- systags - gtags's option changed from -v to -cov.
- gtags.c - replace "%+" of strftime with "%a %b %e %H:%M:%S %Z %Y".
- for Debian GNU linux 1.3.1.
-
- [added]
- gtags - -c option added. (compact format)
-
- Thanks to Takeshi Hojo. Compact format is based on his concept.
-
- htags - -c option added. (to make gzipped html file)
-
- Thanks to Oliver Paukstadt. This option is his idea.
-
- gtags, htags
- - support configuration file.
- (/etc/global.conf or $HOME/.globalrc)
- gctags - -n option added.
- --config option added. (It's undocumented.)
- global - -t option added.
- This option is to use with 'tagprg' and 'tagprgonce' command
- in Elvis editor (2.1g-beta or later).
-
- Thanks to Steve Kirkendall for his excellent editor and
- refined command set.
-
-version 3.01 Almost bugfix [5-Jul-98]
-
- [fixed bug]
- global - print file names in a line.
- gozilla - assume html file as a source file.
- btreeop - insufficient usage check.
- htags - cannot treat path including "++".
-
- [changed]
- global - -f option became to accept multiple files.
- all - fixed warning by -Wall -Wmissing-prototypes.
-
-version 3.1 Support of Java language [4-Aug-98]
-
- [fixed bug]
- htags - locate main functions from the path which belongs
- GTAGSLIBPATH when there is no main function in the local
- source tree.
-
- [added]
- gtags, global, htags, gozilla, gtags.el
- - java supprt added.
- gtags - --find option added. (internal use only - undocumented)
- - --expand option added. (internal use only - undocumented)
- htags - -h option (title header frame) added.
-
- Thanks to Shigeyuki Yamano. This is his idea.
-
- - line comment('//') detection added.
- gctags, systags
- - GTAGSSPECIAL environment variable added to treat system
- macros like 'SYSINIT' in FreeBSD.
- global.conf, lib/conf.c
- - 'CVS/' added to 'skip' parameter.
-
- [deleted]
- gtags.conf
- - 'reserved_words' for htags(1) was deleted.
- It is hard coded.
-
- [changed]
- htags.pl- print guide links in .h file too.
-
-version 3.2 new patch for nvi-1.79(1.66) and multilingual nvi [31-Aug-98]
-
- [fixed bug]
- nvi-1.79.diff
- - may have buffer overflow.
-
- Thanks to David Brownlee for his advice.
-
- - suppress error message 'GTAGS not found'.
-
- [added]
- nvi-1.79-m17n.diff
- - patch for multilingual nvi which is included FreeBSD as
- a ports.
- nvi-1.66.diff
- - patch for nvi-1.66 which is native command of NetBSD 1.3.2
-
- [deleted]
- nvi-1.34.diff
- - it is old enough to support.
-
- [changed]
- gozilla/Imakefile
- - make possible to build gozilla alone without building
- libgloutil.a.
-
-version 3.3 Rewriting gctags(1) and some bug fix. [13-Sep-98]
-
- [fixed bug]
- gctags - look over inner class in a method.(Java)
- - cannot treat 'OBJECT.class' pattern correctly.(Java)
-
- [changed]
- Makefile*
- - library name changed from libutil.a to libgloutil.a becase
- that is already used.
- - definition of MANDIR deleted.
- global.conf
- - comment fixed.
- systags.sh
- - additional support for NetBSD, OpenBSD, GNUmach and GNUhurd.
- - doesn't use CGI form by default.
- - use gtags -l and -h option by default.
- - -g(gtags only), -f(form) and -c(compact) option added.
-
- [deleted]
- gctags - fortran and lisp language support were deleted, because
- it was not supported in GLOBAL system.
- - -a, -d, -f, -t, -u, -w, -v options were deleted,
- because it was not used in GLOBAL system.
- - -D, -x options were deleted. These options became default.
- - GTAGSSPECIAL was deleted.
-
- [added]
- gctags - #if (#else #elif) #endif block parsing added.
- - pick up #define in assembler source.
- - can pick up object like 'definition\n\n() {'.
- - -b, -n, -w options were added.
- gtags.el- gtags-display-browser(ESC-h) command added.
- INSTALL - explanation about formatting online manuals added.
-
- Thanks to Bert Gijsbers for his investigation.
-
- Extended ctags has been completely replaced with new gctags.
- Thanks to Ken Arnold and the other people who developped BSD ctags(1).
- Without it, GLOBAL had never been here.
-
-version 3.4 Unlimited nested index of htags(1). [8-Nov-98]
-
- [added]
- global - --filter option added. (internal use only - undocumented)
- htags - tabs parameter added in global.conf to change tab stop.
- btreeop - '2' option added to the -L command.
-
- [changed]
- htags - unlimited nested index of files supported.
- README, htags.1,
- - statements fixed.
-
- Thanks to Silas S. Brown for his fixing the statements.
-
- Makefile.generic
- - make sub makefiles inherit the macros from the root Makefile.
-
-version 3.41 description added to README file. [10-Dec-98]
-
- [added]
- README - usage description added.
- '5. Elvis using global'
- 'A.3. Incremental updating'
- INSTALL - description about Elvis added.
-
- [change]
- global - -t option is available with -P command.
- global - assume "global -c ''" as "global -c".
-
- [deleted]
- nvi-1.79-m17n.diff
- - because it is difficult for me to maintain. Sorry.
-
-version 3.42 a couple of bugs fixed. [8-Jan-99]
-
- [fixed]
- btreeop.c,gctags.c,global.c,gozilla.c,remote.c,gtags.c
- - 'void main()' is not valid by the C spec.
-
- Thanks to David Brownlee for his patch.
-
- gtags.el- redefinition problem fixed.
- (renamed match-string to util-match-string.)
-
- Thanks to Daisuke Kawahara for his bug report.
diff --git a/contrib/global/INSTALL b/contrib/global/INSTALL
deleted file mode 100644
index a047c1e..0000000
--- a/contrib/global/INSTALL
+++ /dev/null
@@ -1,221 +0,0 @@
-
-Installation of GLOBAL
-
- 6-Dec-1998 Shigio Yamaguchi
----------------------------------------------------------------------------
-Guide line (C style)
----------------------------------------------------------------------------
-
-if (Your system == FreeBSD) {
- You are lucky!
- You need not to do procedure "1. Preparation for generic UNIX".
-
- switch (version) {
- case 2.0.5R:
- case 2.1.0R:
- case 2.1.5R:
- case 2.1.6R:
- case 2.1.7R:
- case 2.2.1R:
- There is no problem.
- break;
- case 2.2.2R:
- case 2.2.5R:
- case 2.2.6R:
- case 2.2.7R:
- Your system includes GLOBAL 1.9 or 2.24.
- You can overwrite it with this package.
- break;
- default:
- I don't know. But it seems to be little problem.
- }
-} else if (Your system == NetBSD 1.3.2) {
- You are lucky!
- You need not to do procedure "1. Preparation for generic UNIX"
- and you can use nvi-1.66.diff for native nvi.
-} else if (Your system == Debian GNU linux 1.3.1) {
- You are lucky!
-
- You can skip most of "1. Preparation for generic UNIX" except for
- "a) Generic makefile".(It's very easy.)
-} else {
- You may some error messages to make GLOBAL.
- But it seems not so difficult to clear it. If you make a patch for it,
- please let me know. I would like to include your patch into new
- version of GLOBAL.
-
- Thank you in advance.
-}
-
-Please see ./dbpatches/README.
-
-----------------------------------------------------------------------------
-Install procedure
-----------------------------------------------------------------------------
-
-0. Extracting
-
- % tar xzvf global-XXX.tar.gz
- % cd global-XXX
-
- (XXX is version number.)
-
-1. Preparation for generic UNIX
-
- If you are a user of FreeBSD (all version) or NetBSD 1.3.2 then
- nothing to do here. Please go to "2. GLOBAL basic".
-
- Otherwise, you must check following items before you install GLOBAL.
-
- a) Generic makefile (necessary)
-
- This package includes generic makefile. Please do the followings.
-
- % make -f Makefile.generic gen
- % vi Makefile <- check variables like BINDIR, MANDIR, ...
-
- b) Some UNIX tools (necessary)
-
- Find(1), sed(1), sort(1), uniq(1) are needed.
- If your environment is UNIX, you have them. You can confirm it like this.
-
- % which find
- /usr/bin/find
- %
-
- c) POSIX regular expression (extension) library (necessary)
-
- If you don't have it, you can use GNU's regex library (regex-0.12.tar.gz).
- See following site.
-
- http://www.gnu.org/order/ftp.html
-
- d) BSD db library version 1.85 (necessary)
-
- If you don't have it, you can fetch it from this site.
-
- http://mongoose.bostic.com/db/packages/db.1.85.tar.gz
-
- e) PERL version 4 or later (needed for htags)
-
- If you don't have it, you can fetch it from this site.
-
- ftp://ftp.cis.ufl.edu/pub/perl/CPAN/src/5.0/latest.tar.gz
-
- f) Rewrite some files (needed for htags)
-
- If you install GLOBAL into other than /usr/bin, you need rewrite
- hard coded path in a program. You can find the place by this command.
-
- % grep '/usr/bin/global' */*.pl
-
- If you install perl to other than /usr/bin, please rewrite hard coded
- path in some programs. You can find the places by this command.
-
- % grep '/usr/bin/perl' */*.pl
-
- g) Groff (needed for formatting online manuals)
-
- Online manuals in GLOBAL are written with 'mandoc' macro which is a part
- of GNU groff package. See following site:
-
- http://www.gnu.org/order/ftp.html
-
- You can format these manuals by following command line manually.
-
- % groff -Wall -Tascii -mandoc global.1
-
- If you replace your system's nroff(1) with GNU's one(nroff.sh) then
- you can use man(1) to see GLOBAL's online manuals.
-
-2. GLOBAL basic (NEEDED)
-
- % make
- # make install
-
-3. Extended nvi (OPTIONAL)
-
- If you use FreeBSD 2.2.2R or later, your nvi is already extended nvi.
- Otherwise, please get nvi-1.79 at:
-
- ftp://ftp.cs.berkeley.edu/ucb/4bsd/nvi-1.79.tar.gz
-
- and do the followings.
-
- % tar xzvf nvi-1.79.tar.gz
- % cd nvi-1.79
- % patch -p < ../nvi-1.79.diff
- % cd build
- % ./configure
- % make
- # make install
-
- The patch for nvi-1.66 is also available for NetBSD 1.3.2 users.
-
-4. Extended emacs (OPTIONAL)
-
- The version of Emacs supported by GLOBAL is GNU Emacs 19.28, 19.34 or
- Mule 2.3 (= Emacs 19.28). Other emacs version seems to work well,
- but I don't confirm it.
-
- You can get it at:
-
- Emacs 19.34b:
- ftp://prep.ai.mit.edu/pub/gnu/emacs-19.34b.tar.gz
- Mule 2.3:
- ftp://ftp.cs.buffalo.edu/pub/mule/mule-2.3.tar.gz
-
- If you are a FreeBSD user, install it from 'package' (see pkg_add(1)).
-
- If you have installed it then copy gtags.el in this package to the emacs
- lisp library directory or place the file in a directory
- (for example "~/lisp") and write $HOME/.emacs like this.
-
- +-----------------------------------------------
- |(setq load-path (cons "~/lisp" load-path))
-
-5. Elvis (OPTIONAL)
-
- You need Elvis 2.1. You can get it at:
-
- ftp://ftp.cs.pdx.edu/pub/elvis/elvis-2.1.tar.gz
-
- You need not any patch for it.
-
-
-6. Gozilla (OPTIONAL)
-
- You need X(1) to install gozilla.
-
- % cd gozilla
- % xmkmf
- % make
- # make install
- # make install.man
-
-7. other parser (OPTIONAL)
-
- If you want to use other tag command like etags (tag command for emacs)
- as a parser, you need to write global.conf (or $HOME/.globalrc).
-
- Sample gtags.conf has etags's entry. Try this.
-
-
- a) Install parser.
-
- % cd <emacs's source directory>/lib-src
- % make ctags
- ...
- # cp ctags /usr/local/bin/ctags-emacs
-
- b) Select ctags-emacs for GLOBAL system.
-
- % setenv GTAGSLABEL ctags-emacs
-
- or
-
- +------------------------------------------------
- |default:\ <== gtags use 'default' entry by default.
- | :include=ctags-emacs:include=htags:
-
-Good luck!
diff --git a/contrib/global/MANIFEST b/contrib/global/MANIFEST
deleted file mode 100644
index ca62a7b..0000000
--- a/contrib/global/MANIFEST
+++ /dev/null
@@ -1,24 +0,0 @@
-COPYING Copyright notice.
-FAQ Frequentry asked question.
-HISTORY Histroy of GLOBAL.
-INSTALL Installation method
-MANIFEST This file.
-Makefile Makefile for BSD.
-Makefile.inc A part of Makefile for BSD.
-Makefile.generic Makefile for generic UNIX(including BSD).
-README Readme (introduction and usage).
-VERSION Version number.
-btreeop/ Btreeop command directory.
-dbpatches/ Patch files for DB(3).
-gctags/ Extended ctags command directory.
-global/ Global command directory.
-global.conf Configuration file.
-gozilla/ Gozilla command directory.
-gtags/ Gtags command directory.
-gzshrc Gzsh start up file.
-htags/ Htags command directory.
-systags/ Script for kernel.
-lib/ Private library.
-gtags.el Gtags mode for Emacs.
-nvi-1.66.diff Patch for nvi 1.66.
-nvi-1.79.diff Patch for nvi 1.79.
diff --git a/contrib/global/Makefile b/contrib/global/Makefile
deleted file mode 100644
index 88b68e0..0000000
--- a/contrib/global/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIR= lib global gtags gctags btreeop htags systags
-
-.include <bsd.subdir.mk>
diff --git a/contrib/global/Makefile.inc b/contrib/global/Makefile.inc
deleted file mode 100644
index b209398..0000000
--- a/contrib/global/Makefile.inc
+++ /dev/null
@@ -1,16 +0,0 @@
-.if !defined(GLOBAL_MAKEFILE_INC_BEEN_HERE)
-
-GLOBAL_MAKEFILE_INC_BEEN_HERE=yes
-BINDIR?= /usr/bin
-.if exists(${.OBJDIR}/../lib)
-LIBDESTDIR= ${.OBJDIR}/../lib
-.else
-LIBDESTDIR= ${.CURDIR}/../lib
-.endif
-LDDESTDIR= -L${LIBDESTDIR}
-LDADD= -lgloutil
-DPADD= ${LIBDESTDIR}/libgloutil.a
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../lib -O \
- -Wall -Wwrite-strings -Wmissing-prototypes
-
-.endif
diff --git a/contrib/global/README b/contrib/global/README
deleted file mode 100644
index d622673..0000000
--- a/contrib/global/README
+++ /dev/null
@@ -1,972 +0,0 @@
-
- @@@@@@@=)))
- @=))) @=))) @=)))
- @=))) @=)))
- @=))) @=))) @@@@@=)@@@@@@=))) @@=) @=)))
- @=))F o r a l l)) h a c k e r s.))) @=@=))@=)))
- @=))) @@@@@@=@=)))@=))) @=)@@@@@=)))@= @=))@=)))
- @=))) @=))@=)))@=))) @=)@=)))@=)@@@@@=))@=)))
- @=))) @=))@=)))@=))) @=)@=)))@=@=)))@=))@=)))
- @@@@@@@@=)))@@@@=)@@@@@=)@@@@@@=@@@=)@@@@=)@@@@@@=)))
-
- Shigio Yamaguchi 10-Dec-98
-
- Copyright 1996, 1997, 1998 Shigio Yamaguchi All right resereved.
-
-GLOBAL is a source code tag system that works the same way across diverse
-environments. It supports C, Yacc and Java source code.
-
-It brings benefits to all hackers. Enjoy!
-
-
- Contents
- --------------------------------
- 0. Introduction
-
- 1. Global
-
- 1.1. Features
- 1.2. Preparation
- 1.3. Basic usage
- 1.4. Applied usage
-
- 2. Extended nvi using global
-
- 2.1. Features
- 2.2. Preparation
- 2.3. Basic usage
- 2.4. Applied usage
-
- 3. Extended emacs using global
-
- 3.1. Features
- 3.2. Preparation
- 3.3. Basic usage
- 3.4. Applied usage
-
- 4. Hypertext generator
-
- 4.1. Features
- 4.2. Preparation
- 4.3. Usage
- 4.4. Making hypertext of the kernel
- 4.5. Gozilla
-
- 5. Elvis using global
-
- 5.1. Features
- 5.2. Preparation
- 5.3. Basic usage
- 5.4. Applied usage
-
- A. Other topics
-
- A.1. How to plug in a parser
- A.2. How to use compact format
- A.3. Incremental updating
- A.4. Plans for the furture
- --------------------------------
-
-0. Introduction
-
-GLOBAL is a source code tag system that works the same way across diverse
-environments. Currently, it supports the following:
-
- o Shell command line(see '1. Global')
- o nvi editor(see '2. Extended nvi using global')
- o emacs editor(see '3. Emacs using global')
- o Web browser(see '4. Hypertext generator')
- o Elvis editor(see '5. Elvis using global')
-
-Supported languages are C/Yacc and Java.
-You can locate a specified function in the source files and move there easily.
-It is useful for hacking a large project containing many subdirectories,
-many '#ifdef' and many main() functions, like MH, X or BSD kernel.
-
-GLOBAL consists of global(1), gtags(1), btreeop(1), gctags(1), htags(1),
-extended nvi(1), gtags.el and gozilla(1).
-
- * 'extended' means being entended for GLOBAL.
-
- * Btreeop and gctags are used internally, so you do not need to
- understand them.
-
-------------------------------------------------------------------------------
-
-1. Global
-
-1.1. Features
-
- o Global can find the locations of a specified object quickly.
- o Global can locate not only object definitions but also object references.
- o Global allows duplicate objects.
- o Global can treat a source tree containing subdirectories as a logical
- scope. You can get the relative path of objects from anywhere within
- that scope.
- o Global allows duplicate objects.
- o Global can understand POSIX 1003.2 regular expressions.
- o Global can search not only in a source tree but also in library paths.
- o Tag files are indepent of machine architecture.
- o Global can use a plugged in parser with the global.conf
- (or $HOME/.globalrc).
- o Global can use a tag file in a compact format to save disk space.
-
- I think these features are useful for a large project containing many
- subdirectories, many '#ifdef' and many main() functions like MH, mozilla,
- X and kernels.
-
-1.2. Preparation
-
- First of all, you must execute gtags(1) at the root of source tree.
- For example, if you want to browse vi's source code:
-
- % cd /usr/src/usr.bin/vi
- % gtags
-
- Gtags traverse subdirectories and makes
- three databases at the root of the source tree.
-
- % ls G*TAGS
- GRTAGS GTAGS GSYMS
-
- GTAGS - database of function definitions
- GRTAGS - database of function references
- GSYMS - database of other symbols
-
-
-1.3. Basic usage
-
- Consider the following source tree:
-
- ROOT/ <- the root of source tree (GTAGS,GRTAGS)
- |
- |- DIR1/
- | |
- | |- fileA.c ..... +---------------+
- | | |main(){ |
- | | | func1();|
- | | | func2();|
- | | |} |
- | | +---------------+
- | |
- | |- fileB.c ..... +---------------+
- | |func1(){ ... } |
- | +---------------+
- |- DIR2/
- |
- |- fileC.c ..... +---------------+
- |#ifdef X |
- |func2(){ i++; }|
- |#else |
- |func2(){ i--; }|
- |#endif |
- |func3(){ |
- | func1();|
- |} |
- +---------------+
-
- You can get the relative path of your object from anywhere in
- the source tree. You need not specify where the tag file is.
- Global will locate the tag file by itself.
-
- % cd ROOT
- % global func1
- DIR1/fileB.c <- func1() is defined in fileB.c
- % cd DIR1
- % global func1
- fileB.c <- relative path from DIR1
- % cd ../DIR2
- % global func1
- ../DIR1/fileB.c <- relative path from DIR2
-
- The -r option locates function references.
-
- % global -r func2
- ../DIR1/fileA.c <- func2() is referred from fileA.c
-
- You can use POSIX regular expressions.
-
- % cd ROOT
- % global 'func[1-3]'
- DIR1/fileB.c <- func1, func2 and func3 are matched
- DIR2/fileC.c
-
- The -x option shows the details. It is similar to the -x option
- in ctags(1).
-
- % global func2
- DIR2/fileC.c
- % global -x func2
- func2 2 DIR2/fileC.c func2(){ i++; }
- func2 4 DIR2/fileC.c func2(){ i--; }
-
- The -a option produces the absolute path name.
-
- % global -a func1
- /home/user/ROOT/DIR1/fileB.c
-
- The -s command locates any symbols other than functions.
-
- % global -xs X
- X 1 DIR2/fileC.c #ifdef X
-
- The -g command locates any patterns including symbols.
- It is similar to grep(1).
-
- % global -xg '#ifdef'
- #ifdef 1 DIR2/fileC.c #ifdef X
-
- You can edit all files that include a specified function by typing
- one command, for example:
-
- % vi `global func1` <- edit fileB.c
-
-
-1.4. Applied usage
-
- You can make multiple tag files.
- For example, you can execute gtags at ROOT/, version1.0/ and version2.0/.
-
- ROOT/ <- the root of source tree (GTAGS,GRTAGS)
- |
- |- version1.0/ <- the root of version1.0 (GTAGS,GRTAGS)
- | |
- | |- file.c ..... +---------------+
- | |func1(){ i++; }|
- | +---------------+
- |
- |- version2.0/ <- the root of version2.0 (GTAGS,GRTAGS)
- |
- |- file.c ..... +---------------+
- |func1(){ i--; }|
- +---------------+
-
- When you are in the version1.0 directory, global will only locate functions
- that are in version1.0.
-
- % cd ROOT/version1.0
- % global -x func1
- func1 1 file.c func1(){ i++; }
-
- When you are in the version2.0, global will only locate functions that
- are in version2.0.
-
- % cd ROOT/version2.0
- % global -x func1
- func1 1 file.c func1(){ i--; }
-
- If you are at ROOT/, or you set the GTAGSROOT environment variable to ROOT,
- then global will locate functions in both directories.
-
- % cd ROOT
- % global -x func1
- func1 1 version1.0/file.c func1(){ i++; }
- func1 1 version2.0/file.c func1(){ i--; }
-
- =-=-=-=
-
- There is another usage of GTAGSROOT.
- If your source files are on a read-only device, such as CDROM,
- then you cannot make databases at the root of the source tree.
- In such cases, please do the following:
-
- % mkdir /var/dbpath
- % cd /cdrom/src <- the root of source tree
- % gtags /var/dbpath <- make tag file in /var/dbpath
- % setenv GTAGSROOT `pwd`
- % setenv GTAGSDBPATH /var/dbpath
- % global func
-
- =-=-=-=
-
- If you want all references to a function that is not defined in the source
- tree to be treated as calls to library functions or system calls, then
- you can specify library directories with the GTAGSLIBPATH environment
- variable.
- You should execute gtags at each directory of the path.
- If GTAGS is not found in a directory, global ignores that directory.
-
- % pwd
- /develop/src/mh <- this is the source tree
- % gtags
- % ls G*TAGS
- GRTAGS GTAGS
- % global mhl
- uip/mhlsbr.c <- mhl() is found
- % global strlen <- strlen() is not found
- % (cd /usr/src/lib; gtags) <- library source
- % (cd /usr/src/sys; gtags) <- kernel source
- % setenv GTAGSLIBPATH /usr/src/lib:/usr/src/sys
- % global strlen
- ../../../usr/src/lib/libc/string/strlen.c <- strlen() is found in library
- % global access
- ../../../usr/src/sys/kern/vfs_syscalls.c <- access() is found in kernel
-
- Of course, the user program does not call kernel functions directly,
- but at least it is useful.
-
- =-=-=-=
-
- If you forget a function name, you can use the -c (complete) command.
-
- % global -c kmem <- maybe k..k.. kmem..
- kmem_alloc
- kmem_alloc_pageable
- kmem_alloc_wait
- kmem_free
- kmem_free_wakeup
- kmem_init
- kmem_malloc
- kmem_suballoc <- This is what I need!
- % global kmem_suballoc
- ../vm/vm_kern.c
-
- You can use the -c command with tcsh's complete command.
-
- % set funcs=(`global -c`)
- % complete global 'n/*/$funcs/'
- % global kmem_<TAB>
- kmem_alloc kmem_alloc_wait kmem_free_wakeup kmem_malloc
- kmem_alloc_pageable kmem_free kmem_init kmem_suballoc
- % global kmem_s<TAB>
- % global kmem_suballoc
- ../vm/vm_kern.c
-
- * <TAB> means the tab key or Ctrl-I.
-
- =-=-=-=
-
- If you want to browse many files in order, do the following:
-
- % global -xr fork | awk '{printf "view +%s %s\n",$2,$3}' | tee /tmp/list
- view +650 ../dev/aic7xxx/aic7xxx_asm.c
- view +250 ibcs2/ibcs2_misc.c
- view +401 linux/linux_misc.c
- view +310 ../kern/init_main.c
- view +318 ../kern/init_main.c
- view +336 ../kern/init_main.c
- view +351 ../kern/init_main.c
- % sh !$ <- from now on, go to next tag with 'ZZ'.
-
-2. Extended nvi using global
-
-2.1. Features
-
- o The tag function of extended vi can locate not only function definitions
- but also function references.
- o Extended nvi allows duplicate tag entries.
- o Extended nvi can understand POSIX regular expressions
- as a tag name for the search.
- o Extended nvi is completely backward-compatible with the original nvi.
- The above functions are available only in 'gtags mode'.
-
-2.2. Preparation
-
- First, do the preparation of global. (Please see "1.2. Preparation").
-
- Second, to use global from vi, you need to get into 'gtagsmode'.
- There are several ways to do this:
-
- (a) Start vi with -G option
-
- % vi -G file.c
-
- (b) Start vi and execute "set gtagsmode"
-
- % vi file.c
- ~
- ~
- ~
- :set gtagsmode
-
- (c) Write the above set command to the .exrc or .nexrc file and start vi
-
- $HOME/.exrc
- +----------------------------
- |set gtagsmode
-
- You must start vi under the source tree described in "1.2. Preparation".
-
-2.3. Basic usage
-
- o To go to func1, you can say
-
- :tag func1
-
- It seemes the same as original vi, but extended vi use GTAGS instead of
- tags.
-
- o To go to the referenced point of func1, add the prefix 'r'
-
- :rtag func1
-
- Extended nvi use GRTAGS.
-
- o If a number of functions are located, extended vi goes to the first tag.
- You can go to next tag by typing ':tagnext' and back by typing ':tagprev'.
-
- Suggested .nexrc:
- set gtagsmode
- map ^N :tagnext^M
- map ^P :tagprev^M
-
- o <control-]> command is available.
-
- In gtags mode, if you are in the first column of a line,
- it is equivalent to ":rtag <current token>", otherwise it is equivalent
- to ":tag <current token>".
-
- o Other tag commands are also available:
-
- <control-T> - Return to the most recent tag context.
- ":tagpop" - Go to the specified tag in the tags stack.
- ":tagtop" - Go to the top tag in the tags stack.
- ":display tags" - Display the tags stack.
-
- Please read the online manual.
-
-2.4. Applied usage
-
- o In large projects that include many main() function like MH,
- you can start vi like this:
-
- % vi -G -t main
-
- You can browse all commands sequentially.
-
- o When you want to check functions the name of which start with "set"
- or "get", use:
-
- % vi -G -t '^[sg]et'
-
- Of course, the following command is also available:
-
- :tag ^[sg]et
-
- o If your source files are on a read only device like a CD-ROM, please do
- the following:
-
- % mkdir /var/dbpath <- directory for the tag file
- % cd /cdrom/src <- the root of the source tree
- % gtags /var/dbpath <- make tag files in /var/dbpath
- % setenv GTAGSROOT `pwd`
- % setenv GTAGSDBPATH /var/dbpath
- % vi -G -t main
-
- o If you want all references to function that are not defined in the source
- tree to be treated as references to library functions or as system calls,
- do the following:
-
- % cd /usr/src/lib
- % gtags <- probably as a root
- % cd /usr/src/sys
- % gtags
- % setenv GTAGSLIBPATH /usr/src/lib:/usr/src/sys
-
- If you examine vi's source,
-
- % cd /usr/src/usr.bin/vi
- % gtags
- % vi -G -t main
-
- You can start from vi and browse the whole unix world as if you were
- using hypertext.
-
-3. Extended emacs using global
-
-3.1. Features
-
- Addition to the extended vi,
-
- o More intelligent recognition of the current token and its type.
- o Tag completion is available for input tag name.
- o Symbol search and pattern search are available.
- o Mouse events are supported.
-
-3.2. Preparation
-
- First, do the preparation of global. (Please see "1.2. Preparation").
-
- Second, to use global from emacs, you need to load the gtags.el file
- and execute gtags-mode function in it. There are several ways to
- do this:
-
- (a) Start emacs, load gtags.el and execute gtags-mode function.
-
- % emacs
-
- |
- |J_:-----Mule: *scratch* (Lisp Interaction)--L16--All----
- |M-x load-library[RET]
- +------------------------------------------------------
-
- |
- |J_:-----Mule: *scratch* (Lisp Interaction)--L16--All----
- |Load library: gtags[RET]
- +------------------------------------------------------
-
- |
- |J_:-----Mule: *scratch* (Lisp Interaction)--L16--All----
- |M-x gtags-mode[RET]
- +------------------------------------------------------
-
- (b) Write the autoload function to the $HOME/.emacs file, start emacs
- and execute the gtags-mode function.
-
- $HOME/.emacs
- +------------------------------------------------------
- |(autoload 'gtags-mode "gtags" "" t)
-
- % emacs
-
- |
- |J_:-----Mule: *scratch* (Lisp Interaction)--L16--All----
- |M-x gtags-mode[RET]
- +------------------------------------------------------
-
- (c) Write the autoload function to the $HOME/.emacs file and start emacs
- with the -f option.
-
-
- $HOME/.emacs
- +------------------------------------------------------
- |(autoload 'gtags-mode "gtags" "" t)
-
- % emacs -f gtags-mode
-
- You must start emacs under the source tree described in "1.2. Preparation".
-
-3.3. Basic usage
-
- o To go to func1, press 'ESC-t' and you can see a prompt in mini-buffer.
- Then input the tag name.
-
- :tag func1 # ':tag ' is a prompt.
- ~~~~~
- o To go to a point that references func1, press 'ESC-r'.
-
- :rtag func1 # 'rtag ' is a prompt
- ~~~~~
-
- o Tag name completion is available.
-
- :tag fu<TAB>
-
- :tag func1 # 'nc1' is appended by emacs
-
- o If a number of functions are located, emacs goes into 'GTAGS SELECT MODE'
- like this:
-
- +-------------------------------------------------------------
- |main 347 i386/isa/ultra14f.c main()
- |main 128 kern/init_main.c main(framep)
- |main 104 netiso/clnp_debug.c main()
- |main 164 netiso/xebec/main.c main(argc, argv)
- |
- |
- |
- |
- |
- |J_:--%*-Mule: *scratch* (Gtags Select)--L1--All----
- |[GTAGS SELECT MODE] 4 lines
- +-------------------------------------------------------------
-
- You can select a tag line by using any emacs command and pressing [RETURN],
- and you can go to the tag's point. When you want to go to the next or
- the previous tag, you can return to 'GTAGS SELECT MODE' with <control-T>
- and reselect.
-
- o <control-]> command is available.
-
- If current token is a definition, it is equivalent to
- ":rtag <current token>[RETURN]", otherwise it is equivalent to
- ":tag <current token>[RETURN]".
- (GLOBAL decides this intelligentlly, but may sometimes misunderstand.)
-
- o To go to any symbols other than function, try 'ESC-s'.
-
- Find symbol: lbolt
- ~~~~~
- o To go to any strings other than symbols, try 'ESC-g'.
-
- Find pattern: Copyright
- ~~~~~~~~~
-
-3.4. Applied usage
-
- o You can use POSIX regular expressions.
-
- :tag ^put_ # locate tags start with 'put_'.
-
- o If your source files are on a read-only device like a CDROM, please do
- the following:
-
- % mkdir /var/dbpath <- directory for the tag file
- % cd /cdrom/src <- the root of the source tree
- % gtags /var/dbpath <- make tag files in /var/dbpath
- % setenv GTAGSROOT `pwd`
- % setenv GTAGSDBPATH /var/dbpath
- % emacs -f gtags-mode
-
- o If you want all references to functions that are not defined in the
- source tree to be treated as references to library functions or
- as system calls, do the following:
-
- % cd /usr/src/lib
- % gtags <- probably as a root
- % cd /usr/src/sys
- % gtags
- % setenv GTAGSLIBPATH /usr/src/lib:/usr/src/sys
- % emacs -f gtags-mode
-
- o Mouse command is avalable.
-
- If you use X version emacs, try the following
- (but it doesn't work well in xemacs; I don't know why).
-
- Move the mouse cursor to a function name and click the middle button.
- You will then go to the function's definition, or to its references,
- depending on the context. In 'GTAGS SELECT MODE', move the mouse cursor
- to a line and click the center button.
-
- To return to the previous position, click the right button.
-
-4. Hypertext generator
-
-4.1. Features
-
- o Htags makes hypertext from C, Yacc and Java source files.
- o Once the hypertext is generated, you need nothing other than a WWW browser.
- o You can move the hypertext to anywhere. It is independent of the source code.
- o You can use all of your browser's functions, such as search,
- history, bookmark, save, frames, windows.
-
-4.2. Preparation
-
- At first, you must ensure that you have a lot of disk space. Hypertext
- needs a great amount of disk space. For example, the source code
- of FreeBSD kernel needs:
-
- source code(/usr/src/sys) 14.0MB
-
- GTAGS 1.5MB
- GRTAGS 8.0MB
- GSYMS 12.0MB
- HTML/ 55MB(!!!)
- -------------------------------------------------
- total 77MB
-
- Please do the following:
-
- (at your source directory)
- % gtags <- make the tag database(GTAGS,GRTAGS,GSYMS)
- % htags <- make the hypertext(HTML/)
-
- Then you will find an 'HTML' subdirectory in the current directory.
-
-4.3. Usage
-
- Please start a web browser like this:
-
- % lynx HTML/index.html
-
- You will understand the usage by looking at the examples.
-
- You can move the HTML directory to anywhere. It is independent of the
- source code.
-
-4.4. Making hypertext of the kernel
-
- If you would like to make hypertext of the FreeBSD kernel source, it is
- convenient to use the systags script in this package.
-
- % cd /usr/src/sys
- % systags
- then
-
- % netscape HTML/index.html
-
- You can use following functions with systags:
-
- o An input form for a dynamic index.
- (this reqires you to set up an httpd server for the CGI program.)
- o Unlimited nested index.
-
- Of course, you can use the above functions without systags. Please
- see gtags(1) and htags(1).
-
-4.5. Gozilla
-
- If you use Netscape Navigator, you can control the browser from the command
- line by using gozilla(1).
-
- % gtags
- % htags
- % global -x fork
- fork 60 kern/kern_fork.c fork(p, uap, retval)
- % gozilla +60 kern/kern_fork.c
- %
-
- Then you can see the hypertext specified around the fork function directly
- on Netscape Navigator. If the browser has not been loaded, gozilla loads it.
-
- If you use another browser like lynx, try this:
-
- % gozilla -b lynx +60 kern/kern_fork.c
-
- or
-
- % setenv BROWSER lynx
- % gozilla +60 kern/kern_fork.c
-
- You can send a remote command to Netscape Navigator too. Try this:
-
- % gozilla -C pagedown
- % gozilla -C pageup
-
- The remote commands are undocumented, but you can see the hint in the
- resource file (Netscape.ad).
-
- NOTES:
- Netscape Navigator is a registered trademark of Netscape Communications
- Corporation in the United States and other countries.
-
-
-5. Elvis using global
-
-Elvis 2.1 has new "tagprg" and "tagprgonce" variables for
-running an external tag search program. You can use them with GLOBAL.
-
-5.1. Features
-
- o The tag function of elvis+GLOBAL can locate not only function definitions
- but also function references.
- o Elvis+GLOBAL allows duplicate tag entries.
- o Elvis+GLOBAL can understand POSIX regular expressions
- as a tag name for the search.
- o Symbol search and pattern search are available.
- o Mouse events are supported.
-
-5.2. Preparation
-
- First, do the preparation of global. (Please see "1.2. Preparation").
-
- Second, start elvis and execute 'set tagprg="global -t $1"' like this.
-
- % elvis
- ~
- ~
- ~
- ~
- ~
- ~
- :set tagprg="global -t $1"
-
-5.3. Basic usage
-
- o To go to func1, you can say
-
- :tag func1
-
- It seemes the same as original elvis, but elvis execute 'global -t func1'
- internally and read it instead of tags file.
-
- o To go to the referenced point of func1, add -r option.
-
- :tag -r func1
-
- Elvis executes command like 'global -t -r func1' internally.
-
- o To go to any symbols other than function, try this.
-
- :tag -s lbolt
-
- o To go to any strings other than symbols, try this.
-
- :tag -g Copyright
-
- o When using -r, -s or -g, you had better to use browse command.
-
- :browse -r fork
-
- It brings a following selection list. You can select tag and go to
- the point.
-
- Browse -r fork (2 matches)
- +----------------+----------------+-------------------------------
- | TAG NAME | SOURCE FILE | SOURCE LINE
- +----------------+----------------|-------------------------------
- |fork |ux/linux_misc.c | (line 565)
- |fork |ern/init_main.c | (line 191)
- +----------------+----------------+-------------------------------
-
- o To get list of functions in a file, use -f command.
-
- :browse -f main.c # locate functions in main.c.
-
- o Other tag commands are also available:
-
- <control-]> - go to the definition of current token.
- <control-T> - return to the most recent tag context.
- ":tag" - without argment, go to the next tag.
- ":pop" - return to the most recent tag context.
- ":stack" - display the tags stack.
- ":stag" - creates a new window and moves its cursor to the
- tag's definition point.
- ":sbrowse" - same with 'browse' but show in a new window.
-
-5.4. Applied usage
-
- o You can use POSIX regular expressions.
-
- :tag ^put_ # locate functions start with 'put_'.
-
- :browse -g 'fseek(.*L_SET)' # locate fseek() using L_SET argment.
-
- o You can browse functions list of many files.
-
- :browse -f *.c # locate functions in *.c.
-
- o You can browse project files which includs specified pattern.
-
- :browse -P ^vm/ # under vm/ directory.
- :browse -P \.h$ # all include files.
- :browse -P init # files including 'init'
-
- o You can use mouse to select tag.
-
- +----------------+----------------+-------------------------------
- | TAG NAME | SOURCE FILE | SOURCE LINE
- +----------------+----------------|-------------------------------
- |fork |ux/linux_misc.c | (line 565)
- |fork |ern/init_main.c | (line 191)
- +----------------+----------------+-------------------------------
-
- Please select tag name with mouse cursor and double click on the left
- button and you go to the tag's point.
- In source screen, also select function name and double click on the
- left button and you can go to the point that the function is defined.
- To come back, double click on the right button.
-
-A. Other topics
-
-A.1. How to plug in a parser
-
- You can use a plugged-in parser. Copy global.conf to /etc/global.conf
- or $HOME/.globalrc.
-
- For example, if you would like to use ctags based on etags (included
- by Emacs),
-
- % cd /<emacs source directory>/lib-src
- % make ctags
- # cp ctags /usr/local/bin/ctags-emacs
- % setenv GTAGSLABEL ctags-emacs <- see global.conf
- % gtags
- % ls G*
- GPATH GTAGS
-
- Or if you would like to use exuberant ctags (included by Vim editor),
-
- % cd /<vim source directory>/src/ctags
- % cp Makefile.unix Makefile
- % make
- # cp ctags /usr/local/bin/ctags-exuberant
- % setenv GTAGSLABEL ctags-exuberant <- see global.conf
- % gtags
- % ls G*
- GPATH GTAGS
-
- GRTAGS and GSYMS don't exist, simply because these parsers don't support
- the -r option and -s option like gctags(1) does.
- All plugged-in parsers must print tag information to standard output
- in the same style as 'ctags -x', ie.:
-
- [1] [2] [3] [4]
- ----------------------------------------------------------------
- main 20 ./main.c main(argc, argv) /* xxx */
-
- [1] tag name
- [2] line number the tag appeared
- [3] path name. It must be equal to argment path name.
- [4] line image
-
- Otherwise, you can make a suitable wrapper for the pug-in parser.
-
-A.2. Compact format.
-
- You can save disk space with the compact format. The compact format
- needs source files.
-
- o To specify the use of the compact format on the command line,
- add the -c option:
-
- % gtags -c
-
- o To specify the use of the compact format in the configuration file:
-
- +----------------------------
- |...
- |default:\
- | format=compact:...
-
- o If you will publish hypertext generated by htags then use the -c option
- of htags too:
-
- % htags -c
-
- With the -c option, htags makes gzipped hypertext.
- You need to set up an HTTP server so that gzipped files can be read
- (see 'HTML/.htaccess.skel').
-
-
- Example:
-
- Standard Compact Compressed rate
- -------------------------------------------------------
- GTAGS 1744896 bytes 720896 bytes -59%
- GRTAGS 10133504 bytes 1409024 bytes -86%
- GSYMS 11911168 bytes 9306112 bytes -22%
-
- Standard Compact Compressed rate
- -------------------------------------------------------
- HTML/ 56618 kbytes 15219 kbytes -73%
-
-A.3. Incremental updating
-
- Modifying some source files, you need not remake whole tag files.
- Instead, you can use incremental updating facility (-i option).
-
- % gtags
- % cd kern
- % vi tty.c # modify tty.c.
- ...
- :wq
- % global -vi # -v means verbose.
- [Sun Dec 6 16:27:47 JST 1998] Gtags started
- Tag found in '/usr/src/sys'.
- Incremental update.
- Updating tags of 'kern/tty.c' ...GTAGS..GRTAGS..GSYMS.. Done.
- Global databases have been modified.
- [Sun Dec 6 16:28:30 JST 1998] Done.
- % global -vi # try again.
- [Sun Dec 6 16:28:48 JST 1998] Gtags started
- Tag found in '/usr/src/sys'.
- Incremental update.
- Global databases are up to date. # do nothing.
- [Sun Dec 6 16:28:52 JST 1998] Done.
-
-A.4. Plans for the furture
-
- Please see GLOBAL home page.
-
- <http://wafu.netgate.net/tama/unix/global.html>
-
-Thank you for your reading.
-And of course, I'm also grateful to all excellent tools (vi, ctags, emacs,
-perl, C, db, mozilla ...) and its authors.
-----------------------------------------------------------------------------
-E-Mail: <shigio@wafu.netgate.net>
-WWW: <http://wafu.netgate.net/tama/unix/indexe.html>
- (You can find the latest version here.)
-----------------------------------------------------------------------------
diff --git a/contrib/global/VERSION b/contrib/global/VERSION
deleted file mode 100644
index 761e16c..0000000
--- a/contrib/global/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-3.42
diff --git a/contrib/global/btreeop/Makefile b/contrib/global/btreeop/Makefile
deleted file mode 100644
index 643a287..0000000
--- a/contrib/global/btreeop/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-PROG= btreeop
-
-.include <bsd.prog.mk>
diff --git a/contrib/global/btreeop/btreeop.1 b/contrib/global/btreeop/btreeop.1
deleted file mode 100644
index 45b6e9f..0000000
--- a/contrib/global/btreeop/btreeop.1
+++ /dev/null
@@ -1,172 +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.
-.\"
-.Dd Nov 3, 1998
-.Dt BTREEOP 1
-.Os BSD 4
-.Sh NAME
-.Nm btreeop
-.Nd btree database maintenance tool
-.Sh SYNOPSIS
-.Nm btreeop
-.Op Fl A
-.Op Fl C
-.Op Fl D[keyno] Ar key
-.Op Fl K[keyno] Ar key
-.Op Fl L[2]
-.Op Fl k Ar prefix
-.Op Ar dbname
-.Sh DESCRIPTION
-.Nm Btreeop
-execute simple operations for
-.Xr btree 3
-database.
-.Nm Btreeop
-can create database, write record, read record (sequential or indexed) and
-delete record from it.
-Duplicate entries are allowed.
-Multi-key is available but only primary key can use index of
-.Xr btree 3 .
-.Sh OPTIONS
-A capital letter means a command. If no command specified
-then it assume sequential read operation.
-.Bl -tag -width Ds
-.It Fl A
-append records. If database doesn't exist, btreeop creates it.
-.It Fl C
-create database and write records to it.
-.It Fl D[keyno] Ar key
-delete records by the key. By default, keyno is 0 (primary key).
-.It Fl K[keyno] Ar key
-search records by the key. By default, keyno is 0 (primary key).
-.It Fl L[2]
-list all primary keys. If '2' is specified, list all the key and data pairs.
-.It Fl k Ar prefix
-scan records which have the prefix as a primary key.
-This option is valid only with sequential read operation (-L command or non command).
-.It Ar dbname
-database name. default is 'btree'.
-.Sh DATA FORMAT
-To creat (or append) database,
-.Nm btreeop
-read data from stdin.
-The format of the data is the following.
-
- Primary-key Secondary-key-1 Secondary-key-2 Data
- (keyno = 0) (keyno = 1) (keyno = 2)
- --------------------------------------------------------------
- main 246 main.c main (){\\n
- func 120 library.c func(a1, a2)\\n
- .
- .
- .
-
-.El
-
-.Bl -enum -offset indent
-.It
-All key and data are separated by blank('\\t' or ' ').
-.It
-Key cannot include blank.
-.It
-Data can include blank.
-.It
-Null data not allowed.
-.It
-Additionally, META record is available. META record has a key that start with
-a blank. You can read this record only by indexed read operation (-K option).
-Usage is unlimited by btreeop.
-.El
-.Sh EXAMPLES
-Create database.
-
- % btreeop -C
- key1 data1
- key2 data2
- key3 data3
- ^D
- %
-
-Append records.
-
- % btreeop -A
- __.VERSION 2
- key2 data2-2
- ^D
- %
-
-Sequential read.
-
- % btreeop
- key1 data1
- key2 data2-2
- key2 data2
- key3 data3
- %
-
-Indexed read.
-
- % btreeop -K key2
- key2 data2-2
- key2 data2
- % btreeop -K ' __.VERSION'
- __.VERSION 2
- %
-
-List primary keys.
-
- % btreeop -L
- key1
- key2
- key3
- %
-
-Delete record.
-
- % btreeop -D ' __.VERSION'
- % btreeop -K ' __.VERSION'
- %
-
-.Sh FILES
-.Bl -tag -width tags -compact
-.It Pa btree
-default database name.
-.El
-.Sh DIAGNOSTICS
-.Nm Btreeop
-exits with a non 0 value if an error occurred, 0 otherwise.
-.Sh SEE ALSO
-.Xr btree 3
-.Sh AUTHOR
-Shigio Yamaguchi (shigio@wafu.netgate.net)
-.Sh HISTORY
-The
-.Nm
-command appeared in FreeBSD 2.2.2.
diff --git a/contrib/global/btreeop/btreeop.c b/contrib/global/btreeop/btreeop.c
deleted file mode 100644
index 2b21cfc..0000000
--- a/contrib/global/btreeop/btreeop.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * 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.
- *
- * btreeop.c 12-Nov-98
- *
- */
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "global.h"
-
-const char *dbdefault = "btree"; /* default database name */
-const char *progname = "btreeop"; /* command name */
-
-static void usage __P((void));
-void signal_setup __P((void));
-void onintr __P((int));
-int main __P((int, char **));
-void dbwrite __P((DBOP *));
-void dbkey __P((DBOP *, char *, int));
-void dbscan __P((DBOP *, char *, int));
-void dbdel __P((DBOP *, char *, int));
-void dbbysecondkey __P((DBOP *, int, char *, int));
-
-#define F_KEY 0
-#define F_DEL 1
-
-static void
-usage()
-{
- fprintf(stderr, "%s\n",
- "usage: btreeop [-A][-C][-D[n] key][-K[n] key][-L[2]][-k prefix][dbname]");
- exit(1);
-}
-
-/*
- * Btreeop catch signal even if the parent ignore it.
- */
-int exitflag = 0;
-
-void
-onintr(signo)
-int signo;
-{
- exitflag = 1;
-}
-
-void
-signal_setup()
-{
- signal(SIGHUP, onintr);
- signal(SIGINT, onintr);
- signal(SIGQUIT, onintr);
- signal(SIGTERM, onintr);
-}
-
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- char command = 'R';
- char *key = NULL;
- int mode = 0;
- const char *db_name;
- DBOP *dbop;
- int i, c;
- int secondkey = 0;
- int keylist = 0;
- char *prefix = NULL;
-
- for (i = 1; i < argc && argv[i][0] == '-'; ++i) {
- switch (c = argv[i][1]) {
- case 'D':
- case 'K':
- if (argv[i][2] && isdigit(argv[i][2]))
- secondkey = atoi(&argv[i][2]);
- if (++i < argc)
- key = argv[i];
- else
- usage();
- /* FALLTHROUGH */
- case 'A':
- case 'C':
- case 'L':
- if (command != 'R')
- usage();
- command = c;
- if (command == 'L') {
- keylist = 1;
- if (argv[i][2] == '2')
- keylist = 2;
- }
- break;
- case 'k':
- if (++i < argc)
- prefix = argv[i];
- else
- usage();
- break;
- default:
- usage();
- }
- }
- db_name = (i < argc) ? argv[i] : dbdefault;
- switch (command) {
- case 'A':
- case 'D':
- mode = 2;
- break;
- case 'C':
- mode = 1;
- break;
- case 'K':
- case 'L':
- case 'R':
- mode = 0;
- break;
- }
- dbop = dbop_open(db_name, mode, 0644, DBOP_DUP);
- if (dbop == NULL) {
- switch (mode) {
- case 0:
- case 2:
- die1("cannot open '%s'.", db_name);
- break;
- case 1:
- die1("cannot create '%s'.", db_name);
- break;
- }
- }
- switch (command) {
- case 'A': /* Append records */
- case 'C': /* Create database */
- dbwrite(dbop);
- break;
- case 'D': /* Delete records */
- dbdel(dbop, key, secondkey);
- break;
- case 'K': /* Keyed (indexed) read */
- dbkey(dbop, key, secondkey);
- break;
- case 'R': /* sequencial Read */
- case 'L': /* primary key List */
- dbscan(dbop, prefix, keylist);
- break;
- }
- dbop_close(dbop);
- if (exitflag)
- exit(1);
- exit(0);
-}
-/*
- * dbwrite: write to database
- *
- * i) dbop database
- */
-void
-dbwrite(dbop)
-DBOP *dbop;
-{
- char *p;
- char keybuf[MAXKEYLEN+1];
- char *c;
-
- signal_setup();
- /*
- * Input file format:
- * +--------------------------------------------------
- * |Primary-key secondary-key-1 secondary-key-2 Data\n
- * |Primary-key secondary-key-1 secondary-key-2 Data\n
- * .
- * .
- * - Keys and Data are separated by blank('\t' or ' ').
- * - Keys cannot include blank.
- * - Data can include blank.
- * - Null record not allowed.
- * - Secondary-key is assumed as a part of data by db(3).
- *
- * META record:
- * You can write meta record by making key start with a ' '.
- * You can read this record only by indexed read ('-K' option).
- * +------------------
- * | __.VERSION 2
- */
- while ((p = mgets(stdin, NULL, 0)) != NULL) {
- if (exitflag)
- break;
- c = p;
- if (*c == ' ') { /* META record */
- if (*++c == ' ')
- die("key cannot include blanks.");
- }
- for (; *c && !isspace(*c); c++) /* skip key part */
- ;
- if (*c == 0)
- die("data part not found.");
- if (c - p > MAXKEYLEN)
- die("primary key too long.");
- strncpy(keybuf, p, c - p); /* make key string */
- keybuf[c - p] = 0;
- for (; *c && isspace(*c); c++) /* skip blanks */
- ;
- if (*c == 0)
- die("data part is null.");
- entab(p);
- dbop_put(dbop, keybuf, p);
- }
-}
-
-/*
- * dbkey: Keyed search
- *
- * i) dbop database
- * i) skey key for search
- * i) secondkey 0: primary key, >0: secondary key
- */
-void
-dbkey(dbop, skey, secondkey)
-DBOP *dbop;
-char *skey;
-int secondkey;
-{
- char *p;
-
- if (!secondkey) {
- for (p = dbop_first(dbop, skey, 0); p; p = dbop_next(dbop))
- detab(stdout, p);
- return;
- }
- dbbysecondkey(dbop, F_KEY, skey, secondkey);
-}
-
-/*
- * dbscan: Scan records
- *
- * i) dbop database
- * i) prefix prefix of primary key
- * i) keylist 0: data, 1: key, 2: key and data
- */
-void
-dbscan(dbop, prefix, keylist)
-DBOP *dbop;
-char *prefix;
-int keylist;
-{
- char *p;
- int flags = 0;
-
- if (prefix)
- flags |= DBOP_PREFIX;
- if (keylist)
- flags |= DBOP_KEY;
-
- for (p = dbop_first(dbop, prefix, flags); p; p = dbop_next(dbop)) {
- if (keylist == 2)
- fprintf(stdout, "%s %s\n", p, dbop->lastdat);
- else
- detab(stdout, p);
- }
-}
-
-/*
- * dbdel: Delete records
- *
- * i) dbop database
- * i) skey key for search
- * i) secondkey 0: primary key, >0: secondary key
- */
-void
-dbdel(dbop, skey, secondkey)
-DBOP *dbop;
-char *skey;
-int secondkey;
-{
- signal_setup();
- if (!secondkey) {
- dbop_del(dbop, skey);
- return;
- }
- dbbysecondkey(dbop, F_DEL, skey, secondkey);
-}
-/*
- * dbbysecondkey: proc by second key
- *
- * i) dbop database
- * i) func F_KEY, F_DEL
- * i) skey
- * i) secondkey
- */
-void
-dbbysecondkey(dbop, func, skey, secondkey)
-DBOP *dbop;
-int func;
-char *skey;
-int secondkey;
-{
- char *c, *p;
- int i;
-
- /* trim skey */
- for (c = skey; *c && isspace(*c); c++)
- ;
- skey = c;
- for (c = skey+strlen(skey)-1; *c && isspace(*c); c--)
- *c = 0;
-
- for (p = dbop_first(dbop, NULL, 0); p; p = dbop_next(dbop)) {
- if (exitflag)
- break;
- c = p;
- /* reach to specified key */
- for (i = secondkey; i; i--) {
- for (; *c && !isspace(*c); c++)
- ;
- if (*c == 0)
- die("specified key not found.");
- for (; *c && isspace(*c); c++)
- ;
- if (*c == 0)
- die("specified key not found.");
- }
- i = strlen(skey);
- if (!strncmp(c, skey, i) && (*(c+i) == 0 || isspace(*(c+i)))) {
- switch (func) {
- case F_KEY:
- detab(stdout, p);
- break;
- case F_DEL:
- dbop_del(dbop, NULL);
- break;
- }
- }
- if (exitflag)
- break;
- }
-}
diff --git a/contrib/global/dbpatches/README b/contrib/global/dbpatches/README
deleted file mode 100644
index b1e9116..0000000
--- a/contrib/global/dbpatches/README
+++ /dev/null
@@ -1,37 +0,0 @@
-Patch for btree(3)
-------------------
-
-Btree(3) core dumps on certain data sets.
-
-if (your system == FreeBSD 2.2.6R or former)
- needs this patch.
-else if (your system == Debian GNU/Linux 1.3.1)
- needs this patch.
-else
- I don't know.
-
-Please apply patch files in this directory.
-
-1. patch your btree(3) source code
-
- % ls
- patch.1.2 patch.1.3 patch.1.4
- % set dir=`pwd` <- set current directory
- % cd /usr/src/lib/libc/db <- your db source code directory
- % cd btree <- btree library
- % patch < $dir/patch.1.2 <- it must be in this order.
- .
- .
- % patch < $dir/patch.1.3
- .
- .
- % patch < $dir/patch.1.4
- .
- .
-
-2. remake and install your db(3) library.
-3. remake GLOBAL.
-4. remake tag files because tag files are already corrupted.
-
-I derived these patches from 'http://www.sleepycat.com/update/'.
-Information is found on 'http://www.sleepycat.com/update/patch.185.html'.
diff --git a/contrib/global/dbpatches/patch.1.2 b/contrib/global/dbpatches/patch.1.2
deleted file mode 100644
index a343909..0000000
--- a/contrib/global/dbpatches/patch.1.2
+++ /dev/null
@@ -1,19 +0,0 @@
-*** btree/bt_split.c Tue Jul 26 14:22:02 1994
---- btree/bt_split.c Sat Jan 4 14:38:55 1997
-***************
-*** 673,679 ****
- * where we decide to try and copy too much onto the left page.
- * Make sure that doesn't happen.
- */
-! if (skip <= off && used + nbytes >= full) {
- --off;
- break;
- }
---- 673,679 ----
- * where we decide to try and copy too much onto the left page.
- * Make sure that doesn't happen.
- */
-! if (skip <= off && used + nbytes >= full || nxt == top - 1) {
- --off;
- break;
- }
diff --git a/contrib/global/dbpatches/patch.1.3 b/contrib/global/dbpatches/patch.1.3
deleted file mode 100644
index 5ca03df..0000000
--- a/contrib/global/dbpatches/patch.1.3
+++ /dev/null
@@ -1,37 +0,0 @@
-*** btree/bt_split.c.orig Sat Feb 8 10:14:10 1997
---- btree/bt_split.c Sat Feb 8 10:14:51 1997
-***************
-*** 673,679 ****
- * where we decide to try and copy too much onto the left page.
- * Make sure that doesn't happen.
- */
-! if (skip <= off && used + nbytes >= full || nxt == top - 1) {
- --off;
- break;
- }
---- 673,680 ----
- * where we decide to try and copy too much onto the left page.
- * Make sure that doesn't happen.
- */
-! if (skip <= off &&
-! used + nbytes + sizeof(indx_t) >= full || nxt == top - 1) {
- --off;
- break;
- }
-***************
-*** 686,692 ****
- memmove((char *)l + l->upper, src, nbytes);
- }
-
-! used += nbytes;
- if (used >= half) {
- if (!isbigkey || bigkeycnt == 3)
- break;
---- 687,693 ----
- memmove((char *)l + l->upper, src, nbytes);
- }
-
-! used += nbytes + sizeof(indx_t);
- if (used >= half) {
- if (!isbigkey || bigkeycnt == 3)
- break;
diff --git a/contrib/global/dbpatches/patch.1.4 b/contrib/global/dbpatches/patch.1.4
deleted file mode 100644
index cec5fbc..0000000
--- a/contrib/global/dbpatches/patch.1.4
+++ /dev/null
@@ -1,22 +0,0 @@
-*** btree/bt_page.c.orig Wed Jul 13 21:29:02 1994
---- btree/bt_page.c Wed Jun 11 20:14:43 1997
-***************
-*** 65,70 ****
---- 65,71 ----
- h->prevpg = P_INVALID;
- h->nextpg = t->bt_free;
- t->bt_free = h->pgno;
-+ F_SET(t, B_METADIRTY);
-
- /* Make sure the page gets written back. */
- return (mpool_put(t->bt_mp, h, MPOOL_DIRTY));
-***************
-*** 92,97 ****
---- 93,99 ----
- (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) {
- *npg = t->bt_free;
- t->bt_free = h->nextpg;
-+ F_SET(t, B_METADIRTY);
- return (h);
- }
- return (mpool_new(t->bt_mp, npg));
diff --git a/contrib/global/gctags/C.c b/contrib/global/gctags/C.c
deleted file mode 100644
index 17df1ac..0000000
--- a/contrib/global/gctags/C.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * 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 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.
- *
- * C.c 12-Sep-98
- */
-
-#include <ctype.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "C.h"
-#include "gctags.h"
-#include "defined.h"
-#include "die.h"
-#include "locatestring.h"
-#include "strbuf.h"
-#include "token.h"
-
-static int function_definition __P((int));
-static void condition_macro __P((int));
-static int reserved __P((char *));
-
-/*
- * #ifdef stack.
- */
-static struct {
- short start; /* level when #if block started */
- short end; /* level when #if block end */
- short if0only; /* #if 0 or notdef only */
-} stack[MAXPIFSTACK], *cur;
-static int piflevel; /* condition macro level */
-static int level; /* brace level */
-
-/*
- * C: read C (includes .h, .y) file and pickup tag entries.
- */
-void
-C(yacc)
- int yacc;
-{
- int c, cc;
- int savelevel;
- int target;
- int startmacro, startsharp;
- const char *interested = "{}=;";
- STRBUF *sb = stropen();
- /*
- * yacc file format is like the following.
- *
- * declarations
- * %%
- * rules
- * %%
- * programs
- *
- */
- int yaccstatus = (yacc) ? DECLARATIONS : PROGRAMS;
- int inC = (yacc) ? 0 : 1; /* 1 while C source */
-
- level = piflevel = 0;
- savelevel = -1;
- target = (sflag) ? SYM : (rflag) ? REF : DEF;
- startmacro = startsharp = 0;
- cmode = 1; /* allow token like '#xxx' */
- crflag = 1; /* require '\n' as a token */
- if (yacc)
- ymode = 1; /* allow token like '%xxx' */
-
- while ((cc = nexttoken(interested, reserved)) != EOF) {
- switch (cc) {
- case SYMBOL: /* symbol */
- if (inC && peekc(0) == '('/* ) */) {
- if (isnotfunction(token)) {
- if (target == REF && defined(token))
- PUT(token, lineno, sp);
- } else if (level > 0 || startmacro) {
- if (target == REF && defined(token))
- PUT(token, lineno, sp);
- } else if (level == 0 && !startmacro && !startsharp) {
- char savetok[MAXTOKEN], *saveline;
- int savelineno = lineno;
-
- strcpy(savetok, token);
- strstart(sb);
- strnputs(sb, sp, strlen(sp) + 1);
- saveline = strvalue(sb);
- if (function_definition(target))
- if (target == DEF)
- PUT(savetok, savelineno, saveline);
- }
- } else {
- if (target == SYM)
- PUT(token, lineno, sp);
- }
- break;
- case '{': /* } */
- DBG_PRINT(level, "{"); /* } */
- if (yaccstatus == RULES && level == 0)
- inC = 1;
- ++level;
- if (bflag && atfirst) {
- if (wflag && level != 1) /* { */
- fprintf(stderr, "Warning: forced level 1 block start by '{' at column 0 [+%d %s].\n", lineno, curfile);
- level = 1;
- }
- break;
- /* { */
- case '}':
- if (--level < 0) {
- if (wflag)
- fprintf(stderr, "Warning: missing left '{' [+%d %s].\n", lineno, curfile); /* } */
- level = 0;
- }
- if (eflag && atfirst) {
- if (wflag && level != 0) /* { */
- fprintf(stderr, "Warning: forced level 0 block end by '}' at column 0 [+%d %s].\n", lineno, curfile);
- level = 0;
- }
- if (yaccstatus == RULES && level == 0)
- inC = 0;
- /* { */
- DBG_PRINT(level, "}");
- break;
- case '\n':
- if (startmacro && level != savelevel) {
- if (wflag)
- fprintf(stderr, "Warning: different level before and after #define macro. reseted. [+%d %s].\n", lineno, curfile);
- level = savelevel;
- }
- startmacro = startsharp = 0;
- break;
- case YACC_SEP: /* %% */
- if (level != 0) {
- if (wflag)
- fprintf(stderr, "Warning: forced level 0 block end by '%%' [+%d %s].\n", lineno, curfile);
- level = 0;
- }
- if (yaccstatus == DECLARATIONS) {
- if (target == DEF)
- PUT("yyparse", lineno, sp);
- yaccstatus = RULES;
- } else if (yaccstatus == RULES)
- yaccstatus = PROGRAMS;
- inC = (yaccstatus == PROGRAMS) ? 1 : 0;
- break;
- case YACC_BEGIN: /* %{ */
- if (level != 0) {
- if (wflag)
- fprintf(stderr, "Warning: forced level 0 block end by '%%{' [+%d %s].\n", lineno, curfile);
- level = 0;
- }
- if (inC == 1 && wflag)
- fprintf(stderr, "Warning: '%%{' appeared in C mode. [+%d %s].\n", lineno, curfile);
- inC = 1;
- break;
- case YACC_END: /* %} */
- if (level != 0) {
- if (wflag)
- fprintf(stderr, "Warning: forced level 0 block end by '%%}' [+%d %s].\n", lineno, curfile);
- level = 0;
- }
- if (inC == 0 && wflag)
- fprintf(stderr, "Warning: '%%}' appeared in Yacc mode. [+%d %s].\n", lineno, curfile);
- inC = 0;
- break;
- /*
- * #xxx
- */
- case CP_DEFINE:
- startmacro = 1;
- savelevel = level;
- if ((c = nexttoken(interested, reserved)) != SYMBOL) {
- pushbacktoken();
- break;
- }
- if (peekc(1) == '('/* ) */) {
- if (target == DEF)
- PUT(token, lineno, sp);
- while ((c = nexttoken("()", reserved)) != EOF && c != '\n' && c != /* ( */ ')')
- if (c == SYMBOL && target == SYM)
- PUT(token, lineno, sp);
- if (c == '\n')
- pushbacktoken();
- }
- break;
- case CP_INCLUDE:
- case CP_ERROR:
- case CP_LINE:
- case CP_PRAGMA:
- while ((c = nexttoken(interested, reserved)) != EOF && c != '\n')
- ;
- break;
- case CP_IFDEF:
- case CP_IFNDEF:
- case CP_IF:
- case CP_ELIF:
- case CP_ELSE:
- case CP_ENDIF:
- case CP_UNDEF:
- condition_macro(cc);
- while ((c = nexttoken(interested, reserved)) != EOF && c != '\n') {
- if (!((cc == CP_IF || cc == CP_ELIF) && !strcmp(token, "defined")))
- continue;
- if (c == SYMBOL && target == SYM)
- PUT(token, lineno, sp);
- }
- break;
- case CP_SHARP: /* ## */
- (void)nexttoken(interested, reserved);
- break;
- case C_STRUCT:
- c = nexttoken(interested, reserved);
- if (c == '{' /* } */) {
- pushbacktoken();
- break;
- }
- if (c == SYMBOL)
- if (target == SYM)
- PUT(token, lineno, sp);
- break;
- case C_EXTERN:
- if (startmacro)
- break;
- while ((c = nexttoken(interested, reserved)) != EOF && c != ';') {
- switch (c) {
- case CP_IFDEF:
- case CP_IFNDEF:
- case CP_IF:
- case CP_ELIF:
- case CP_ELSE:
- case CP_ENDIF:
- case CP_UNDEF:
- condition_macro(c);
- continue;
- }
- if (startmacro && c == '\n')
- break;
- if (c == '{')
- level++;
- else if (c == '}')
- level--;
- else if (c == SYMBOL)
- if (target == SYM)
- PUT(token, lineno, sp);
- }
- break;
- /* control statement check */
- case C_BREAK:
- case C_CASE:
- case C_CONTINUE:
- case C_DEFAULT:
- case C_DO:
- case C_ELSE:
- case C_FOR:
- case C_GOTO:
- case C_IF:
- case C_RETURN:
- case C_SWITCH:
- case C_WHILE:
- if (wflag && !startmacro && level == 0)
- fprintf(stderr, "Warning: Out of function. %8s [+%d %s]\n", token, lineno, curfile);
- break;
- default:
- }
- }
- strclose(sb);
- if (wflag) {
- if (level != 0)
- fprintf(stderr, "Warning: {} block unmatched. (last at level %d.)[+%d %s]\n", level, lineno, curfile);
- if (piflevel != 0)
- fprintf(stderr, "Warning: #if block unmatched. (last at level %d.)[+%d %s]\n", piflevel, lineno, curfile);
- }
-}
-/*
- * function_definition: return if function definition or not.
- *
- * r) target type
- */
-static int
-function_definition(target)
-int target;
-{
- int c;
- int brace_level, isdefine;
-
- brace_level = isdefine = 0;
- while ((c = nexttoken("(,)", reserved)) != EOF) {
- switch (c) {
- case CP_IFDEF:
- case CP_IFNDEF:
- case CP_IF:
- case CP_ELIF:
- case CP_ELSE:
- case CP_ENDIF:
- case CP_UNDEF:
- condition_macro(c);
- continue;
- }
- if (c == '('/* ) */)
- brace_level++;
- else if (c == /* ( */')') {
- if (--brace_level == 0)
- break;
- } else if (c == SYMBOL) {
- if (target == SYM)
- PUT(token, lineno, sp);
- }
- }
- if (c == EOF)
- return 0;
- while ((c = nexttoken(",;{}=", reserved)) != EOF) {
- switch (c) {
- case CP_IFDEF:
- case CP_IFNDEF:
- case CP_IF:
- case CP_ELIF:
- case CP_ELSE:
- case CP_ENDIF:
- case CP_UNDEF:
- condition_macro(c);
- continue;
- }
- if (c == SYMBOL || IS_RESERVED(c))
- isdefine = 1;
- else if (c == ';' || c == ',') {
- if (!isdefine)
- break;
- } else if (c == '{' /* } */) {
- pushbacktoken();
- return 1;
- } else if (c == /* { */'}') {
- break;
- } else if (c == '=')
- break;
- }
- return 0;
-}
-
-/*
- * condition_macro:
- *
- * i) cc token
- */
-static void
-condition_macro(cc)
- int cc;
-{
- cur = &stack[piflevel];
- if (cc == CP_IFDEF || cc == CP_IFNDEF || cc == CP_IF) {
- DBG_PRINT(piflevel, "#if");
- if (++piflevel >= MAXPIFSTACK)
- die1("#if stack over flow. [%s]", curfile);
- ++cur;
- cur->start = level;
- cur->end = -1;
- cur->if0only = 0;
- if (peekc(0) == '0')
- cur->if0only = 1;
- else if ((cc = nexttoken(NULL, reserved)) == SYMBOL && !strcmp(token, "notdef"))
- cur->if0only = 1;
- else
- pushbacktoken();
- } else if (cc == CP_ELIF || cc == CP_ELSE) {
- DBG_PRINT(piflevel - 1, "#else");
- if (cur->end == -1)
- cur->end = level;
- else if (cur->end != level && wflag)
- fprintf(stderr, "Warning: uneven level. [+%d %s]\n", lineno, curfile);
- level = cur->start;
- cur->if0only = 0;
- } else if (cc == CP_ENDIF) {
- if (cur->if0only)
- level = cur->start;
- else if (cur->end != -1) {
- if (cur->end != level && wflag)
- fprintf(stderr, "Warning: uneven level. [+%d %s]\n", lineno, curfile);
- level = cur->end;
- }
- --piflevel;
- DBG_PRINT(piflevel, "#endif");
- }
-}
- /* sorted by alphabet */
-static struct words words[] = {
- {"##", CP_SHARP},
- {"#define", CP_DEFINE},
- {"#elif", CP_ELIF},
- {"#else", CP_ELSE},
- {"#endif", CP_ENDIF},
- {"#error", CP_ERROR},
- {"#if", CP_IF},
- {"#ifdef", CP_IFDEF},
- {"#ifndef", CP_IFNDEF},
- {"#include", CP_INCLUDE},
- {"#line", CP_LINE},
- {"#pragma", CP_PRAGMA},
- {"#undef", CP_UNDEF},
- {"%%", YACC_SEP},
- {"%left", YACC_LEFT},
- {"%nonassoc", YACC_NONASSOC},
- {"%right", YACC_RIGHT},
- {"%start", YACC_START},
- {"%token", YACC_TOKEN},
- {"%type", YACC_TYPE},
- {"%{", YACC_BEGIN},
- {"%}", YACC_END},
- {"__P", C___P},
- {"auto", C_AUTO},
- {"break", C_BREAK},
- {"case", C_CASE},
- {"char", C_CHAR},
- {"continue", C_CONTINUE},
- {"default", C_DEFAULT},
- {"do", C_DO},
- {"double", C_DOUBLE},
- {"else", C_ELSE},
- {"extern", C_EXTERN},
- {"float", C_FLOAT},
- {"for", C_FOR},
- {"goto", C_GOTO},
- {"if", C_IF},
- {"int", C_INT},
- {"long", C_LONG},
- {"register", C_REGISTER},
- {"return", C_RETURN},
- {"short", C_SHORT},
- {"sizeof", C_SIZEOF},
- {"static", C_STATIC},
- {"struct", C_STRUCT},
- {"switch", C_SWITCH},
- {"typedef", C_TYPEDEF},
- {"union", C_UNION},
- {"unsigned", C_UNSIGNED},
- {"void", C_VOID},
- {"while", C_WHILE},
-};
-
-static int
-reserved(word)
- char *word;
-{
- struct words tmp;
- struct words *result;
-
- tmp.name = word;
- result = (struct words *)bsearch(&tmp, words, sizeof(words)/sizeof(struct words), sizeof(struct words), cmp);
- return (result != NULL) ? result->val : SYMBOL;
-}
diff --git a/contrib/global/gctags/C.h b/contrib/global/gctags/C.h
deleted file mode 100644
index ae60948..0000000
--- a/contrib/global/gctags/C.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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 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.
- *
- * C.h 20-Aug-98
- */
-#define DECLARATIONS 0
-#define RULES 1
-#define PROGRAMS 2
-
-#define C___P 1001
-#define C_AUTO 1002
-#define C_BREAK 1003
-#define C_CASE 1004
-#define C_CHAR 1005
-#define C_CONTINUE 1006
-#define C_DEFAULT 1007
-#define C_DO 1008
-#define C_DOUBLE 1009
-#define C_ELSE 1010
-#define C_EXTERN 1011
-#define C_FLOAT 1012
-#define C_FOR 1013
-#define C_GOTO 1014
-#define C_IF 1015
-#define C_INT 1016
-#define C_LONG 1017
-#define C_REGISTER 1018
-#define C_RETURN 1019
-#define C_SHORT 1020
-#define C_SIZEOF 1021
-#define C_STATIC 1022
-#define C_STRUCT 1023
-#define C_SWITCH 1024
-#define C_TYPEDEF 1025
-#define C_UNION 1026
-#define C_UNSIGNED 1027
-#define C_VOID 1028
-#define C_WHILE 1029
-#define CP_ELIF 2001
-#define CP_ELSE 2002
-#define CP_DEFINE 2003
-#define CP_IF 2004
-#define CP_IFDEF 2005
-#define CP_IFNDEF 2006
-#define CP_INCLUDE 2007
-#define CP_PRAGMA 2008
-#define CP_SHARP 2009
-#define CP_ERROR 2010
-#define CP_UNDEF 2011
-#define CP_ENDIF 2012
-#define CP_LINE 2013
-#define YACC_SEP 3001
-#define YACC_BEGIN 3002
-#define YACC_END 3003
-#define YACC_LEFT 3004
-#define YACC_NONASSOC 3005
-#define YACC_RIGHT 3006
-#define YACC_START 3007
-#define YACC_TOKEN 3008
-#define YACC_TYPE 3009
-
-#define IS_CTOKEN(c) (c > 1000 && c < 2001)
-#define IS_CPTOKEN(c) (c > 2000 && c < 3001)
-#define IS_YACCTOKEN(c) (c > 3000 && c < 4001)
-#define MAXPIFSTACK 100
diff --git a/contrib/global/gctags/Makefile b/contrib/global/gctags/Makefile
deleted file mode 100644
index 18bc967..0000000
--- a/contrib/global/gctags/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-PROG= gctags
-SRCS= C.c assembler.c gctags.c java.c
-
-.include <bsd.prog.mk>
diff --git a/contrib/global/gctags/assembler.c b/contrib/global/gctags/assembler.c
deleted file mode 100644
index 7f2a532..0000000
--- a/contrib/global/gctags/assembler.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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 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.
- *
- * assembler.c 20-Aug-98
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "gctags.h"
-#include "defined.h"
-#include "token.h"
-
-static int reserved __P((char *));
-
-#define A_CALL 1001
-#define A_DEFINE 1002
-#define A_ENTRY 1003
-#define A_EXT 1004
-#define A_ALTENTRY 1005
-
-void
-assembler()
-{
- int c;
- int target;
- const char *interested = NULL; /* get all token */
- int startline = 1;
- int level; /* not used */
-
- level = 0; /* to satisfy compiler */
- /* symbol search doesn't supported. */
- if (sflag)
- return;
- target = (rflag) ? REF : DEF;
-
- cmode = 1;
- crflag = 1;
-
- while ((c = nexttoken(interested, reserved)) != EOF) {
- switch (c) {
- case '\n':
- startline = 1;
- continue;
- case A_CALL:
- if (!startline || target != REF)
- break;
- if ((c = nexttoken(interested, reserved)) == A_EXT) {
- if ((c = nexttoken(interested, reserved)) == '('/* ) */)
- if ((c = nexttoken(interested, reserved)) == SYMBOL)
- if (defined(token))
- PUT(token, lineno, sp);
- } else if (c == SYMBOL && *token == '_') {
- if (defined(&token[1]))
- PUT(&token[1], lineno, sp);
- }
- break;
- case A_ALTENTRY:
- case A_ENTRY:
- if (!startline || target != DEF)
- break;
- if ((c = nexttoken(interested, reserved)) == '('/* ) */)
- if ((c = nexttoken(interested, reserved)) == SYMBOL)
- if (peekc(1) == /* ( */ ')')
- PUT(token, lineno, sp);
- break;
- case A_DEFINE:
- if (!startline || target != DEF)
- break;
- if ((c = nexttoken(interested, reserved)) == SYMBOL) {
- if (peekc(1) == '('/* ) */) {
- PUT(token, lineno, sp);
- while ((c = nexttoken(interested, reserved)) != EOF && c != '\n' && c != /* ( */ ')')
- ;
- while ((c = nexttoken(interested, reserved)) != EOF && c != '\n')
- ;
- }
- }
- default:
- }
- startline = 0;
- }
-}
-static int
-reserved(word)
- char *word;
-{
- switch (*word) {
- case '#':
- if (!strcmp(word, "#define"))
- return A_DEFINE;
- break;
- case 'A':
- if (!strcmp(word, "ALTENTRY"))
- return A_ALTENTRY;
- break;
- case 'E':
- if (!strcmp(word, "ENTRY"))
- return A_ENTRY;
- else if (!strcmp(word, "EXT"))
- return A_EXT;
- break;
- case 'c':
- if (!strcmp(word, "call"))
- return A_CALL;
- break;
- }
- return SYMBOL;
-}
diff --git a/contrib/global/gctags/gctags.1 b/contrib/global/gctags/gctags.1
deleted file mode 100644
index 31415c6..0000000
--- a/contrib/global/gctags/gctags.1
+++ /dev/null
@@ -1,143 +0,0 @@
-.\"
-.\" 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 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.
-.\"
-.\"
-.Dd Aug 19, 1998
-.Dt GCTAGS 1
-.Os BSD 4
-.Sh NAME
-.Nm gctags
-.Nd print cross reference list for gtags.
-.Sh SYNOPSIS
-.Nm gctags
-.Op Fl b
-.Op Fl e
-.Op Fl n
-.Op Fl r
-.Op Fl s
-.Op Fl w
-.Ar file ...
-.Sh DESCRIPTION
-.Nm Gctags
-print cross reference list for
-.Xr gtags 1
-from the specified C,
-.Tn YACC ,
-.Tn JAVA ,
-and assembler source to standard output.
-Each line of output contains the object name, the line number which it appears,
-the file in which it is defined, and a line image separated by
-white-space.
-It's same with the output of
-.Xr ctags 1
-with -x option.
-.Pp
-Depending upon the options provided to
-.Nm gctags ,
-objects will consist of function definitions, function references and other
-symbols.
-This command is the default parser of GLOBAL source code tag system.
-.Bl -tag -width Ds
-.It Fl b
-force level 1 block to begin when reach a '{' at the first column. (C only)
-.It Fl e
-force level 1 block to end when reach a '}' at the first column. (C only)
-.It Fl n
-suppress output of tags. It is useful to use with
-.Fl w
-option.
-.It Fl r
-locate function references instead of function definitions. GTAGS file is
-needed at the current directory. (C and Java source only)
-By default, locate function definitions.
-.It Fl s
-collect symbols other than functions. By default, locate function definitions.
-.It Fl w
-print warning message.
-.El
-.Pp
-The
-.Fl r
-and
-.Fl s
-options override each other; the last one specified determines the method used.
-.Pp
-Files whose names end in
-.Nm \&.c
-or
-.Nm \&.h
-are assumed to be C
-source files and are searched for C style routine and macro definitions.
-Files whose names end in
-.Nm \&.y
-are assumed to be
-.Tn YACC
-source files.
-Files whose names end in
-.Nm \&.java
-are assumed to be Java source files.
-Files whose names end in
-.Nm \&.s
-or
-.Nm \&.S
-are assumed to be Assembler
-source files. Other files are searched for C style definitions.
-.Pp
-Yacc files each have a special tag.
-.Ar Yyparse
-is the start
-of the second section of the yacc file.
-.El
-.Sh DIAGNOSTICS
-.Nm Gctags
-exits with a non 0 value if an error occurred, 0 otherwise.
-Duplicate objects are not considered errors.
-.Sh SEE ALSO
-.Xr btreeop 1 ,
-.Xr ex 1 ,
-.Xr global 1 ,
-.Xr gtags 1 ,
-.Xr htags 1 ,
-.Xr vi 1 .
-.Sh BUGS
-.Pp
-.Nm Gctags
-relies on the input being well formed, and any syntactical
-errors will completely confuse it.
-.Pp
-Assembler support is far from complete. It extracts only ENTRY()
-and ALTENTRY() from source file. Probably valid only for FreeBSD and Linux
-kernel source.
-.Sh AUTHORS
-Shigio Yamaguchi (shigio@wafu.netgate.net)
-.Sh HISTORY
-The
-.Nm
-command appeared in FreeBSD 2.2.2.
diff --git a/contrib/global/gctags/gctags.c b/contrib/global/gctags/gctags.c
deleted file mode 100644
index fad2250..0000000
--- a/contrib/global/gctags/gctags.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 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 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.
- *
- * gctags.c 13-Sep-98
- */
-
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "global.h"
-#include "gctags.h"
-
-int bflag; /* -b: force level 1 block start */
-int dflag; /* -d: debug */
-int eflag; /* -e: force level 1 block end */
-int nflag; /* -n: doen't print tag */
-int rflag; /* -r: function reference */
-int sflag; /* -s: collect symbols */
-int wflag; /* -w: warning message */
-int yaccfile; /* yacc file */
-
-const char *progname = "gctags"; /* program name */
-char *notfunction;
-
-int main __P((int, char **));
-static void usage __P((void));
-
-struct words *words;
-static int tablesize;
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- char *p;
-
- while (--argc > 0 && (++argv)[0][0] == '-') {
- for (p = argv[0] + 1; *p; p++) {
- switch(*p) {
- case 'b':
- bflag++;
- break;
- case 'd':
- dflag++;
- break;
- case 'e':
- eflag++;
- break;
- case 'n':
- nflag++;
- break;
- case 'r':
- rflag++;
- sflag = 0;
- break;
- case 's':
- sflag++;
- rflag = 0;
- break;
- case 'w':
- wflag++;
- break;
- default:
- usage();
- }
- }
- }
- if (argc < 1)
- usage();
- if (getenv("GTAGSWARNING"))
- wflag++;
- if (test("r", NOTFUNCTION)) {
- FILE *ip;
- STRBUF *sb = stropen();
- int i;
-
- if ((ip = fopen(NOTFUNCTION, "r")) == 0)
- die1("'%s' cannot read.", NOTFUNCTION);
- for (tablesize = 0; (p = mgets(ip, NULL, 0)) != NULL; tablesize++)
- strnputs(sb, p, strlen(p) + 1);
- fclose(ip);
- if ((words = malloc(sizeof(struct words) * tablesize)) == NULL)
- die("short of memory.");
- p = strvalue(sb);
- for (i = 0; i < tablesize; i++) {
- words[i].name = p;
- p += strlen(p) + 1;
- }
- qsort(words, tablesize, sizeof(struct words), cmp);
- /* don't call strclose(sb); */
- }
- for (; argc > 0; argv++, argc--) {
- if (!opentoken(argv[0]))
- die1("'%s' cannot open.", argv[0]);
- if (locatestring(argv[0], ".y", MATCH_AT_LAST))
- C(1);
- else if (locatestring(argv[0], ".s", MATCH_AT_LAST) ||
- locatestring(argv[0], ".S", MATCH_AT_LAST))
- assembler();
- else if (locatestring(argv[0], ".java", MATCH_AT_LAST))
- java();
- else
- C(0);
- closetoken();
- }
- exit(0);
-}
-
-static void
-usage()
-{
- (void)fprintf(stderr, "usage: gctags [-benrsw] file ...\n");
- exit(1);
-}
-
-int
-cmp(s1, s2)
- const void *s1, *s2;
-{
- return strcmp(((struct words *)s1)->name, ((struct words *)s2)->name);
-}
-
-int
-isnotfunction(name)
- char *name;
-{
- struct words tmp;
- struct words *result;
-
- if (words == NULL)
- return 0;
- tmp.name = name;
- result = (struct words *)bsearch(&tmp, words, tablesize, sizeof(struct words), cmp);
- return (result != NULL) ? 1 : 0;
-}
-
-#ifdef DEBUG
-void
-dbg_print(level, s)
- int level;
- const char *s;
-{
- if (!dflag)
- return;
- fprintf(stderr, "[%04d]", lineno);
- for (; level > 0; level--)
- fprintf(stderr, " ");
- fprintf(stderr, "%s\n", s);
-}
-#endif
diff --git a/contrib/global/gctags/gctags.h b/contrib/global/gctags/gctags.h
deleted file mode 100644
index e27e32d..0000000
--- a/contrib/global/gctags/gctags.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 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 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.
- *
- * gctags.h 17-Oct-98
- */
-#include <sys/param.h>
-#include "token.h"
-/*
- * target type.
- */
-#define DEF 1
-#define REF 2
-#define SYM 3
-
-#define NOTFUNCTION ".notfunction"
-
-extern int bflag;
-extern int dflag;
-extern int eflag;
-extern int nflag;
-extern int rflag;
-extern int sflag;
-extern int wflag;
-extern int yaccfile;
-
-struct words {
- const char *name;
- int val;
-};
-
-#define PUT(tag, lno, line) { \
- DBG_PRINT(level, line); \
- if (!nflag) { \
- if (strlen(tag) >= 16 && lno >= 1000) \
- printf("%-16s %4d %-16s %s\n", \
- tag, lno, curfile, line); \
- else \
- printf("%-16s%4d %-16s %s\n", \
- tag, lno, curfile, line); \
- } \
-}
-
-#define IS_RESERVED(a) ((a) > 255)
-
-#ifndef __P
-#ifdef __STDC__
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-#ifdef DEBUG
-void dbg_print __P((int, const char *));
-#define DBG_PRINT(level, a) dbg_print(level, a)
-#else
-#define DBG_PRINT(level, a)
-#endif
-
-int isnotfunction __P((char *));
-int cmp __P((const void *, const void *));
-void C __P((int));
-void assembler __P((void));
-void java __P((void));
diff --git a/contrib/global/gctags/java.c b/contrib/global/gctags/java.c
deleted file mode 100644
index cb49f86..0000000
--- a/contrib/global/gctags/java.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 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 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.
- *
- * java.c 2-Sep-98
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "gctags.h"
-#include "defined.h"
-#include "die.h"
-#include "java.h"
-#include "token.h"
-
-static int reserved __P((char *));
-
-/*
- * java: read java file and pickup tag entries.
- */
-void
-java()
-{
- int c;
- int level; /* brace level */
- int target;
- int startclass, startthrows, startequal;
- char classname[MAXTOKEN];
- char completename[MAXCOMPLETENAME];
- int classlevel;
- struct {
- char *classname;
- char *terminate;
- int level;
- } stack[MAXCLASSSTACK];
- const char *interested = "{}=;";
-
- stack[0].terminate = completename;
- stack[0].level = 0;
- level = classlevel = 0;
- target = (sflag) ? SYM : ((rflag) ? REF : DEF);
- startclass = startthrows = startequal = 0;
-
- while ((c = nexttoken(interested, reserved)) != EOF) {
- switch (c) {
- case SYMBOL: /* symbol */
- for (; c == SYMBOL && peekc(1) == '.'; c = nexttoken(interested, reserved)) {
- if (target == SYM)
- PUT(token, lineno, sp);
- }
- if (c != SYMBOL)
- break;
- if (startclass || startthrows) {
- if (target == REF && defined(token))
- PUT(token, lineno, sp);
- } else if (peekc(0) == '('/* ) */) {
- if (target == DEF && level == stack[classlevel].level && !startequal)
- /* ignore constructor */
- if (strcmp(stack[classlevel].classname, token))
- PUT(token, lineno, sp);
- if (target == REF && (level > stack[classlevel].level || startequal) && defined(token))
- PUT(token, lineno, sp);
- } else {
- if (target == SYM)
- PUT(token, lineno, sp);
- }
- break;
- case '{': /* } */
- DBG_PRINT(level, "{"); /* } */
-
- ++level;
- if (startclass) {
- char *p = stack[classlevel].terminate;
- char *q = classname;
-
- if (++classlevel >= MAXCLASSSTACK)
- die1("class stack over flow.[%s]", curfile);
- if (classlevel > 1)
- *p++ = '.';
- stack[classlevel].classname = p;
- while (*q)
- *p++ = *q++;
- stack[classlevel].terminate = p;
- stack[classlevel].level = level;
- *p++ = 0;
- }
- startclass = startthrows = 0;
- break;
- /* { */
- case '}':
- if (--level < 0) {
- if (wflag)
- fprintf(stderr, "Warning: missing left '{' (at %d).\n", lineno); /* } */
- level = 0;
- }
- if (level < stack[classlevel].level)
- *(stack[--classlevel].terminate) = 0;
- /* { */
- DBG_PRINT(level, "}");
- break;
- case '=':
- startequal = 1;
- break;
- case ';':
- startclass = startthrows = startequal = 0;
- break;
- case J_CLASS:
- case J_INTERFACE:
- if ((c = nexttoken(interested, reserved)) == SYMBOL) {
- strcpy(classname, token);
- startclass = 1;
- if (target == DEF)
- PUT(token, lineno, sp);
- }
- break;
- case J_NEW:
- case J_INSTANCEOF:
- while ((c = nexttoken(interested, reserved)) == SYMBOL && peekc(1) == '.')
- if (target == SYM)
- PUT(token, lineno, sp);
- if (c == SYMBOL)
- if (target == REF && defined(token))
- PUT(token, lineno, sp);
- break;
- case J_THROWS:
- startthrows = 1;
- break;
- case J_BOOLEAN:
- case J_BYTE:
- case J_CHAR:
- case J_DOUBLE:
- case J_FLOAT:
- case J_INT:
- case J_LONG:
- case J_SHORT:
- case J_VOID:
- if (peekc(1) == '.' && (c = nexttoken(interested, reserved)) != J_CLASS)
- pushbacktoken();
- break;
- default:
- }
- }
-}
- /* sorted by alphabet */
-static struct words words[] = {
- {"abstract", J_ABSTRACT},
- {"boolean", J_BOOLEAN},
- {"break", J_BREAK},
- {"byte", J_BYTE},
- {"case", J_CASE},
- {"catch", J_CATCH},
- {"char", J_CHAR},
- {"class", J_CLASS},
- {"const", J_CONST},
- {"continue", J_CONTINUE},
- {"default", J_DEFAULT},
- {"do", J_DO},
- {"double", J_DOUBLE},
- {"else", J_ELSE},
- {"extends", J_EXTENDS},
- {"false", J_FALSE},
- {"final", J_FINAL},
- {"finally", J_FINALLY},
- {"float", J_FLOAT},
- {"for", J_FOR},
- {"goto", J_GOTO},
- {"if", J_IF},
- {"implements", J_IMPLEMENTS},
- {"import", J_IMPORT},
- {"instanceof", J_INSTANCEOF},
- {"int", J_INT},
- {"interface", J_INTERFACE},
- {"long", J_LONG},
- {"native", J_NATIVE},
- {"new", J_NEW},
- {"null", J_NULL},
- {"package", J_PACKAGE},
- {"private", J_PRIVATE},
- {"protected", J_PROTECTED},
- {"public", J_PUBLIC},
- {"return", J_RETURN},
- {"short", J_SHORT},
- {"static", J_STATIC},
- {"strictfp", J_STRICTFP},
- {"super", J_SUPER},
- {"switch", J_SWITCH},
- {"synchronized",J_SYNCHRONIZED},
- {"this", J_THIS},
- {"throw", J_THROW},
- {"throws", J_THROWS},
- {"union", J_UNION},
- {"transient", J_TRANSIENT},
- {"true", J_TRUE},
- {"try", J_TRY},
- {"void", J_VOID},
- {"volatile", J_VOLATILE},
- {"while", J_WHILE},
- {"widefp", J_WIDEFP},
-};
-
-static int
-reserved(word)
- char *word;
-{
- struct words tmp;
- struct words *result;
-
- tmp.name = word;
- result = (struct words *)bsearch(&tmp, words, sizeof(words)/sizeof(struct words), sizeof(struct words), cmp);
- return (result != NULL) ? result->val : SYMBOL;
-}
diff --git a/contrib/global/gctags/java.h b/contrib/global/gctags/java.h
deleted file mode 100644
index 5c0da71..0000000
--- a/contrib/global/gctags/java.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 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 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.
- *
- * java.h 20-Aug-98
- */
-/*
- * java's reserved words.
- */
-#define J_ABSTRACT 1001
-#define J_BOOLEAN 1002
-#define J_BREAK 1003
-#define J_BYTE 1004
-#define J_CASE 1005
-#define J_CATCH 1006
-#define J_CHAR 1007
-#define J_CLASS 1008
-#define J_CONST 1009
-#define J_CONTINUE 1010
-#define J_DEFAULT 1011
-#define J_DO 1012
-#define J_DOUBLE 1013
-#define J_ELSE 1014
-#define J_EXTENDS 1015
-#define J_FALSE 1016
-#define J_FINAL 1017
-#define J_FINALLY 1018
-#define J_FLOAT 1019
-#define J_FOR 1020
-#define J_GOTO 1021
-#define J_IF 1022
-#define J_IMPLEMENTS 1023
-#define J_IMPORT 1024
-#define J_INSTANCEOF 1025
-#define J_INT 1026
-#define J_INTERFACE 1027
-#define J_LONG 1028
-#define J_NATIVE 1029
-#define J_NEW 1030
-#define J_NULL 1031
-#define J_PACKAGE 1032
-#define J_PRIVATE 1033
-#define J_PROTECTED 1034
-#define J_PUBLIC 1035
-#define J_RETURN 1036
-#define J_SHORT 1037
-#define J_STATIC 1038
-#define J_SUPER 1039
-#define J_SWITCH 1040
-#define J_SYNCHRONIZED 1041
-#define J_THIS 1042
-#define J_THROW 1043
-#define J_THROWS 1044
-#define J_UNION 1045
-#define J_TRANSIENT 1046
-#define J_TRUE 1047
-#define J_TRY 1048
-#define J_VOID 1049
-#define J_VOLATILE 1050
-#define J_WHILE 1051
-#define J_STRICTFP 1052
-#define J_WIDEFP 1053
-
-#define MAXCOMPLETENAME 1024 /* max size of complete name of class */
-#define MAXCLASSSTACK 10 /* max size of class stack */
diff --git a/contrib/global/gctags/test/ctags.test b/contrib/global/gctags/test/ctags.test
deleted file mode 100644
index 1f334ac..0000000
--- 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/global.conf b/contrib/global/global.conf
deleted file mode 100644
index e00cf0e..0000000
--- a/contrib/global/global.conf
+++ /dev/null
@@ -1,157 +0,0 @@
-#
-# Copyright (c) 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.
-#
-# Configuration file for GLOBAL source code tag system.
-#
-# Copy this file as /etc/global.conf or $HOME/.globalrc and GLOBAL system
-# use it.
-#
-# 'default' is default target.
-# You can specify target with GTAGSLABEL environment variable.
-#
-# include:
-# It's similar to 'tc=' in termcap but can be used anytime and anywhere.
-# 8 level nested usage is allowed.
-#
-default:\
- :include=gctags:include=htags:
-#---------------------------------------------------------------------
-#
-# Configuration for gtags(1)
-#
-# format:
-# Select 'standard' or 'compact'. By default, it assumes 'standard'.
-# suffixes:
-# Suffixes of target source file. By default, 'c,h,y,s,S,java'.
-# skip:
-# Skip files among the target files. If the name ends with '/',
-# gtags skips all files under the directory.
-# By default, 'y.tab.c,y.tab.h,SCCS/,RCS/,CVS/'.
-# extractmethod:
-# Please see source code of gtags(1).
-# GTAGS:
-# Tag command for definitions. Non of default value.
-# GRTAGS:
-# Tag command for references. Non of default value.
-# GSYMS:
-# Tag command for other symbols. Non of default value.
-#
-# Htags(1) needs both of GTAGS and GRTAGS. Global(1)'s -s option needs GSYMS.
-#
-#---------------------------------------------------------------------
-common:\
- :skip=y.tab.c,y.tab.h,SCCS/,RCS/,CVS/:\
- :format=standard:
-#
-# [gctags]
-#
-# This command is distributed as part of GLOBAL.
-#
-gctags|tag command for GLOBAL:\
- :include=common:\
- :suffixes=c,h,y,s,S,java:\
- :GTAGS=gctags %s:\
- :GRTAGS=gctags -r %s:\
- :GSYMS=gctags -s %s:
-#
-# [Emacs's ctags]
-#
-# This ctags is distributed as a part of Emacs editor.
-#
-# supported suffixes by etags.
-#
-# lisp: l,el,lsp,lisp,cl,clisp
-# scheme: sm,scm,scheme,t,sch,ss,SM,SCM
-# assembler: s,a,sa,asm,src,def,ins,inc
-# C++: C,H,cpp,cxx,hxx,cc
-# C*: cs,hs
-# c,yacc: c,h,y
-# pl,p,pas: pascal
-# fortran: f,for
-#
-# [Installation]
-# % cd <emacs source directory>/lib-src
-# % make ctags
-# # cp ctags /usr/local/bin/ctags-emacs
-#
-ctags-emacs|ctags based on etags|GNU Emacs ctags:\
- :include=common:\
- :suffixes=el,s,a,sa,asm,C,H,cpp,cxx,hxx,cc,c,h,y:\
- :skip=ispell.el,canna.el,gnusutil.el:\
- :extractmethod:\
- :GTAGS=/usr/local/bin/ctags-emacs -x -d -T -w %s:
-#
-# [Exuberant Ctags]
-#
-# This ctags is distributed as a part of Vim editor.
-#
-# [Installation]
-# % cd <Vim source directory>/src/ctags
-# % make
-# # cp ctags /usr/local/bin/ctags-exuberant
-#
-ctags-exuberant|Exuberant Ctags|ctags by Darren Hiebert:\
- :include=common:\
- :suffixes=s,a,sa,asm,C,H,cpp,cxx,hxx,cc,c,h,y:\
- :extractmethod:\
- :GTAGS=/usr/local/bin/ctags-exuberant -x %s | perl -ne '($name, $type, $no, $path, $line) = split(/[ \t]+/, $_, 5); printf(STDOUT "%-16s %4d %-16s %s", $name, $no, $path, $line);':
-#---------------------------------------------------------------------
-#
-# Configuration for htags(1)
-# Let's paint hypertext with your favorite colors!
-#
-# bgcolor,text,link,vlink,alink:
-# attribute of <BODY>. (default is not set)
-# title_begin,title_end:
-# title tag
-# comment_begin,comment_end:
-# comment tag. (/* ... */, // ...)
-# sharp_begin,sharp_end:
-# macro tag. (#include, #define, ...)
-# brace_begin,brace_end:
-# brace tag. ('{', '}')
-# reserved_begin,reserved_end:
-# reserved word tag. (while, if, char, ...)
-# ncol:
-# columns of line number. (default = 4)
-# tabs:
-# tab stop. (default = 8)
-# gzipped_suffix:
-# suffix of compressed html file.
-#
-#---------------------------------------------------------------------
-htags:\
- :bgcolor=silver:text=black:link=blue:vlink=red:alink=cyan:\
- :title_begin=<FONT COLOR=#cc0000>:title_end=</FONT>:\
- :comment_begin=<I><FONT COLOR=green>:comment_end=</FONT></I>:\
- :sharp_begin=<FONT COLOR=darkred>:sharp_end=</FONT>:\
- :brace_begin=<FONT COLOR=blue>:brace_end=</FONT>:\
- :reserved_begin=<B>:reserved_end=</B>:\
- :ncol#4:tabs#8:gzipped_suffix=ghtml:
diff --git a/contrib/global/global/Makefile b/contrib/global/global/Makefile
deleted file mode 100644
index 376b200..0000000
--- a/contrib/global/global/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-PROG= global
-
-.include <bsd.prog.mk>
diff --git a/contrib/global/global/global.1 b/contrib/global/global/global.1
deleted file mode 100644
index 1ec56ab..0000000
--- a/contrib/global/global/global.1
+++ /dev/null
@@ -1,195 +0,0 @@
-.\"
-.\" 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.
-.\"
-.Dd Dec 8, 1998
-.Dt GLOBAL 1
-.Os BSD 4
-.Sh NAME
-.Nm global
-.Nd print the locations of specified object.
-.Sh SYNOPSIS
-.Nm global
-.Op Fl alnrtvx
-.Ar pattern
-.Nm global -c
-.Op Ar prefix
-.Nm global
-.Fl f[anrtx]
-.Ar files
-.Nm global
-.Fl g[alntvx]
-.Ar pattern
-.Nm global
-.Fl i[v]
-.Nm global
-.Fl p
-.Nm global
-.Fl P[alnt]
-.Op Ar pattern
-.Nm global
-.Fl s[alntvx]
-.Ar pattern
-.Sh DESCRIPTION
-.Nm Global
-find the locations of specified object in C, Yacc and Java source files.
-.Nm Global
-can treat a source tree, that is, a directory that has subdirectories and
-source files.
-You can get the relative path of objects from anywhere within the tree.
-.Nm Global
-can locate not only function definitions but also function references and
-other symbols.
-Duplicate entries are allowed.
-.Pp
-In advance of using this command, you must execute
-.Xr gtags 1
-at the root directory of the source tree to make tag files.
-Then you can execute
-.Nm
-at anywhere in the source tree.
-.Sh COMMANDS
-The following commands are available:
-.Bl -tag -width Ds
-.It Ar pattern
-print object which match to the
-.Ar pattern .
-It can include POSIX 1003.2 regular expression.
-.It Fl c Op Ar prefix
-print candidate function names which start with specified
-.Ar prefix .
-If
-.Ar prefix
-is not specified, print all function names.
-.It Fl f Ar files
-print all function definitions in the
-.Ar files .
-This option implies -x option.
-.It Fl g Ar pattern
-print all lines which match to the
-.Ar pattern .
-It is similar to grep(1).
-.It Fl i
-locate tag files and reconstruct them incrementally.
-.It Fl p
-print the location of GTAGS.
-.It Fl P Op Ar pattern
-print the path which match to the
-.Ar pattern .
-If no pattern specified, print all.
-.It Fl s Ar pattern
-print the locations of specified symbol other than function names.
-You need GSYMS tags file. See
-.Xr gtags 1 .
-.Sh OPTIONS
-The following options are available:
-.Bl -tag -width Ds
-.It Fl a
-print absolute path name. By default, print relative path name.
-.It Fl l
-print just objects which exist under the current directory.
-.It Fl n
-suppress sort filter and path conversion filter.
-.It Fl r
-print the locations of object references. By default, print object
-definitions.
-.It Fl t
-print with standard ctags format.
-.It Fl x
-In addition to the default output, produce the line number and
-the line contents.
-.Sh FILES
-.Bl -tag -width tags -compact
-.It Pa GTAGS
-tags file for function definitions.
-.It Pa GRTAGS
-tags file for function references.
-.It Pa GSYMS
-tags file for symbols other then functions.
-.It Pa GPATH
-path index. This is used for incremental updating and compact format.
-.El
-.Sh ENVIRONMENT
-The following environment variables affect the execution of global.
-.Pp
-.Bl -tag -width indent
-.It Ev GTAGSROOT
-The directory which is the root of source tree.
-.It Ev GTAGSDBPATH
-The directory on which gtags database exist. This value is ignored
-when GTAGSROOT is not defined.
-.It Ev GTAGSLIBPATH
-If this variable is set, its value is used as the path to search for library
-functions. If specified function is not found in a source tree,
-global search in these path too.
-.Sh EXAMPLES
-
- % ls -F
- Makefile src/ lib/
- % gtags
- % global main
- src/main.c
- % global -x main
- main 10 src/main.c main (argc, argv) {
- % global -x '^[sg]et'
- set_num 20 lib/util.c set_num(values)
- get_num 30 lib/util.c get_num() {
- % global -rx '^[sg]et'
- set_num 113 src/op.c set_num(32);
- set_num 225 src/opop.c if (set_num(0) > 0) {
- get_num 90 src/op.c while (get_num() > 0) {
- % cd lib
- % global -rx '^[sg]et'
- set_num 113 ../src/op.c set_num(32);
- set_num 225 ../src/opop.c if (set_num(0) > 0) {
- get_num 90 ../src/op.c while (get_num() > 0) {
- % global strlen
- % (cd /usr/src/sys; gtags)
- % setenv GTAGSLIBPATH /usr/src/sys
- % global strlen
- ../../../usr/src/sys/libkern/strlen.c
- % (cd /usr/src/lib; gtags)
- % setenv GTAGSLIBPATH /usr/src/lib:/usr/src/sys
- % global strlen
- ../../../usr/src/lib/libc/string/strlen.c
-
-.Sh DIAGNOSTICS
-.Nm Global
-exits with a non 0 value if an error occurred, 0 otherwise.
-.Sh SEE ALSO
-.Xr btreeop 1 ,
-.Xr gtags 1 ,
-.Xr htags 1 ,
-.Xr vi 1 .
-.Sh AUTHORS
-Shigio Yamaguchi (shigio@wafu.netgate.net)
-.Sh HISTORY
-The
-.Nm
-command appeared in FreeBSD 2.2.2.
diff --git a/contrib/global/global/global.c b/contrib/global/global/global.c
deleted file mode 100644
index a8dbb17..0000000
--- a/contrib/global/global/global.c
+++ /dev/null
@@ -1,907 +0,0 @@
-/*
- * 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.
- *
- * global.c 8-Dec-98
- *
- */
-
-#include <sys/types.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"
-
-const char *progname = "global"; /* command name */
-
-static void usage __P((void));
-static void setcom __P((int));
-int main __P((int, char **));
-void makefilter __P((char *));
-FILE *openfilter __P((void));
-void closefilter __P((FILE *));
-void completelist __P((char *, char *, char *));
-void relative_filter __P((STRBUF *, char *, char *));
-void grep __P((char *));
-void pathlist __P((char *, char *));
-void parsefile __P((int, char **, char *, char *, char *, int));
-void printtag __P((FILE *, char *));
-int notnamechar __P((char *));
-int search __P((char *, char *, char *, char *, int));
-int includepath __P((char *, char *));
-
-char sortfilter[MAXFILLEN+1]; /* sort filter */
-char pathfilter[MAXFILLEN+1]; /* path convert filter */
-char *localprefix; /* local prefix */
-int aflag; /* [option] */
-int cflag; /* command */
-int fflag; /* command */
-int gflag; /* command */
-int iflag; /* command */
-int lflag; /* [option] */
-int nflag; /* [option] */
-int pflag; /* command */
-int Pflag; /* command */
-int rflag; /* [option] */
-int sflag; /* command */
-int tflag; /* [option] */
-int vflag; /* [option] */
-int xflag; /* [option] */
-int pfilter; /* undocumented command */
-
-static void
-usage()
-{
- fprintf(stderr, "usage:\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n",
- "global [-alnrtvx] pattern",
- "global -c [prefix]",
- "global -f[alnrtx] files",
- "global -g[alntvx] pattern",
- "global -i[v]",
- "global -p[v]",
- "global -P[alnt] [pattern]",
- "global -s[alntvx] pattern");
- exit(1);
-}
-
-static int command;
-static void
-setcom(c)
-int c;
-{
- if (command == 0)
- command = c;
- else
- usage();
-}
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- char *av;
- int count;
- int db;
- char cwd[MAXPATHLEN+1]; /* current directory */
- char root[MAXPATHLEN+1]; /* root of source tree */
- char dbpath[MAXPATHLEN+1]; /* dbpath directory */
-
- while (--argc > 0 && (++argv)[0][0] == '-') {
- char *p;
-
- if (!strcmp(argv[0], "--filter")) {
- pfilter++;
- continue;
- }
- for (p = argv[0] + 1; *p; p++) {
- switch (*p) {
- case 'a':
- aflag++;
- break;
- case 'c':
- cflag++;
- setcom(*p);
- break;
- case 'f':
- fflag++;
- xflag++;
- setcom(*p);
- break;
- case 'l':
- lflag++;
- break;
- case 'n':
- nflag++;
- break;
- case 'g':
- gflag++;
- setcom(*p);
- break;
- case 'i':
- iflag++;
- setcom(*p);
- break;
- case 'p':
- pflag++;
- setcom(*p);
- break;
- case 'P':
- Pflag++;
- setcom(*p);
- break;
- case 'r':
- rflag++;
- break;
- case 's':
- sflag++;
- setcom(*p);
- break;
- case 't':
- tflag++;
- break;
- case 'v':
- vflag++;
- break;
- case 'x':
- xflag++;
- break;
- default:
- usage();
- }
- }
- }
- av = (argc > 0) ? *argv : NULL;
- /*
- * only -c, -i, -P and -p allows no argment.
- */
- if (!av && !pfilter) {
- switch (command) {
- case 'c':
- case 'i':
- case 'p':
- case 'P':
- break;
- default:
- usage();
- }
- }
- /*
- * invalid options are just ignored.
- */
- /*
- * remove leading blanks.
- */
- if (av && !gflag)
- for (; *av == ' ' || *av == '\t'; av++)
- ;
- if (cflag && av && notnamechar(av))
- die("only name char is allowed with -c option.");
- /*
- * get path of following directories.
- * o current directory
- * o root of source tree
- * o dbpath directory
- *
- * if GTAGS not found, getdbpath doesn't return.
- */
- if (pflag && vflag) {
- char *gtagsdbpath = getenv("GTAGSDBPATH");
- char *gtagsroot = getenv("GTAGSROOT");
- if (gtagsdbpath && !gtagsroot)
- fprintf(stdout, "warning: GTAGSDBPATH is ignored becase GTAGSROOT is not set.\n");
- }
- getdbpath(cwd, root, dbpath);
-
- if (pflag) {
- fprintf(stdout, "%s\n", dbpath);
- exit(0);
- }
- /*
- * incremental update of tag files.
- */
- if (iflag) {
- STRBUF *sb = stropen();
-
- if (chdir(root) < 0)
- die1("cannot change directory to '%s'.", root);
- strputs(sb, "gtags -i");
- if (vflag)
- strputc(sb, 'v');
- strputc(sb, ' ');
- strputs(sb, dbpath);
- if (system(strvalue(sb)))
- exit(1);
- strclose(sb);
- exit(0);
- }
-
- /*
- * complete function name
- */
- if (cflag) {
- completelist(dbpath, root, av);
- exit(0);
- }
- /*
- * make sort filter.
- */
- if (sflag && xflag)
- strcpy(sortfilter, "");
- else if (tflag) /* ctags format */
- strcpy(sortfilter, "sort +0 -1 +1 -2 +2n -3");
- else if (fflag)
- strcpy(sortfilter, "sort +2 -3 +1n -2");
- else if (xflag) /* print details */
- strcpy(sortfilter, "sort +0 -1 +2 -3 +1n -2");
- else /* print just file name */
- strcpy(sortfilter, "sort | uniq");
- /*
- * make path filter.
- */
- if (aflag) /* absolute path name */
- sprintf(pathfilter, "sed -e 's!\\.!%s!'", root);
- else { /* relative path name */
- STRBUF *sb = stropen();
-
- relative_filter(sb, root, cwd);
- strcpy(pathfilter, strvalue(sb));
- strclose(sb);
- }
- /*
- * make local prefix.
- */
- if (lflag) {
- char *p = cwd + strlen(root);
- STRBUF *sb = stropen();
- /*
- * getdbpath() assure follows.
- * cwd != "/" and cwd includes root.
- */
- strputc(sb, '.');
- if (*p)
- strputs(sb, p);
- strputc(sb, '/');
- localprefix = strdup(strvalue(sb));
- if (!localprefix)
- die("short of memory.");
- strclose(sb);
- }
- /*
- * print filter.
- */
- if (pfilter) {
- char filter[MAXFILLEN+1];
-
- makefilter(filter);
- fprintf(stdout, "%s\n", filter);
- exit(0);
- }
- /*
- * grep the pattern in a source tree.
- */
- if (gflag) {
- if (!lflag)
- chdir(root);
- else if (!aflag)
- sprintf(pathfilter, "sed -e 's!\\./!!'");
- grep(av);
- exit(0);
- }
- /*
- * locate the path including the pattern in a source tree.
- */
- if (Pflag) {
- pathlist(dbpath, av);
- exit(0);
- }
- db = (rflag) ? GRTAGS : ((sflag) ? GSYMS : GTAGS);
- /*
- * print function definitions.
- */
- if (fflag) {
- parsefile(argc, argv, cwd, root, dbpath, db);
- exit(0);
- }
- /*
- * search in current source tree.
- */
- count = search(av, cwd, root, dbpath, db);
- /*
- * search in library path.
- */
- if (count == 0 && !rflag && !sflag && !notnamechar(av) && getenv("GTAGSLIBPATH")) {
- char buf[MAXENVLEN+1];
- char libdbpath[MAXPATHLEN+1];
- char *p, *lib;
-
- strcpy(buf, getenv("GTAGSLIBPATH"));
- p = buf;
- while (p) {
- lib = p;
- if ((p = locatestring(p, ":", MATCH_FIRST)) != NULL)
- *p++ = 0;
- if (!gtagsexist(lib, libdbpath))
- continue;
- if (!strcmp(dbpath, libdbpath))
- continue;
- if (aflag) /* absolute path name */
- sprintf(pathfilter, "sed -e 's!\\.!%s!'", lib);
- else {
- STRBUF *sb = stropen();
- relative_filter(sb, lib, cwd);
- strcpy(pathfilter, strvalue(sb));
- strclose(sb);
- }
- count = search(av, cwd, lib, libdbpath, db);
- if (count > 0) {
- strcpy(dbpath, libdbpath);
- break;
- }
- }
- }
- if (vflag) {
- if (count) {
- if (count == 1)
- fprintf(stderr, "%d object located", count);
- if (count > 1)
- fprintf(stderr, "%d objects located", count);
- fprintf(stderr, " (using '%s').\n", makepath(dbpath, dbname(db)));
- } else {
- fprintf(stderr, "'%s' not found.\n", av);
- }
- }
- exit(0);
-}
-/*
- * makefilter: make filter string.
- *
- * io) filter buffer
- */
-void
-makefilter(filter)
-char *filter;
-{
- if (nflag)
- filter[0] = 0;
- else if (sortfilter[0] == 0 && pathfilter[0] == 0)
- filter[0] = 0;
- else if (sortfilter[0] && pathfilter[0])
- sprintf(filter, "%s | %s", sortfilter, pathfilter);
- else if (sortfilter[0])
- strcpy(filter, sortfilter);
- else
- strcpy(filter, pathfilter);
-}
-/*
- * openfilter: open output filter.
- *
- * gi) pathfilter
- * gi) sortfilter
- * r) output filter
- */
-FILE *
-openfilter(void)
-{
- FILE *op;
- char filter[MAXFILLEN+1];
-
- makefilter(filter);
- if (filter[0] == 0)
- op = stdout;
- else
- op = popen(filter, "w");
- return op;
-}
-void
-closefilter(op)
-FILE *op;
-{
- if (op != stdout)
- pclose(op);
-}
-/*
- * completelist: print complete list of function
- *
- * i) dbpath dbpath directory
- * i) root root directory
- * i) prefix prefix of primary key
- */
-void
-completelist(dbpath, root, prefix)
-char *dbpath;
-char *root;
-char *prefix;
-{
- char *p;
- int flags = GTOP_KEY;
- GTOP *gtop;
-
- if (prefix && *prefix == 0) /* In the case global -c '' */
- prefix = NULL;
- if (prefix)
- flags |= GTOP_PREFIX;
- gtop = gtagsopen(dbpath, root, GTAGS, GTAGS_READ, 0);
- for (p = gtagsfirst(gtop, prefix, flags); p; p = gtagsnext(gtop))
- (void)fprintf(stdout, "%s\n", p);
- gtagsclose(gtop);
-}
-/*
- * relative_filter: make relative path filter
- *
- * i) sb string buffer
- * i) root the root directory of source tree
- * i) cwd current directory
- * r) relative path filter
- */
-void
-relative_filter(sb, root, cwd)
-STRBUF *sb;
-char *root;
-char *cwd;
-{
- char *p, *c, *branch;
-
- /*
- * get branch point.
- */
- branch = cwd;
- for (p = root, c = cwd; *p && *c && *p == *c; p++, c++)
- if (*c == '/')
- branch = c;
- if (*p == 0 && (*c == 0 || *c == '/'))
- branch = c;
- /*
- * forward to root.
- */
- strputs(sb, "sed -e 's!\\./!");
- for (c = branch; *c; c++)
- if (*c == '/')
- strputs(sb, "../");
- p = root + (branch - cwd);
- /*
- * backward to leaf.
- */
- if (*p) {
- p++;
- strputs(sb, p);
- strputc(sb, '/');
- }
- strputs(sb, "!'");
- /*
- * remove redundancy.
- */
- if (*branch) {
- char unit[256];
-
- p = unit;
- for (c = branch + 1; ; c++) {
- if (*c == 0 || *c == '/') {
- *p = 0;
- strputs(sb, " -e 's!\\.\\./");
- strputs(sb, unit);
- strputs(sb, "/!!'");
- if (*c == 0)
- break;
- p = unit;
- } else
- *p++ = *c;
- }
- }
-}
-/*
- * printtag: print a tag's line
- *
- * i) op output stream
- * i) bp tag's line
- */
-void
-printtag(op, bp)
-FILE *op;
-char *bp;
-{
- if (tflag) {
- char buf[MAXBUFLEN+1];
- char lno[20], *l = lno;
- char *p = bp;
- char *q = buf;
-
- while (*p && !isspace(*p))
- *q++ = *p++;
- *q++ = '\t';
- for (; *p && isspace(*p); p++)
- ;
- while (*p && isdigit(*p))
- *l++ = *p++;
- *l = 0;
- for (; *p && isspace(*p); p++)
- ;
- while (*p && !isspace(*p))
- *q++ = *p++;
- *q++ = '\t';
- l = lno;
- while (*l)
- *q++ = *l++;
- *q = 0;
- fprintf(op, "%s\n", buf);
- } else if (!xflag) {
- char *p = locatestring(bp, "./", MATCH_FIRST);
-
- if (p == NULL)
- die("illegal tag format (path not found).");
- while (*p && *p != ' ' && *p != '\t')
- (void)putc(*p++, op);
- (void)putc('\n', op);
- } else
- detab(op, bp);
-}
-
-/*
- * notnamechar: test whether or not no name char included.
- *
- * i) s string
- * r) 0: not included, 1: included
- */
-int
-notnamechar(s)
-char *s;
-{
- int c;
-
- while ((c = *s++) != '\0')
- if ( (c >= 'a' && c <= 'z') ||
- (c >= 'A' && c <= 'Z') ||
- (c >= '0' && c <= '9') ||
- (c == '-') || (c == '_'))
- ;
- else
- return 1;
- return 0;
-}
-/*
- * grep: grep pattern
- *
- * i) pattern POSIX regular expression
- */
-void
-grep(pattern)
-char *pattern;
-{
- FILE *op, *fp;
- char *path;
- char edit[IDENTLEN+1];
- char *buffer;
- int linenum, count, editlen;
- regex_t preg;
-
- /*
- * convert spaces into %FF format.
- */
- {
- char *p, *e = edit;
- for (p = pattern; *p; p++) {
- if (*p == '%' || *p == ' ' || *p == '\t') {
- sprintf(e, "%%%02x", *p);
- e += 3;
- } else
- *e++ = *p;
- }
- *e = 0;
- }
- editlen = strlen(edit);
-
- if (regcomp(&preg, pattern, REG_EXTENDED) != 0)
- die("illegal regular expression.");
- if (!(op = openfilter()))
- die("cannot open output filter.");
- count = 0;
- for (findopen(); (path = findread(NULL)) != NULL; ) {
- if (!(fp = fopen(path, "r")))
- die1("cannot open file '%s'.", path);
- linenum = 0;
- while ((buffer = mgets(fp, NULL, 0)) != NULL) {
- linenum++;
- if (regexec(&preg, buffer, 0, 0, 0) == 0) {
- count++;
- if (tflag)
- fprintf(op, "%s\t%s\t%d\n",
- edit, path, linenum);
- else if (!xflag) {
- fprintf(op, "%s\n", path);
- break;
- } else if (editlen >= 16 && linenum >= 1000)
- fprintf(op, "%-16s %4d %-16s %s\n",
- edit, linenum, path, buffer);
- else
- fprintf(op, "%-16s%4d %-16s %s\n",
- edit, linenum, path, buffer);
- }
- }
- fclose(fp);
- }
- findclose();
- closefilter(op);
- if (vflag) {
- if (count == 0)
- fprintf(stderr, "object not found.\n");
- if (count == 1)
- fprintf(stderr, "%d object located.\n", count);
- if (count > 1)
- fprintf(stderr, "%d objects located.\n", count);
- }
-}
-/*
- * pathlist: print candidate path list.
- *
- * i) dbpath
- */
-void
-pathlist(dbpath, av)
-char *dbpath;
-char *av;
-{
- FILE *op;
- const char *tag = av;
- char key[10], *path;
- regex_t preg;
- int i, lim;
-
- if (av) {
- if (regcomp(&preg, av, REG_EXTENDED) != 0)
- die("illegal regular expression.");
- } else
- tag = "file";
- if (!(op = openfilter()))
- die("cannot open output filter.");
- if (pathopen(dbpath, 0) < 0)
- die("GPATH not found.");
- lim = nextkey();
- for (i = 0; i < lim; i++) {
- sprintf(key, "%d", i);
- if ((path = pathget(key)) == NULL)
- continue;
- if (lflag && !locatestring(path, localprefix, MATCH_AT_FIRST))
- continue;
- if (av && regexec(&preg, path + 2, 0, 0, 0) != 0)
- continue;
- if (tflag)
- fprintf(op, "%s\t%s\t1\n", tag, path);
- else
- fprintf(op, "%s\n", path);
- }
- pathclose();
- closefilter(op);
-}
-/*
- * parsefile: parse file to pick up tags.
- *
- * i) db
- * i) dbpath
- * i) root
- * i) cwd
- * i) argc
- * i) argv
- */
-void
-parsefile(argc, argv, cwd, root, dbpath, db)
-int argc;
-char **argv;
-char *cwd;
-char *root;
-char *dbpath;
-int db;
-{
- char buf[MAXPATHLEN+1], *path;
- char *p;
- FILE *ip, *op;
- char *parser, *av;
- STRBUF *sb = stropen();
- STRBUF *com = stropen();
-
- /*
- * get parser.
- */
- if (!getconfs(dbname(db), sb))
- die1("cannot get parser for %s.", dbname(db));
- parser = strvalue(sb);
-
- if (!(op = openfilter()))
- die("cannot open output filter.");
- if (pathopen(dbpath, 0) < 0)
- die("GPATH not found.");
- for (; argc > 0; argv++, argc--) {
- av = argv[0];
-
- if (test("d", av)) {
- fprintf(stderr, "'%s' is a directory.\n", av);
- continue;
- }
- if (!test("f", NULL)) {
- fprintf(stderr, "'%s' not found.\n", av);
- continue;
- }
- /*
- * convert path into relative from root directory of source tree.
- */
- path = realpath(av, buf);
- if (*path != '/')
- die("realpath(3) is not compatible with BSD version.");
- if (strncmp(path, root, strlen(root))) {
- fprintf(stderr, "'%s' is out of source tree.\n", path);
- continue;
- }
- path += strlen(root) - 1;
- *path = '.';
- if (!pathget(path)) {
- fprintf(stderr, "'%s' not found in GPATH.\n", path);
- continue;
- }
- if (chdir(root) < 0)
- die1("cannot move to '%s' directory.", root);
- /*
- * make command line.
- */
- strstart(com);
- makecommand(parser, path, com);
- if (!(ip = popen(strvalue(com), "r")))
- die1("cannot execute '%s'.", strvalue(com));
- while ((p = mgets(ip, NULL, 0)) != NULL)
- printtag(op, p);
- pclose(ip);
- if (chdir(cwd) < 0)
- die1("cannot move to '%s' directory.", cwd);
- }
- pathclose();
- closefilter(op);
- strclose(com);
- strclose(sb);
-}
-/*
- * search: search specified function
- *
- * i) pattern search pattern
- * i) cwd current directory
- * i) root root of source tree
- * i) dbpath database directory
- * i) db GTAGS,GRTAGS,GSYMS
- * r) count of output lines
- */
-int
-search(pattern, cwd, root, dbpath, db)
-char *pattern;
-char *cwd;
-char *root;
-char *dbpath;
-int db;
-{
- char *p;
- int count = 0;
- FILE *op;
- GTOP *gtop;
- regex_t preg;
-
- /*
- * open tag file.
- */
- gtop = gtagsopen(dbpath, root, db, GTAGS_READ, 0);
- if (!(op = openfilter()))
- die("cannot open output filter.");
- /*
- * regular expression.
- */
- if (!strcmp(pattern, ".*")) {
- for (p = gtagsfirst(gtop, NULL, 0); p; p = gtagsnext(gtop)) {
- if (lflag) {
- char *q;
- /* locate start point of a path */
- q = locatestring(p, "./", MATCH_FIRST);
- if (!locatestring(q, localprefix, MATCH_AT_FIRST))
- continue;
- }
- printtag(op, p);
- count++;
- }
-
- } else if (notnamechar(pattern) && regcomp(&preg, pattern, REG_EXTENDED) == 0) {
- if (*pattern == '^' && *(p = pattern + 1) && (isalpha(*p) || *p == '_')) {
- char buf[IDENTLEN+1];
- char *prefix = buf;
-
- *prefix++ = *p++;
- while (*p && (isalpha(*p) || isdigit(*p) || *p == '_'))
- *prefix++ = *p++;
- *prefix = 0;
- prefix = buf;
- p = gtagsfirst(gtop, prefix, GTOP_PREFIX);
- } else {
- p = gtagsfirst(gtop, NULL, 0);
- }
- for (; p; p = gtagsnext(gtop)) {
- /*
- * search $1 of tag line (not key)
- */
- if (regexec(&preg, strmake(gtop->dbop->lastdat, " \t"), 0, 0, 0) != 0)
- continue;
- if (lflag) {
- char *q;
- /* locate start point of a path */
- q = locatestring(p, "./", MATCH_FIRST);
- if (!locatestring(q, localprefix, MATCH_AT_FIRST))
- continue;
- }
- printtag(op, p);
- count++;
- }
- } else {
- for (p = gtagsfirst(gtop, pattern, 0); p; p = gtagsnext(gtop)) {
- if (lflag) {
- char *q;
- /* locate start point of a path */
- q = locatestring(p, "./", MATCH_FIRST);
- if (!locatestring(q, localprefix, MATCH_AT_FIRST))
- continue;
- }
- printtag(op, p);
- count++;
- }
- }
- closefilter(op);
- gtagsclose(gtop);
- return count;
-}
-/*
- * includepath: check if the path included in tag line or not.
- *
- * i) line tag line
- * i) path path
- * r) 0: doesn't included, 1: included
- */
-int
-includepath(line, path)
-char *line;
-char *path;
-{
- char *p;
- int length;
-
- if (!(p = locatestring(line, "./", MATCH_FIRST)))
- die("illegal tag format (path not found).");
- length = strlen(path);
- if (strncmp(p, path, length))
- return 0;
- p += length;
- if (*p == ' ' || *p == '\t')
- return 1;
- return 0;
-}
diff --git a/contrib/global/gozilla/Imakefile b/contrib/global/gozilla/Imakefile
deleted file mode 100644
index 035c544..0000000
--- a/contrib/global/gozilla/Imakefile
+++ /dev/null
@@ -1,24 +0,0 @@
-XCOMM
-XCOMM Imakefile for gozilla
-XCOMM
-
- INC = ../lib
-LOCAL_LIBRARIES = XawClientLibs
- DEPLIBS = XawClientDepLibs
- DEFINES = -DSTANDALONE -DGLOBAL -I$(INC)
-
- SRCS = gozilla.c remote.c test.c getdbpath.c strbuf.c conf.c \
- mgets.c locatestring.c makepath.c strmake.c
- OBJS = gozilla.o remote.o test.o getdbpath.o strbuf.o conf.o \
- mgets.o locatestring.o makepath.o strmake.o
-
-LinkSourceFile(test.c,$(INC))
-LinkSourceFile(getdbpath.c,$(INC))
-LinkSourceFile(strbuf.c,$(INC))
-LinkSourceFile(conf.c,$(INC))
-LinkSourceFile(mgets.c,$(INC))
-LinkSourceFile(locatestring.c,$(INC))
-LinkSourceFile(makepath.c,$(INC))
-LinkSourceFile(strmake.c,$(INC))
-
-ComplexProgramTarget(gozilla)
diff --git a/contrib/global/gozilla/gozilla.c b/contrib/global/gozilla/gozilla.c
deleted file mode 100644
index 32d4730..0000000
--- a/contrib/global/gozilla/gozilla.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * 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.
- *
- * gozilla.c 17-Jul-98
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "global.h"
-
-const char *progname = "gozilla"; /* command name */
-
-static void usage __P((void));
-
-int main __P((int, char **));
-int issource __P((char *));
-int sendcommand __P((char *));
-
-int bflag;
-int pflag;
-int Cflag;
-
-static void
-usage()
-{
- fprintf(stderr, "usage:\t%s\n\t%s\n",
- "gozilla [+no] [-b browser] [-p] file",
- "gozilla -C command");
- exit(1);
-}
-
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- char c, *p, *q;
- char *browser = NULL;
- char *command = NULL;
- char *arg = NULL;
- char URL[MAXPATHLEN+1];
- char com[MAXFILLEN+1];
- int linenumber = 0;
- int status;
-
- while (--argc > 0 && (c = (++argv)[0][0]) == '-' || c == '+') {
- if (c == '+') {
- linenumber = atoi(argv[0] + 1);
- continue;
- }
- p = argv[0] + 1;
- switch (*p) {
- case 'b':
- browser = argv[1];
- --argc; ++argv;
- break;
- case 'p':
- pflag++;
- break;
- case 'C':
- command = argv[1];
- --argc; ++argv;
- break;
- default:
- usage();
- }
- }
- if (!browser && getenv("BROWSER"))
- browser = getenv("BROWSER");
- if (command) {
- if (browser)
- die("-C option is valid only for mozilla.");
- if (sendcommand(command) == -1)
- die("mozilla not found.");
- exit(0);
- }
- if (argc == 0)
- usage();
- if (locatestring(argv[0], "http:", MATCH_AT_FIRST) ||
- locatestring(argv[0], "ftp:", MATCH_AT_FIRST) ||
- locatestring(argv[0], "news:", MATCH_AT_FIRST) ||
- locatestring(argv[0], "mail:", MATCH_AT_FIRST) ||
- locatestring(argv[0], "file:", MATCH_AT_FIRST))
- strcpy(URL, argv[0]);
- else {
- char *abspath;
- char buf[MAXPATHLEN+1];
-
- if (!test("f", argv[0]) && !test("d", NULL))
- die1("path '%s' not found.", argv[0]);
- if (!(abspath = realpath(argv[0], buf)))
- die1("cannot make absolute path name. realpath(%s) failed.", argv[0]);
- if (*abspath != '/')
- die("realpath(3) is not compatible with BSD version.");
- if (issource(abspath)) {
- char cwd[MAXPATHLEN+1];
- char root[MAXPATHLEN+1];
- char dbpath[MAXPATHLEN+1];
- char htmldir[MAXPATHLEN+1];
- /*
- * get current, root and dbpath directory.
- * if GTAGS not found, getdbpath doesn't return.
- */
- getdbpath(cwd, root, dbpath);
- if (test("d", makepath(dbpath, "HTML")))
- strcpy(htmldir, makepath(dbpath, "HTML"));
- else if (test("d", makepath(root, "HTML")))
- strcpy(htmldir, makepath(root, "HTML"));
- else
- die("hypertext not found. See htags(1).");
- /*
- * convert path into hypertext.
- */
- p = abspath + strlen(root);
- for (q = ++p; *q; q++)
- if (*q == '/')
- *q = ' ';
- if (linenumber)
- sprintf(URL, "file:%s/S/%s.html#%d", htmldir, p, linenumber);
- else
- sprintf(URL, "file:%s/S/%s.html", htmldir, p);
- } else {
- sprintf(URL, "file:%s", abspath);
- }
- }
- if (pflag) {
- fprintf(stdout, "%s\n", URL);
- exit(0);
- }
- /*
- * execute generic browser.
- */
- if (browser && !locatestring(browser, "netscape", MATCH_AT_LAST)) {
- sprintf(com, "%s '%s'", browser, URL);
- system(com);
- exit (0);
- }
- /*
- * send a command to mozilla.
- */
- sprintf(com, "openURL(%s)", URL);
- status = sendcommand(com);
- /*
- * load mozilla if not found.
- */
- if (status != 0) {
- int pid;
-
- if ((pid = fork()) < 0) {
- die("cannot execute netscape (fork).");
- } else if (pid == 0) {
- execlp("netscape", "netscape", URL, NULL);
- die("loading mozilla failed.");
- }
- exit(0);
- }
- exit(status);
-}
-int
-issource(path)
-char *path;
-{
- STRBUF *sb = stropen();
- char *p;
- char suff[MAXPATHLEN+1];
- int retval = 0;
-
- if (!getconfs("suffixes", sb)) {
- strclose(sb);
- return 0;
- }
- suff[0] = '.';
- for (p = strvalue(sb); p; ) {
- char *unit = p;
- if ((p = locatestring(p, ",", MATCH_FIRST)) != NULL)
- *p++ = 0;
- strcpy(&suff[1], unit);
- if (locatestring(path, suff, MATCH_AT_LAST)) {
- retval = 1;
- break;
- }
- }
- strclose(sb);
- return retval;
-
-}
-int
-sendcommand(com)
-char *com;
-{
- int argc = 3;
- char *argv[4];
-
- argv[0] = "netscape-remote";
- argv[1] = "-remote";
- argv[2] = com;
- argv[3] = NULL;
-
- return netscape_remote(argc, argv);
-}
diff --git a/contrib/global/gozilla/gozilla.man b/contrib/global/gozilla/gozilla.man
deleted file mode 100644
index 39e257f..0000000
--- a/contrib/global/gozilla/gozilla.man
+++ /dev/null
@@ -1,145 +0,0 @@
-.\"
-.\" Copyright (c) 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.
-.\"
-.Dd Sep 17, 1997
-.Dt GOZILLA 1
-.Os BSD 4
-.Sh NAME
-.Nm gozilla
-.Nd force mozilla to display specified source file
-.Sh SYNOPSIS
-\fBgozilla\fP [\fB+\fP\fIno\fP]
-.Op Fl b Ar browser
-.Op Fl p
-.Ar file
-.Nm gozilla
-.Fl C Ar command
-.Sh DESCRIPTION
-First form:
-.br
-.Nm Gozilla
-force mozilla (Netscape Navigator) to display specified source file
-as a hypertext.
-If mozilla has not loaded then
-.Nm
-loads it.
-.Pp
-In advance of using this command, you must execute
-.Xr gtags 1
-and
-.Xr htags 1
-at the root directory of the source tree to make tag files.
-Then you can execute
-.Nm
-at anywhere in the source tree.
-.br
-You can specify source file and the line number optionally.
-.Pp
-Second form:
-.br
-.Nm Gozilla
-send
-.Ar command
-to mozilla directly.
-.Ar Command
-is undocumented. But the hint is in the resource file of mozilla.
-.Pp
-The following options are available:
-.Bl -tag -width Ds
-.It Ar \fB+\fP\fIno\fP
-line number. It must be a line on which function definition or function
-reference is exist.
-If you execute
-.Xr htags 1
-with -l option, you can specify any line.
-.It Fl b Ar browser
-browser to use. By default, assumes mozilla.
-If you specify another browser,
-.Nm
-waits for exiting of the browser.
-.It Fl p
-just print generated target URL.
-.It Ar file
-path of source file.
-.It Fl C Ar command
-send
-.Ar command
-to mozilla directly.
-.El
-.Sh FILES
-.Bl -tag -width tags -compact
-.It Pa HTML/
-hypertext of source tree.
-.It Pa GTAGS
-tags file for function definitions.
-.El
-.Sh ENVIRONMENT
-The following environment variables affect the execution of gozilla.
-.Pp
-.Bl -tag -width indent
-.It Ev GTAGSROOT
-The directory which is the root of source tree.
-.It Ev GTAGSDBPATH
-The directory on which HTML directory exist. This value is ignored
-when GTAGSROOT is not defined.
-.It Ev BROWSER
-browser to use. By default, assumes mozilla.
-.El
-.Sh EXAMPLES
-
- % global -x main
- main 82 ctags.c main(argc, argv)
- % gozilla +82 ctags.c
- % gozilla -C pageDown
- % gozilla -C back
-
-.Sh DIAGNOSTICS
-.Nm Gozilla
-exits with a non 0 value if an error occurred, 0 otherwise.
-.Sh SEE ALSO
-.Xr global 1 ,
-.Xr gtags 1 ,
-.Xr htags 1 .
-.Sh NOTES
-Netscape Navigator is a registered trademark of Netscape Communications Corporation
-in the United States and other countries.
-.Pp
-.Nm Gozilla
-means 'Global for mozilla'.
-.Sh BUGS
-.Nm Gozilla
-can treat not only source file but also normal file, directory, HTML file
-and even URL, because it is omnivorous.
-.Sh AUTHORS
-Shigio Yamaguchi (shigio@wafu.netgate.net)
-.Sh HISTORY
-The
-.Nm
-command appeared in FreeBSD 2.2.5.
diff --git a/contrib/global/gozilla/remote.c b/contrib/global/gozilla/remote.c
deleted file mode 100644
index ebc08d7..0000000
--- a/contrib/global/gozilla/remote.c
+++ /dev/null
@@ -1,717 +0,0 @@
-/* -*- Mode:C; tab-width: 8 -*-
- * remote.c --- remote control of Netscape Navigator for Unix.
- * version 1.1.3, for Netscape Navigator 1.1 and newer.
- *
- * 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
- * documentation. No representations are made about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * To compile:
- *
- * cc -o netscape-remote remote.c -DSTANDALONE -lXmu -lX11
- *
- * To use:
- *
- * netscape-remote -help
- *
- * Documentation for the protocol which this code implements may be found at:
- *
- * http://home.netscape.com/newsref/std/x-remote.html
- *
- * Bugs and commentary to x_cbug@netscape.com.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/Xmu/WinUtil.h> /* for XmuClientWindow() */
-
-
-/* vroot.h is a header file which lets a client get along with `virtual root'
- window managers like swm, tvtwm, olvwm, etc. If you don't have this header
- file, you can find it at "http://home.netscape.com/newsref/std/vroot.h".
- If you don't care about supporting virtual root window managers, you can
- comment this line out.
- */
-#include "vroot.h"
-
-
-#ifdef STANDALONE
-#ifdef GLOBAL
- extern char *progname;
-#else
- static const char *progname = 0;
-#endif
- static const char *expected_mozilla_version = "1.1";
-#else /* !STANDALONE */
- extern const char *progname;
- extern const char *expected_mozilla_version;
-#endif /* !STANDALONE */
-
-#define MOZILLA_VERSION_PROP "_MOZILLA_VERSION"
-#define MOZILLA_LOCK_PROP "_MOZILLA_LOCK"
-#define MOZILLA_COMMAND_PROP "_MOZILLA_COMMAND"
-#define MOZILLA_RESPONSE_PROP "_MOZILLA_RESPONSE"
-static Atom XA_MOZILLA_VERSION = 0;
-static Atom XA_MOZILLA_LOCK = 0;
-static Atom XA_MOZILLA_COMMAND = 0;
-static Atom XA_MOZILLA_RESPONSE = 0;
-
-static void
-mozilla_remote_init_atoms (Display *dpy)
-{
- if (! XA_MOZILLA_VERSION)
- XA_MOZILLA_VERSION = XInternAtom (dpy, MOZILLA_VERSION_PROP, False);
- if (! XA_MOZILLA_LOCK)
- XA_MOZILLA_LOCK = XInternAtom (dpy, MOZILLA_LOCK_PROP, False);
- if (! XA_MOZILLA_COMMAND)
- XA_MOZILLA_COMMAND = XInternAtom (dpy, MOZILLA_COMMAND_PROP, False);
- if (! XA_MOZILLA_RESPONSE)
- XA_MOZILLA_RESPONSE = XInternAtom (dpy, MOZILLA_RESPONSE_PROP, False);
-}
-
-static Window
-mozilla_remote_find_window (Display *dpy)
-{
- int i;
- Window root = RootWindowOfScreen (DefaultScreenOfDisplay (dpy));
- Window root2, parent, *kids;
- unsigned int nkids;
- Window result = 0;
- Window tenative = 0;
- unsigned char *tenative_version = 0;
-
- if (! XQueryTree (dpy, root, &root2, &parent, &kids, &nkids))
- {
- fprintf (stderr, "%s: XQueryTree failed on display %s\n", progname,
- DisplayString (dpy));
- exit (2);
- }
-
- /* root != root2 is possible with virtual root WMs. */
-
- if (! (kids && nkids))
- {
- fprintf (stderr, "%s: root window has no children on display %s\n",
- progname, DisplayString (dpy));
- exit (2);
- }
-
- for (i = nkids-1; i >= 0; i--)
- {
- Atom type;
- int format;
- unsigned long nitems, bytesafter;
- unsigned char *version = 0;
- Window w = XmuClientWindow (dpy, kids[i]);
- int status = XGetWindowProperty (dpy, w, XA_MOZILLA_VERSION,
- 0, (65536 / sizeof (long)),
- False, XA_STRING,
- &type, &format, &nitems, &bytesafter,
- &version);
- if (! version)
- continue;
- if (strcmp ((char *) version, expected_mozilla_version) &&
- !tenative)
- {
- tenative = w;
- tenative_version = version;
- continue;
- }
- XFree (version);
- if (status == Success && type != None)
- {
- result = w;
- break;
- }
- }
-
- if (result && tenative)
- {
-#ifndef GLOBAL
- fprintf (stderr,
- "%s: warning: both version %s (0x%x) and version\n"
- "\t%s (0x%x) are running. Using version %s.\n",
- progname, tenative_version, (unsigned int) tenative,
- expected_mozilla_version, (unsigned int) result,
- expected_mozilla_version);
-#endif
- XFree (tenative_version);
- return result;
- }
- else if (tenative)
- {
-#ifndef GLOBAL
- fprintf (stderr,
- "%s: warning: expected version %s but found version\n"
- "\t%s (0x%x) instead.\n",
- progname, expected_mozilla_version,
- tenative_version, (unsigned int) tenative);
-#endif
- XFree (tenative_version);
- return tenative;
- }
- else if (result)
- {
- return result;
- }
- else
- {
-#ifdef GLOBAL
- return 0;
-#else
- fprintf (stderr, "%s: not running on display %s\n", progname,
- DisplayString (dpy));
- exit (1);
-#endif
- }
-}
-
-static void
-mozilla_remote_check_window (Display *dpy, Window window)
-{
- Atom type;
- int format;
- unsigned long nitems, bytesafter;
- unsigned char *version = 0;
- int status = XGetWindowProperty (dpy, window, XA_MOZILLA_VERSION,
- 0, (65536 / sizeof (long)),
- False, XA_STRING,
- &type, &format, &nitems, &bytesafter,
- &version);
- if (status != Success || !version)
- {
- fprintf (stderr, "%s: window 0x%x is not a Netscape window.\n",
- progname, (unsigned int) window);
- exit (6);
- }
- else if (strcmp ((char *) version, expected_mozilla_version))
- {
- fprintf (stderr,
- "%s: warning: window 0x%x is Netscape version %s;\n"
- "\texpected version %s.\n",
- progname, (unsigned int) window,
- version, expected_mozilla_version);
- }
- XFree (version);
-}
-
-
-static char *lock_data = 0;
-
-static void
-mozilla_remote_obtain_lock (Display *dpy, Window window)
-{
- Bool locked = False;
- Bool waited = False;
-
- if (! lock_data)
- {
- lock_data = (char *) malloc (255);
- sprintf (lock_data, "pid%d@", getpid ());
- if (gethostname (lock_data + strlen (lock_data), 100))
- {
- perror ("gethostname");
- exit (-1);
- }
- }
-
- do
- {
- int result;
- Atom actual_type;
- int actual_format;
- unsigned long nitems, bytes_after;
- unsigned char *data = 0;
-
- XGrabServer (dpy); /* ################################# DANGER! */
-
- result = XGetWindowProperty (dpy, window, XA_MOZILLA_LOCK,
- 0, (65536 / sizeof (long)),
- False, /* don't delete */
- XA_STRING,
- &actual_type, &actual_format,
- &nitems, &bytes_after,
- &data);
- if (result != Success || actual_type == None)
- {
- /* It's not now locked - lock it. */
-#ifdef DEBUG_PROPS
- fprintf (stderr, "%s: (writing " MOZILLA_LOCK_PROP
- " \"%s\" to 0x%x)\n",
- progname, lock_data, (unsigned int) window);
-#endif
- XChangeProperty (dpy, window, XA_MOZILLA_LOCK, XA_STRING, 8,
- PropModeReplace, (unsigned char *) lock_data,
- strlen (lock_data));
- locked = True;
- }
-
- XUngrabServer (dpy); /* ################################# danger over */
- XSync (dpy, False);
-
- if (! locked)
- {
- /* We tried to grab the lock this time, and failed because someone
- else is holding it already. So, wait for a PropertyDelete event
- to come in, and try again. */
-
- fprintf (stderr, "%s: window 0x%x is locked by %s; waiting...\n",
- progname, (unsigned int) window, data);
- waited = True;
-
- while (1)
- {
- XEvent event;
- XNextEvent (dpy, &event);
- if (event.xany.type == DestroyNotify &&
- event.xdestroywindow.window == window)
- {
- fprintf (stderr, "%s: window 0x%x unexpectedly destroyed.\n",
- progname, (unsigned int) window);
- exit (6);
- }
- else if (event.xany.type == PropertyNotify &&
- event.xproperty.state == PropertyDelete &&
- event.xproperty.window == window &&
- event.xproperty.atom == XA_MOZILLA_LOCK)
- {
- /* Ok! Someone deleted their lock, so now we can try
- again. */
-#ifdef DEBUG_PROPS
- fprintf (stderr, "%s: (0x%x unlocked, trying again...)\n",
- progname, (unsigned int) window);
-#endif
- break;
- }
- }
- }
- if (data)
- XFree (data);
- }
- while (! locked);
-
- if (waited)
- fprintf (stderr, "%s: obtained lock.\n", progname);
-}
-
-
-static void
-mozilla_remote_free_lock (Display *dpy, Window window)
-{
- int result;
- Atom actual_type;
- int actual_format;
- unsigned long nitems, bytes_after;
- unsigned char *data = 0;
-
-#ifdef DEBUG_PROPS
- fprintf (stderr, "%s: (deleting " MOZILLA_LOCK_PROP
- " \"%s\" from 0x%x)\n",
- progname, lock_data, (unsigned int) window);
-#endif
-
- result = XGetWindowProperty (dpy, window, XA_MOZILLA_LOCK,
- 0, (65536 / sizeof (long)),
- True, /* atomic delete after */
- XA_STRING,
- &actual_type, &actual_format,
- &nitems, &bytes_after,
- &data);
- if (result != Success)
- {
- fprintf (stderr, "%s: unable to read and delete " MOZILLA_LOCK_PROP
- " property\n",
- progname);
- return;
- }
- else if (!data || !*data)
- {
- fprintf (stderr, "%s: invalid data on " MOZILLA_LOCK_PROP
- " of window 0x%x.\n",
- progname, (unsigned int) window);
- return;
- }
- else if (strcmp ((char *) data, lock_data))
- {
- fprintf (stderr, "%s: " MOZILLA_LOCK_PROP
- " was stolen! Expected \"%s\", saw \"%s\"!\n",
- progname, lock_data, data);
- return;
- }
-
- if (data)
- XFree (data);
-}
-
-
-static int
-mozilla_remote_command (Display *dpy, Window window, const char *command,
- Bool raise_p)
-{
- int result;
- Bool done = False;
- char *new_command = 0;
-
- /* The -noraise option is implemented by passing a "noraise" argument
- to each command to which it should apply.
- */
- if (! raise_p)
- {
- char *close;
- new_command = (char *) malloc (strlen (command) + 20);
- strcpy (new_command, command);
- close = strrchr (new_command, ')');
- if (close)
- strcpy (close, ", noraise)");
- else
- strcat (new_command, "(noraise)");
- command = new_command;
- }
-
-#ifdef DEBUG_PROPS
- fprintf (stderr, "%s: (writing " MOZILLA_COMMAND_PROP " \"%s\" to 0x%x)\n",
- progname, command, (unsigned int) window);
-#endif
-
- XChangeProperty (dpy, window, XA_MOZILLA_COMMAND, XA_STRING, 8,
- PropModeReplace, (unsigned char *) command,
- strlen (command));
-
- while (!done)
- {
- XEvent event;
- XNextEvent (dpy, &event);
- if (event.xany.type == DestroyNotify &&
- event.xdestroywindow.window == window)
- {
- /* Print to warn user...*/
- fprintf (stderr, "%s: window 0x%x was destroyed.\n",
- progname, (unsigned int) window);
- result = 6;
- goto DONE;
- }
- else if (event.xany.type == PropertyNotify &&
- event.xproperty.state == PropertyNewValue &&
- event.xproperty.window == window &&
- event.xproperty.atom == XA_MOZILLA_RESPONSE)
- {
- Atom actual_type;
- int actual_format;
- unsigned long nitems, bytes_after;
- unsigned char *data = 0;
-
- result = XGetWindowProperty (dpy, window, XA_MOZILLA_RESPONSE,
- 0, (65536 / sizeof (long)),
- True, /* atomic delete after */
- XA_STRING,
- &actual_type, &actual_format,
- &nitems, &bytes_after,
- &data);
-#ifdef DEBUG_PROPS
- if (result == Success && data && *data)
- {
- fprintf (stderr, "%s: (server sent " MOZILLA_RESPONSE_PROP
- " \"%s\" to 0x%x.)\n",
- progname, data, (unsigned int) window);
- }
-#endif
-
- if (result != Success)
- {
- fprintf (stderr, "%s: failed reading " MOZILLA_RESPONSE_PROP
- " from window 0x%0x.\n",
- progname, (unsigned int) window);
- result = 6;
- done = True;
- }
- else if (!data || strlen((char *) data) < 5)
- {
- fprintf (stderr, "%s: invalid data on " MOZILLA_RESPONSE_PROP
- " property of window 0x%0x.\n",
- progname, (unsigned int) window);
- result = 6;
- done = True;
- }
- else if (*data == '1') /* positive preliminary reply */
- {
- fprintf (stderr, "%s: %s\n", progname, data + 4);
- /* keep going */
- done = False;
- }
-#if 1
- else if (!strncmp ((char *)data, "200", 3)) /* positive completion */
- {
- result = 0;
- done = True;
- }
-#endif
- else if (*data == '2') /* positive completion */
- {
- fprintf (stderr, "%s: %s\n", progname, data + 4);
- result = 0;
- done = True;
- }
- else if (*data == '3') /* positive intermediate reply */
- {
- fprintf (stderr, "%s: internal error: "
- "server wants more information? (%s)\n",
- progname, data);
- result = 3;
- done = True;
- }
- else if (*data == '4' || /* transient negative completion */
- *data == '5') /* permanent negative completion */
- {
- fprintf (stderr, "%s: %s\n", progname, data + 4);
- result = (*data - '0');
- done = True;
- }
- else
- {
- fprintf (stderr,
- "%s: unrecognised " MOZILLA_RESPONSE_PROP
- " from window 0x%x: %s\n",
- progname, (unsigned int) window, data);
- result = 6;
- done = True;
- }
-
- if (data)
- XFree (data);
- }
-#ifdef DEBUG_PROPS
- else if (event.xany.type == PropertyNotify &&
- event.xproperty.window == window &&
- event.xproperty.state == PropertyDelete &&
- event.xproperty.atom == XA_MOZILLA_COMMAND)
- {
- fprintf (stderr, "%s: (server 0x%x has accepted "
- MOZILLA_COMMAND_PROP ".)\n",
- progname, (unsigned int) window);
- }
-#endif /* DEBUG_PROPS */
- }
-
- DONE:
-
- if (new_command)
- free (new_command);
-
- return result;
-}
-
-int
-mozilla_remote_commands (Display *dpy, Window window, char **commands)
-{
- Bool raise_p = True;
- int status = 0;
- mozilla_remote_init_atoms (dpy);
-
- if (window == 0)
- window = mozilla_remote_find_window (dpy);
- else
- mozilla_remote_check_window (dpy, window);
-#ifdef GLOBAL
- if (window == 0)
- return -1;
-#endif
-
- XSelectInput (dpy, window, (PropertyChangeMask|StructureNotifyMask));
-
- mozilla_remote_obtain_lock (dpy, window);
-
- while (*commands)
- {
- if (!strcmp (*commands, "-raise"))
- raise_p = True;
- else if (!strcmp (*commands, "-noraise"))
- raise_p = False;
- else
- status = mozilla_remote_command (dpy, window, *commands, raise_p);
-
- if (status != 0)
- break;
- commands++;
- }
-
- /* When status = 6, it means the window has been destroyed */
- /* It is invalid to free the lock when window is destroyed. */
-
- if ( status != 6 )
- mozilla_remote_free_lock (dpy, window);
-
- return status;
-}
-
-
-#ifdef STANDALONE
-
-static void
-usage (void)
-{
- fprintf (stderr, "usage: %s [ options ... ]\n\
- where options include:\n\
-\n\
- -help to show this message.\n\
- -display <dpy> to specify the X server to use.\n\
- -remote <remote-command> to execute a command in an already-running\n\
- Netscape process. See the manual for a\n\
- list of valid commands.\n\
- -id <window-id> the id of an X window to which the -remote\n\
- commands should be sent; if unspecified,\n\
- the first window found will be used.\n\
- -raise whether following -remote commands should\n\
- cause the window to raise itself to the top\n\
- (this is the default.)\n\
- -noraise the opposite of -raise: following -remote\n\
- commands will not auto-raise the window.\n\
-",
- progname);
-}
-
-
-#ifdef GLOBAL
-int
-netscape_remote(int argc, char **argv)
-#else
-int
-main (int argc, char **argv)
-#endif
-{
- Display *dpy;
- char *dpy_string = 0;
- char **remote_commands = 0;
- int remote_command_count = 0;
- int remote_command_size = 0;
- unsigned long remote_window = 0;
- Bool sync_p = False;
- int i;
-
- progname = strrchr (argv[0], '/');
- if (progname)
- progname++;
- else
- progname = argv[0];
-
- /* Hack the -help and -version arguments before opening the display. */
- for (i = 1; i < argc; i++)
- {
- if (!strcasecmp (argv [i], "-h") ||
- !strcasecmp (argv [i], "-help"))
- {
- usage ();
- exit (0);
- }
- else if (!strcmp (argv [i], "-d") ||
- !strcmp (argv [i], "-dpy") ||
- !strcmp (argv [i], "-disp") ||
- !strcmp (argv [i], "-display"))
- {
- i++;
- dpy_string = argv [i];
- }
- else if (!strcmp (argv [i], "-sync") ||
- !strcmp (argv [i], "-synchronize"))
- {
- sync_p = True;
- }
- else if (!strcmp (argv [i], "-remote"))
- {
- if (remote_command_count == remote_command_size)
- {
- remote_command_size += 20;
- remote_commands =
- (remote_commands
- ? realloc (remote_commands,
- remote_command_size * sizeof (char *))
- : calloc (remote_command_size, sizeof (char *)));
- }
- i++;
- if (!argv[i] || *argv[i] == '-' || *argv[i] == 0)
- {
- fprintf (stderr, "%s: invalid `-remote' option \"%s\"\n",
- progname, argv[i] ? argv[i] : "");
- usage ();
- exit (-1);
- }
- remote_commands [remote_command_count++] = argv[i];
- }
- else if (!strcmp (argv [i], "-raise") ||
- !strcmp (argv [i], "-noraise"))
- {
- char *r = argv [i];
- if (remote_command_count == remote_command_size)
- {
- remote_command_size += 20;
- remote_commands =
- (remote_commands
- ? realloc (remote_commands,
- remote_command_size * sizeof (char *))
- : calloc (remote_command_size, sizeof (char *)));
- }
- remote_commands [remote_command_count++] = r;
- }
- else if (!strcmp (argv [i], "-id"))
- {
- char c;
- if (remote_command_count > 0)
- {
- fprintf (stderr,
- "%s: the `-id' option must preceed all `-remote' options.\n",
- progname);
- usage ();
- exit (-1);
- }
- else if (remote_window != 0)
- {
- fprintf (stderr, "%s: only one `-id' option may be used.\n",
- progname);
- usage ();
- exit (-1);
- }
- i++;
- if (argv[i] &&
- 1 == sscanf (argv[i], " %ld %c", &remote_window, &c))
- ;
- else if (argv[i] &&
- 1 == sscanf (argv[i], " 0x%lx %c", &remote_window, &c))
- ;
- else
- {
- fprintf (stderr, "%s: invalid `-id' option \"%s\"\n",
- progname, argv[i] ? argv[i] : "");
- usage ();
- exit (-1);
- }
- }
- }
-
- dpy = XOpenDisplay (dpy_string);
- if (! dpy)
- exit (-1);
-
- if (sync_p)
- XSynchronize (dpy, True);
-
-#ifdef GLOBAL
- return mozilla_remote_commands (dpy, (Window) remote_window,
- remote_commands);
-#else
- exit (mozilla_remote_commands (dpy, (Window) remote_window,
- remote_commands));
-#endif
-}
-
-#endif /* STANDALONE */
diff --git a/contrib/global/gozilla/vroot.h b/contrib/global/gozilla/vroot.h
deleted file mode 100644
index e06c263..0000000
--- a/contrib/global/gozilla/vroot.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*****************************************************************************/
-/** 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 permis- **/
-/** sion 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 **/
-/** MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ANDREAS STOLCKE **/
-/** OR SOLBOURNE 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. **/
-/*****************************************************************************/
-/*
- * vroot.h -- Virtual Root Window handling header file
- *
- * This header file redefines the X11 macros RootWindow and DefaultRootWindow,
- * making them look for a virtual root window as provided by certain `virtual'
- * window managers like swm and tvtwm. If none is found, the ordinary root
- * window is returned, thus retaining backward compatibility with standard
- * window managers.
- * The function implementing the virtual root lookup remembers the result of
- * its last invocation to avoid overhead in the case of repeated calls
- * on the same display and screen arguments.
- * The lookup code itself is taken from Tom LaStrange's ssetroot program.
- *
- * Most simple root window changing X programs can be converted to using
- * virtual roots by just including
- *
- * #include <X11/vroot.h>
- *
- * after all the X11 header files. It has been tested on such popular
- * X clients as xphoon, xfroot, xloadimage, and xaqua.
- * It also works with the core clients xprop, xwininfo, xwd, and editres
- * (and is necessary to get those clients working under tvtwm).
- * It does NOT work with xsetroot; get the xsetroot replacement included in
- * the tvtwm distribution instead.
- *
- * Andreas Stolcke <stolcke@ICSI.Berkeley.EDU>, 9/7/90
- * - replaced all NULL's with properly cast 0's, 5/6/91
- * - free children list (suggested by Mark Martin <mmm@cetia.fr>), 5/16/91
- * - include X11/Xlib.h and support RootWindowOfScreen, too 9/17/91
- */
-
-#ifndef _VROOT_H_
-#define _VROOT_H_
-
-#include <X11/X.h>
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-
-static Window
-VirtualRootWindowOfScreen(screen)
- Screen *screen;
-{
- static Screen *save_screen = (Screen *)0;
- static Window root = (Window)0;
-
- if (screen != save_screen) {
- Display *dpy = DisplayOfScreen(screen);
- Atom __SWM_VROOT = None;
- int i;
- Window rootReturn, parentReturn, *children;
- unsigned int numChildren;
-
- root = RootWindowOfScreen(screen);
-
- /* go look for a virtual root */
- __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
- if (XQueryTree(dpy, root, &rootReturn, &parentReturn,
- &children, &numChildren)) {
- for (i = 0; i < numChildren; i++) {
- Atom actual_type;
- int actual_format;
- unsigned long nitems, bytesafter;
- Window *newRoot = (Window *)0;
-
- if (XGetWindowProperty(dpy, children[i],
- __SWM_VROOT, 0, 1, False, XA_WINDOW,
- &actual_type, &actual_format,
- &nitems, &bytesafter,
- (unsigned char **) &newRoot) == Success
- && newRoot) {
- root = *newRoot;
- break;
- }
- }
- if (children)
- XFree((char *)children);
- }
-
- save_screen = screen;
- }
-
- return root;
-}
-
-#undef RootWindowOfScreen
-#define RootWindowOfScreen(s) VirtualRootWindowOfScreen(s)
-
-#undef RootWindow
-#define RootWindow(dpy,screen) VirtualRootWindowOfScreen(ScreenOfDisplay(dpy,screen))
-
-#undef DefaultRootWindow
-#define DefaultRootWindow(dpy) VirtualRootWindowOfScreen(DefaultScreenOfDisplay(dpy))
-
-#endif /* _VROOT_H_ */
diff --git a/contrib/global/gtags.el b/contrib/global/gtags.el
deleted file mode 100644
index 22dcc93..0000000
--- a/contrib/global/gtags.el
+++ /dev/null
@@ -1,368 +0,0 @@
-;;; gtags.el --- gtags facility for Emacs
-
-;;
-;; Copyright (c) 1997, 1998, 1999 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.el 8-Jan-99
-;;
-
-;; This file is part of GLOBAL.
-;; Author: Shigio Yamaguchi <shigio@wafu.netgate.net>
-;; Version: 1.5
-;; Keywords: tools
-
-;;; Code
-
-(defvar gtags-buffer-stack nil
- "Stack for tag browsing.")
-(defvar gtags-point-stack nil
- "Stack for tag browsing.")
-(defvar gtags-complete-list nil
- "Gtags complete list.")
-(defconst symbol-regexp "[A-Za-z_][A-Za-z_0-9]*"
- "Regexp matching tag name.")
-(defconst definition-regexp "#[ \t]*define[ \t]+\\|ENTRY(\\|ALTENTRY("
- "Regexp matching tag definition name.")
-(defvar gtags-read-only nil
- "Gtags read only mode")
-(defvar gtags-mode-map (make-sparse-keymap)
- "Keymap used in gtags mode.")
-(define-key gtags-mode-map "\et" 'gtags-find-tag)
-(define-key gtags-mode-map "\er" 'gtags-find-rtag)
-(define-key gtags-mode-map "\es" 'gtags-find-symbol)
-(define-key gtags-mode-map "\eg" 'gtags-find-pattern)
-(define-key gtags-mode-map "\C-]" 'gtags-find-tag-from-here)
-(define-key gtags-mode-map "\eh" 'gtags-display-browser)
-(define-key gtags-mode-map "\C-t" 'gtags-pop-stack)
-(define-key gtags-mode-map "\e." 'etags-style-find-tag)
-(define-key gtags-mode-map [mouse-2] 'gtags-find-tag-by-event)
-(define-key gtags-mode-map [mouse-3] 'gtags-pop-stack)
-
-(defvar gtags-select-mode-map (make-sparse-keymap)
- "Keymap used in gtags select mode.")
-(define-key gtags-select-mode-map "q" 'gtags-pop-stack)
-(define-key gtags-select-mode-map "\C-t" 'gtags-pop-stack)
-(define-key gtags-select-mode-map "\C-m" 'gtags-select-tag)
-(define-key gtags-select-mode-map " " 'scroll-up)
-(define-key gtags-select-mode-map "\^?" 'scroll-down)
-(define-key gtags-select-mode-map "\C-f" 'scroll-up)
-(define-key gtags-select-mode-map "\C-b" 'scroll-down)
-(define-key gtags-select-mode-map "n" 'next-line)
-(define-key gtags-select-mode-map "p" 'previous-line)
-(define-key gtags-select-mode-map "j" 'next-line)
-(define-key gtags-select-mode-map "k" 'previous-line)
-(define-key gtags-select-mode-map [mouse-2] 'gtags-select-tag-by-event)
-(define-key gtags-select-mode-map [mouse-3] 'gtags-pop-stack)
-
-;;
-;; utility
-;;
-(defun util-match-string (n)
- (buffer-substring (match-beginning n) (match-end n)))
-
-;; Return a default tag to search for, based on the text at point.
-(defun gtags-current-token ()
- (cond
- ((looking-at "[0-9A-Za-z_]")
- (while (looking-at "[0-9A-Za-z_]")
- (forward-char -1))
- (forward-char 1))
- (t
- (while (looking-at "[ \t]")
- (forward-char 1))))
- (if (and (bolp) (looking-at definition-regexp))
- (goto-char (match-end 0)))
- (if (looking-at symbol-regexp)
- (util-match-string 0) nil))
-
-;; push current context to stack
-(defun push-context ()
- (setq gtags-buffer-stack (cons (current-buffer) gtags-buffer-stack))
- (setq gtags-point-stack (cons (point) gtags-point-stack)))
-
-;; pop context from stack
-(defun pop-context ()
- (if (not gtags-buffer-stack) nil
- (let (buffer point)
- (setq buffer (car gtags-buffer-stack))
- (setq gtags-buffer-stack (cdr gtags-buffer-stack))
- (setq point (car gtags-point-stack))
- (setq gtags-point-stack (cdr gtags-point-stack))
- (list buffer point))))
-
-;; if the buffer exist in the stack
-(defun exist-in-stack (buffer)
- (memq buffer gtags-buffer-stack))
-
-;; is it a function?
-(defun is-function ()
- (save-excursion
- (while (and (not (eolp)) (looking-at "[0-9A-Za-z_]"))
- (forward-char 1))
- (while (and (not (eolp)) (looking-at "[ \t]"))
- (forward-char 1))
- (if (looking-at "(") t nil)))
-
-;; is it a definition?
-(defun is-definition ()
- (save-excursion
- (if (and (string-match "\.java$" buffer-file-name) (looking-at "[^(]+([^)]*)[ \t]*{"))
- t
- (if (bolp)
- t
- (forward-word -1)
- (cond
- ((looking-at "define")
- (forward-char -1)
- (while (and (not (bolp)) (looking-at "[ \t]"))
- (forward-char -1))
- (if (and (bolp) (looking-at "#"))
- t nil))
- ((looking-at "ENTRY\\|ALTENTRY")
- (if (bolp) t nil)))))))
-
-;;
-;; interactive command
-;;
-(defun gtags-find-tag ()
- "Input tag name and move to the definition."
- (interactive)
- (let (tagname)
- (setq tagname (completing-read ":tag " gtags-complete-list))
- (push-context)
- (gtags-goto-tag tagname "")))
-
-(defun etags-style-find-tag ()
- "Input tag name and move to the definition.(etags style)"
- (interactive)
- (let (tagname prompt input)
- (setq tagname (gtags-current-token))
- (if tagname
- (setq prompt (concat "Find tag: (default " tagname ") "))
- (setq prompt "Find tag: "))
- (setq input (completing-read prompt gtags-complete-list))
- (if (not (equal "" input)) (setq tagname input))
- (push-context)
- (gtags-goto-tag tagname "")))
-
-(defun gtags-find-symbol ()
- "Input symbol and move to the locations."
- (interactive)
- (let (tagname prompt input)
- (setq tagname (gtags-current-token))
- (if tagname
- (setq prompt (concat "Find symbol: (default " tagname ") "))
- (setq prompt "Find symbol: "))
- (setq input (read-string prompt))
- (if (not (equal "" input)) (setq tagname input))
- (push-context)
- (gtags-goto-tag tagname "s")))
-
-(defun gtags-find-pattern ()
- "Input pattern and move to the locations."
- (interactive)
- (let (tagname prompt input)
- (setq tagname (gtags-current-token))
- (if tagname
- (setq prompt (concat "Find pattern: (default " tagname ") "))
- (setq prompt "Find pattern: "))
- (setq input (read-string prompt))
- (if (not (equal "" input)) (setq tagname input))
- (push-context)
- (gtags-goto-tag tagname "g")))
-
-(defun gtags-find-rtag ()
- "Input tag name and move to the referenced point."
- (interactive)
- (let (tagname)
- (setq tagname (completing-read ":rtag " gtags-complete-list))
- (push-context)
- (gtags-goto-tag tagname "r")))
-
-(defun gtags-find-tag-from-here ()
- "Get the expression as a tagname around here and move there."
- (interactive)
- (let (tagname flag)
- (setq tagname (gtags-current-token))
- (if (is-function)
- (if (is-definition) (setq flag "r") (setq flag ""))
- (setq flag "s"))
- (if (not tagname)
- nil
- (push-context)
- (gtags-goto-tag tagname flag))))
-
-(defun gtags-display-browser ()
- "Display current screen on hypertext browser."
- (interactive)
- (let (lno)
- (save-excursion
- (end-of-line)
- (if (equal (point-min) (point))
- (setq lno 1)
- (setq lno (count-lines (point-min) (point)))))
- (message (number-to-string lno))
- (call-process "gozilla" nil t nil (concat "+" (number-to-string lno)) buffer-file-name)))
-
-(defun gtags-find-tag-by-event (event)
- "Get the expression as a tagname around here and move there."
- (interactive "e")
- (select-window (posn-window (event-end event)))
- (set-buffer (window-buffer (posn-window (event-end event))))
- (goto-char (posn-point (event-end event)))
- (let (tagname flag)
- (if (= 0 (count-lines (point-min) (point-max)))
- (progn (setq tagname "main") (setq flag ""))
- (setq tagname (gtags-current-token))
- (if (is-function)
- (if (is-definition) (setq flag "r") (setq flag ""))
- (setq flag "s")))
- (if (not tagname)
- nil
- (push-context)
- (gtags-goto-tag tagname flag))))
-
-(defun gtags-select-tag ()
- "Select a tagname in [GTAGS SELECT MODE] and move there."
- (interactive)
- (push-context)
- (gtags-select-it nil))
-
-(defun gtags-select-tag-by-event (event)
- "Select a tagname in [GTAGS SELECT MODE] and move there."
- (interactive "e")
- (select-window (posn-window (event-end event)))
- (set-buffer (window-buffer (posn-window (event-end event))))
- (goto-char (posn-point (event-end event)))
- (push-context)
- (gtags-select-it nil))
-
-(defun gtags-pop-stack ()
- "Move to previous point on the stack."
- (interactive)
- (let (delete context buffer)
- (if (not (exist-in-stack (current-buffer)))
- (setq delete t))
- (setq context (pop-context))
- (if (not context)
- (message "The tags stack is empty.")
- (if delete
- (kill-buffer (current-buffer)))
- (switch-to-buffer (nth 0 context))
- (goto-char (nth 1 context)))))
-
-;;
-;; common function
-;;
-
-;; goto tag's point
-(defun gtags-goto-tag (tagname flag)
- (let (save prefix buffer lines)
- (setq save (current-buffer))
- (cond
- ((equal flag "g")
- (setq prefix "(G)"))
- ((equal flag "s")
- (setq prefix "(S)"))
- ((equal flag "r")
- (setq prefix "(R)"))
- (t (setq prefix "(D)")))
- ;; load tag
- (setq buffer (generate-new-buffer (generate-new-buffer-name (concat prefix tagname))))
- (set-buffer buffer)
- (if (not (= 0 (call-process "global" nil t nil (concat "-ax" flag) tagname)))
- (progn (message (buffer-substring (point-min)(1- (point-max))))
- (pop-context))
- (goto-char (point-min))
- (setq lines (count-lines (point-min) (point-max)))
- (cond
- ((= 0 lines)
- (message "%s: tag not found" tagname)
- (pop-context)
- (kill-buffer buffer)
- (set-buffer save))
- ((= 1 lines)
- (gtags-select-it t))
- (t
- (switch-to-buffer buffer)
- (gtags-select-mode))))))
-
-;; select a tag line from lines
-(defun gtags-select-it (delete)
- (let (line file)
- ;; get context from current tag line
- (beginning-of-line)
-;; (if (not (looking-at "[A-Za-z_][A-Za-z_0-9]*[ \t]+\\([0-9]+\\)[ \t]\\([^ \t]+\\)[ \t]"))
- (if (not (looking-at "[^ \t]+[ \t]+\\([0-9]+\\)[ \t]\\([^ \t]+\\)[ \t]"))
- (pop-context)
- (setq line (string-to-number (util-match-string 1)))
- (setq file (util-match-string 2))
- (if delete (kill-buffer (current-buffer)))
- ;; move to the context
- (if gtags-read-only (find-file-read-only file) (find-file file))
- (goto-line line)
- (use-local-map gtags-mode-map))))
-
-;; make complete list
-(defun make-gtags-complete-list ()
-;; "Make tag name list for completion."
-;; (interactive)
- (save-excursion
- (setq gtags-complete-list (make-vector 63 0))
- (set-buffer (generate-new-buffer "*Completions*"))
- (call-process "global" nil t nil "-c")
- (goto-char (point-min))
- (while (looking-at symbol-regexp)
- (intern (util-match-string 0) gtags-complete-list)
- (forward-line))
- (kill-buffer (current-buffer))))
-
-;;;###autoload
-(defun gtags-mode ()
- "Minor mode for browsing C source using GLOBAL."
- (interactive)
- (if (y-or-n-p "Do you use function name completion?")
- (make-gtags-complete-list))
- (use-local-map gtags-mode-map)
- (run-hooks 'gtags-mode-hook))
-
-;; make gtags select mode
-(defun gtags-select-mode ()
- "Major mode for choosing a tag from tags list."
- (setq buffer-read-only t
- major-mode 'gtags-select-mode
- mode-name "Gtags Select")
- (use-local-map gtags-select-mode-map)
- (setq truncate-lines t)
- (goto-char (point-min))
- (message "[GTAGS SELECT MODE] %d lines" (count-lines (point-min) (point-max)))
- (run-hooks 'gtags-select-mode-hook))
-
-;;; gtags.el ends here
diff --git a/contrib/global/gtags/Makefile b/contrib/global/gtags/Makefile
deleted file mode 100644
index ecfb0ea..0000000
--- a/contrib/global/gtags/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-PROG= gtags
-
-.include <bsd.prog.mk>
diff --git a/contrib/global/gtags/gtags.1 b/contrib/global/gtags/gtags.1
deleted file mode 100644
index e6b09e6..0000000
--- a/contrib/global/gtags/gtags.1
+++ /dev/null
@@ -1,105 +0,0 @@
-.\"
-.\" 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.
-.\"
-.Dd Oct 10, 1998
-.Dt GTAGS 1
-.Os BSD 4
-.Sh NAME
-.Nm gtags
-.Nd create tag files for global.
-.Sh SYNOPSIS
-.Nm gtags
-.Op Fl c
-.Op Fl i
-.Op Fl o
-.Op Fl w
-.Op Fl v
-.Op Ar dbpath
-.Sh DESCRIPTION
-.Nm Gtags
-makes GTAGS, GRTAGS, GSYMS and GPATH file for
-.Xr global 1 .
-.Nm Gtags
-trace subdirectories, read source files,
-locate symbols and save the information into tag files.
-C, yacc, java and assembler source files are supported.
-You should execute this command at the root of the source tree.
-.Pp
-If your source directory is on a read only device like CDROM, specify
-.Ar dbpath
-of the directory on which make tag files.
-.Pp
-.Bl -tag -width Ds
-.It Fl c
-make tag files with compact format.
-.It Fl i
-update tag files incrementally.
-.It Fl o
-suppress making GSYMS file.
-Use this option if you don't use -s option of
-.Xr global 1 .
-.It Fl w
-print warning messages.
-.It Fl v
-verbose mode.
-.Sh FILES
-.Bl -tag -width tags -compact
-.It Pa GTAGS
-tag file for function definitions.
-.It Pa GRTAGS
-tag file for function references.
-.It Pa GSYMS
-tag file for other symbols.
-.It Pa GPATH
-path index file which is used for incremental updating and compact format.
-.El
-.Sh DIAGNOSTICS
-.Nm Gtags
-exits with a non 0 value if an error occurred, 0 otherwise.
-.Sh SEE ALSO
-.Xr btreeop 1 ,
-.Xr global 1 ,
-.Xr htags 1 ,
-.Xr vi 1 .
-.Sh BUG
-GTAGS, GRTAGS and GSYMS are very large.
-In advance of using this command, check the space of your disk.
-.br
-Assembler support is far from complete. It extracts only ENTRY()
-and ALTENTRY() from source file. Probably valid only for FreeBSD and Linux
-kernel source.
-.br
-There is no concurrency control about tag files.
-.Sh AUTHORS
-Shigio Yamaguchi (shigio@wafu.netgate.net)
-.Sh HISTORY
-The
-.Nm
-command appeared in FreeBSD 2.2.2.
diff --git a/contrib/global/gtags/gtags.c b/contrib/global/gtags/gtags.c
deleted file mode 100644
index 7a88747..0000000
--- a/contrib/global/gtags/gtags.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * 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.
- *
- * gtags.c 8-Oct-98
- *
- */
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "global.h"
-
-const char *progname = "gtags"; /* command name */
-
-static void usage __P((void));
-int main __P((int, char **));
-int incremental __P((char *, char *));
-void updatetags __P((char *, char *, char *, int));
-void createtags __P((char *, char *, int));
-int printconf __P((char *));
-char *now __P((void));
-
-int cflag; /* compact format */
-int iflag; /* incremental update */
-int oflag; /* suppress making GSYMS */
-int wflag; /* warning message */
-int vflag; /* verbose mode */
-
-int extractmethod = 0;
-
-static void
-usage()
-{
- fprintf(stderr, "usage:\t%s [-c][-i][-l][-o][-w][-v][dbpath]\n", progname);
- exit(1);
-}
-
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- char dbpath[MAXPATHLEN+1];
- char cwd[MAXPATHLEN+1];
- char env[MAXENVLEN+1];
- STRBUF *sb = stropen();
- int db;
-
- while (--argc > 0 && (++argv)[0][0] == '-') {
- char *p;
- /*
- * Secret option for htags(1).
- */
- if (!strcmp(argv[0], "--config")) {
- if (argc == 1)
- fprintf(stdout, "%s\n", configpath());
- else if (argc == 2) {
- if (!printconf(argv[1]))
- exit(1);
- }
- exit(0);
- } else if (!strcmp(argv[0], "--find")) {
- for (findopen(); (p = findread(NULL)) != NULL; )
- fprintf(stdout, "%s\n", p);
- findclose();
- exit(0);
- } else if (!strcmp(argv[0], "--expand")) {
- FILE *ip;
-
- ++argv; --argc;
- if (argc && argv[0][0] == '-') {
- settabs(atoi(&argv[0][1]));
- ++argv; --argc;
- }
- ip = (argc) ? fopen(argv[0], "r") : stdin;
- if (ip == NULL)
- exit(1);
- while ((p = mgets(ip, NULL, 0)) != NULL)
- detab(stdout, p);
- exit(0);
- }
-
- for (p = argv[0] + 1; *p; p++) {
- switch (*p) {
- case 'c':
- cflag++;
- break;
- case 'i':
- iflag++;
- break;
- case 'o':
- oflag++;
- break;
- case 'w':
- wflag++;
- break;
- case 'v':
- vflag++;
- break;
- /* for compatibility */
- case 's':
- case 'e':
- break;
- default:
- usage();
- }
- }
- }
- if (!getcwd(cwd, MAXPATHLEN))
- die("cannot get current directory.");
- if (argc > 0)
- realpath(*argv,dbpath) ;
- else
- strcpy(dbpath, cwd);
- if (!strcmp(dbpath, "/"))
- die("It's root directory! What are you doing?");
- if (!test("d", dbpath))
- die1("directory '%s' not found.", dbpath);
- if (vflag)
- fprintf(stderr, "[%s] Gtags started\n", now());
- /*
- * load .gtagsrc or /etc/gtags.conf
- */
- openconf();
- if (getconfb("extractmethod"))
- extractmethod = 1;
- strstart(sb);
- if (getconfs("format", sb) && !strcmp(strvalue(sb), "compact"))
- cflag++;
- /*
- * teach gctags(1) where is dbpath.
- */
- sprintf(env, "GTAGSDBPATH=%s", dbpath);
- putenv(env);
- if (wflag) {
- sprintf(env, "GTAGSWARNING=1");
- putenv(env);
- }
- /*
- * incremental update.
- */
- if (iflag && test("f", makepath(dbpath, dbname(GTAGS))) &&
- test("f", makepath(dbpath, dbname(GRTAGS))))
- {
- /* open for version check */
- GTOP *gtop = gtagsopen(dbpath, cwd, GTAGS, GTAGS_MODIFY, 0);
- gtagsclose(gtop);
- if (!test("f", makepath(dbpath, "GPATH")))
- die("Old version tag file found. Please remake it.");
- (void)incremental(dbpath, cwd);
- exit(0);
- }
- if (iflag && vflag)
- fprintf(stderr, " GTAGS and GRTAGS not found. -i option ignored.\n");
- /*
- * create GTAGS, GRTAGS and GSYMS
- */
- for (db = GTAGS; db < GTAGLIM; db++) {
-
- if (oflag && db == GSYMS)
- continue;
- strstart(sb);
- if (!getconfs(dbname(db), sb))
- continue;
- if (!usable(strmake(strvalue(sb), " \t")))
- die1("Parser '%s' not found or not executable.", strmake(strvalue(sb), " \t"));
- if (vflag)
- fprintf(stderr, "[%s] Creating '%s'.\n", now(), dbname(db));
- createtags(dbpath, cwd, db);
- }
-
- if (vflag)
- fprintf(stderr, "[%s] Done.\n", now());
- closeconf();
- exit(0);
-}
-/*
- * incremental: incremental update
- *
- * i) dbpath dbpath directory
- * i) root root directory of source tree
- * r) 0: not updated, 1: updated
- */
-int
-incremental(dbpath, root)
-char *dbpath;
-char *root;
-{
- struct stat statp;
- time_t gtags_mtime;
- STRBUF *addlist = stropen();
- STRBUF *updatelist = stropen();
- STRBUF *deletelist = stropen();
- int updated = 0;
- char *path;
-
- if (vflag) {
- fprintf(stderr, " Tag found in '%s'.\n", dbpath);
- fprintf(stderr, " Incremental update.\n");
- }
- /*
- * get modified time of GTAGS.
- */
- path = makepath(dbpath, dbname(GTAGS));
- if (stat(path, &statp) < 0)
- die1("stat failed '%s'.", path);
- gtags_mtime = statp.st_mtime;
-
- if (pathopen(dbpath, 0) < 0)
- die("GPATH not found.");
- /*
- * make add list and update list.
- */
- for (findopen(); (path = findread(NULL)) != NULL; ) {
- if (stat(path, &statp) < 0)
- die1("stat failed '%s'.", path);
- if (!pathget(path))
- strnputs(addlist, path, strlen(path) + 1);
- else if (gtags_mtime < statp.st_mtime)
- strnputs(updatelist, path, strlen(path) + 1);
- }
- findclose();
- /*
- * make delete list.
- */
- {
- int i, limit = nextkey();
-
- for (i = 0; i < limit; i++) {
- if ((path = pathiget(i)) == NULL)
- continue;
- if (!test("f", path))
- strnputs(deletelist, path, strlen(path) + 1);
- }
- }
- pathclose();
- if (strbuflen(addlist) + strbuflen(deletelist) + strbuflen(updatelist))
- updated = 1;
- /*
- * execute updating.
- */
- if (strbuflen(updatelist) > 0) {
- char *start = strvalue(updatelist);
- char *end = start + strbuflen(updatelist);
- char *p;
-
- for (p = start; p < end; p += strlen(p) + 1)
- updatetags(dbpath, root, p, 0);
- updated = 1;
- }
- if (strbuflen(addlist) > 0) {
- char *start = strvalue(addlist);
- char *end = start + strbuflen(addlist);
- char *p;
-
- for (p = start; p < end; p += strlen(p) + 1)
- updatetags(dbpath, root, p, 1);
- updated = 1;
- }
- if (strbuflen(deletelist) > 0) {
- char *start = strvalue(deletelist);
- char *end = start + strbuflen(deletelist);
- char *p;
-
- for (p = start; p < end; p += strlen(p) + 1)
- updatetags(dbpath, root, p, 2);
-
- pathopen(dbpath, 2);
- for (p = start; p < end; p += strlen(p) + 1)
- pathdel(p);
- pathclose();
- updated = 1;
- }
- if (vflag) {
- if (updated)
- fprintf(stderr, " Global databases have been modified.\n");
- else
- fprintf(stderr, " Global databases are up to date.\n");
- fprintf(stderr, "[%s] Done.\n", now());
- }
- strclose(addlist);
- strclose(deletelist);
- strclose(updatelist);
- return updated;
-}
-/*
- * updatetags: update tag file.
- *
- * i) dbpath directory in which tag file exist
- * i) root root directory of source tree
- * i) path path which should be updated
- * i) type 0:update, 1:add, 2:delete
- */
-void
-updatetags(dbpath, root, path, type)
-char *dbpath;
-char *root;
-char *path;
-int type;
-{
- GTOP *gtop;
- STRBUF *sb = stropen();
- int db;
- const char *msg = NULL;
-
- switch (type) {
- case 0: msg = "Updating"; break;
- case 1: msg = "Adding"; break;
- case 2: msg = "Deleting"; break;
- }
- if (vflag)
- fprintf(stderr, " %s tags of '%s' ...", msg, path + 2);
- for (db = GTAGS; db < GTAGLIM; db++) {
- int flags = 0;
-
- if (db == GSYMS && !test("f", makepath(dbpath, dbname(db))))
- continue;
- if (vflag)
- fprintf(stderr, "%s", dbname(db));
- /*
- * get tag command.
- */
- strstart(sb);
- if (!getconfs(dbname(db), sb))
- die1("cannot get tag command. (%s)", dbname(db));
- gtop = gtagsopen(dbpath, root, db, GTAGS_MODIFY, 0);
- /*
- * GTAGS needed to make GRTAGS.
- */
- if (db == GRTAGS && !test("f", makepath(dbpath, "GTAGS")))
- die("GTAGS needed to create GRTAGS.");
- if (type != 1)
- gtagsdelete(gtop, path);
- if (vflag)
- fprintf(stderr, "..");
- if (type != 2) {
- if (db == GSYMS)
- flags |= GTAGS_UNIQUE;
- if (extractmethod)
- flags |= GTAGS_EXTRACTMETHOD;
- gtagsadd(gtop, strvalue(sb), path, flags);
- }
- gtagsclose(gtop);
- }
- if (vflag)
- fprintf(stderr, " Done.\n");
- strclose(sb);
-}
-/*
- * createtags: create tags file
- *
- * i) dbpath dbpath directory
- * i) root root directory of source tree
- * i) db GTAGS, GRTAGS, GSYMS
- */
-void
-createtags(dbpath, root, db)
-char *dbpath;
-char *root;
-int db;
-{
- char *path;
- GTOP *gtop;
- int flags;
- char *comline;
- STRBUF *sb = stropen();
-
- /*
- * get tag command.
- */
- if (!getconfs(dbname(db), sb))
- die1("cannot get tag command. (%s)", dbname(db));
- comline = strdup(strvalue(sb));
- if (!comline)
- die("short of memory.");
- /*
- * GTAGS needed to make GRTAGS.
- */
- if (db == GRTAGS && !test("f", makepath(dbpath, "GTAGS")))
- die("GTAGS needed to create GRTAGS.");
- flags = 0;
- strstart(sb);
- if (cflag) {
- flags |= GTAGS_COMPACT;
- flags |= GTAGS_PATHINDEX;
- }
- strstart(sb);
- if (vflag > 1 && getconfs(dbname(db), sb))
- fprintf(stderr, " using tag command '%s <path>'.\n", strvalue(sb));
- gtop = gtagsopen(dbpath, root, db, GTAGS_CREATE, flags);
- for (findopen(); (path = findread(NULL)) != NULL; ) {
- int gflags = 0;
- /*
- * GSYMS doesn't treat asembler.
- */
- if (db == GSYMS)
- if (locatestring(path, ".s", MATCH_AT_LAST) != NULL ||
- locatestring(path, ".S", MATCH_AT_LAST) != NULL)
- continue;
- if (vflag)
- fprintf(stderr, " extracting tags of %s.\n", path);
- if (db == GSYMS)
- gflags |= GTAGS_UNIQUE;
- if (extractmethod)
- gflags |= GTAGS_EXTRACTMETHOD;
- gtagsadd(gtop, comline, path, gflags);
- }
- findclose();
- gtagsclose(gtop);
- free(comline);
- strclose(sb);
-}
-/*
- * now: current date and time
- *
- * r) date and time
- */
-char *
-now(void)
-{
- static char buf[80];
- time_t tval;
-
- if (time(&tval) == -1)
- die("cannot get current time.");
- (void)strftime(buf, sizeof(buf), "%a %b %e %H:%M:%S %Z %Y", localtime(&tval));
- return buf;
-}
-/*
- * printconf: print configuration data.
- *
- * i) name label of config data
- * r) exit code
- */
-int
-printconf(name)
-char *name;
-{
- STRBUF *sb;
- int num;
- int exist = 1;
-
- if (getconfn(name, &num))
- fprintf(stdout, "%d\n", num);
- else if (getconfb(name))
- fprintf(stdout, "1\n");
- else {
- sb = stropen();
- if (getconfs(name, sb))
- fprintf(stdout, "%s\n", strvalue(sb));
- else
- exist = 0;
- strclose(sb);
- }
- return exist;
-}
diff --git a/contrib/global/htags/Makefile b/contrib/global/htags/Makefile
deleted file mode 100644
index f02d082..0000000
--- a/contrib/global/htags/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-MAN1= htags.1
-
-beforeinstall:
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- ${.CURDIR}/htags.pl ${DESTDIR}${BINDIR}/htags
-
-.include <bsd.prog.mk>
diff --git a/contrib/global/htags/htags.1 b/contrib/global/htags/htags.1
deleted file mode 100644
index e563043..0000000
--- a/contrib/global/htags/htags.1
+++ /dev/null
@@ -1,139 +0,0 @@
-.\"
-.\" 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd Oct 11, 1998
-.Dt HTAGS 1
-.Os BSD 4
-.Sh NAME
-.Nm htags
-.Nd generate hypertext from C, Yacc and Java source code
-.Sh SYNOPSIS
-.Nm htags
-.Op Fl a
-.Op Fl c
-.Op Fl f
-.Op Fl h
-.Op Fl l
-.Op Fl n
-.Op Fl v
-.Op Fl w
-.Op Fl d Ar tagdir
-.Op Fl t Ar title
-.Op Ar dir
-.Sh DESCRIPTION
-.Nm Htags
-makes hypertext from C, Yacc and Java source code using GLOBAL database (GTAGS, GRTAGS).
-.Pp
-In advance of using this command, you must execute
-.Xr gtags 1
-from the root directory of the source tree.
-Then you can execute
-.Nm htags
-from the same place.
-.Nm Htags
-makes an HTML directory and generates hypertext in it.
-.Pp
-You can start browsing from 'HTML/index.html'.
-Once the hypertext is generated, you can move it anywhere and browse it
-in any browsers.
-.Pp
-.br
-.Bl -tag -width Ds
-.It Fl a
-Make an alphabetical function index, suitable for a large project.
-.It Fl c
-Compress html files by
-.Xr gzip 1 .
-You need to set up an HTTP server so that
-.Xr gzip 1
-is invoked for each compressed
-files. See skelton file 'HTML/.htaccess.skel' that is generated by htags.
-.It Fl f
-Support an input form and a dynamic index with a CGI program.
-You need to set up an HTTP server for this.
-.It Fl h
-Add title header frame. By default, doesn't add this.
-.It Fl l
-Make a name tag(<A NAME=line number>) for each line, so that other hypertext
-can link to any line of this hypertext.
-By default, htags makes it only for lines that are referred to by an object.
-.It Fl n
-Print the line numbers (they are not printed by default).
-.It Fl v
-Verbose mode.
-.It Fl w
-Print a warning message.
-.It Fl d Ar tagdir
-Specifies the directory in which GTAGS and GRTAGS exist. The default is the
-current directory.
-.It Fl t Ar title
-The title of this hypertext. Defaults to the last component of the current
-path.
-.It Ar dir
-The directory in which hypertext is generated. The default is the current
-directory.
-.Sh EXAMPLES
- % cd /usr/src/sys
- # gtags -o
- # htags -fnvat 'Welcome to FreeBSD kernel source tour!'
- % lynx HTML/index.html
-.Sh FILES
-.Bl -tag -width tags -compact
-.It Pa HTML/index.html
-Index file.
-.It Pa GTAGS
-Tags file for function definitions.
-.It Pa GRTAGS
-Tags file for function references.
-.El
-.Sh ENVIRONMENT
-The following environment variables affect the execution of htags.
-.Pp
-.Bl -tag -width indent
-.It Ev TMPDIR
-If this variable is set, its value is used as the directory to make temporary files.
-The default is /tmp.
-.Sh DIAGNOSTICS
-.Nm Htags
-exits with a non 0 value if an error occurred, 0 otherwise.
-.Sh SEE ALSO
-.Xr btreeop 1 ,
-.Xr global 1 ,
-.Xr gtags 1 .
-.Sh BUG
-Generated hypertext is VERY LARGE. In advance, check the space of your disk.
-.Sh AUTHORS
-Shigio Yamaguchi (shigio@wafu.netgate.net)
-.Sh HISTORY
-The
-.Nm
-command appeared in FreeBSD 2.2.2.
diff --git a/contrib/global/htags/htags.pl b/contrib/global/htags/htags.pl
deleted file mode 100644
index d8488de..0000000
--- a/contrib/global/htags/htags.pl
+++ /dev/null
@@ -1,1595 +0,0 @@
-#!/usr/bin/perl
-#
-# 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.
-#
-# htags.pl 10-Nov-98
-#
-$com = $0;
-$com =~ s/.*\///;
-$usage = "usage: $com [-a][-c][-f][-h][-l][-n][-v][-w][-t title][-d tagdir][dir]\n";
-#-------------------------------------------------------------------------
-# COMMAND EXISTENCE CHECK
-#-------------------------------------------------------------------------
-foreach $c ('sort', 'gtags', 'global', 'btreeop') {
- if (!&'usable($c)) {
- &'error("'$c' command is required but not found.");
- }
-}
-#-------------------------------------------------------------------------
-# CONFIGURATION
-#-------------------------------------------------------------------------
-# temporary directory
-$'tmp = '/tmp';
-if (defined($ENV{'TMPDIR'}) && -d $ENV{'TMPDIR'}) {
- $tmp = $ENV{'TMPDIR'};
-}
-$'ncol = 4; # columns of line number
-$'tabs = 8; # tab skip
-$'gzipped_suffix = 'ghtml'; # suffix of gzipped html file
-#
-# font
-#
-$'title_begin = '<FONT COLOR=#cc0000>';
-$'title_end = '</FONT>';
-$'comment_begin = '<I><FONT COLOR=green>'; # /* ... */
-$'comment_end = '</FONT></I>';
-$'sharp_begin = '<FONT COLOR=darkred>'; # #define, #include or so on
-$'sharp_end = '</FONT>';
-$'brace_begin = '<FONT COLOR=blue>'; # { ... }
-$'brace_end = '</FONT>';
-$'reserved_begin = '<B>'; # if, while, for or so on
-$'reserved_end = '</B>';
-#
-# color
-#
-$'body_bgcolor = '';
-$'body_text = '';
-$'body_link = '';
-$'body_vlink = '';
-$'body_alink = '';
-#
-# Reserved words for C and Java are hard coded.
-# (configuration parameter 'reserved_words' was deleted.)
-#
-$'c_reserved_words = "auto,break,case,char,continue,default,do,double,else," .
- "extern,float,for,goto,if,int,long,register,return," .
- "short,sizeof,static,struct,switch,typedef,union," .
- "unsigned,void,while";
-$'java_reserved_words = "abstract,boolean,break,byte,case,catch,char,class," .
- "const,continue,default,do,double,else,extends,false," .
- "final,finally,float,for,goto,if,implements,import," .
- "instanceof,int,interface,long,native,new,null," .
- "package,private,protected,public,return,short," .
- "static,super,switch,synchronized,this,throw,throws," .
- "union,transient,true,try,void,volatile,while";
-$'c_reserved_words =~ s/,/|/g;
-$'java_reserved_words =~ s/,/|/g;
-#
-# read values from global.conf
-#
-chop($config = `gtags --config`);
-if ($config) {
- if ($var1 = &'getconf('ncol')) {
- if ($var1 < 1 || $var1 > 10) {
- print STDERR "Warning: parameter 'ncol' ignored becase the value is too large or too small.\n";
- } else {
- $ncol = $var1;
- }
- }
- if ($var1 = &'getconf('tabs')) {
- if ($var1 < 1 || $var1 > 32) {
- print STDERR "Warning: parameter 'tabs' ignored becase the value is too large or too small.\n";
- } else {
- $tabs = $var1;
- }
- }
- if ($var1 = &'getconf('gzipped_suffix')) {
- $gzipped_suffix = $var1;
- }
- if (($var1 = &'getconf('title_begin')) && ($var2 = &'getconf('title_end'))) {
- $title_begin = $var1;
- $title_end = $var2;
- }
- if (($var1 = &'getconf('comment_begin')) && ($var2 = &'getconf('comment_end'))) {
- $comment_begin = $var1;
- $comment_end = $var2;
- }
- if (($var1 = &'getconf('sharp_begin')) && ($var2 = &'getconf('sharp_end'))) {
- $sharp_begin = $var1;
- $sharp_end = $var2;
- }
- if (($var1 = &'getconf('brace_begin')) && ($var2 = &'getconf('brace_end'))) {
- $brace_begin = $var1;
- $brace_end = $var2;
- }
- if (($var1 = &'getconf('reserved_begin')) && ($var2 = &'getconf('reserved_end'))) {
- $reserved_begin = $var1;
- $reserved_end = $var2;
- }
- $body_bgcolor = $var1 if ($var1 = &'getconf('bgcolor'));
- $body_text = $var1 if ($var1 = &'getconf('text'));
- $body_link = $var1 if ($var1 = &'getconf('link'));
- $body_vlink = $var1 if ($var1 = &'getconf('vlink'));
- $body_alink = $var1 if ($var1 = &'getconf('alink'));
-}
-# HTML tag
-$'begin_html = "<HTML>\n";
-$'end_html = "</HTML>\n";
-$'begin_body = '<BODY';
-$'begin_body .= " BGCOLOR=$body_bgcolor" if ($body_bgcolor);
-$'begin_body .= " TEXT=$body_text" if ($body_text);
-$'begin_body .= " LINK=$body_link" if ($body_link);
-$'begin_body .= " LINK=$body_vlink" if ($body_vlink);
-$'begin_body .= " LINK=$body_alink" if ($body_alink);
-$'begin_body .= '>';
-$'begin_body .= "\n";
-$'end_body = "</BODY>\n";
-#-------------------------------------------------------------------------
-# DEFINITION
-#-------------------------------------------------------------------------
-# unit for a path
-$'SEP = ' '; # source file path must not include $SEP charactor
-$'ESCSEP = &'escape($SEP);
-$'SRCS = 'S';
-$'DEFS = 'D';
-$'REFS = 'R';
-$'INCS = 'I';
-#-------------------------------------------------------------------------
-# JAVASCRIPT PARTS
-#-------------------------------------------------------------------------
-# escaped angle
-$'langle = sprintf("unescape('%s')", &'escape('<'));
-$'rangle = sprintf("unescape('%s')", &'escape('>'));
-$'begin_script="<SCRIPT LANGUAGE=javascript>\n<!--\n";
-$'end_script="<!-- end of script -->\n</SCRIPT>\n";
-$'default_view=
- "// if your browser doesn't support javascript, write a BASE tag statically.\n" .
- "if (parent.frames.length)\n" .
- " document.write($langle+'BASE TARGET=mains'+$rangle)\n";
-$'rewrite_href_funcs =
- "if (parent.frames.length && parent.funcs == self) {\n" .
- " document.links[0].href = '../funcs.html';\n" .
- " document.links[document.links.length - 1].href = '../funcs.html';\n" .
- "}\n";
-$'rewrite_href_files =
- "if (parent.frames.length && parent.files == self) {\n" .
- " document.links[0].href = '../files.html';\n" .
- " document.links[document.links.length - 1].href = '../files.html';\n" .
- "}\n";
-sub set_header {
- local($display, $title, $script) = @_;
- local($head) = "<HEAD><TITLE>$title</TITLE>";
- if ($script || ($'hflag && $display)) {
- $head .= "\n";
- $head .= $'begin_script;
- $head .= $script if ($script);
- if ($'hflag && $display) {
- $title = '[' . $title . ']' if ($title);
- $head .= "if (parent.frames.length && parent.mains == self) {\n";
- $head .= " parent.title.document.open();\n";
- $head .= " parent.title.document.write('<H3>$title</H3>');\n";
- $head .= " parent.title.document.close();\n";
- $head .= "}\n";
- }
- $head .= $'end_script;
- }
- $head .= "</HEAD>\n";
- $head;
-}
-#-------------------------------------------------------------------------
-# UTIRITIES
-#-------------------------------------------------------------------------
-sub getcwd {
- local($dir) = `/bin/pwd`;
- chop($dir);
- $dir;
-}
-sub realpath {
- local($dir) = @_;
- local($cwd) = &getcwd;
- chdir($dir) || &'error("cannot change directory '$dir'.");
- local($new) = &getcwd;
- chdir($cwd) || &'error("cannot recover current directory '$cwd'.");
- $new;
-}
-sub date {
- local($date) = `date`;
- chop($date);
- $date;
-}
-sub error {
- &clean();
- printf STDERR "$com: $_[0]\n";
- exit 1;
-}
-sub clean {
- &anchor'finish();
- &cache'close();
-}
-sub escape {
- local($c) = @_;
- '%' . sprintf("%x", ord($c));
-}
-sub usable {
- local($command) = @_;
- foreach (split(/:/, $ENV{'PATH'})) {
- return 1 if (-x "$_/$command");
- }
- return 0;
-}
-sub copy {
- local($from, $to) = @_;
- local($ret) = system("cp $from $to");
- $ret = $ret / 256;
- $ret = ($ret == 0) ? 1 : 0;
- $ret;
-}
-sub getconf {
- local($name) = @_;
- local($val);
- chop($val = `gtags --config $name`);
- if ($? != 0) { $val = ''; }
- $val;
-}
-sub path2file {
- local($path) = @_;
- $path =~ s/^\.\///;
- $path =~ s!/!$'SEP!g;
- $path . '.' . $'HTML;
-}
-sub path2url {
- local($path) = @_;
- $path =~ s/^\.\///;
- $path =~ s!/!$'ESCSEP!g;
- $path . '.' . $'HTML;
-}
-#-------------------------------------------------------------------------
-# PROCESS START
-#-------------------------------------------------------------------------
-#
-# options check.
-#
-$'aflag = $'cflag = $'fflag = $'hflag = $'lflag = $'nflag = $'vflag = $'wflag = '';
-while ($ARGV[0] =~ /^-/) {
- $opt = shift;
- if ($opt =~ /[^-acfhlnvwtd]/) {
- print STDERR $usage;
- exit 1;
- }
- if ($opt =~ /a/) { $'aflag = 'a'; }
- if ($opt =~ /c/) { $'cflag = 'c'; }
- if ($opt =~ /f/) { $'fflag = 'f'; }
- if ($opt =~ /h/) { $'hflag = 'h'; }
- if ($opt =~ /l/) { $'lflag = 'l'; }
- if ($opt =~ /n/) { $'nflag = 'n'; }
- if ($opt =~ /v/) { $'vflag = 'v'; }
- if ($opt =~ /w/) { $'wflag = 'w'; }
- if ($opt =~ /t/) {
- $opt = shift;
- last if ($opt eq '');
- $title = $opt;
- } elsif ($opt =~ /d/) {
- $opt = shift;
- last if ($opt eq '');
- $dbpath = $opt;
- }
-}
-if ($'cflag && !&'usable('gzip')) {
- print STDERR "Warning: 'gzip' command not found. -c option ignored.\n";
- $'cflag = '';
-}
-if (!$title) {
- @cwd = split('/', &'getcwd);
- $title = $cwd[$#cwd];
-}
-$dbpath = '.' if (!$dbpath);
-unless (-r "$dbpath/GTAGS" && -r "$dbpath/GRTAGS") {
- &'error("GTAGS and GRTAGS not found. Please make them.");
-}
-$dbpath = &'realpath($dbpath);
-#
-# for global(1)
-#
-$ENV{'GTAGSROOT'} = &'getcwd();
-$ENV{'GTAGSDBPATH'} = $dbpath;
-delete $ENV{'GTAGSLIBPATH'};
-#
-# check directories
-#
-$dist = &'getcwd() . '/HTML';
-if ($ARGV[0]) {
- $cwd = &'getcwd();
- unless (-w $ARGV[0]) {
- &'error("'$ARGV[0]' is not writable directory.");
- }
- chdir($ARGV[0]) || &'error("directory '$ARGV[0]' not found.");
- $dist = &'getcwd() . '/HTML';
- chdir($cwd) || &'error("cannot return to original directory.");
-}
-#
-# find filter
-#
-$'findcom = "gtags --find";
-#
-# check if GTAGS, GRTAGS is the latest.
-#
-$gtags_ctime = (stat("$dbpath/GTAGS"))[10];
-open(FIND, "$'findcom |") || &'error("cannot fork.");
-while (<FIND>) {
- chop;
- if ($gtags_ctime < (stat($_))[10]) {
- &'error("GTAGS is not the latest one. Please remake it.");
- }
-}
-close(FIND);
-if ($?) { &'error("cannot traverse directory."); }
-#-------------------------------------------------------------------------
-# MAKE FILES
-#-------------------------------------------------------------------------
-# HTML/cgi-bin/global.cgi ... CGI program (1)
-# HTML/cgi-bin/ghtml.cgi ... unzip script (1)
-# HTML/.htaccess.skel ... skelton of .htaccess (1)
-# HTML/help.html ... help file (2)
-# HTML/$REFS/* ... referencies (3)
-# HTML/$DEFS/* ... definitions (3)
-# HTML/funcs.html ... function index (4)
-# HTML/funcs/* ... function index (4)
-# HTML/files.html ... file index (5)
-# HTML/files/* ... file index (5)
-# HTML/index.html ... index file (6)
-# HTML/mains.html ... main index (7)
-# HTML/null.html ... main null html (7)
-# HTML/$SRCS/ ... source files (8)
-# HTML/$INCS/ ... include file index (9)
-#-------------------------------------------------------------------------
-$'HTML = ($'cflag) ? $gzipped_suffix : 'html';
-print STDERR "[", &'date, "] ", "Htags started\n" if ($'vflag);
-#
-# (0) make directories
-#
-print STDERR "[", &'date, "] ", "(0) making directories ...\n" if ($'vflag);
-mkdir($dist, 0777) || &'error("cannot make directory '$dist'.") if (! -d $dist);
-foreach $d ($SRCS, $INCS, $DEFS, $REFS, files, funcs) {
- mkdir("$dist/$d", 0775) || &'error("cannot make HTML directory") if (! -d "$dist/$d");
-}
-if ($'fflag || $'cflag) {
- mkdir("$dist/cgi-bin", 0775) || &'error("cannot make cgi-bin directory") if (! -d "$dist/cgi-bin");
-}
-#
-# (1) make CGI program
-#
-if ($'fflag) {
- print STDERR "[", &'date, "] ", "(1) making CGI program ...\n" if ($'vflag);
- &makeprogram("$dist/cgi-bin/global.cgi") || &'error("cannot make CGI program.");
- chmod(0755, "$dist/cgi-bin/global.cgi") || &'error("cannot chmod CGI program.");
- unlink("$dist/cgi-bin/GTAGS", "$dist/cgi-bin/GRTAGS", "$dist/cgi-bin/GPATH");
- link("$dbpath/GTAGS", "$dist/cgi-bin/GTAGS") || &'copy("$dbpath/GTAGS", "$dist/cgi-bin/GTAGS") || &'error("cannot copy GTAGS.");
- link("$dbpath/GRTAGS", "$dist/cgi-bin/GRTAGS") || &'copy("$dbpath/GRTAGS", "$dist/cgi-bin/GRTAGS") || &'error("cannot copy GRTAGS.");
- link("$dbpath/GPATH", "$dist/cgi-bin/GPATH") || &'copy("$dbpath/GPATH", "$dist/cgi-bin/GPATH") || &'error("cannot copy GPATH.");
-}
-if ($'cflag) {
- &makehtaccess("$dist/.htaccess.skel") || &'error("cannot make .htaccess skelton.");
- &makeghtml("$dist/cgi-bin/ghtml.cgi") || &'error("cannot make unzip script.");
- chmod(0755, "$dist/cgi-bin/ghtml.cgi") || &'error("cannot chmod unzip script.");
-}
-#
-# (2) make help file
-#
-print STDERR "[", &'date, "] ", "(2) making help.html ...\n" if ($'vflag);
-&makehelp("$dist/help.html");
-#
-# (3) make function entries ($DEFS/* and $REFS/*)
-# MAKING TAG CACHE
-#
-print STDERR "[", &'date, "] ", "(3) making duplicate entries ...\n" if ($'vflag);
-sub suddenly { &'clean(); exit 1}
-$SIG{'INT'} = 'suddenly';
-$SIG{'QUIT'} = 'suddenly';
-$SIG{'TERM'} = 'suddenly';
-&cache'open(100000);
-$func_total = &makedupindex($dist);
-print STDERR "Total $func_total functions.\n" if ($'vflag);
-#
-# (4) make function index (funcs.html and funcs/*)
-# PRODUCE @funcs
-#
-print STDERR "[", &'date, "] ", "(4) making function index ...\n" if ($'vflag);
-$func_total = &makefuncindex($dist, "$dist/funcs.html", $func_total);
-print STDERR "Total $func_total functions.\n" if ($'vflag);
-#
-# (5) make file index (files.html and files/*)
-# PRODUCE @files %includes
-#
-print STDERR "[", &'date, "] ", "(5) making file index ...\n" if ($'vflag);
-$file_total = &makefileindex($dist, "$dist/files.html", "$dist/$INCS");
-print STDERR "Total $file_total files.\n" if ($'vflag);
-#
-# [#] make a common part for mains.html and index.html
-# USING @funcs @files
-#
-print STDERR "[", &'date, "] ", "(#) making a common part ...\n" if ($'vflag);
-$index = &makecommonpart($title);
-#
-# (6)make index file (index.html)
-#
-print STDERR "[", &'date, "] ", "(6) making index file ...\n" if ($'vflag);
-&makeindex("$dist/index.html", $title, $index);
-#
-# (7) make main index (mains.html)
-#
-print STDERR "[", &'date, "] ", "(7) making main index ...\n" if ($'vflag);
-&makemainindex("$dist/mains.html", $index);
-&makenullhtml("$dist/null.html") if ($'hflag);
-#
-# (#) make anchor database
-#
-print STDERR "[", &'date, "] ", "(#) making temporary database ...\n" if ($'vflag);
-&anchor'create();
-#
-# (8) make HTML files ($SRCS/*)
-# USING TAG CACHE, %includes and anchor database.
-#
-print STDERR "[", &'date, "] ", "(8) making hypertext from source code ...\n" if ($'vflag);
-&makehtml($dist, $file_total);
-&'clean();
-print STDERR "[", &'date, "] ", "Done.\n" if ($'vflag);
-if ($'cflag && $'vflag) {
- print STDERR "\n";
- print STDERR "[Information]\n";
- print STDERR "\n";
- print STDERR " You need to setup http server so that '*.ghtml' are treated\n";
- print STDERR " as gzipped files. Please see 'HTML/.htaccess.skel'.\n";
- print STDERR " Good luck!\n";
- print STDERR "\n";
-}
-exit 0;
-#-------------------------------------------------------------------------
-# SUBROUTINES
-#-------------------------------------------------------------------------
-#
-# makeprogram: make CGI program
-#
-sub makeprogram {
- local($file) = @_;
-
- open(PROGRAM, ">$file") || &'error("cannot make CGI program.");
- $program = <<'END_OF_SCRIPT';
-#!/usr/bin/perl
-#------------------------------------------------------------------
-# SORRY TO HAVE SURPRISED YOU!
-# IF YOU SEE THIS UNREASONABLE FILE WHILE BROUSING, FORGET PLEASE.
-# IF YOU ARE A ADMINISTRATOR OF THIS SITE, PLEASE SETUP HTTP SERVER
-# SO THAT THIS SCRIPT CAN BE EXECUTED AS A CGI COMMAND. THANK YOU.
-#------------------------------------------------------------------
-$SRCS = 'S';
-$HTML = '@HTML@';
-$SEP = ' '; # source file path must not include $SEP charactor
-$ESCSEP = &escape($SEP);
-sub escape {
- local($c) = @_;
- '%' . sprintf("%x", ord($c));
-}
-print "Content-type: text/html\n\n";
-print "<HTML><BODY>\n";
-@pairs = split (/&/, $ENV{'QUERY_STRING'});
-foreach $p (@pairs) {
- ($name, $value) = split(/=/, $p);
- $value =~ tr/+/ /;
- $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack("C", hex($1))/eg;
- $form{$name} = $value;
-}
-if ($form{'pattern'} eq '') {
- print "<H3>Pattern not specified. <A HREF=../mains.html>[return]</A></H3>\n";
- print "</BODY></HTML>\n";
- exit 0;
-}
-$pattern = $form{'pattern'};
-$flag = ($form{'type'} eq 'definition') ? '' : 'r';
-$words = ($form{'type'} eq 'definition') ? 'definitions' : 'referencies';
-print "<H1><FONT COLOR=#cc0000>\"$pattern\"</FONT></H1>\n";
-print "Following $words are matched to above pattern.<HR>\n";
-$pattern =~ s/'//g; # to shut security hole
-unless (open(PIPE, "/usr/bin/global -x$flag '$pattern' |")) {
- print "<H3>Cannot execute global. <A HREF=../mains.html>[return]</A></H3>\n";
- print "</BODY></HTML>\n";
- exit 0;
-}
-$cnt = 0;
-print "<PRE>\n";
-while (<PIPE>) {
- $cnt++;
- local($tag, $lno, $filename) = split;
- $filename =~ s/^\.\///;
- $filename =~ s/\//$ESCSEP/g;
- s/($tag)/<A HREF=..\/$SRCS\/$filename.$HTML#$lno>$1<\/A>/;
- print;
-}
-close(PIPE);
-print "</PRE>\n";
-if ($cnt == 0) {
- print "<H3>Pattern not found. <A HREF=../mains.html>[return]</A></H3>\n";
-}
-print "</BODY></HTML>\n";
-exit 0;
-#------------------------------------------------------------------
-# SORRY TO HAVE SURPRISED YOU!
-# IF YOU SEE THIS UNREASONABLE FILE WHILE BROUSING, FORGET PLEASE.
-# IF YOU ARE A ADMINISTRATOR OF THIS SITE, PLEASE SETUP HTTP SERVER
-# SO THAT THIS SCRIPT CAN BE EXECUTED AS A CGI COMMAND. THANK YOU.
-#------------------------------------------------------------------
-END_OF_SCRIPT
-
- $program =~ s/\@HTML\@/$'HTML/g;
- print PROGRAM $program;
- close(PROGRAM);
-}
-#
-# makeghtml: make unzip script
-#
-sub makeghtml {
- local($file) = @_;
- open(PROGRAM, ">$file") || &'error("cannot make unzip script.");
- $program = <<'END_OF_SCRIPT';
-#!/bin/sh
-echo "content-type: text/html"
-echo
-gzip -S @HTML@ -d -c "$PATH_TRANSLATED"
-END_OF_SCRIPT
-
- $program =~ s/\@HTML\@/$'HTML/g;
- print PROGRAM $program;
- close(PROGRAM);
-}
-#
-# makehtaccess: make .htaccess skelton file.
-#
-sub makehtaccess {
- local($file) = @_;
- open(SKELTON, ">$file") || &'error("cannot make .htaccess skelton file.");
- $skelton = <<'END_OF_SCRIPT';
-#
-# Skelton file for .htaccess -- This file was generated by htags(1).
-#
-# Htags have made gzipped hypertext because you specified -c option.
-# You need to setup http server so that these hypertext can be treated
-# as gzipped files.
-# There are many way to do it, but one of the method is to put .htaccess
-# file in 'HTML' directory.
-#
-# Please rewrite XXX to the true value in your web site and rename this
-# file to '.htaccess' and http server read this.
-#
-AddHandler htags-gzipped-html ghtml
-Action htags-gzipped-html /XXX/cgi-bin/ghtml.cgi
-END_OF_SCRIPT
- print SKELTON $skelton;
- close(SKELTON);
-}
-#
-# makehelp: make help file
-#
-sub makehelp {
- local($file) = @_;
-
- open(HELP, ">$file") || &'error("cannot make help file.");
- print HELP $'begin_html;
- print HELP &'set_header(0, 'HELP');
- print HELP $'begin_body;
- print HELP "<H2>Usage of Links</H2>\n";
- print HELP "<PRE>/* [&lt;][&gt;][^][v] [top][bottom][index][help] */</PRE>\n";
- print HELP "<DL>\n";
- print HELP "<DT>[&lt;]<DD>Previous function.\n";
- print HELP "<DT>[&gt;]<DD>Next function.\n";
- print HELP "<DT>[^]<DD>First function in this file.\n";
- print HELP "<DT>[v]<DD>Last function in this file.\n";
- print HELP "<DT>[top]<DD>Top of this file.\n";
- print HELP "<DT>[bottom]<DD>Bottom of this file.\n";
- print HELP "<DT>[index]<DD>Return to index page (mains.html).\n";
- print HELP "<DT>[help]<DD>You are seeing now.\n";
- print HELP "</DL>\n";
- print HELP $'end_body;
- print HELP $'end_html;
- close(HELP);
-}
-#
-# makedupindex: make duplicate entries index ($DEFS/* and $REFS/*)
-#
-# go) tag cache
-# r) $count
-#
-sub makeline {
- $_[0] =~ s/\.\///;
- $_[0] =~ s/&/&amp;/g;
- $_[0] =~ s/</&lt;/g;
- $_[0] =~ s/>/&gt;/g;
- local($tag, $lno, $filename) = split(/[ \t\n]+/, $_[0]);;
- $filename = &'path2url($filename);
- $_[0] =~ s/^$tag/<A HREF=..\/$'SRCS\/$filename#$lno>$tag<\/A>/;
-}
-sub makedupindex {
- local($dist) = @_;
- local($count) = 0;
-
- foreach $db ('GRTAGS', 'GTAGS') {
- local($kind) = $db eq 'GTAGS' ? "definitions" : "references";
- local($option) = $db eq 'GTAGS' ? '' : 'r';
- local($prev) = '';
- local($first_line);
- local($writing) = 0;
-
- $count = 0;
- local($command) = "global -nx$option '.*' | sort +0 -1 +2 -3 +1n -2";
- open(LIST, "$command |") || &'error("cannot fork.");
- while (<LIST>) {
- chop;
- local($tag, $lno, $filename) = split;
- if ($prev ne $tag) {
- $count++;
- print STDERR " [$count] adding $tag $kind.\n" if ($'vflag);
- if ($writing) {
- print FILE "</PRE>\n";
- print FILE $'end_body;
- print FILE $'end_html;
- close(FILE);
- $writing = 0;
- }
- # single entry
- if ($first_line) {
- &cache'put($db, $prev, $first_line);
- }
- $first_line = $_;
- $prev = $tag;
- } else {
- # duplicate entry
- if ($first_line) {
- &cache'put($db, $tag, '');
- local($type) = ($db eq 'GTAGS') ? $'DEFS : $'REFS;
- if ($'cflag) {
- open(FILE, "| gzip -c >$dist/$type/$tag.$'HTML") || &'error("cannot make file '$dist/$type/$tag.$'HTML'.");
- } else {
- open(FILE, ">$dist/$type/$tag.$'HTML") || &'error("cannot make file '$dist/$type/$tag.$'HTML'.");
- }
- $writing = 1;
- print FILE $'begin_html;
- print FILE &'set_header(0, $tag);
- print FILE $'begin_body;
- print FILE "<PRE>\n";
- &makeline($first_line);
- print FILE $first_line, "\n";
- $first_line = '';
- }
- &makeline($_);
- print FILE $_, "\n";
- }
- }
- close(LIST);
- if ($?) { &'error("'$command' failed."); }
- if ($writing) {
- print FILE "</PRE>\n";
- print FILE $'end_body;
- print FILE $'end_html;
- close(FILE);
- }
- if ($first_line) {
- &cache'put($db, $prev, $first_line);
- }
- }
- $count;
-}
-#
-# makefuncindex: make function index (including alphabetic index)
-#
-# i) dist distribution directory
-# i) file function index file
-# i) total functions total
-# gi) tag cache
-# go) @funcs
-#
-sub makefuncindex {
- local($dist, $file, $total) = @_;
- local($count) = 0;
- local($indexlink) = "../mains.$'HTML";
-
- open(FUNCTIONS, ">$file") || &'error("cannot make function index '$file'.");
- print FUNCTIONS $'begin_html;
- print FUNCTIONS &'set_header(0, 'FUNCTION INDEX', $'default_view);
- print FUNCTIONS $'begin_body;
- print FUNCTIONS "<H2>FUNCTION INDEX</H2>\n";
- print FUNCTIONS "<OL>\n" if (!$'aflag);
- local($old) = select(FUNCTIONS);
- local($command) = "global -c";
- open(TAGS, "$command |") || &'error("cannot fork.");
- local($alpha, $alpha_f);
- @funcs = (); # [A][B][C]...
- while (<TAGS>) {
- $count++;
- chop;
- local($tag) = $_;
- print STDERR " [$count/$total] adding $tag\n" if ($'vflag);
- if ($'aflag && ($alpha eq '' || $tag !~ /^$alpha/)) {
- if ($alpha) {
- print ALPHA "</OL>\n";
- print ALPHA "<A HREF=$indexlink TARGET=_self>[index]</A>\n";
- print ALPHA "$'begin_script$'rewrite_href_funcs$'end_script";
- print ALPHA $'end_body;
- print ALPHA $'end_html;
- close(ALPHA);
- }
- # for multi-byte code
- local($c0, $c1);
- $c0 = substr($tag, 0, 1);
- if (ord($c0) > 127) {
- $c1 = substr($tag, 1, 1);
- $alpha = $c0 . $c1;
- $alpha_f = "" . ord($c0) . ord($c1);
- } else {
- $alpha = $alpha_f = $c0;
- }
- push(@funcs, "<A HREF=funcs/$alpha_f.$'HTML TARGET=_self>[$alpha]</A>\n");
- if ($'cflag) {
- open(ALPHA, "| gzip -c >$dist/funcs/$alpha_f.$'HTML") || &'error("cannot make alphabetical function index.");
- } else {
- open(ALPHA, ">$dist/funcs/$alpha_f.$'HTML") || &'error("cannot make alphabetical function index.");
- }
- print ALPHA $'begin_html;
- print ALPHA &'set_header(0, $alpha, $'default_view);
- print ALPHA $'begin_body;
- print ALPHA "<H2>[$alpha]</H2>\n";
- print ALPHA "<A HREF=$indexlink TARGET=_self>[index]</A>\n";
- print ALPHA "<OL>\n";
- select(ALPHA);
- }
- local($line) = &cache'get('GTAGS', $tag);
- if (!$line) {
- print "<LI><A HREF=", ($'aflag) ? "../" : "", "$'DEFS/$tag.$'HTML>$tag</A>\n";
- } else {
- local($tag, $lno, $filename) = split(/[ \t]+/, $line);
- $filename = &'path2url($filename);
- print "<LI><A HREF=", ($'aflag) ? "../" : "", "$'SRCS/$filename#$lno>$tag</A>\n";
- }
- }
- close(TAGS);
- if ($?) { &'error("'$command' failed."); }
- select($old);
- if ($'aflag) {
- print ALPHA "</OL>\n";
- print ALPHA "<A HREF=$indexlink TARGET=_self>[index]</A>\n";
- print ALPHA "$'begin_script$'rewrite_href_funcs$'end_script";
- print ALPHA $'end_body;
- print ALPHA $'end_html;
- close(ALPHA);
-
- print FUNCTIONS @funcs;
- }
- print FUNCTIONS "</OL>\n" if (!$'aflag);
- print FUNCTIONS $'end_body;
- print FUNCTIONS $'end_html;
- close(FUNCTIONS);
- $count;
-}
-#
-# makefileindex: make file index
-#
-# i) dist distribution directory
-# i) file file name
-# i) $incdir $INC directory
-# go) @files
-# go) %includes
-#
-sub makefileindex {
- local($dist, $file, $incdir) = @_;
- local($count) = 0;
- local($indexlink) = "../mains.$'HTML";
- local(@dirstack, @fdstack);
- local($command) = "gtags --find | sort";
- open(FIND, "$command |") || &'error("cannot fork.");
- open(FILES, ">$file") || &'error("cannot make file '$file'.");
- print FILES $'begin_html;
- print FILES &'set_header(0, 'FILE INDEX', $'default_view);
- print FILES $'begin_body;
- print FILES "<H2>FILE INDEX</H2>\n";
- print FILES "<OL>\n";
-
- local($org) = select(FILES);
- local(@push, @pop, $file);
-
- while (<FIND>) {
- $count++;
- chop;
- s/^\.\///;
- print STDERR " [$count] adding $_\n" if ($'vflag);
- @push = split('/');
- $file = pop(@push);
- @pop = @dirstack;
- while ($push[0] && $pop[0] && $push[0] eq $pop[0]) {
- shift @push;
- shift @pop;
- }
- if (@push || @pop) {
- while (@pop) {
- pop(@dirstack);
- local($parent) = (@dirstack) ? &path2url(join('/', @dirstack)) : $indexlink;
- print "</OL>\n";
- print "<A HREF=$parent TARGET=_self>[..]</A>\n";
- print "$'begin_script$'rewrite_href_files$'end_script" if (@dirstack == 0);
- print $'end_body;
- print $'end_html;
- $path = pop(@fdstack);
- close($path);
- select($fdstack[$#fdstack]) if (@fdstack);
- pop(@pop);
- }
- while (@push) {
- local($parent) = (@dirstack) ? &path2url(join('/', @dirstack)) : $indexlink;
- push(@dirstack, shift @push);
- $path = join('/', @dirstack);
- $cur = "$dist/files/" . &path2file($path);
- local($li) = "<LI><A HREF=" . (@dirstack == 1 ? 'files/' : '') . &path2url($path) . " TARGET=_self>$path/</A>\n";
- if (@dirstack == 1) {
- push(@files, $li);
- } else {
- print $li;
- }
- if ($'cflag) {
- open($cur, "| gzip -c >'$cur'") || &'error("cannot make directory index.");
- } else {
- open($cur, ">$cur") || &'error("cannot make directory index.");
- }
- select($cur);
- push(@fdstack, $cur);
- print $'begin_html;
- print &'set_header(0, "$path", $'default_view);
- print $'begin_body;
- print "<H2>$path/</H2>\n";
- print "<A HREF=$parent TARGET=_self>[..]</A>\n";
- print "<OL>\n";
- }
- }
- # collect include files.
- if (/.*\.h$/) {
- if (! defined $includes{$file}) {
- $includes{$file} = $_;
- } else {
- # duplicate entries
- $includes{$file} = "$includes{$file}\n$_";
- }
- }
- local($url) = &path2url($_);
- local($li) = "<LI><A HREF=" . (@dirstack == 0 ? '' : '../') . "S/$url>$_</A>\n";
- if (@dirstack == 0) {
- push(@files, $li);
- } else {
- print $li;
- }
- }
- close(FIND);
- while (@dirstack) {
- pop(@dirstack);
- local($parent) = (@dirstack) ? &path2url(join('/', @dirstack)) : $indexlink;
- print "</OL>\n";
- print "<A HREF=$parent TARGET=_self>[..]</A>\n";
- print "$'begin_script$'rewrite_href_files$'end_script" if (@dirstack == 0);
- print $'end_body;
- print $'end_html;
- $path = pop(@fdstack);
- close($path);
- select($fdstack[$#fdstack]) if (@fdstack);
- }
- print FILES @files;
- print FILES "</OL>\n";
- print FILES $'end_body;
- print FILES $'end_html;
- close(FILES);
-
- select($org);
- foreach $last (keys %includes) {
- local(@incs) = split(/\n/, $includes{$last});
- if (@incs > 1) {
- if ($'cflag) {
- open(INCLUDE, "| gzip -c >$incdir/$last.$'HTML") || &'error("cannot open file '$incdir/$last.$'HTML'.");
- } else {
- open(INCLUDE, ">$incdir/$last.$'HTML") || &'error("cannot open file '$incdir/$last.$'HTML'.");
- }
- print INCLUDE $'begin_html;
- print INCLUDE &'set_header(0, $last);
- print INCLUDE $'begin_body;
- print INCLUDE "<PRE>\n";
- foreach $filename (@incs) {
- local($path) = &'path2url($filename);
- print INCLUDE "<A HREF=../$'SRCS/$path>$filename</A>\n";
- }
- print INCLUDE "</PRE>\n";
- print INCLUDE $'end_body;
- print INCLUDE $'end_html;
- close(INCLUDE);
- # '' means that information already written to file.
- $includes{$last} = '';
- }
- }
- $count;
-}
-#
-# makecommonpart: make a common part for mains.html and index.html
-#
-# gi) @files
-# gi) @funcs
-#
-sub makecommonpart {
- local($title) = @_;
- local($index) = '';
-
- $index .= "<H1>$'title_begin$'title$'title_end</H1>\n";
- $index .= "<P ALIGN=right>";
- $index .= "Last updated " . &'date . "<BR>\n";
- $index .= "This hypertext was generated by <A HREF=http://wafu.netgate.net/tama/unix/global.html TARGET=_top>GLOBAL</A>.<BR>\n";
- $index .= $'begin_script;
- $index .= "if (parent.frames.length && parent.mains == self)\n";
- $index .= " document.write($'langle+'A HREF=mains.html TARGET=_top'+$'rangle+'[No frame version is here.]'+$'langle+'/A'+$'rangle)\n";
- $index .= $'end_script;
- $index .= "</P>\n<HR>\n";
- if ($'fflag) {
- $index .= "<H2>FUNCTION SEARCH</H2>\n";
- $index .= "Please input function name and select [Search]. POSIX's regular expression is allowed.<P>\n";
- $index .= "<FORM METHOD=GET ACTION=cgi-bin/global.cgi>\n";
- $index .= "<INPUT NAME=pattern>\n";
- $index .= "<INPUT TYPE=submit VALUE=Search>\n";
- $index .= "<INPUT TYPE=reset VALUE=Reset><BR>\n";
- $index .= "<INPUT TYPE=radio NAME=type VALUE=definition CHECKED>Definition\n";
- $index .= "<INPUT TYPE=radio NAME=type VALUE=reference>Reference\n";
- $index .= "</FORM>\n<HR>\n";
- }
- $index .= "<H2>MAINS</H2>\n";
- $index .= "<PRE>\n";
- local($command) = "global -nx main | sort +0 -1 +2 -3 +1n -2";
- open(PIPE, "$command |") || &'error("cannot fork.");
- while (<PIPE>) {
- local($nouse, $lno, $filename) = split;
- $nouse = ''; # to make perl quiet
- $filename = &'path2url($filename);
- s/(main)/<A HREF=$'SRCS\/$filename#$lno>$1<\/A>/;
- $index .= $_;
- }
- close(PIPE);
- if ($?) { &'error("'$command' failed."); }
- $index .= "</PRE>\n<HR>\n<H2>FUNCTIONS</H2>\n";
- if ($'aflag) {
- foreach $f (@funcs) {
- $index .= $f;
- }
- } else {
- $index .= "<PRE><A HREF=funcs.html>function index</A></PRE>\n";
- }
- $index .= "<HR>\n<H2>FILES</H2>\n";
- $index .= "<OL>\n";
- foreach $f (@files) {
- $index .= $f;
- }
- $index .= "</OL>\n<HR>\n";
- $index;
-}
-#
-# makeindex: make index file
-#
-# i) $file file name
-# i) $title title of index file
-# i) $index common part
-#
-sub makeindex {
- local($file, $title, $index) = @_;
-
- open(FRAME, ">$file") || &'error("cannot open file '$file'.");
- print FRAME $'begin_html;
- print FRAME "<HEAD><TITLE>$title</TITLE></HEAD>\n";
- print FRAME "<FRAMESET COLS='200,*'>\n";
- print FRAME "<FRAMESET ROWS='50%,50%'>\n";
- print FRAME "<FRAME NAME=funcs SRC=funcs.html>\n";
- print FRAME "<FRAME NAME=files SRC=files.html>\n";
- print FRAME "</FRAMESET>\n";
- if ($'hflag) {
- print FRAME "<FRAMESET ROWS='50,*'>\n";
- print FRAME "<FRAME NAME=title SRC=null.html BORDER=0 SCROLLING=no>\n";
- print FRAME "<FRAME NAME=mains SRC=mains.html BORDER=0>\n";
- print FRAME "</FRAMESET>\n";
- } else {
- print FRAME "<FRAME NAME=mains SRC=mains.html>\n";
- }
- print FRAME "<NOFRAMES>\n$index</NOFRAMES>\n";
- print FRAME "</FRAMESET>\n";
- print FRAME $'end_html;
- close(FRAME);
-}
-#
-# makemainindex: make main index
-#
-# i) $file file name
-# i) $index common part
-#
-sub makemainindex {
- local($file, $index) = @_;
-
- open(INDEX, ">$file") || &'error("cannot create file '$file'.");
- print INDEX $'begin_html;
- print INDEX &'set_header(1, $title);
- print INDEX $'begin_body;
- print INDEX $index;
- print INDEX $'end_body;
- print INDEX $'end_html;
- close(INDEX);
-}
-#
-# makenullhtml: make null html
-#
-# i) $file file name
-#
-sub makenullhtml {
- local($file) = @_;
-
- open(NULL, ">$file") || &'error("cannot create file '$file'.");
- print NULL "<HTML><BODY></BODY></HTML>\n";
- close(NULL);
-}
-#
-# makehtml: make html files
-#
-# i) total number of files.
-#
-sub makehtml {
- local($dist, $total) = @_;
- local($count) = 0;
-
- open(FIND, "$'findcom |") || &'error("cannot fork.");
- while (<FIND>) {
- chop;
- $count++;
- local($path) = $_;
- $path =~ s/^\.\///;
- print STDERR " [$count/$total] converting $_\n" if ($'vflag);
- $path = &'path2file($path);
- &convert'src2html($_, "$dist/$'SRCS/$path");
- }
- close(FIND);
- if ($?) { &'error("cannot traverse directory."); }
-}
-#=========================================================================
-# CONVERT PACKAGE
-#=========================================================================
-package convert;
-#
-# src2html: convert source code into HTML
-#
-# i) $file source file - Read from
-# i) $hfile HTML file - Write to
-# gi) %includes
-# pairs of include file and the path
-#
-sub src2html {
- local($file, $hfile) = @_;
- local($ncol) = $'ncol;
- local($tabs) = $'tabs;
- local(%ctab) = ('&', '&amp;', '<', '&lt;', '>', '&gt;');
- local($expand) = &'usable('expand') ? 'expand' : 'gtags --expand';
- local($isjava) = ($file =~ /\.java$/) ? 1 : 0;
- local($reserved_words) = ($isjava) ? $'java_reserved_words : $'c_reserved_words;
-
- if ($'cflag) {
- open(HTML, "| gzip -c >'$hfile'") || &'error("cannot create file '$hfile'.");
- } else {
- open(HTML, ">$hfile") || &'error("cannot create file '$hfile'.");
- }
- local($old) = select(HTML);
- #
- # load tags belonging to this file.
- #
- &anchor'load($file);
- open(SRC, "$expand -$tabs '$file' |") || &'error("cannot fork.");
- #
- # print the header
- #
- $file =~ s/^\.\///;
- print $'begin_html;
- print &'set_header(1, $file);
- print $'begin_body;
- print "<A NAME=TOP><H2>$file</H2>\n";
- print &link_format(&anchor'getlinks(0));
- print "\n<HR>\n";
- print "<H2>FUNCTIONS</H2>\n";
- print "This source file includes following functions.\n";
- print "<OL>\n";
- local($lno, $tag, $type);
- for (($lno, $tag, $type) = &anchor'first(); $lno; ($lno, $tag, $type) = &anchor'next()) {
- print "<LI><A HREF=#$lno>$tag</A>\n" if ($type eq 'D');
- }
- print "</OL>\n";
- print "<HR>\n";
- #
- # print source code
- #
- print "<PRE>\n";
- $INCOMMENT = 0; # initial status is out of comment
- local($LNO, $TAG, $TYPE) = &anchor'first();
- while (<SRC>) {
- local($converted);
- s/\r$//;
- # make link for include file
- if (!$INCOMMENT && /^#include/) {
- local($last, $sep) = m![</"]([^</"]+)([">])!;
- if (defined $'includes{$last}) {
- local($link, $suffix);
- if ($'includes{$last}) {
- $link = &'path2url($'includes{$last});
- } else {
- $link = "../$'INCS/$last.$'HTML";
- }
- if ($sep eq '"') {
- s!"(.*$last)"!"<A HREF=$link>$1</A>"!;
- } else {
- s!<(.*$last)>!&lt;<A HREF=$link>$1</A>&gt;!;
- }
- $converted = 1;
- }
- }
- # translate '<', '>' and '&' into entity name
- if (!$converted) { s/([&<>])/$ctab{$1}/ge; }
- &protect_line(); # protect quoted char, strings and comments
- # painting source code
- s/({|})/$'brace_begin$1$'brace_end/g;
- local($sharp) = s/^(#\w+)// ? $1 : '';
- s/\b($reserved_words)\b/$'reserved_begin$1$'reserved_end/go if ($sharp ne '#include');
- s/^/$'sharp_begin$sharp$'sharp_end/ if ($sharp); # recover macro
-
- local($define_line) = 0;
- local(@links) = ();
- local($count) = 0;
- local($lno_printed) = 0;
-
- if ($'lflag) {
- print "<A NAME=$.>";
- $lno_printed = 1;
- }
- for (; int($LNO) == $.; ($LNO, $TAG, $TYPE) = &anchor'next()) {
- if (!$lno_printed) {
- print "<A NAME=$.>";
- $lno_printed = 1;
- }
- $define_line = $LNO if ($TYPE eq 'D');
- $db = ($TYPE eq 'D') ? 'GRTAGS' : 'GTAGS';
- local($line) = &cache'get($db, $TAG);
- if (defined($line)) {
- local($href);
- if ($line) {
- local($nouse, $lno, $filename) = split(/[ \t]+/, $line);
- $nouse = ''; # to make perl quiet
- $filename = &'path2url($filename);
- $href = "<A HREF=../$'SRCS/$filename#$lno>$TAG</A>";
- } else {
- local($dir) = ($TYPE eq 'D') ? $'REFS : $'DEFS;
- $href = "<A HREF=../$dir/$TAG.$'HTML>$TAG</A>";
- }
- # set tag marks and save hyperlink into @links
- if (ord($TAG) > 127) { # for multi-byte code
- if (s/([\x00-\x7f])$TAG([ \t]*\()/$1\005$count\005$2/ || s/([\x00-\x7f])$TAG([\x00-\x7f])/$1\005$count\005$2/) {
- $count++;
- push(@links, $href);
- } else {
- print STDERR "Error: $file $LNO $TAG($TYPE) tag must exist.\n" if ($'wflag);
- }
- } else {
- if (s/\b$TAG([ \t]*\()/\005$count\005$1/ || s/\b$TAG\b/\005$count\005/ || s/\b_$TAG\b/_\005$count\005/)
- {
- $count++;
- push(@links, $href);
- } else {
- print STDERR "Error: $file $LNO $TAG($TYPE) tag must exist.\n" if ($'wflag);
- }
- }
- } else {
- print STDERR "Warning: $file $LNO $TAG($TYPE) found but not referred.\n" if ($'wflag);
- }
- }
- # implant links
- local($s);
- for ($count = 0; @links; $count++) {
- $s = shift @links;
- unless (s/\005$count\005/$s/) {
- print STDERR "Error: $file $LNO $TAG($TYPE) tag must exist.\n" if ($'wflag);
- }
- }
- &unprotect_line();
- # print a line
- printf "%${ncol}d ", $. if ($'nflag);
- print;
- # print hyperlinks
- if ($define_line) {
- print ' ' x ($ncol + 1) if ($'nflag);
- print &link_format(&anchor'getlinks($define_line));
- print "\n";
- }
- }
- print "</PRE>\n";
- print "<HR>\n";
- print "<A NAME=BOTTOM>\n";
- print &link_format(&anchor'getlinks(-1));
- print "\n";
- print $'end_body;
- print $'end_html;
- close(SRC);
- if ($?) { &'error("cannot open file '$file'."); }
- close(HTML);
- select($old);
-
-}
-#
-# protect_line: protect quoted strings
-#
-# io) $_ source line
-#
-# \001 quoted(\) char
-# \002 quoted('') char
-# \003 quoted string
-# \004 comment
-# \005 line comment
-# \032 temporary mark
-#
-sub protect_line {
- @quoted_char1 = ();
- while (s/(\\.)/\001/) {
- push(@quoted_char1, $1);
- }
- @quoted_char2 = ();
- while (s/('[^']')/\002/) {
- push(@quoted_char2, $1);
- }
- @quoted_strings = ();
- while (s/("[^"]*")/\003/) {
- push(@quoted_strings, $1);
- }
- @comments = ();
- s/^/\032/ if ($INCOMMENT);
- while (1) {
- if ($INCOMMENT == 0) {
- if (s/\/\*/\032\/\*/) { # start comment
- $INCOMMENT = 1;
- } else {
- last;
- }
- } else {
- # Thanks to Jeffrey Friedl for his code.
- if (s!\032((/\*)?[^*]*\*+([^/*][^*]*\*+)*/)!\004!) {
- push(@comments, $1);
- $INCOMMENT = 0;
- } else {
- s/\032(.*)$/\004/; # mark comment
- push(@comments, $1);
- }
- last if ($INCOMMENT);
- }
- }
- $line_comment = '';
- if (s!(//.*)$!\005!) {
- $line_comment = $1;
- # ^ // /* $
- # (1) (2) ... (1) invalidate (2).
- $INCOMMENT = 0;
- }
-}
-#
-# unprotect_line: recover quoted strings
-#
-# i) $_ source line
-#
-sub unprotect_line {
- local($s);
-
- if ($line_comment) {
- s/\005/$'comment_begin$line_comment$'comment_end/;
- }
- while (@comments) {
- $s = shift @comments;
- # nested tag can be occured but no problem.
- s/\004/$'comment_begin$s$'comment_end/;
- }
- while (@quoted_strings) {
- $s = shift @quoted_strings;
- s/\003/$s/;
- }
- while (@quoted_char2) {
- $s = shift @quoted_char2;
- s/\002/$s/;
- }
- while (@quoted_char1) {
- $s = shift @quoted_char1;
- s/\001/$s/;
- }
-}
-#
-# link_format: format hyperlinks.
-#
-# i) (previous, next, first, last, top, bottom)
-#
-sub link_format {
- local(@tag) = @_;
- local(@label) = ('&lt;', '&gt;', '^', 'v', 'top', 'bottom');
-
- local($line) = "$'comment_begin/* ";
- while ($label = shift @label) {
- local($tag) = shift @tag;
- $line .= "<A HREF=#$tag>" if ($tag);
- $line .= "[$label]";
- $line .= "</A>" if ($tag);
- }
- $line .= "<A HREF=../mains.html>[index]</A>";
- $line .= "<A HREF=../help.html>[help]</A>";
- $line .= " */$'comment_end";
-
- $line;
-}
-
-#=========================================================================
-# ANCHOR PACKAGE
-#=========================================================================
-package anchor;
-#
-# create: create anchors temporary database
-#
-# go) %PATHLIST
-#
-sub create {
- $ANCH = "$'tmp/ANCH$$";
- open(ANCH, ">$ANCH") || &'error("cannot create file '$ANCH'.");
- close(ANCH);
- chmod ($ANCH, 0600);
- local($command) = "btreeop -C $ANCH";
- open(ANCH, "| $command") || &'error("cannot fork.");
- local($fcount) = 1;
- local($fnumber);
- foreach $db ('GTAGS', 'GRTAGS') {
- local($type) = ($db eq 'GTAGS') ? 'D' : 'R';
- local($option) = ($db eq 'GTAGS') ? '' : 'r';
- local($command) = "global -nx$option '.*'";
- open(PIPE, "$command |") || &'error("cannot fork.");
- while (<PIPE>) {
- local($tag, $lno, $filename) = split;
- $fnumber = $PATHLIST{$filename};
- if (!$fnumber) {
- $PATHLIST{$filename} = $fnumber = $fcount++;
- }
- print ANCH "$fnumber $lno $tag $type\n";
- }
- close(PIPE);
- if ($?) { &'error("'$command' failed."); }
- }
- close(ANCH);
- if ($?) { &'error("'$command' failed."); }
-}
-#
-# finish: remove anchors database
-#
-sub finish {
- unlink("$ANCH") if (defined($ANCH));
-}
-#
-# load: load anchors belonging to specified file.
-#
-# i) $file source file
-# gi) %PATHLIST
-# go) FIRST first definition
-# go) LAST last definition
-#
-sub load {
- local($file) = @_;
- local($fnumber);
-
- @ANCHORS = ();
- $FIRST = $LAST = 0;
-
- $file = './' . $file if ($file !~ /^\.\//);
- if (!($fnumber = $PATHLIST{$file})) {
- return;
- }
- local($command) = "btreeop -K $fnumber $ANCH";
- open(ANCH, "$command |") || &'error("cannot fork.");
- while (<ANCH>) {
- local($fnumber, $lno, $tag, $type) = split;
- local($line);
- # don't refer to macros which is defined in other C source.
- if ($type eq 'R' && ($line = &cache'get('GTAGS', $tag))) {
- local($nouse1, $nouse2, $f, $def) = split(/[ \t]+/, $line);
- if ($f !~ /\.h$/ && $f ne $file && $def =~ /^#/) {
- print STDERR "Information: $file $lno $tag($type) skipped, because this is a macro which is defined in other C source.\n" if ($'wflag);
- next;
- }
- }
- push(@ANCHORS, "$lno,$tag,$type");
- }
- close(ANCH);
- if ($?) {&'error("'$command' failed."); }
- local(@keys);
- foreach (@ANCHORS) {
- push(@keys, (split(/,/))[0]);
- }
- sub compare { $keys[$a] <=> $keys[$b]; }
- @ANCHORS = @ANCHORS[sort compare 0 .. $#keys];
- local($c);
- for ($c = 0; $c < @ANCHORS; $c++) {
- local($lno, $tag, $type) = split(/,/, $ANCHORS[$c]);
- if ($type eq 'D') {
- $FIRST = $lno;
- last;
- }
- }
- for ($c = $#ANCHORS; $c >= 0; $c--) {
- local($lno, $tag, $type) = split(/,/, $ANCHORS[$c]);
- if ($type eq 'D') {
- $LAST = $lno;
- last;
- }
- }
-}
-#
-# first: get first anchor
-#
-sub first {
- $CURRENT = 0;
- local($lno, $tag, $type) = split(/,/, $ANCHORS[$CURRENT]);
- $CURRENTDEF = $CURRENT if ($type eq 'D');
-
- ($lno, $tag, $type);
-}
-#
-# next: get next anchor
-#
-sub next {
- if (++$CURRENT > $#ANCHORS) {
- return ('', '', '');
- }
- local($lno, $tag, $type) = split(/,/, $ANCHORS[$CURRENT]);
- $CURRENTDEF = $CURRENT if ($type eq 'D');
-
- ($lno, $tag, $type);
-}
-#
-# getlinks: get links
-#
-# i) linenumber >= 1: line number
-# 0: header, -1: tailer
-# gi) @ANCHORS tag table in current file
-# r) (previous, next, first, last, top, bottom)
-#
-sub getlinks {
- local($linenumber) = @_;
- local($prev, $next, $first, $last, $top, $bottom);
-
- $prev = $next = $first = $last = $top = $bottom = 0;
- if ($linenumber >= 1) {
- local($c, $p, $n);
- if ($CURRENTDEF == 0) {
- for ($c = 0; $c <= $#ANCHORS; $c++) {
- local($lno, $tag, $type) = split(/,/, $ANCHORS[$c]);
- if ($lno == $linenumber && $type eq 'D') {
- last;
- }
- }
- $CURRENTDEF = $c;
- } else {
- for ($c = $CURRENTDEF; $c >= 0; $c--) {
- local($lno, $tag, $type) = split(/,/, $ANCHORS[$c]);
- if ($lno == $linenumber && $type eq 'D') {
- last;
- }
- }
- }
- $p = $n = $c;
- while (--$p >= 0) {
- local($lno, $tag, $type) = split(/,/, $ANCHORS[$p]);
- if ($type eq 'D') {
- $prev = $lno;
- last;
- }
- }
- while (++$n <= $#ANCHORS) {
- local($lno, $tag, $type) = split(/,/, $ANCHORS[$n]);
- if ($type eq 'D') {
- $next = $lno;
- last;
- }
- }
- }
- $first = $FIRST if ($FIRST > 0 && $linenumber != $FIRST);
- $last = $LAST if ($LAST > 0 && $linenumber != $LAST);
- $top = 'TOP' if ($linenumber != 0);
- $bottom = 'BOTTOM' if ($linenumber != -1);
- if ($FIRST > 0 && $FIRST == $LAST) {
- $last = '' if ($linenumber == 0);
- $first = '' if ($linenumber == -1);
- }
-
- ($prev, $next, $first, $last, $top, $bottom);
-}
-
-#=========================================================================
-# CACHE PACKAGE
-#=========================================================================
-package cache;
-#
-# open: open tag cache
-#
-# i) size cache size
-# -1: all cache
-# 0: no cache
-# other: sized cache
-#
-sub open {
- ($cachesize) = @_;
-
- if ($cachesize == -1) {
- return;
- }
- undef %CACH if defined(%CACH);
- $cachecount = 0;
-}
-#
-# put: put tag into cache
-#
-# i) $db database name
-# i) $tag tag name
-# i) $line tag line
-#
-sub put {
- local($db, $tag, $line) = @_;
- local($label) = ($db eq 'GTAGS') ? 'D' : 'R';
-
- $cachecount++;
- if ($cachesize >= 0 && $cachecount > $cachesize) {
- $CACH = "$'tmp/CACH$$";
- dbmopen(%CACH, $CACH, 0600) || &'error("make cache database.");
- $cachesize = -1;
- }
- $CACH{$label.$tag} = $line;
-}
-#
-# get: get tag from cache
-#
-# i) $db database name
-# i) $tag tag name
-# r) tag line
-#
-sub get {
- local($db, $tag) = @_;
- local($label) = ($db eq 'GTAGS') ? 'D' : 'R';
-
- defined($CACH{$label.$tag}) ? $CACH{$label.$tag} : undef;
-}
-#
-# close: close cache
-#
-sub close {
- #dbmclose(%CACH);
- unlink("$CACH.db") if (defined($CACH));
-}
diff --git a/contrib/global/lib/Makefile b/contrib/global/lib/Makefile
deleted file mode 100644
index 83d8be0..0000000
--- a/contrib/global/lib/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-LIB= gloutil
-SRCS= gtagsop.c tab.c strbuf.c mgets.c defined.c getdbpath.c \
- find.c dbop.c test.c makepath.c locatestring.c pathop.c \
- conf.c strmake.c usable.c token.c
-NOPROFILE= noprofile
-INTERNALLIB= true
-INTERNALSTATICLIB= true
-
-.include <bsd.lib.mk>
diff --git a/contrib/global/lib/conf.c b/contrib/global/lib/conf.c
deleted file mode 100644
index 887663d..0000000
--- a/contrib/global/lib/conf.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * 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.
- *
- * conf.c 30-Jun-98
- *
- */
-#include <sys/param.h>
-#include <assert.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "conf.h"
-#include "die.h"
-#include "gparam.h"
-#include "locatestring.h"
-#include "makepath.h"
-#include "mgets.h"
-#include "strbuf.h"
-#include "strmake.h"
-#include "test.h"
-/*
- * Access library for gtags.conf (.gtagsrc).
- * File format is a subset of XXXcap (termcap, printcap) file.
- */
-#define GTAGSCONF "/etc/global.conf"
-#define GTAGSRC ".globalrc"
-#define DEFAULTLABEL "default"
-static FILE *fp;
-static char *line;
-static int allowed_nest_level = 8;
-static int opened;
-
-static void trim __P((char *));
-static char *readrecord __P((const char *));
-static void includelabel __P((STRBUF *, const char *, int));
-
-static void
-trim(l)
-char *l;
-{
- char *f, *b;
- int colon = 0;
-
- for (f = b = l; *f; f++) {
- if (colon && isspace(*f))
- continue;
- colon = 0;
- if ((*b++ = *f) == ':')
- colon = 1;
- }
- *b = 0;
-}
-static char *
-readrecord(label)
-const char *label;
-{
- char *p, *q;
-
- rewind(fp);
- while ((p = mgets(fp, NULL, MGETS_CONT|MGETS_SKIPCOM)) != NULL) {
- trim(p);
- for (;;) {
- if ((q = strmake(p, "|:")) == NULL)
- die1("illegal configuration file format (%s).", p);
- if (!strcmp(label, q)) {
- if (!(p = locatestring(p, ":", MATCH_FIRST)))
- die("illegal configuration file format.");
- p = strdup(p);
- if (!p)
- die("short of memory.");
- return p;
- }
- p += strlen(q);
- if (*p == ':')
- break;
- else if (*p == '|')
- p++;
- else
- assert(0);
- }
- }
- return NULL;
-}
-static void
-includelabel(sb, label, level)
-STRBUF *sb;
-const char *label;
-int level;
-{
- char *savep, *p, *q;
-
- if (++level > allowed_nest_level)
- die("nested include= (or tc=) over flow.");
- if (!(savep = p = readrecord(label)))
- die1("label '%s' not found.", label);
- while ((q = locatestring(p, ":include=", MATCH_FIRST)) || (q = locatestring(p, ":tc=", MATCH_FIRST))) {
- char inclabel[MAXPROPLEN+1], *c = inclabel;
-
- strnputs(sb, p, q - p);
- q = locatestring(q, "=", MATCH_FIRST) + 1;
- while (*q && *q != ':')
- *c++ = *q++;
- *c = 0;
- includelabel(sb, inclabel, level);
- p = q;
- }
- strputs(sb, p);
- free(savep);
-}
-/*
- * configpath: get path of configuration file.
- */
-char *
-configpath() {
- static char config[MAXPATHLEN+1];
- char *p;
-
- if ((p = getenv("GTAGSCONF")) != NULL) {
- if (!test("r", p))
- config[0] = 0;
- else
- strcpy(config, p);
- } else if ((p = getenv("HOME")) && test("r", makepath(p, GTAGSRC)))
- strcpy(config, makepath(p, GTAGSRC));
- else if (test("r", GTAGSCONF))
- strcpy(config, GTAGSCONF);
- else
- config[0] = 0;
- return config;
-}
-/*
- * openconf: load configuration file.
- *
- * go) line specified entry
- */
-void
-openconf()
-{
- const char *label, *config;
- STRBUF *sb;
-
- assert(opened == 0);
-
- config = configpath();
- /*
- * if configuration file is not found, default values are set
- * for upper compatibility.
- */
- if (*config == 0) {
- sb = stropen();
- strputs(sb, "suffixes=c,h,y,s,S,java:");
- strputs(sb, "skip=y.tab.c,y.tab.h,SCCS/,RCS/,CVS/:");
- strputs(sb, "format=standard:");
- strputs(sb, "extractmethod:");
- strputs(sb, "GTAGS=gctags %s:");
- strputs(sb, "GRTAGS=gctags -r %s:");
- strputs(sb, "GSYMS=gctags -s %s:");
- line = strdup(strvalue(sb));
- if (!line)
- die("short of memory.");
- strclose(sb);
- opened = 1;
- return;
- }
- if ((label = getenv("GTAGSLABEL")) == NULL)
- label = "default";
- if (!(fp = fopen(config, "r")))
- die1("cannot open '%s'.", config);
- sb = stropen();
- includelabel(sb, label, 0);
- line = strdup(strvalue(sb));
- strclose(sb);
- fclose(fp);
- opened = 1;
- return;
-}
-/*
- * getconfn: get property number
- *
- * i) name property name
- * o) num value (if not NULL)
- * r) 1: found, 0: not found
- */
-int
-getconfn(name, num)
-const char *name;
-int *num;
-{
- char *p;
- char buf[MAXPROPLEN+1];
-
- if (!opened)
- openconf();
- sprintf(buf, ":%s#", name);
- if ((p = locatestring(line, buf, MATCH_FIRST)) != NULL) {
- p += strlen(buf);
- if (num != NULL)
- *num = atoi(p);
- return 1;
- }
- return 0;
-}
-/*
- * getconfs: get property string
- *
- * i) name property name
- * o) sb string buffer (if not NULL)
- * r) 1: found, 0: not found
- */
-int
-getconfs(name, sb)
-const char *name;
-STRBUF *sb;
-{
- char *p;
- char buf[MAXPROPLEN+1];
- int all = 0;
- int exist = 0;
-
- if (!opened)
- openconf();
- if (!strcmp(name, "suffixes") || !strcmp(name, "skip") || !strcmp(name, "reserved_words"))
- all = 1;
- sprintf(buf, ":%s=", name);
- p = line;
- while ((p = locatestring(p, buf, MATCH_FIRST)) != NULL) {
- if (exist && sb)
- strputc(sb, ',');
- exist = 1;
- for (p += strlen(buf); *p && *p != ':'; p++)
- if (sb)
- strputc(sb, *p);
- if (!all)
- break;
- }
- /*
- * It may be that these code should be moved to applications.
- * But nothing cannot start without them.
- */
- if (!exist) {
- exist = 1;
- if (!strcmp(name, "suffixes")) {
- if (sb)
- strputs(sb, "c,h,y,s,S,java");
- } else if (!strcmp(name, "skip")) {
- if (sb)
- strputs(sb, "y.tab.c,y.tab.h,SCCS/,RCS/,CVS/");
- } else
- exist = 0;
- }
- return exist;
-}
-/*
- * getconfb: get property bool value
- *
- * i) name property name
- * r) 1: TRUE, 0: FALSE
- */
-int
-getconfb(name)
-const char *name;
-{
- char *p;
- char buf[MAXPROPLEN+1];
-
- if (!opened)
- openconf();
- sprintf(buf, ":%s:", name);
- if ((p = locatestring(line, buf, MATCH_FIRST)) != NULL)
- return 1;
- return 0;
-}
-void
-closeconf()
-{
- if (!opened)
- return;
- free(line);
- opened = 0;
-}
diff --git a/contrib/global/lib/conf.h b/contrib/global/lib/conf.h
deleted file mode 100644
index 9317d9f..0000000
--- a/contrib/global/lib/conf.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.
- *
- * conf.h 16-Oct-97
- *
- */
-
-#ifndef _CONF_H_
-#define _CONF_H_
-
-#include "strbuf.h"
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-char *configpath __P((void));
-void openconf __P((void));
-int getconfn __P((const char *, int *));
-int getconfs __P((const char *, STRBUF *));
-int getconfb __P((const char *));
-void closeconf __P((void));
-
-#endif /* ! _CONF_H_ */
diff --git a/contrib/global/lib/dbop.c b/contrib/global/lib/dbop.c
deleted file mode 100644
index 9bd98f3..0000000
--- a/contrib/global/lib/dbop.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Copyright (c) 1996, 1997, 1998 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.
- *
- * dbop.c 12-Nov-98
- *
- */
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <assert.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "dbop.h"
-#include "die.h"
-#include "test.h"
-
-static DBT key; /* key of record */
-static DBT dat; /* data of record */
-/*
- * dbop_open: open db database.
- *
- * i) dbname database name
- * i) mode 0: read only, 1: create, 2: modify
- * i) perm file permission
- * i) flags
- * DBOP_DUP: allow duplicate records.
- * DBOP_REMOVE: remove on closed.
- * r) descripter for dbop_xxx()
- */
-DBOP *
-dbop_open(dbname, mode, perm, flags)
-const char *dbname;
-int mode;
-int perm;
-int flags;
-{
- DB *db;
- int rw = 0;
- DBOP *dbop;
- BTREEINFO info;
-
- /*
- * setup argments.
- */
- switch (mode) {
- case 0:
- rw = O_RDONLY;
- break;
- case 1:
- rw = O_RDWR|O_CREAT|O_TRUNC;
- break;
- case 2:
- rw = O_RDWR;
- break;
- default:
- assert(0);
- }
- memset(&info, 0, sizeof(info));
- if (flags & DBOP_DUP)
- info.flags |= R_DUP;
- info.cachesize = 500000;
-
- /*
- * 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)
- return NULL;
- if (!(dbop = (DBOP *)malloc(sizeof(DBOP))))
- die("short of memory.");
- strcpy(dbop->dbname, dbname);
- dbop->db = db;
- dbop->openflags = flags;
- dbop->perm = (mode == 1) ? perm : 0;
- dbop->lastkey = NULL;
- dbop->lastdat = NULL;
-
- return dbop;
-}
-/*
- * dbop_get: get data by a key.
- *
- * i) dbop descripter
- * i) name name
- * r) pointer to data
- */
-char *
-dbop_get(dbop, name)
-DBOP *dbop;
-const char *name;
-{
- DB *db = dbop->db;
- int status;
-
- key.data = (char *)name;
- key.size = strlen(name)+1;
-
- status = (*db->get)(db, &key, &dat, 0);
- dbop->lastkey = (char *)key.data;
- dbop->lastdat = (char *)dat.data;
- switch (status) {
- case RET_SUCCESS:
- break;
- case RET_ERROR:
- die("cannot read from database.");
- case RET_SPECIAL:
- return (NULL);
- }
- return((char *)dat.data);
-}
-/*
- * dbop_put: put data by a key.
- *
- * i) dbop descripter
- * i) name key
- * i) data data
- */
-void
-dbop_put(dbop, name, data)
-DBOP *dbop;
-const char *name;
-const char *data;
-{
- DB *db = dbop->db;
- int status;
-
- if (strlen(name) > MAXKEYLEN)
- die("primary key too long.");
- key.data = (char *)name;
- key.size = strlen(name)+1;
- dat.data = (char *)data;
- dat.size = strlen(data)+1;
-
- status = (*db->put)(db, &key, &dat, 0);
- switch (status) {
- case RET_SUCCESS:
- break;
- case RET_ERROR:
- case RET_SPECIAL:
- die("cannot write to database.");
- }
-}
-/*
- * dbop_del: delete record by a key.
- *
- * i) dbop descripter
- * i) name key
- */
-void
-dbop_del(dbop, name)
-DBOP *dbop;
-const char *name;
-{
- DB *db = dbop->db;
- int status;
-
- if (name) {
- key.data = (char *)name;
- key.size = strlen(name)+1;
- status = (*db->del)(db, &key, 0);
- } else
- status = (*db->del)(db, &key, R_CURSOR);
- if (status == RET_ERROR)
- die("cannot delete record.");
-}
-/*
- * dbop_first: get first record.
- *
- * i) dbop dbop descripter
- * i) name key
- * !=NULL: indexed read by key
- * ==NULL: sequential read
- * i) flags following dbop_next call take over this.
- * DBOP_KEY read key part
- * DBOP_PREFIX prefix read
- * only valied when sequential read
- * r) data
- */
-char *
-dbop_first(dbop, name, flags)
-DBOP *dbop;
-const char *name;
-int flags;
-{
- DB *db = dbop->db;
- int status;
-
- if (flags & DBOP_PREFIX && !name)
- flags &= ~DBOP_PREFIX;
- if (name) {
- if (strlen(name) > MAXKEYLEN)
- die("primary key too long.");
- strcpy(dbop->key, name);
- key.data = (char *)name;
- key.size = strlen(name);
- /*
- * includes NULL character unless prefix read.
- */
- if (!(flags & DBOP_PREFIX))
- key.size++;
- dbop->keylen = key.size;
- status = (*db->seq)(db, &key, &dat, R_CURSOR);
- } else {
- dbop->keylen = dbop->key[0] = 0;
- /* skip META records */
- for (status = (*db->seq)(db, &key, &dat, R_FIRST);
- status == RET_SUCCESS;
- status = (*db->seq)(db, &key, &dat, R_NEXT)) {
- int c = (flags & DBOP_KEY) ? *((char *)key.data) : *((char *)dat.data);
- if (c != ' ')
- break;
- }
- }
- dbop->lastkey = (char *)key.data;
- dbop->lastdat = (char *)dat.data;
- switch (status) {
- case RET_SUCCESS:
- break;
- case RET_ERROR:
- die("dbop_first failed.");
- case RET_SPECIAL:
- return (NULL);
- }
- dbop->ioflags = flags;
- if (flags & DBOP_PREFIX) {
- if (strncmp((char *)key.data, dbop->key, dbop->keylen))
- return NULL;
- } else if (dbop->keylen) {
- if (strcmp((char *)key.data, dbop->key))
- return NULL;
- }
- if (flags & DBOP_KEY) {
- strcpy(dbop->prev, (char *)key.data);
- return (char *)key.data;
- }
- return ((char *)dat.data);
-}
-/*
- * dbop_next: get next record.
- *
- * i) dbop dbop descripter
- * r) data
- *
- * Db_next always skip meta records.
- */
-char *
-dbop_next(dbop)
-DBOP *dbop;
-{
- DB *db = dbop->db;
- int flags = dbop->ioflags;
- int status;
-
- while ((status = (*db->seq)(db, &key, &dat, R_NEXT)) == RET_SUCCESS) {
- assert(dat.data != NULL);
- if (flags & DBOP_KEY && *((char *)key.data) == ' ')
- continue;
- else if (*((char *)dat.data) == ' ')
- continue;
- if (flags & DBOP_KEY) {
- if (!strcmp(dbop->prev, (char *)key.data))
- continue;
- if (strlen((char *)key.data) > MAXKEYLEN)
- die("primary key too long.");
- strcpy(dbop->prev, (char *)key.data);
- }
- dbop->lastkey = (char *)key.data;
- dbop->lastdat = (char *)dat.data;
- if (flags & DBOP_PREFIX) {
- if (strncmp((char *)key.data, dbop->key, dbop->keylen))
- return NULL;
- } else if (dbop->keylen) {
- if (strcmp((char *)key.data, dbop->key))
- return NULL;
- }
- return (flags & DBOP_KEY) ? (char *)key.data : (char *)dat.data;
- }
- if (status == RET_ERROR)
- die("dbop_next failed.");
- return NULL;
-}
-/*
- * dbop_close: close db
- *
- * i) dbop dbop descripter
- */
-void
-dbop_close(dbop)
-DBOP *dbop;
-{
- DB *db = dbop->db;
-
- (void)db->close(db);
- if (dbop->openflags & DBOP_REMOVE)
- (void)unlink(dbop->dbname);
- else if (dbop->perm && chmod(dbop->dbname, dbop->perm) < 0)
- die("cannot change file mode.");
- (void)free(dbop);
-}
diff --git a/contrib/global/lib/dbop.h b/contrib/global/lib/dbop.h
deleted file mode 100644
index 38342ca..0000000
--- a/contrib/global/lib/dbop.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1996, 1997, 1998 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.
- *
- * dbop.h 12-Nov-98
- *
- */
-#ifndef _DBOP_H_
-#define _DBOP_H_
-
-#include <sys/param.h>
-#include <db.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 dbop_open() */
- int ioflags; /* flags of dbop_first() */
- int perm; /* file permission */
-} DBOP;
-
-/*
- * openflags
- */
-#define DBOP_DUP 1 /* allow duplicate records */
-#define DBOP_REMOVE 2 /* remove file when closed */
-/*
- * ioflags
- */
-#define DBOP_KEY 1 /* read key part */
-#define DBOP_PREFIX 2 /* prefixed read */
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-DBOP *dbop_open __P((const char *, int, int, int));
-char *dbop_get __P((DBOP *, const char *));
-void dbop_put __P((DBOP *, const char *, const char *));
-void dbop_del __P((DBOP *, const char *));
-char *dbop_first __P((DBOP *, const char *, int));
-char *dbop_next __P((DBOP *));
-void dbop_close __P((DBOP *));
-#endif /* _DBOP_H_ */
diff --git a/contrib/global/lib/defined.c b/contrib/global/lib/defined.c
deleted file mode 100644
index 1e72b46..0000000
--- a/contrib/global/lib/defined.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- *
- * defined.c 12-Nov-98
- *
- */
-#include <stdlib.h>
-
-#include "die.h"
-#include "dbop.h"
-#include "defined.h"
-#include "makepath.h"
-
-static DBOP *dbop = NULL;
-
-/*
- * Tag command that supports referenced tag must call this function
- * to decide whether or not the tag is defined.
- */
-int
-defined(name)
-const char *name;
-{
- if (dbop == NULL) {
- const char *dbpath;
-
- /*
- * gtags(1) set GTAGSDBPATH to the path GTAGS exist.
- */
- if (!(dbpath = getenv("GTAGSDBPATH")))
- dbpath = ".";
- dbop = dbop_open(makepath(dbpath, "GTAGS"), 0, 0, 0);
- if (dbop == NULL)
- die1("GTAGS not found. (%s)", makepath(dbpath, "GTAGS"));
- }
- if (dbop_get(dbop, name))
- return 1;
- return 0;
-}
diff --git a/contrib/global/lib/defined.h b/contrib/global/lib/defined.h
deleted file mode 100644
index 6d342ac..0000000
--- a/contrib/global/lib/defined.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- *
- * defined.h 2-May-98
- *
- */
-
-#ifndef _DEFINED_H_
-#define _DEFINED_H_
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-int defined __P((const char *));
-
-#endif /* ! _DEFINED_H_ */
diff --git a/contrib/global/lib/die.h b/contrib/global/lib/die.h
deleted file mode 100644
index fc0e9e0..0000000
--- a/contrib/global/lib/die.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- *
- * die.h 16-Oct-97
- *
- */
-#ifndef _DIE_H_
-#define _DIE_H_
-#include <stdio.h>
-
-extern const char *progname;
-
-#define die(a) fprintf(stderr, "%s: ", progname),\
- fprintf(stderr, a),\
- fputs("\n", stderr),\
- exit(1)
-
-#define die1(a,b) fprintf(stderr, "%s: ", progname),\
- fprintf(stderr, a, b),\
- fputs("\n", stderr),\
- exit(1)
-#define die2(a,b,c) fprintf(stderr, "%s: ", progname),\
- fprintf(stderr, a, b, c),\
- fputs("\n", stderr),\
- exit(1)
-#endif /* ! _DIE_H_ */
diff --git a/contrib/global/lib/find.c b/contrib/global/lib/find.c
deleted file mode 100644
index 4682bee..0000000
--- a/contrib/global/lib/find.c
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
- * 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.
- *
- * find.c 1-May-98
- *
- */
-/*
- * USEFIND use find(1) to traverse directory tree.
- * Otherwise, use dirent(3) library.
- */
-#define USEFIND
-
-#include <sys/param.h>
-
-#include <assert.h>
-#include <ctype.h>
-#ifndef USEFIND
-#include <dirent.h>
-#ifndef BSD4_4
-#include <sys/stat.h>
-#endif
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <regex.h>
-
-#include "conf.h"
-#include "die.h"
-#include "find.h"
-#include "gparam.h"
-#include "locatestring.h"
-#include "makepath.h"
-#include "strbuf.h"
-
-/*
- * usage of findxxx()
- *
- * findopen(db);
- * while (path = findread(&length)) {
- * ...
- * }
- * findclose();
- *
- */
-static regex_t skip_area;
-static regex_t *skip = &skip_area;
-static int opened;
-
-static void trim __P((char *));
-
-/*
- * trim: remove blanks and '\'.
- */
-static void
-trim(s)
-char *s;
-{
- char *p;
-
- for (p = s; *s; s++) {
- if (isspace(*s))
- continue;
- if (*s == '\\' && *(s + 1))
- s++;
- *p++ = *s;
- }
- *p = 0;
-}
-#ifdef USEFIND
-/*----------------------------------------------------------------------*/
-/* find command version */
-/*----------------------------------------------------------------------*/
-static FILE *ip;
-
-void
-findopen()
-{
- char *findcom, *p, *q;
- STRBUF *sb;
- char *sufflist = NULL;
- char *skiplist = NULL;
-
- assert(opened == 0);
- opened = 1;
-
- sb = stropen();
- if (!getconfs("suffixes", sb))
- die("cannot get suffixes data.");
- sufflist = strdup(strvalue(sb));
- if (!sufflist)
- die("short of memory.");
- trim(sufflist);
- strstart(sb);
- if (getconfs("skip", sb)) {
- skiplist = strdup(strvalue(sb));
- if (!skiplist)
- die("short of memory.");
- trim(skiplist);
- }
-
- strstart(sb);
- strputs(sb, "find . \\( -type f -o -type l \\) \\(");
- for (p = sufflist; p; ) {
- char *suff = p;
- if ((p = locatestring(p, ",", MATCH_FIRST)) != NULL)
- *p++ = 0;
- strputs(sb, " -name '*.");
- strputs(sb, suff);
- strputs(sb, "'");
- if (p)
- strputs(sb, " -o");
- }
- strputs(sb, " \\) -print");
- findcom = strvalue(sb);
-
- if (skiplist) {
- char *reg;
- STRBUF *sbb = stropen();
- /*
- * construct regular expression.
- */
- strputc(sbb, '('); /* ) */
- for (p = skiplist; p; ) {
- char *skipf = p;
- if ((p = locatestring(p, ",", MATCH_FIRST)) != NULL)
- *p++ = 0;
- strputc(sbb, '/');
- for (q = skipf; *q; q++) {
- if (*q == '.')
- strputc(sbb, '\\');
- strputc(sbb, *q);
- }
- if (*(q - 1) != '/')
- strputc(sbb, '$');
- if (p)
- strputc(sbb, '|');
- }
- strputc(sbb, ')');
- reg = strvalue(sbb);
- /*
- * compile regular expression.
- */
- if (regcomp(skip, reg, REG_EXTENDED|REG_NEWLINE) != 0)
- die("cannot compile regular expression.");
- strclose(sbb);
- } else {
- skip = (regex_t *)0;
- }
- if (!(ip = popen(findcom, "r")))
- die("cannot execute find.");
- strclose(sb);
- if (sufflist)
- free(sufflist);
- if (skiplist)
- free(skiplist);
-}
-char *
-findread(length)
-int *length;
-{
- static char path[MAXPATHLEN+1];
- char *p;
-
- assert(opened == 1);
- while (fgets(path, MAXPATHLEN, ip)) {
- if (!skip || regexec(skip, path, 0, 0, 0) != 0) {
- /*
- * chop(path)
- */
- p = path + strlen(path) - 1;
- if (*p != '\n')
- die("output of find(1) is wrong (findread).");
- *p = 0;
- if (length)
- *length = p - path;
- return path;
- }
- }
- return NULL;
-}
-void
-findclose(void)
-{
- assert(opened == 1);
- pclose(ip);
- opened = 0;
-}
-#else /* USEFIND */
-/*----------------------------------------------------------------------*/
-/* dirent version findxxx() */
-/*----------------------------------------------------------------------*/
-#define STACKSIZE 50
-static char dir[MAXPATHLEN+1]; /* directory path */
-static struct {
- STRBUF *sb;
- char *dirp, *start, *end, *p;
-} stack[STACKSIZE], *topp, *curp; /* stack */
-
-static regex_t suff_area;
-static regex_t *suff = &suff_area;
-
-static int
-getdirs(dir, sb)
-char *dir;
-STRBUF *sb;
-{
- DIR *dirp;
- struct dirent *dp;
-#ifndef BSD4_4
- struct stat st;
-#endif
-
- if ((dirp = opendir(dir)) == NULL)
- return -1;
- while ((dp = readdir(dirp)) != NULL) {
-#ifdef BSD4_4
- if (dp->d_namlen == 1 && dp->d_name[0] == '.')
- continue;
- if (dp->d_namlen == 2 && dp->d_name[0] == '.' && dp->d_name[1] == '.')
- continue;
- if (dp->d_type == DT_DIR)
- strputc(sb, 'd');
- else if (dp->d_type == DT_REG)
- strputc(sb, 'f');
- else if (dp->d_type == DT_LNK)
- strputc(sb, 'l');
- else
- strputc(sb, ' ');
- strnputs(sb, dp->d_name, (int)dp->d_namlen);
-#else
- if (stat(path, &st) < 0) {
- fprintf(stderr, "cannot stat '%s'. (Ignored)\n", path);
- continue;
- }
- if (S_ISDIR(st.st_mode))
- strputc(sb, 'd');
- else if (S_ISREG(st.st_mode))
- strputc(sb, 'f');
- else if (S_ISLNK(st.st_mode))
- strputc(sb, 'l');
- else
- strputc(sb, ' ');
- strputs(sb, dp->d_name);
-#endif /* BSD4_4 */
- strputc(sb, '\0');
- }
- (void)closedir(dirp);
- return 0;
-}
-void
-findopen()
-{
- STRBUF *sb = stropen();
- char *sufflist = NULL;
- char *skiplist = NULL;
-
- assert(opened == 0);
- opened = 1;
-
- /*
- * setup stack.
- */
- curp = &stack[0];
- topp = curp + STACKSIZE;
- strcpy(dir, ".");
-
- curp->dirp = dir + strlen(dir);
- curp->sb = stropen();
- if (getdirs(dir, curp->sb) < 0)
- die("cannot open '.' directory.");
- curp->start = curp->p = strvalue(curp->sb);
- curp->end = curp->start + strbuflen(curp->sb);
-
- /*
- * preparing regular expression.
- */
- strstart(sb);
- if (!getconfs("suffixes", sb))
- die("cannot get suffixes data.");
- sufflist = strdup(strvalue(sb));
- if (!sufflist)
- die("short of memory.");
- trim(sufflist);
- strstart(sb);
- if (getconfs("skip", sb)) {
- skiplist = strdup(strvalue(sb));
- if (!skiplist)
- die("short of memory.");
- trim(skiplist);
- }
- {
- char *p;
-
- strstart(sb);
- strputc(sb, '('); /* ) */
- for (p = sufflist; p; ) {
- char *suffp = p;
- if ((p = locatestring(p, ",", MATCH_FIRST)) != NULL)
- *p++ = 0;
- strputs(sb, "\\.");
- strputs(sb, suffp);
- strputc(sb, '$');
- if (p)
- strputc(sb, '|');
- }
- strputc(sb, ')');
- /*
- * compile regular expression.
- */
- if (regcomp(suff, strvalue(sb), REG_EXTENDED) != 0)
- die("cannot compile regular expression.");
- }
- if (skiplist) {
- char *p, *q;
- /*
- * construct regular expression.
- */
- strstart(sb);
- strputc(sb, '('); /* ) */
- for (p = skiplist; p; ) {
- char *skipf = p;
- if ((p = locatestring(p, ",", MATCH_FIRST)) != NULL)
- *p++ = 0;
- strputc(sb, '/');
- for (q = skipf; *q; q++) {
- if (*q == '.')
- strputc(sb, '\\');
- strputc(sb, *q);
- }
- if (*(q - 1) != '/')
- strputc(sb, '$');
- if (p)
- strputc(sb, '|');
- }
- strputc(sb, ')');
- /*
- * compile regular expression.
- */
- if (regcomp(skip, strvalue(sb), REG_EXTENDED) != 0)
- die("cannot compile regular expression.");
- } else {
- skip = (regex_t *)0;
- }
- strclose(sb);
- if (sufflist)
- free(sufflist);
- if (skiplist)
- free(skiplist);
-}
-char *
-findread(length)
-int *length;
-{
- static char val[MAXPATHLEN+1];
-
- for (;;) {
- while (curp->p < curp->end) {
- char type = *(curp->p);
- char *unit = curp->p + 1;
-
- curp->p += strlen(curp->p) + 1;
- if (type == 'f' || type == 'l') {
- char *path = makepath(dir, unit);
- if (regexec(suff, path, 0, 0, 0) != 0)
- continue;
- if (skip && regexec(skip, path, 0, 0, 0) == 0)
- continue;
- strcpy(val, path);
- return val;
- }
- if (type == 'd') {
- STRBUF *sb = stropen();
- char *dirp = curp->dirp;
-
- strcat(dirp, "/");
- strcat(dirp, unit);
- if (getdirs(dir, sb) < 0) {
- fprintf(stderr, "cannot open directory '%s'. (Ignored)\n", dir);
- strclose(sb);
- *(curp->dirp) = 0;
- continue;
- }
- /*
- * Push stack.
- */
- if (++curp >= topp)
- die("directory stack over flow.");
- curp->dirp = dirp + strlen(dirp);
- curp->sb = sb;
- curp->start = curp->p = strvalue(sb);
- curp->end = curp->start + strbuflen(sb);
- }
- }
- strclose(curp->sb);
- curp->sb = NULL;
- if (curp == &stack[0])
- break;
- /*
- * Pop stack.
- */
- curp--;
- *(curp->dirp) = 0;
- }
- return NULL;
-}
-void
-findclose(void)
-{
- assert(opened == 1);
- for (curp = &stack[0]; curp < topp; curp++)
- if (curp->sb != NULL)
- strclose(curp->sb);
- else
- break;
- opened = 0;
-}
-#endif /* !USEFIND */
diff --git a/contrib/global/lib/find.h b/contrib/global/lib/find.h
deleted file mode 100644
index ae16f72..0000000
--- a/contrib/global/lib/find.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- *
- * find.h 16-Oct-97
- *
- */
-
-#ifndef _FIND_H_
-#define _FIND_H_
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-int issource __P((char *));
-void findopen __P((void));
-char *findread __P((int *));
-void findclose __P((void));
-
-#endif /* ! _FIND_H_ */
diff --git a/contrib/global/lib/getdbpath.c b/contrib/global/lib/getdbpath.c
deleted file mode 100644
index 4529988..0000000
--- a/contrib/global/lib/getdbpath.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.
- *
- * getdbpath.c 20-Oct-97
- *
- */
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "die.h"
-#include "getdbpath.h"
-#include "test.h"
-
-static const char *makeobjdirprefix; /* obj partition */
-static const char *makeobjdir; /* obj directory */
-
-/*
- * gtagsexist: test whether GTAGS's existence.
- *
- * i) candidate candidate root directory
- * o) dbpath directory which GTAGS exist
- * r) 0: not found, 1: found
- */
-int
-gtagsexist(candidate, dbpath)
-char *candidate;
-char *dbpath;
-{
- char path[MAXPATHLEN+1];
-
- sprintf(path, "%s/GTAGS", candidate);
- if (test("fr", path)) {
- strcpy(dbpath, candidate);
- return 1;
- }
- sprintf(path, "%s/%s/GTAGS", candidate, makeobjdir);
- if (test("fr", path)) {
- sprintf(dbpath, "%s/%s", candidate, makeobjdir);
- return 1;
- }
- sprintf(path, "%s%s/GTAGS", makeobjdirprefix, candidate);
- if (test("fr", path)) {
- sprintf(dbpath, "%s%s", makeobjdirprefix, candidate);
- return 1;
- }
- return 0;
-}
-/*
- * getdbpath: get dbpath directory
- *
- * o) cwd current directory
- * o) root root of source tree
- * o) dbpath directory which GTAGS exist
- *
- * root and dbpath assumed as
- * char cwd[MAXPATHLEN+1];
- * char root[MAXPATHLEN+1];
- * char dbpath[MAXPATHLEN+1];
- */
-void
-getdbpath(cwd, root, dbpath)
-char *cwd;
-char *root;
-char *dbpath;
-{
- struct stat sb;
- char *p;
-
- if (!getcwd(cwd, MAXPATHLEN))
- die("cannot get current directory.");
- /*
- * GLOBAL never think '/' is the root of source tree.
- */
- if (!strcmp(cwd, "/"))
- die("It's root directory! What are you doing?");
-
- if ((p = getenv("MAKEOBJDIRPREFIX")) != NULL)
- makeobjdirprefix = p;
- else
- makeobjdirprefix = "/usr/obj";
- if ((p = getenv("MAKEOBJDIR")) != NULL)
- makeobjdir = p;
- else
- makeobjdir = "obj";
-
- 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);
- if (realpath(p, root) == NULL)
- die1("cannot get real path of '%s'.", p);
- /*
- * GTAGSDBPATH is meaningful only when GTAGSROOT exist.
- */
- if ((p = getenv("GTAGSDBPATH")) != NULL) {
- if (*p != '/')
- die("GTAGSDBPATH must be an absolute path.");
- if (stat(p, &sb) || !S_ISDIR(sb.st_mode))
- die1("directory '%s' not found.", p);
- strcpy(dbpath, getenv("GTAGSDBPATH"));
- } else {
- if (!gtagsexist(root, dbpath))
- die("GTAGS not found.");
- }
- } else {
- /*
- * start from current directory to '/' directory.
- */
- strcpy(root, cwd);
- p = root + strlen(root);
- while (!gtagsexist(root, dbpath)) {
- while (*--p != '/')
- ;
- *p = 0;
- if (root == p) /* reached root directory */
- break;
- }
- if (*root == 0)
- die("GTAGS not found.");
- }
-}
diff --git a/contrib/global/lib/getdbpath.h b/contrib/global/lib/getdbpath.h
deleted file mode 100644
index 063d236..0000000
--- a/contrib/global/lib/getdbpath.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- *
- * getdbpath.h 16-Oct-97
- *
- */
-
-#ifndef _GETDBPATH_H_
-#define _GETDBPATH_H_
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-int gtagsexist __P((char *, char *));
-void getdbpath __P((char *, char *, char *));
-
-#endif /* ! _GETDBPATH_H_ */
diff --git a/contrib/global/lib/global.h b/contrib/global/lib/global.h
deleted file mode 100644
index 5ab2ca5..0000000
--- a/contrib/global/lib/global.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.
- *
- * global.h 2-May-98
- *
- */
-
-#ifndef _GLOBAL_H_
-#define _GLOBAL_H_
-
-#include "conf.h"
-#include "dbop.h"
-#include "defined.h"
-#include "die.h"
-#include "find.h"
-#include "getdbpath.h"
-#include "gparam.h"
-#include "gtagsop.h"
-#include "locatestring.h"
-#include "makepath.h"
-#include "mgets.h"
-#include "pathop.h"
-#include "strbuf.h"
-#include "strmake.h"
-#include "tab.h"
-#include "test.h"
-#include "token.h"
-#include "usable.h"
-
-#endif /* ! _GLOBAL_H_ */
diff --git a/contrib/global/lib/gparam.h b/contrib/global/lib/gparam.h
deleted file mode 100644
index 8a13c7e..0000000
--- a/contrib/global/lib/gparam.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- *
- * gparam.h 16-Jul-98
- *
- */
-#ifndef _GPARAM_H_
-#define _GPARAM_H_
-
-#define MAXFILLEN 1024 /* max length of filter */
-#define IDENTLEN 512 /* max length of ident */
-#define MAXENVLEN 1024 /* max length of env */
-#define MAXBUFLEN 1024 /* max length of buffer */
-#define MAXPROPLEN 1024 /* max length of property */
-#define MAXARGLEN 512 /* max length of argment */
-
-#endif /* ! _GPARAM_H_ */
diff --git a/contrib/global/lib/gtagsop.c b/contrib/global/lib/gtagsop.c
deleted file mode 100644
index 4163569..0000000
--- a/contrib/global/lib/gtagsop.c
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * 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.
- *
- * gtagsop.c 12-Nov-98
- *
- */
-#include <assert.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "dbop.h"
-#include "die.h"
-#include "gtagsop.h"
-#include "locatestring.h"
-#include "makepath.h"
-#include "mgets.h"
-#include "pathop.h"
-#include "strbuf.h"
-#include "strmake.h"
-#include "tab.h"
-
-static char *genrecord __P((GTOP *));
-static int belongto __P((GTOP *, char *, char *));
-
-static int support_version = 2; /* acceptable format version */
-static const char *tagslist[] = {"GTAGS", "GRTAGS", "GSYMS"};
-/*
- * dbname: return db name
- *
- * i) db 0: GTAGS, 1: GRTAGS, 2: GSYMS
- * r) dbname
- */
-const char *
-dbname(db)
-int db;
-{
- assert(db >= 0 && db < GTAGLIM);
- return tagslist[db];
-}
-/*
- * makecommand: make command line to make global tag file
- *
- * i) comline skelton command line
- * i) path path name
- * o) sb command line
- */
-void
-makecommand(comline, path, sb)
-char *comline;
-char *path;
-STRBUF *sb;
-{
- char *p;
-
- if (!(p = strmake(comline, "%")))
- die1("'%%s' is needed in tag command line. (%s)\n", comline);
- strputs(sb, p);
- strputs(sb, path);
- if (!(p = locatestring(comline, "%s", MATCH_FIRST)))
- die1("'%%s' is needed in tag command line. (%s)\n", comline);
- strputs(sb, p+2);
-}
-/*
- * formatcheck: check format of tag command's output
- *
- * i) line input
- * i) flags flag
- * r) 0: normal
- * -1: tag name
- * -2: line number
- * -3: path
- *
- * [example of right format]
- *
- * $1 $2 $3 $4
- * ----------------------------------------------------
- * main 83 ./ctags.c main(argc, argv)
- */
-int
-formatcheck(line, flags)
-char *line;
-int flags;
-{
- char *p, *q;
- /*
- * $1 = tagname: allowed any char except sepalator.
- */
- p = q = line;
- while (*p && !isspace(*p))
- p++;
- while (*p && isspace(*p))
- p++;
- if (p == q)
- return -1;
- /*
- * $2 = line number: must be digit.
- */
- q = p;
- while (*p && !isspace(*p))
- if (!isdigit(*p))
- return -2;
- else
- p++;
- if (p == q)
- return -2;
- while (*p && isspace(*p))
- p++;
- /*
- * $3 = path:
- * standard format: must start with './'.
- * compact format: must be digit.
- */
- if (flags & GTAGS_PATHINDEX) {
- while (*p && !isspace(*p))
- if (!isdigit(*p))
- return -3;
- else
- p++;
- } else {
- if (!(*p == '.' && *(p + 1) == '/' && *(p + 2)))
- return -3;
- }
- return 0;
-}
-/*
- * gtagsopen: open global tag.
- *
- * i) dbpath dbpath directory
- * i) root root directory (needed when compact format)
- * i) db GTAGS, GRTAGS, GSYMS
- * i) mode GTAGS_READ: read only
- * GTAGS_CREATE: create tag
- * GTAGS_MODIFY: modify tag
- * i) flags GTAGS_COMPACT
- * GTAGS_PATHINDEX
- * r) GTOP structure
- *
- * when error occurred, gtagopen doesn't return.
- * GTAGS_PATHINDEX needs GTAGS_COMPACT.
- */
-GTOP *
-gtagsopen(dbpath, root, db, mode, flags)
-char *dbpath;
-char *root;
-int db;
-int mode;
-int flags;
-{
- GTOP *gtop;
- int dbmode = 0;
-
- if ((gtop = (GTOP *)calloc(sizeof(GTOP), 1)) == NULL)
- die("short of memory.");
- gtop->db = db;
- gtop->mode = mode;
- switch (gtop->mode) {
- case GTAGS_READ:
- dbmode = 0;
- break;
- case GTAGS_CREATE:
- dbmode = 1;
- break;
- case GTAGS_MODIFY:
- dbmode = 2;
- break;
- default:
- assert(0);
- }
-
- /*
- * allow duplicate records.
- */
- gtop->dbop = dbop_open(makepath(dbpath, dbname(db)), dbmode, 0644, DBOP_DUP);
- if (gtop->dbop == NULL) {
- if (dbmode == 1)
- die1("cannot make %s.", dbname(db));
- die1("%s not found.", dbname(db));
- }
- /*
- * decide format version.
- */
- gtop->format_version = 1;
- gtop->format = GTAGS_STANDARD;
- /*
- * This is a special case. GSYMS had compact format even if
- * format version 1.
- */
- if (db == GSYMS)
- gtop->format |= GTAGS_COMPACT;
- if (gtop->mode == GTAGS_CREATE) {
- if (flags & GTAGS_COMPACT) {
- char buf[80];
-
- gtop->format_version = 2;
- sprintf(buf, "%s %d", VERSIONKEY, gtop->format_version);
- dbop_put(gtop->dbop, VERSIONKEY, buf);
- gtop->format |= GTAGS_COMPACT;
- dbop_put(gtop->dbop, COMPACTKEY, COMPACTKEY);
- if (flags & GTAGS_PATHINDEX) {
- gtop->format |= GTAGS_PATHINDEX;
- dbop_put(gtop->dbop, PATHINDEXKEY, PATHINDEXKEY);
- }
- }
- } 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.
- */
- char *p;
-
- if ((p = dbop_get(gtop->dbop, VERSIONKEY)) != NULL) {
- for (p += strlen(VERSIONKEY); *p && isspace(*p); p++)
- ;
- gtop->format_version = atoi(p);
- }
- if (gtop->format_version > support_version)
- die("GTAGS seems new format. Please install the latest GLOBAL.");
- if (gtop->format_version > 1) {
- if (dbop_get(gtop->dbop, COMPACTKEY) != NULL)
- gtop->format |= GTAGS_COMPACT;
- if (dbop_get(gtop->dbop, PATHINDEXKEY) != NULL)
- gtop->format |= GTAGS_PATHINDEX;
- }
- }
- if (gtop->format & GTAGS_PATHINDEX || gtop->mode != GTAGS_READ) {
- if (pathopen(dbpath, dbmode) < 0) {
- if (dbmode == 1)
- die("cannot create GPATH.");
- else
- die("GPATH not found.");
- }
- }
- /*
- * Stuff for compact format.
- */
- if (gtop->format & GTAGS_COMPACT) {
- assert(root != NULL);
- strcpy(gtop->root, root);
- if (gtop->mode != GTAGS_READ)
- gtop->sb = stropen();
- }
- return gtop;
-}
-/*
- * gtagsput: put tag record with packing.
- *
- * i) gtop descripter of GTOP
- * i) tag tag name
- * i) record ctags -x image
- */
-void
-gtagsput(gtop, tag, record)
-GTOP *gtop;
-char *tag;
-char *record;
-{
- char *p, *q;
- char lno[10];
- char path[MAXPATHLEN+1];
-
- if (gtop->format == GTAGS_STANDARD) {
- entab(record);
- dbop_put(gtop->dbop, tag, record);
- return;
- }
- /*
- * gtop->format & GTAGS_COMPACT
- */
- p = record; /* ignore $1 */
- while (*p && !isspace(*p))
- p++;
- while (*p && isspace(*p))
- p++;
- q = lno; /* lno = $2 */
- while (*p && !isspace(*p))
- *q++ = *p++;
- *q = 0;
- while (*p && isspace(*p))
- p++;
- q = path; /* path = $3 */
- while (*p && !isspace(*p))
- *q++ = *p++;
- *q = 0;
- /*
- * First time, it occurs, because 'prev_tag' and 'prev_path' are NULL.
- */
- if (strcmp(gtop->prev_tag, tag) || strcmp(gtop->prev_path, path)) {
- if (gtop->prev_tag[0])
- dbop_put(gtop->dbop, gtop->prev_tag, strvalue(gtop->sb));
- strcpy(gtop->prev_tag, tag);
- strcpy(gtop->prev_path, path);
- /*
- * Start creating new record.
- */
- strstart(gtop->sb);
- strputs(gtop->sb, strmake(record, " \t"));
- strputc(gtop->sb, ' ');
- strputs(gtop->sb, path);
- strputc(gtop->sb, ' ');
- strputs(gtop->sb, lno);
- } else {
- strputc(gtop->sb, ',');
- strputs(gtop->sb, lno);
- }
-}
-/*
- * gtagsadd: add tags belonging to the path into tag file.
- *
- * i) gtop descripter of GTOP
- * i) comline tag command line
- * i) path source file
- * i) flags GTAGS_UNIQUE, GTAGS_EXTRACTMETHOD
- */
-void
-gtagsadd(gtop, comline, path, flags)
-GTOP *gtop;
-char *comline;
-char *path;
-int flags;
-{
- char *tagline;
- FILE *ip;
- STRBUF *sb = stropen();
-
- /*
- * add path index if not yet.
- */
- pathput(path);
- /*
- * make command line.
- */
- makecommand(comline, path, sb);
- /*
- * Compact format.
- */
- if (gtop->format & GTAGS_PATHINDEX) {
- char *pno;
-
- if ((pno = pathget(path)) == NULL)
- die1("GPATH is corrupted.('%s' not found)", path);
- strputs(sb, "| sed 's!");
- strputs(sb, path);
- strputs(sb, "!");
- strputs(sb, pno);
- strputs(sb, "!'");
- }
- if (gtop->format & GTAGS_COMPACT)
- strputs(sb, "| sort +0 -1 +1n -2");
- if (flags & GTAGS_UNIQUE)
- strputs(sb, "| uniq");
- if (!(ip = popen(strvalue(sb), "r")))
- die1("cannot execute '%s'.", strvalue(sb));
- while ((tagline = mgets(ip, NULL, MGETS_TAILCUT)) != NULL) {
- char *tag, *p;
-
- if (formatcheck(tagline, gtop->format) < 0)
- die1("illegal parser output.\n'%s'", tagline);
- tag = strmake(tagline, " \t"); /* tag = $1 */
- /*
- * extract method when class method definition.
- *
- * Ex: Class::method(...)
- *
- * key = 'method'
- * data = 'Class::method 103 ./class.cpp ...'
- */
- if (flags & GTAGS_EXTRACTMETHOD) {
- if ((p = locatestring(tag, ".", MATCH_LAST)) != NULL)
- tag = p + 1;
- else if ((p = locatestring(tag, "::", MATCH_LAST)) != NULL)
- tag = p + 2;
- }
- gtagsput(gtop, tag, tagline);
- }
- pclose(ip);
- strclose(sb);
-}
-/*
- * belongto: wheather or not record belongs to the path.
- *
- * i) gtop GTOP structure
- * i) path path name (in standard format)
- * path number (in compact format)
- * i) p record
- * r) 1: belong, 0: not belong
- */
-static int
-belongto(gtop, path, p)
-GTOP *gtop;
-char *path;
-char *p;
-{
- char *q;
- int length = strlen(path);
-
- /*
- * seek to path part.
- */
- if (gtop->format & GTAGS_PATHINDEX) {
- for (q = p; *q && !isspace(*q); q++)
- ;
- if (*q == 0)
- die1("illegal tag format. '%s'", p);
- for (; *q && isspace(*q); q++)
- ;
- } else
- q = locatestring(p, "./", MATCH_FIRST);
- if (*q == 0)
- die1("illegal tag format. '%s'", p);
- if (!strncmp(q, path, length) && isspace(*(q + length)))
- return 1;
- return 0;
-}
-/*
- * gtagsdelete: delete records belong to path.
- *
- * i) gtop GTOP structure
- * i) path path name
- */
-void
-gtagsdelete(gtop, path)
-GTOP *gtop;
-char *path;
-{
- char *p, *key;
- int length;
-
- /*
- * In compact format, a path is saved as a file number.
- */
- key = path;
- if (gtop->format & GTAGS_PATHINDEX)
- if ((key = pathget(path)) == NULL)
- die1("GPATH is corrupted.('%s' not found)", path);
- length = strlen(key);
- /*
- * read sequentially, because db(1) has just one index.
- */
- for (p = dbop_first(gtop->dbop, NULL, 0); p; p = dbop_next(gtop->dbop))
- if (belongto(gtop, key, p))
- dbop_del(gtop->dbop, NULL);
- /*
- * don't delete from path index.
- */
-}
-/*
- * gtagsfirst: return first record
- *
- * i) gtop GTOP structure
- * i) tag tag name
- * i) flags GTOP_PREFIX prefix read
- * GTOP_KEY read key only
- * r) record
- */
-char *
-gtagsfirst(gtop, tag, flags)
-GTOP *gtop;
-char *tag;
-int flags;
-{
- int dbflags = 0;
- char *line;
-
- gtop->flags = flags;
- if (flags & GTOP_PREFIX && tag != NULL)
- dbflags |= DBOP_PREFIX;
- if (flags & GTOP_KEY)
- dbflags |= DBOP_KEY;
- if ((line = dbop_first(gtop->dbop, tag, dbflags)) == NULL)
- return NULL;
- if (gtop->format == GTAGS_STANDARD || gtop->flags & GTOP_KEY)
- return line;
- /*
- * Compact format.
- */
- gtop->line = line; /* gtop->line = $0 */
- gtop->opened = 0;
- return genrecord(gtop);
-}
-/*
- * gtagsnext: return followed record
- *
- * i) gtop GTOP structure
- * r) record
- * NULL end of tag
- */
-char *
-gtagsnext(gtop)
-GTOP *gtop;
-{
- char *line;
-
- /*
- * If it is standard format or only key.
- * Just return it.
- */
- if (gtop->format == GTAGS_STANDARD || gtop->flags & GTOP_KEY)
- return dbop_next(gtop->dbop);
- /*
- * gtop->format & GTAGS_COMPACT
- */
- if ((line = genrecord(gtop)) != NULL)
- return line;
- /*
- * read next record.
- */
- if ((line = dbop_next(gtop->dbop)) == NULL)
- return line;
- gtop->line = line; /* gtop->line = $0 */
- gtop->opened = 0;
- return genrecord(gtop);
-}
-/*
- * gtagsclose: close tag file
- *
- * i) gtop GTOP structure
- */
-void
-gtagsclose(gtop)
-GTOP *gtop;
-{
- if (gtop->format & GTAGS_PATHINDEX || gtop->mode != GTAGS_READ)
- pathclose();
- if (gtop->sb && gtop->prev_tag[0])
- dbop_put(gtop->dbop, gtop->prev_tag, strvalue(gtop->sb));
- if (gtop->sb)
- strclose(gtop->sb);
- dbop_close(gtop->dbop);
- free(gtop);
-}
-static char *
-genrecord(gtop)
-GTOP *gtop;
-{
- static char output[MAXBUFLEN+1];
- char path[MAXPATHLEN+1];
- static char buf[1];
- char *buffer = buf;
- char *lnop;
- int tagline;
-
- if (!gtop->opened) {
- char *p, *q;
-
- gtop->opened = 1;
- p = gtop->line;
- q = gtop->tag; /* gtop->tag = $1 */
- while (!isspace(*p))
- *q++ = *p++;
- *q = 0;
- for (; isspace(*p) ; p++)
- ;
- if (gtop->format & GTAGS_PATHINDEX) { /* gtop->path = $2 */
- char *name;
-
- q = path;
- while (!isspace(*p))
- *q++ = *p++;
- *q = 0;
- if ((name = pathget(path)) == NULL)
- die1("GPATH is corrupted.('%s' not found)", path);
- strcpy(gtop->path, name);
- } else {
- q = gtop->path;
- while (!isspace(*p))
- *q++ = *p++;
- *q = 0;
- }
- for (; isspace(*p) ; p++)
- ;
- gtop->lnop = p; /* gtop->lnop = $3 */
-
- if (gtop->root)
- sprintf(path, "%s/%s", gtop->root, &gtop->path[2]);
- else
- sprintf(path, "%s", &gtop->path[2]);
- if ((gtop->fp = fopen(path, "r")) != NULL) {
- buffer = mgets(gtop->fp, NULL, MGETS_TAILCUT);
- gtop->lno = 1;
- }
- }
-
- lnop = gtop->lnop;
- if (*lnop >= '0' && *lnop <= '9') {
- /* get line number */
- for (tagline = 0; *lnop >= '0' && *lnop <= '9'; lnop++)
- tagline = tagline * 10 + *lnop - '0';
- if (*lnop == ',')
- lnop++;
- gtop->lnop = lnop;
- if (gtop->fp) {
- if (gtop->lno == tagline)
- return output;
- while (gtop->lno < tagline) {
- if (!(buffer = mgets(gtop->fp, NULL, MGETS_TAILCUT)))
- die1("unexpected end of file. '%s'", path);
- gtop->lno++;
- }
- }
- if (strlen(gtop->tag) >= 16 && tagline >= 1000)
- sprintf(output, "%-16s %4d %-16s %s",
- gtop->tag, tagline, gtop->path, buffer);
- else
- sprintf(output, "%-16s%4d %-16s %s",
- gtop->tag, tagline, gtop->path, buffer);
- return output;
- }
- if (gtop->opened && gtop->fp != NULL) {
- gtop->opened = 0;
- fclose(gtop->fp);
- }
- return NULL;
-}
diff --git a/contrib/global/lib/gtagsop.h b/contrib/global/lib/gtagsop.h
deleted file mode 100644
index c6e75d7..0000000
--- a/contrib/global/lib/gtagsop.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.
- *
- * gtagsop.h 23-Dec-97
- *
- */
-
-#ifndef _GTOP_H_
-#define _GTOP_H_
-#include <stdio.h>
-#include "dbop.h"
-#include "gparam.h"
-#include "strbuf.h"
-
-#define VERSIONKEY " __.VERSION"
-#define COMPACTKEY " __.COMPACT"
-#define PATHINDEXKEY " __.PATHINDEX"
-
-#define GTAGS 0
-#define GRTAGS 1
-#define GSYMS 2
-#define GTAGLIM 3
-
-#define GTAGS_READ 0
-#define GTAGS_CREATE 1
-#define GTAGS_MODIFY 2
-
-/* gtagsopen() */
-#define GTAGS_STANDARD 0 /* standard format */
-#define GTAGS_COMPACT 1 /* compact format */
-#define GTAGS_PATHINDEX 2 /* use path index */
-/* gtagsadd() */
-#define GTAGS_UNIQUE 1 /* compress duplicate lines */
-#define GTAGS_EXTRACTMETHOD 2 /* extract method from class definition */
-/* gtagsfirst() */
-#define GTOP_KEY 1 /* read key part */
-#define GTOP_PREFIX 2 /* prefixed read */
-
-typedef struct {
- DBOP *dbop; /* descripter of DBOP */
- int format_version; /* format version */
- int format; /* GTAGS_STANDARD, GTAGS_COMPACT */
- int mode; /* mode */
- int db; /* 0:GTAGS, 1:GRTAGS, 2:GSYMS */
- int flags; /* flags */
- char root[MAXPATHLEN+1]; /* root directory of source tree */
- /*
- * Stuff for compact format
- */
- int opened; /* wether or not file opened */
- char *line; /* current record */
- char tag[IDENTLEN+1]; /* current tag */
- char prev_tag[IDENTLEN+1]; /* previous tag */
- char path[MAXPATHLEN+1]; /* current path */
- char prev_path[MAXPATHLEN+1];/* previous path */
- STRBUF *sb; /* string buffer */
- FILE *fp; /* descriptor of 'path' */
- char *lnop; /* current line number */
- int lno; /* integer value of 'lnop' */
-} GTOP;
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-const char *dbname __P((int));
-void makecommand __P((char *, char *, STRBUF *));
-int formatcheck __P((char *, int));
-GTOP *gtagsopen __P((char *, char *, int, int, int));
-void gtagsput __P((GTOP *, char *, char *));
-char *gtagsget __P((GTOP *, char *));
-void gtagsadd __P((GTOP *, char *, char *, int));
-void gtagsdelete __P((GTOP *, char *));
-char *gtagsfirst __P((GTOP *, char *, int));
-char *gtagsnext __P((GTOP *));
-void gtagsclose __P((GTOP *));
-
-#endif /* ! _GTOP_H_ */
diff --git a/contrib/global/lib/locatestring.c b/contrib/global/lib/locatestring.c
deleted file mode 100644
index 7628599..0000000
--- a/contrib/global/lib/locatestring.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- *
- * locatestring.c 25-Jul-98
- *
- */
-#include <string.h>
-
-#include "locatestring.h"
-
-/*
- * locatestring: locate pattern from string
- *
- * i) string string
- * i) pattern pattern
- * i) flag MATCH_FIRST: match first
- * MATCH_AT_FIRST: match only at first column
- * MATCH_LAST: match last
- * MATCH_AT_LAST: match only at last column
- * r) pointer or NULL
- *
- * This function is made to avoid compatibility problems.
- */
-char *
-locatestring(string, pattern, flag)
-const char *string;
-const char *pattern;
-int flag;
-{
- int c = *pattern;
- int slen, plen;
- const char *p = NULL;
-
- plen = strlen(pattern);
- if (flag == MATCH_AT_LAST && (slen = strlen(string)) > plen)
- string += (slen - plen);
- for (; *string; string++) {
- if (*string == c)
- if (!strncmp(string, pattern, plen)) {
- p = string;
- if (flag == MATCH_FIRST)
- break;
- }
- if (flag == MATCH_AT_FIRST || flag == MATCH_AT_LAST)
- break;
- }
- return (char *)p;
-}
diff --git a/contrib/global/lib/locatestring.h b/contrib/global/lib/locatestring.h
deleted file mode 100644
index 2b881c6..0000000
--- a/contrib/global/lib/locatestring.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- *
- * locatestring.h 25-Jul-98
- *
- */
-
-#ifndef _LOCATESTRING_H_
-#define _LOCATESTRING_H_
-
-#define MATCH_FIRST 0
-#define MATCH_AT_FIRST 1
-#define MATCH_LAST 2
-#define MATCH_AT_LAST 3
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-char *locatestring __P((const char *, const char *, int));
-
-#endif /* ! _LOCATESTRING_H_ */
diff --git a/contrib/global/lib/makepath.c b/contrib/global/lib/makepath.c
deleted file mode 100644
index 26de065..0000000
--- a/contrib/global/lib/makepath.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.
- *
- * makepath.c 15-May-98
- *
- */
-#include <string.h>
-#include <sys/param.h>
-#include "die.h"
-#include "makepath.h"
-#include "strbuf.h"
-
-static STRBUF *sb;
-/*
- * makepath: make path from directory and file.
- *
- * i) dir directory
- * i) file file
- * r) path
- */
-char *
-makepath(dir, file)
-const char *dir;
-const char *file;
-{
- int length;
-
- if (sb == NULL)
- sb = stropen();
- strstart(sb);
- if ((length = strlen(dir)) > MAXPATHLEN)
- die1("path name too long. '%s'\n", dir);
- strputs(sb, dir);
- strunputc(sb, '/');
- strputc(sb, '/');
- strputs(sb, file);
- if ((length = strlen(strvalue(sb))) > MAXPATHLEN)
- die1("path name too long. '%s'\n", dir);
- return strvalue(sb);
-}
diff --git a/contrib/global/lib/makepath.h b/contrib/global/lib/makepath.h
deleted file mode 100644
index 74b1c16..0000000
--- a/contrib/global/lib/makepath.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- *
- * makepath.h 16-Oct-97
- *
- */
-
-#ifndef _MAKEPATH_H_
-#define _MAKEPATH_H_
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-char *makepath __P((const char *, const char *));
-
-#endif /* ! _MAKEPATH_H_ */
diff --git a/contrib/global/lib/mgets.c b/contrib/global/lib/mgets.c
deleted file mode 100644
index 6b9bb73..0000000
--- a/contrib/global/lib/mgets.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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.
- *
- * mgets.c 29-Aug-98
- *
- */
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "die.h"
-#include "mgets.h"
-
-#define EXPANDSIZE 127
-#define MINSIZE 16
-
-static int mbufsize = EXPANDSIZE;
-static char *mbuf;
-
-/*
- * mgets: read whole record into allocated buffer
- *
- * i) ip input stream
- * o) length record length
- * i) flags flags
- * MGETS_CONT \\ + \n -> ''
- * MGETS_SKIPCOM skip line which start with '#'.
- * MGETS_TAILCUT remove following blanks
- * r) record buffer (NULL at end of file)
- *
- * Returned buffer has whole record.
- * The buffer end with '\0' and doesn't include '\r' and '\n'.
- */
-char *
-mgets(ip, length, flags)
-FILE *ip;
-int *length;
-int flags;
-{
- char *p;
-
- /*
- * allocate initial buffer.
- */
- if (!mbuf)
- if (!(mbuf = (char *)malloc(mbufsize + 1)))
- die("short of memory.");
- /*
- * read whole record.
- */
- if (!fgets(mbuf, mbufsize, ip))
- return NULL;
- if (flags & MGETS_SKIPCOM)
- while (*mbuf == '#')
- if (!fgets(mbuf, mbufsize, ip))
- return NULL;
- p = mbuf + strlen(mbuf);
-
- for (;;) {
- /*
- * get a line.
- */
- while (*(p - 1) != '\n') {
- /*
- * expand buffer and read additionally.
- */
- int count = p - mbuf;
-
- if (mbufsize - count < MINSIZE) {
- mbufsize += EXPANDSIZE;
- if (!(mbuf = (char *)realloc(mbuf, mbufsize + 1)))
- die("short of memory.");
- p = mbuf + count;
- }
- if (!fgets(p, mbufsize - count, ip)) {
- *p++ = '\n';
- break;
- }
- p += strlen(p);
- }
- /*
- * chop(mbuf)
- */
- *(--p) = 0;
- if (*(p - 1) == '\r')
- *(--p) = 0;
- /*
- * continue?
- */
- if ((flags & MGETS_CONT) && *(p - 1) == '\\')
- *(--p) = 0;
- else
- break;
- }
-/*
- if (flags & MGETS_SKIPCOM)
- for (p = mbuf; *p; p++)
- if (*p == '#') {
- *p = 0;
- break;
- }
-*/
- if (flags & MGETS_TAILCUT)
- while (isspace(*(--p)))
- *p = 0;
- if (length)
- *length = p - mbuf;
- return mbuf;
-}
diff --git a/contrib/global/lib/mgets.h b/contrib/global/lib/mgets.h
deleted file mode 100644
index 75b5e83..0000000
--- a/contrib/global/lib/mgets.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1996, 1997, 1998 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.
- *
- * mgets.h 20-Oct-97
- *
- */
-#ifndef _MGETS_H_
-#define _MGETS_H_
-
-#include <stdio.h>
-#define MGETS_CONT 1
-#define MGETS_SKIPCOM 2
-#define MGETS_TAILCUT 4
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-char *mgets __P((FILE *, int *, int));
-
-#endif /* ! _MGETS_H_ */
diff --git a/contrib/global/lib/pathop.c b/contrib/global/lib/pathop.c
deleted file mode 100644
index 2eb9e69..0000000
--- a/contrib/global/lib/pathop.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.
- *
- * pathop.c 12-Nov-98
- *
- */
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "die.h"
-#include "dbop.h"
-#include "makepath.h"
-#include "pathop.h"
-
-static DBOP *dbop;
-static const char *gpath = "GPATH";
-static int _nextkey;
-static int _mode;
-static int opened;
-static int created;
-
-/*
- * pathopen: open path dictionary tag.
- *
- * i) mode 0: read only
- * 1: create
- * 2: modify
- * r) 0: normal
- * -1: error
- */
-int
-pathopen(dbpath, mode)
-char *dbpath;
-int mode;
-{
- char *p;
-
- assert(opened == 0);
- /*
- * We create GPATH just first time.
- */
- _mode = mode;
- if (mode == 1 && created)
- mode = 0;
- dbop = dbop_open(makepath(dbpath, gpath), mode, 0644, 0);
- if (dbop == NULL)
- return -1;
- if (mode == 1)
- _nextkey = 0;
- else {
- if (!(p = dbop_get(dbop, NEXTKEY)))
- die("nextkey not found in GPATH.");
- _nextkey = atoi(p);
- }
- opened = 1;
- return 0;
-}
-void
-pathput(path)
-char *path;
-{
- char buf[10];
-
- assert(opened == 1);
- if (_mode == 1 && created)
- return;
- if (dbop_get(dbop, path) != NULL)
- return;
- sprintf(buf, "%d", _nextkey++);
- dbop_put(dbop, path, buf);
- dbop_put(dbop, buf, path);
-}
-char *
-pathget(key)
-char *key;
-{
- assert(opened == 1);
- return dbop_get(dbop, key);
-}
-char *
-pathiget(n)
-int n;
-{
- char key[80];
- assert(opened == 1);
- sprintf(key, "%d", n);
- return dbop_get(dbop, key);
-}
-void
-pathdel(key)
-char *key;
-{
- char *d;
-
- assert(opened == 1);
- assert(_mode == 2);
- assert(key[0] == '.' && key[1] == '/');
- d = dbop_get(dbop, key);
- if (d == NULL)
- return;
- dbop_del(dbop, d);
- dbop_del(dbop, key);
-}
-int
-nextkey(void)
-{
- assert(_mode != 1);
- return _nextkey;
-}
-void
-pathclose(void)
-{
- char buf[10];
-
- assert(opened == 1);
- opened = 0;
- if (_mode == 1 && created) {
- dbop_close(dbop);
- return;
- }
- sprintf(buf, "%d", _nextkey);
- if (_mode == 1 || _mode == 2)
- dbop_put(dbop, NEXTKEY, buf);
- dbop_close(dbop);
- if (_mode == 1)
- created = 1;
-}
diff --git a/contrib/global/lib/pathop.h b/contrib/global/lib/pathop.h
deleted file mode 100644
index 5bfef5d..0000000
--- a/contrib/global/lib/pathop.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.
- *
- * pathop.h 14-May-98
- *
- */
-
-#ifndef _PATHOP_H_
-#define _PATHOP_H_
-#include <stdio.h>
-#include "dbop.h"
-#include "gparam.h"
-
-#define NEXTKEY " __.NEXTKEY"
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-int pathopen __P((char *, int));
-char *pathget __P((char *));
-char *pathiget __P((int));
-void pathput __P((char *));
-void pathdel __P((char *));
-void pathclose __P((void));
-int nextkey __P((void));
-
-#endif /* ! _PATHOP_H_ */
diff --git a/contrib/global/lib/strbuf.c b/contrib/global/lib/strbuf.c
deleted file mode 100644
index 3df14c9..0000000
--- a/contrib/global/lib/strbuf.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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.
- *
- * strbuf.c 5-Jul-98
- *
- */
-#include <stdlib.h>
-#include <string.h>
-
-#include "die.h"
-#include "strbuf.h"
-
-/*
- * usage: string buffer
- *
- * sb = stropen();
- * for (s = string; *s; s++)
- * strputc(sb, *s);
- * s = strvalue(sb);
- * strstart(sb);
- * strputs(sb, "hello");
- * s = strvalue(sb);
- * strclose(sb);
- */
-/*
- * expandbuf: expand buffer so that afford to the length data at least.
- *
- * i) sb STRBUF structure
- * i) length required room
- */
-void
-expandbuf(sb, length)
-STRBUF *sb;
-int length;
-{
- int count = sb->curp - sb->sbuf;
-
- sb->sbufsize += (length > EXPANDSIZE) ? length : EXPANDSIZE;
- if (!(sb->sbuf = (char *)realloc(sb->sbuf, sb->sbufsize + 1)))
- die("short of memory.");
- sb->curp = sb->sbuf + count;
- sb->endp = sb->sbuf + sb->sbufsize;
-}
-/*
- * stropen: open string buffer.
- *
- * r) sb STRBUF structure
- */
-STRBUF *
-stropen(void)
-{
- STRBUF *sb = (STRBUF *)calloc(sizeof(STRBUF), 1);
-
- if (sb == NULL)
- die("short of memory.");
- sb->sbufsize = INITIALSIZE;
- if (!(sb->sbuf = (char *)malloc(sb->sbufsize + 1)))
- die("short of memory.");
- sb->curp = sb->sbuf;
- sb->endp = sb->sbuf + sb->sbufsize;
-
- return sb;
-}
-/*
- * strstart: reset string buffer for new string.
- *
- * i) sb STRBUF structure
- */
-void
-strstart(sb)
-STRBUF *sb;
-{
- sb->curp = sb->sbuf;
-}
-/*
- * strbuflen: return the length of string buffer.
- *
- * i) sb STRBUF structure
- */
-int
-strbuflen(sb)
-STRBUF *sb;
-{
- return sb->curp - sb->sbuf;
-}
-/*
- * strvalue: return the content of string buffer.
- *
- * i) sb STRBUF structure
- * r) string
- */
-char *
-strvalue(sb)
-STRBUF *sb;
-{
- *sb->curp = 0;
- return sb->sbuf;
-}
-/*
- * strclose: close string buffer.
- *
- * i) sb STRBUF structure
- */
-void
-strclose(sb)
-STRBUF *sb;
-{
- (void)free(sb->sbuf);
- (void)free(sb);
-}
diff --git a/contrib/global/lib/strbuf.h b/contrib/global/lib/strbuf.h
deleted file mode 100644
index e62c7ab..0000000
--- a/contrib/global/lib/strbuf.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.
- *
- * strbuf.h 5-Jul-98
- *
- */
-
-#ifndef _STRBUF_H
-#define _STRBUF_H
-
-#include <string.h>
-#define INITIALSIZE 80
-#define EXPANDSIZE 80
-
-typedef struct {
- char *sbuf;
- char *endp;
- char *curp;
- int sbufsize;
-} STRBUF;
-
-#define strputc(sb,c) do {\
- if (sb->curp + 1 > sb->endp)\
- expandbuf(sb, 0);\
- *sb->curp++ = c;\
-} while (0)
-#define strunputc(sb,c) do {\
- if (sb->curp > sb->sbuf && *(sb->curp - 1) == c)\
- sb->curp--;\
-} while (0)
-#define strnputs(sb, s, len) do {\
- unsigned int _length = len;\
- if (sb->curp + _length > sb->endp)\
- expandbuf(sb, _length);\
- strncpy(sb->curp, s, _length);\
- sb->curp += _length;\
-} while (0)
-#define strputs(sb, s) strnputs(sb, s, strlen(s))
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-void expandbuf __P((STRBUF *, int));
-STRBUF *stropen __P((void));
-void strstart __P((STRBUF *));
-int strbuflen __P((STRBUF *));
-char *strvalue __P((STRBUF *));
-void strclose __P((STRBUF *));
-
-#endif /* ! _STRBUF_H */
diff --git a/contrib/global/lib/strmake.c b/contrib/global/lib/strmake.c
deleted file mode 100644
index da5dea4..0000000
--- a/contrib/global/lib/strmake.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.
- *
- * strmake.c 15-May-98
- *
- */
-#include <stdlib.h>
-
-#include "strbuf.h"
-#include "strmake.h"
-
-static STRBUF *sb;
-
-char *
-strmake(p, lim)
-const char *p;
-const char *lim;
-{
- const char *c;
-
- if (sb == NULL)
- sb = stropen();
- strstart(sb);
- for (; *p; p++) {
- for (c = lim; *c; c++)
- if (*p == *c)
- goto end;
- strputc(sb,*p);
- }
-end:
- return strvalue(sb);
-}
diff --git a/contrib/global/lib/strmake.h b/contrib/global/lib/strmake.h
deleted file mode 100644
index 3558c55..0000000
--- a/contrib/global/lib/strmake.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- *
- * strmake.h 17-Apr-98
- *
- */
-
-#ifndef _STRMAKE_H_
-#define _STRMAKE_H_
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-char *strmake __P((const char *, const char *));
-
-#endif /* ! _STRMAKE_H_ */
diff --git a/contrib/global/lib/tab.c b/contrib/global/lib/tab.c
deleted file mode 100644
index 1a9896f..0000000
--- a/contrib/global/lib/tab.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.
- *
- * tab.c 8-Oct-98
- *
- */
-#include <stdio.h>
-
-#include "tab.h"
-
-static int tabs = 8;
-
-#define TABPOS(i) ((i)%tabs == 0)
-/*
- * settabs: set default tab stop
- *
- * i) n tab stop
- */
-void
-settabs(n)
-int n;
-{
- if (n < 1 || n > 32)
- return;
- tabs = n;
-}
-/*
- * detab: convert tabs into spaces and print
- *
- * i) op FILE *
- * i) buf string including tabs
- */
-void
-detab(op, buf)
-FILE *op;
-char *buf;
-{
- int src, dst;
- char c;
-
- src = dst = 0;
- while ((c = buf[src++]) != 0) {
- if (c == '\t') {
- do {
- (void)putc(' ', op);
- dst++;
- } while (!TABPOS(dst));
- } else {
- (void)putc(c, op);
- dst++;
- }
- }
- (void)putc('\n', op);
-}
-/*
- * entab: convert spaces into tabs
- *
- * io) buf string buffer
- */
-void
-entab(buf)
-char *buf;
-{
- int blanks = 0;
- int pos, src, dst;
- char c;
-
- pos = src = dst = 0;
- while ((c = buf[src++]) != 0) {
- if (c == ' ') {
- if (!TABPOS(++pos)) {
- blanks++; /* count blanks */
- continue;
- }
- /* don't convert single blank into tab */
- buf[dst++] = (blanks == 0) ? ' ' : '\t';
- } else if (c == '\t') {
- while (!TABPOS(++pos))
- ;
- buf[dst++] = '\t';
- } else {
- ++pos;
- while (blanks--)
- buf[dst++] = ' ';
- buf[dst++] = c;
- }
- blanks = 0;
- }
- if (blanks > 0)
- while (blanks--)
- buf[dst++] = ' ';
- buf[dst] = 0;
-}
diff --git a/contrib/global/lib/tab.h b/contrib/global/lib/tab.h
deleted file mode 100644
index 6153ff1..0000000
--- a/contrib/global/lib/tab.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- *
- * tab.h 8-Oct-98
- *
- */
-
-#ifndef _TAB
-#define _TAB_H_
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-void settabs __P((int));
-void detab __P((FILE *, char *));
-void entab __P((char *));
-
-#endif /* ! _TAB_H_ */
diff --git a/contrib/global/lib/test.c b/contrib/global/lib/test.c
deleted file mode 100644
index d5c940e..0000000
--- a/contrib/global/lib/test.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.
- *
- * test.c 12-Dec-97
- *
- */
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <unistd.h>
-
-#include "test.h"
-
-/*
- * test:
- *
- * i) flags file flags
- *
- * "f" [ -f path ]
- * "d" [ -d path ]
- * "r" [ -r path ]
- * "w" [ -w path ]
- * "x" [ -x path ]
- *
- * i) path path
- * if NULL then previous path.
- * r) 0: no, 1: ok
- *
- * You can specify more than one character. It assumed 'and' test.
- */
-int
-test(flags, path)
-const char *flags;
-const char *path;
-{
- static struct stat sb;
- int c;
-
- if (path != NULL)
- if (stat(path, &sb) < 0)
- return 0;
- while ((c = *flags++) != 0) {
- switch (c) {
- case 'f':
- if (!S_ISREG(sb.st_mode))
- return 0;
- break;
- case 'd':
- if (!S_ISDIR(sb.st_mode))
- return 0;
- break;
- case 'r':
- if (access(path, R_OK) < 0)
- return 0;
- break;
- case 'w':
- if (access(path, W_OK) < 0)
- return 0;
- break;
- case 'x':
- if (access(path, X_OK) < 0)
- return 0;
- break;
- default:
- break;
- }
- }
- return 1;
-}
diff --git a/contrib/global/lib/test.h b/contrib/global/lib/test.h
deleted file mode 100644
index c44ee48..0000000
--- a/contrib/global/lib/test.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- *
- * test.h 16-Oct-97
- *
- */
-
-#ifndef _TEST_H_
-#define _TEST_H_
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-int test __P((const char *, const char *));
-
-#endif /* ! _TEST_H_ */
diff --git a/contrib/global/lib/token.c b/contrib/global/lib/token.c
deleted file mode 100644
index 27dbe42..0000000
--- a/contrib/global/lib/token.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright (c) 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 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.
- *
- * token.c 14-Aug-98
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/param.h>
-
-#include "mgets.h"
-#include "token.h"
-
-/*
- * File input method.
- */
-int lineno;
-char *sp, *cp, *lp;
-int crflag; /* 1: return '\n', 0: doesn't return */
-int cmode; /* allow token which start with '#' */
-int ymode; /* allow token which start with '%' */
-char token[MAXTOKEN];
-char curfile[MAXPATHLEN];
-
-static char ptok[MAXTOKEN];
-static int lasttok;
-static FILE *ip;
-
-static void pushbackchar __P((void));
-
-/*
- * opentoken:
- */
-int
-opentoken(file)
- char *file;
-{
- if ((ip = fopen(file, "r")) == NULL)
- return 0;
- strcpy(curfile, file);
- sp = cp = lp = NULL; lineno = 0;
- return 1;
-}
-/*
- * closetoken:
- */
-void
-closetoken()
-{
- fclose(ip);
-}
-
-/*
- * nexttoken: get next token
- *
- * i) interested interested special charactor
- * if NULL then all charactor.
- * i) reserved converter from token to token number
- * if this is specified, nexttoken() return
- * word number, else return symbol.
- * r) EOF(-1) end of file
- * ==0 symbol ('tok' has the value.)
- * > 255 reserved word
- * <=255 interested special charactor
- *
- * nexttoken() doesn't return followings.
- *
- * o comment
- * o space (' ', '\t', '\f')
- * o quoted string ("...", '.')
- */
-
-int
-nexttoken(interested, reserved)
- const char *interested;
- int (*reserved)(char *);
-{
- int c;
- char *p;
- int sharp = 0;
- int percent = 0;
-
- /* check push back buffer */
- if (ptok[0]) {
- strcpy(token, ptok);
- ptok[0] = 0;
- return lasttok;
- }
-
- for (;;) {
- /* skip spaces */
- if (!crflag)
- while ((c = nextchar()) != EOF && isspace(c))
- ;
- else
- while ((c = nextchar()) != EOF && (c == ' ' || c == '\t' || c == '\f'))
- ;
- if (c == EOF || c == '\n')
- break;
-
- if (c == '"' || c == '\'') { /* quoted string */
- int quote = c;
-
- while ((c = nextchar()) != EOF) {
- if (c == quote)
- break;
- if (quote == '\'' && c == '\n')
- break;
- if (c == '\\' && (c = nextchar()) == EOF)
- break;
- }
- } else if (c == '/') { /* comment */
- if ((c = nextchar()) == '/') {
- while ((c = nextchar()) != EOF)
- if (c == '\n')
- break;
- } else if (c == '*') {
- while ((c = nextchar()) != EOF) {
- if (c == '*') {
- if ((c = nextchar()) == '/')
- break;
- pushbackchar();
- }
- }
- } else
- pushbackchar();
- } else if (c == '\\') {
- (void)nextchar();
- } else if (isdigit(c)) { /* digit */
- while ((c = nextchar()) != EOF && (c == '.' || isdigit(c) || isalpha(c)))
- ;
- pushbackchar();
- } else if (c == '#' && cmode) {
- /* recognize '##' as a token if it is reserved word. */
- if (peekc(1) == '#') {
- p = token;
- *p++ = c;
- *p++ = nextchar();
- *p = 0;
- if (reserved && (c = (*reserved)(token)) == 0)
- break;
- } else if (atfirst_exceptspace()) {
- sharp = 1;
- continue;
- }
- } else if (c == '%' && ymode) {
- /* recognize '%%' as a token if it is reserved word. */
- if (atfirst) {
- p = token;
- *p++ = c;
- if ((c = peekc(1)) == '%' || c == '{' || c == '}') {
- *p++ = nextchar();
- *p = 0;
- if (reserved && (c = (*reserved)(token)) != 0)
- break;
- } else if (!isspace(c)) {
- percent = 1;
- continue;
- }
- }
- } else if (c & 0x80 || isalpha(c) || c == '_') {/* symbol */
- p = token;
- if (sharp) {
- sharp = 0;
- *p++ = '#';
- } else if (percent) {
- percent = 0;
- *p++ = '%';
- }
- for (*p++ = c; (c = nextchar()) != EOF && (c & 0x80 || isalnum(c) || c == '_'); *p++ = c)
- ;
- *p = 0;
- if (c != EOF)
- pushbackchar();
- /* convert token string into token number */
- if (reserved)
- c = (*reserved)(token);
- break;
- } else { /* special char */
- if (interested == NULL || strchr(interested, c))
- break;
- /* otherwise ignore it */
- }
- sharp = percent = 0;
- }
- return lasttok = c;
-}
-/*
- * pushbacktoken: push back token
- *
- * following nexttoken() return same token again.
- */
-void
-pushbacktoken()
-{
- strcpy(ptok, token);
-}
-/*
- * peekc: peek next char
- *
- * i) immediate 0: ignore blank, 1: include blank
- *
- * Peekc() read ahead following blanks but doesn't chage line.
- */
-int
-peekc(immediate)
- int immediate;
-{
- int c;
- long pos;
-
- if (cp != NULL) {
- if (immediate)
- c = nextchar();
- else
- while ((c = nextchar()) != EOF && c != '\n' && isspace(c))
- ;
- if (c != EOF)
- pushbackchar();
- if (c != '\n' || immediate)
- return c;
- }
- pos = ftell(ip);
- if (immediate)
- c = getc(ip);
- else
- while ((c = getc(ip)) != EOF && isspace(c))
- ;
- (void)fseek(ip, pos, SEEK_SET);
-
- return c;
-}
-/*
- * atfirst_exceptspace: return if current position is the first column
- * except for space.
- * | 1 0
- * | v v
- * | # define
- */
-int
-atfirst_exceptspace()
-{
- char *start = sp;
- char *end = cp ? cp - 1 : lp;
-
- while (start < end && *start && isspace(*start))
- start++;
- return (start == end) ? 1 : 0;
-}
-/*
- * pushbackchar: push back charactor.
- *
- * following nextchar() return same charactor again.
- *
- */
-static void
-pushbackchar()
-{
- if (sp == NULL)
- return; /* nothing to do */
- if (cp == NULL)
- cp = lp;
- else
- --cp;
-}
diff --git a/contrib/global/lib/token.h b/contrib/global/lib/token.h
deleted file mode 100644
index 571b850..0000000
--- a/contrib/global/lib/token.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 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 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.
- *
- * token.h 14-Aug-98
- */
-
-#ifndef _TOKEN_H_
-#define _TOKEN_H_
-
-#include <sys/param.h>
-#include "mgets.h"
-#define MAXTOKEN 512
-#define SYMBOL 0
-
-extern char *sp, *cp, *lp;
-extern int lineno;
-extern int crflag;
-extern int cmode;
-extern int ymode;
-extern char token[MAXTOKEN];
-extern char curfile[MAXPATHLEN];
-
-#define nextchar() \
- (cp == NULL ? \
- ((sp = cp = mgets(ip, NULL, 0)) == NULL ? \
- EOF : \
- (lineno++, *cp == 0 ? \
- lp = cp, cp = NULL, '\n' : \
- *cp++)) : \
- (*cp == 0 ? (lp = cp, cp = NULL, '\n') : *cp++))
-#define atfirst (sp && sp == (cp ? cp - 1 : lp))
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-int opentoken __P((char *));
-void closetoken __P((void));
-int nexttoken __P((const char *, int (*)(char *)));
-void pushbacktoken __P((void));
-int peekc __P((int));
-int atfirst_exceptspace __P((void));
-
-#endif /* ! _TOKEN_H_ */
diff --git a/contrib/global/lib/usable.c b/contrib/global/lib/usable.c
deleted file mode 100644
index af8dd0a..0000000
--- a/contrib/global/lib/usable.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- *
- * usable.c 22-Jun-98
- *
- */
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "locatestring.h"
-#include "gparam.h"
-#include "makepath.h"
-#include "test.h"
-#include "usable.h"
-
-/*
- * usable: check executable or not about the command.
- *
- * i) command
- * r) 1: executable
- * 0: non executable
- */
-int
-usable(command)
-char *command;
-{
- char buf[MAXENVLEN+1], *p, *dir;
-
- if (*command == '/' || locatestring(command, "./", MATCH_AT_FIRST) || locatestring(command, "../", MATCH_AT_FIRST))
- return test("fx", command);
-
- strcpy(buf, getenv("PATH"));
- p = buf;
- while (p) {
- dir = p;
- if ((p = locatestring(p, ":", MATCH_FIRST)) != NULL)
- *p++ = 0;
- if (test("fx", makepath(dir, command)))
- return 1;
- }
- return 0;
-}
diff --git a/contrib/global/lib/usable.h b/contrib/global/lib/usable.h
deleted file mode 100644
index 647769d..0000000
--- a/contrib/global/lib/usable.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- *
- * usable.h 22-Jul-98
- *
- */
-
-#ifndef _USABLE_H_
-#define _USABLE_H_
-
-#ifndef __P
-#if defined(__STDC__)
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-int usable __P((char *));
-
-#endif /* ! _USABLE_H_ */
diff --git a/contrib/global/nvi-1.66.diff b/contrib/global/nvi-1.66.diff
deleted file mode 100644
index bf1400b..0000000
--- a/contrib/global/nvi-1.66.diff
+++ /dev/null
@@ -1,673 +0,0 @@
-diff -c -r -N /usr/src/usr.bin/nvi-1.66.org/build/Makefile ./build/Makefile
-*** /usr/src/usr.bin/nvi-1.66.org/build/Makefile Tue May 5 15:57:21 1998
---- ./build/Makefile Sun Aug 16 03:22:53 1998
-***************
-*** 3,9 ****
- # from: @(#)Makefile.in 8.56 (Berkeley) 5/18/96
-
- WARNS= 0
-! CPPFLAGS+=-I${.CURDIR} -I${.CURDIR}/../include
-
- LDADD+= -lcurses -ltermcap
- DPADD+= ${LIBCURSES} ${LIBTERMCAP}
---- 3,9 ----
- # from: @(#)Makefile.in 8.56 (Berkeley) 5/18/96
-
- WARNS= 0
-! CPPFLAGS+=-I${.CURDIR} -I${.CURDIR}/../include -DGTAGS
-
- LDADD+= -lcurses -ltermcap
- DPADD+= ${LIBCURSES} ${LIBTERMCAP}
-diff -c -r -N /usr/src/usr.bin/nvi-1.66.org/common/main.c ./common/main.c
-*** /usr/src/usr.bin/nvi-1.66.org/common/main.c Tue May 5 15:57:26 1998
---- ./common/main.c Sun Aug 16 03:27:19 1998
-***************
-*** 63,68 ****
---- 63,71 ----
- size_t len;
- u_int flags;
- int ch, fd, flagchk, lflag, startup, readonly, rval, silent;
-+ #ifdef GTAGS
-+ int gtags = 0;
-+ #endif
- char *tag_f, *wsizearg;
- char path[256];
-
-***************
-*** 113,123 ****
---- 116,135 ----
- /* Set the file snapshot flag. */
- F_SET(gp, G_SNAPSHOT);
-
-+ #ifdef GTAGS
-+ #ifdef DEBUG
-+ while ((ch = getopt(argc, argv, "c:D:eFGlRrsT:t:vw:")) != EOF)
-+ #else
-+ while ((ch = getopt(argc, argv, "c:eFGlRrst:vw:")) != EOF)
-+ #endif
-+ #else
- #ifdef DEBUG
- while ((ch = getopt(argc, argv, "c:D:eFlRrsT:t:vw:")) != EOF)
- #else
- while ((ch = getopt(argc, argv, "c:eFlRrst:vw:")) != EOF)
- #endif
-+ #endif
-+
- switch (ch) {
- case 'c': /* Run the command. */
- /*
-***************
-*** 167,172 ****
---- 179,189 ----
- case 'F': /* No snapshot. */
- F_CLR(gp, G_SNAPSHOT);
- break;
-+ #ifdef GTAGS
-+ case 'G': /* gtags mode. */
-+ gtags = 1;
-+ break;
-+ #endif
- case 'l': /* Set lisp, showmatch options. */
- lflag = 1;
- break;
-***************
-*** 258,263 ****
---- 275,284 ----
- { int oargs[4], *oargp = oargs;
- if (readonly) /* Command-line options. */
- *oargp++ = O_READONLY;
-+ #ifdef GTAGS
-+ if (gtags)
-+ *oargp++ = O_GTAGSMODE;
-+ #endif
- if (lflag) {
- *oargp++ = O_LISP;
- *oargp++ = O_SHOWMATCH;
-diff -c -r -N /usr/src/usr.bin/nvi-1.66.org/common/options.c ./common/options.c
-*** /usr/src/usr.bin/nvi-1.66.org/common/options.c Tue May 5 15:57:26 1998
---- ./common/options.c Sun Aug 16 03:29:51 1998
-***************
-*** 80,85 ****
---- 80,89 ----
- {"filec", NULL, OPT_STR, 0},
- /* O_FLASH HPUX */
- {"flash", NULL, OPT_1BOOL, 0},
-+ #ifdef GTAGS
-+ /* O_GTAGSMODE FreeBSD, NetBSD */
-+ {"gtagsmode", NULL, OPT_0BOOL, 0},
-+ #endif
- /* O_HARDTABS 4BSD */
- {"hardtabs", NULL, OPT_NUM, 0},
- /* O_ICLOWER 4.4BSD */
-***************
-*** 240,245 ****
---- 244,252 ----
- {"eb", O_ERRORBELLS}, /* 4BSD */
- {"ed", O_EDCOMPATIBLE}, /* 4BSD */
- {"ex", O_EXRC}, /* System V (undocumented) */
-+ #ifdef GTAGS
-+ {"gt", O_GTAGSMODE}, /* FreeBSD, NetBSD */
-+ #endif
- {"ht", O_HARDTABS}, /* 4BSD */
- {"ic", O_IGNORECASE}, /* 4BSD */
- {"li", O_LINES}, /* 4.4BSD */
-diff -c -r -N /usr/src/usr.bin/nvi-1.66.org/docs/USD.doc/vi.man/vi.1 ./docs/USD.doc/vi.man/vi.1
-*** /usr/src/usr.bin/nvi-1.66.org/docs/USD.doc/vi.man/vi.1 Tue May 5 15:57:31 1998
---- ./docs/USD.doc/vi.man/vi.1 Sun Aug 16 03:34:12 1998
-***************
-*** 40,46 ****
- .SH SYNOPSIS
- .B ex
- [\c
-! .B -eFRrsv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
---- 40,46 ----
- .SH SYNOPSIS
- .B ex
- [\c
-! .B -eFGRrsv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
-***************
-*** 51,57 ****
- .br
- .B vi
- [\c
-! .B -eFlRrv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
---- 51,57 ----
- .br
- .B vi
- [\c
-! .B -eFGlRrv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
-***************
-*** 62,68 ****
- .br
- .B view
- [\c
-! .B -eFRrv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
---- 62,68 ----
- .br
- .B view
- [\c
-! .B -eFGRrv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
-***************
-*** 135,140 ****
---- 135,143 ----
- (The default is to make a copy in case someone else modifies
- the file during your edit session.)
- .TP
-+ .B \-G
-+ Start editing in gtags mode, as if the gtagsmode option was set.
-+ .TP
- .B \-l
- Start editing with the lisp and showmatch options set.
- .TP
-***************
-*** 441,446 ****
---- 444,451 ----
- .TP
- .B "<control-]>"
- Push a tag reference onto the tag stack.
-+ In gtagsmode, if at the first column of line,
-+ locate function references otherwise function definitions.
- .TP
- .B "<control-^>"
- Switch to the most recently edited file.
-***************
-*** 952,957 ****
---- 957,965 ----
- .B "rew[ind][!]"
- Rewind the argument list.
- .TP
-+ .B "rta[g][!] tagstring"
-+ Edit the file refering the specified tag. (Only in gtagsmode)
-+ .TP
- .B "se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]"
- Display or set editor options.
- .TP
-***************
-*** 1121,1126 ****
---- 1129,1137 ----
- .TP
- .B "flash [on]"
- Flash the screen instead of beeping the keyboard on error.
-+ .TP
-+ .B "gtagsmode, gt [off]"
-+ Use GTAGS and GRTAGS instead of tags.
- .TP
- .B "hardtabs, ht [8]"
- Set the spacing between hardware tab settings.
-diff -c -r -N /usr/src/usr.bin/nvi-1.66.org/ex/ex.h ./ex/ex.h
-*** /usr/src/usr.bin/nvi-1.66.org/ex/ex.h Tue May 5 15:57:37 1998
---- ./ex/ex.h Sun Aug 16 03:35:58 1998
-***************
-*** 162,167 ****
---- 162,170 ----
- #define E_NEWLINE 0x00800000 /* Found ending <newline>. */
- #define E_USELASTCMD 0x01000000 /* Use the last command. */
- #define E_VISEARCH 0x02000000 /* It's really a vi search command. */
-+ #ifdef GTAGS
-+ #define E_REFERENCE 0x04000000 /* locate function references */
-+ #endif
- u_int32_t flags; /* Current flags. */
- };
-
-diff -c -r -N /usr/src/usr.bin/nvi-1.66.org/ex/ex_cmd.c ./ex/ex_cmd.c
-*** /usr/src/usr.bin/nvi-1.66.org/ex/ex_cmd.c Tue May 5 15:57:37 1998
---- ./ex/ex_cmd.c Sun Aug 16 03:38:03 1998
-***************
-*** 302,307 ****
---- 302,314 ----
- "!",
- "rew[ind][!]",
- "re-edit all the files in the file argument list"},
-+ #ifdef GTAGS
-+ /* C_RTAG */
-+ {"rtag", ex_rtag_push, E_NEWSCREEN,
-+ "!w1o",
-+ "rta[g][!] [string]",
-+ "edit the file containing the tag"},
-+ #endif
- /*
- * !!!
- * Adding new commands starting with 's' may break the substitute command code
-diff -c -r -N /usr/src/usr.bin/nvi-1.66.org/ex/ex_tag.c ./ex/ex_tag.c
-*** /usr/src/usr.bin/nvi-1.66.org/ex/ex_tag.c Tue May 5 15:57:41 1998
---- ./ex/ex_tag.c Sun Aug 16 03:46:43 1998
-***************
-*** 46,51 ****
---- 46,55 ----
- static int compare __P((char *, char *, char *));
- static void ctag_file __P((SCR *, TAGF *, char *, char **, size_t *));
- static int ctag_search __P((SCR *, char *, char *));
-+ #ifdef GTAGS
-+ static int getentry __P((char *, char **, char **, char **));
-+ static TAGQ *gtag_slist __P((SCR *, char *, int));
-+ #endif
- static int ctag_sfile __P((SCR *, TAGF *, TAGQ *, char *));
- static TAGQ *ctag_slist __P((SCR *, char *));
- static char *linear_search __P((char *, char *, char *));
-***************
-*** 89,94 ****
---- 93,117 ----
- return (0);
- }
-
-+ #ifdef GTAGS
-+ /*
-+ * ex_rtag_push -- ^]
-+ * :rtag[!] [string]
-+ *
-+ * Enter a new TAGQ context based on a ctag string.
-+ *
-+ * PUBLIC: int ex_rtag_push __P((SCR *, EXCMD *));
-+ */
-+ int
-+ ex_rtag_push(sp, cmdp)
-+ SCR *sp;
-+ EXCMD *cmdp;
-+ {
-+ F_SET(cmdp, E_REFERENCE);
-+ return ex_tag_push(sp, cmdp);
-+ }
-+ #endif
-+
- /*
- * ex_tag_push -- ^]
- * :tag[!] [string]
-***************
-*** 138,143 ****
---- 161,172 ----
- }
-
- /* Get the tag information. */
-+ #ifdef GTAGS
-+ if (O_ISSET(sp, O_GTAGSMODE)) {
-+ if ((tqp = gtag_slist(sp, exp->tag_last, F_ISSET(cmdp, E_REFERENCE))) == NULL)
-+ return (1);
-+ } else
-+ #endif
- if ((tqp = ctag_slist(sp, exp->tag_last)) == NULL)
- return (1);
-
-***************
-*** 963,969 ****
---- 992,1120 ----
- (void)nonblank(sp, sp->lno, &sp->cno);
- return (0);
- }
-+ #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 = buf;
-+
-+ for (*tag = p; *p && !isspace(*p); p++) /* tag name */
-+ ;
-+ if (*p == 0)
-+ goto err;
-+ *p++ = 0;
-+ for (; *p && isspace(*p); p++) /* (skip blanks) */
-+ ;
-+ if (*p == 0)
-+ goto err;
-+ *line = p; /* line no */
-+ for (*line = p; *p && !isspace(*p); p++)
-+ ;
-+ if (*p == 0)
-+ goto err;
-+ *p++ = 0;
-+ for (; *p && isspace(*p); p++) /* (skip blanks) */
-+ ;
-+ if (*p == 0)
-+ goto err;
-+ *file = p; /* file name */
-+ for (*file = p; *p && !isspace(*p); p++)
-+ ;
-+ if (*p == 0)
-+ goto err;
-+ *p = 0;
-+
-+ /* value check */
-+ if (strlen(*tag) && strlen(*line) && strlen(*file) && atoi(*line) > 0)
-+ return 1; /* OK */
-+ err:
-+ return 0; /* ERROR */
-+ }
-+
-+ /*
-+ * gtag_slist --
-+ * Search the list of tags files for a tag, and return tag queue.
-+ */
-+ static TAGQ *
-+ gtag_slist(sp, tag, ref)
-+ SCR *sp;
-+ char *tag;
-+ int ref;
-+ {
-+ EX_PRIVATE *exp;
-+ TAGF *tfp;
-+ TAGQ *tqp;
-+ size_t len;
-+ int echk;
-+ TAG *tp;
-+ char *name, *file, *line;
-+ char command[BUFSIZ];
-+ char buf[BUFSIZ];
-+ FILE *fp;
-+
-+ /* Allocate and initialize the tag queue structure. */
-+ len = strlen(tag);
-+ CALLOC_GOTO(sp, tqp, TAGQ *, 1, sizeof(TAGQ) + len + 1);
-+ CIRCLEQ_INIT(&tqp->tagq);
-+ tqp->tag = tqp->buf;
-+ memcpy(tqp->tag, tag, (tqp->tlen = len) + 1);
-+
-+ /*
-+ * Find the tag, only display missing file messages once, and
-+ * then only if we didn't find the tag.
-+ */
-+ snprintf(command, sizeof(command), "global -%s '%s' 2>/dev/null", ref ? "rx" : "x", tag);
-+ if (fp = popen(command, "r")) {
-+ while (fgets(buf, sizeof(buf), fp)) {
-+ if (buf[strlen(buf)-1] == '\n') /* chop(buf) */
-+ buf[strlen(buf)-1] = 0;
-+ else
-+ while (fgetc(fp) != '\n')
-+ ;
-+ if (getentry(buf, &name, &file, &line) == 0) {
-+ echk = 1;
-+ F_SET(tfp, TAGF_ERR);
-+ break;
-+ }
-+ CALLOC_GOTO(sp, tp,
-+ TAG *, 1, sizeof(TAG) + strlen(file) + 1 + strlen(line) + 1);
-+ tp->fname = tp->buf;
-+ strcpy(tp->fname, file);
-+ tp->fnlen = strlen(file);
-+ tp->search = tp->fname + tp->fnlen + 1;
-+ strcpy(tp->search, line);
-+ CIRCLEQ_INSERT_TAIL(&tqp->tagq, tp, q);
-+ }
-+ pclose(fp);
-+ }
-+
-+ /* Check to see if we found anything. */
-+ if (tqp->tagq.cqh_first == (void *)&tqp->tagq) {
-+ msgq_str(sp, M_ERR, tag, "162|%s: tag not found");
-+ free(tqp);
-+ return (NULL);
-+ }
-
-+ tqp->current = tqp->tagq.cqh_first;
-+ return (tqp);
-+
-+ alloc_err:
-+ return (NULL);
-+ }
-+ #endif
- /*
- * ctag_slist --
- * Search the list of tags files for a tag, and return tag queue.
-diff -c -r -N /usr/src/usr.bin/nvi-1.66.org/include/ex_def.h ./include/ex_def.h
-*** /usr/src/usr.bin/nvi-1.66.org/include/ex_def.h Tue May 5 15:57:42 1998
---- ./include/ex_def.h Sun Aug 16 03:49:40 1998
-***************
-*** 47,78 ****
- #define C_RECOVER 46
- #define C_RESIZE 47
- #define C_REWIND 48
-! #define C_SUBSTITUTE 49
-! #define C_SCRIPT 50
-! #define C_SET 51
-! #define C_SHELL 52
-! #define C_SOURCE 53
-! #define C_STOP 54
-! #define C_SUSPEND 55
-! #define C_T 56
-! #define C_TAG 57
-! #define C_TAGNEXT 58
-! #define C_TAGPOP 59
-! #define C_TAGPREV 60
-! #define C_TAGTOP 61
-! #define C_TCLCMD 62
-! #define C_UNDO 63
-! #define C_UNABBREVIATE 64
-! #define C_UNMAP 65
-! #define C_V 66
-! #define C_VERSION 67
-! #define C_VISUAL_EX 68
-! #define C_VISUAL_VI 69
-! #define C_VIUSAGE 70
-! #define C_WRITE 71
-! #define C_WN 72
-! #define C_WQ 73
-! #define C_XIT 74
-! #define C_YANK 75
-! #define C_Z 76
-! #define C_SUBTILDE 77
---- 47,79 ----
- #define C_RECOVER 46
- #define C_RESIZE 47
- #define C_REWIND 48
-! #define C_RTAG 49
-! #define C_SUBSTITUTE 50
-! #define C_SCRIPT 51
-! #define C_SET 52
-! #define C_SHELL 53
-! #define C_SOURCE 54
-! #define C_STOP 55
-! #define C_SUSPEND 56
-! #define C_T 57
-! #define C_TAG 58
-! #define C_TAGNEXT 59
-! #define C_TAGPOP 60
-! #define C_TAGPREV 61
-! #define C_TAGTOP 62
-! #define C_TCLCMD 63
-! #define C_UNDO 64
-! #define C_UNABBREVIATE 65
-! #define C_UNMAP 66
-! #define C_V 67
-! #define C_VERSION 68
-! #define C_VISUAL_EX 69
-! #define C_VISUAL_VI 70
-! #define C_VIUSAGE 71
-! #define C_WRITE 72
-! #define C_WN 73
-! #define C_WQ 74
-! #define C_XIT 75
-! #define C_YANK 76
-! #define C_Z 77
-! #define C_SUBTILDE 78
-diff -c -r -N /usr/src/usr.bin/nvi-1.66.org/include/ex_extern.h ./include/ex_extern.h
-*** /usr/src/usr.bin/nvi-1.66.org/include/ex_extern.h Tue May 5 15:57:42 1998
---- ./include/ex_extern.h Sun Aug 16 03:50:24 1998
-***************
-*** 92,97 ****
---- 92,100 ----
- char *, char **, size_t *, regex_t *, u_int));
- void re_error __P((SCR *, int, regex_t *));
- int ex_tag_first __P((SCR *, char *));
-+ #ifdef GTAGS
-+ int ex_rtag_push __P((SCR *, EXCMD *));
-+ #endif
- int ex_tag_push __P((SCR *, EXCMD *));
- int ex_tag_next __P((SCR *, EXCMD *));
- int ex_tag_prev __P((SCR *, EXCMD *));
-diff -c -r -N /usr/src/usr.bin/nvi-1.66.org/include/options_def.h ./include/options_def.h
-*** /usr/src/usr.bin/nvi-1.66.org/include/options_def.h Tue May 5 15:57:42 1998
---- ./include/options_def.h Sun Aug 16 03:54:45 1998
-***************
-*** 16,77 ****
- #define O_EXTENDED 15
- #define O_FILEC 16
- #define O_FLASH 17
-! #define O_HARDTABS 18
-! #define O_ICLOWER 19
-! #define O_IGNORECASE 20
-! #define O_KEYTIME 21
-! #define O_LEFTRIGHT 22
-! #define O_LINES 23
-! #define O_LISP 24
-! #define O_LIST 25
-! #define O_LOCKFILES 26
-! #define O_MAGIC 27
-! #define O_MATCHTIME 28
-! #define O_MESG 29
-! #define O_MODELINE 30
-! #define O_MSGCAT 31
-! #define O_NOPRINT 32
-! #define O_NUMBER 33
-! #define O_OCTAL 34
-! #define O_OPEN 35
-! #define O_OPTIMIZE 36
-! #define O_PARAGRAPHS 37
-! #define O_PRINT 38
-! #define O_PROMPT 39
-! #define O_READONLY 40
-! #define O_RECDIR 41
-! #define O_REDRAW 42
-! #define O_REMAP 43
-! #define O_REPORT 44
-! #define O_RULER 45
-! #define O_SCROLL 46
-! #define O_SEARCHINCR 47
-! #define O_SECTIONS 48
-! #define O_SECURE 49
-! #define O_SHELL 50
-! #define O_SHELLMETA 51
-! #define O_SHIFTWIDTH 52
-! #define O_SHOWMATCH 53
-! #define O_SHOWMODE 54
-! #define O_SIDESCROLL 55
-! #define O_SLOWOPEN 56
-! #define O_SOURCEANY 57
-! #define O_TABSTOP 58
-! #define O_TAGLENGTH 59
-! #define O_TAGS 60
-! #define O_TERM 61
-! #define O_TERSE 62
-! #define O_TILDEOP 63
-! #define O_TIMEOUT 64
-! #define O_TTYWERASE 65
-! #define O_VERBOSE 66
-! #define O_W1200 67
-! #define O_W300 68
-! #define O_W9600 69
-! #define O_WARN 70
-! #define O_WINDOW 71
-! #define O_WRAPLEN 72
-! #define O_WRAPMARGIN 73
-! #define O_WRAPSCAN 74
-! #define O_WRITEANY 75
-! #define O_OPTIONCOUNT 76
---- 16,78 ----
- #define O_EXTENDED 15
- #define O_FILEC 16
- #define O_FLASH 17
-! #define O_GTAGSMODE 18
-! #define O_HARDTABS 19
-! #define O_ICLOWER 20
-! #define O_IGNORECASE 21
-! #define O_KEYTIME 22
-! #define O_LEFTRIGHT 23
-! #define O_LINES 24
-! #define O_LISP 25
-! #define O_LIST 26
-! #define O_LOCKFILES 27
-! #define O_MAGIC 28
-! #define O_MATCHTIME 29
-! #define O_MESG 30
-! #define O_MODELINE 31
-! #define O_MSGCAT 32
-! #define O_NOPRINT 33
-! #define O_NUMBER 34
-! #define O_OCTAL 35
-! #define O_OPEN 36
-! #define O_OPTIMIZE 37
-! #define O_PARAGRAPHS 38
-! #define O_PRINT 39
-! #define O_PROMPT 40
-! #define O_READONLY 41
-! #define O_RECDIR 42
-! #define O_REDRAW 43
-! #define O_REMAP 44
-! #define O_REPORT 45
-! #define O_RULER 46
-! #define O_SCROLL 47
-! #define O_SEARCHINCR 48
-! #define O_SECTIONS 49
-! #define O_SECURE 50
-! #define O_SHELL 51
-! #define O_SHELLMETA 52
-! #define O_SHIFTWIDTH 53
-! #define O_SHOWMATCH 54
-! #define O_SHOWMODE 55
-! #define O_SIDESCROLL 56
-! #define O_SLOWOPEN 57
-! #define O_SOURCEANY 58
-! #define O_TABSTOP 59
-! #define O_TAGLENGTH 60
-! #define O_TAGS 61
-! #define O_TERM 62
-! #define O_TERSE 63
-! #define O_TILDEOP 64
-! #define O_TIMEOUT 65
-! #define O_TTYWERASE 66
-! #define O_VERBOSE 67
-! #define O_W1200 68
-! #define O_W300 69
-! #define O_W9600 70
-! #define O_WARN 71
-! #define O_WINDOW 72
-! #define O_WRAPLEN 73
-! #define O_WRAPMARGIN 74
-! #define O_WRAPSCAN 75
-! #define O_WRITEANY 76
-! #define O_OPTIONCOUNT 77
-diff -c -r -N /usr/src/usr.bin/nvi-1.66.org/vi/v_ex.c ./vi/v_ex.c
-*** /usr/src/usr.bin/nvi-1.66.org/vi/v_ex.c Tue May 5 15:57:45 1998
---- ./vi/v_ex.c Sun Aug 16 03:55:38 1998
-***************
-*** 221,226 ****
---- 221,231 ----
- ARGS *ap[2], a;
- EXCMD cmd;
-
-+ #ifdef GTAGS
-+ if (O_ISSET(sp, O_GTAGSMODE) && vp->m_start.cno == 0)
-+ ex_cinit(&cmd, C_RTAG, 0, OOBLNO, 0, 0, ap);
-+ else
-+ #endif
- ex_cinit(&cmd, C_TAG, 0, OOBLNO, 0, 0, ap);
- ex_cadd(&cmd, &a, VIP(sp)->keyw, strlen(VIP(sp)->keyw));
- return (v_exec_ex(sp, vp, &cmd));
diff --git a/contrib/global/nvi-1.79.diff b/contrib/global/nvi-1.79.diff
deleted file mode 100644
index 7b601b2..0000000
--- a/contrib/global/nvi-1.79.diff
+++ /dev/null
@@ -1,674 +0,0 @@
-diff -c -r -N /usr/local/src/nvi-1.79/build/Makefile.in ./build/Makefile.in
-*** /usr/local/src/nvi-1.79/build/Makefile.in Wed Oct 23 22:43:38 1996
---- ./build/Makefile.in Fri Aug 14 01:41:14 1998
-***************
-*** 3,9 ****
- srcdir= @srcdir@/..
- CC= @CC@
- OPTFLAG=@OPTFLAG@
-! CFLAGS= -c $(OPTFLAG) @CFLAGS@ -I. -I$(srcdir)/include @CPPFLAGS@
- LDFLAGS=@LDFLAGS@
- PERL= @vi_cv_path_perl@
- PERLLIB=@vi_cv_perllib@
---- 3,9 ----
- srcdir= @srcdir@/..
- CC= @CC@
- OPTFLAG=@OPTFLAG@
-! CFLAGS= -c $(OPTFLAG) @CFLAGS@ -I. -I$(srcdir)/include @CPPFLAGS@ -DGTAGS
- LDFLAGS=@LDFLAGS@
- PERL= @vi_cv_path_perl@
- PERLLIB=@vi_cv_perllib@
-diff -c -r -N /usr/local/src/nvi-1.79/common/main.c ./common/main.c
-*** /usr/local/src/nvi-1.79/common/main.c Sat Oct 12 07:28:28 1996
---- ./common/main.c Fri Aug 14 01:41:14 1998
-***************
-*** 64,69 ****
---- 64,72 ----
- size_t len;
- u_int flags;
- int ch, flagchk, lflag, secure, startup, readonly, rval, silent;
-+ #ifdef GTAGS
-+ int gtags = 0;
-+ #endif
- char *tag_f, *wsizearg, path[256];
-
- /* Initialize the busy routine, if not defined by the screen. */
-***************
-*** 113,123 ****
---- 116,134 ----
- /* Set the file snapshot flag. */
- F_SET(gp, G_SNAPSHOT);
-
-+ #ifdef GTAGS
-+ #ifdef DEBUG
-+ while ((ch = getopt(argc, argv, "c:D:eFGlRrSsT:t:vw:")) != EOF)
-+ #else
-+ while ((ch = getopt(argc, argv, "c:eFGlRrSst:vw:")) != EOF)
-+ #endif
-+ #else
- #ifdef DEBUG
- while ((ch = getopt(argc, argv, "c:D:eFlRrSsT:t:vw:")) != EOF)
- #else
- while ((ch = getopt(argc, argv, "c:eFlRrSst:vw:")) != EOF)
- #endif
-+ #endif
- switch (ch) {
- case 'c': /* Run the command. */
- /*
-***************
-*** 154,159 ****
---- 165,175 ----
- case 'F': /* No snapshot. */
- F_CLR(gp, G_SNAPSHOT);
- break;
-+ #ifdef GTAGS
-+ case 'G': /* gtags mode. */
-+ gtags = 1;
-+ break;
-+ #endif
- case 'l': /* Set lisp, showmatch options. */
- lflag = 1;
- break;
-***************
-*** 252,257 ****
---- 268,277 ----
- }
- if (readonly)
- *oargp++ = O_READONLY;
-+ #ifdef GTAGS
-+ if (gtags)
-+ *oargp++ = O_GTAGSMODE;
-+ #endif
- if (secure)
- *oargp++ = O_SECURE;
- *oargp = -1; /* Options initialization. */
-diff -c -r -N /usr/local/src/nvi-1.79/common/options.c ./common/options.c
-*** /usr/local/src/nvi-1.79/common/options.c Tue Oct 15 03:56:29 1996
---- ./common/options.c Fri Aug 14 01:41:14 1998
-***************
-*** 80,85 ****
---- 80,89 ----
- {"filec", NULL, OPT_STR, 0},
- /* O_FLASH HPUX */
- {"flash", NULL, OPT_1BOOL, 0},
-+ #ifdef GTAGS
-+ /* O_GTAGSMODE FreeBSD2.2 */
-+ {"gtagsmode", NULL, OPT_0BOOL, 0},
-+ #endif
- /* O_HARDTABS 4BSD */
- {"hardtabs", NULL, OPT_NUM, 0},
- /* O_ICLOWER 4.4BSD */
-***************
-*** 244,249 ****
---- 248,256 ----
- {"eb", O_ERRORBELLS}, /* 4BSD */
- {"ed", O_EDCOMPATIBLE}, /* 4BSD */
- {"ex", O_EXRC}, /* System V (undocumented) */
-+ #ifdef GTAGS
-+ {"gt", O_GTAGSMODE}, /* FreeBSD2.2 */
-+ #endif
- {"ht", O_HARDTABS}, /* 4BSD */
- {"ic", O_IGNORECASE}, /* 4BSD */
- {"li", O_LINES}, /* 4.4BSD */
-diff -c -r -N /usr/local/src/nvi-1.79/docs/USD.doc/vi.man/vi.1 ./docs/USD.doc/vi.man/vi.1
-*** /usr/local/src/nvi-1.79/docs/USD.doc/vi.man/vi.1 Fri Oct 11 10:34:05 1996
---- ./docs/USD.doc/vi.man/vi.1 Fri Aug 14 01:41:14 1998
-***************
-*** 17,23 ****
- .SH SYNOPSIS
- .B ex
- [\c
-! .B -eFRrSsv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
---- 17,23 ----
- .SH SYNOPSIS
- .B ex
- [\c
-! .B -eFGRrSsv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
-***************
-*** 28,34 ****
- .br
- .B vi
- [\c
-! .B -eFlRrSv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
---- 28,34 ----
- .br
- .B vi
- [\c
-! .B -eFGlRrSv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
-***************
-*** 39,45 ****
- .br
- .B view
- [\c
-! .B -eFRrSv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
---- 39,45 ----
- .br
- .B view
- [\c
-! .B -eFGRrSv\c
- ] [\c
- .BI -c " cmd"\c
- ] [\c
-***************
-*** 121,126 ****
---- 121,129 ----
- .B \-l
- Start editing with the lisp and showmatch options set.
- .TP
-+ .B \-G
-+ Start editing in gtags mode, as if the gtagsmode option was set.
-+ .TP
- .B \-R
- Start editing in read-only mode, as if the command name was
- .IR view ,
-***************
-*** 429,434 ****
---- 432,439 ----
- .TP
- .B "<control-]>"
- Push a tag reference onto the tag stack.
-+ In gtagsmode, if at the first column of line,
-+ locate function references otherwise function definitions.
- .TP
- .B "<control-^>"
- Switch to the most recently edited file.
-***************
-*** 940,945 ****
---- 945,953 ----
- .B "rew[ind][!]"
- Rewind the argument list.
- .TP
-+ .B "rta[g][!] tagstring"
-+ Edit the file refering the specified tag. (Only in gtagsmode)
-+ .TP
- .B "se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]"
- Display or set editor options.
- .TP
-***************
-*** 1109,1114 ****
---- 1117,1125 ----
- .TP
- .B "flash [on]"
- Flash the screen instead of beeping the keyboard on error.
-+ .TP
-+ .B "gtagsmode, gt [off]"
-+ Use GTAGS and GRTAGS instead of tags.
- .TP
- .B "hardtabs, ht [8]"
- Set the spacing between hardware tab settings.
-diff -c -r -N /usr/local/src/nvi-1.79/ex/ex.h ./ex/ex.h
-*** /usr/local/src/nvi-1.79/ex/ex.h Tue Aug 13 09:24:00 1996
---- ./ex/ex.h Fri Aug 14 01:41:14 1998
-***************
-*** 152,157 ****
---- 152,160 ----
- #define E_SEARCH_WMSG 0x01000000 /* Display search-wrapped message. */
- #define E_USELASTCMD 0x02000000 /* Use the last command. */
- #define E_VISEARCH 0x04000000 /* It's really a vi search command. */
-+ #ifdef GTAGS
-+ #define E_REFERENCE 0x08000000 /* locate function references */
-+ #endif
- u_int32_t flags; /* Current flags. */
- };
-
-diff -c -r -N /usr/local/src/nvi-1.79/ex/ex_cmd.c ./ex/ex_cmd.c
-*** /usr/local/src/nvi-1.79/ex/ex_cmd.c Wed Oct 23 22:31:01 1996
---- ./ex/ex_cmd.c Fri Aug 14 01:41:14 1998
-***************
-*** 302,307 ****
---- 302,314 ----
- "!",
- "rew[ind][!]",
- "re-edit all the files in the file argument list"},
-+ #ifdef GTAGS
-+ /* C_RTAG */
-+ {"rtag", ex_rtag_push, E_NEWSCREEN,
-+ "!w1o",
-+ "rta[g][!] [string]",
-+ "edit the file containing the tag"},
-+ #endif
- /*
- * !!!
- * Adding new commands starting with 's' may break the substitute command code
-diff -c -r -N /usr/local/src/nvi-1.79/ex/ex_tag.c ./ex/ex_tag.c
-*** /usr/local/src/nvi-1.79/ex/ex_tag.c Mon Sep 16 05:02:43 1996
---- ./ex/ex_tag.c Fri Aug 14 01:53:35 1998
-***************
-*** 46,51 ****
---- 46,55 ----
- static int compare __P((char *, char *, char *));
- static void ctag_file __P((SCR *, TAGF *, char *, char **, size_t *));
- static int ctag_search __P((SCR *, char *, size_t, char *));
-+ #ifdef GTAGS
-+ static int getentry __P((char *, char **, char **, char **));
-+ static TAGQ *gtag_slist __P((SCR *, char *, int));
-+ #endif
- static int ctag_sfile __P((SCR *, TAGF *, TAGQ *, char *));
- static TAGQ *ctag_slist __P((SCR *, char *));
- static char *linear_search __P((char *, char *, char *));
-***************
-*** 89,94 ****
---- 93,117 ----
- return (0);
- }
-
-+ #ifdef GTAGS
-+ /*
-+ * ex_rtag_push -- ^]
-+ * :rtag[!] [string]
-+ *
-+ * Enter a new TAGQ context based on a ctag string.
-+ *
-+ * PUBLIC: int ex_rtag_push __P((SCR *, EXCMD *));
-+ */
-+ int
-+ ex_rtag_push(sp, cmdp)
-+ SCR *sp;
-+ EXCMD *cmdp;
-+ {
-+ F_SET(cmdp, E_REFERENCE);
-+ return ex_tag_push(sp, cmdp);
-+ }
-+ #endif
-+
- /*
- * ex_tag_push -- ^]
- * :tag[!] [string]
-***************
-*** 138,143 ****
---- 161,172 ----
- }
-
- /* Get the tag information. */
-+ #ifdef GTAGS
-+ if (O_ISSET(sp, O_GTAGSMODE)) {
-+ if ((tqp = gtag_slist(sp, exp->tag_last, F_ISSET(cmdp, E_REFERENCE))) == NULL)
-+ return (1);
-+ } else
-+ #endif
- if ((tqp = ctag_slist(sp, exp->tag_last)) == NULL)
- return (1);
-
-***************
-*** 969,974 ****
---- 998,1126 ----
- return (0);
- }
-
-+ #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 = buf;
-+
-+ for (*tag = p; *p && !isspace(*p); p++) /* tag name */
-+ ;
-+ if (*p == 0)
-+ goto err;
-+ *p++ = 0;
-+ for (; *p && isspace(*p); p++) /* (skip blanks) */
-+ ;
-+ if (*p == 0)
-+ goto err;
-+ *line = p; /* line no */
-+ for (*line = p; *p && !isspace(*p); p++)
-+ ;
-+ if (*p == 0)
-+ goto err;
-+ *p++ = 0;
-+ for (; *p && isspace(*p); p++) /* (skip blanks) */
-+ ;
-+ if (*p == 0)
-+ goto err;
-+ *file = p; /* file name */
-+ for (*file = p; *p && !isspace(*p); p++)
-+ ;
-+ if (*p == 0)
-+ goto err;
-+ *p = 0;
-+
-+ /* value check */
-+ if (strlen(*tag) && strlen(*line) && strlen(*file) && atoi(*line) > 0)
-+ return 1; /* OK */
-+ err:
-+ return 0; /* ERROR */
-+ }
-+
-+ /*
-+ * gtag_slist --
-+ * Search the list of tags files for a tag, and return tag queue.
-+ */
-+ static TAGQ *
-+ gtag_slist(sp, tag, ref)
-+ SCR *sp;
-+ char *tag;
-+ int ref;
-+ {
-+ EX_PRIVATE *exp;
-+ TAGF *tfp;
-+ TAGQ *tqp;
-+ size_t len;
-+ int echk;
-+ TAG *tp;
-+ char *name, *file, *line;
-+ char command[BUFSIZ];
-+ char buf[BUFSIZ];
-+ FILE *fp;
-+
-+ /* Allocate and initialize the tag queue structure. */
-+ len = strlen(tag);
-+ CALLOC_GOTO(sp, tqp, TAGQ *, 1, sizeof(TAGQ) + len + 1);
-+ CIRCLEQ_INIT(&tqp->tagq);
-+ tqp->tag = tqp->buf;
-+ memcpy(tqp->tag, tag, (tqp->tlen = len) + 1);
-+
-+ /*
-+ * Find the tag, only display missing file messages once, and
-+ * then only if we didn't find the tag.
-+ */
-+ snprintf(command, sizeof(command), "global -%s '%s' 2>/dev/null", ref ? "rx" : "x", tag);
-+ if (fp = popen(command, "r")) {
-+ while (fgets(buf, sizeof(buf), fp)) {
-+ if (buf[strlen(buf)-1] == '\n') /* chop(buf) */
-+ buf[strlen(buf)-1] = 0;
-+ else
-+ while (fgetc(fp) != '\n')
-+ ;
-+ if (getentry(buf, &name, &file, &line) == 0) {
-+ echk = 1;
-+ F_SET(tfp, TAGF_ERR);
-+ break;
-+ }
-+ CALLOC_GOTO(sp, tp,
-+ TAG *, 1, sizeof(TAG) + strlen(file) + 1 + strlen(line) + 1);
-+ tp->fname = tp->buf;
-+ strcpy(tp->fname, file);
-+ tp->fnlen = strlen(file);
-+ tp->search = tp->fname + tp->fnlen + 1;
-+ strcpy(tp->search, line);
-+ CIRCLEQ_INSERT_TAIL(&tqp->tagq, tp, q);
-+ }
-+ pclose(fp);
-+ }
-+
-+ /* Check to see if we found anything. */
-+ if (tqp->tagq.cqh_first == (void *)&tqp->tagq) {
-+ msgq_str(sp, M_ERR, tag, "162|%s: tag not found");
-+ free(tqp);
-+ return (NULL);
-+ }
-+
-+ tqp->current = tqp->tagq.cqh_first;
-+ return (tqp);
-+
-+ alloc_err:
-+ return (NULL);
-+ }
-+ #endif
- /*
- * ctag_slist --
- * Search the list of tags files for a tag, and return tag queue.
-diff -c -r -N /usr/local/src/nvi-1.79/include/ex_def.h ./include/ex_def.h
-*** /usr/local/src/nvi-1.79/include/ex_def.h Wed Oct 23 22:53:09 1996
---- ./include/ex_def.h Fri Aug 14 01:41:14 1998
-***************
-*** 47,78 ****
- #define C_RECOVER 46
- #define C_RESIZE 47
- #define C_REWIND 48
-! #define C_SUBSTITUTE 49
-! #define C_SCRIPT 50
-! #define C_SET 51
-! #define C_SHELL 52
-! #define C_SOURCE 53
-! #define C_STOP 54
-! #define C_SUSPEND 55
-! #define C_T 56
-! #define C_TAG 57
-! #define C_TAGNEXT 58
-! #define C_TAGPOP 59
-! #define C_TAGPREV 60
-! #define C_TAGTOP 61
-! #define C_TCLCMD 62
-! #define C_UNDO 63
-! #define C_UNABBREVIATE 64
-! #define C_UNMAP 65
-! #define C_V 66
-! #define C_VERSION 67
-! #define C_VISUAL_EX 68
-! #define C_VISUAL_VI 69
-! #define C_VIUSAGE 70
-! #define C_WRITE 71
-! #define C_WN 72
-! #define C_WQ 73
-! #define C_XIT 74
-! #define C_YANK 75
-! #define C_Z 76
-! #define C_SUBTILDE 77
---- 47,79 ----
- #define C_RECOVER 46
- #define C_RESIZE 47
- #define C_REWIND 48
-! #define C_RTAG 49
-! #define C_SUBSTITUTE 50
-! #define C_SCRIPT 51
-! #define C_SET 52
-! #define C_SHELL 53
-! #define C_SOURCE 54
-! #define C_STOP 55
-! #define C_SUSPEND 56
-! #define C_T 57
-! #define C_TAG 58
-! #define C_TAGNEXT 59
-! #define C_TAGPOP 60
-! #define C_TAGPREV 61
-! #define C_TAGTOP 62
-! #define C_TCLCMD 63
-! #define C_UNDO 64
-! #define C_UNABBREVIATE 65
-! #define C_UNMAP 66
-! #define C_V 67
-! #define C_VERSION 68
-! #define C_VISUAL_EX 69
-! #define C_VISUAL_VI 70
-! #define C_VIUSAGE 71
-! #define C_WRITE 72
-! #define C_WN 73
-! #define C_WQ 74
-! #define C_XIT 75
-! #define C_YANK 76
-! #define C_Z 77
-! #define C_SUBTILDE 78
-diff -c -r -N /usr/local/src/nvi-1.79/include/ex_extern.h ./include/ex_extern.h
-*** /usr/local/src/nvi-1.79/include/ex_extern.h Wed Oct 23 22:53:10 1996
---- ./include/ex_extern.h Fri Aug 14 01:41:14 1998
-***************
-*** 89,94 ****
---- 89,95 ----
- char *, size_t, char **, size_t *, regex_t *, u_int));
- void re_error __P((SCR *, int, regex_t *));
- int ex_tag_first __P((SCR *, char *));
-+ int ex_rtag_push __P((SCR *, EXCMD *));
- int ex_tag_push __P((SCR *, EXCMD *));
- int ex_tag_next __P((SCR *, EXCMD *));
- int ex_tag_prev __P((SCR *, EXCMD *));
-diff -c -r -N /usr/local/src/nvi-1.79/include/options_def.h ./include/options_def.h
-*** /usr/local/src/nvi-1.79/include/options_def.h Wed Oct 23 22:53:10 1996
---- ./include/options_def.h Fri Aug 14 01:41:14 1998
-***************
-*** 16,79 ****
- #define O_EXTENDED 15
- #define O_FILEC 16
- #define O_FLASH 17
-! #define O_HARDTABS 18
-! #define O_ICLOWER 19
-! #define O_IGNORECASE 20
-! #define O_KEYTIME 21
-! #define O_LEFTRIGHT 22
-! #define O_LINES 23
-! #define O_LISP 24
-! #define O_LIST 25
-! #define O_LOCKFILES 26
-! #define O_MAGIC 27
-! #define O_MATCHTIME 28
-! #define O_MESG 29
-! #define O_MODELINE 30
-! #define O_MSGCAT 31
-! #define O_NOPRINT 32
-! #define O_NUMBER 33
-! #define O_OCTAL 34
-! #define O_OPEN 35
-! #define O_OPTIMIZE 36
-! #define O_PARAGRAPHS 37
-! #define O_PATH 38
-! #define O_PRINT 39
-! #define O_PROMPT 40
-! #define O_READONLY 41
-! #define O_RECDIR 42
-! #define O_REDRAW 43
-! #define O_REMAP 44
-! #define O_REPORT 45
-! #define O_RULER 46
-! #define O_SCROLL 47
-! #define O_SEARCHINCR 48
-! #define O_SECTIONS 49
-! #define O_SECURE 50
-! #define O_SHELL 51
-! #define O_SHELLMETA 52
-! #define O_SHIFTWIDTH 53
-! #define O_SHOWMATCH 54
-! #define O_SHOWMODE 55
-! #define O_SIDESCROLL 56
-! #define O_SLOWOPEN 57
-! #define O_SOURCEANY 58
-! #define O_TABSTOP 59
-! #define O_TAGLENGTH 60
-! #define O_TAGS 61
-! #define O_TERM 62
-! #define O_TERSE 63
-! #define O_TILDEOP 64
-! #define O_TIMEOUT 65
-! #define O_TTYWERASE 66
-! #define O_VERBOSE 67
-! #define O_W1200 68
-! #define O_W300 69
-! #define O_W9600 70
-! #define O_WARN 71
-! #define O_WINDOW 72
-! #define O_WINDOWNAME 73
-! #define O_WRAPLEN 74
-! #define O_WRAPMARGIN 75
-! #define O_WRAPSCAN 76
-! #define O_WRITEANY 77
-! #define O_OPTIONCOUNT 78
---- 16,80 ----
- #define O_EXTENDED 15
- #define O_FILEC 16
- #define O_FLASH 17
-! #define O_GTAGSMODE 18
-! #define O_HARDTABS 19
-! #define O_ICLOWER 20
-! #define O_IGNORECASE 21
-! #define O_KEYTIME 22
-! #define O_LEFTRIGHT 23
-! #define O_LINES 24
-! #define O_LISP 25
-! #define O_LIST 26
-! #define O_LOCKFILES 27
-! #define O_MAGIC 28
-! #define O_MATCHTIME 29
-! #define O_MESG 30
-! #define O_MODELINE 31
-! #define O_MSGCAT 32
-! #define O_NOPRINT 33
-! #define O_NUMBER 34
-! #define O_OCTAL 35
-! #define O_OPEN 36
-! #define O_OPTIMIZE 37
-! #define O_PARAGRAPHS 38
-! #define O_PATH 39
-! #define O_PRINT 40
-! #define O_PROMPT 41
-! #define O_READONLY 42
-! #define O_RECDIR 43
-! #define O_REDRAW 44
-! #define O_REMAP 45
-! #define O_REPORT 46
-! #define O_RULER 47
-! #define O_SCROLL 48
-! #define O_SEARCHINCR 49
-! #define O_SECTIONS 50
-! #define O_SECURE 51
-! #define O_SHELL 52
-! #define O_SHELLMETA 53
-! #define O_SHIFTWIDTH 54
-! #define O_SHOWMATCH 55
-! #define O_SHOWMODE 56
-! #define O_SIDESCROLL 57
-! #define O_SLOWOPEN 58
-! #define O_SOURCEANY 59
-! #define O_TABSTOP 60
-! #define O_TAGLENGTH 61
-! #define O_TAGS 62
-! #define O_TERM 63
-! #define O_TERSE 64
-! #define O_TILDEOP 65
-! #define O_TIMEOUT 66
-! #define O_TTYWERASE 67
-! #define O_VERBOSE 68
-! #define O_W1200 69
-! #define O_W300 70
-! #define O_W9600 71
-! #define O_WARN 72
-! #define O_WINDOW 73
-! #define O_WINDOWNAME 74
-! #define O_WRAPLEN 75
-! #define O_WRAPMARGIN 76
-! #define O_WRAPSCAN 77
-! #define O_WRITEANY 78
-! #define O_OPTIONCOUNT 79
-diff -c -r -N /usr/local/src/nvi-1.79/vi/v_ex.c ./vi/v_ex.c
-*** /usr/local/src/nvi-1.79/vi/v_ex.c Mon Sep 16 05:03:02 1996
---- ./vi/v_ex.c Fri Aug 14 01:41:14 1998
-***************
-*** 226,231 ****
---- 226,236 ----
- ARGS *ap[2], a;
- EXCMD cmd;
-
-+ #ifdef GTAGS
-+ if (O_ISSET(sp, O_GTAGSMODE) && vp->m_start.cno == 0)
-+ ex_cinit(&cmd, C_RTAG, 0, OOBLNO, 0, 0, ap);
-+ else
-+ #endif
- ex_cinit(&cmd, C_TAG, 0, OOBLNO, 0, 0, ap);
- ex_cadd(&cmd, &a, VIP(sp)->keyw, strlen(VIP(sp)->keyw));
- return (v_exec_ex(sp, vp, &cmd));
diff --git a/contrib/global/systags/Makefile b/contrib/global/systags/Makefile
deleted file mode 100644
index 08d4040..0000000
--- a/contrib/global/systags/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-beforeinstall:
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- ${.CURDIR}/systags.sh ${DESTDIR}${BINDIR}/systags
-
-.include <bsd.prog.mk>
diff --git a/contrib/global/systags/systags.sh b/contrib/global/systags/systags.sh
deleted file mode 100755
index 97f43e2..0000000
--- a/contrib/global/systags/systags.sh
+++ /dev/null
@@ -1,247 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 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.
-#
-# systags.sh 17-Aug-98
-#
-# script to make hypertext of kernel source.
-# support OS: FreeBSD, NetBSD, OpenBSD, Linux, GNUmach, GNUhurd
-#
-while case $1 in
- -*)
- if grep '[^-cfgn]' <<! >/dev/null 2>&1; then
-$1
-!
- echo "usage: systags [-c][-f][-g][-n][dir]"
- exit 1
- fi
- case $1 in
- *c*) cflag=c;;
- esac
- case $1 in
- *f*) fflag=f;;
- esac
- case $1 in
- *g*) gflag=g;;
- esac
- case $1 in
- *n*) nflag=n;;
- esac
- ;;
- *) false;;
- esac
-do
- shift
-done
-case $1 in
-"") dir=.;;
-*) dir=$1;;
-esac
-if [ ! -d $dir -o ! -w $dir ]; then
- echo "systags: '$dir' is not a directory or not writable."
- exit 1
-fi
-tmpdir=$dir/systags_tmpdir_$$
-#
-# get release number from source tree.
-#
-if [ -f conf/newvers.sh ]; then
- # (Free|Net|Open)BSD?
- if ! mkdir $tmpdir 2>/dev/null; then
- echo "systags: '$dir' is not writable."
- exit 1
- fi
- cwd=`pwd`
- (cd $tmpdir; sh $cwd/conf/newvers.sh)
- os=`awk -F\" '/char[ \t]+ostype\[\][ \t]*=[ \t]*\"[^"]+\"/ {print $2}' < $tmpdir/vers.c`;
- release=`awk -F\" '/char[ \t]+osrelease\[\][ \t]*=[ \t]*\"[^"]+\"/ {print $2}' < $tmpdir/vers.c`;
- rm -rf $tmpdir
-elif [ -f Makefile ] && grep '^vmlinux:' Makefile >/dev/null; then
- # Linux?
- os=Linux
- version=`awk -F= '/^VERSION *=/ {print $2}' < Makefile`
- patchlevel=`awk -F= '/^PATCHLEVEL *=/ {print $2}' < Makefile`
- sublevel=`awk -F= '/^SUBLEVEL *=/ {print $2}' < Makefile`
- release=`echo "$version.$patchlevel.$sublevel" | tr -d ' '`
-elif [ -f version.c ]; then
- # GNU mach?
- version=`awk -F\" '/char[ \t]+version\[\][ \t]*=[ \t]*\"[^"]+\"/ {print $2}' < version.c`
- os=`echo $version | awk '{print $1}'`
- release=`echo $version | awk '{print $2}'`
-elif [ -f version.h ]; then
- # GNU hurd?
- release=`awk -F\" '/^#define[ \t]+HURD_VERSION[ \t]+"[^"]+\"/ {print $2}' < version.h`
- if [ ${release}X != X ]; then
- os=GNUhurd
- fi
-fi
-#
-# remove old files
-#
-files=
-for f in htags.log gtags.log GTAGS GRTAGS GSYMS GPATH HTML; do
- files="$files $dir/$f";
-done
-com="rm -rf $files"
-case $nflag in
-n) echo $com;;
-*) eval $com;;
-esac
-#
-# FreeBSD System macros.
-#
-# These macros with argument are used out of function.
-# gctags(1) knows these are not function by '.notfunction' list.
-#
-# kernel.h MAKE_SET,TEXT_SET,DATA_SET,BSS_SET,ABS_SET,
-# SYSINIT,SYSINIT_KT,SYSINIT_KP,PSEUDO_SET
-# sysctl.h SYSCTL_OID,SYSCTL_NODE,SYSCTL_STRING,SYSCTL_INT,SYSCTL_OPAQUE,
-# SYSCTL_STRUCT,SYSCTL_PROC
-# domain.h DOMAIN_SET
-# mount.h VFS_SET
-# lkm.h MOD_DECL,MOD_SYSCALL,MOD_VFS,MOD_DEV,MOD_EXEC,MOD_MISC
-# vnode.h VNODEOP_SET
-# spl.h GENSPL
-# queue.h SLIST_HEAD,SLIST_ENTRY,SLIST_INIT,SLIST_INSERT_AFTER,
-# SLIST_INSERT_HEAD,SLIST_REMOVE_HEAD,SLIST_REMOVE,STAILQ_HEAD,
-# STAILQ_ENTRY,STAILQ_INIT,STAILQ_INSERT_HEAD,STAILQ_INSERT_TAIL,
-# STAILQ_INSERT_AFTER,STAILQ_REMOVE_HEAD,STAILQ_REMOVE,
-# LIST_HEAD,LIST_ENTRY,LIST_INIT,LIST_INSERT_AFTER,LIST_INSERT_BEFORE,
-# LIST_INSERT_HEAD,LIST_REMOVE,TAILQ_HEAD,TAILQ_ENTRY,
-# TAILQ_EMPTY,TAILQ_FIRST,TAILQ_LAST,TAILQ_NEXT,TAILQ_PREV,
-# TAILQ_INIT,TAILQ_INSERT_HEAD,TAILQ_INSERT_TAIL,TAILQ_INSERT_AFTER,
-# TAILQ_INSERT_BEFORE,TAILQ_REMOVE,CIRCLEQ_HEAD,CIRCLEQ_ENTRY,
-# CIRCLEQ_INIT,CIRCLEQ_INSERT_AFTER,CIRCLEQ_INSERT_BEFORE,
-# CIRCLEQ_INSERT_HEAD,CIRCLEQ_INSERT_TAIL,CIRCLEQ_REMOVE
-#
-case $os in
-FreeBSD)
- cat <<-! >.notfunction
- MAKE_SET
- TEXT_SET
- DATA_SET
- BSS_SET
- ABS_SET
- SYSINIT
- SYSINIT_KT
- SYSINIT_KP
- PSEUDO_SET
- SYSCTL_OID
- SYSCTL_NODE
- SYSCTL_STRING
- SYSCTL_INT
- SYSCTL_OPAQUE
- SYSCTL_STRUCT
- SYSCTL_PROC
- DOMAIN_SET
- VFS_SET
- MOD_DECL
- MOD_SYSCALL
- MOD_VFS
- MOD_DEV
- MOD_EXEC
- MOD_MISC
- VNODEOP_SET
- GENSPL
- SLIST_HEAD
- SLIST_ENTRY
- SLIST_INIT
- SLIST_INSERT_AFTER
- SLIST_INSERT_HEAD
- SLIST_REMOVE_HEAD
- SLIST_REMOVE
- STAILQ_HEAD
- STAILQ_ENTRY
- STAILQ_INIT
- STAILQ_INSERT_HEAD
- STAILQ_INSERT_TAIL
- STAILQ_INSERT_AFTER
- STAILQ_REMOVE_HEAD
- STAILQ_REMOVE
- LIST_HEAD
- LIST_ENTRY
- LIST_INIT
- LIST_INSERT_AFTER
- LIST_INSERT_BEFORE
- LIST_INSERT_HEAD
- LIST_REMOVE
- TAILQ_HEAD
- TAILQ_ENTRY
- TAILQ_EMPTY
- TAILQ_FIRST
- TAILQ_LAST
- TAILQ_NEXT
- TAILQ_PREV
- TAILQ_INIT
- TAILQ_INSERT_HEAD
- TAILQ_INSERT_TAIL
- TAILQ_INSERT_AFTER
- TAILQ_INSERT_BEFORE
- TAILQ_REMOVE
- CIRCLEQ_HEAD
- CIRCLEQ_ENTRY
- CIRCLEQ_INIT
- CIRCLEQ_INSERT_AFTER
- CIRCLEQ_INSERT_BEFORE
- CIRCLEQ_INSERT_HEAD
- CIRCLEQ_INSERT_TAIL
- CIRCLEQ_REMOVE
-!
-esac
-#
-# make global database(GTAGS, GRTAGS).
-#
-com="gtags -owv $dir > $dir/gtags.log 2>&1"
-case $nflag in
-n) echo $com;;
-*) eval $com;;
-esac
-case $? in
-0) ;;
-*) exit 1;;
-esac
-case $gflag in
-g) exit 0;;
-esac
-#
-# make hypertext.
-# (please replace this title with a suitable one.)
-#
-if [ ${os}X != X -a ${release}X != X ]; then
- title="Welcome to $os $release kernel source tour!"
-else
- program=`/bin/pwd | sed 's/.*\///'`
- title="Welcome to $program source tour!"
-fi
-com="htags -${cflag}${fflag}lhnvat '$title' -d $dir $dir > $dir/htags.log 2>&1"
-case $nflag in
-n) echo $com;;
-*) eval $com;;
-esac
OpenPOWER on IntegriCloud