summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog32
-rw-r--r--Makefile.in51
-rw-r--r--README.alpha-test5
-rw-r--r--TODO4
-rw-r--r--acconfig.h13
-rw-r--r--bitops.h2
-rw-r--r--config.h.in23
-rwxr-xr-xconfigure108
-rw-r--r--configure.in12
-rw-r--r--idarg.h2
-rw-r--r--idfile.c16
-rw-r--r--idfile.h2
-rwxr-xr-xidtest53
-rw-r--r--iid.c3
-rw-r--r--lid.c43
-rw-r--r--misc.c4
-rw-r--r--misc.h4
-rw-r--r--mkid.c52
-rw-r--r--scanners.c40
-rw-r--r--stamp-h.in2
-rw-r--r--stamp-vti2
-rw-r--r--token.h2
22 files changed, 318 insertions, 157 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d096fc..7d638c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+Mon Feb 20 16:18:47 1995 Greg McGary <gkm@magilla.cichlid.com>
+
+ * scanners.c (scanners, suffixes, init_scanners, get_scanner,
+ set_scan_args, get_lang_name, get_filter, get_suffix): Fixed
+ boundary conditions.
+
+ * mkid.c (make_sibling_summary): Don't realloc if kid's sum_tokens
+ is already large enough. (scan_1_file): Ignore blank tokens.
+ Avoid division by 0 (pinard@iro.umontreal.ca). (write_idfile):
+ Moved assertions & qsort to top. Don't check for blank tokens--it
+ can't happen. (rehash): Prefix "Rehashing..." with "\n\t".
+
+ * idtest: Test fid more rigorously.
+
+ * idfile.c (init_idfile): Don't increment i for non-file args.
+
+ * Makefile.in (DEFS, DIST_SHAR, AWK, bump-patch, bump-minor,
+ bump-major, shar): Added. (.PRECIOUS): Added configure, config.h
+ config.h.in.
+
+ * configure.in (DEPEND): Fixed portability (kazusi-m@is.aist-nara.ac.jp).
+ (AC_CHECK_FUNCS(basename, dirname)): Added.
+ * misc.h, misc.c: Made decl/defn of basename, dirname conditional.
+
+
+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.
+ (savetty): ANSI'fy arglist declaration.
+
Sat Feb 18 21:44:39 1995 Greg McGary <gkm@magilla.cichlid.com>
* Version 3.0.6 released.
diff --git a/Makefile.in b/Makefile.in
index 971c591..fa1d1b1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -39,6 +39,7 @@ libdir = @libdir@
CC = @CC@
YACC = @YACC@
LN_S = @LN_S@
+AWK = @AWK@
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
INSTALL = @INSTALL@
@@ -48,6 +49,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
+DEFS = @DEFS@
IID_HELP_FILE = @IID_HELP_FILE@
DEPEND = @DEPEND@
@@ -100,6 +102,7 @@ DIST_FILES = $(DIST_CONF_FILES) $(DIST_SRC_FILES) $(DIST_DOC_FILES) $(DIST_MISC_
DIST_DIR = $(PACKAGE)-$(VERSION).$(PATCH_LEVEL)
DIST_TGZ = $(DIST_DIR).tar.gz
DIST_UU = $(DIST_TGZ).uu
+DIST_SHAR = $(DIST_DIR).shar
OLD_DIST_DIR = $(PACKAGE)-$(VERSION).$(OLD_PATCH_LEVEL)
@@ -109,7 +112,7 @@ PATCH_C_UU = $(PATCH_C_GZ).uu
##############################################################################
-.PRECIOUS: $(DEPEND) Makefile
+.PRECIOUS: $(DEPEND) Makefile configure config.h config.h.in
.SUFFIXES:
.SUFFIXES: .c .i .o
@@ -234,28 +237,46 @@ realclean: distclean
##############################################################################
+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
+
+########################################
+
+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 dist-tgz: $(DIST_TGZ)
+dist-tgz: $(DIST_TGZ)
$(DIST_TGZ): $(DIST_DIR)
tar cfzho $@ $(DIST_DIR)
dist-dir: $(DIST_DIR)
-dist-dir-links: $(OLD_DIST_DIR) $(DIST_DIR)
- @cd $(DIST_DIR); \
- for file in $(DIST_FILES); do \
- if cmp -s $$file ../$(OLD_DIST_DIR)/$$file; then \
- rm -f $$file; \
- if test -L ../$(OLD_DIST_DIR)/$$file; then \
- cp -a ../$(OLD_DIST_DIR)/$$file $$file; \
- else \
- $(LN_S) ../$(OLD_DIST_DIR)/$$file $$file; \
- fi; \
- fi; \
- done
-
$(DIST_DIR): $(DIST_FILES)
rm -fr $@
mkdir $@
diff --git a/README.alpha-test b/README.alpha-test
index 585dbd3..a5d2887 100644
--- a/README.alpha-test
+++ b/README.alpha-test
@@ -37,10 +37,7 @@ Special instructions for alpha testers:
(type ./mkid to get the usage banner which includes the version)
* The output of "make -k all", to show me where it's dying.
* The output of "uname -a"
- * The output of "nm" on your system's libc.
- * An ID file of the .h files in your system's /usr/include (I know--it's
- a checken and egg problem. Use mkid2. You don't have mkid2? It's ok,
- don't knock yourself out.)
+ * The output of "nm" on your system's libc, if applicable.
* Be aware that this is still work in progress. See TODO for a list of
things yet undone.
diff --git a/TODO b/TODO
index ba9e5e1..c7168a8 100644
--- a/TODO
+++ b/TODO
@@ -15,6 +15,9 @@
(notably DOS & OS/2).
- Fix assumption that (sizeof (int) == sizeof (long))
+* all query interfaces
+ - add environment variable for setting default ID file name.
+
* lid
- change the name of the program to something a bit more
descriptive, e.g., "findid".
@@ -37,6 +40,7 @@
* mkid
- add a recursive file tree walker, so a complete list of file names
need not be supplied.
+ - (Optinally?) store tokenized contents of comments.
- Store attributes with symbols: type, func, variable struct-tag
enum-tag, keyword, etc. Store caller/callee relationships between
identifiers. Indicate which files have defns vs. uses. This info
diff --git a/acconfig.h b/acconfig.h
index 603afaf..7b356d8 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -29,12 +29,19 @@
/* (u)intmin32_t are integer types that are *at least* 32 bits.
Larger ints are OK. */
-# if SIZEOF_LONG == 4
+#if SIZEOF_LONG == 4
typedef unsigned long uintmin32_t;
typedef long intmin32_t;
-# else
+#else
typedef unsigned int uintmin32_t;
typedef int intmin32_t;
+#endif
+
+/* NeXT POSIX compatibility is losing. sgtty is the way to go. */
+#if HAVE_SGTTY_H
+# ifdef NeXT
+# undef HAVE_TERMIOS_H
# endif
+#endif
-#endif /* _config_h_ */
+#endif /* not _config_h_ */
diff --git a/bitops.h b/bitops.h
index 7e0f0a7..6de8bf2 100644
--- a/bitops.h
+++ b/bitops.h
@@ -28,4 +28,4 @@
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);
-#endif /* _bitops_h_ */
+#endif /* not _bitops_h_ */
diff --git a/config.h.in b/config.h.in
index ab7206c..2332ce5 100644
--- a/config.h.in
+++ b/config.h.in
@@ -65,12 +65,18 @@
/* The number of bytes in a long. */
#undef SIZEOF_LONG
+/* Define if you have the basename function. */
+#undef HAVE_BASENAME
+
/* Define if you have the bcopy function. */
#undef HAVE_BCOPY
/* Define if you have the bzero function. */
#undef HAVE_BZERO
+/* Define if you have the dirname function. */
+#undef HAVE_DIRNAME
+
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
@@ -131,8 +137,8 @@
/* Define if you have the <regex.h> header file. */
#undef HAVE_REGEX_H
-/* Define if you have the <sgttyb.h> header file. */
-#undef HAVE_SGTTYB_H
+/* Define if you have the <sgtty.h> header file. */
+#undef HAVE_SGTTY_H
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
@@ -166,12 +172,19 @@
/* (u)intmin32_t are integer types that are *at least* 32 bits.
Larger ints are OK. */
-# if SIZEOF_LONG == 4
+#if SIZEOF_LONG == 4
typedef unsigned long uintmin32_t;
typedef long intmin32_t;
-# else
+#else
typedef unsigned int uintmin32_t;
typedef int intmin32_t;
+#endif
+
+/* NeXT POSIX compatibility is losing. sgtty is the way to go. */
+#if HAVE_SGTTY_H
+# ifdef NeXT
+# undef HAVE_TERMIOS_H
# endif
+#endif
-#endif /* _config_h_ */
+#endif /* not _config_h_ */
diff --git a/configure b/configure
index 8d11898..2a357ea 100755
--- a/configure
+++ b/configure
@@ -401,7 +401,7 @@ fi
PACKAGE=mkid
VERSION=3.0
-PATCH_LEVEL=6
+PATCH_LEVEL=7
OLD_PATCH_LEVEL=`expr $PATCH_LEVEL - 1`
cat >> confdefs.h <<EOF
#define PACKAGE "$PACKAGE"
@@ -506,8 +506,8 @@ if test $ac_cv_prog_gcc = yes; then
if eval "test \"`echo '${'ac_cv_prog_gcc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1 |grep -v warning:`"; then
+ echo 'void f(void); void f(void){}' > conftest.c
+if test -z "`${CC-cc} -g -O -c conftest.c 2>&1`"; then
ac_cv_prog_gcc_g=yes
else
ac_cv_prog_gcc_g=no
@@ -643,6 +643,38 @@ 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
@@ -660,7 +692,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 664 "configure"
+#line 696 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
@@ -674,7 +706,7 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 678 "configure"
+#line 710 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
@@ -706,7 +738,7 @@ else
ac_cv_cross=yes
else
cat > conftest.$ac_ext <<EOF
-#line 710 "configure"
+#line 742 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
@@ -727,7 +759,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 731 "configure"
+#line 763 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -749,7 +781,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 753 "configure"
+#line 785 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -767,7 +799,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 771 "configure"
+#line 803 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -788,7 +820,7 @@ if test "$cross_compiling" = yes; then
ac_cv_header_stdc=no
else
cat > conftest.$ac_ext <<EOF
-#line 792 "configure"
+#line 824 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -822,7 +854,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 826 "configure"
+#line 858 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -865,7 +897,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 869 "configure"
+#line 901 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
@@ -901,7 +933,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 905 "configure"
+#line 937 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
@@ -929,7 +961,7 @@ else
fi
done
-for ac_hdr in sys/ioctl.h termios.h termio.h sgttyb.h regex.h
+for ac_hdr in sys/ioctl.h termios.h termio.h sgtty.h regex.h
do
ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&4
@@ -937,7 +969,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 941 "configure"
+#line 973 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
@@ -971,7 +1003,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 975 "configure"
+#line 1007 "configure"
#include "confdefs.h"
int main() { return 0; }
@@ -1056,7 +1088,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 1060 "configure"
+#line 1092 "configure"
#include "confdefs.h"
#if !defined(__STDC__) || __STDC__ != 1
choke me
@@ -1105,7 +1137,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 1109 "configure"
+#line 1141 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -1139,7 +1171,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 1143 "configure"
+#line 1175 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1170,7 +1202,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 1174 "configure"
+#line 1206 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1204,7 +1236,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1208 "configure"
+#line 1240 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1241,7 +1273,7 @@ if eval "test \"`echo '${'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 1245 "configure"
+#line 1277 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -1259,7 +1291,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 1263 "configure"
+#line 1295 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -1279,14 +1311,14 @@ fi
fi
fi
-for ac_func in getwd getcwd getopt_long
+for ac_func in getwd getcwd getopt_long basename dirname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&4
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 1290 "configure"
+#line 1322 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1335,7 +1367,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 1339 "configure"
+#line 1371 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1384,7 +1416,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 1388 "configure"
+#line 1420 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1433,7 +1465,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 1437 "configure"
+#line 1469 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1482,7 +1514,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 1486 "configure"
+#line 1518 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() { return 0; }
@@ -1513,7 +1545,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 1517 "configure"
+#line 1549 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -1571,7 +1603,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 1575 "configure"
+#line 1607 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -1598,7 +1630,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 1602 "configure"
+#line 1634 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1641,7 +1673,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 1645 "configure"
+#line 1677 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1684,7 +1716,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 1688 "configure"
+#line 1720 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1738,7 +1770,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 1742 "configure"
+#line 1774 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -1796,7 +1828,10 @@ cat >> confdefs.h <<EOF
EOF
-DEPEND=${srcdir:-.}/depend.out
+case x$srcdir in
+x) DEPEND=depend.out;;
+*) DEPEND=$srcdir/depend.out;;
+esac
DEPEND_FILE=$DEPEND
@@ -1907,6 +1942,7 @@ 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
diff --git a/configure.in b/configure.in
index edb17a8..46aad5c 100644
--- a/configure.in
+++ b/configure.in
@@ -4,7 +4,7 @@ AC_CONFIG_HEADER(config.h)
PACKAGE=mkid
VERSION=3.0
-PATCH_LEVEL=6
+PATCH_LEVEL=7
OLD_PATCH_LEVEL=`expr $PATCH_LEVEL - 1`
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
@@ -21,6 +21,7 @@ AC_PROG_CC
AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_MAKE_SET
+AC_PROG_AWK
dnl Checks for libraries.
@@ -30,7 +31,7 @@ AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(limits.h stddef.h sys/types.h sys/stat.h sys/param.h)
AC_CHECK_HEADERS(stdlib.h unistd.h string.h malloc.h memory.h assert.h ctype.h errno.h)
-AC_CHECK_HEADERS(sys/ioctl.h termios.h termio.h sgttyb.h regex.h)
+AC_CHECK_HEADERS(sys/ioctl.h termios.h termio.h sgtty.h regex.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@@ -47,7 +48,7 @@ AC_SUBST(LDFLAGS)
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
-AC_CHECK_FUNCS(getwd getcwd getopt_long)
+AC_CHECK_FUNCS(getwd getcwd getopt_long basename dirname)
AC_CHECK_FUNCS(strdup strchr strrchr strcasecmp strerror)
AC_CHECK_FUNCS(memcpy bcopy memset bzero)
AC_CHECK_FUNCS(regcomp regcmp re_comp)
@@ -72,7 +73,10 @@ AC_SUBST(libdir)
AC_SUBST(IID_HELP_FILE)
AC_DEFINE_UNQUOTED(IID_HELP_FILE, "$libdir/iid.help")
-DEPEND=${srcdir:-.}/depend.out
+case x$srcdir in
+x) DEPEND=depend.out;;
+*) DEPEND=$srcdir/depend.out;;
+esac
DEPEND_FILE=$DEPEND
AC_SUBST(DEPEND)
AC_SUBST_FILE(DEPEND_FILE)
diff --git a/idarg.h b/idarg.h
index 4bcef8a..7570ebd 100644
--- a/idarg.h
+++ b/idarg.h
@@ -30,4 +30,4 @@ struct idarg
#define IDA_PREFIX_US 0x02 /* file has names with prefixed underscores */
};
-#endif /* _idarg_h_ */
+#endif /* not _idarg_h_ */
diff --git a/idfile.c b/idfile.c
index 4979c85..15e8019 100644
--- a/idfile.c
+++ b/idfile.c
@@ -63,16 +63,18 @@ init_idfile (char const *id_file, struct idhead *idh, struct idarg **id_args)
strings = malloc (i = idh->idh_tokens_offset - idh->idh_args_offset);
fread (strings, i, 1, id_FILE);
ida = *id_args = CALLOC (struct idarg, idh->idh_paths);
- for (i = 0; i < idh->idh_args; i++)
+ for (i = 0; i < idh->idh_paths; i++)
{
- if (*strings != '+' && *strings != '-')
+ while (*strings == '+' || *strings == '-')
{
- ida->ida_flags = 0;
- ida->ida_arg = strings;
- ida->ida_next = ida + 1;
- ida->ida_index = i;
- ida++;
+ while (*strings++)
+ ;
}
+ ida->ida_flags = 0;
+ ida->ida_arg = strings;
+ ida->ida_next = ida + 1;
+ ida->ida_index = i;
+ ida++;
while (*strings++)
;
}
diff --git a/idfile.h b/idfile.h
index 3b8d389..c83ed67 100644
--- a/idfile.h
+++ b/idfile.h
@@ -51,4 +51,4 @@ int read_idhead (FILE *input_FILE, struct idhead *idh);
int write_idhead (FILE *input_FILE, struct idhead *idh);
int sizeof_idhead (void);
-#endif /* _idfile_h_ */
+#endif /* not _idfile_h_ */
diff --git a/idtest b/idtest
index 83cdd7a..a75511e 100755
--- a/idtest
+++ b/idtest
@@ -1,32 +1,47 @@
#!/bin/sh
-set -x
-
case $# in
0) 1>&2 echo Usage: $0 files...; exit 1;;
esac
case $1 in
--f*) _fID=$1; shift;;
+-f*) idfile_arg=$1; shift;;
esac
-idx "$@" |sort -u >ids.idx
-lid $_fID |sed -e 's/[ ].*//' |sort -u >ids.lid
+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
+ rm -f ID.idx ID.lid
+ echo "Good. idx and lid agree."
+else
+ 1>&2 echo "Oops! idx and lid disagree--look in ID.idx and ID.lid"
+ errors=t
+fi
+
+idx_file=$$.idx
+fid_file=$$.fid
+
for file
do
case x$file in
- x-*) continue;;
+ x-*) scan_args="$scan_args $file"
+ continue;;
esac
- fid $_fID $file
-done |sort -u >ids.fid
-
-if cmp ids.idx ids.lid
-then
- if cmp ids.idx ids.fid
- then
- echo OK
- rm -f ids.idx ids.fid ids.lid
- exit 0
+ fid $idfile_arg $file >$fid_file
+ idx $scan_args $file |sort -u >$idx_file
+ if 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"
+ errors=t
fi
-fi
-echo Oops!
-exit 1
+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;;
+esac
diff --git a/iid.c b/iid.c
index 5dee019..a990d6b 100644
--- a/iid.c
+++ b/iid.c
@@ -943,6 +943,9 @@ yyreduce:
clog << "Reducing via rule " << yyn << " (line " << yyrline[yyn] << " ): ";
#endif /* __cplusplus */
else
+#ifndef YYFILE
+#define YYFILE "<parser>"
+#endif
#ifndef __cplusplus
fprintf (stderr, YYFILE ":%d: ", yyrline[yyn]);
#else /* __cplusplus */
diff --git a/lid.c b/lid.c
index c5e3899..099ea2b 100644
--- a/lid.c
+++ b/lid.c
@@ -1286,41 +1286,44 @@ struct termios savemode;
#else /* not HAVE_TERMIOS_H */
-#if HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
+# if HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+# endif
+
+# if HAVE_TERMIO_H
-#if HAVE_TERMIO_H
-#include <termio.h>
+# include <termio.h>
struct termio linemode;
struct termio charmode;
struct termio savemode;
#define GET_TTY_MODES(modes) ioctl (0, TCGETA, (modes))
#define SET_TTY_MODES(modes) ioctl (0, TCSETA, (modes))
-#else /* not HAVE_TERMIO_H */
+# else /* not HAVE_TERMIO_H */
-#if HAVE_SGTTYB_H
-#include <sgttyb.h>
+# if HAVE_SGTTY_H
+
+# include <sgtty.h>
struct sgttyb linemode;
struct sgttyb charmode;
struct sgttyb savemode;
-#ifdef TIOCGETP
+# ifdef TIOCGETP
#define GET_TTY_MODES(modes) ioctl (0, TIOCGETP, (modes))
#define SET_TTY_MODES(modes) ioctl (0, TIOCSETP, (modes))
-#else /* not TIOCGETP */
+# else
#define GET_TTY_MODES(modes) gtty (0, (modes))
#define SET_TTY_MODES(modes) stty (0, (modes))
-#endif /* not TIOCGETP */
+# endif
-savetty()
+void
+savetty (void)
{
-#ifdef TIOCGETP
+# ifdef TIOCGETP
ioctl(0, TIOCGETP, &savemode);
-#else
+# else
gtty(0, &savemode);
-#endif
+# endif
charmode = linemode = savemode;
charmode.sg_flags &= ~ECHO;
@@ -1330,8 +1333,8 @@ savetty()
linemode.sg_flags &= ~RAW;
}
-#endif /* HAVE_SGTTYB_H */
-#endif /* not HAVE_TERMIO_H */
+# endif /* not HAVE_SGTTY_H */
+# endif /* not HAVE_TERMIO_H */
#endif /* not HAVE_TERMIOS_H */
#if HAVE_TERMIOS_H || HAVE_TERMIO_H
@@ -1351,9 +1354,9 @@ savetty (void)
linemode.c_cc[VEOL] = 0377;
}
-#endif /* HAVE_TERMIOS_H || HAVE_TERMIO_H */
+#endif
-#if HAVE_TERMIOS_H || HAVE_TERMIO_H || HAVE_SGTTYB_H
+#if HAVE_TERMIOS_H || HAVE_TERMIO_H || HAVE_SGTTY_H
void
restoretty (void)
@@ -1373,4 +1376,4 @@ chartty (void)
SET_TTY_MODES (&charmode);
}
-#endif /* HAVE_TERMIOS_H || HAVE_TERMIO_H || HAVE_SGTTYB_H */
+#endif
diff --git a/misc.c b/misc.c
index 40a0da9..e0dc945 100644
--- a/misc.c
+++ b/misc.c
@@ -23,6 +23,7 @@
#include "strxtra.h"
#include "misc.h"
+#if !HAVE_BASENAME
char const *
basename (char const *path)
{
@@ -34,7 +35,9 @@ basename (char const *path)
else
return path;
}
+#endif
+#if !HAVE_DIRNAME
char const *
dirname (char const *path)
{
@@ -46,6 +49,7 @@ dirname (char const *path)
else
return ".";
}
+#endif
/* This is like fgets(3s), except that lines are delimited by NULs
rather than newlines. Also, we return the number of characters
diff --git a/misc.h b/misc.h
index 9a3956f..161f796 100644
--- a/misc.h
+++ b/misc.h
@@ -19,8 +19,12 @@
#ifndef _misc_h_
#define _misc_h_
+#if !HAVE_BASENAME
char const *basename (char const *path);
+#endif
+#if !HAVE_DIRNAME
char const *dirname (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);
diff --git a/mkid.c b/mkid.c
index 836a2fb..d9d6078 100644
--- a/mkid.c
+++ b/mkid.c
@@ -286,6 +286,7 @@ scan_files (struct idarg *idarg)
{
printf ("%s: ", lang_name);
printf (filter ? filter : "%s", arg);
+ fflush (stdout);
}
scan_1_file (scanner, source_FILE);
if (verbose_flag)
@@ -476,6 +477,7 @@ scan_1_file (char const *(*get_token) (FILE*, int*), FILE *source_FILE)
int new_tokens = 0;
int distinct_tokens = 0;
int flags;
+ struct token *token;
if (fstat (fileno (source_FILE), &stat_buf) == 0)
{
@@ -485,8 +487,9 @@ scan_1_file (char const *(*get_token) (FILE*, int*), FILE *source_FILE)
while ((key = (*get_token) (source_FILE, &flags)) != NULL)
{
- struct token *token = *(slot = hash_lookup (key));
-
+ if (*key == '\0')
+ continue;
+ token = *(slot = hash_lookup (key));
total_tokens++;
if (token)
{
@@ -508,11 +511,14 @@ scan_1_file (char const *(*get_token) (FILE*, int*), FILE *source_FILE)
}
}
if (verbose_flag)
- printf (" uniq=%d/%d=%.2f, new=%d/%d=%.2f",
- distinct_tokens, total_tokens,
- (double) distinct_tokens / (double) total_tokens,
- new_tokens, distinct_tokens,
- (double) new_tokens / (double) distinct_tokens);
+ {
+ printf (" uniq=%d/%d", distinct_tokens, total_tokens);
+ if (total_tokens != 0)
+ printf ("=%.2f", (double) distinct_tokens / (double) total_tokens);
+ printf (", new=%d/%d", new_tokens, distinct_tokens);
+ if (distinct_tokens != 0)
+ printf ("=%.2f", (double) new_tokens / (double) distinct_tokens);
+ }
}
/* As the database is written, may need to adjust the file names. If
@@ -539,6 +545,12 @@ write_idfile (char const *file_name, struct idarg *idarg)
int max_vec_size = 0;
if (verbose_flag)
+ printf ("Sorting tokens...\n");
+ assert (summary_root->sum_hits_count == hash_fill);
+ tokens = REALLOC (summary_root->sum_tokens, struct token *, hash_fill);
+ qsort (tokens, hash_fill, sizeof (struct token *), compare_tokens);
+
+ if (verbose_flag)
printf ("Writing `%s'...\n", file_name);
lsl = strrchr (relative_file_name (PWD_name, absolute_idfile_name), '/');
if (lsl == NULL)
@@ -593,19 +605,9 @@ write_idfile (char const *file_name, struct idarg *idarg)
putc ('\0', id_FILE);
idh.idh_tokens_offset = ftell (id_FILE);
- assert (summary_root->sum_hits_count == hash_fill);
- tokens = REALLOC (summary_root->sum_tokens, struct token *, hash_fill);
- qsort (tokens, hash_fill, sizeof (struct token *), compare_tokens);
for (i = 0; i < hash_fill; i++, tokens++)
{
struct token *token = *tokens;
- if (*token->tok_name == '\0')
- {
- fprintf (stderr, "Blank token!\n");
- hash_fill--;
- i--;
- continue;
- }
occurrences += token->tok_count;
if (token->tok_flags & TOK_NUMBER)
number_tokens++;
@@ -732,7 +734,7 @@ rehash (void)
hash_size *= 2;
if (verbose_flag)
- printf ("Rehashing... (doubling size to %ld)\n", hash_size);
+ printf ("\n\tRehashing... (doubling size to %ld)\n", hash_size);
hash_rehashes++;
hash_capacity = hash_size - (hash_size >> 4);
hash_table = CALLOC (struct token *, hash_size);
@@ -905,14 +907,22 @@ make_sibling_summary (struct summary *summary)
if (parent == NULL)
{
levels++;
- size = INIT_TOKENS_SIZE (levels);
summary_root = summary->sum_parent = parent = CALLOC (struct summary, 1);
parent->sum_level = levels;
parent->sum_kids[0] = summary;
parent->sum_hits_count = summary->sum_hits_count;
parent->sum_free_index = 1;
- parent->sum_tokens_size = size;
- parent->sum_tokens = REALLOC (summary->sum_tokens, struct token *, size);
+ size = INIT_TOKENS_SIZE (levels);
+ if (summary->sum_tokens_size >= size)
+ {
+ parent->sum_tokens_size = summary->sum_tokens_size;
+ parent->sum_tokens = summary->sum_tokens;
+ }
+ else
+ {
+ parent->sum_tokens_size = size;
+ parent->sum_tokens = REALLOC (summary->sum_tokens, struct token *, size);
+ }
summary->sum_tokens = 0;
}
if (parent->sum_free_index == 8)
diff --git a/scanners.c b/scanners.c
index abd03a9..87e814a 100644
--- a/scanners.c
+++ b/scanners.c
@@ -70,7 +70,7 @@ static struct suffix *get_suffix_entry (char const *suffix);
static struct language *get_lang_entry (char const *lang_name);
static void usage_scan (void);
-struct language languages[] =
+struct language languages_0[] =
{
/* must be sorted for bsearch(3) */
{ "C", get_token_c, set_args_c, NULL },
@@ -82,6 +82,7 @@ struct language languages[] =
{ "roff", get_token_text, set_args_text, "sed '/^\\.so/d' < %s | deroff" },
{ "text", get_token_text, set_args_text, NULL },
};
+struct language *languages = languages_0;
/*
This is a rather incomplete list of default associations
@@ -91,7 +92,7 @@ struct language languages[] =
associate a `.ada' suffix with the Ada language, use
`-S.ada=ada'
*/
-struct suffix suffixes[] =
+struct suffix suffixes_0[] =
{
{ "", "text" },
{ ".1", "roff" },
@@ -129,14 +130,15 @@ struct suffix suffixes[] =
{ ".yacc", "C" },
{ ".z", "gzip" },
};
+struct suffix *suffixes = suffixes_0;
void
init_scanners (void)
{
struct language *lang;
- struct language *lang_N = &languages[(sizeof (languages) / sizeof (languages[0])) - 1];
+ struct language *lang_N = &languages_0[(sizeof (languages_0) / sizeof (languages_0[0])) - 1];
struct suffix *suff;
- struct suffix *suff_N = &suffixes[(sizeof (suffixes) / sizeof (suffixes[0])) - 1];
+ struct suffix *suff_N = &suffixes_0[(sizeof (suffixes_0) / sizeof (suffixes_0[0])) - 1];
for (lang = languages; lang <= lang_N; ++lang)
lang->lang_next = lang + 1;
@@ -163,7 +165,7 @@ get_suffix_entry (char const *suffix)
for (stp = suffixes; stp; stp = stp->suff_next)
if (strequ (stp->suff_suffix, suffix))
return stp;
- return stp;
+ return NULL;
}
static struct language *
@@ -174,7 +176,7 @@ get_lang_entry (char const *lang_name)
if (lang_name == NULL)
lang_name = "";
- for (ltp = languages; ltp->lang_next; ltp = ltp->lang_next)
+ for (ltp = languages; ltp; ltp = ltp->lang_next)
if (ltp->lang_name == lang_name || strequ (ltp->lang_name, lang_name))
return ltp;
return ltp;
@@ -186,7 +188,7 @@ get_lang_name (char const *suffix)
struct suffix *stp;
stp = get_suffix_entry (suffix);
- if (stp->suff_next == NULL)
+ if (stp == NULL)
return NULL;
return stp->suff_language->lang_name;
}
@@ -197,7 +199,7 @@ get_filter (char const *suffix)
struct suffix *stp;
stp = get_suffix_entry (suffix);
- if (stp->suff_next == NULL)
+ if (stp == NULL)
return NULL;
return stp->suff_language->lang_filter;
}
@@ -209,7 +211,7 @@ get_scanner (char const *lang)
struct language *ltp;
ltp = get_lang_entry (lang);
- if (ltp->lang_next == NULL)
+ if (ltp == NULL)
return NULL;
return ltp->lang_get_token;
}
@@ -244,7 +246,7 @@ set_scan_args (int op, char *arg)
{
lhs += 2;
ltp = get_lang_entry (lhs);
- if (ltp->lang_next == NULL)
+ if (ltp == NULL)
{
printf ("No scanner for language `%s'\n", lhs);
return;
@@ -265,7 +267,7 @@ set_scan_args (int op, char *arg)
{
lhs[strlen (lhs) - 2] = '\0';
stp = get_suffix_entry (lhs);
- if (stp->suff_next == NULL)
+ if (stp == NULL)
{
printf ("No scanner assigned to suffix `%s'\n", lhs);
return;
@@ -282,17 +284,19 @@ set_scan_args (int op, char *arg)
*arg++ = '\0';
ltp = get_lang_entry (arg);
- if (ltp->lang_next == NULL)
+ if (ltp == NULL)
{
fprintf (stderr, "%s: Language undefined: %s\n", program_name, arg);
return;
}
stp = get_suffix_entry (lhs);
- if (stp->suff_next == NULL)
+ if (stp == NULL)
{
+ stp = CALLOC (struct suffix, 1);
stp->suff_suffix = lhs;
stp->suff_language = ltp;
- stp->suff_next = CALLOC (struct suffix, 1);
+ stp->suff_next = suffixes;
+ suffixes = stp;
}
else if (!strequ (arg, stp->suff_language->lang_name))
{
@@ -307,11 +311,13 @@ set_scan_args (int op, char *arg)
ltp = get_lang_entry (lhs);
if (ltp->lang_next == NULL)
{
+ ltp = CALLOC (struct language, 1);
ltp->lang_name = lhs;
ltp->lang_get_token = get_token_text;
ltp->lang_set_args = set_args_text;
ltp->lang_filter = NULL;
- ltp->lang_next = CALLOC (struct language, 1);
+ ltp->lang_next = languages;
+ languages = ltp;
}
lhs2 = arg;
arg = strchr (arg, '/');
@@ -321,7 +327,7 @@ set_scan_args (int op, char *arg)
{
*arg++ = '\0';
ltp2 = get_lang_entry (lhs2);
- if (ltp2->lang_next == NULL)
+ if (ltp2 == NULL)
{
fprintf (stderr, "%s: language %s not defined.\n", program_name, lhs2);
ltp2 = ltp;
@@ -357,7 +363,7 @@ set_scan_args (int op, char *arg)
*arg++ = '\0';
ltp = get_lang_entry (lhs);
- if (ltp->lang_next == NULL)
+ if (ltp == NULL)
{
fprintf (stderr, "%s: Language undefined: %s\n", program_name, lhs);
return;
diff --git a/stamp-h.in b/stamp-h.in
index 077a8ae..400576a 100644
--- a/stamp-h.in
+++ b/stamp-h.in
@@ -1 +1 @@
-Sat Feb 18 08:55:23 EST 1995
+Mon Feb 20 16:39:28 EST 1995
diff --git a/stamp-vti b/stamp-vti
index 9716513..300b62b 100644
--- a/stamp-vti
+++ b/stamp-vti
@@ -1 +1 @@
-Sat Feb 18 08:55:24 EST 1995
+Mon Feb 20 16:39:29 EST 1995
diff --git a/token.h b/token.h
index b3d90d5..d0fe9b7 100644
--- a/token.h
+++ b/token.h
@@ -37,4 +37,4 @@ unsigned int tok_flags (char const *buf);
unsigned short tok_count (char const *buf);
unsigned char const *tok_hits_addr (char const *buf);
-#endif /* _token_h_ */
+#endif /* not _token_h_ */