Compare commits

..
Author SHA1 Message Date
cvs2svn 58fda9eaae This commit was manufactured by cvs2svn to create tag
'RELENG_2_2_5_RELEASE'.
1997-10-21 01:56:05 +00:00
2709 changed files with 100075 additions and 177446 deletions

No files matched your search

+38 -104
View File
@@ -1,15 +1,14 @@
#
# $Id: Makefile,v 1.109.2.24 1998/03/09 14:18:02 jkh Exp $
# $Id: Makefile,v 1.109.2.18 1997/09/17 23:50:26 rgrimes Exp $
#
# Make command line options:
# -DCLOBBER will remove /usr/include
# -DMAKE_KERBEROS4 to build KerberosIV
# -DMAKE_EBONES to build eBones (KerberosIV)
# -DALLLANG to build documentation for all languages
# (where available -- see share/doc/Makefile)
#
# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
# -DNOCLEAN do not clean at all
# -DNOTOOLS do not rebuild any tools first
# -DNOCRYPT will prevent building of crypt versions
# -DNOLKM do not build loadable kernel modules
# -DNOOBJDIR do not run ``${MAKE} obj''
@@ -18,7 +17,6 @@
# -DNOGAMES do not go into games subdir
# -DNOSHARE do not go into share subdir
# -DNOINFO do not make or install info files
# -DNOPERL do not make or install perl
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
#
@@ -41,13 +39,6 @@
# Put initial settings here.
SUBDIR=
# We must do share/info early so that installation of info `dir'
# entries works correctly. Do it first since it is less likely to
# grow dependencies on include and lib than vice versa.
.if exists(share/info)
SUBDIR+= share/info
.endif
# We must do include and lib first so that the perl *.ph generation
# works correctly as it uses the header files installed by this.
.if exists(include)
@@ -66,8 +57,8 @@ SUBDIR+= games
.if exists(gnu)
SUBDIR+= gnu
.endif
.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
SUBDIR+= kerberosIV
.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
SUBDIR+= eBones
.endif
.if exists(libexec)
SUBDIR+= libexec
@@ -155,7 +146,7 @@ world:
cd ${.CURDIR} && ${MAKE} pre-world
.endif
cd ${.CURDIR} && ${MAKE} buildworld
cd ${.CURDIR} && ${MAKE} -B installworld
cd ${.CURDIR} && ${MAKE} installworld
.if target(post-world)
@echo
@echo "--------------------------------------------------------------"
@@ -218,22 +209,14 @@ buildworld:
chflags -R noschg ${WORLDTMP}/
rm -rf ${WORLDTMP}
.endif
.if !defined(NOTOOLS)
@echo
@echo "--------------------------------------------------------------"
@echo " Making make"
@echo "--------------------------------------------------------------"
mkdir -p ${WORLDTMP}/usr/bin
.if !defined(NOCLEAN) || !defined(NOOBJDIR)
cd ${.CURDIR}/usr.bin/make && \
${IBMAKE} -I${.CURDIR}/share/mk ${CLEANDIR} ${OBJDIR}
.endif
cd ${.CURDIR}/usr.bin/make && \
${IBMAKE} -I${.CURDIR}/share/mk depend && \
${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all && \
${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install && \
${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean cleandepend
.endif
${IBMAKE} -I${.CURDIR}/share/mk ${OBJDIR} clean cleandepend depend && \
${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all install clean cleandepend
@echo
@echo "--------------------------------------------------------------"
@echo " Making hierarchy"
@@ -244,16 +227,15 @@ buildworld:
@echo "--------------------------------------------------------------"
@echo " Cleaning up the obj tree"
@echo "--------------------------------------------------------------"
cd ${.CURDIR} && ${BMAKE} par-${CLEANDIR}
cd ${.CURDIR} && ${BMAKE} ${CLEANDIR}
.endif
.if !defined(NOOBJDIR)
@echo
@echo "--------------------------------------------------------------"
@echo " Rebuilding the obj tree"
@echo "--------------------------------------------------------------"
cd ${.CURDIR} && ${BMAKE} par-obj
cd ${.CURDIR} && ${BMAKE} obj
.endif
.if !defined(NOTOOLS)
@echo
@echo "--------------------------------------------------------------"
@echo " Rebuilding bootstrap tools"
@@ -264,36 +246,31 @@ buildworld:
@echo " Rebuilding tools necessary to build the include files"
@echo "--------------------------------------------------------------"
cd ${.CURDIR} && ${BMAKE} include-tools
.endif
@echo
@echo "--------------------------------------------------------------"
@echo " Rebuilding /usr/include"
@echo "--------------------------------------------------------------"
cd ${.CURDIR} && SHARED=symlinks ${BMAKE} includes
.if !defined(NOTOOLS)
@echo
@echo "--------------------------------------------------------------"
@echo " Rebuilding tools needed to build the libraries"
@echo "--------------------------------------------------------------"
cd ${.CURDIR} && ${BMAKE} lib-tools
.endif
@echo
@echo "--------------------------------------------------------------"
@echo " Rebuilding /usr/lib"
@echo "--------------------------------------------------------------"
cd ${.CURDIR} && ${BMAKE} libraries
.if !defined(NOTOOLS)
@echo
@echo "--------------------------------------------------------------"
@echo " Rebuilding all other tools needed to build the world"
@echo "--------------------------------------------------------------"
cd ${.CURDIR} && ${BMAKE} build-tools
.endif
@echo
@echo "--------------------------------------------------------------"
@echo " Rebuilding dependencies"
@echo "--------------------------------------------------------------"
cd ${.CURDIR} && ${XMAKE} ${.MAKEFLAGS} par-depend
cd ${.CURDIR} && ${XMAKE} depend
@echo
@echo "--------------------------------------------------------------"
@echo " Building everything.."
@@ -327,11 +304,6 @@ reinstall:
cd ${.CURDIR} && ${MAKE} install
@echo
@echo "--------------------------------------------------------------"
@echo " Re-scanning the shared libraries.."
@echo "--------------------------------------------------------------"
cd ${.CURDIR} && ldconfig -R
@echo
@echo "--------------------------------------------------------------"
@echo " Rebuilding man page indexes"
@echo "--------------------------------------------------------------"
cd ${.CURDIR}/share/man && ${MAKE} makedb
@@ -379,8 +351,8 @@ most:
cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} all
cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} all
cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} all
#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
# cd ${.CURDIR}/kerberosIV && ${MAKE} ${.MAKEFLAGS} most
#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
# cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} most
#.endif
#.if !defined(NOSECURE) && !defined(NOCRYPT)
# cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} most
@@ -404,8 +376,8 @@ installmost:
cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} install
cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} install
cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} install
#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
# cd ${.CURDIR}/kerberos4 && ${MAKE} ${.MAKEFLAGS} installmost
#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
# cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} installmost
#.endif
#.if !defined(NOSECURE) && !defined(NOCRYPT)
# cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} installmost
@@ -441,14 +413,11 @@ bootstrap:
cd ${.CURDIR}/include && make symlinks
.endif
cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} -DNOLIB all && \
${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
${MAKE} ${MK_FLAGS} -DNOLIB all install ${CLEANDIR}
.if !defined(NOOBJDIR)
cd ${.CURDIR}/usr.bin/lex && ${MAKE} obj
.endif
@@ -462,9 +431,8 @@ bootstrap:
# on cleaned away headers in ${WORLDTMP}.
#
include-tools:
cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} -B cleandepend depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} cleandepend depend && \
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
#
# includes - possibly generate and install the include files.
@@ -475,22 +443,17 @@ includes:
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${DESTDIR}/usr/include
.endif
cd ${.CURDIR}/include && ${MAKE} -B all install
cd ${.CURDIR}/include && ${MAKE} all install
cd ${.CURDIR}/gnu/include && ${MAKE} install
cd ${.CURDIR}/gnu/lib/libreadline && ${MAKE} beforeinstall
cd ${.CURDIR}/gnu/lib/libregex && ${MAKE} beforeinstall
cd ${.CURDIR}/gnu/lib/libstdc++ && ${MAKE} beforeinstall
cd ${.CURDIR}/gnu/lib/libg++ && ${MAKE} beforeinstall
cd ${.CURDIR}/gnu/lib/libdialog && ${MAKE} beforeinstall
.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
cd ${.CURDIR}/kerberosIV/lib/libacl && ${MAKE} beforeinstall
cd ${.CURDIR}/kerberosIV/lib/libkadm && ${MAKE} beforeinstall
cd ${.CURDIR}/kerberosIV/lib/libkafs && ${MAKE} beforeinstall
cd ${.CURDIR}/kerberosIV/lib/libkdb && ${MAKE} beforeinstall
cd ${.CURDIR}/kerberosIV/lib/libkrb && ${MAKE} beforeinstall
cd ${.CURDIR}/kerberosIV/lib/libtelnet && ${MAKE} beforeinstall
.else
cd ${.CURDIR}/lib/libtelnet && ${MAKE} beforeinstall
.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
cd ${.CURDIR}/eBones/include && ${MAKE} beforeinstall
cd ${.CURDIR}/eBones/lib/libkrb && ${MAKE} beforeinstall
cd ${.CURDIR}/eBones/lib/libkadm && ${MAKE} beforeinstall
.endif
cd ${.CURDIR}/lib/csu/i386 && ${MAKE} beforeinstall
cd ${.CURDIR}/lib/libalias && ${MAKE} beforeinstall
@@ -535,8 +498,7 @@ lib-tools:
usr.bin/ranlib \
usr.bin/uudecode
cd ${.CURDIR}/$d && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endfor
#
@@ -545,53 +507,43 @@ lib-tools:
libraries:
.if exists(lib/csu/i386)
cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(lib/libcompat)
cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(lib/libncurses)
cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(lib/libtermcap)
cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(gnu)
cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(lib)
cd ${.CURDIR}/lib && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(usr.bin/lex/lib)
cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
cd ${.CURDIR}/kerberosIV/lib && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
cd ${.CURDIR}/eBones/lib && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
.if exists(usr.sbin/pcvt/keycap)
cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endif
#
@@ -662,25 +614,7 @@ build-tools:
usr.sbin/mtree \
usr.sbin/zic
cd ${.CURDIR}/$d && ${MAKE} depend && \
${MAKE} ${MK_FLAGS} all && \
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
.endfor
.for __target in clean cleandir obj depend
.for entry in ${SUBDIR}
${entry}.${__target}__D: .PHONY
if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
edir=${entry}.${MACHINE}; \
cd ${.CURDIR}/$${edir}; \
else \
${ECHODIR} "===> ${DIRPRFX}${entry}"; \
edir=${entry}; \
cd ${.CURDIR}/$${edir}; \
fi; \
${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
.endfor
par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
.endfor
.include <bsd.subdir.mk>
+3 -3
View File
@@ -1,5 +1,5 @@
This is the top level of the FreeBSD source directory. This file
was last revised on: $Id: README,v 1.7.2.1 1997/08/13 19:49:35 jkh Exp $
was last revised on: $Id: README,v 1.7 1997/01/01 14:06:29 jkh Exp $
For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
@@ -14,10 +14,10 @@ kernel and the contents of /etc. Please see the top of the Makefile
in this directory for more information on the standard build targets
and compile-time flags.
Building a kernel with config(8) is a somewhat more involved process,
Building a kernel with config(1) is a somewhat more involved process,
documentation for which can be found at:
http://www.freebsd.org/handbook/kernelconfig.html
And in the config(8) man page.
And in the config(1) man page.
The sample kernel configuration files reside in the sys/i386/conf
sub-directory (assuming that you've installed the kernel sources), the
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: chio.c,v 1.1.1.1.2.2 1997/08/24 10:29:16 jkh Exp $ */
/* $Id: chio.c,v 1.1.1.1.2.1 1997/06/06 16:02:01 charnier Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe <[email protected]>
@@ -374,7 +374,7 @@ do_params(cname, argc, argv)
/* No arguments to this command. */
if (argc) {
warnx("%s: no arguments expected", cname);
warnx("%s: no arguements expected", cname);
goto usage;
}
+2 -6
View File
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)chmod.1 8.4 (Berkeley) 3/31/94
.\" $Id: chmod.1,v 1.4.2.1 1997/02/28 07:54:25 mpp Exp $
.\" $Id: chmod.1,v 1.7 1997/02/22 14:01:29 peter Exp $
.\"
.Dd March 31, 1994
.Dt CHMOD 1
@@ -110,14 +110,10 @@ the following values:
.Bl -tag -width 6n -compact -offset indent
.It Li 4000
set-user-ID-on-execution
( see
.Xr chmod 2
for directories )
.It Li 2000
set-group-ID-on-execution
.It Li 1000
sticky bit, see
.Xr chmod 2
sticky bit, see chmod(2)
.It Li 0400
read by owner
.It Li 0200
+6 -21
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: utils.c,v 1.9.2.1 1997/08/24 10:34:49 jkh Exp $
* $Id: utils.c,v 1.9 1996/03/08 06:58:08 wosch Exp $
*/
#ifndef lint
@@ -60,8 +60,7 @@ copy_file(entp, dne)
{
static char buf[MAXBSIZE];
struct stat to_stat, *fs;
int ch, checkch, from_fd, rcount, rval, to_fd, wcount, wresid;
char *bufp;
int ch, checkch, from_fd, rcount, rval, to_fd, wcount;
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
char *p;
#endif
@@ -82,16 +81,13 @@ copy_file(entp, dne)
* modified by the umask.)
*/
if (!dne) {
#define YESNO "(y/n [n]) "
if (iflag) {
(void)fprintf(stderr, "overwrite %s? %s",
to.p_path, YESNO);
(void)fprintf(stderr, "overwrite %s? ", to.p_path);
checkch = ch = getchar();
while (ch != '\n' && ch != EOF)
ch = getchar();
if (checkch != 'y' && checkch != 'Y') {
(void)close(from_fd);
(void)fprintf(stderr, "not overwritten\n");
return (0);
}
}
@@ -129,13 +125,7 @@ copy_file(entp, dne)
warn("%s", entp->fts_path);
rval = 1;
} else {
for (bufp = p, wresid = fs->st_size; ;
bufp += wcount, wresid -= wcount) {
wcount = write(to_fd, bufp, wresid);
if (wcount >= wresid || wcount <= 0)
break;
}
if (wcount != wresid) {
if (write(to_fd, p, fs->st_size) != fs->st_size) {
warn("%s", to.p_path);
rval = 1;
}
@@ -149,13 +139,8 @@ copy_file(entp, dne)
#endif
{
while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) {
for (bufp = buf, wresid = rcount; ;
bufp += wcount, wresid -= wcount) {
wcount = write(to_fd, bufp, wresid);
if (wcount >= wresid || wcount <= 0)
break;
}
if (wcount != wresid) {
wcount = write(to_fd, buf, rcount);
if (rcount != wcount || wcount == -1) {
warn("%s", to.p_path);
rval = 1;
break;
+2 -3
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: csh.c,v 1.6.2.1 1997/08/24 21:41:29 jkh Exp $
* $Id: csh.c,v 1.6 1995/10/23 23:08:25 ache Exp $
*/
#ifndef lint
@@ -46,7 +46,6 @@ static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <fcntl.h>
#include <errno.h>
#include <pwd.h>
@@ -230,7 +229,7 @@ main(argc, argv)
*/
set(STRstatus, Strsave(STR0));
if ((tcp = getenv("HOME")) != NULL && strlen(tcp) < MAXPATHLEN)
if ((tcp = getenv("HOME")) != NULL)
cp = SAVE(tcp);
else
cp = NULL;
+2 -2
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: err.c,v 1.2.8.1 1997/08/24 21:41:31 jkh Exp $
* $Id: err.c,v 1.2 1994/09/24 02:53:57 davidg Exp $
*/
#ifndef lint
@@ -307,7 +307,7 @@ seterror(id, va_alist)
#endif
if (id < 0 || id > sizeof(errorlist) / sizeof(errorlist[0]))
id = ERR_INVALID;
vsnprintf(berr, sizeof(berr), errorlist[id], va);
vsprintf(berr, errorlist[id], va);
va_end(va);
seterr = strsave(berr);
+3 -3
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: file.c,v 1.4.2.1 1997/08/24 21:41:33 jkh Exp $
* $Id: file.c,v 1.4 1995/06/18 14:08:44 ache Exp $
*/
#ifndef lint
@@ -450,7 +450,7 @@ tsearch(word, command, max_word_length)
looking_for_lognames = (*word == '~') && (Strchr(word, '/') == NULL);
if (looking_for_lognames) {
setpwent();
(void) setpwent();
copyn(name, &word[1], MAXNAMLEN); /* name sans ~ */
dir_fd = NULL;
}
@@ -498,7 +498,7 @@ again: /* search for matches */
ignoring = FALSE;
nignored = 0;
if (looking_for_lognames)
setpwent();
(void) setpwent();
else
rewinddir(dir_fd);
goto again;
+1 -3
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: proc.c,v 1.2.8.1 1997/08/24 21:41:37 jkh Exp $
* $Id: proc.c,v 1.2 1994/09/24 02:54:13 davidg Exp $
*/
#ifndef lint
@@ -86,7 +86,6 @@ pchild(notused)
struct process *fp;
int pid;
extern int insource;
int save_errno = errno;
union wait w;
int jobflags;
struct rusage ru;
@@ -102,7 +101,6 @@ loop:
goto loop;
}
pnoprocesses = pid == -1;
errno = save_errno;
return;
}
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next)
+6 -6
View File
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)date.1 8.3 (Berkeley) 4/28/95
.\" $Id: date.1,v 1.8.2.6 1997/10/03 12:54:28 danny Exp $
.\" $Id: date.1,v 1.8.2.4 1997/09/14 13:07:03 jkh Exp $
.\"
.Dd November 17, 1993
.Dt DATE 1
@@ -43,14 +43,14 @@
.Nd display or set date and time
.Sh SYNOPSIS
.Nm date
.Op Fl nu
.Op Fl d Ar dst
.Op Fl r Ar seconds
.Op Fl t Ar minutes_west
.Op Fl v Ns Ar [+|-]val Ns Op ymwdHM
.Op Fl nu
.Op Cm + Ns Ar format
.Op Fl v Ar [+|-]val[ymwdHM]
.Ar ...
.Op Fl f Ar fmt Ar date | [[[[yy]mm]dd]HH]MM[\&.ss]
.Op Cm + Ns Ar format
.Sh DESCRIPTION
.Nm
displays the current date and time when invoked without arguments.
@@ -183,12 +183,12 @@ and years are handled automatically.
.Sh EXAMPLES
The command:
.Bd -literal -offset indent
date "+DATE: 19%y-%m-%d%nTIME: %H:%M:%S"
date ``+DATE: %m/%d/%y%nTIME: %H:%M:%S''
.Ed
.Pp
will display:
.Bd -literal -offset indent
DATE: 1987-11-21
DATE: 11/21/87
TIME: 13:36:16
.Ed
.Pp
+5 -6
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: date.c,v 1.7.2.6 1997/10/03 12:54:30 danny Exp $
* $Id: date.c,v 1.7.2.5 1997/10/01 06:12:58 danny Exp $
*/
#ifndef lint
@@ -187,9 +187,9 @@ setthetime(fmt, p)
lt = localtime(&tval);
return;
} else if (*t != '\0')
fprintf(stderr, "Warning: Ignoring %ld extraneous"
fprintf(stderr, "Warning: Ignoring %d extraneous"
" characters in date string (%s)\n",
(long) strlen(t), t);
strlen(t), t);
} else {
for (t = p, dot = NULL; *t; ++t) {
if (isdigit(*t))
@@ -276,8 +276,7 @@ static void
usage()
{
(void)fprintf(stderr, "%s\n%s\n",
"usage: date [-nu] [-d dst] [-r seconds] [-t west] "
"[-v[+|-]val[ymwdHM]] ... ",
" [-f fmt date | [[[[yy]mm]dd]HH]MM[.ss]] [+format]");
"usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format]",
" [-v [+|-]val[ymwdHM]] ... [-f fmt date | [[[[yy]mm]dd]HH]MM[.ss]]");
exit(1);
}
-28
View File
@@ -1,31 +1,3 @@
/*-
* Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
* 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.
*
* 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.
*
* $Id$
*/
#include <time.h>
#include <string.h>
#include <stdlib.h>
-28
View File
@@ -1,31 +1,3 @@
/*-
* Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
* 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.
*
* 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.
*
* $Id$
*/
struct vary {
char *arg;
struct vary *next;
+1 -4
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: args.c,v 1.3.8.2 1997/08/24 21:45:26 jkh Exp $
* $Id: args.c,v 1.3.8.1 1996/11/21 16:30:28 phk Exp $
*/
#ifndef lint
@@ -101,8 +101,6 @@ jcl(argv)
in.dbsz = out.dbsz = 512;
while ((oper = *++argv) != NULL) {
if ((oper = strdup(oper)) == NULL)
errx(1, "unable to allocate space for the argument \"%s\"", *argv);
if ((arg = strchr(oper, '=')) == NULL)
errx(1, "unknown operand %s", oper);
*arg++ = '\0';
@@ -284,7 +282,6 @@ static struct conv {
{ "oldebcdic", C_EBCDIC, C_ASCII, a2e_32V },
{ "oldibm", C_EBCDIC, C_ASCII, a2ibm_32V },
{ "osync", C_OSYNC, C_BS, NULL },
{ "sparse", C_SPARSE, 0, NULL },
{ "swab", C_SWAB, 0, NULL },
{ "sync", C_SYNC, 0, NULL },
{ "ucase", C_UCASE, C_LCASE, NULL },
+1 -8
View File
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)dd.1 8.2 (Berkeley) 1/13/94
.\" $Id: dd.1,v 1.2.8.2 1997/08/24 21:45:30 jkh Exp $
.\" $Id: dd.1,v 1.2.8.1 1997/02/28 07:54:33 mpp Exp $
.\"
.Dd January 13, 1994
.Dt DD 1
@@ -250,13 +250,6 @@ regularly sized blocks to be written.
This option is incompatible with use of the
.Cm bs= Ns Ar n
block size specification.
.It Cm sparse
If one or more output blocks would consist solely of
.Tn NUL
bytes, try to seek the output file by the required space instead of
filling them with
.Tn NULs ,
resulting in a sparse file.
.It Cm swab
Swap every pair of input bytes.
If an input buffer has an odd number of bytes, the last byte will be
+5 -34
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: dd.c,v 1.5.2.4 1998/01/09 09:13:06 joerg Exp $
* $Id: dd.c,v 1.5.2.2 1997/08/21 02:52:39 jlemon Exp $
*/
#ifndef lint
@@ -75,7 +75,6 @@ IO in, out; /* input/output state */
STAT st; /* statistics */
void (*cfunc) __P((void)); /* conversion function */
u_long cpy_cnt; /* # of blocks to copy */
u_long pending = 0; /* pending seek if sparse */
u_int ddflags; /* conversion options */
u_int cbsz; /* conversion block size */
u_int files_cnt = 1; /* # of files to copy */
@@ -316,7 +315,7 @@ dd_in()
}
if (ddflags & C_SWAB) {
if ((n = in.dbrcnt) & 1) {
if ((n = in.dbcnt) & 1) {
++st.swab;
--n;
}
@@ -348,7 +347,7 @@ dd_close()
memset(out.dbp, 0, out.dbsz - out.dbcnt);
out.dbcnt = out.dbsz;
}
if (out.dbcnt || pending)
if (out.dbcnt)
dd_out(1);
}
@@ -357,7 +356,7 @@ dd_out(force)
int force;
{
static int warned;
int cnt, n, nw, i, sparse;
int cnt, n, nw;
u_char *outp;
/*
@@ -379,35 +378,7 @@ dd_out(force)
outp = out.db;
for (n = force ? out.dbcnt : out.dbsz;; n = out.dbsz) {
for (cnt = n;; cnt -= nw) {
sparse = 0;
if (ddflags & C_SPARSE) {
sparse = 1; /* Is buffer sparse? */
for (i = 0; i < cnt; i++)
if (outp[i] != 0) {
sparse = 0;
break;
}
}
if (sparse && !force) {
pending += cnt;
nw = cnt;
} else {
if (pending != 0) {
if (force)
pending--;
if (lseek (out.fd, pending, SEEK_CUR) == -1)
err(2, "%s: seek error creating sparse file",
out.name);
if (force)
write(out.fd, outp, 1);
pending = 0;
}
if (cnt)
nw = write(out.fd, outp, cnt);
else
return;
}
nw = write(out.fd, outp, cnt);
if (nw <= 0) {
if (nw == 0)
errx(1, "%s: end of device", out.name);
+2 -3
View File
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)dd.h 8.3 (Berkeley) 4/2/94
* $Id: dd.h,v 1.2.8.2 1998/02/11 02:24:40 asami Exp $
* $Id: dd.h,v 1.2 1994/09/24 02:54:54 davidg Exp $
*/
/* Input/output stream state. */
@@ -69,7 +69,7 @@ typedef struct {
u_long out_part; /* # of partial output blocks */
u_long trunc; /* # of truncated records */
u_long swab; /* # of odd-length swab blocks */
u_int64_t bytes; /* # of bytes written */
u_long bytes; /* # of bytes written */
double start; /* start time of dd */
} STAT;
@@ -95,4 +95,3 @@ typedef struct {
#define C_UCASE 0x40000
#define C_UNBLOCK 0x80000
#define C_OSYNC 0x100000
#define C_SPARSE 0x200000
+2 -5
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: misc.c,v 1.2.8.3 1998/02/11 02:24:41 asami Exp $
* $Id: misc.c,v 1.2.8.1 1996/11/21 16:30:35 phk Exp $
*/
#ifndef lint
@@ -45,7 +45,6 @@ static char const sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
#include <sys/time.h>
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -82,7 +81,7 @@ summary()
(void)write(STDERR_FILENO, buf, strlen(buf));
}
(void)snprintf(buf, sizeof(buf),
"%qu bytes transferred in %.6f secs (%.0f bytes/sec)\n",
"%u bytes transferred in %.6f secs (%.0f bytes/sec)\n",
st.bytes, secs, st.bytes / secs);
(void)write(STDERR_FILENO, buf, strlen(buf));
}
@@ -92,10 +91,8 @@ void
summaryx(notused)
int notused;
{
int save_errno = errno;
summary();
errno = save_errno;
}
/* ARGSUSED */
+2 -2
View File
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)df.1 8.2 (Berkeley) 1/13/94
.\" $Id: df.1,v 1.4.2.2 1997/09/19 06:18:10 charnier Exp $
.\" $Id: df.1,v 1.4.2.1 1996/12/13 17:15:10 joerg Exp $
.\"
.Dd January 13, 1994
.Dt DF 1
@@ -96,7 +96,7 @@ or
``df -t local -t nomfs''
will display statistics for UFS and LFS filesystems.
.El
.Sh ENVIRONMENT VARIABLES
.Sh ENVIRONMENTAL VARIABLES
.Bl -tag -width BLOCKSIZE
.It Ev BLOCKSIZE
If the environment variable
+2 -2
View File
@@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: df.c,v 1.8.2.1 1996/12/13 17:15:11 joerg Exp $
* $Id: df.c,v 1.8 1996/01/14 18:55:09 bde Exp $
*/
#ifndef lint
@@ -129,7 +129,7 @@ main(argc, argv)
iflag = nflag = tflag = 0;
fsmask = MT_NONE;
while ((ch = getopt(argc, argv, "iknt:")) != -1)
while ((ch = getopt(argc, argv, "iknt:")) != EOF)
switch (ch) {
case 'i':
iflag = 1;
+3 -11
View File
@@ -24,15 +24,11 @@
* 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.
*
* $Id: buf.c,v 1.7 1995/05/30 00:06:43 rgrimes Exp $
*/
#ifndef lint
#if 0
static char * const rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp";
#else
static char * const rcsid =
"$Id: buf.c,v 1.15 1997/12/31 12:25:33 helbig Exp $";
#endif
static char *rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp";
#endif /* not lint */
#include <sys/file.h>
@@ -268,10 +264,6 @@ init_buffers()
hello, world
EOF */
setbuffer(stdin, stdinbuf, 1);
/* Ensure stdout is line buffered. This avoids bogus delays
of output if stdout is piped through utilities to a terminal. */
setvbuf(stdout, NULL, _IOLBF, 0);
if (open_sbuf() < 0)
quit(2);
REQUE(&buffer_head, &buffer_head);
+2 -2
View File
@@ -1,4 +1,4 @@
.\" $Id: ed.1,v 1.12 1997/12/31 12:25:35 helbig Exp $
.\" $Id: ed.1,v 1.8 1996/10/05 22:26:02 wosch Exp $
.TH ED 1 "21 May 1993"
.SH NAME
.\" ed, red \- text editor
@@ -820,7 +820,7 @@ are treated as a single command by undo.
is its own inverse.
.TP 8
.RI (1,$)v /re/command-list
.RI (1,$)v /pat/command-list
Applies
.I command-list
to each of the addressed lines not matching a regular expression
+2 -1
View File
@@ -25,9 +25,10 @@
* SUCH DAMAGE.
*
* @(#)ed.h,v 1.5 1994/02/01 00:34:39 alm Exp
* $Id: ed.h,v 1.8 1994/11/03 21:46:55 davidg Exp $
* $Id: ed.h,v 1.7 1994/09/24 02:55:25 davidg Exp $
*/
#include <sys/types.h>
#include <sys/param.h> /* for MAXPATHLEN */
#include <errno.h>
#if defined(sun) || defined(__NetBSD__)
+3 -8
View File
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: main.c,v 1.6.2.1 1997/08/24 21:50:21 jkh Exp $
* $Id: main.c,v 1.6 1996/08/11 16:48:11 ache Exp $
*/
#ifndef lint
@@ -1355,8 +1355,7 @@ signal_hup(signo)
{
if (mutex)
sigflags |= (1 << (signo - 1));
else
handle_hup(signo);
else handle_hup(signo);
}
@@ -1366,8 +1365,7 @@ signal_int(signo)
{
if (mutex)
sigflags |= (1 << (signo - 1));
else
handle_int(signo);
else handle_int(signo);
}
@@ -1417,8 +1415,6 @@ void
handle_winch(signo)
int signo;
{
int save_errno = errno;
struct winsize ws; /* window size structure */
sigflags &= ~(1 << (signo - 1));
@@ -1426,7 +1422,6 @@ handle_winch(signo)
if (ws.ws_row > 2) rows = ws.ws_row - 2;
if (ws.ws_col > 8) cols = ws.ws_col - 8;
}
errno = save_errno;
}
+2 -2
View File
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)ls.1 8.6 (Berkeley) 4/18/94
.\" $Id: ls.1,v 1.5.2.4 1997/09/19 06:18:11 charnier Exp $
.\" $Id: ls.1,v 1.5.2.3 1997/03/26 17:55:17 obrien Exp $
.\"
.Dd April 18, 1994
.Dt LS 1
@@ -265,7 +265,7 @@ and setgroup-ID mode is set.
The file is executable or the directory is
searchable.
.It Sy \-
The file is neither readable, writable, executable,
The file is neither readable, writeable, executable,
nor set-user-ID nor set-group-ID mode, nor sticky. (See below.)
.El
.Pp
+2 -2
View File
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ls.c,v 1.10 1996/08/27 21:51:48 adam Exp $
* $Id: ls.c,v 1.9 1995/10/26 10:56:38 ache Exp $
*/
#ifndef lint
@@ -131,7 +131,7 @@ main(argc, argv)
f_listdot = 1;
fts_options = FTS_PHYSICAL;
while ((ch = getopt(argc, argv, "1ACFLRTacdfgikloqrstu")) != -1) {
while ((ch = getopt(argc, argv, "1ACFLRTacdfgikloqrstu")) != EOF) {
switch (ch) {
/*
* The -1, -C and -l options all override each other so shell
+2 -2
View File
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)mv.1 8.1 (Berkeley) 5/31/93
.\" $Id: mv.1,v 1.7 1996/08/29 18:06:04 wosch Exp $
.\" $Id: mv.1,v 1.6 1996/02/20 23:27:54 wosch Exp $
.\"
.Dd May 31, 1993
.Dt MV 1
@@ -47,7 +47,7 @@
.Ar source target
.Nm mv
.Op Fl f | Fl i
.Ar source ... directory
.Ar source ... source directory
.Sh DESCRIPTION
.Pp
In its first form, the
+12 -30
View File
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mv.c,v 1.8.2.1 1997/08/25 08:33:11 jkh Exp $
* $Id: mv.c,v 1.8 1996/03/01 06:14:13 wosch Exp $
*/
#ifndef lint
@@ -50,7 +50,6 @@ static char const sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94";
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <err.h>
#include <errno.h>
@@ -143,7 +142,7 @@ do_move(from, to)
char *from, *to;
{
struct stat sb;
int ask, ch, first;
int ask, ch;
char modep[15];
/*
@@ -158,47 +157,30 @@ do_move(from, to)
warn("%s", from);
return (1);
}
#define YESNO "(y/n [n]) "
ask = 0;
if (iflg) {
(void)fprintf(stderr, "overwrite %s? %s", to, YESNO);
(void)fprintf(stderr, "overwrite %s? ", to);
ask = 1;
} else if (access(to, W_OK) && !stat(to, &sb)) {
strmode(sb.st_mode, modep);
(void)fprintf(stderr, "override %s%s%s/%s for %s? %s",
(void)fprintf(stderr, "override %s%s%s/%s for %s? ",
modep + 1, modep[9] == ' ' ? "" : " ",
user_from_uid(sb.st_uid, 0),
group_from_gid(sb.st_gid, 0), to, YESNO);
group_from_gid(sb.st_gid, 0), to);
ask = 1;
}
if (ask) {
first = ch = getchar();
while (ch != '\n' && ch != EOF)
ch = getchar();
if (first != 'y' && first != 'Y') {
(void)fprintf(stderr, "not overwritten\n");
if ((ch = getchar()) != EOF && ch != '\n')
while (getchar() != '\n');
if (ch != 'y' && ch != 'Y')
return (0);
}
}
}
if (!rename(from, to))
return (0);
if (errno == EXDEV) {
struct statfs sfs;
char path[MAXPATHLEN];
/* Can't mv(1) a mount point. */
if (realpath(from, path) == NULL) {
warnx("cannot resolve %s: %s", from, path);
return (1);
}
if (!statfs(path, &sfs) && !strcmp(path, sfs.f_mntonname)) {
warnx("cannot rename a mount point");
return (1);
}
} else {
if (errno != EXDEV) {
warn("rename %s to %s", from, to);
return (1);
}
@@ -345,7 +327,7 @@ void
usage()
{
(void)fprintf(stderr, "%s\n%s\n",
"usage: mv [-f | -i] source target",
" mv [-f | -i] source ... directory");
"usage: mv [-f | -i] src target",
" mv [-f | -i] src1 ... srcN directory");
exit(1);
}
+3 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ar_io.c,v 1.4.2.2 1997/09/14 13:07:09 jkh Exp $
* $Id: ar_io.c,v 1.4.2.1 1997/08/25 08:36:50 jkh Exp $
*/
#ifndef lint
@@ -42,9 +42,11 @@ static char const sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#endif /* not lint */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/mtio.h>
#include <sys/param.h>
#include <signal.h>
#include <string.h>
#include <fcntl.h>
+3 -2
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ar_subs.c,v 1.4.2.2 1997/09/14 13:07:11 jkh Exp $
* $Id: ar_subs.c,v 1.4.2.1 1997/08/25 08:36:51 jkh Exp $
*/
#ifndef lint
@@ -44,6 +44,7 @@ static char const sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94";
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <signal.h>
#include <string.h>
#include <stdio.h>
@@ -742,7 +743,7 @@ copy()
* set up the destination dir path and make sure it is a directory. We
* make sure we have a trailing / on the destination
*/
dlen = l_strncpy(dirbuf, dirptr, sizeof(dirbuf) - 1);
dlen = l_strncpy(dirbuf, dirptr, PAXPATHLEN);
dest_pt = dirbuf + dlen;
if (*(dest_pt-1) != '/') {
*dest_pt++ = '/';
+4 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: buf_subs.c,v 1.4.2.2 1997/09/14 13:07:13 jkh Exp $
* $Id: buf_subs.c,v 1.4.2.1 1997/08/25 08:36:52 jkh Exp $
*/
#ifndef lint
@@ -42,7 +42,10 @@ static char const sccsid[] = "@(#)buf_subs.c 8.2 (Berkeley) 4/18/94";
#endif /* not lint */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
+3 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cache.c,v 1.3.2.3 1997/09/14 13:07:15 jkh Exp $
* $Id: cache.c,v 1.3.2.2 1997/08/25 08:36:54 jkh Exp $
*/
#ifndef lint
@@ -42,7 +42,9 @@ static char const sccsid[] = "@(#)cache.c 8.1 (Berkeley) 5/31/93";
#endif /* not lint */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <string.h>
#include <stdio.h>
#include <pwd.h>
+2 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cpio.c,v 1.4.2.2 1997/09/14 13:07:17 jkh Exp $
* $Id: cpio.c,v 1.4.2.1 1997/08/25 08:36:55 jkh Exp $
*/
#ifndef lint
@@ -44,6 +44,7 @@ static char const sccsid[] = "@(#)cpio.c 8.1 (Berkeley) 5/31/93";
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
+2 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: file_subs.c,v 1.4.2.2 1997/09/14 13:07:21 jkh Exp $
* $Id: file_subs.c,v 1.4.2.1 1997/08/25 08:36:56 jkh Exp $
*/
#ifndef lint
@@ -45,6 +45,7 @@ static char const sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93";
#include <sys/time.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/param.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
+2 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ftree.c,v 1.4.2.2 1997/09/14 13:07:23 jkh Exp $
* $Id: ftree.c,v 1.4.2.1 1997/08/25 08:36:57 jkh Exp $
*/
#ifndef lint
@@ -44,6 +44,7 @@ static char const sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94";
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
+2 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: gen_subs.c,v 1.6.2.1 1997/08/25 08:37:00 jkh Exp $
* $Id: gen_subs.c,v 1.6 1995/10/23 21:23:14 ache Exp $
*/
#ifndef lint
@@ -44,6 +44,7 @@ static char const sccsid[] = "@(#)gen_subs.c 8.1 (Berkeley) 5/31/93";
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <stdio.h>
#include <utmp.h>
#include <unistd.h>
+3 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: options.c,v 1.4.2.2 1997/09/14 13:07:25 jkh Exp $
* $Id: options.c,v 1.4.2.1 1997/08/25 08:37:01 jkh Exp $
*/
#ifndef lint
@@ -42,8 +42,10 @@ static char const sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94";
#endif /* not lint */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/mtio.h>
#include <sys/param.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+3 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: pat_rep.c,v 1.5.2.3 1997/09/14 13:07:27 jkh Exp $
* $Id: pat_rep.c,v 1.5.2.2 1997/08/25 08:37:02 jkh Exp $
*/
#ifndef lint
@@ -42,7 +42,9 @@ static char const sccsid[] = "@(#)pat_rep.c 8.2 (Berkeley) 4/18/94";
#endif /* not lint */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+6 -5
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: pax.c,v 1.5.2.2 1997/09/14 13:07:29 jkh Exp $
* $Id: pax.c,v 1.5.2.1 1997/08/25 08:37:03 jkh Exp $
*/
#ifndef lint
@@ -47,16 +47,17 @@ static char const copyright[] =
static char const sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94";
#endif /* not lint */
#include <stdio.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <locale.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "pax.h"
#include "extern.h"
static int gen_init __P((void));
+2 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: sel_subs.c,v 1.3.2.2 1997/09/14 13:07:33 jkh Exp $
* $Id: sel_subs.c,v 1.3.2.1 1997/08/25 08:37:04 jkh Exp $
*/
#ifndef lint
@@ -44,6 +44,7 @@ static char const sccsid[] = "@(#)sel_subs.c 8.1 (Berkeley) 5/31/93";
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <pwd.h>
#include <grp.h>
#include <stdio.h>
+4 -3
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: tables.c,v 1.4.2.3 1997/09/14 13:07:34 jkh Exp $
* $Id: tables.c,v 1.4.2.2 1997/08/25 08:37:05 jkh Exp $
*/
#ifndef lint
@@ -44,12 +44,13 @@ static char const sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93";
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include "pax.h"
#include "tables.h"
#include "extern.h"
+2 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: tar.c,v 1.4.2.2 1997/09/14 13:07:35 jkh Exp $
* $Id: tar.c,v 1.4.2.1 1997/08/25 08:37:05 jkh Exp $
*/
#ifndef lint
@@ -44,6 +44,7 @@ static char const sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
+4 -1
View File
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: tty_subs.c,v 1.3.2.2 1997/09/14 13:07:37 jkh Exp $
* $Id: tty_subs.c,v 1.3.2.1 1997/08/25 08:37:06 jkh Exp $
*/
#ifndef lint
@@ -42,9 +42,12 @@ static char const sccsid[] = "@(#)tty_subs.c 8.2 (Berkeley) 4/18/94";
#endif /* not lint */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+2 -8
View File
@@ -1,15 +1,9 @@
# @(#)Makefile 8.1 (Berkeley) 6/2/93
# $Id: Makefile,v 1.6.2.1 1997/10/16 12:44:17 mckay Exp $
# $Id: Makefile,v 1.6 1995/10/25 15:07:38 torstenb Exp $
PROG= ps
SRCS= fmt.c keyword.c nlist.c print.c ps.c
#
# To support "lazy" ps for non root/wheel users
# add -DLAZY_PS to the cflags. This helps
# keep ps from being an unnecessary load
# on large systems.
#
CFLAGS+=-I${.CURDIR}/../../sys -DLAZY_PS
CFLAGS+=-I${.CURDIR}/../../sys
DPADD= ${LIBM} ${LIBKVM}
LDADD= -lm -lkvm
BINGRP= kmem
+2 -4
View File
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $Id: ps.1,v 1.11.2.1 1997/08/21 02:54:28 jlemon Exp $
.\" $Id: ps.1,v 1.11 1996/10/21 07:30:25 peter Exp $
.\"
.Dd April 18, 1994
.Dt PS 1
@@ -40,7 +40,7 @@
.Nd process status
.Sh SYNOPSIS
.Nm \&ps
.Op Fl aCcefhjlmrSTuvwx
.Op Fl aCcehjlmrSTuvwx
.Op Fl M Ar core
.Op Fl N Ar system
.Op Fl O Ar fmt
@@ -88,8 +88,6 @@ cpu calculation that ignores ``resident'' time (this normally has
no effect).
.It Fl e
Display the environment as well.
.It Fl f
Work harder to get detailed process information.
.It Fl h
Repeat the information header as often as necessary to guarantee one
header per page of information.
+6 -32
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ps.c,v 1.13.2.2 1997/06/06 16:09:12 charnier Exp $
* $Id: ps.c,v 1.13.2.1 1996/11/11 21:23:15 phk Exp $
*/
#ifndef lint
@@ -84,12 +84,6 @@ int totwidth; /* calculated width of requested variables */
static int needuser, needcomm, needenv;
#if defined(LAZY_PS)
static int forceuread=0;
#else
static int forceuread=1;
#endif
enum sort { DEFAULT, SORTMEM, SORTCPU } sortby = DEFAULT;
static char *fmt __P((char **(*)(kvm_t *, const struct kinfo_proc *, int),
@@ -145,11 +139,7 @@ main(argc, argv)
ttydev = NODEV;
memf = nlistf = swapf = NULL;
while ((ch = getopt(argc, argv,
#if defined(LAZY_PS)
"aCcefghjLlM:mN:O:o:p:rSTt:U:uvW:wx")) != EOF)
#else
"aCceghjLlM:mN:O:o:p:rSTt:U:uvW:wx")) != EOF)
#endif
switch((char)ch) {
case 'a':
all = 1;
@@ -163,12 +153,6 @@ main(argc, argv)
case 'e': /* XXX set ufmt */
needenv = 1;
break;
#if defined(LAZY_PS)
case 'f':
if (getuid() == 0 || getgid() == 0)
forceuread = 1;
break;
#endif
case 'g':
break; /* no-op */
case 'h':
@@ -409,8 +393,6 @@ fmt(fn, ki, comm, maxlen)
return (s);
}
#define UREADOK(ki) (forceuread || (KI_PROC(ki)->p_flag & P_INMEM))
static void
saveuser(ki)
KINFO *ki;
@@ -420,7 +402,7 @@ saveuser(ki)
struct user *u_addr = (struct user *)USRSTACK;
usp = &ki->ki_u;
if (UREADOK(ki) && kvm_uread(kd, KI_PROC(ki), (unsigned long)&u_addr->u_stats,
if (kvm_uread(kd, KI_PROC(ki), (unsigned long)&u_addr->u_stats,
(char *)&pstats, sizeof(pstats)) == sizeof(pstats)) {
/*
* The u-area might be swapped out, and we can't get
@@ -437,23 +419,15 @@ saveuser(ki)
/*
* save arguments if needed
*/
if (needcomm && UREADOK(ki)) {
if (needcomm)
ki->ki_args = fmt(kvm_getargv, ki, KI_PROC(ki)->p_comm,
MAXCOMLEN);
} else if (needcomm) {
ki->ki_args = malloc(strlen(KI_PROC(ki)->p_comm) + 3);
sprintf(ki->ki_args, "(%s)", KI_PROC(ki)->p_comm);
} else {
else
ki->ki_args = NULL;
}
if (needenv && UREADOK(ki)) {
if (needenv)
ki->ki_env = fmt(kvm_getenvv, ki, (char *)NULL, 0);
} else if (needenv) {
ki->ki_env = malloc(3);
strcpy(ki->ki_env, "()");
} else {
else
ki->ki_env = NULL;
}
}
static int
+8 -10
View File
@@ -1,25 +1,23 @@
# @(#)Makefile 8.1 (Berkeley) 7/19/93
# $Id$
# $Id: Makefile,v 1.4 1994/09/29 13:06:00 csgr Exp $
PROG= rcp
SRCS= rcp.c util.c
CFLAGS+=-Wall
.if exists(${DESTDIR}/usr/lib/libkrb.a) && defined(MAKE_KERBEROS4)
SRCS+= krcmd.c kcmd.c rcmd_util.c encrypt.c
.if exists(${DESTDIR}/usr/lib/libkrb.a) && (defined(MAKE_KERBEROS) \
|| defined(MAKE_EBONES))
SRCS+= kcmd.c krcmd.c
CFLAGS+=-DKERBEROS -DCRYPT
DPADD= ${LIBKRB} ${LIBDES}
CFLAGS+=-DKERBEROS -DCRYPT -DHAVE_CONFIG_H \
-I${.CURDIR}/../../kerberosIV/include \
-I${.CURDIR}/../../crypto/kerberosIV/include \
-I${.CURDIR}/../../crypto/kerberosIV/lib/roken \
-I${.CURDIR}/../../crypto/kerberosIV/appl/bsd
LDADD= -lkrb -ldes
DISTRIBUTION= krb
.PATH: ${.CURDIR}/../../crypto/kerberosIV/appl/bsd
.endif
BINOWN= root
BINMODE=4555
INSTALLFLAGS=-fschg
.PATH: ${.CURDIR}/../../usr.bin/rlogin
.include <bsd.prog.mk>
+4 -4
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: rcp.c,v 1.8.2.2 1997/06/06 16:11:15 charnier Exp $
*/
#ifndef lint
@@ -70,9 +70,9 @@ static char const sccsid[] = "@(#)rcp.c 8.2 (Berkeley) 4/2/94";
#ifdef KERBEROS
#include <des.h>
#include <krb.h>
#include <kerberosIV/krb.h>
/* #include "../../usr.bin/rlogin/krb.h" */
#include "../../usr.bin/rlogin/krb.h"
char dst_realm_buf[REALM_SZ];
char *dest_realm = NULL;
@@ -344,7 +344,7 @@ tolocal(argc, argv)
if (!(bp = malloc(len)))
err(1, NULL);
(void)snprintf(bp, len, "exec %s%s%s %s %s", _PATH_CP,
iamrecursive ? " -PR" : "", pflag ? " -p" : "",
iamrecursive ? " -r" : "", pflag ? " -p" : "",
argv[i], argv[argc - 1]);
if (susystem(bp, userid))
++errs;
+2 -2
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: rm.c,v 1.11 1996/03/07 23:26:59 wosch Exp $
* $Id: rm.c,v 1.10 1996/02/19 05:57:22 pst Exp $
*/
#ifndef lint
@@ -82,7 +82,7 @@ main(argc, argv)
int ch, rflag;
rflag = 0;
while ((ch = getopt(argc, argv, "dfiPRr")) != -1)
while ((ch = getopt(argc, argv, "dfiPRr")) != EOF)
switch(ch) {
case 'd':
dflag = 1;
+6 -9
View File
@@ -1,5 +1,5 @@
# @(#)Makefile 8.4 (Berkeley) 5/5/95
# $Id: Makefile,v 1.15.2.2 1997/08/25 21:16:13 jkh Exp $
# $Id: Makefile,v 1.15.2.1 1997/08/25 09:09:28 jkh Exp $
PROG= sh
SHSRCS= alias.c cd.c echo.c error.c eval.c exec.c expand.c \
@@ -7,8 +7,7 @@ SHSRCS= alias.c cd.c echo.c error.c eval.c exec.c expand.c \
mystring.c options.c output.c parser.c printf.c redir.c show.c \
trap.c var.c
GENSRCS= arith.c arith_lex.c builtins.c init.c nodes.c syntax.c
GENHDRS= builtins.h nodes.h syntax.h token.h
SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS}
SRCS= ${SHSRCS} ${GENSRCS}
DPADD+= ${LIBL} ${LIBEDIT} ${LIBTERMCAP}
LDADD+= -ll -ledit -ltermcap
@@ -20,13 +19,13 @@ CFLAGS+=-DSHELL -I. -I${.CURDIR}
.PATH: ${.CURDIR}/bltin ${.CURDIR}/../../usr.bin/printf
CLEANFILES+= mkinit mkinit.o mknodes mknodes.o \
CLEANFILES+= builtins.h mkinit mkinit.o mknodes mknodes.o \
mksyntax mksyntax.o \
y.tab.h
CLEANFILES+= ${GENSRCS} ${GENHDRS}
nodes.h syntax.h token.h y.tab.h
CLEANFILES+= ${GENSRCS}
beforedepend: builtins.h nodes.h syntax.h token.h
.ORDER: builtins.c builtins.h
builtins.c builtins.h: mkbuiltins builtins.def
cd ${.CURDIR}; sh mkbuiltins ${.OBJDIR}
@@ -46,11 +45,9 @@ mknodes.o: mknodes.c # XXX and many headers
mksyntax: mksyntax.o
mksyntax.o: mksyntax.c # XXX and many headers
.ORDER: nodes.c nodes.h
nodes.c nodes.h: mknodes nodetypes nodes.c.pat
./mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
.ORDER: syntax.c syntax.h
syntax.c syntax.h: mksyntax
./mksyntax
-2
View File
@@ -29,8 +29,6 @@
* 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.
*
* $Id$
*/
char *getpwd __P((void));
+2 -1
View File
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: jobs.c,v 1.8.2.3 1997/08/25 09:10:00 jkh Exp $
* $Id: jobs.c,v 1.8.2.2 1997/08/17 14:47:33 joerg Exp $
*/
#ifndef lint
@@ -45,6 +45,7 @@ static char const sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95";
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/param.h>
#ifdef BSD
#include <sys/wait.h>
+4 -63
View File
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: miscbltin.c,v 1.8.2.1 1997/08/25 09:10:10 jkh Exp $
* $Id: miscbltin.c,v 1.8 1996/09/03 14:24:44 peter Exp $
*/
#ifndef lint
@@ -52,7 +52,6 @@ static char const sccsid[] = "@(#)miscbltin.c 8.4 (Berkeley) 5/4/95";
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <termios.h>
#include "shell.h"
#include "options.h"
@@ -89,43 +88,14 @@ readcmd(argc, argv)
int startword;
int status;
int i;
struct timeval tv;
char *tvptr;
fd_set ifds;
struct termios told, tnew;
int tsaved;
eflag = 0;
prompt = NULL;
tv.tv_sec = -1;
tv.tv_usec = 0;
while ((i = nextopt("ep:t:")) != '\0') {
switch(i) {
case 'p':
while ((i = nextopt("ep:")) != '\0') {
if (i == 'p')
prompt = optarg;
break;
case 'e':
else
eflag = 1;
break;
case 't':
tv.tv_sec = strtol(optarg, &tvptr, 0);
if (tvptr == optarg)
error("timeout value");
switch(*tvptr) {
case 0:
case 's':
break;
case 'h':
tv.tv_sec *= 60;
/* FALLTHROUGH */
case 'm':
tv.tv_sec *= 60;
break;
default:
error("timeout unit");
}
break;
}
}
if (prompt && isatty(0)) {
out2str(prompt);
@@ -135,35 +105,6 @@ readcmd(argc, argv)
error("arg count");
if ((ifs = bltinlookup("IFS", 1)) == NULL)
ifs = nullstr;
if (tv.tv_sec >= 0) {
/*
* See if we can disable input processing; this will
* not give the desired result if we are in a pipeline
* and someone upstream is still in line-by-line mode.
*/
tsaved = 0;
if (tcgetattr(0, &told) == 0) {
memcpy(&tnew, &told, sizeof(told));
cfmakeraw(&tnew);
tcsetattr(0, TCSANOW, &tnew);
tsaved = 1;
}
/*
* Wait for something to become available.
*/
FD_ZERO(&ifds);
FD_SET(0, &ifds);
status = select(1, &ifds, NULL, NULL, &tv);
if (tsaved)
tcsetattr(0, TCSANOW, &told);
/*
* If there's nothing ready, return an error.
*/
if (status <= 0)
return(1);
}
status = 0;
startword = 1;
backslash = 0;
+3 -23
View File
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $Id: sh.1,v 1.9.2.7 1998/02/12 01:25:29 jdp Exp $
.\" $Id: sh.1,v 1.9.2.3 1997/08/25 21:22:27 jkh Exp $
.\"
.Dd May 5, 1995
.Dt SH 1
@@ -453,10 +453,6 @@ error, or a false indication. The man page for each command
should indicate the various exit codes and what they mean.
Additionally, the builtin commands return exit codes, as does
an executed shell function.
.Pp
If a command is terminated by a signal, its exit status is 128 plus
the signal number. Signal numbers are defined in the header file
.Aq Pa sys/signal.h .
.Ss Complex Commands
Complex commands are combinations of simple commands
with control operators or reserved words, together creating a larger complex
@@ -627,7 +623,7 @@ slightly more efficient.
Grouping commands together this way allows you to
redirect their output as though they were one program:
.Bd -literal -offset indent
{ echo -n "hello"; echo " world"; } > greeting
{ echo -n "hello"; echo " world" } > greeting
.Ed
.Ss Functions
The syntax of a function definition is
@@ -974,15 +970,6 @@ etc).
A null command that returns a 0 (true) exit value.
.It \&. file
The commands in the specified file are read and executed by the shell.
If
.Ar file
contains any
.Ql /
characters, it is used as is. Otherwise, the shell searches the
.Ev PATH
for the file. If it is not found in the
.Ev PATH ,
it is sought in the current working directory.
.It alias [ name[=string] ... ]
If name=string is specified, the shell defines the
alias ``name'' with value ``string''. If just ``name''
@@ -1136,7 +1123,7 @@ is rather than recomputing it each time. This makes
it faster. However, if the current directory is
renamed, the builtin version of pwd will continue to
print the old name for the directory.
.It Li "read [ -p prompt ] [ -t timeout ] [ -e ] variable ...
.It read [ -p prompt ] [ -e ] variable ...
The prompt is printed if the -p option is specified
and the standard input is a terminal. Then a line is
read from the standard input. The trailing newline
@@ -1149,13 +1136,6 @@ separated them) are assigned to the last variable.
If there are more variables than pieces, the remaining
variables are assigned the null string.
.Pp
If the -t option is specified the timeout elapses
before any input is supplied, the read command will
return without assigning any values. The timeout value
may optionally be followed by one of 's', 'm' or 'h' to
explicitly specify seconds, minutes or or hours. If none
is supplied, 's' is assumed.
.Pp
The -e option causes any backslashes in the input to
be treated specially. If a backslash is followed by
a newline, the backslash and the newline will be
+6 -12
View File
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: trap.c,v 1.4.2.1 1997/08/25 09:10:46 jkh Exp $
* $Id: trap.c,v 1.4 1996/09/01 10:21:47 peter Exp $
*/
#ifndef lint
@@ -205,12 +205,12 @@ clear_traps()
* Set the signal handler for the specified signal. The routine figures
* out what it should be set to.
*/
void
long
setsignal(signo)
int signo;
{
int action;
sig_t sig, sigact = SIG_DFL;
sig_t sigact = SIG_DFL;
char *t;
if ((t = trap[signo]) == NULL)
@@ -260,7 +260,7 @@ setsignal(signo)
* here, but other shells don't. We don't alter
* sigmode, so that we retry every time.
*/
return;
return 0;
}
if (sigact == SIG_IGN) {
if (mflag && (signo == SIGTSTP ||
@@ -273,18 +273,14 @@ setsignal(signo)
}
}
if (*t == S_HARD_IGN || *t == action)
return;
return 0;
switch (action) {
case S_DFL: sigact = SIG_DFL; break;
case S_CATCH: sigact = onsig; break;
case S_IGN: sigact = SIG_IGN; break;
}
*t = action;
sig = signal(signo, sigact);
#ifdef BSD
if (sig != SIG_ERR && action == S_CATCH)
siginterrupt(signo, 1);
#endif
return (long)signal(signo, sigact);
}
@@ -344,9 +340,7 @@ onsig(signo)
int signo;
{
#ifndef BSD
signal(signo, onsig);
#endif
if (signo == SIGINT && trap[SIGINT] == NULL) {
onint();
return;
+2 -2
View File
@@ -34,14 +34,14 @@
* SUCH DAMAGE.
*
* @(#)trap.h 8.3 (Berkeley) 6/5/95
* $Id: trap.h,v 1.3.2.1 1997/08/25 09:10:48 jkh Exp $
* $Id: trap.h,v 1.3 1996/09/01 10:21:50 peter Exp $
*/
extern int pendingsigs;
int trapcmd __P((int, char **));
void clear_traps __P((void));
void setsignal __P((int));
long setsignal __P((int));
void ignoresig __P((int));
void onsig __P((int));
void dotrap __P((void));
+3 -5
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: print.c,v 1.5.6.1 1997/08/25 09:24:08 jkh Exp $
* $Id: print.c,v 1.5 1995/05/30 00:07:27 rgrimes Exp $
*/
#ifndef lint
@@ -205,10 +205,8 @@ print(tp, wp, ldisc, fmt)
if (fmt != BSD && cc[p->sub] == p->def)
continue;
#define WD "%-8s"
(void)snprintf(buf1 + cnt * 8, sizeof(buf1) - cnt * 8,
WD, p->name);
(void)snprintf(buf2 + cnt * 8, sizeof(buf2) - cnt * 8,
WD, ccval(p, cc[p->sub]));
(void)sprintf(buf1 + cnt * 8, WD, p->name);
(void)sprintf(buf2 + cnt * 8, WD, ccval(p, cc[p->sub]));
if (++cnt == LINELENGTH / 8) {
cnt = 0;
(void)printf("%s\n", buf1);
+3 -2
View File
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: test.c,v 1.13.2.2 1997/08/25 09:26:35 jkh Exp $
* $Id: test.c,v 1.13.2.1 1996/12/26 18:54:46 joerg Exp $
*/
#ifndef lint
@@ -46,8 +46,9 @@ static char const copyright[] =
static char const sccsid[] = "@(#)test.c 8.3 (Berkeley) 4/2/94";
#endif /* not lint */
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <ctype.h>
#include <err.h>
+2 -2
View File
@@ -325,9 +325,9 @@ The long-named options can be introduced with `+' as well as `\-\-',
for compatibility with previous releases. Eventually support for `+'
will be removed, because it is incompatible with the POSIX.2 standard.
.SH FILES
/usr/share/misc/bison.simple simple parser
/usr/local/lib/bison.simple simple parser
.br
/usr/share/misc/bison.hairy complicated parser
/usr/local/lib/bison.hairy complicated parser
.SH SEE ALSO
.IR yacc (1)
.br
+1 -1
View File
@@ -3,7 +3,7 @@ GNU cpio 2.4.2
removed files:
INSTALL cpio.info mkdir.c
Makefile.in mkinstalldirs
Makefile.in cpio.texi mkinstalldirs
argmatch.c fnmatch.c mt.1
bcopy.c fnmatch.h mt.c
configure install-sh rmt.c
+4 -4
View File
@@ -1977,7 +1977,7 @@ cases where multiple declaration is valid and changes nothing.
.B \-Wnested-externs
Warn if an \c
.B extern\c
\& declaration is encountered within a function.
\& declaration is encountered within an function.
.TP
.B \-Wenum\-clash
Warn about conversion between different enumeration types (C++ only).
@@ -2925,17 +2925,17 @@ exist in SPARClite but not in SPARC v7.
.B \-mcypress
.TP
.B \-msupersparc
These two options select the processor for which the code is optimized.
These two options select the processor for which the code is optimised.
.Sp
With
.B \-mcypress
(the default), the compiler optimizes code for the Cypress CY7C602 chip, as
(the default), the compiler optimises code for the Cypress CY7C602 chip, as
used in the SparcStation/SparcServer 3xx series. This is also appropriate for
the older SparcStation 1, 2, IPX etc.
.Sp
With
.B \-msupersparc
the compiler optimizes code for the SuperSparc cpu, as used in the SparcStation
the compiler optimises code for the SuperSparc cpu, as used in the SparcStation
10, 1000 and 2000 series. This flag also enables use of the full SPARC v8
instruction set.
.PP
+1 -2
View File
@@ -2098,7 +2098,7 @@ pexecute (search_flag, program, argv, not_last)
/* Exec the program. */
(*func) (program, argv);
perror_exec (program);
_exit (1);
exit (-1);
/* NOTREACHED */
return 0;
@@ -2709,7 +2709,6 @@ process_command (argc, argv)
#ifdef FREEBSD_NATIVE
add_prefix (&exec_prefixes, "/usr/libexec/", 0, 0, NULL_PTR);
add_prefix (&exec_prefixes, "/usr/bin/", 0, 0, NULL_PTR);
add_prefix (&startfile_prefixes, "/usr/libdata/gcc/", 0, 0, NULL_PTR);
#else /* not FREEBSD_NATIVE */
#ifndef OS2
add_prefix (&exec_prefixes, standard_exec_prefix, 0, 2, NULL_PTR);
+1 -2
View File
@@ -87,8 +87,7 @@ add_to_objfile_sections (abfd, asect, objfile_p_char)
/* XXX perhaps this should be in bfd_section_vma (), but it wouldn't
even compile there, since a bfd pointer isn't actually passed in
all invocations of bfd_section_vma (). */
if (kernel_debugging)
section.addr += bfd_get_start_address (abfd);
section.addr += bfd_get_start_address (abfd);
#endif
section.endaddr = section.addr + bfd_section_size (abfd, asect);
obstack_grow (&objfile->psymbol_obstack, (char *) &section, sizeof(section));
-77
View File
@@ -1,77 +0,0 @@
@@@@@@@=
@= @=
@= @=
@= @= @@@@@= @@@@@@= @@= @=
@= F o r a l l h a c k e r s. @=@= @=
@= @@@@@@=@= @= @= @@@@@= @= @= @=
@= @= @= @= @= @= @= @@@@@= @=
@= @= @= @= @= @= @=@= @= @=
@@@@@@@@= @@@@= @@@@@= @@@@@@=@@@= @@@@= @@@@@@=
This software is covered by the following:
Copyright (c) 1996, 1997, 1998 Shigio Yamaguchi. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by Shigio Yamaguchi.
4. Neither the name of the author nor the names of any co-contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of gozilla(1) are covered by the following:
Copyright 1996 Netscape Communications Corporation, all rights reserved.
Created: Jamie Zawinski <[email protected]>, 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.
-36
View File
@@ -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
<[email protected]> for inclusion in his next release. The most recent
release of GLOBAL is available at the author's web page:
http://wafu.netgate.net/tama/unix/indexe.html
[email protected] - July 1997
-357
View File
@@ -1,357 +0,0 @@
GLOBAL history
--------------
version 1.0 Initial version [21-Apr-96]
global, gtags, btreeop, extended ctags.
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 not only 'obj'(MAKEOBJDIR) directory but also
'/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.
-178
View File
@@ -1,178 +0,0 @@
Installation of GLOBAL
20-Jan-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:
There is no problem.
break;
case 2.1.6R:
case 2.1.7R:
I don't know. But it seems same with 2.1.5R.
break;
case 2.2.1R:
It is OK. But your native nvi is version 1.71.
Use 1.79 nvi available on the Internet.
break;
case 2.2.2R:
case 2.2.5R:
Your system inlucdes GLOBAL 1.9. You can overwrite it
with this 2.2 package.
But skip procedure "3. Extended vi (OPTIONAL)", because
your /usr/bin/nvi is already extended nvi for GLOBAL.
break;
default:
I don't know. But it seems to be little problem.
}
} 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.
}
----------------------------------------------------------------------------
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 FreeBSD (all version) user, nothing to do here.
Please go to "2. GLOBAL basic".
Otherwise, you must install following items before you install GLOBAL.
a) Generic makefile
This package includes generic makefile. Please do the followings.
% make -f Makefile.generic gen
% vi Makefile <- check install directories (BINDIR, MANDIR)
b) BSD db library version 1.85
If you don't have it, you can fetch it from this site.
http://mongoose.bostic.com/db/packages/db.1.85.tar.gz
c) PERL version 4 or later
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
d) Rewrite some files
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
e) POSIX regular expression (extension) library
If you don't have it, you can use GNU's regex library.
f) Some UNIX tools
Find(1), sed(1), sort(1) are needed.
If your environment is UNIX, you have them.
2. GLOBAL basic (NEEDED)
% make
# make install
3. Extended vi (OPTIONAL)
GLOBAL supports two version of nvi.
There is a little defference in behavior between them when a number of
functions located. (please see 'README'.)
Version 1.34 nvi is included by FreeBSD 2.0.5R, 2.1.0R and 2.1.5R.
Version 1.79 nvi is available on
ftp://ftp.cs.berkeley.edu/ucb/4bsd/nvi-1.79.tar.gz.
If you don't have nvi-1.34, use nvi-1.79.
If you use version 1.34 nvi which is a native command in FreeBSD 2.0.5R,
2.1.0R or 2.1.5R then
% cp -r /usr/src/usr.bin/vi vi <- version 1.34 of nex/nvi
% cd vi
% patch -p < ../nvi-1.34.diff
% make
# make install
else if you use version 1.79 nvi which is the latest version then
fetch from ftp://ftp.cs.berkeley.edu/ucb/4bsd/nvi-1.79.tar.gz and
% tar xzvf nvi-1.79.tar.gz
% cd nvi-1.79
% patch -p < ../nvi-1.79.diff
% cd build
% ./configure
% make
# make install
Caution: If you use FreeBSD 2.2.2R or later, your nvi is already
extended vi. Don't patch with nvi-1.79.diff.
else we have no patch for it.
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 from
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. Gozilla (OPTIONAL)
You need X(1) to install gozilla.
% cd gozilla
% xmkmf
% make
# make install
# make install.man
Good luck!
-3
View File
@@ -1,3 +0,0 @@
SUBDIR= lib global gtags gctags btreeop htags systags
.include <bsd.subdir.mk>
-7
View File
@@ -1,7 +0,0 @@
BINDIR?= /usr/bin
MANDIR?= /usr/share/man/man
.if exists(${.OBJDIR}/../lib)
LIBUTIL=${.OBJDIR}/../lib/libutil.a
.else
LIBUTIL=${.CURDIR}/../lib/libutil.a
.endif
-38
View File
@@ -1,38 +0,0 @@
GLOBAL cannot recognize following macros and functions.
1. Macro which doesn't end with ';'.
GLOBAL cannot recognize func() after M(a), because M(a) seems to be
function definition.
#define M(a) static char *string = a;
M(a)
func() {
...
}
It should be follows.
#define M(a) static char *string = a
M(a);
func() {
...
}
2. Macro which is a renamed function.
#define func _func
_func() {
...
}
main() {
func();
}
In fact, main() calls _func() instead of func() but GLOBAL cannot
recognize it.
-1
View File
@@ -1 +0,0 @@
2.24
-6
View File
@@ -1,6 +0,0 @@
PROG= btreeop
CFLAGS+=-I${.CURDIR}/../lib
LDADD= $(LIBUTIL)
DPADD= $(LIBUTIL)
.include <bsd.prog.mk>
-344
View File
@@ -1,344 +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.
*
* btreeop.c 6-Nov-97
*
*/
#include <sys/stat.h>
#include <ctype.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include "dbio.h"
#include "global.h"
char *dbdefault = "btree"; /* default database name */
char *progname = "btreeop"; /* command name */
static void usage __P((void));
void signal_setup __P((void));
void onintr __P((int));
void main __P((int, char **));
void dbwrite __P((DBIO *));
void dbkey __P((DBIO *, char *, int));
void dbscan __P((DBIO *, char *, int));
void dbdel __P((DBIO *, char *, int));
void dbbysecondkey __P((DBIO *, 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][-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);
}
void
main(argc, argv)
int argc;
char *argv[];
{
char command = 'R';
char *key = NULL;
int mode = 0;
char *dbname;
DBIO *dbio;
int i, c;
int secondkey = 0;
char *prefix = (char *)0;
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]);
key = argv[++i];
case 'A':
case 'C':
case 'L':
if (command != 'R')
usage();
command = c;
break;
case 'k':
prefix = argv[++i];
break;
default:
usage();
}
}
dbname = (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;
}
dbio = db_open(dbname, mode, 0644, DBIO_DUP);
if (dbio == NULL)
die1("db_open failed (dbname = %s).", dbname);
switch (command) {
case 'A': /* Append records */
case 'C': /* Create database */
dbwrite(dbio);
break;
case 'D': /* Delete records */
dbdel(dbio, key, secondkey);
break;
case 'K': /* Keyed (indexed) read */
dbkey(dbio, key, secondkey);
break;
case 'R': /* sequencial Read */
case 'L': /* primary key List */
dbscan(dbio, prefix, (command == 'L') ? 1 : 0);
break;
}
db_close(dbio);
if (exitflag)
exit(1);
exit(0);
}
/*
* dbwrite: write to database
*
* i) dbio database
*/
void
dbwrite(dbio)
DBIO *dbio;
{
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, 0, NULL)) != 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);
db_put(dbio, keybuf, p);
}
}
/*
* dbkey: Keyed search
*
* i) dbio database
* i) skey key for search
* i) secondkey 0: primary key, >0: secondary key
*/
void
dbkey(dbio, skey, secondkey)
DBIO *dbio;
char *skey;
int secondkey;
{
char *p;
if (!secondkey) {
for (p = db_first(dbio, skey, 0); p; p = db_next(dbio))
detab(stdout, p);
return;
}
dbbysecondkey(dbio, F_KEY, skey, secondkey);
}
/*
* dbscan: Scan records
*
* i) dbio database
* i) prefix prefix of primary key
* i) keylist 0: key and data, 1: primary key only
*/
void
dbscan(dbio, prefix, keylist)
DBIO *dbio;
char *prefix;
int keylist;
{
char *p;
int flags = DBIO_SKIPMETA;
if (prefix)
flags |= DBIO_PREFIX;
if (keylist)
flags |= DBIO_KEY;
for (p = db_first(dbio, prefix, flags); p; p = db_next(dbio))
detab(stdout, p);
}
/*
* dbdel: Delete records
*
* i) dbio database
* i) skey key for search
* i) secondkey 0: primary key, >0: secondary key
*/
void
dbdel(dbio, skey, secondkey)
DBIO *dbio;
char *skey;
int secondkey;
{
signal_setup();
if (!secondkey) {
db_del(dbio, skey);
return;
}
dbbysecondkey(dbio, F_DEL, skey, secondkey);
}
/*
* dbbysecondkey: proc by second key
*
* i) dbio database
* i) func F_KEY, F_DEL
* i) skey
* i) secondkey
*/
void
dbbysecondkey(dbio, func, skey, secondkey)
DBIO *dbio;
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 = db_first(dbio, NULL, DBIO_SKIPMETA); p; p = db_next(dbio)) {
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:
db_del(dbio, NULL);
break;
}
}
if (exitflag)
break;
}
}
-7
View File
@@ -1,7 +0,0 @@
PROG= gctags
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../lib
LDADD= $(LIBUTIL)
DPADD= $(LIBUTIL)
SRCS= C.c ctags.c fortran.c lisp.c print.c tree.c yacc.c assembler.c
.include <bsd.prog.mk>
-108
View File
@@ -1,108 +0,0 @@
/*
* Copyright (c) 1987, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)assembler.c 8.3 (Berkeley) 6/6/97";
#endif /* LIBC_SCCS and not lint */
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include "ctags.h"
#include "lookup.h"
#ifdef GLOBAL
void
asm_entries()
{
char *lbp;
char tok[MAXTOKEN];
char *sp;
for (;;) {
lineftell = ftell(inf);
if (!fgets(lbuf, sizeof(lbuf), inf))
return;
++lineno;
if (rflag) {
/* extract only call EXT(xxx) or call _xxx */
lbp = lbuf;
while (*lbp && isspace(*lbp))
lbp++;
if (*lbp != 'c' || strncmp(lbp, "call", 4))
continue;
lbp += 4;
while (*lbp && isspace(*lbp))
lbp++;
sp = tok;
if (!strncmp(lbp, "EXT(" /* ) */, 4)) {
lbp += 4;
while (*lbp && intoken(*lbp))
*sp++ = *lbp++;
if (*lbp != /* ( */ ')')
continue;
*sp = EOS;
} else if (*lbp == '_') {
lbp++;
while (*lbp && intoken(*lbp))
*sp++ = *lbp++;
*sp = EOS;
} else
continue;
if (!lookup(tok))
continue;
} else {
/* extract only ENTRY() and ALTENTRY(). */
if (lbuf[0] != 'E' && lbuf[0] != 'A')
continue;
lbp = lbuf;
if (!strncmp(lbp, "ENTRY(", 6)) {
lbp += 6;
} else if (!strncmp(lbp, "ALTENTRY(", 9)) {
lbp += 9;
} else
continue;
sp = tok;
while (*lbp && intoken(*lbp))
*sp++ = *lbp++;
if (*lbp != /* ( */ ')')
continue;
*sp = EOS;
}
getline();
pfnote(tok, lineno);
}
/*NOTREACHED*/
}
#endif
-6
View File
@@ -1,6 +0,0 @@
PROG= global
CFLAGS+=-I${.CURDIR}/../lib
LDADD= $(LIBUTIL)
DPADD= $(LIBUTIL)
.include <bsd.prog.mk>
-751
View File
@@ -1,751 +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.
*
* global.c 7-Nov-97
*
*/
#include <sys/stat.h>
#include <ctype.h>
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "global.h"
char *progname = "global"; /* command name */
static void usage __P((void));
void main __P((int, char **));
char *outfilter __P((void));
void completelist __P((char *, char *));
void relative_filter __P((char *, char *, char *));
void grep __P((char *));
int printtag __P((FILE *, char *, char *, int));
int regexp __P((char *));
int search __P((char *, char *, char *, char *, int));
char *extractpath __P((char *));
int includepath __P((char *, char *));
char sortfilter[MAXCOMLINE+1]; /* sort filter */
char pathfilter[MAXCOMLINE+1]; /* path convert filter */
char local[MAXPATHLEN+1]; /* local prefix */
char *localprefix; /* local prefix */
int aflag; /* [option] */
int cflag; /* command */
int fflag; /* command */
int lflag; /* [option] */
int gflag; /* command */
int iflag; /* command */
int pflag; /* command */
int rflag; /* [option] */
int sflag; /* command */
int vflag; /* [option] */
int xflag; /* [option] */
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",
"global [-alrvx] pattern",
"global -c [prefix]",
"global -f[arx] file",
"global -g[alvx] pattern",
"global -i[v]",
"global -p",
"global -s[alvx] pattern");
exit(1);
}
void
main(argc, argv)
int argc;
char *argv[];
{
char *p, *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 */
char comline[MAXCOMLINE+1];
while (--argc > 0 && (++argv)[0][0] == '-') {
for (p = argv[0] + 1; *p; p++) {
switch (*p) {
case 'a':
aflag++;
break;
case 'c':
cflag++;
break;
case 'f':
fflag++;
break;
case 'l':
lflag++;
break;
case 'g':
gflag++;
break;
case 'i':
iflag++;
break;
case 'p':
pflag++;
break;
case 'r':
rflag++;
break;
case 's':
sflag++;
break;
case 'v':
vflag++;
break;
case 'x':
xflag++;
break;
default:
usage();
}
}
}
av = (argc > 0) ? *argv : (char *)0;
/*
* usage check.
*/
{
int commands, options;
commands = cflag + fflag + gflag + iflag + pflag + sflag;
options = aflag + lflag + rflag + xflag;
/*
* only -c, -i and -p allows no argment.
*/
if (!av && !cflag && !iflag && !pflag)
usage();
/*
* command cannot be duplicated.
*/
if (commands > 1)
usage();
/*
* -c and -i command allows only -v option.
*/
if (cflag + iflag && options)
usage();
/*
* -r is not valid for -g, -i and -s.
*/
if (rflag && (gflag + iflag + sflag))
usage();
}
/*
* remove leading blanks.
*/
if (av && !gflag)
for (; *av == ' ' || *av == '\t'; av++)
;
if (cflag && av && regexp(av))
die("regular expression not 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.
*/
getdbpath(cwd, root, dbpath);
if (pflag) {
fprintf(stdout, "%s\n", dbpath);
exit(0);
}
/*
* incremental update of tag files.
*/
if (iflag) {
if (chdir(root) < 0)
die1("cannot change directory to '%s'.", root);
sprintf(comline, "gtags -i%s %s", (vflag) ? "v" : "", dbpath);
if (system(comline))
exit(1);
exit(0);
}
/*
* complete function name
*/
if (cflag) {
completelist(dbpath, av);
exit(0);
}
/*
* make sort filter.
*/
if (sflag && xflag)
*sortfilter = 0;
else if (fflag)
sprintf(sortfilter, "sort +1n -2");
else if (xflag) /* print details */
sprintf(sortfilter, "sort +0 -1 +2 -3 +1n -2");
else /* print just file name */
sprintf(sortfilter, "sort | uniq");
/*
* make path filter.
*/
if (aflag) /* absolute path name */
sprintf(pathfilter, "sed -e 's!\\.!%s!'", root);
else /* relative path name */
relative_filter(root, cwd, pathfilter);
/*
* make local prefix.
*/
if (lflag) {
/*
* getdbpath() assure follows.
* cwd != "/" and cwd includes root.
*/
strcpy(local, cwd);
strcat(local, "/");
localprefix = local + strlen(root) - 1;
*localprefix = '.';
}
/*
* 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);
}
db = (rflag) ? GRTAGS : ((sflag) ? GSYMS : GTAGS);
/*
* print function definitions.
*/
if (fflag) {
struct stat sb;
char pathbuf[MAXPATHLEN+1], *path;
char *p;
FILE *op;
DBIO *dbio;
/* av !~ /\.[chysS]$/) */
p = av + strlen(av) - 1; /* last character */
if (stat(av, &sb) || !S_ISREG(sb.st_mode))
die1("file '%s' not found.", av);
if (*(p - 1) != '.' || !locatestring("chysS", p, 0))
die("accept only file name end with '.c .h .y .s .S'.");
/*
* convert path into relative from root directory of source tree.
*/
path = realpath(av, pathbuf);
if (*path != '/')
die("realpath(3) is not compatible with BSD version.");
if (strncmp(path, root, strlen(root)))
die1("file '%s' is out of source tree.", path);
path += strlen(root) - 1;
*path = '.';
if (!(op = popen(outfilter(), "w")))
die("cannot open output pipe.");
dbio = gtagsopen(dbpath, db, 0);
for (p = db_first(dbio, NULL, DBIO_SKIPMETA); p; p = db_next(dbio))
if (includepath(p, path))
fprintf(op, "%s\n", p);
db_close(dbio);
pclose(op);
exit(0);
}
/*
* search in current source tree.
*/
count = search(av, cwd, root, dbpath, db);
/*
* search in library path.
*/
if (count == 0 && !rflag && !sflag && !regexp(av) && getenv("GTAGSLIBPATH")) {
char envbuf[MAXENVLEN+1];
char libdbpath[MAXPATHLEN+1];
char *p, *lib;
strcpy(envbuf, getenv("GTAGSLIBPATH"));
p = envbuf;
while (p) {
lib = p;
if ((p = locatestring(p, ":", 0)) != NULL)
*p++ = 0;
if (!strncmp(lib, cwd, strlen(cwd)) || !strncmp(cwd, lib, strlen(lib)))
continue;
if (!gtagsexist(lib, libdbpath))
continue;
if (!strcmp(dbpath, libdbpath))
continue;
if (aflag) /* absolute path name */
sprintf(pathfilter, "sed -e 's!\\.!%s!'", lib);
else
relative_filter(lib, cwd, pathfilter);
count = search(av, cwd, lib, libdbpath, GTAGS);
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);
}
/*
* outfilter: return output filter.
*
* gi) pathfilter
* gi) sortfilter
* r) output filter
*/
char *
outfilter(void)
{
static char filter[MAXCOMLINE+1];
/*
* make output filter
*/
if (*sortfilter)
sprintf(filter, "%s | %s", sortfilter, pathfilter);
else
strcpy(filter, pathfilter);
return filter;
}
/*
* completelist: print complete list of function
*
* i) dbpath dbpath directory
* i) prefix prefix of primary key
*/
void
completelist(dbpath, prefix)
char *dbpath;
char *prefix;
{
char *p;
DBIO *dbio;
dbio = gtagsopen(dbpath, GTAGS, 0);
for (p = db_first(dbio, prefix, DBIO_KEY|DBIO_PREFIX|DBIO_SKIPMETA); p; p = db_next(dbio))
(void)fprintf(stdout, "%s\n", p);
db_close(dbio);
}
/*
* relative_filter: make relative path filter
*
* i) root the root directory of source tree
* i) argcwd current directory
* o) bp result
* relative path filter
*/
void
relative_filter(root, cwd, bp)
char *root;
char *cwd;
char *bp;
{
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;
if (*c == 0 && *p)
die("illegal root.");
/*
* forward to root.
*/
strcpy(bp, "sed -e 's!\\./!");
for (c = branch; *c; c++)
if (*c == '/')
strcat(bp, "../");
p = root + (branch - cwd);
/*
* backward to leaf.
*/
if (*p) {
p++;
strcat(bp, p);
strcat(bp, "/");
}
strcat(bp, "!'");
/*
* remove redundancy.
*/
if (*branch) {
char unit[256];
bp += strlen(bp);
p = unit;
for (c = branch + 1; ; c++) {
if (*c == 0 || *c == '/') {
*p = 0;
sprintf(bp, " -e 's!\\.\\./%s/!!'", unit);
bp += strlen(bp);
if (*c == 0)
break;
p = unit;
} else
*p++ = *c;
}
}
}
/*
* printtag: print a tag's line
*
* i) op output stream
* i) root root of source tree
* i) bp tag's line
* i) compact 0: standard format, 1: compact format
* r) output line count
*/
int
printtag(op, root, bp, compact)
FILE *op;
char *root;
char *bp;
int compact;
{
int count = 0;
char *tag, *file, *lno;
int opened = 0;
char path[MAXPATHLEN+1];
char *buffer;
int line = 0, tagline = 0;
FILE *ip;
if (!xflag) {
fprintf(op, "%s\n", extractpath(bp));
return 1;
}
if (compact) { /* compact format */
char *p = bp;
tag = p; /* tag = $1 */
for (; !isspace(*p) ; p++)
;
*p++ = 0;
for (; isspace(*p) ; p++)
;
file = p; /* file = $2 */
for (; !isspace(*p) ; p++)
;
*p++ = 0;
for (; isspace(*p) ; p++)
;
lno = p; /* lno = $3 */
sprintf(path, "%s/%s", root, file + 2);
if ((ip = fopen(path, "r")) != NULL) {
opened = 1;
buffer = mgets(ip, 0, NULL);
line = 1;
} else {
buffer = "";
}
while (*lno) {
/* get line number */
for (tagline = 0; *lno >= '0' && *lno <= '9'; lno++)
tagline = tagline * 10 + *lno - '0';
if (*lno == ',')
lno++;
if (opened) {
while (line < tagline) {
if (!(buffer = mgets(ip, 0, NULL)))
die1("unexpected end of file. '%s'", path);
line++;
}
}
if (strlen(tag) >= 16 && tagline >= 1000)
fprintf(op, "%-16s %4d %-16s %s\n",
tag, tagline, file, buffer);
else
fprintf(op, "%-16s%4d %-16s %s\n",
tag, tagline, file, buffer);
count++;
}
if (opened)
fclose(ip);
} else { /* standard format */
/*
* separater in key part must be ' ' to avoid sort(1)'s bug.
*/
detab(op, bp);
count++;
}
return count;
}
/*
* regexp: test whether regular expression included.
*
* i) s string
* r) 0: not included, 1: included
*
* This function cannot be used for generic purpose.
* Any character except '[a-zA-Z_0-9]' is assumed RE char..
*/
int
regexp(s)
char *s;
{
int c;
while ((c = *s++) != NULL)
if ( (c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9') ||
(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, *p, *e;
int linenum, count, editlen;
regex_t preg;
/*
* convert spaces into %FF format.
*/
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 = popen(outfilter(), "w")))
die("cannot open output pipe.");
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, 0, NULL)) != NULL) {
linenum++;
if (regexec(&preg, buffer, 0, 0, 0) == 0) {
count++;
if (xflag == 0) {
fprintf(op, "%s\n", path);
break;
}
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();
pclose(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);
}
}
/*
* 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;
DBIO *dbio;
int compact;
regex_t preg;
/*
* open tag file.
* currently only GSYMS is compact format.
*/
dbio = gtagsopen(dbpath, db, 0);
compact = (db == GSYMS) ? 1 : 0;
if (!(op = popen(outfilter(), "w")))
die1("filter '%s' failed.", outfilter());
/*
* regular expression.
*/
if (regexp(pattern) && regcomp(&preg, pattern, REG_EXTENDED) == 0) {
char prefix_buf[IDENTLEN+1];
char *prefix = (char *)0;
if (*pattern == '^' && *(p = pattern + 1) && (isalpha(*p) || *p == '_')) {
prefix = prefix_buf;
*prefix++ = *p++;
while (*p && (isalpha(*p) || isdigit(*p) || *p == '_'))
*prefix++ = *p++;
*prefix = 0;
prefix = prefix_buf;
p = db_first(dbio, prefix, DBIO_SKIPMETA|DBIO_PREFIX);
} else {
p = db_first(dbio, NULL, DBIO_SKIPMETA);
}
for (; p; p = db_next(dbio)) {
if (*p == ' ')
continue;
if (regexec(&preg, dbio->lastkey, 0, 0, 0) == 0)
count += printtag(op, root, p, compact);
}
} else {
for (p = db_first(dbio, pattern, 0); p; p = db_next(dbio)) {
if (lflag) {
char *q;
/* locate start point of a path */
q = locatestring(p, "./", 0);
if (!locatestring(q, localprefix, 1))
continue;
}
count += printtag(op, root, p, compact);
}
}
pclose(op);
db_close(dbio);
return count;
}
/*
* extractpath: extract path string of a tag line
*
* i) line tag line
* r) path
*
* standard format: main 12 ./xxx/xxx/xxx.c main(argc, argv) {
* compact format: main ./xxx/xxx/xxx.c 12,15,55,101
*/
char *
extractpath(line)
char *line;
{
static char buf[MAXPATHLEN+1];
char *p, *b;
int c;
if (!(p = locatestring(line, "./", 0)))
die("illegal tag format (path not found).");
b = buf;
while ((c = *b++ = *p++) != NULL) {
if (c == ' ' || c == '\t') {
*(b - 1) = 0;
break;
}
}
return buf;
}
/*
* 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, "./", 0)))
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;
}
-12
View File
@@ -1,12 +0,0 @@
XCOMM
XCOMM Imakefile for gozilla
XCOMM
LOCAL_LIBRARIES = XawClientLibs -L../lib -lutil
DEPLIBS = XawClientDepLibs ../lib/libutil.a
DEFINES = -DSTANDALONE -DGLOBAL -I../lib
SRCS = gozilla.c remote.c
OBJS = gozilla.o remote.o
ComplexProgramTarget(gozilla)
-194
View File
@@ -1,194 +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.
*
* gozilla.c 27-Oct-97
*
*/
#include <stdio.h>
#include <stdlib.h>
#include "global.h"
char *progname = "gozilla"; /* command name */
static void usage __P((void));
void main __P((int, 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);
}
void
main(argc, argv)
int argc;
char *argv[];
{
char c, *p, *q;
char *browser = (char *)0;
char *command = (char *)0;
char *arg = (char *)0;
char URL[MAXPATHLEN+1];
char com[MAXCOMLINE+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:", 1) || locatestring(argv[0], "file:", 1))
strcpy(URL, argv[0]);
else {
char *abspath;
char pathbuf[MAXPATHLEN+1];
char htmlpath[MAXPATHLEN+1];
if (!test("f", argv[0]) && !test("d", argv[0]))
die1("path '%s' not found.", argv[0]);
if (!(abspath = realpath(argv[0], pathbuf)))
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", 3)) {
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, (char *)0);
die("loading mozilla failed.");
}
exit(0);
}
exit(status);
}
int
sendcommand(com)
char *com;
{
int argc = 3;
char *argv[4];
argv[0] = "netscape-remote";
argv[1] = "-remote";
argv[2] = com;
argv[3] = (char *)0;
return netscape_remote(argc, argv);
}
-141
View File
@@ -1,141 +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 ([email protected])
-717
View File
@@ -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
void
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 */
-119
View File
@@ -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_ */
-350
View File
@@ -1,350 +0,0 @@
;;; gtags.el --- gtags facility for Emacs
;;
;; 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.
;;
;; gtags.el 31-Aug-97
;;
;; This file is part of GLOBAL.
;; Author: Shigio Yamaguchi <[email protected]>
;; Version: 1.1
;; 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 "\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 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)
(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 (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-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 (match-string 1)))
(setq file (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 ()
(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 (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)
(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
-6
View File
@@ -1,6 +0,0 @@
PROG= gtags
CFLAGS+=-I${.CURDIR}/../lib
LDADD= $(LIBUTIL)
DPADD= $(LIBUTIL)
.include <bsd.prog.mk>
-305
View File
@@ -1,305 +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.
*
* gtags.c 12-Dec-97
*
*/
#include <sys/stat.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include "global.h"
char *progname = "gtags"; /* command name */
static void usage __P((void));
void main __P((int, char **));
int incremental __P((char *));
void tagadd __P((int, char *));
void createtags __P((char *, int));
char *current __P((void));
static int iflag;
static int oflag;
static int vflag;
static void
usage()
{
fprintf(stderr, "usage:\t%s [-i][-o][-v][dbpath]\n", progname);
exit(1);
}
void
main(argc, argv)
int argc;
char *argv[];
{
char dbpath[MAXPATHLEN+1];
char env[MAXENVLEN+1];
char *p;
int db;
while (--argc > 0 && (++argv)[0][0] == '-') {
for (p = argv[0] + 1; *p; p++) {
switch (*p) {
case 'i':
iflag++;
break;
case 'o':
oflag++;
break;
case 'v':
vflag++;
break;
/* for compatibility */
case 's':
case 'e':
break;
default:
usage();
}
}
}
if (argc > 0) {
strcpy(dbpath, *argv);
} else {
if (!getcwd(dbpath, MAXPATHLEN))
die("cannot get current directory.");
}
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", current());
/*
* teach gctags(1) where is dbpath.
*/
sprintf(env, "GTAGSDBPATH=%s", dbpath);
putenv(env);
/*
* incremental update.
*/
if (iflag && test("f", makepath(dbpath, dbname(GTAGS))) &&
test("f", makepath(dbpath, dbname(GRTAGS))))
{
(void)incremental(dbpath);
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;
if (vflag)
fprintf(stderr, "[%s] Creating '%s'.\n", current(), dbname(db));
createtags(dbpath, db);
}
if (vflag)
fprintf(stderr, "[%s] Done.\n", current());
exit(0);
}
/*
* incremental: incremental update
*
* i) dbpath dbpath directory
* r) 0: not updated, 1: updated
*/
int
incremental(dbpath)
char *dbpath;
{
struct stat sb;
time_t gtags_mtime;
int updated = 0;
char *path;
int db;
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, &sb) < 0)
die1("stat failed '%s'.", path);
gtags_mtime = sb.st_mtime;
for (findopen(); (path = findread(NULL)) != NULL; ) {
if (stat(path, &sb) < 0)
die1("stat failed '%s'.", path);
/*
* only the path modified after GTAGS was modified.
*/
if (gtags_mtime < sb.st_mtime) {
updated = 1;
if (vflag)
fprintf(stderr, " Updating tags of '%s' ...", path + 2);
for (db = GTAGS; db < GTAGLIM; db++) {
if (db == GSYMS && !test("f", makepath(dbpath, dbname(db))))
continue;
if (vflag)
fprintf(stderr, "%s", dbname(db));
tagopen(dbpath, db, 2);
/*
* GTAGS needed to make GRTAGS.
*/
if (db == GRTAGS)
lookupopen(dbpath);
tagdelete(path);
if (vflag)
fprintf(stderr, "..");
tagadd(db, path);
if (db == GRTAGS)
lookupclose();
tagclose();
}
if (vflag)
fprintf(stderr, " Done.\n");
}
}
findclose();
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", current());
fprintf(stderr, " Done.\n");
}
return updated;
}
/*
* tagadd: add records which has specified path.
*
* i) db 0: GTAGS, 1: GRTAGS, 2: GSYMS
* i) path source file
*/
void
tagadd(db, path)
int db;
char *path;
{
char *tagline, *p, *q;
char key[IDENTLEN+1];
FILE *ip;
stropen();
/*
* make command line.
*/
strputs("gctags -Dex");
if (db == GRTAGS)
strputs("r");
if (db == GSYMS)
strputs("sc");
strputc(' ');
strputs(path);
p = strclose();
if (!(ip = popen(p, "r")))
die1("cannot execute '%s'.", p);
while ((tagline = mgets(ip, 0, NULL)) != NULL) {
p = tagline;
q = key;
while (*p && !isspace(*p))
*q++ = *p++;
*q = 0;
tagput(key, tagline);
}
pclose(ip);
}
/*
* createtags: create tags file
*
* i) dbpath dbpath directory
* i) db GTAGS, GRTAGS, GSYMS
*/
void
createtags(dbpath, db)
char *dbpath;
int db;
{
char *path;
/*
* GTAGS needed to make GRTAGS.
*/
if (db == GRTAGS)
lookupopen(dbpath);
tagopen(dbpath, db, 1);
for (findopen(); (path = findread(NULL)) != NULL; ) {
/*
* GSYMS doesn't treat asembler.
*/
if (db == GSYMS) {
char *p = path + strlen(path) - 1;
if ((*p == 's' || *p == 'S') && *(p - 1) == '.')
continue;
}
if (vflag)
fprintf(stderr, " extracting tags of %s.\n", path);
tagadd(db, path);
}
findclose();
tagclose();
if (db == GRTAGS)
lookupclose();
}
/*
* current: current date and time
*
* r) date and time
*/
char *
current(void)
{
static char buf[80];
time_t tval;
if (time(&tval) == -1)
die("cannot get current time.");
(void)strftime(buf, sizeof(buf), "%+", localtime(&tval));
return buf;
}
-7
View File
@@ -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>
-8
View File
@@ -1,8 +0,0 @@
LIB= util
SRCS= 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
NOPROFILE= yes
install:
@echo -n
.include <bsd.lib.mk>
-328
View File
@@ -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);
}
-89
View File
@@ -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_ */
-48
View File
@@ -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];
}
-53
View File
@@ -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_ */
-49
View File
@@ -1,49 +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.
*
* die.h 16-Oct-97
*
*/
#ifndef _DIE_H_
#define _DIE_H_
#include <stdio.h>
extern 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)
#endif /* ! _DIE_H_ */
-165
View File
@@ -1,165 +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.
*
* find.c 20-Oct-97
*
*/
#include <stdio.h>
#include <sys/types.h>
#include <regex.h>
#include <sys/param.h>
#include "gparam.h"
#include "find.h"
#include "die.h"
#include "locatestring.h"
/*
* usage of findxxx()
*
* findopen();
* while (path = findread(&length)) {
* ...
* }
* findclose();
*
*/
static char *skippath[] = {
"y.tab.c",
"y.tab.h",
"SCCS/",
"RCS/",
};
static char *ext[] = {
"c",
"h",
"y",
"s",
"S",
};
static char findcom[MAXCOMLINE+1];
static regex_t skip_area;
static regex_t *skip;
static FILE *ip;
static int opened;
int
issource(path)
char *path;
{
char *p;
if (!(p = locatestring(path, ".", 2)))
return 0;
++p;
if (sizeof(ext) != 0) {
int i, lim = sizeof(ext)/sizeof(char *);
for (i = 0; i < lim; i++)
if (*ext[i] == *p && !strcmp(ext[i], p))
return 1;
}
return 0;
}
void
findopen(void)
{
char edit[512], *p, *q;
int i, lim;
if (opened)
die("nested call to findopen.");
opened = 1;
p = findcom;
strcpy(p, "find . \\( -type f -o -type l \\) \\(");
p += strlen(p);
lim = sizeof(ext)/sizeof(char *);
for (i = 0; i < lim; i++) {
sprintf(p, " -name '*.%s'%s", ext[i], (i + 1 < lim) ? " -o" : "");
p += strlen(p);
}
sprintf(p, " \\) -print");
if (sizeof(skippath) != 0) {
int i, lim = sizeof(skippath)/sizeof(char *);
/*
* construct regular expression.
*/
p = edit;
*p++ = '(';
for (i = 0; i < lim; i++) {
*p++ = '/';
for (q = skippath[i]; *q; q++) {
if (*q == '.')
*p++ = '\\';
*p++ = *q;
}
if (*(q - 1) != '/')
*p++ = '$';
*p++ = '|';
}
*(p - 1) = ')';
*p = 0;
/*
* compile regular expression.
*/
skip = &skip_area;
if (regcomp(skip, edit, REG_EXTENDED|REG_NEWLINE) != 0)
die("cannot compile regular expression.");
} else {
skip = (regex_t *)0;
}
if (!(ip = popen(findcom, "r")))
die("cannot execute find.");
}
char *
findread(length)
int *length;
{
static char path[MAXPATHLEN+1];
char *p;
while (fgets(path, MAXPATHLEN, ip)) {
if (!skip || regexec(skip, path, 0, 0, 0) != 0) {
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 (char *)0;
}
void
findclose(void)
{
pclose(ip);
opened = 0;
}
-51
View File
@@ -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.
*
* 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_ */
-160
View File
@@ -1,160 +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.
*
* getdbpath.c 20-Oct-97
*
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include "die.h"
#include "getdbpath.h"
#include "locatestring.h"
#include "test.h"
static char *makeobjdirprefix; /* obj partition */
static char *makeobjdir; /* obj directory */
static int bsd; /* if BSD */
/*
* 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;
}
if (bsd) {
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 (getenv("OSTYPE") && locatestring(getenv("OSTYPE"), "BSD", 0)) {
if ((p = getenv("MAKEOBJDIRPREFIX")) != NULL)
makeobjdirprefix = p;
else
makeobjdirprefix = "/usr/obj";
if ((p = getenv("MAKEOBJDIR")) != NULL)
makeobjdir = p;
else
makeobjdir = "obj";
bsd = 1;
}
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.");
}
}
-49
View File
@@ -1,49 +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.
*
* 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_ */
-54
View File
@@ -1,54 +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.
*
* global.h 16-Oct-97
*
*/
#ifndef _GLOBAL_H_
#define _GLOBAL_H_
#include "gparam.h"
#include "dbname.h"
#include "makepath.h"
#include "dbio.h"
#include "locatestring.h"
#include "mgets.h"
#include "die.h"
#include "find.h"
#include "getdbpath.h"
#include "strop.h"
#include "gtagsopen.h"
#include "lookup.h"
#include "tab.h"
#include "tag.h"
#include "test.h"
#endif /* ! _GLOBAL_H_ */
-42
View File
@@ -1,42 +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.
*
* gparam.h 16-Oct-97
*
*/
#ifndef _GPARAM_H_
#define _GPARAM_H_
#define MAXCOMLINE 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 */
#endif /* ! _GPARAM_H_ */
-100
View File
@@ -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;
}
-41
View File
@@ -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_ */
Loaded 100 of 2709 files, more files were not shown because too many files have changed in this diff. Show more