diff options
-rw-r--r-- | ChangeLog | 46 | ||||
-rw-r--r-- | Makefile.in | 166 | ||||
-rw-r--r-- | THANKS | 19 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | acconfig.h | 26 | ||||
-rw-r--r-- | bitops.c | 6 | ||||
-rw-r--r-- | bitops.h | 4 | ||||
-rw-r--r-- | config.h.in | 35 | ||||
-rwxr-xr-x | configure | 150 | ||||
-rw-r--r-- | configure.in | 26 | ||||
-rw-r--r-- | depend.out | 34 | ||||
-rw-r--r-- | fid.c | 11 | ||||
-rw-r--r-- | filenames.c | 3 | ||||
-rw-r--r-- | filenames.h | 26 | ||||
-rw-r--r-- | idfile.c | 58 | ||||
-rw-r--r-- | idfile.h | 24 | ||||
-rwxr-xr-x | idtest | 26 | ||||
-rw-r--r-- | idx.c | 5 | ||||
-rw-r--r-- | iid.c | 123 | ||||
-rw-r--r-- | iid.y | 53 | ||||
-rw-r--r-- | lid.c | 89 | ||||
-rw-r--r-- | misc.c | 3 | ||||
-rw-r--r-- | misc.h | 14 | ||||
-rw-r--r-- | mkid.c | 101 | ||||
-rw-r--r-- | scanners.c | 49 | ||||
-rw-r--r-- | scanners.h | 12 | ||||
-rw-r--r-- | stamp-h.in | 2 | ||||
-rw-r--r-- | stamp-vti | 2 | ||||
-rw-r--r-- | strerror.c | 3 | ||||
-rw-r--r-- | token.c | 2 | ||||
-rw-r--r-- | token.h | 6 | ||||
-rw-r--r-- | version.texi | 2 |
32 files changed, 555 insertions, 573 deletions
@@ -1,5 +1,44 @@ +Sat Feb 25 16:23:49 1995 Greg McGary <gkm@magilla.cichlid.com> + + * Version 3.0.8 released. + + * configure.in, acconfig.h, Makefile.in (TOUCH, PREV_VERSION): + Added. (check): Export PATH. (TAGS): Eliminate unnecessary `-t' + option to etags. (mostlyclean, clean, distclean, + maintainer-clean, install): Bring into conformance with GNU + standards. (AWK, OLD_PATCH_LEVEL, PATCH_LEVEL, SIZEOF_LONG, + bump-major, bump-minor, bump-patch): Deleted. (ANSI2KNR, + ansi2knr): Added. (depend): Fixed to support ansi2knr. + + * configure.in: Update stamp-h inside AC_OUTPUT. + + * acconfig.h: Work harder to force #undef of HAVE_TERMIOS_H for NeXT. + (__P): Added. + + * bitops.c, fid.c, filenames.c, idfile.c, idx.c, iid.c, lid.c, + misc.c, mkid.c, scanners.c, token.c: Changed "config.h" to <config.h>. + + * acconfig.h, bitops.c, bitops.h, fid.c, filenames.h, idfile.c, + idfile.h, idx.c, iid.c, lid.c, misc.h, mkid.c, scanners.c, + scanners.h, token.h: Use __P around function prototype decls. + + * acconfig.h, idfile.h, idfile.c (intmin32_t, uintmin32_t): + Deleted in favor of long and unsigned long. + + * idtest: Fixed bugs (Thanks to Francois Pinard). + + * mkid.c (write_idfile): Delete erroneous remnant of old file name + indexing scheme (Reported by Dave Wiggins). (assert_hits): + Simplified & fixed erroneous assertion. + + * lid.c (grep_id): Treat '\0' as end-of-line along with '\n'. + + * strerror.c (strerror): Protoize defn. + Mon Feb 20 16:18:47 1995 Greg McGary <gkm@magilla.cichlid.com> + * Version 3.0.7 released. + * scanners.c (scanners, suffixes, init_scanners, get_scanner, set_scan_args, get_lang_name, get_filter, get_suffix): Fixed boundary conditions. @@ -25,9 +64,10 @@ Mon Feb 20 16:18:47 1995 Greg McGary <gkm@magilla.cichlid.com> Sun Feb 19 19:21:09 1995 Thomas Neumann <tom@smart.ruhr.de> - * configure.in: Check for <sgtty.h>, not <sgttyb.h>. * - accconfig.h: Disbale HAVE_TERMIOS_H for NeXT, if HAVE_SGTTY_H is - present. * lid.c: Depend on HAVE_SGTTY_H, not HAVE_SGTTYB_H. + * configure.in: Check for <sgtty.h>, not <sgttyb.h>. + * accconfig.h: Disbale HAVE_TERMIOS_H for NeXT, + if HAVE_SGTTY_H is present. + * lid.c: Depend on HAVE_SGTTY_H, not HAVE_SGTTYB_H. (savetty): ANSI'fy arglist declaration. Sat Feb 18 21:44:39 1995 Greg McGary <gkm@magilla.cichlid.com> diff --git a/Makefile.in b/Makefile.in index fa1d1b1..65ee277 100644 --- a/Makefile.in +++ b/Makefile.in @@ -20,8 +20,7 @@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ -PATCH_LEVEL = @PATCH_LEVEL@ -OLD_PATCH_LEVEL=@OLD_PATCH_LEVEL@ +PREV_VERSION = @PREV_VERSION@ SHELL = /bin/sh VPATH = @srcdir@ @@ -32,19 +31,20 @@ srcdir = @srcdir@ exec_prefix = @exec_prefix@ bindir = $(exec_prefix)/bin infodir = $(prefix)/info -libdir = @libdir@ +datadir = @datadir@ ############################################################################## CC = @CC@ YACC = @YACC@ LN_S = @LN_S@ -AWK = @AWK@ -MAKEINFO = makeinfo -TEXI2DVI = texi2dvi INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +ANSI2KNR = @ANSI2KNR@ +MAKEINFO = makeinfo +TEXI2DVI = texi2dvi +TOUCH = echo timestamp > CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ @@ -65,11 +65,13 @@ LID_LINKS = eid aid gid pid ######################################## -MKID_OFILES = mkid.o misc.o scanners.o idfile.o filenames.o bitops.o $(LIB_OFILES) -LID_OFILES = lid.o misc.o idfile.o filenames.o bitops.o token.o $(REGEXP) $(LIB_OFILES) -FID_OFILES = fid.o misc.o idfile.o filenames.o bitops.o token.o $(LIB_OFILES) -IDX_OFILES = idx.o scanners.o filenames.o misc.o $(LIB_OFILES) -IID_OFILES = iid.o $(STRCASECMP) $(LIB_OFILES) +MKID_OFILES = mkid$o misc$o scanners$o idfile$o filenames$o bitops$o $(LIB_OFILES) +LID_OFILES = lid$o misc$o idfile$o filenames$o bitops$o token$o $(REGEXP) $(LIB_OFILES) +FID_OFILES = fid$o misc$o idfile$o filenames$o bitops$o token$o $(LIB_OFILES) +IDX_OFILES = idx$o scanners$o filenames$o misc$o $(LIB_OFILES) +IID_OFILES = iid$o $(STRCASECMP) $(LIB_OFILES) + +ALL_OFILES = $(MKID_OFILES) $(LID_OFILES) $(FID_OFILES) $(IDX_OFILES) $(IID_OFILES) ######################################## @@ -86,12 +88,12 @@ SRC_HFILES = alloc.h bitops.h filenames.h idarg.h \ LIB_HFILES = regex.h getopt.h TAG_SRC_FILES = $(SRC_HFILES) $(LIB_HFILES) $(SRC_CFILES) $(LIB_CFILES) $(SRC_YFILES) -DIST_SRC_FILES =$(ALL_CFILES) $(SRC_HFILES) $(LIB_HFILES) $(SRC_YFILES) +DIST_SRC_FILES= $(ALL_CFILES) $(SRC_HFILES) $(LIB_HFILES) $(SRC_YFILES) INFO_FILES = mkid.info -DIST_DOC_FILES =mkid.texinfo version.texi stamp-vti $(INFO_FILES) fid.1 iid.1 lid.1 mkid.1 iid.help +DIST_DOC_FILES= mkid.texinfo version.texi stamp-vti $(INFO_FILES) fid.1 iid.1 lid.1 mkid.1 iid.help DIST_CONF_FILES=aclocal.m4 acconfig.h configure.in Makefile.in mkdirhier install-sh \ - stamp-h.in config.h.in configure $(DEPEND) + stamp-h.in config.h.in configure $(DEPEND) ansi2knr.c ansi2knr.1 DIST_MISC_FILES=COPYING README README.alpha-test INSTALL NEWS TODO THANKS \ idtest gid.el ChangeLog @@ -99,33 +101,62 @@ DIST_FILES = $(DIST_CONF_FILES) $(DIST_SRC_FILES) $(DIST_DOC_FILES) $(DIST_MISC_ ######################################## -DIST_DIR = $(PACKAGE)-$(VERSION).$(PATCH_LEVEL) +DIST_DIR = $(PACKAGE)-$(VERSION) DIST_TGZ = $(DIST_DIR).tar.gz DIST_UU = $(DIST_TGZ).uu DIST_SHAR = $(DIST_DIR).shar -OLD_DIST_DIR = $(PACKAGE)-$(VERSION).$(OLD_PATCH_LEVEL) +OLD_DIST_DIR = $(PACKAGE)-$(PREV_VERSION) -PATCH_C_GZ = $(OLD_DIST_DIR)-$(VERSION).$(PATCH_LEVEL).diff.gz -PATCH_U_GZ = $(OLD_DIST_DIR)-$(VERSION).$(PATCH_LEVEL).udiff.gz -PATCH_C_UU = $(PATCH_C_GZ).uu +CDIFF_GZ = $(OLD_DIST_DIR)-$(VERSION).diff.gz +UDIFF_GZ = $(OLD_DIST_DIR)-$(VERSION).udiff.gz +CDIFF_UU = $(CDIFF_GZ).uu ############################################################################## .PRECIOUS: $(DEPEND) Makefile configure config.h config.h.in .SUFFIXES: -.SUFFIXES: .c .i .o +.SUFFIXES: .c .i ._c ._i ._o .o +o = .@U@o INCLUDES = -I. -I$(srcdir) CC_FLAGS = $(DEFS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS) LINK = $(CC) $(LDFLAGS) -o $@ +COMPILE = $(CC) -c $(CC_FLAGS) +PRE_PROCESS = $(CPP) $(CC_FLAGS) + +######################################## # This is a convenient diagnostic aid: get a cpp'ed foo.c with "make foo.i" .c.i: - $(CPP) $(CC_FLAGS) $< >$@ + $(PRE_PROCESS) $< >$@ .c.o: - $(CC) $(CC_FLAGS) -c $< + $(COMPILE) $< + +######################################## + +.c._c: + $(ANSI2KNR) $< > $@.tmp && mv $@.tmp $@ +._c._o: + @echo $(COMPILE) $< + @rm -f _$*.c + @ln $< _$*.c && $(COMPILE) _$*.c && mv _$*.o $@ && rm _$*.c +.c._o: + $(ANSI2KNR) $< > $*._c.tmp && mv $*._c.tmp $*._c + @echo $(COMPILE) $*._c + @rm -f _$*.c + @ln $*._c _$*.c && $(COMPILE) _$*.c && mv _$*.o $@ && rm _$*.c + +._c._i: + @echo $(PRE_PROCESS) $< + @rm -f _$*.c + @ln $< _$*.c && $(PRE_PROCESS) _$*.c >$@ +.c._i: + $(ANSI2KNR) $< > $*._c.tmp && mv $*._c.tmp $*._c + @echo $(PRE_PROCESS) $*._c + @rm -f _$*.c + @ln $*._c _$*.c && $(PRE_PROCESS) _$*.c >$@ ############################################################################## @@ -152,6 +183,13 @@ $(LID_LINKS): lid iid.c: iid.y $(YACC) $(srcdir)/iid.y && mv -f y.tab.c $@ +######################################## + +$(ALL_OFILES): $(ANSI2KNR) + +ansi2knr: ansi2knr.o + $(LINK) ansi2knr.o $(LIBS) + ############################################################################## info: $(INFO_FILES) @@ -170,12 +208,12 @@ stamp-vti: configure.in :; else \ echo "@set VERSION $(VERSION)" >$(srcdir)/version.texi; \ fi - date >stamp-vti + $(TOUCH) stamp-vti ############################################################################## install: all - $(srcdir)/mkdirhier $(bindir) $(libdir) $(infodir) + $(srcdir)/mkdirhier $(bindir) $(datadir) $(infodir) @for file in $(PROGRAMS); do \ cmd="$(INSTALL_PROGRAM) $$file $(bindir)/`echo $$file | sed '$(transform)'`"; \ (echo $$cmd; eval $$cmd); \ @@ -206,71 +244,46 @@ uninstall: ############################################################################## check: mkid lid fid idx - here=`pwd`; PATH=$$here:$$PATH; cd $(srcdir) \ + here=`pwd`; PATH=$$here:$$PATH; export PATH; cd $(srcdir) \ && $$here/mkid -v -f$$here/ID $(TAG_SRC_FILES) \ && $(SHELL) ./idtest -f$$here/ID $(TAG_SRC_FILES) \ && rm -f $$here/ID -ID: $(TAG_SRC_FILES) mkid - here=`pwd`; PATH=$$here:$$PATH; export PATH; cd $(srcdir) \ - && $$here/mkid -f$$here/ID $$here/config.h $(TAG_SRC_FILES) +id: ID +ID: $(TAG_SRC_FILES) + here=`pwd`; cd $(srcdir) \ + && PATH=$$here:$$PATH mkid -f$$here/ID $$here/config.h $(TAG_SRC_FILES) tags: TAGS TAGS: $(TAG_SRC_FILES) - here=`pwd`; cd $(srcdir) && etags -t $(TAG_SRC_FILES) -o $$here/TAGS + here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(TAG_SRC_FILES) ############################################################################## mostlyclean: - rm -f $(TARGETS) a.out - rm -f *.o core *.core core.* *.aux *.cp *.cps *.dvi *.fn *.fns - rm -f *.ky *.kys *.log *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs + rm -f a.out *.o *._? core *.core core.* *.aux *.cp *.cps *.fn *.fns + rm -f *.dvi *.ky *.kys *.log *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs *.tmp clean: mostlyclean + rm -f $(TARGETS) rm -f iid.c distclean: clean + rm -f ansi2knr ID TAGS rm -f Makefile config.h config.status config.cache stamp-h -realclean: distclean - rm -f *.info* TAGS ID *~ +maintainer-clean: distclean + @echo "This command is intended only for maintainers to use;" + @echo "rebuilding the deleted files may require special tools." + rm -f stamp-vti version.texi mkid.info* ############################################################################## -dist: $(DIST_TGZ) $(PATCH_U_GZ) $(PATCH_C_GZ) - -bump-patch: dist - rm -fr $(OLD_DIST_DIR) - $(AWK) -F= '\ - /^PATCH_LEVEL/ { print $$1 "=" $$2 + 1; next; } \ - { print; }' <configure.in >configure.new \ - && mv configure.new configure.in - -bump-minor: dist - rm -fr $(OLD_DIST_DIR) - $(AWK) -F'[=.]' '\ - /^VERSION/ { print $$1 "=" $$2 "." $$3 + 1; next; } \ - /^PATCH_LEVEL/ { print $$1 "=" 0; next; } \ - { print; }' <configure.in >configure.new \ - && mv configure.new configure.in - -bump-major: dist - rm -fr $(OLD_DIST_DIR) - $(AWK) -F'[=.]' '\ - /^VERSION/ { print $$1 "=" $$2 + 1 ".0"; next; } \ - /^PATCH_LEVEL/ { print $$1 "=" 0; next; } \ - { print; }' <configure.in >configure.new \ - && mv configure.new configure.in - -######################################## +dist: $(DIST_TGZ) $(UDIFF_GZ) $(CDIFF_GZ) shar: $(DIST_SHAR) -$(DIST_SHAR): $(DIST_TGZ) $(PATCH_C_GZ) - shar $(PATCH_C_GZ) $(DIST_TGZ) >$@ - -dist-uu: $(DIST_UU) -$(DIST_UU): $(DIST_TGZ) - uuencode $(DIST_TGZ) <$(DIST_TGZ) >$@ +$(DIST_SHAR): $(DIST_TGZ) $(CDIFF_GZ) + shar $(CDIFF_GZ) $(DIST_TGZ) >$@ dist-tgz: $(DIST_TGZ) $(DIST_TGZ): $(DIST_DIR) @@ -286,18 +299,12 @@ $(DIST_DIR): $(DIST_FILES) ######################################## -# context-diff patches are for distribution -patch-uu: $(PATCH_C_UU) -$(PATCH_C_UU): $(PATCH_C_GZ) - uuencode $(PATCH_C_GZ) <$(PATCH_C_GZ) >$@ - -patch patch-gz: $(PATCH_C_GZ) -$(PATCH_C_GZ): $(OLD_DIST_DIR) $(DIST_DIR) +cdiff: $(CDIFF_GZ) +$(CDIFF_GZ): $(OLD_DIST_DIR) $(DIST_DIR) diff -r -c --show-c-function --new-file $(OLD_DIST_DIR) $(DIST_DIR) |gzip >$@ -# unidiff patches are for the maintainer's information -patchu patchu-gz: $(PATCH_U_GZ) -$(PATCH_U_GZ): $(OLD_DIST_DIR) $(DIST_DIR) +udiff: $(UDIFF_GZ) +$(UDIFF_GZ): $(OLD_DIST_DIR) $(DIST_DIR) diff -r -u $(OLD_DIST_DIR) $(DIST_DIR) |gzip >$@ ############################################################################## @@ -312,14 +319,15 @@ $(srcdir)/configure: configure.in aclocal.m4 config.h: stamp-h stamp-h: $(srcdir)/config.h.in config.status CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status - date >stamp-h + $(TOUCH) stamp-h $(srcdir)/config.h.in: stamp-h.in $(srcdir)/stamp-h.in: configure.in aclocal.m4 acconfig.h cd $(srcdir) && autoheader - date >$(srcdir)/stamp-h.in + $(TOUCH) $(srcdir)/stamp-h.in depend $(DEPEND): - (cd $(srcdir) && $(CC) $(CC_FLAGS) -MM $(ALL_CFILES);) >$(DEPEND) + (cd $(srcdir) && $(CC) $(CC_FLAGS) -MM $(ALL_CFILES)) \ + | sed -e 's/\.o:/$$o:/' >$(DEPEND) ############################################################################## @@ -1,14 +1,19 @@ -mkid THANKS file +`mkid' THANKS file -Mkid, lid, fid, and idx were originally written by Greg McGary. iid +mkid, lid, fid, and idx were originally written by Greg McGary. iid and pid were written by Tom Horsley, who also maintained the programs -for a time and released mkid2 to comp.sources.unix. +for a time and released mkid2 to comp.sources.unix. mkid.texinfo was +written by Tom Horsley. + +Special thanks go to Francois Pinard worked tirelessly to refine +mkid's autoconfiscation, ensure mkid's conformance to GNU standards, +and generally pick all the nits that were fit to pick. ;-) Many people further contributed to mkid by reporting problems, suggesting improvements, or submitting patches. Here is a list of these people. If you contributed, but don't see your name here, -please notify me at the address in the README file. Help me keep this -list complete and accurate. +please notify me (Greg McGary) at the address in the README file. +Help keep this list complete and accurate. Tom Horsley <Tom.Horsley@mail.hcsc.com> Wolfgang Rupprecht <wolfgang@wsrcc.com> @@ -21,3 +26,7 @@ Karl Berry <karl@owl.hq.ileaf.com> Nathanael Makarevitch <nat@nataa.frmug.fr.net> Rodney Brown <rdb@mel.cocam.oz.au> Richard Stallman <rms@gnu.ai.mit.edu> +Dave Wiggins <dpw@x.org> +Thomas Neumann <tom@smart.ruhr.de> +Jim Meyering <meyering@comco.com> +Kazushi (Jam)Marukawa <kazusi-m@is.aist-nara.ac.jp> @@ -45,6 +45,8 @@ enum-tag, keyword, etc. Store caller/callee relationships between identifiers. Indicate which files have defns vs. uses. This info is needed to support a cscope interface. + - Add times(2) results to statistics output. + - treat \ specially for TeX files and do likewise with @ for Texinfo. * cscope - add a cscope work-alike query interface (this is being done by @@ -16,9 +16,6 @@ /* Define to the name of the distribution. */ #undef PACKAGE -/* Define to the patch-level of the distribution. */ -#undef PATCH_LEVEL - /* Define to 1 if ANSI function prototypes are usable. */ #undef PROTOTYPES @@ -27,20 +24,21 @@ @BOTTOM@ -/* (u)intmin32_t are integer types that are *at least* 32 bits. - Larger ints are OK. */ -#if SIZEOF_LONG == 4 - typedef unsigned long uintmin32_t; - typedef long intmin32_t; -#else - typedef unsigned int uintmin32_t; - typedef int intmin32_t; -#endif +/* According to Thomas Neumann, NeXT POSIX termios support is losing, + and sgtty is the way to go. Note: the comment between #undef & + HAVE_TERMIOS_H is necessary to defeat configure's edits. */ -/* NeXT POSIX compatibility is losing. sgtty is the way to go. */ #if HAVE_SGTTY_H # ifdef NeXT -# undef HAVE_TERMIOS_H +# undef /**/ HAVE_TERMIOS_H +# endif +#endif + +#ifndef __P +# ifndef PROTOTYPES +# define __P(args) () +# else +# define __P(args) args # endif #endif @@ -16,11 +16,11 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" +#include <config.h> #include "bitops.h" -static int str_to_int (char *bufp, int size); -static char *int_to_str (int i, int size); +static int str_to_int __P((char *bufp, int size)); +static char *int_to_str __P((int i, int size)); int vec_to_bits (char *bit_array, char *vec, int size) @@ -25,7 +25,7 @@ #define BITAND(ba, bn) ((ba)[(bn) >> 3] &= (1 << ((bn) & 0x07))) #define BITXOR(ba, bn) ((ba)[(bn) >> 3] ^= (1 << ((bn) & 0x07))) -int vec_to_bits (char *bit_array, char *vec, int size); -int bits_to_vec (char *vec, char *bit_array, int bit_count, int size); +int vec_to_bits __P((char *bit_array, char *vec, int size)); +int bits_to_vec __P((char *vec, char *bit_array, int bit_count, int size)); #endif /* not _bitops_h_ */ diff --git a/config.h.in b/config.h.in index 2332ce5..f2e39db 100644 --- a/config.h.in +++ b/config.h.in @@ -53,17 +53,19 @@ /* Define to the name of the distribution. */ #undef PACKAGE -/* Define to the patch-level of the distribution. */ -#undef PATCH_LEVEL - /* Define to 1 if ANSI function prototypes are usable. */ #undef PROTOTYPES /* Define to the major.minor version # of the distribution. */ #undef VERSION -/* The number of bytes in a long. */ -#undef SIZEOF_LONG +#ifndef __P +# ifndef PROTOTYPES +# define __P(args) () +# else +# define __P(args) args +# endif +#endif /* Define if you have the basename function. */ #undef HAVE_BASENAME @@ -170,20 +172,21 @@ /* Define if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H -/* (u)intmin32_t are integer types that are *at least* 32 bits. - Larger ints are OK. */ -#if SIZEOF_LONG == 4 - typedef unsigned long uintmin32_t; - typedef long intmin32_t; -#else - typedef unsigned int uintmin32_t; - typedef int intmin32_t; -#endif +/* According to Thomas Neumann, NeXT POSIX termios support is losing, + and sgtty is the way to go. Note: the comment between #undef & + HAVE_TERMIOS_H is necessary to defeat configure's edits. */ -/* NeXT POSIX compatibility is losing. sgtty is the way to go. */ #if HAVE_SGTTY_H # ifdef NeXT -# undef HAVE_TERMIOS_H +# undef /**/ HAVE_TERMIOS_H +# endif +#endif + +#ifndef __P +# ifndef PROTOTYPES +# define __P(args) () +# else +# define __P(args) args # endif #endif @@ -400,9 +400,8 @@ fi PACKAGE=mkid -VERSION=3.0 -PATCH_LEVEL=7 -OLD_PATCH_LEVEL=`expr $PATCH_LEVEL - 1` +VERSION=3.0.8 +PREV_VERSION=3.0.7 cat >> confdefs.h <<EOF #define PACKAGE "$PACKAGE" EOF @@ -411,11 +410,6 @@ cat >> confdefs.h <<EOF #define VERSION "$VERSION" EOF -cat >> confdefs.h <<EOF -#define PATCH_LEVEL "$PATCH_LEVEL" -EOF - - @@ -453,7 +447,6 @@ test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" - # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&4 @@ -643,38 +636,6 @@ else SET_MAKE="MAKE=${MAKE-make}" fi -for ac_prog in mawk gawk nawk awk -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&4 -if eval "test \"`echo '${'ac_cv_prog_AWK'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&4 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AWK="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AWK="$ac_cv_prog_AWK" -if test -n "$AWK"; then - echo "$ac_t""$AWK" 1>&4 -else - echo "$ac_t""no" 1>&4 -fi - -test -n "$AWK" && break -done - echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&4 @@ -692,7 +653,7 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 696 "configure" +#line 657 "configure" #include "confdefs.h" #include <assert.h> Syntax Error @@ -706,7 +667,7 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 710 "configure" +#line 671 "configure" #include "confdefs.h" #include <assert.h> Syntax Error @@ -738,7 +699,7 @@ else ac_cv_cross=yes else cat > conftest.$ac_ext <<EOF -#line 742 "configure" +#line 703 "configure" #include "confdefs.h" main(){return(0);} EOF @@ -759,7 +720,7 @@ if eval "test \"`echo '${'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 763 "configure" +#line 724 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -781,7 +742,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 785 "configure" +#line 746 "configure" #include "confdefs.h" #include <string.h> EOF @@ -799,7 +760,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 803 "configure" +#line 764 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -820,7 +781,7 @@ if test "$cross_compiling" = yes; then ac_cv_header_stdc=no else cat > conftest.$ac_ext <<EOF -#line 824 "configure" +#line 785 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -854,7 +815,7 @@ if eval "test \"`echo '${'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 858 "configure" +#line 819 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -897,7 +858,7 @@ if eval "test \"`echo '${'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 901 "configure" +#line 862 "configure" #include "confdefs.h" #include <$ac_hdr> EOF @@ -933,7 +894,7 @@ if eval "test \"`echo '${'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 937 "configure" +#line 898 "configure" #include "confdefs.h" #include <$ac_hdr> EOF @@ -969,7 +930,7 @@ if eval "test \"`echo '${'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 973 "configure" +#line 934 "configure" #include "confdefs.h" #include <$ac_hdr> EOF @@ -1003,7 +964,7 @@ if eval "test \"`echo '${'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1007 "configure" +#line 968 "configure" #include "confdefs.h" int main() { return 0; } @@ -1088,7 +1049,7 @@ for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xa -Xc do CFLAGS="$ac_save_CFLAGS $ac_arg" cat > conftest.$ac_ext <<EOF -#line 1092 "configure" +#line 1053 "configure" #include "confdefs.h" #if !defined(__STDC__) || __STDC__ != 1 choke me @@ -1137,7 +1098,7 @@ if eval "test \"`echo '${'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1141 "configure" +#line 1102 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -1171,7 +1132,7 @@ if eval "test \"`echo '${'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1175 "configure" +#line 1136 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1202,7 +1163,7 @@ if eval "test \"`echo '${'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1206 "configure" +#line 1167 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1228,38 +1189,6 @@ EOF fi -echo $ac_n "checking size of long""... $ac_c" 1>&4 -if eval "test \"`echo '${'ac_cv_sizeof_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&4 -else - if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else -cat > conftest.$ac_ext <<EOF -#line 1240 "configure" -#include "confdefs.h" -#include <stdio.h> -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(long)); - exit(0); -} -EOF -eval $ac_link -if test -s conftest && (./conftest; exit) 2>/dev/null; then - ac_cv_sizeof_long=`cat conftestval` -fi -fi -rm -fr conftest* -fi -echo "$ac_t""$ac_cv_sizeof_long" 1>&4 -cat >> confdefs.h <<EOF -#define SIZEOF_LONG $ac_cv_sizeof_long -EOF - - CFLAGS=${CFLAGS--g} LDFLAGS=${LDFLAGS--g} @@ -1273,7 +1202,7 @@ if eval "test \"`echo '${'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 1277 "configure" +#line 1206 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -1291,7 +1220,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 1295 "configure" +#line 1224 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -1318,7 +1247,7 @@ if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1322 "configure" +#line 1251 "configure" #include "confdefs.h" #include <ctype.h> /* Arbitrary system header to define __stub macros. */ /* Override any gcc2 internal prototype to avoid an error. */ @@ -1367,7 +1296,7 @@ if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1371 "configure" +#line 1300 "configure" #include "confdefs.h" #include <ctype.h> /* Arbitrary system header to define __stub macros. */ /* Override any gcc2 internal prototype to avoid an error. */ @@ -1416,7 +1345,7 @@ if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1420 "configure" +#line 1349 "configure" #include "confdefs.h" #include <ctype.h> /* Arbitrary system header to define __stub macros. */ /* Override any gcc2 internal prototype to avoid an error. */ @@ -1465,7 +1394,7 @@ if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1469 "configure" +#line 1398 "configure" #include "confdefs.h" #include <ctype.h> /* Arbitrary system header to define __stub macros. */ /* Override any gcc2 internal prototype to avoid an error. */ @@ -1514,7 +1443,7 @@ if eval "test \"`echo '${'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1518 "configure" +#line 1447 "configure" #include "confdefs.h" #include <alloca.h> int main() { return 0; } @@ -1545,7 +1474,7 @@ if eval "test \"`echo '${'ac_cv_func_alloca'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1549 "configure" +#line 1478 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -1603,7 +1532,7 @@ if eval "test \"`echo '${'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1607 "configure" +#line 1536 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -1630,7 +1559,7 @@ if eval "test \"`echo '${'ac_cv_func__getb67'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1634 "configure" +#line 1563 "configure" #include "confdefs.h" #include <ctype.h> /* Arbitrary system header to define __stub macros. */ /* Override any gcc2 internal prototype to avoid an error. */ @@ -1673,7 +1602,7 @@ if eval "test \"`echo '${'ac_cv_func_GETB67'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1677 "configure" +#line 1606 "configure" #include "confdefs.h" #include <ctype.h> /* Arbitrary system header to define __stub macros. */ /* Override any gcc2 internal prototype to avoid an error. */ @@ -1716,7 +1645,7 @@ if eval "test \"`echo '${'ac_cv_func_getb67'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&4 else cat > conftest.$ac_ext <<EOF -#line 1720 "configure" +#line 1649 "configure" #include "confdefs.h" #include <ctype.h> /* Arbitrary system header to define __stub macros. */ /* Override any gcc2 internal prototype to avoid an error. */ @@ -1770,7 +1699,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 1774 "configure" +#line 1703 "configure" #include "confdefs.h" find_stack_direction () { @@ -1816,15 +1745,15 @@ if test "$ac_cv_func_strerror" = no; then STRERROR="strerror.o"; fi if test "x$prefix" != xNONE; then - libdir=$prefix/lib + datadir=$prefix/share else - libdir=$ac_default_prefix/lib + datadir=$ac_default_prefix/share fi -IID_HELP_FILE=$libdir/iid.help +IID_HELP_FILE=$datadir/iid.help cat >> confdefs.h <<EOF -#define IID_HELP_FILE "$libdir/iid.help" +#define IID_HELP_FILE "$datadir/iid.help" EOF @@ -1934,15 +1863,13 @@ s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@PACKAGE@%$PACKAGE%g s%@VERSION@%$VERSION%g -s%@PATCH_LEVEL@%$PATCH_LEVEL%g -s%@OLD_PATCH_LEVEL@%$OLD_PATCH_LEVEL%g +s%@PREV_VERSION@%$PREV_VERSION%g s%@YACC@%$YACC%g s%@CC@%$CC%g s%@LN_S@%$LN_S%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@SET_MAKE@%$SET_MAKE%g -s%@AWK@%$AWK%g s%@CPP@%$CPP%g s%@U@%$U%g s%@ANSI2KNR@%$ANSI2KNR%g @@ -1951,7 +1878,7 @@ s%@REGEXP@%$REGEXP%g s%@GETOPT@%$GETOPT%g s%@STRCASECMP@%$STRCASECMP%g s%@STRERROR@%$STRERROR%g -s%@libdir@%$libdir%g +s%@datadir@%$datadir%g s%@IID_HELP_FILE@%$IID_HELP_FILE%g s%@DEPEND@%$DEPEND%g /@DEPEND_FILE@/r $DEPEND_FILE @@ -2114,11 +2041,10 @@ cat >> $CONFIG_STATUS <<\EOF fi; done - +test -z "$CONFIG_HEADERS" || echo timestamp >stamp-h exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS -date >stamp-h diff --git a/configure.in b/configure.in index 46aad5c..3d8b63c 100644 --- a/configure.in +++ b/configure.in @@ -3,25 +3,20 @@ AC_INIT(mkid.c) AC_CONFIG_HEADER(config.h) PACKAGE=mkid -VERSION=3.0 -PATCH_LEVEL=7 -OLD_PATCH_LEVEL=`expr $PATCH_LEVEL - 1` +VERSION=3.0.8 +PREV_VERSION=3.0.7 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") AC_DEFINE_UNQUOTED(VERSION, "$VERSION") -AC_DEFINE_UNQUOTED(PATCH_LEVEL, "$PATCH_LEVEL") AC_SUBST(PACKAGE) AC_SUBST(VERSION) -AC_SUBST(PATCH_LEVEL) -AC_SUBST(OLD_PATCH_LEVEL) +AC_SUBST(PREV_VERSION) dnl Checks for programs. AC_PROG_YACC -AC_SUBST(YACC) AC_PROG_CC AC_PROG_LN_S AC_PROG_INSTALL AC_PROG_MAKE_SET -AC_PROG_AWK dnl Checks for libraries. @@ -39,7 +34,6 @@ fp_C_PROTOTYPES AC_TYPE_SIGNAL AC_TYPE_OFF_T AC_TYPE_SIZE_T -AC_CHECK_SIZEOF(long) CFLAGS=${CFLAGS--g} LDFLAGS=${LDFLAGS--g} @@ -64,14 +58,14 @@ if test "$ac_cv_func_strerror" = no; then STRERROR="strerror.o"; fi AC_SUBST(STRERROR) if test "x$prefix" != xNONE; then - libdir=$prefix/lib + datadir=$prefix/share else - libdir=$ac_default_prefix/lib + datadir=$ac_default_prefix/share fi -IID_HELP_FILE=$libdir/iid.help -AC_SUBST(libdir) +IID_HELP_FILE=$datadir/iid.help +AC_SUBST(datadir) AC_SUBST(IID_HELP_FILE) -AC_DEFINE_UNQUOTED(IID_HELP_FILE, "$libdir/iid.help") +AC_DEFINE_UNQUOTED(IID_HELP_FILE, "$datadir/iid.help") case x$srcdir in x) DEPEND=depend.out;; @@ -81,5 +75,5 @@ DEPEND_FILE=$DEPEND AC_SUBST(DEPEND) AC_SUBST_FILE(DEPEND_FILE) -AC_OUTPUT(Makefile) -date >stamp-h +AC_OUTPUT(Makefile, + [test -z "$CONFIG_HEADERS" || echo timestamp >stamp-h]) @@ -1,20 +1,20 @@ -mkid.o: mkid.c config.h strxtra.h alloc.h idfile.h idarg.h token.h bitops.h misc.h \ +mkid$o: mkid.c config.h strxtra.h alloc.h idfile.h idarg.h token.h bitops.h misc.h \ filenames.h scanners.h -lid.o: lid.c config.h alloc.h idfile.h idarg.h token.h bitops.h strxtra.h misc.h \ +lid$o: lid.c config.h alloc.h idfile.h idarg.h token.h bitops.h strxtra.h misc.h \ filenames.h -fid.o: fid.c config.h idfile.h idarg.h bitops.h filenames.h misc.h strxtra.h \ +fid$o: fid.c config.h idfile.h idarg.h bitops.h filenames.h misc.h strxtra.h \ alloc.h token.h -idx.o: idx.c config.h misc.h filenames.h scanners.h -misc.o: misc.c config.h strxtra.h misc.h -scanners.o: scanners.c config.h strxtra.h token.h alloc.h scanners.h -idfile.o: idfile.c config.h alloc.h idfile.h idarg.h strxtra.h -filenames.o: filenames.c config.h strxtra.h filenames.h misc.h -bitops.o: bitops.c config.h bitops.h -token.o: token.c config.h token.h -regex.o: regex.c regex.h -alloca.o: alloca.c -getopt.o: getopt.c -getopt1.o: getopt1.c getopt.h -strcasecmp.o: strcasecmp.c -strerror.o: strerror.c -iid.o: iid.c ./config.h ./strxtra.h +idx$o: idx.c config.h misc.h filenames.h scanners.h +misc$o: misc.c config.h strxtra.h misc.h +scanners$o: scanners.c config.h strxtra.h token.h alloc.h scanners.h +idfile$o: idfile.c config.h alloc.h idfile.h idarg.h strxtra.h +filenames$o: filenames.c config.h strxtra.h filenames.h misc.h +bitops$o: bitops.c config.h bitops.h +token$o: token.c config.h token.h +regex$o: regex.c config.h regex.h +alloca$o: alloca.c +getopt$o: getopt.c +getopt1$o: getopt1.c getopt.h +strcasecmp$o: strcasecmp.c +strerror$o: strerror.c +iid$o: iid.c ./config.h ./strxtra.h @@ -16,10 +16,11 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" #include <stdio.h> #include <string.h> #include <ctype.h> + +#include <config.h> #include "idfile.h" #include "idarg.h" #include "bitops.h" @@ -29,10 +30,10 @@ #include "alloc.h" #include "token.h" -int get_idarg_index (char const *file_name); -int is_hit (unsigned char const *hits, int file_number); -int is_hit_1 (unsigned char const **hits, int level, int file_number); -void skip_hits (unsigned char const **hits, int level); +int get_idarg_index __P((char const *file_name)); +int is_hit __P((unsigned char const *hits, int file_number)); +int is_hit_1 __P((unsigned char const **hits, int level, int file_number)); +void skip_hits __P((unsigned char const **hits, int level)); FILE *id_FILE; struct idhead idh; diff --git a/filenames.c b/filenames.c index 0b288d7..20c0c23 100644 --- a/filenames.c +++ b/filenames.c @@ -16,7 +16,6 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" #include <stdlib.h> #include <unistd.h> #include <string.h> @@ -24,6 +23,8 @@ #include <sys/param.h> #include <sys/types.h> #include <sys/stat.h> + +#include <config.h> #include "strxtra.h" #include "filenames.h" #include "misc.h" diff --git a/filenames.h b/filenames.h index 938f04a..587e16a 100644 --- a/filenames.h +++ b/filenames.h @@ -19,18 +19,18 @@ #ifndef _filenames_h_ #define _filenames_h_ -char const *relative_file_name (char const *dir, char const *arg); -char const *span_file_name (char const *dir, char const *arg); -char const *root_name (char const *path); -char const *suff_name (char const *path); -int can_crunch (char const *path1, char const *path2); -char const *look_up (char const *arg); -void cannoname (char *n); -char const *kshgetwd (char *pathname); -char const *unsymlink (char *n); -FILE *open_source_FILE (char *file_name, char const *filter); -void close_source_FILE (FILE *fp, char const *filter); -char const *get_sccs (char const *dir, char const *base, char const *sccs_dir); -char const *co_rcs (char const *dir, char const *base, char const *rcs_dir); +char const *relative_file_name __P((char const *dir, char const *arg)); +char const *span_file_name __P((char const *dir, char const *arg)); +char const *root_name __P((char const *path)); +char const *suff_name __P((char const *path)); +int can_crunch __P((char const *path1, char const *path2)); +char const *look_up __P((char const *arg)); +void cannoname __P((char *n)); +char const *kshgetwd __P((char *pathname)); +char const *unsymlink __P((char *n)); +FILE *open_source_FILE __P((char *file_name, char const *filter)); +void close_source_FILE __P((FILE *fp, char const *filter)); +char const *get_sccs __P((char const *dir, char const *base, char const *sccs_dir)); +char const *co_rcs __P((char const *dir, char const *base, char const *rcs_dir)); #endif /* not _filenames_h_ */ @@ -16,18 +16,20 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" #include <stdio.h> #include <string.h> + +#include <config.h> #include "alloc.h" #include "idfile.h" #include "idarg.h" #include "strxtra.h" -static int io_idhead (FILE *fp, int (*io) (FILE *, void *, unsigned int, int), struct idhead *idh); -static int io_write (FILE *output_FILE, void *addr, unsigned int size, int is_int); -static int io_read (FILE *input_FILE, void *addr, unsigned int size, int is_int); -static int io_size (FILE *, void *, unsigned int size, int); +typedef int (*iof_t) __P((FILE *, void *, unsigned int, int)); +static int io_idhead __P((FILE *fp, iof_t iof, struct idhead *idh)); +static int io_write __P((FILE *output_FILE, void *addr, unsigned int size, int is_int)); +static int io_read __P((FILE *input_FILE, void *addr, unsigned int size, int is_int)); +static int io_size __P((FILE *, void *, unsigned int size, int)); extern char *program_name; @@ -113,11 +115,11 @@ io_read (FILE *input_FILE, void *addr, unsigned int size, int is_int) { switch (size) { - case 4: /* This must be a literal 4. Don't use sizeof (uintmin32_t)! */ - *(uintmin32_t *)addr = getc (input_FILE); - *(uintmin32_t *)addr += getc (input_FILE) << 010; - *(uintmin32_t *)addr += getc (input_FILE) << 020; - *(uintmin32_t *)addr += getc (input_FILE) << 030; + case 4: /* This must be a literal 4. Don't use sizeof (unsigned long)! */ + *(unsigned long *)addr = getc (input_FILE); + *(unsigned long *)addr += getc (input_FILE) << 010; + *(unsigned long *)addr += getc (input_FILE) << 020; + *(unsigned long *)addr += getc (input_FILE) << 030; break; case 2: *(unsigned short *)addr = getc (input_FILE); @@ -145,11 +147,11 @@ io_write (FILE *output_FILE, void *addr, unsigned int size, int is_int) { switch (size) { - case 4: /* This must be a literal 4. Don't use sizeof (uintmin32_t)! */ - putc (*(uintmin32_t *)addr, output_FILE); - putc (*(uintmin32_t *)addr >> 010, output_FILE); - putc (*(uintmin32_t *)addr >> 020, output_FILE); - putc (*(uintmin32_t *)addr >> 030, output_FILE); + case 4: /* This must be a literal 4. Don't use sizeof (unsigned long)! */ + putc (*(unsigned long *)addr, output_FILE); + putc (*(unsigned long *)addr >> 010, output_FILE); + putc (*(unsigned long *)addr >> 020, output_FILE); + putc (*(unsigned long *)addr >> 030, output_FILE); break; case 2: putc (*(unsigned short *)addr, output_FILE); @@ -176,22 +178,22 @@ io_write (FILE *output_FILE, void *addr, unsigned int size, int is_int) (e.g., Cray) */ static int -io_idhead (FILE *fp, int (*io) (FILE *, void *, unsigned int, int), struct idhead *idh) +io_idhead (FILE *fp, iof_t iof, struct idhead *idh) { unsigned int size = 0; if (fp) fseek (fp, 0L, 0); - size += io (fp, idh->idh_magic, 2, 0); - size += io (fp, &idh->idh_pad_1, 1, 0); - size += io (fp, &idh->idh_version, 1, 0); - size += io (fp, &idh->idh_flags, 2, 1); - size += io (fp, &idh->idh_args, 4, 1); - size += io (fp, &idh->idh_paths, 4, 1); - size += io (fp, &idh->idh_tokens, 4, 1); - size += io (fp, &idh->idh_buf_size, 4, 1); - size += io (fp, &idh->idh_vec_size, 4, 1); - size += io (fp, &idh->idh_args_offset, 4, 1); - size += io (fp, &idh->idh_tokens_offset, 4, 1); - size += io (fp, &idh->idh_end_offset, 4, 1); + size += iof (fp, idh->idh_magic, 2, 0); + size += iof (fp, &idh->idh_pad_1, 1, 0); + size += iof (fp, &idh->idh_version, 1, 0); + size += iof (fp, &idh->idh_flags, 2, 1); + size += iof (fp, &idh->idh_args, 4, 1); + size += iof (fp, &idh->idh_paths, 4, 1); + size += iof (fp, &idh->idh_tokens, 4, 1); + size += iof (fp, &idh->idh_buf_size, 4, 1); + size += iof (fp, &idh->idh_vec_size, 4, 1); + size += iof (fp, &idh->idh_args_offset, 4, 1); + size += iof (fp, &idh->idh_tokens_offset, 4, 1); + size += iof (fp, &idh->idh_end_offset, 4, 1); return size; } @@ -34,21 +34,21 @@ struct idhead #define IDH_VERSION 3 unsigned short idh_flags; #define IDH_COUNTS 0x0001 /* occurrence counts are included with each token */ - uintmin32_t idh_args; /* total # of args for mkid update */ - uintmin32_t idh_paths; /* total # of file names for mkid update */ - uintmin32_t idh_tokens; /* total # of tokens */ - uintmin32_t idh_buf_size; /* # of bytes in longest entry (bufsiz for lid) */ - uintmin32_t idh_vec_size; /* # of hits in longest entry (max vector size for lid) */ - intmin32_t idh_args_offset; /* file offset of args */ - intmin32_t idh_tokens_offset; /* file offset of tokens section */ - intmin32_t idh_end_offset; /* file offset beyond tokens section */ + unsigned long idh_args; /* total # of args for mkid update */ + unsigned long idh_paths; /* total # of file names for mkid update */ + unsigned long idh_tokens; /* total # of tokens */ + unsigned long idh_buf_size; /* # of bytes in longest entry (bufsiz for lid) */ + unsigned long idh_vec_size; /* # of hits in longest entry (max vector size for lid) */ + long idh_args_offset; /* file offset of args */ + long idh_tokens_offset; /* file offset of tokens section */ + long idh_end_offset; /* file offset beyond tokens section */ }; struct idarg; -FILE *init_idfile (char const *id_file, struct idhead *idhp, struct idarg **id_args); -int read_idhead (FILE *input_FILE, struct idhead *idh); -int write_idhead (FILE *input_FILE, struct idhead *idh); -int sizeof_idhead (void); +FILE *init_idfile __P((char const *id_file, struct idhead *idhp, struct idarg **id_args)); +int read_idhead __P((FILE *input_FILE, struct idhead *idh)); +int write_idhead __P((FILE *input_FILE, struct idhead *idh)); +int sizeof_idhead __P((void)); #endif /* not _idfile_h_ */ @@ -1,5 +1,7 @@ #!/bin/sh +export LANG; LANG=C + case $# in 0) 1>&2 echo Usage: $0 files...; exit 1;; esac @@ -9,11 +11,10 @@ esac errors= -echo "idx ..." -idx "$@" |sort -u >ID.idx -echo "lid ..." -lid $idfile_arg |sed -e 's/[ ].*//' |sort -u >ID.lid -if cmp -s ID.idx ID.lid; then +if idx "$@" |sort -u >ID.idx && + lid $idfile_arg |sed -e 's/[ ].*//' |sort -u >ID.lid && + cmp -s ID.idx ID.lid +then rm -f ID.idx ID.lid echo "Good. idx and lid agree." else @@ -30,9 +31,10 @@ do x-*) scan_args="$scan_args $file" continue;; esac - fid $idfile_arg $file >$fid_file - idx $scan_args $file |sort -u >$idx_file - if cmp -s $idx_file $fid_file; then + if fid $idfile_arg $file >$fid_file && + idx $scan_args $file |sort -u >$idx_file && + cmp -s $idx_file $fid_file; + then echo "Good. idx and fid agree for $file" else 1>&2 echo "Oops! idx and fid disagree for $file" @@ -42,6 +44,10 @@ done rm -f $idx_file $fid_file case x$errors in -xt) 1>&2 echo "mkid and friends are broken."; exit 1;; -*) echo "mkid and friends are happy."; exit 0;; +xt) echo "Some checks failed." + echo "mkid and friends are broken--boo hoo!" + exit 1;; +*) echo "All checks successful." + echo "mkid and friends are happy!" + exit 0;; esac @@ -1,14 +1,15 @@ /* static char copyright[] = "@(#)Copyright (c) 1986, Greg McGary"; static char sccsid[] = "@(#)idx.c 1.2 86/10/17"; */ -#include "config.h" #include <stdio.h> #include <string.h> + +#include <config.h> #include "misc.h" #include "filenames.h" #include "scanners.h" -void idxtract (char *path); +void idxtract __P((char *path)); char const *program_name; @@ -42,13 +42,14 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" #include <stdio.h> #include <ctype.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <getopt.h> + +#include <config.h> #include "strxtra.h" #if HAVE_ALLOCA @@ -224,34 +225,34 @@ set_type * * TheSets = NULL ; */ int VerboseQuery ; -int yyerror( char const * s ) ; -void ScanInit( char * line ) ; -int yylex( void ) ; -int ArgListSize( id_list_type * idlp ) ; -int SetListSize( set_type * sp ) ; -void FlushFiles( void ) ; -void fatal( char const * s ) ; -int CountBits( set_type * sp ) ; -void OneDescription( set_type * sp ) ; -void DescribeSets( void ) ; -id_list_type * SetList( id_list_type * idlp , set_type * sp ) ; -void PrintSet( set_type * sp ) ; -void FlushSets( void ) ; -id_list_type * InitList( void ) ; -id_list_type * ExtendList( id_list_type * idlp , id_type * idp ) ; -void InitIid( void ) ; -symtab_type * InstallFile( char const * fp ) ; -void RunPager( char * pp , set_type * sp ) ; -void AddSet( set_type * sp ) ; -set_type * RunProg( char const * pp , id_list_type * idlp ) ; -void SetDirectory( id_type * dir ) ; -set_type * SetIntersect( set_type * sp1 , set_type * sp2 ) ; -set_type * SetUnion( set_type * sp1 , set_type * sp2 ) ; -set_type * SetInverse( set_type * sp ) ; -void RunShell( char * pp , id_list_type * idlp ) ; - - -#line 230 "./iid.y" +int yyerror __P(( char const * s )) ; +void ScanInit __P(( char * line )) ; +int yylex __P(( void )) ; +int ArgListSize __P(( id_list_type * idlp )) ; +int SetListSize __P(( set_type * sp )) ; +void FlushFiles __P(( void )) ; +void fatal __P(( char const * s )) ; +int CountBits __P(( set_type * sp )) ; +void OneDescription __P(( set_type * sp )) ; +void DescribeSets __P(( void )) ; +id_list_type * SetList __P(( id_list_type * idlp , set_type * sp )) ; +void PrintSet __P(( set_type * sp )) ; +void FlushSets __P(( void )) ; +id_list_type * InitList __P(( void )) ; +id_list_type * ExtendList __P(( id_list_type * idlp , id_type * idp )) ; +void InitIid __P(( void )) ; +symtab_type * InstallFile __P(( char const * fp )) ; +void RunPager __P(( char * pp , set_type * sp )) ; +void AddSet __P(( set_type * sp )) ; +set_type * RunProg __P(( char const * pp , id_list_type * idlp )) ; +void SetDirectory __P(( id_type * dir )) ; +set_type * SetIntersect __P(( set_type * sp1 , set_type * sp2 )) ; +set_type * SetUnion __P(( set_type * sp1 , set_type * sp2 )) ; +set_type * SetInverse __P(( set_type * sp )) ; +void RunShell __P(( char * pp , id_list_type * idlp )) ; + + +#line 231 "./iid.y" typedef union { set_type * setdef ; id_type * strdef ; @@ -343,9 +344,9 @@ static const short yyrhs[] = { 9, #if YYDEBUG != 0 static const short yyrline[] = { 0, - 256, 264, 265, 271, 277, 283, 289, 293, 300, 309, - 318, 327, 334, 343, 352, 363, 370, 379, 388, 396, - 404, 413, 422, 431, 439, 446, 452, 460, 468 + 257, 265, 266, 272, 278, 284, 290, 294, 301, 310, + 319, 328, 335, 344, 353, 364, 371, 380, 389, 397, + 405, 414, 423, 432, 440, 447, 453, 461, 469 }; static const char * const yytname[] = { "$","error","$illegal.","SET","ID", @@ -971,7 +972,7 @@ yyreduce: switch (yyn) { case 1: -#line 258 "./iid.y" +#line 259 "./iid.y" { /* cd to the directory specified as argument, flush sets */ @@ -980,7 +981,7 @@ case 1: ; break;} case 3: -#line 266 "./iid.y" +#line 267 "./iid.y" { /* print the list of files resulting from Query */ @@ -988,7 +989,7 @@ case 3: ; break;} case 4: -#line 272 "./iid.y" +#line 273 "./iid.y" { /* run PAGER on the list of files in SET */ @@ -996,7 +997,7 @@ case 4: ; break;} case 5: -#line 278 "./iid.y" +#line 279 "./iid.y" { /* describe sets created so far */ @@ -1004,7 +1005,7 @@ case 5: ; break;} case 6: -#line 284 "./iid.y" +#line 285 "./iid.y" { /* run PAGER on the help file */ @@ -1012,13 +1013,13 @@ case 6: ; break;} case 7: -#line 290 "./iid.y" +#line 291 "./iid.y" { exit(0) ; ; break;} case 8: -#line 294 "./iid.y" +#line 295 "./iid.y" { /* run the shell command and eat the results as a file set */ @@ -1027,7 +1028,7 @@ case 8: ; break;} case 9: -#line 301 "./iid.y" +#line 302 "./iid.y" { /* run the shell command */ @@ -1036,7 +1037,7 @@ case 9: ; break;} case 10: -#line 311 "./iid.y" +#line 312 "./iid.y" { /* Turn on verbose query flag */ @@ -1044,7 +1045,7 @@ case 10: ; break;} case 11: -#line 320 "./iid.y" +#line 321 "./iid.y" { /* Turn off verbose query flag */ @@ -1052,7 +1053,7 @@ case 11: ; break;} case 12: -#line 329 "./iid.y" +#line 330 "./iid.y" { /* value of query is set associated with primitive */ @@ -1060,7 +1061,7 @@ case 12: ; break;} case 13: -#line 335 "./iid.y" +#line 336 "./iid.y" { /* value of query is intersection of the two query sets */ @@ -1071,7 +1072,7 @@ case 13: ; break;} case 14: -#line 344 "./iid.y" +#line 345 "./iid.y" { /* value of query is union of the two query sets */ @@ -1082,7 +1083,7 @@ case 14: ; break;} case 15: -#line 353 "./iid.y" +#line 354 "./iid.y" { /* value of query is inverse of other query */ @@ -1093,7 +1094,7 @@ case 15: ; break;} case 16: -#line 365 "./iid.y" +#line 366 "./iid.y" { /* Value of primitive is value of recorded set */ @@ -1101,7 +1102,7 @@ case 16: ; break;} case 17: -#line 371 "./iid.y" +#line 372 "./iid.y" { /* Value of primitive is obtained by running an lid query */ @@ -1112,7 +1113,7 @@ case 17: ; break;} case 18: -#line 380 "./iid.y" +#line 381 "./iid.y" { /* Value of primitive is obtained by running an aid query */ @@ -1123,7 +1124,7 @@ case 18: ; break;} case 19: -#line 389 "./iid.y" +#line 390 "./iid.y" { /* Match names from database against pattern */ yyval. setdef = RunProg("pid -kmn", yyvsp[0]. listdef ) ; @@ -1133,7 +1134,7 @@ case 19: ; break;} case 20: -#line 397 "./iid.y" +#line 398 "./iid.y" { /* value of primitive is value of query */ @@ -1141,7 +1142,7 @@ case 20: ; break;} case 21: -#line 406 "./iid.y" +#line 407 "./iid.y" { /* make arg list holding single ID */ @@ -1151,7 +1152,7 @@ case 21: ; break;} case 22: -#line 414 "./iid.y" +#line 415 "./iid.y" { /* arg list is Id_list */ @@ -1160,7 +1161,7 @@ case 22: ; break;} case 23: -#line 424 "./iid.y" +#line 425 "./iid.y" { /* arg list is Id_list */ @@ -1168,7 +1169,7 @@ case 23: ; break;} case 24: -#line 433 "./iid.y" +#line 434 "./iid.y" { /* make arg list holding single ID */ @@ -1177,7 +1178,7 @@ case 24: ; break;} case 25: -#line 440 "./iid.y" +#line 441 "./iid.y" { /* make arg list holding names from set */ @@ -1186,7 +1187,7 @@ case 25: ; break;} case 26: -#line 447 "./iid.y" +#line 448 "./iid.y" { /* extend arg list with additional ID */ @@ -1194,7 +1195,7 @@ case 26: ; break;} case 27: -#line 453 "./iid.y" +#line 454 "./iid.y" { /* extend arg list with additional file names */ @@ -1202,7 +1203,7 @@ case 27: ; break;} case 28: -#line 462 "./iid.y" +#line 463 "./iid.y" { /* make arg list holding single ID */ @@ -1211,7 +1212,7 @@ case 28: ; break;} case 29: -#line 469 "./iid.y" +#line 470 "./iid.y" { /* extend arg list with additional ID */ @@ -1442,7 +1443,7 @@ yyerrhandle: yystate = yyn; goto yynewstate; } -#line 476 "./iid.y" +#line 477 "./iid.y" /* ScanLine - a global variable holding a pointer to the current @@ -17,13 +17,14 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" #include <stdio.h> #include <ctype.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <getopt.h> + +#include <config.h> #include "strxtra.h" #if HAVE_ALLOCA @@ -199,31 +200,31 @@ set_type * * TheSets = NULL ; */ int VerboseQuery ; -int yyerror( char const * s ) ; -void ScanInit( char * line ) ; -int yylex( void ) ; -int ArgListSize( id_list_type * idlp ) ; -int SetListSize( set_type * sp ) ; -void FlushFiles( void ) ; -void fatal( char const * s ) ; -int CountBits( set_type * sp ) ; -void OneDescription( set_type * sp ) ; -void DescribeSets( void ) ; -id_list_type * SetList( id_list_type * idlp , set_type * sp ) ; -void PrintSet( set_type * sp ) ; -void FlushSets( void ) ; -id_list_type * InitList( void ) ; -id_list_type * ExtendList( id_list_type * idlp , id_type * idp ) ; -void InitIid( void ) ; -symtab_type * InstallFile( char const * fp ) ; -void RunPager( char * pp , set_type * sp ) ; -void AddSet( set_type * sp ) ; -set_type * RunProg( char const * pp , id_list_type * idlp ) ; -void SetDirectory( id_type * dir ) ; -set_type * SetIntersect( set_type * sp1 , set_type * sp2 ) ; -set_type * SetUnion( set_type * sp1 , set_type * sp2 ) ; -set_type * SetInverse( set_type * sp ) ; -void RunShell( char * pp , id_list_type * idlp ) ; +int yyerror __P(( char const * s )) ; +void ScanInit __P(( char * line )) ; +int yylex __P(( void )) ; +int ArgListSize __P(( id_list_type * idlp )) ; +int SetListSize __P(( set_type * sp )) ; +void FlushFiles __P(( void )) ; +void fatal __P(( char const * s )) ; +int CountBits __P(( set_type * sp )) ; +void OneDescription __P(( set_type * sp )) ; +void DescribeSets __P(( void )) ; +id_list_type * SetList __P(( id_list_type * idlp , set_type * sp )) ; +void PrintSet __P(( set_type * sp )) ; +void FlushSets __P(( void )) ; +id_list_type * InitList __P(( void )) ; +id_list_type * ExtendList __P(( id_list_type * idlp , id_type * idp )) ; +void InitIid __P(( void )) ; +symtab_type * InstallFile __P(( char const * fp )) ; +void RunPager __P(( char * pp , set_type * sp )) ; +void AddSet __P(( set_type * sp )) ; +set_type * RunProg __P(( char const * pp , id_list_type * idlp )) ; +void SetDirectory __P(( id_type * dir )) ; +set_type * SetIntersect __P(( set_type * sp1 , set_type * sp2 )) ; +set_type * SetUnion __P(( set_type * sp1 , set_type * sp2 )) ; +set_type * SetInverse __P(( set_type * sp )) ; +void RunShell __P(( char * pp , id_list_type * idlp )) ; %} @@ -16,7 +16,6 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" #include <stdlib.h> #include <unistd.h> #include <stdio.h> @@ -29,6 +28,8 @@ #include <assert.h> #include <limits.h> #include <regex.h> + +#include <config.h> #include "alloc.h" #include "idfile.h" #include "idarg.h" @@ -38,43 +39,43 @@ #include "misc.h" #include "filenames.h" -typedef void (*doit_t) (char const *name, char **argv); - -unsigned char *tree8_to_bits (unsigned char *bits_vec, unsigned char const *hits_tree8); -void tree8_to_bits_1 (unsigned char **bits_vec, unsigned char const **hits_tree8, int level); -char **tree8_to_argv (unsigned char const *hits_tree8); -char **bits_to_argv (unsigned char const *bits_vec); - -static void usage (void); -void look_id (char const *name, char **argv); -void grep_id (char const *name, char **argv); -void edit_id (char const *name, char **argv); -int skip_to_argv (char **argv); -int find_plain (char const *arg, doit_t doit); -int find_anchor (char const *arg, doit_t doit); -int find_regexp (char const *arg, doit_t doit); -int find_number (char const *arg, doit_t doit); -int find_non_unique (unsigned int, doit_t doit); -int find_apropos (char const *arg, doit_t doit); -void parse_frequency_arg (char const *arg); -int frequency_wanted (char const *tok); -char const *strcpos (char const *s1, char const *s2); -char const *file_regexp (char const *name0, char const *left_delimit, char const *right_delimit); -off_t find_token (char const *token); -int is_regexp (char *name); -char **vec_to_argv (int const *vec); -int file_name_wildcard (char const *re, char const *fn); -int match_file_names (char const *re, doit_t doit); -int word_match (char const *name0, char const *line); -int radix (char const *name); -int stoi (char const *name); -int otoi (char const *name); -int dtoi (char const *name); -int xtoi (char const *name); -void savetty (void); -void restoretty (void); -void linetty (void); -void chartty (void); +typedef void (*doit_t) __P((char const *name, char **argv)); + +unsigned char *tree8_to_bits __P((unsigned char *bits_vec, unsigned char const *hits_tree8)); +void tree8_to_bits_1 __P((unsigned char **bits_vec, unsigned char const **hits_tree8, int level)); +char **tree8_to_argv __P((unsigned char const *hits_tree8)); +char **bits_to_argv __P((unsigned char const *bits_vec)); + +static void usage __P((void)); +void look_id __P((char const *name, char **argv)); +void grep_id __P((char const *name, char **argv)); +void edit_id __P((char const *name, char **argv)); +int skip_to_argv __P((char **argv)); +int find_plain __P((char const *arg, doit_t doit)); +int find_anchor __P((char const *arg, doit_t doit)); +int find_regexp __P((char const *arg, doit_t doit)); +int find_number __P((char const *arg, doit_t doit)); +int find_non_unique __P((unsigned int, doit_t doit)); +int find_apropos __P((char const *arg, doit_t doit)); +void parse_frequency_arg __P((char const *arg)); +int frequency_wanted __P((char const *tok)); +char const *strcpos __P((char const *s1, char const *s2)); +char const *file_regexp __P((char const *name0, char const *left_delimit, char const *right_delimit)); +off_t find_token __P((char const *token)); +int is_regexp __P((char *name)); +char **vec_to_argv __P((int const *vec)); +int file_name_wildcard __P((char const *re, char const *fn)); +int match_file_names __P((char const *re, doit_t doit)); +int word_match __P((char const *name0, char const *line)); +int radix __P((char const *name)); +int stoi __P((char const *name)); +int otoi __P((char const *name)); +int dtoi __P((char const *name)); +int xtoi __P((char const *name)); +void savetty __P((void)); +void restoretty __P((void)); +void linetty __P((void)); +void chartty __P((void)); enum radix { RADIX_OCT = 1, @@ -369,8 +370,6 @@ look_id (char const *name, char **argv) void grep_id (char const *name, char **argv) { - FILE *gid_FILE; - char const *gid_name; char line[BUFSIZ]; char const *re = NULL; int line_number; @@ -392,10 +391,12 @@ grep_id (char const *name, char **argv) line[0] = ' '; /* sentry */ while (*argv) { - gid_FILE = fopen (gid_name = *argv++, "r"); + char const *file_name = *argv++; + FILE *gid_FILE = fopen (file_name, "r"); + if (gid_FILE == NULL) { - filerr ("open", gid_name); + filerr ("open", file_name); continue; } line_number = 0; @@ -409,7 +410,7 @@ grep_id (char const *name, char **argv) } else if (!word_match (name, line)) continue; - printf ("%s:%d: %s", gid_name, line_number, &line[1]); + printf ("%s:%d: %s", file_name, line_number, &line[1]); } fclose (gid_FILE); } @@ -1076,7 +1077,7 @@ word_match (char const *name0, char const *line) /* find an initial-character match */ while (*line != *name) { - if (*line == '\n') + if (*line == '\0' || *line == '\n') return 0; line++; } @@ -16,10 +16,11 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" #include <stdio.h> #include <string.h> #include <errno.h> + +#include <config.h> #include "strxtra.h" #include "misc.h" @@ -20,15 +20,15 @@ #define _misc_h_ #if !HAVE_BASENAME -char const *basename (char const *path); +char const *basename __P((char const *path)); #endif #if !HAVE_DIRNAME -char const *dirname (char const *path); +char const *dirname __P((char const *path)); #endif -int fgets0 (char *buf0, int size, FILE *in_FILE); -void filerr (char const *syscall, char const *file_name); -int tree8_count_levels (unsigned int cardinality); -int gets_past_00 (char *tok, FILE *input_FILE); -int skip_past_00 (FILE *input_FILE); +int fgets0 __P((char *buf0, int size, FILE *in_FILE)); +void filerr __P((char const *syscall, char const *file_name)); +int tree8_count_levels __P((unsigned int cardinality)); +int gets_past_00 __P((char *tok, FILE *input_FILE)); +int skip_past_00 __P((FILE *input_FILE)); #endif /* not _misc_h_ */ @@ -16,7 +16,6 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" #include <sys/types.h> #include <sys/stat.h> #include <stdlib.h> @@ -25,9 +24,11 @@ #include <assert.h> #include <stdio.h> #include <string.h> -#include "strxtra.h" #include <ctype.h> #include <errno.h> + +#include <config.h> +#include "strxtra.h" #include "alloc.h" #include "idfile.h" #include "idarg.h" @@ -66,43 +67,43 @@ struct token struct token **hash_table; /* Vector of token pointers */ -char *bitsset (char *s1, char const *s2, int n); -char *bitsclr (char *s1, char const *s2, int n); -char *bitsand (char *s1, char const *s2, int n); -char *bitsxor (char *s1, char const *s2, int n); -int bitstst (char const *s1, char const *s2, int n); -int bitsany (char const *s, int n); -int round2 (int rough); -struct token *make_token (char const *name, int); -void scan_1_file (char const *(*get_token) (FILE*, int*), FILE *source_FILE); -struct idarg *parse_idargs (int argc, char **argv); -struct idarg *parse_idargs_from_FILE (FILE *arg_FILE, struct idarg *idarg); -void init_hash_table (int file_name_count); -void scan_files (struct idarg *idarg); -void report_statistics (void); - -void init_hash (long size); -struct token **hash_lookup (char const *key); -unsigned int string_hash_1 (char const *key); -unsigned int string_hash_2 (char const *key); -void rehash (void); - -void write_idfile (char const *id_file, struct idarg *idargs); -void bump_current_hits_signature (void); -void init_hits_signature (int i); -int bit_to_index (int bit); -int compare_tokens (void const *x, void const *y); -void free_summary_tokens (void); -void summarize (void); -void assert_hits (struct summary *summary); -void write_hits (FILE *fp, struct summary *summary, unsigned char const *tail_hits); -void sign_token (struct token *token); -void add_token_to_summary (struct summary *summary, struct token *token); -void init_summary (void); -struct summary *make_sibling_summary (struct summary *summary); -int count_vec_size (struct summary *summary, unsigned char const *tail_hits); -int count_buf_size (struct summary *summary, unsigned char const *tail_hits); -void usage (void); +char *bitsset __P((char *s1, char const *s2, int n)); +char *bitsclr __P((char *s1, char const *s2, int n)); +char *bitsand __P((char *s1, char const *s2, int n)); +char *bitsxor __P((char *s1, char const *s2, int n)); +int bitstst __P((char const *s1, char const *s2, int n)); +int bitsany __P((char const *s, int n)); +int round2 __P((int rough)); +struct token *make_token __P((char const *name, int)); +void scan_1_file __P((char const *(*get_token) (FILE*, int*), FILE *source_FILE)); +struct idarg *parse_idargs __P((int argc, char **argv)); +struct idarg *parse_idargs_from_FILE __P((FILE *arg_FILE, struct idarg *idarg)); +void init_hash_table __P((int file_name_count)); +void scan_files __P((struct idarg *idarg)); +void report_statistics __P((void)); + +void init_hash __P((long size)); +struct token **hash_lookup __P((char const *key)); +unsigned int string_hash_1 __P((char const *key)); +unsigned int string_hash_2 __P((char const *key)); +void rehash __P((void)); + +void write_idfile __P((char const *id_file, struct idarg *idargs)); +void bump_current_hits_signature __P((void)); +void init_hits_signature __P((int i)); +int bit_to_index __P((int bit)); +int compare_tokens __P((void const *x, void const *y)); +void free_summary_tokens __P((void)); +void summarize __P((void)); +void assert_hits __P((struct summary *summary)); +void write_hits __P((FILE *fp, struct summary *summary, unsigned char const *tail_hits)); +void sign_token __P((struct token *token)); +void add_token_to_summary __P((struct summary *summary, struct token *token)); +void init_summary __P((void)); +struct summary *make_sibling_summary __P((struct summary *summary)); +int count_vec_size __P((struct summary *summary, unsigned char const *tail_hits)); +int count_buf_size __P((struct summary *summary, unsigned char const *tail_hits)); +void usage __P((void)); /* Miscellaneous statistics */ long input_chars; @@ -158,8 +159,8 @@ Usage: %s [-v] [-f<idfile>] [(+|-)l[<lang>]] [(+|-)S<scanarg>] [-a<argfile>] [-] -S<lang>? Print usage documentation for <lang>\n\ -u Update an existing database (unimplemented)\n\ \n\ -Version %s.%s; Made %s %s\n", - program_name, VERSION, PATCH_LEVEL, __DATE__, __TIME__); +Version %s; Made %s %s\n", + program_name, VERSION, __DATE__, __TIME__); exit (1); } @@ -534,7 +535,6 @@ write_idfile (char const *file_name, struct idarg *idarg) struct token **tokens; int i; FILE *id_FILE; - int lasti; struct idhead idh; int fixup_names; char *lsl; @@ -581,15 +581,9 @@ write_idfile (char const *file_name, struct idarg *idarg) /* write out the list of pathnames */ fseek (id_FILE, sizeof_idhead (), 0); idh.idh_args_offset = ftell (id_FILE); - for (i = lasti = 0; idarg->ida_next; idarg = idarg->ida_next) + for (i = 0; idarg->ida_next; idarg = idarg->ida_next) { - if (idarg->ida_index > 0) - while (++lasti < idarg->ida_index) - { - i++; - putc ('\0', id_FILE); - } - if (fixup_names) + if (*idarg->ida_arg != '-' && fixup_names) fputs (relative_file_name (absolute_idfile_name, span_file_name (PWD_name, idarg->ida_arg)), id_FILE); else fputs (idarg->ida_arg, id_FILE); @@ -988,12 +982,7 @@ assert_hits (struct summary* summary) struct summary **kids = summary->sum_kids; struct summary **end = &kids[8]; - /* Some systems have broken assert() macros that expand into exposed - if-statements, so we need braces around them when used with if/else. */ - if (summary == summary_root) - { assert (summary->sum_hits == 0); } - else - { assert (summary->sum_hits && *summary->sum_hits == 0); } + assert (summary->sum_hits == NULL || *summary->sum_hits == 0); if (end[-1] == 0) while (*--end == 0) @@ -17,10 +17,11 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" #include <stdio.h> #include <string.h> #include <ctype.h> + +#include <config.h> #include "strxtra.h" #include "token.h" #include "alloc.h" @@ -28,24 +29,24 @@ extern char const *program_name; -static char const *get_token_VHIL (FILE *input_FILE, int *flags); -static char const *get_token_c (FILE *input_FILE, int *flags); -static void set_args_c (char const *lang_name, int op, char const *arg); -static void set_ctype_c (char const *chars, int type); -static void clear_ctype_c (char const *chars, int type); -static void usage_c (char const *lang_name); - -static char const *get_token_asm (FILE *input_FILE, int *flags); -static void set_ctype_asm (char const *chars, int type); -static void clear_ctype_asm (char const *chars, int type); -static void usage_asm (char const *lang_name); -static void set_args_asm (char const *lang_name, int op, char const *arg); - -static char const *get_token_text (FILE *input_FILE, int *flags); -static void set_ctype_text (char const *chars, int type); -static void clear_ctype_text (char const *chars, int type); -static void usage_text (char const *lang_name); -static void set_args_text (char const *lang_name, int op, char const *arg); +static char const *get_token_VHIL __P((FILE *input_FILE, int *flags)); +static char const *get_token_c __P((FILE *input_FILE, int *flags)); +static void set_args_c __P((char const *lang_name, int op, char const *arg)); +static void set_ctype_c __P((char const *chars, int type)); +static void clear_ctype_c __P((char const *chars, int type)); +static void usage_c __P((char const *lang_name)); + +static char const *get_token_asm __P((FILE *input_FILE, int *flags)); +static void set_ctype_asm __P((char const *chars, int type)); +static void clear_ctype_asm __P((char const *chars, int type)); +static void usage_asm __P((char const *lang_name)); +static void set_args_asm __P((char const *lang_name, int op, char const *arg)); + +static char const *get_token_text __P((FILE *input_FILE, int *flags)); +static void set_ctype_text __P((char const *chars, int type)); +static void clear_ctype_text __P((char const *chars, int type)); +static void usage_text __P((char const *lang_name)); +static void set_args_text __P((char const *lang_name, int op, char const *arg)); /****************************************************************************/ @@ -72,7 +73,6 @@ static void usage_scan (void); struct language languages_0[] = { - /* must be sorted for bsearch(3) */ { "C", get_token_c, set_args_c, NULL }, { "TeX", get_token_text, set_args_text, NULL }, { "VHIL", get_token_VHIL, set_args_c, NULL }, @@ -204,9 +204,8 @@ get_filter (char const *suffix) return stp->suff_language->lang_filter; } -char const *(* +get_token_t get_scanner (char const *lang) - ) (FILE *input_FILE, int *flags) { struct language *ltp; @@ -453,7 +452,7 @@ get_token_VHIL (FILE *input_FILE, int *flags) } /* - Grab the next identifier the C source + Grab the next identifier from the C source file opened with the handle `input_FILE'. This state machine is built for speed, not elegance. */ @@ -1080,8 +1079,8 @@ static unsigned char ctype_text[257] = /*010*/ 0, 0, 0, 0, 0, 0, 0, 0, /*020*/ 0, 0, 0, 0, 0, 0, 0, 0, /*030*/ 0, 0, 0, 0, 0, 0, 0, 0, -/*040*/ 0, 0, 0, 0, 0, 0, 0, SQ, -/*050*/ 0, 0, 0, 0, 0, SQ, SQ, 0, +/*040*/ 0, 0, 0, 0, 0, 0, 0, 0, +/*050*/ 0, 0, 0, 0, 0, 0, 0, 0, /*060*/ NM, NM, NM, NM, NM, NM, NM, NM, /*070*/ NM, NM, 0, 0, 0, 0, 0, 0, /*100*/ 0, I1|NM, I1|NM, I1|NM, I1|NM, I1|NM, I1|NM, I1, @@ -19,12 +19,12 @@ #ifndef _scanners_h_ #define _scanners_h_ -typedef char *(*get_token_t) (FILE*, int*); +typedef char const *(*get_token_t) __P((FILE*, int*)); -char const *get_lang_name (char const *suffix); -char const *get_filter (char const *suffix); -char const *(*get_scanner (char const *lang_name)) (FILE *input_FILE, int *flags); -void set_scan_args (int op, char *arg); -void init_scanners (void); +char const *get_lang_name __P((char const *suffix)); +char const *get_filter __P((char const *suffix)); +get_token_t get_scanner __P((char const *lang_name)); +void set_scan_args __P((int op, char *arg)); +void init_scanners __P((void)); #endif /* not _scanners_h_ */ @@ -1 +1 @@ -Mon Feb 20 16:39:28 EST 1995 +timestamp @@ -1 +1 @@ -Mon Feb 20 16:39:29 EST 1995 +timestamp @@ -15,8 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -char *strerror(errnum) -int errnum; +char *strerror(int errnum) { extern char *sys_errlist[]; extern int sys_nerr; @@ -16,7 +16,7 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" +#include <config.h> #include "token.h" unsigned int @@ -33,8 +33,8 @@ #define TOK_SHORT_COUNT 0x80 /* count is two bytes */ #define tok_string(buf) (buf) -unsigned int tok_flags (char const *buf); -unsigned short tok_count (char const *buf); -unsigned char const *tok_hits_addr (char const *buf); +unsigned int tok_flags __P((char const *buf)); +unsigned short tok_count __P((char const *buf)); +unsigned char const *tok_hits_addr __P((char const *buf)); #endif /* not _token_h_ */ diff --git a/version.texi b/version.texi index 499d47f..4550c3d 100644 --- a/version.texi +++ b/version.texi @@ -1 +1 @@ -@set VERSION 3.0 +@set VERSION 3.0.8 |