diff options
| author | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-18 06:59:19 +0000 |
|---|---|---|
| committer | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-18 06:59:19 +0000 |
| commit | 7887cea99911ffdceaf8033c738b38b8ea9329cc (patch) | |
| tree | ed58b03e5114161567409a2137870f052143bae0 /contrib/global/lib | |
| parent | 3ba3e2cc4b63fa16707f51e735e751e62dd9526e (diff) | |
Diffstat (limited to 'contrib/global/lib')
| -rw-r--r-- | contrib/global/lib/Makefile.generic | 14 | ||||
| -rw-r--r-- | contrib/global/lib/dbio.c | 328 | ||||
| -rw-r--r-- | contrib/global/lib/dbio.h | 89 | ||||
| -rw-r--r-- | contrib/global/lib/dbname.c | 48 | ||||
| -rw-r--r-- | contrib/global/lib/dbname.h | 53 | ||||
| -rw-r--r-- | contrib/global/lib/gtagsopen.c | 100 | ||||
| -rw-r--r-- | contrib/global/lib/gtagsopen.h | 41 | ||||
| -rw-r--r-- | contrib/global/lib/lookup.c | 64 | ||||
| -rw-r--r-- | contrib/global/lib/lookup.h | 50 | ||||
| -rw-r--r-- | contrib/global/lib/strop.c | 121 | ||||
| -rw-r--r-- | contrib/global/lib/strop.h | 52 | ||||
| -rw-r--r-- | contrib/global/lib/tag.c | 85 | ||||
| -rw-r--r-- | contrib/global/lib/tag.h | 51 |
13 files changed, 0 insertions, 1096 deletions
diff --git a/contrib/global/lib/Makefile.generic b/contrib/global/lib/Makefile.generic deleted file mode 100644 index 2cd87fbd2e21..000000000000 --- a/contrib/global/lib/Makefile.generic +++ /dev/null @@ -1,14 +0,0 @@ -LIB = libutil.a -CC = gcc -AR = ar -CFLAGS = -O -I../lib -I/usr/include/db -OBJS = tag.o tab.o strop.o mgets.o lookup.o gtagsopen.o getdbpath.o \ - find.o dbname.o dbio.o test.o makepath.o locatestring.o -all: $(LIB) - -$(LIB): $(OBJS) - $(AR) cq $(LIB) $(OBJS) -install: - @echo -n -clean: - rm -f $(LIB) $(OBJS) diff --git a/contrib/global/lib/dbio.c b/contrib/global/lib/dbio.c deleted file mode 100644 index c29a91477bdb..000000000000 --- a/contrib/global/lib/dbio.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redilogibution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redilogibutions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redilogibutions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the dilogibution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * dbio.c 14-Dec-97 - * - */ -#include <sys/stat.h> - -#include <fcntl.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include "dbio.h" -#include "die.h" -#include "test.h" - -DBT key; /* key of record */ -DBT dat; /* data of record */ -/* - * db_open: open db database. - * - * i) dbname database name - * i) mode 0: read only, 1: write only, 2: read & write - * i) perm file permission - * i) flags - * DBIO_DUP: allow duplicate records. - * DBIO_REMOVE: remove on closed. - * r) descripter for db_xxx() - * - * db_open leaves database permission 0600. please chmod(2) to make public. - */ -DBIO * -db_open(dbname, mode, perm, flags) -char *dbname; -int mode; -int perm; -int flags; -{ - DB *db; - int rw; - BTREEINFO info; - DBIO *dbio; - - /* - * setup argments. - */ - if (mode == 0) - rw = O_RDONLY; - else if (mode == 1) - rw = O_RDWR|O_CREAT|O_TRUNC; - else if (mode == 2) - rw = O_RDWR; - else - die("db_open illegal mode."); - info.flags = (flags & DBIO_DUP) ? R_DUP : 0; - info.cachesize = 500000; - info.maxkeypage = 0; - info.minkeypage = 0; - info.psize = 0; - info.compare = NULL; - info.prefix = NULL; - info.lorder = LITTLE_ENDIAN; - - /* - * if unlink do job normally, those who already open tag file can use - * it until closing. - */ - if (mode == 1 && test("f", dbname)) - (void)unlink(dbname); - db = dbopen(dbname, rw, 0600, DB_BTREE, &info); - if (!db) - die1("db_open failed (dbname = %s).", dbname); - if (!(dbio = (DBIO *)malloc(sizeof(DBIO)))) - die("short of memory."); - strcpy(dbio->dbname, dbname); - dbio->db = db; - dbio->openflags = flags; - dbio->perm = (mode == 1) ? perm : 0; - dbio->lastkey = (char *)0; - dbio->lastdat = (char *)0; - - return dbio; -} -/* - * db_get: get data by a key. - * - * i) dbio descripter - * i) k key - * r) pointer to data - */ -char * -db_get(dbio, k) -DBIO *dbio; -char *k; -{ - DB *db = dbio->db; - int status; - - key.data = k; - key.size = strlen(k)+1; - - status = (*db->get)(db, &key, &dat, 0); - dbio->lastkey = (char *)key.data; - dbio->lastdat = (char *)dat.data; - switch (status) { - case RET_SUCCESS: - break; - case RET_ERROR: - die("db_get failed."); - case RET_SPECIAL: - return((char *)0); - } - return((char *)dat.data); -} -/* - * db_put: put data by a key. - * - * i) dbio descripter - * i) k key - * i) d data - */ -void -db_put(dbio, k, d) -DBIO *dbio; -char *k; -char *d; -{ - DB *db = dbio->db; - int status; - - if (strlen(k) > MAXKEYLEN) - die("primary key too long."); - key.data = k; - key.size = strlen(k)+1; - dat.data = d; - dat.size = strlen(d)+1; - - status = (*db->put)(db, &key, &dat, 0); - switch (status) { - case RET_SUCCESS: - break; - case RET_ERROR: - case RET_SPECIAL: - die("db_put failed."); - } -} -/* - * db_del: delete record by a key. - * - * i) dbio descripter - * i) k key - */ -void -db_del(dbio, k) -DBIO *dbio; -char *k; -{ - DB *db = dbio->db; - int status; - - if (k) { - key.data = k; - key.size = strlen(k)+1; - status = (*db->del)(db, &key, 0); - } else - status = (*db->del)(db, &key, R_CURSOR); - if (status == RET_ERROR) - die("db_del failed."); -} -/* - * db_first: get first record. - * - * i) dbio dbio descripter - * i) k key - * !=NULL: indexed read by key - * ==NULL: sequential read - * i) flags following db_next call take over this. - * DBIO_KEY read key part - * DBIO_PREFIX prefix read - * DBIO_SKIPMETA skip META record - * only valied when sequential read - * r) data - */ -char * -db_first(dbio, k, flags) -DBIO *dbio; -char *k; -int flags; -{ - DB *db = dbio->db; - int status; - - if (flags & DBIO_PREFIX && !k) - flags &= ~DBIO_PREFIX; - if (flags & DBIO_SKIPMETA && k) - flags &= ~DBIO_SKIPMETA; - if (k) { - if (strlen(k) > MAXKEYLEN) - die("primary key too long."); - strcpy(dbio->key, k); - key.data = k; - key.size = strlen(k); - /* - * includes NULL character unless prefix read. - */ - if (!(flags & DBIO_PREFIX)) - key.size++; - dbio->keylen = key.size; - status = (*db->seq)(db, &key, &dat, R_CURSOR); - } else { - dbio->keylen = dbio->key[0] = 0; - for (status = (*db->seq)(db, &key, &dat, R_FIRST); - status == RET_SUCCESS && - flags & DBIO_SKIPMETA && - *((char *)dat.data) == ' '; - status = (*db->seq)(db, &key, &dat, R_NEXT)) - ; - } - dbio->lastkey = (char *)key.data; - dbio->lastdat = (char *)dat.data; - switch (status) { - case RET_SUCCESS: - break; - case RET_ERROR: - die("db_first failed."); - case RET_SPECIAL: - return ((char *)0); - } - dbio->ioflags = flags; - if (flags & DBIO_PREFIX) { - if (strncmp((char *)key.data, dbio->key, dbio->keylen)) - return (char *)0; - } else if (dbio->keylen) { - if (strcmp((char *)key.data, dbio->key)) - return (char *)0; - } - if (flags & DBIO_KEY) { - strcpy(dbio->prev, (char *)key.data); - return (char *)key.data; - } - return ((char *)dat.data); -} -/* - * db_next: get next record. - * - * i) dbio dbio descripter - * r) data - */ -char * -db_next(dbio) -DBIO *dbio; -{ - DB *db = dbio->db; - int flags = dbio->ioflags; - int status; - - while ((status = (*db->seq)(db, &key, &dat, R_NEXT)) == RET_SUCCESS) { - if (flags & DBIO_SKIPMETA) { - if (*((char *)dat.data) == ' ') - continue; - } - if (flags & DBIO_KEY) { - if (!strcmp(dbio->prev, (char *)key.data)) - continue; - if (strlen((char *)key.data) > MAXKEYLEN) - die("primary key too long."); - strcpy(dbio->prev, (char *)key.data); - } - dbio->lastkey = (char *)key.data; - dbio->lastdat = (char *)dat.data; - if (flags & DBIO_PREFIX) { - if (strncmp((char *)key.data, dbio->key, dbio->keylen)) - return (char *)0; - } else if (dbio->keylen) { - if (strcmp((char *)key.data, dbio->key)) - return (char *)0; - } - return (flags & DBIO_KEY) ? (char *)key.data : (char *)dat.data; - } - if (status == RET_ERROR) - die("db_next failed."); - return (char *)0; -} -/* - * db_close: close db - * - * i) dbio dbio descripter - */ -void -db_close(dbio) -DBIO *dbio; -{ - DB *db = dbio->db; - (void)db->close(db); - if (dbio->openflags & DBIO_REMOVE) - (void)unlink(dbio->dbname); - else if (dbio->perm && chmod(dbio->dbname, dbio->perm) < 0) - die("cannot change file mode."); - (void)free(dbio); -} diff --git a/contrib/global/lib/dbio.h b/contrib/global/lib/dbio.h deleted file mode 100644 index 7c1994e86d69..000000000000 --- a/contrib/global/lib/dbio.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redilogibution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redilogibutions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redilogibutions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the dilogibution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * dbio.h 14-Dec-97 - * - */ -#ifndef _DBIO_H_ -#define _DBIO_H_ - -#include <db.h> -#include <sys/param.h> - -#ifndef LITTLE_ENDIAN -#define LITTLE_ENDIAN 1234 -#endif -#ifndef BIG_ENDIAN -#define BIG_ENDIAN 4321 -#endif - -#define MAXKEYLEN 300 - -typedef struct { - DB *db; /* descripter of DB */ - char dbname[MAXPATHLEN+1]; /* dbname */ - char key[MAXKEYLEN+1]; /* key */ - int keylen; /* key length */ - char prev[MAXKEYLEN+1]; /* previous key value */ - char *lastkey; /* the key of last located record */ - char *lastdat; /* the data of last located record */ - int openflags; /* flags of db_open() */ - int ioflags; /* flags of db_first() */ - int perm; /* file permission */ -} DBIO; - -/* - * openflags - */ -#define DBIO_DUP 1 /* allow duplicate records */ -#define DBIO_REMOVE 2 /* remove file when closed */ -/* - * ioflags - */ -#define DBIO_KEY 1 /* read key part */ -#define DBIO_PREFIX 2 /* prefixed read */ -#define DBIO_SKIPMETA 4 /* skip META record */ - -#ifndef __P -#if defined(__STDC__) -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -DBIO *db_open __P((char *, int, int, int)); -char *db_get __P((DBIO *, char *)); -void db_put __P((DBIO *, char *, char *)); -void db_del __P((DBIO *, char *)); -char *db_first __P((DBIO *, char *, int)); -char *db_next __P((DBIO *)); -void db_close __P((DBIO *)); -#endif /* _DBIO_H_ */ diff --git a/contrib/global/lib/dbname.c b/contrib/global/lib/dbname.c deleted file mode 100644 index 1e68b3a2bf4a..000000000000 --- a/contrib/global/lib/dbname.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * dbname.c 20-Oct-97 - * - */ -#include "dbname.h" - -static char *tagslist[] = {"GTAGS", "GRTAGS", "GSYMS"}; -/* - * dbname: return db name - * - * i) db 0: GTAGS, 1: GRTAGS, 2: GSYMS - * r) dbname - */ -char * -dbname(db) -int db; -{ - return tagslist[db]; -} diff --git a/contrib/global/lib/dbname.h b/contrib/global/lib/dbname.h deleted file mode 100644 index 17eba363eda4..000000000000 --- a/contrib/global/lib/dbname.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * dbname.h 16-Oct-97 - * - */ - -#ifndef _DBNAME_H_ -#define _DBNAME_H_ - -#ifndef __P -#if defined(__STDC__) -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -#define GTAGS 0 -#define GRTAGS 1 -#define GSYMS 2 -#define GTAGLIM 3 - -char *dbname __P((int)); - -#endif /* ! _DBNAME_H_ */ diff --git a/contrib/global/lib/gtagsopen.c b/contrib/global/lib/gtagsopen.c deleted file mode 100644 index 90f0481603f5..000000000000 --- a/contrib/global/lib/gtagsopen.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * gtagsopen.c 20-Oct-97 - * - */ -#include <sys/param.h> - -#include <ctype.h> -#include <db.h> -#include <fcntl.h> -#include <stdlib.h> - -#include "dbio.h" -#include "dbname.h" -#include "die.h" -#include "gtagsopen.h" -#include "makepath.h" - -#define VERSIONKEY " __.VERSION" -static int support_version = 1; /* accept this format version */ - -/* - * gtagsopen: open global database. - * - * i) dbpath dbpath directory - * i) db GTAGS, GRTAGS, GSYMS - * i) mode 0: read only - * 1: write only - * 2: read and write - * r) DB structure - * - * when error occurred, gtagopen doesn't return. - */ -DBIO * -gtagsopen(dbpath, db, mode) -char *dbpath; -int db; -int mode; -{ - DBIO *dbio; - int version_number; - char *p; - - /* - * allow duplicate records. - */ - dbio = db_open(makepath(dbpath, dbname(db)), mode, 0644, DBIO_DUP); - if (dbio == NULL) { - if (mode == 1) - die1("cannot make database (%s).", makepath(dbpath, dbname(db))); - die1("database not found (%s).", makepath(dbpath, dbname(db))); - } - if (mode == 1) { - /* nothing to do now */ - } else { - /* - * recognize format version of GTAGS. 'format version record' - * is saved as a META record in GTAGS and GRTAGS. - * if 'format version record' is not found, it's assumed - * version 1. - */ - if ((p = db_get(dbio, VERSIONKEY)) != NULL) { - for (p += strlen(VERSIONKEY); *p && isspace(*p); p++) - ; - version_number = atoi(p); - } else - version_number = 1; - if (version_number > support_version) - die("GTAGS seems new format. Please install the latest GLOBAL."); - } - return dbio; -} diff --git a/contrib/global/lib/gtagsopen.h b/contrib/global/lib/gtagsopen.h deleted file mode 100644 index 2afb2ab56892..000000000000 --- a/contrib/global/lib/gtagsopen.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * gtagsopen.h 16-Oct-97 - * - */ - -#ifndef _GTAGSOPEN_H_ -#define _GTAGSOPEN_H_ -#include "dbio.h" - -DBIO *gtagsopen __P((char *, int, int)); - -#endif /* ! _GTAGSOPEN_H_ */ diff --git a/contrib/global/lib/lookup.c b/contrib/global/lib/lookup.c deleted file mode 100644 index d317ba6f3434..000000000000 --- a/contrib/global/lib/lookup.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * lookup.c 20-Oct-97 - * - */ -#include "gtagsopen.h" -#include "lookup.h" -#include "dbio.h" -#include "die.h" -#include "dbname.h" - -static DBIO *dbio; -static int opened; - -void -lookupopen(dbpath) -char *dbpath; -{ - if (opened) - die("nested call to lookupopen."); - opened = 1; - dbio = gtagsopen(dbpath, GTAGS, 0); -} -int -lookup(name) -char *name; -{ - char *p = db_get(dbio, name); - return (p) ? 1 : 0; -} -void -lookupclose(void) -{ - db_close(dbio); - opened = 0; -} diff --git a/contrib/global/lib/lookup.h b/contrib/global/lib/lookup.h deleted file mode 100644 index 037102f53600..000000000000 --- a/contrib/global/lib/lookup.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * lookup.h 16-Oct-97 - * - */ - -#ifndef _LOOKUP_H_ -#define _LOOKUP_H_ - -#ifndef __P -#if defined(__STDC__) -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -void lookupopen __P((char *)); -int lookup __P((char *)); -void lookupclose __P((void)); - -#endif /* ! _LOOKUP_H_ */ diff --git a/contrib/global/lib/strop.c b/contrib/global/lib/strop.c deleted file mode 100644 index b024abca8371..000000000000 --- a/contrib/global/lib/strop.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * strop.c 20-Oct-97 - * - */ -#include <stdlib.h> -#include <string.h> - -#include "die.h" -#include "strop.h" - -/* - * usage: string buffer - * - * stropen(); - * for (s = string; *s; s++) - * strputc(*s); - * s = strclose(); - */ -#define EXPANDSIZE 80 -static char *sbuf; -static char *endp; -static char *curp; -static int sbufsize; -static int opened; - -void -stropen(void) -{ - if (opened) - die("nested call to stropen."); - opened = 1; - /* - * allocate initial buffer. - */ - if (!sbuf) - if (!(sbuf = (char *)malloc(sbufsize + 1))) - die("short of memory."); - curp = sbuf; - endp = sbuf + sbufsize; - *curp = 0; -} -void -strputs(s) -char *s; -{ - int length = strlen(s); - - strnputs(s, length); -} -void -strnputs(s, length) -char *s; -int length; -{ - if (curp + length > endp) { - int count = curp - sbuf; - - sbufsize += (length > EXPANDSIZE) ? length : EXPANDSIZE; - if (!(sbuf = (char *)realloc(sbuf, sbufsize + 1))) - die("short of memory."); - curp = sbuf + count; - endp = sbuf + sbufsize; - } - strncpy(curp, s, length); - curp += length; - *curp = 0; -} -void -strputc(c) -int c; -{ - if (curp + 1 > endp) { - int count = curp - sbuf; - - sbufsize += EXPANDSIZE; - if (!(sbuf = (char *)realloc(sbuf, sbufsize + 1))) - die("short of memory."); - curp = sbuf + count; - endp = sbuf + sbufsize; - } - *curp++ = c; - *curp = 0; -} -char * -strclose(void) -{ - opened = 0; - /* - * doesn't free area in current implementation. - */ - return sbuf; -} diff --git a/contrib/global/lib/strop.h b/contrib/global/lib/strop.h deleted file mode 100644 index 9289566d0097..000000000000 --- a/contrib/global/lib/strop.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * strop.h 16-Oct-97 - * - */ - -#ifndef _STROP_H_ -#define _STROP_H_ - -#ifndef __P -#if defined(__STDC__) -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -void stropen __P((void)); -void strputs __P((char *)); -void strnputs __P((char *, int)); -void strputc __P((int)); -char *strclose __P((void)); - -#endif /* ! _STROP_H_ */ diff --git a/contrib/global/lib/tag.c b/contrib/global/lib/tag.c deleted file mode 100644 index e80d634c2708..000000000000 --- a/contrib/global/lib/tag.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * tag.c 20-Oct-97 - * - */ -#include <ctype.h> -#include <string.h> - -#include "dbio.h" -#include "die.h" -#include "gtagsopen.h" -#include "locatestring.h" -#include "tab.h" -#include "tag.h" - - -static DBIO *dbio; -static int opened; - -void -tagopen(dbpath, db, mode) -char *dbpath; -int db; -int mode; -{ - if (opened) - die("nested call to tagopen."); - opened = 1; - dbio = gtagsopen(dbpath, db, mode); -} -void -tagput(entry, record) -char *entry; -char *record; -{ - entab(record); - db_put(dbio, entry, record); -} -void -tagdelete(path) -char *path; -{ - char *p; - int length = strlen(path); - - for (p = db_first(dbio, NULL, DBIO_SKIPMETA); p; p = db_next(dbio)) { - p = locatestring(p, "./", 0); - if (!strncmp(p, path, length) && isspace(*(p + length))) - db_del(dbio, NULL); - } -} -void -tagclose(void) -{ - db_close(dbio); - opened = 0; -} diff --git a/contrib/global/lib/tag.h b/contrib/global/lib/tag.h deleted file mode 100644 index 8bac2ac2f9b6..000000000000 --- a/contrib/global/lib/tag.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Shigio Yamaguchi. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * tag.h 16-Oct-97 - * - */ - -#ifndef _TAG_H_ -#define _TAG_H_ - -#ifndef __P -#if defined(__STDC__) -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -void tagopen __P((char *, int, int)); -void tagput __P((char *, char *)); -void tagdelete __P((char *)); -void tagclose __P((void)); - -#endif /* ! _TAG_H_ */ |
