xtail-2.1/ 40775 311 311 0 7116651443 10502 5ustar chipchipxtail-2.1/Makefile.in100444 311 311 3302 7116651420 12631 0ustar chipchip# $Id: Makefile.in,v 2.11 2000/06/04 19:04:56 chip Exp $ # $Source: /local/src/xtail/RCS/Makefile.in,v $ SHELL = @SHELL@ srcdir = @srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ CC = @CC@ DEFS = @DEFS@ -I$(srcdir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ LDFLAGS = @LDFLAGS@ CFLAGS = @CFLAGS@ $(DEFS) TARBALL = xtail.tar XTAIL_OBJECTS = xtail.o entryfuncs.o miscfuncs.o DISTFILES = Makefile.in README acconfig.h config.h.in configure \ configure.in entryfuncs.c install-sh miscfuncs.c xtail.1 xtail.c \ xtail.h ### all : xtail xtail.1 xtail : $(XTAIL_OBJECTS) $(CC) -o $@ $(LDFLAGS) $(XTAIL_OBJECTS) $(LIBS) xtail.o : xtail.c xtail.h config.h entryfuncs.o : entryfuncs.c xtail.h config.h miscfuncs.o : miscfuncs.c xtail.h config.h install : $(bindir)/xtail $(mandir)/man1/xtail.1 $(bindir)/xtail : xtail $(INSTALL_PROGRAM) $? $@ $(mandir)/man1/xtail.1 : xtail.1 $(INSTALL_DATA) $? $@ clean : rm -f xtail $(XTAIL_OBJECTS) $(TARBALL) distclean : clean rm -f Makefile config.h config.cache config.log config.status dist : $(TARBALL) $(TARBALL) : $(DISTFILES) tar cf $@ $(DISTFILES) ### config.status : $(srcdir)/configure $(SHELL) ./config.status --recheck Makefile : $(srcdir)/Makefile.in config.status CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status #config.h : $(srcdir)/config.h.in config.status # CONFIG_FILES= CONFIG_HEADERS=$@ $(SHELL) ./config.status $(srcdir)/configure : $(srcdir)/configure.in cd $(srcdir) && autoconf $(srcdir)/config.h.in : $(srcdir)/configure.in $(srcdir)/acconfig.h cd $(srcdir) && autoheader xtail-2.1/README100444 311 311 3062 7116651422 11451 0ustar chipchip=== CHANGES === v2.1 - Stamps out a Y2K bug and now uses GNU autoconf. === SUMMARY === "xtail" watches the growth of files. It's like running a "tail -f" on a bunch of files at once. The syntax is: xtail name ... You can specify both filenames and directories on the command line. If you specify a directory, it watches all the files in that directory. It will notice when new files are created (and start watching them) or when old files are deleted (and stop watching them). I originally wrote this program so I could run: xtail /usr/spool/uucp/.Log/* Even though I don't use "uucp" any more, I still use this utility a lot. These days, my favorite is: xtail /var/log/* /usenet/lib/*log === INSTRUCTIONS === - xtail version 2 requires an ANSI compiler such as gcc. - Run: sh configure - If you'd like, review the configuration definitions in xtail.h - Run: make - If you'd like, as root run: make install === HISTORICAL NOTES === This program is an oldie but goodie. It was posted to comp.sources.misc in July 1989 (see ftp.uu.net:/usenet/comp.sources.misc/volume7/xtail.Z). I remember posting an even earlier version to alt.sources. It has been published in the O'Reilly & Associates "Unix Power Tools" collection (book and CD-ROM). Over the years, some fly-by-night organizations (such as the MIT X Consortium and SGI) have tried to steal the "xtail" name. Don't be fooled! Insist on the original. The 1989 release credited David Dykstra for his contributions. Chip Rosenthal $Id: README,v 2.4 2000/06/04 05:15:35 chip Exp $ xtail-2.1/acconfig.h100444 311 311 212 7116651420 12463 0ustar chipchip@BOTTOM@ /* $Id: acconfig.h,v 1.1 2000/06/04 04:52:54 chip Exp $ */ #ifdef __STDC__ # define VOID void #else # define VOID char #endif xtail-2.1/config.h.in100444 311 311 2353 7116651420 12614 0ustar chipchip/* config.h.in. Generated automatically from configure.in by autoheader. */ /* Define to empty if the keyword does not work. */ #undef const /* Define to `long' if doesn't define. */ #undef off_t /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if your declares struct tm. */ #undef TM_IN_SYS_TIME /* Define if you have the difftime function. */ #undef HAVE_DIFFTIME /* Define if you have the strerror function. */ #undef HAVE_STRERROR /* Define if you have the header file. */ #undef HAVE_DIRENT_H /* Define if you have the header file. */ #undef HAVE_NDIR_H /* Define if you have the header file. */ #undef HAVE_STDLIB_H /* Define if you have the header file. */ #undef HAVE_SYS_DIR_H /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H /* Define if you have the header file. */ #undef HAVE_TERMIOS_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* $Id: acconfig.h,v 1.1 2000/06/04 04:52:54 chip Exp $ */ #ifdef __STDC__ # define VOID void #else # define VOID char #endif xtail-2.1/configure100555 311 311 153415 7116651420 12546 0ustar chipchip#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=xtail.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:558: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # 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>&6 echo "configure:613: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:643: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then case "`uname -s`" in *win32* | *WIN32*) # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:694: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi ;; esac fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:726: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF #line 737 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo "configure:768: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo "configure:773: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo "configure:801: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi if test "$GCC" = yes; then CFLAGS="-Wall $CFLAGS" fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:838: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:859: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 echo "configure:918: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:931: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_stdc=no fi 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 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* 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 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF if { (eval echo configure:998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_header_stdc=no fi rm -fr conftest* fi fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 if test $ac_cv_header_stdc = yes; then cat >> confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 echo "configure:1026: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> int main() { DIR *dirp = 0; ; return 0; } EOF if { (eval echo configure:1039: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 echo "configure:1064: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="$LIBS -ldir" else echo "$ac_t""no" 1>&6 fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 echo "configure:1105: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="$LIBS -lx" else echo "$ac_t""no" 1>&6 fi fi for ac_hdr in stdlib.h unistd.h termios.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:1150: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1160: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done echo $ac_n "checking for working const""... $ac_c" 1>&6 echo "configure:1188: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } ; return 0; } EOF if { (eval echo configure:1242: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_const=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_c_const" 1>&6 if test $ac_cv_c_const = no; then cat >> confdefs.h <<\EOF #define const EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 echo "configure:1263: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_off_t=yes else rm -rf conftest* ac_cv_type_off_t=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_off_t" 1>&6 if test $ac_cv_type_off_t = no; then cat >> confdefs.h <<\EOF #define off_t long EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 echo "configure:1296: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF if { (eval echo configure:1309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_struct_tm=sys/time.h fi rm -f conftest* fi echo "$ac_t""$ac_cv_struct_tm" 1>&6 if test $ac_cv_struct_tm = sys/time.h; then cat >> confdefs.h <<\EOF #define TM_IN_SYS_TIME 1 EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 echo "configure:1331: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #ifdef signal #undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main() { int i; ; return 0; } EOF if { (eval echo configure:1353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_type_signal=int fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_signal" 1>&6 cat >> confdefs.h <&6 echo "configure:1374: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:1402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@CC@%$CC%g s%@CPP@%$CPP%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: # Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF sed -n -f conftest.hdr confdefs.h > conftest.vals rm -f conftest.hdr # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >> conftest.vals <<\EOF s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write a limited-size here document to conftest.frag. echo ' cat > conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF sed -f conftest.frag conftest.in > conftest.out rm -f conftest.in mv conftest.out conftest.in ' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 xtail-2.1/configure.in100444 311 311 1067 7116651420 13103 0ustar chipchipdnl Process this file with autoconf to produce a configure script. AC_INIT(xtail.c) AC_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_INSTALL AC_PROG_CC if test "$GCC" = yes; then CFLAGS="-Wall $CFLAGS" fi dnl Checks for libraries. dnl Checks for header files. AC_HEADER_STDC AC_HEADER_DIRENT AC_CHECK_HEADERS(stdlib.h unistd.h termios.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_STRUCT_TM dnl Checks for library functions. AC_TYPE_SIGNAL AC_CHECK_FUNCS(difftime strerror) AC_OUTPUT(Makefile) xtail-2.1/entryfuncs.c100444 311 311 10444 7116651422 13157 0ustar chipchip/* $Id: entryfuncs.c,v 2.6 2000/06/05 07:10:57 chip Exp $ */ #include "config.h" #include #include #include #include #include #include #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #include "xtail.h" struct entry_list *new_entry_list(int chunk) { struct entry_list *listp; listp = safe_malloc(sizeof(struct entry_list)); listp->list = safe_malloc(chunk * sizeof(struct entry_descrip *)); listp->num_entries = 0; listp->max_entries = chunk; listp->chunk = chunk; return listp; } static struct entry_descrip *E_append(struct entry_list *listp, struct entry_descrip *entryp) { if (listp->num_entries >= listp->max_entries) { listp->max_entries += listp->chunk; listp->list = safe_realloc(listp->list, listp->max_entries * sizeof(struct entry_descrip *)); } listp->list[listp->num_entries++] = entryp; Sorted = FALSE; return entryp; } static void E_remove(struct entry_list *listp, int entryno) { while (++entryno < listp->num_entries) listp->list[entryno-1] = listp->list[entryno]; --listp->num_entries; Sorted = FALSE; } static char *list_name(struct entry_list *listp) /* for debug output only */ { if (listp == List_file) return ""; if (listp == List_dir) return ""; if (listp == List_zap) return ""; return "?unknown?"; } /* * Create a new entry description and append it to a list. */ struct entry_descrip *new_entry(struct entry_list *listp, const char *name) { struct entry_descrip *entryp; Dprintf(stderr, ">>> creating entry '%s' on %s list\n", name, list_name(listp)); entryp = safe_malloc(sizeof(struct entry_descrip)); entryp->name = safe_strdup(name); entryp->fd = 0; entryp->size = 0; entryp->mtime = 0; return E_append(listp,entryp); } /* * Remove an entry from a list and free up its space. */ void rmv_entry(struct entry_list *listp, int entryno) { struct entry_descrip *entryp = listp->list[entryno]; Dprintf(stderr, ">>> removing entry '%s' from %s list\n", listp->list[entryno]->name, list_name(listp)); E_remove(listp,entryno); if (entryp->fd > 0) (void) close(entryp->fd); free((VOID *) entryp->name); free((VOID *) entryp); } /* * Move an entry from one list to another. * In addition we close up the entry if appropriate. */ void move_entry(struct entry_list *dst_listp, struct entry_list *src_listp, int src_entryno) { struct entry_descrip *entryp = src_listp->list[src_entryno]; Dprintf(stderr, ">>> moving entry '%s' from %s list to %s list\n", src_listp->list[src_entryno]->name, list_name(src_listp), list_name(dst_listp)); if (entryp->fd > 0) { (void) close(entryp->fd); entryp->fd = 0; } E_remove(src_listp,src_entryno); (void) E_append(dst_listp,entryp); if (Reset_status) { entryp->size = 0; entryp->mtime = 0; } } /* * Get the inode status for an entry. * Returns code describing the status of the entry. */ int stat_entry(struct entry_list *listp, int entryno, struct stat *sbuf) { int status; struct entry_descrip *entryp = listp->list[entryno]; status = (entryp->fd > 0 ? fstat(entryp->fd,sbuf) : stat(entryp->name,sbuf)); if (status != 0) return (errno == ENOENT ? ENTRY_ZAP : ENTRY_ERROR); switch (sbuf->st_mode & S_IFMT) { case S_IFREG: return ENTRY_FILE; case S_IFDIR: return ENTRY_DIR; default: return ENTRY_SPECIAL; } /*NOTREACHED*/ } /* * Open an entry. * Returns 0 if the open is successful, else returns errno. In the case * of an error, an appropriate diagnostic will be printed, and the entry * will be moved or deleted as required. If the entry is already opened, * then no action will occur and 0 will be returned. */ int open_entry(struct entry_list *listp, int entryno) { struct entry_descrip *entryp = listp->list[entryno]; if (entryp->fd > 0) return 0; Dprintf(stderr, ">>> opening entry '%s' on %s list\n", listp->list[entryno]->name, list_name(listp)); if ((entryp->fd = open(entryp->name, O_RDONLY)) > 0) return 0; if (errno == ENOENT) { message(MSSG_ZAPPED, entryp); move_entry(List_zap, listp, entryno); } else { message(MSSG_OPEN, entryp); rmv_entry(listp, entryno); } return -1; } xtail-2.1/install-sh100555 311 311 12736 7116651420 12623 0ustar chipchip#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 xtail-2.1/miscfuncs.c100444 311 311 15537 7116651422 12761 0ustar chipchip/* $Id: miscfuncs.c,v 2.5 2000/06/04 09:09:03 chip Exp $ */ #include "config.h" #include #include #include #include #include #include #include #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #include #ifdef TM_IN_SYS_TIME # include #endif #ifdef HAVE_TERMIOS_H # include #else # include # define termios termio #endif #ifdef HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen((dirent)->d_name) #else # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen # if HAVE_SYS_NDIR_H # include # endif # if HAVE_SYS_DIR_H # include # endif # if HAVE_NDIR_H # include # endif #endif #ifndef STDC_HEADERS extern VOID *malloc(), *realloc(); extern char *strcpy(), *strrchr(); #endif #ifndef STDIN_FILENO # define STDIN_FILENO 0 #endif #include "xtail.h" /* * Scan a directory for files not currently on a list. */ int scan_directory(const char *dirname) { register int i; register struct dirent *dp; register struct entry_descrip **elist, *entryp; char *basename; struct stat sbuf; DIR *dirp; static char pathname[MAXNAMLEN]; Dprintf(stderr, ">>> scanning directory '%s'\n", dirname); if ((dirp = opendir(dirname)) == NULL) return -1; (void) strcat(strcpy(pathname, dirname), "/"); basename = pathname + strlen(pathname); #define SKIP_DIR(D) \ (D[0] == '.' && (D[1] == '\0' || (D[1] == '.' && D[2] == '\0'))) while ((dp = readdir(dirp)) != NULL) { if (SKIP_DIR(dp->d_name)) continue; (void) strcpy(basename, dp->d_name); if (stat(pathname, &sbuf) != 0) continue; if ((sbuf.st_mode & S_IFMT) != S_IFREG) continue; for (i = List_file->num_entries, elist=List_file->list ; i > 0 ; --i, ++elist) { if (strcmp((*elist)->name, pathname) == 0) break; } if (i > 0) continue; for (i = List_zap->num_entries, elist=List_zap->list ; i > 0 ; --i, ++elist) { if (strcmp((*elist)->name, pathname) == 0) break; } if (i > 0) continue; entryp = new_entry(List_file, pathname); if (Reset_status) { message(MSSG_CREATED, entryp); } else { entryp->mtime = sbuf.st_mtime; entryp->size = sbuf.st_size; } } (void) closedir(dirp); return 0; } /* * Compare mtime of two entries. Used by the "qsort()" in "fixup_open_files()". */ int ecmp(const void *p1, const void *p2) { const struct entry_descrip **ep1 = (const struct entry_descrip **) p1; const struct entry_descrip **ep2 = (const struct entry_descrip **) p2; return ((*ep2)->mtime - (*ep1)->mtime); } /* * Manage the open files. * A small number of entries in "List_file" are kept open to minimize * the overhead in checking for changes. The strategy is to make sure * the MAX_OPEN most recently modified files are all open. */ void fixup_open_files(void) { register int i; register struct entry_descrip **elist; Dprintf(stderr, ">>> resorting file list\n"); (void) qsort( (char *) List_file->list, List_file->num_entries, sizeof(struct entry_descrip *), ecmp); Sorted = TRUE; /* * Start at the end of the list. */ i = last_entry(List_file); elist = &List_file->list[i]; /* * All the files at the end of the list should be closed. */ for ( ; i >= MAX_OPEN ; --i, --elist) { if ((*elist)->fd > 0) { (void) close((*elist)->fd); (*elist)->fd = 0; } } /* * The first MAX_OPEN files in the list should be open. */ for ( ; i >= 0 ; --i, --elist) { if ((*elist)->fd <= 0) (void) open_entry(List_file, i); } } /* * Standard message interface. * There are two reasons for this message interface. First, it provides * consistent diagnostics for all the messages. Second, it manages the * filename banner display whenever we switch to a different file. * Warning - "errno" is used in some of the messages, so care must be * taken not to step on it before message() can be called. */ void message(int sel, const struct entry_descrip *e) { static char *ofile = NULL; /* * Don't display the file banner if the file hasn't changed since last time. */ if (sel == MSSG_BANNER && ofile != NULL && strcmp(ofile, e->name) == 0) return; /* * Make sure the message selector is within range. */ if (sel < 0 || sel > MSSG_UNKNOWN) sel = MSSG_UNKNOWN; /* * Display the message. */ if (mssg_list[sel] != NULL) (void) printf(mssg_list[sel], e->name, strerror(errno)); ofile = (sel == MSSG_BANNER ? e->name : NULL); } /* * Display currently opened files. */ void show_status(void) { int i, n; struct tm *tp; static char *monname[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; static time_t tval0; time_t tval; /* give user a hint if they are whacking on SIGINT */ time(&tval); if (tval0 != 0 && difftime(tval, tval0) < 3) (void) printf("(note: use \"%s\" SIQUIT to exit program)\n", quit_ch()); tval0 = tval; (void) printf("\n*** recently changed files ***\n"); for (i = 0, n = 0 ; i < List_file->num_entries ; ++i) { if (List_file->list[i]->fd > 0) { tp = localtime(&List_file->list[i]->mtime); (void) printf("%4d %2d-%3s-%02d %02d:%02d:%02d %s\n", ++n, tp->tm_mday, monname[tp->tm_mon], (tp->tm_year % 100), tp->tm_hour, tp->tm_min, tp->tm_sec, List_file->list[i]->name ); } } (void) printf( "currently watching: %d files %d dirs %d unknown entries\n", List_file->num_entries, List_dir->num_entries, List_zap->num_entries); message(MSSG_NONE, (struct entry_descrip *) NULL); } char *quit_ch(void) { struct termios tty; static char buf[8]; int c; if (buf[0] != '\0') return buf; if (tcgetattr(STDIN_FILENO, &tty) < 0) { strcpy(buf, "?err?"); return buf; } c = tty.c_cc[VQUIT]; if (isprint(c) && !isspace(c)) { buf[0] = c; buf[1] = '\0'; } else if (iscntrl(c)) { sprintf(buf, "ctrl-%c", c+0x40); } else { sprintf(buf, "0x%02X", c); } return buf; } VOID *safe_malloc(size_t n) { VOID *p; if ((p = malloc(n)) == NULL) { fprintf(stderr, "%s: malloc(%d) failed\n", Progname, n); exit(2); } return p; } VOID *safe_realloc(VOID *p, size_t n) { VOID *p1; if ((p1 = realloc(p, n)) == NULL) { fprintf(stderr, "%s: realloc(%d) failed\n", Progname, n); exit(2); } return p1; } char *safe_strdup(const char *p) { return strcpy(safe_malloc(strlen(p)+1), p); } char *basename(char *p) { char *q = strrchr(p, '/'); return (q ? q+1 : p); } #ifndef HAVE_DIFFTIME double difftime(time_t t1, time_t t0) { double d1, d0; d1 = t1; d0 = t0; return (d1 - d0); } #endif #ifndef HAVE_STRERROR extern int errno; extern char *sys_errlist[]; char *strerror(int err) { return sys_errlist[err]; } #endif xtail-2.1/xtail.1100444 311 311 2430 7116651422 11772 0ustar chipchip.\" $Id: xtail.1,v 2.2 1996/06/25 00:31:15 chip Exp $ .TH XTAIL 1L .SH NAME xtail - Watch the growth of files. .SH SYNTAX .B xtail entry ... .SH DESCRIPTION .I Xtail monitors one or more files, and displays all data written to a file since command invocation. It is very useful for monitoring multiple logfiles simultaneously. .P If an .I entry given on the command line is a directory, all files in that directory will be monitored, including those created after the .I xtail invocation. If an .I entry given on the command line doesn't exist, .I xtail will watch for it and monitor it once created. When switching files in the display, a banner showing the pathname of the file is printed. .P An interrupt character (usually CTRL/C or DEL) will display a list of the most recently modified files being watched. Send a quit signal (usually CTRL/backslash) to stop .IR xtail . .SH SEE ALSO tail(1) .SH NOTES .I Xtail may be easily confused. For example, if a file is renamed, .I xtail may or may not continue to monitor it. If you ask it to monitor a file multiple times, it probably will. If you misspell a filename, .I xtail will treat it as a nonexistent entry and happily wait for its creation. .P My favorite use is "xtail /usr/spool/uucp/.Log/*". .SH AUTHOR Chip Rosenthal xtail-2.1/xtail.c100444 311 311 20716 7116651420 12101 0ustar chipchip/* $Id: xtail.c,v 2.5 2000/06/04 09:09:03 chip Exp $ */ #include "config.h" #include #include #include #include #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #define INTERN #include "xtail.h" int sigcaught = 0; RETSIGTYPE sigcatcher(int sig); int main(int argc, char *argv[]) { int open_files_only, already_open, iteration, i; struct entry_descrip *entryp; struct stat sbuf; /* * Initialize. */ Progname = basename(argv[0]); List_file = new_entry_list(ENTRY_LIST_CHUNK); List_dir = new_entry_list(ENTRY_LIST_CHUNK); List_zap = new_entry_list(ENTRY_LIST_CHUNK); Sorted = FALSE; Reset_status = FALSE; Debug = FALSE; sigcatcher(0); /* * Place all of the entries onto lists. */ for (i = 1 ; i < argc ; ++i) { if (i == 1 && strcmp(argv[i], "-D") == 0) { Debug = TRUE; continue; } /* * Temporarily throw this entry onto the end of the zapped list. */ entryp = new_entry(List_zap, argv[i]); /* * Stat the file and get it to its proper place. */ switch (stat_entry(List_zap, last_entry(List_zap), &sbuf)) { case ENTRY_FILE: /* move entry to file list */ move_entry(List_file, List_zap, last_entry(List_zap)); entryp->size = sbuf.st_size; entryp->mtime = sbuf.st_mtime; break; case ENTRY_DIR: /* move entry to dir list */ move_entry(List_dir, List_zap, last_entry(List_zap)); entryp->size = sbuf.st_size; entryp->mtime = sbuf.st_mtime; if (scan_directory(entryp->name) != 0) { message(MSSG_OPEN, entryp); rmv_entry(List_dir, last_entry(List_dir)); } break; case ENTRY_ZAP: /* keep entry on zap list */ break; case ENTRY_SPECIAL: /* entry is a special file */ message(MSSG_NOTAFIL, entryp); rmv_entry(List_zap, last_entry(List_zap)); break; default: /* stat error */ message(MSSG_STAT, entryp); rmv_entry(List_zap, last_entry(List_zap)); break; } } /* * Make sure we are watching something reasonable. */ if (List_file->num_entries == 0) { if (List_dir->num_entries == 0 && List_zap->num_entries == 0) { (void) fprintf(stderr, "%s: no valid entries specified\n", Progname); (void) exit(1); } (void) puts("\n*** warning - no files are being watched ***"); } /* * From this point on we want to reset the status of an entry any * time we move it around to another list. */ Reset_status = TRUE; /* * Force a check of everything first time through the loop. */ iteration = CHECK_COUNT; /* * Loop forever. */ for (;;) { /* * Once every CHECK_COUNT iterations check everything. * All other times only look at the opened files. */ open_files_only = (++iteration < CHECK_COUNT); if (!open_files_only) iteration = 0; /* * Make sure that the most recently modified files are open. */ if (!Sorted) fixup_open_files(); /* * Display what we are watching if a SIGINT was caught. */ if (sigcaught) { show_status(); sigcatcher(0); } /* * Go through all of the files looking for changes. */ Dprintf(stderr, ">>> checking files list (%s)\n", (open_files_only ? "open files only" : "all files")); for (i = 0 ; i < List_file->num_entries ; ++i) { entryp = List_file->list[i]; already_open = (entryp->fd > 0) ; /* * Ignore closed files except every CHECK_COUNT iterations. */ if (!already_open && open_files_only) continue; /* * Get the status of this file. */ switch (stat_entry(List_file, i, &sbuf)) { case ENTRY_FILE: /* got status OK */ break; case ENTRY_DIR: /* huh??? it's now a dir */ move_entry(List_dir, List_file, i--); continue; case ENTRY_ZAP: /* entry has been deleted */ message(MSSG_ZAPPED, entryp); move_entry(List_zap, List_file, i--); continue; case ENTRY_SPECIAL: /* entry is a special file */ message(MSSG_NOTAFIL, entryp); rmv_entry(List_file, i--); continue; default: /* stat error */ message(MSSG_STAT, entryp); rmv_entry(List_file, i--); continue; } /* * See if an opened file has been deleted. */ if (already_open && sbuf.st_nlink == 0) { message(MSSG_ZAPPED, entryp); move_entry(List_zap, List_file, i--); continue; } /* * If nothing has changed then continue on. */ if (entryp->size==sbuf.st_size && entryp->mtime==sbuf.st_mtime) continue; /* * If the file isn't already open, then do so. * Note -- it is important that we call "fixup_open_files()" * at the end of the loop to make sure too many files don't * stay opened. */ if (!already_open && open_entry(List_file, i) != 0) { --i; continue; } /* * See if the file has been truncated. */ if (sbuf.st_size < entryp->size) { message(MSSG_TRUNC, entryp); entryp->size = 0; } /* * Seek to where the changes begin. */ if (lseek(entryp->fd, entryp->size, 0) < 0) { message(MSSG_SEEK, entryp); rmv_entry(List_file, i--); continue; } /* * Dump the recently added info. */ { int nb; static char buf[BUFSIZ]; message(MSSG_BANNER, entryp); while ((nb = read(entryp->fd, buf, sizeof(buf))) > 0) { (void) fwrite(buf, sizeof(char), (unsigned) nb, stdout); entryp->size += nb; } if (nb < 0) { message(MSSG_READ, entryp); rmv_entry(List_file, i--); continue; } } /* * Update the modification time. */ entryp->mtime = sbuf.st_mtime; /* * Since we've changed the mtime, the list might no longer be * sorted. However if this entry is already at the top of the * list then it's OK. */ if (i != 0) Sorted = FALSE; /* * If we've just opened the file then force a resort now to * prevent too many files from being opened. */ if (!already_open) fixup_open_files(); } /* * Go through list of nonexistent entries to see if any have appeared. * This is done only once every CHECK_COUNT iterations. */ if (!open_files_only) { Dprintf(stderr, ">>> checking zapped list\n"); for (i = 0 ; i < List_zap->num_entries ; ++i) { entryp = List_zap->list[i]; switch (stat_entry(List_zap, i, &sbuf)) { case ENTRY_FILE: /* entry has appeared as a file */ message(MSSG_CREATED, entryp); move_entry(List_file, List_zap, i--); break; case ENTRY_DIR: /* entry has appeared as a dir */ message(MSSG_CREATED, entryp); move_entry(List_dir, List_zap, i--); break; case ENTRY_ZAP: /* entry still doesn't exist */ break; case ENTRY_SPECIAL: /* entry is a special file */ message(MSSG_NOTAFIL, entryp); rmv_entry(List_zap, i--); break; default: /* error - entry removed */ message(MSSG_STAT, entryp); rmv_entry(List_zap, i--); break; } } } /* * Go through the list of dirs to see if any new files were created. * This is done only once every CHECK_COUNT iterations. */ if (!open_files_only) { Dprintf(stderr, ">>> checking directory list\n"); for (i = 0 ; !open_files_only && i < List_dir->num_entries ; ++i) { entryp = List_dir->list[i]; switch (stat_entry(List_dir, i, &sbuf)) { case ENTRY_DIR: /* got status OK */ break; case ENTRY_FILE: /* huh??? it's now a reg file */ move_entry(List_file, List_dir, i--); continue; case ENTRY_ZAP: /* entry has been deleted */ message(MSSG_ZAPPED, entryp); move_entry(List_zap, List_dir, i--); continue; case ENTRY_SPECIAL: /* entry is a special file */ message(MSSG_NOTAFIL, entryp); rmv_entry(List_dir, i--); continue; default: /* stat error */ message(MSSG_STAT, entryp); rmv_entry(List_dir, i--); continue; } if (entryp->mtime == sbuf.st_mtime) continue; if (scan_directory(entryp->name) != 0) { message(MSSG_OPEN, entryp); rmv_entry(List_dir, i--); } entryp->mtime = sbuf.st_mtime; } } /* * End of checking loop. */ { extern unsigned sleep(); (void) fflush(stdout); (void) sleep(SLEEP_TIME); } } /*NOTREACHED*/ } RETSIGTYPE sigcatcher(int sig) { if (sig == SIGQUIT) (void) exit(0); sigcaught = sig; #ifdef STATUS_ENAB (void) signal(SIGINT, sigcatcher); (void) signal(SIGQUIT, sigcatcher); #endif } xtail-2.1/xtail.h100444 311 311 15635 7116651422 12114 0ustar chipchip/* $Id: xtail.h,v 2.7 2000/06/04 19:02:23 chip Exp $ */ /***************************************************************************** * * Start of Site-Specific Customizations * *****************************************************************************/ /* * STATUS_ENAB - If defined, a SIGINT causes a summary of the opened files to * be displayed, and a SIGQUIT terminates the program. If not defined, * these signals act normally. */ #define STATUS_ENAB /* * SLEEP_TIME - Number of seconds between iterations of the checking loop. */ #define SLEEP_TIME 1 /* * CHECK_COUNT - Recently modified files are checked for changes every time * through the checking loop. We only go looking for changes to * not-so-recently modified stuff only once ever CHECK_COUNT iterations * through the loop. */ #define CHECK_COUNT 5 /* * MAX_OPEN - This number of most recently changed files is kept open, and * they are checked every iteration through the checking loop. Keeping these * files open improves the performance because we can use "fstat()" rather * than "stat()". Keeping too many files open may overflow your open file * table, and will reduce performance by checking more files more frequently. */ #define MAX_OPEN 8 /* * MAX_ENTRIES - This is *BOGUS* I should get rid of this. */ #define MAX_ENTRIES 512 /***************************************************************************** * * End of Site-Specific Customizations * *****************************************************************************/ #define TRUE 1 #define FALSE 0 #define Dprintf if ( !Debug ) ; else (void) fprintf /* * Codes returned by the "stat_entry()" procedure. */ #define ENTRY_ERROR 0 /* stat error or permissions error */ #define ENTRY_SPECIAL 1 /* entry is a special file */ #define ENTRY_FILE 2 /* entry is a regular file */ #define ENTRY_DIR 3 /* entry is a directory */ #define ENTRY_ZAP 4 /* specified entry doesn't exist */ /* * Diagnostic message codes. * The ordering of codes must correspond to the "mssg_list[]" defined below. */ #define MSSG_NONE 0 /* no message - just reset header */ #define MSSG_BANNER 1 /* display banner for file output */ #define MSSG_CREATED 2 /* file has been created */ #define MSSG_ZAPPED 3 /* file has been deleted */ #define MSSG_TRUNC 4 /* file has been truncated */ #define MSSG_NOTAFIL 5 /* error - not a regular file or dir */ #define MSSG_STAT 6 /* error - stat() failed */ #define MSSG_OPEN 7 /* error - open() failed */ #define MSSG_SEEK 8 /* error - lseek() failed */ #define MSSG_READ 9 /* error - read() failed */ #define MSSG_UNKNOWN 10 /* unknown error - must be last in list */ #ifdef INTERN # define EXTERN #else # define EXTERN extern #endif /* * Each item we are watching is stored in a (struct entry_descrip). These * entries are placed in lists, which are managed as (struct entry_list). * * There are three lists maintained: * * List_file All of the regular files we are watching. We will try to * keep the MAX_OPEN most recently modified files open, and * they will be checked more frequently. * * List_dir All of the directories we are watching. If a file is created * in one of these directories, we will add it to "List_file". * * List_zap All the entries which don't exist. When something appears * under one of these names, the entry will be moved to either * "List_file" or "List_dir", as appropriate. */ struct entry_descrip { char *name; /* pathname to the entry */ int fd; /* opened fd, or <= 0 if not opened */ long size; /* size of entry last time checked */ long mtime; /* modification time last time checked */ }; struct entry_list { struct entry_descrip **list; int num_entries; /* num entries stored in the list */ int max_entries; /* list allocated to hold this many entries */ int chunk; /* chunk for growin the list */ }; #define ENTRY_LIST_CHUNK 64 #define last_entry(L) ((L)->num_entries - 1) /* * The lists of entries being watched. */ EXTERN struct entry_list *List_file; /* regular files */ EXTERN struct entry_list *List_dir; /* directories */ EXTERN struct entry_list *List_zap; /* nonexistent entries */ /* * List sorting status. * This flag indicates that "List_file" is sorted, and the right entries * are open. Anything which possibly effects this state (e.g. an entry * is added to "List_file", the mtime of a file is changed, etc.) must set * this flag FALSE. We will periodically check this flag and call the * "fixup_open_files()" procedure to resort and organize the list. */ EXTERN int Sorted; /* * Entry status control flag. * The procedures which manipulate entries will reset the status information * if this flag is TRUE. When initializing the lists we want this FALSE. * For example, consider the file size. When initializing we want to use * the current file size, otherwise we would dump the file from the beginning. * However, later when we notice things are created we want to reset the * size to zero so that we do dump from the beginning. */ EXTERN int Reset_status; EXTERN int Debug; EXTERN char *Progname; /* * Diagnostic messages produced by the "message()" procedure. * The first "%s" is the entry name. The second "%s" is the errno descrip. */ #ifdef INTERN char *mssg_list[] = { NULL, /*MSSG_NONE */ "\n*** %s ***\n", /*MSSG_BANNER */ "\n*** '%s' has been created ***\n", /*MSSG_CREATED*/ "\n*** '%s' has been deleted ***\n", /*MSSG_ZAPPED */ "\n*** '%s' has been truncated - rewinding ***\n", /*MSSG_TRUNC */ "\n*** error - '%s' not a file or dir - removed ***\n", /*MSSG_NOTAFIL*/ "\n*** error - couldn't stat '%s' (%s) - removed ***\n",/*MSSG_STAT */ "\n*** error - couldn't open '%s' (%s) - removed ***\n",/*MSSG_OPEN */ "\n*** error - couldn't seek '%s' (%s) - removed ***\n",/*MSSG_SEEK */ "\n*** error - couldn't read '%s' (%s) - removed ***\n",/*MSSG_READ */ "\n*** error - unknown error on file '%s' ***\n", /*MSSG_UNKNOWN*/ }; #else extern char *mssg_list[]; #endif /* * Entry management procedures. */ struct entry_list *new_entry_list(int chunk); struct entry_descrip *new_entry(struct entry_list *listp, const char *name); void rmv_entry(struct entry_list *listp, int entryno); void move_entry(struct entry_list *dst_listp, struct entry_list *src_listp, int src_entryno); int stat_entry(struct entry_list *listp, int entryno, struct stat *sbuf); int open_entry(struct entry_list *listp, int entryno); /* * Miscellaneous procedures. */ int scan_directory(const char *dirname); int ecmp(const void *p1, const void *p2); void fixup_open_files(void); void message(int sel, const struct entry_descrip *e); void show_status(void); char *quit_ch(void); VOID *safe_malloc(size_t n); VOID *safe_realloc(VOID *p, size_t n); char *safe_strdup(const char *p); char *basename(char *p); #ifndef HAVE_DIFFTIME double difftime(time_t t1, time_t t0) #endif #ifndef HAVE_STRERROR char *strerror(int err); #endif