v47i141: conflict - utility for displaying pathname conflicts, Part01/02

6 views
Skip to first unread message

T.E.Dickey

unread,
Apr 16, 1995, 3:00:00 AM4/16/95
to
Submitted-by: dic...@clark.net ("T.E.Dickey")
Posting-number: Volume 47, Issue 141
Archive-name: conflict/part01
Environment: UNIX, MSDOS, OS/2

CONFLICT examines the user-specifiable list of programs, looking for instances
in the user's path which conflict (i.e., the name appears in more than one
point in the path).

It runs on UNIX systems, as well as MSDOS and OS/2.

#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# Contents: conflict-6.0 conflict-6.0/configure
# conflict-6.0/conflict.h conflict-6.0/install.sh
# conflict-6.0/unix.c
# Wrapped by kent@ftp on Sun Apr 16 18:09:28 1995
PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 1 (of 2)."'
if test ! -d 'conflict-6.0' ; then
echo shar: Creating directory \"'conflict-6.0'\"
mkdir 'conflict-6.0'
fi
if test -f 'conflict-6.0/configure' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/configure'\"
else
echo shar: Extracting \"'conflict-6.0/configure'\" \(41850 characters\)
sed "s/^X//" >'conflict-6.0/configure' <<'END_OF_FILE'
X#! /bin/sh
X
X# From configure.in Revision: 6.0
X# Guess values for system-dependent variables and create Makefiles.
X# Generated automatically using autoconf version 2.2
X# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
X#
X# This configure script is free software; the Free Software Foundation
X# gives unlimited permission to copy, distribute and modify it.
X
X# Defaults:
Xac_help=
Xac_default_prefix=/usr/local
X# Any additions from configure.in:
Xac_help="$ac_help
X --with-debugging turn on gcc debug-flag "
Xac_help="$ac_help
X --with-warnings turn on gcc warnings, for debugging "
Xac_help="$ac_help
X --with-dbmalloc compile/link with dbmalloc if found "
X
X# Initialize some variables set by options.
X# The variables have the same names as the options, with
X# dashes changed to underlines.
Xbuild=NONE
Xcache_file=./config.cache
Xexec_prefix=NONE
Xhost=NONE
Xno_create=
Xnonopt=NONE
Xno_recursion=
Xprefix=NONE
Xprogram_prefix=NONE
Xprogram_suffix=NONE
Xprogram_transform_name=s,x,x,
Xsilent=
Xsite=
Xsrcdir=
Xtarget=NONE
Xverbose=
Xx_includes=NONE
Xx_libraries=NONE
X
X# Initialize some other variables.
Xsubdirs=
X
Xac_prev=
Xfor ac_option
Xdo
X
X # If the previous option needs an argument, assign it.
X if test -n "$ac_prev"; then
X eval "$ac_prev=\$ac_option"
X ac_prev=
X continue
X fi
X
X case "$ac_option" in
X -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
X *) ac_optarg= ;;
X esac
X
X # Accept the important Cygnus configure options, so we can diagnose typos.
X
X case "$ac_option" in
X
X -build | --build | --buil | --bui | --bu | --b)
X ac_prev=build ;;
X -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
X build="$ac_optarg" ;;
X
X -cache-file | --cache-file | --cache-fil | --cache-fi \
X | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
X ac_prev=cache_file ;;
X -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
X | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
X cache_file="$ac_optarg" ;;
X
X -disable-* | --disable-*)
X ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
X # Reject names that are not valid shell variable names.
X if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
X { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
X fi
X ac_feature=`echo $ac_feature| sed 's/-/_/g'`
X eval "enable_${ac_feature}=no" ;;
X
X -enable-* | --enable-*)
X ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
X # Reject names that are not valid shell variable names.
X if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
X { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
X fi
X ac_feature=`echo $ac_feature| sed 's/-/_/g'`
X case "$ac_option" in
X *=*) ;;
X *) ac_optarg=yes ;;
X esac
X eval "enable_${ac_feature}='$ac_optarg'" ;;
X
X -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
X | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
X | --exec | --exe | --ex)
X ac_prev=exec_prefix ;;
X -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
X | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
X | --exec=* | --exe=* | --ex=*)
X exec_prefix="$ac_optarg" ;;
X
X -gas | --gas | --ga | --g)
X # Obsolete; use --with-gas.
X with_gas=yes ;;
X
X -help | --help | --hel | --he)
X # Omit some internal or obsolete options to make the list less imposing.
X # This message is too long to be a string in the A/UX 3.1 sh.
X cat << EOF
XUsage: configure [options] [host]
XOptions: [defaults in brackets after descriptions]
XConfiguration:
X --cache-file=FILE cache test results in FILE
X --help print this message
X --no-create do not create output files
X --quiet, --silent do not print \`checking...' messages
X --version print the version of autoconf that created configure
XDirectory and file names:
X --prefix=PREFIX install architecture-independent files in PREFIX
X [$ac_default_prefix]
X --exec-prefix=PREFIX install architecture-dependent files in PREFIX
X [same as prefix]
X --srcdir=DIR find the sources in DIR [configure dir or ..]
X --program-prefix=PREFIX prepend PREFIX to installed program names
X --program-suffix=SUFFIX append SUFFIX to installed program names
X --program-transform-name=PROGRAM run sed PROGRAM on installed program names
XHost type:
X --build=BUILD configure for building on BUILD [BUILD=HOST]
X --host=HOST configure for HOST [guessed]
X --target=TARGET configure for TARGET [TARGET=HOST]
XFeatures and packages:
X --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
X --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
X --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
X --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
X --x-includes=DIR X include files are in DIR
X --x-libraries=DIR X library files are in DIR
X--enable and --with options recognized:$ac_help
XEOF
X exit 0 ;;
X
X -host | --host | --hos | --ho)
X ac_prev=host ;;
X -host=* | --host=* | --hos=* | --ho=*)
X host="$ac_optarg" ;;
X
X -nfp | --nfp | --nf)
X # Obsolete; use --without-fp.
X with_fp=no ;;
X
X -no-create | --no-create | --no-creat | --no-crea | --no-cre \
X | --no-cr | --no-c)
X no_create=yes ;;
X
X -no-recursion | --no-recursion | --no-recursio | --no-recursi \
X | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
X no_recursion=yes ;;
X
X -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
X ac_prev=prefix ;;
X -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
X prefix="$ac_optarg" ;;
X
X -program-prefix | --program-prefix | --program-prefi | --program-pref \
X | --program-pre | --program-pr | --program-p)
X ac_prev=program_prefix ;;
X -program-prefix=* | --program-prefix=* | --program-prefi=* \
X | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
X program_prefix="$ac_optarg" ;;
X
X -program-suffix | --program-suffix | --program-suffi | --program-suff \
X | --program-suf | --program-su | --program-s)
X ac_prev=program_suffix ;;
X -program-suffix=* | --program-suffix=* | --program-suffi=* \
X | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
X program_suffix="$ac_optarg" ;;
X
X -program-transform-name | --program-transform-name \
X | --program-transform-nam | --program-transform-na \
X | --program-transform-n | --program-transform- \
X | --program-transform | --program-transfor \
X | --program-transfo | --program-transf \
X | --program-trans | --program-tran \
X | --progr-tra | --program-tr | --program-t)
X ac_prev=program_transform_name ;;
X -program-transform-name=* | --program-transform-name=* \
X | --program-transform-nam=* | --program-transform-na=* \
X | --program-transform-n=* | --program-transform-=* \
X | --program-transform=* | --program-transfor=* \
X | --program-transfo=* | --program-transf=* \
X | --program-trans=* | --program-tran=* \
X | --progr-tra=* | --program-tr=* | --program-t=*)
X program_transform_name="$ac_optarg" ;;
X
X -q | -quiet | --quiet | --quie | --qui | --qu | --q \
X | -silent | --silent | --silen | --sile | --sil)
X silent=yes ;;
X
X -site | --site | --sit)
X ac_prev=site ;;
X -site=* | --site=* | --sit=*)
X site="$ac_optarg" ;;
X
X -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
X ac_prev=srcdir ;;
X -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
X srcdir="$ac_optarg" ;;
X
X -target | --target | --targe | --targ | --tar | --ta | --t)
X ac_prev=target ;;
X -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
X target="$ac_optarg" ;;
X
X -v | -verbose | --verbose | --verbos | --verbo | --verb)
X verbose=yes ;;
X
X -version | --version | --versio | --versi | --vers)
X echo "configure generated by autoconf version 2.2"
X exit 0 ;;
X
X -with-* | --with-*)
X ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
X # Reject names that are not valid shell variable names.
X if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
X { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
X fi
X ac_package=`echo $ac_package| sed 's/-/_/g'`
X case "$ac_option" in
X *=*) ;;
X *) ac_optarg=yes ;;
X esac
X eval "with_${ac_package}='$ac_optarg'" ;;
X
X -without-* | --without-*)
X ac_package=`echo $ac_option|sed -e 's/-*without-//'`
X # Reject names that are not valid shell variable names.
X if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
X { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
X fi
X ac_package=`echo $ac_package| sed 's/-/_/g'`
X eval "with_${ac_package}=no" ;;
X
X --x)
X # Obsolete; use --with-x.
X with_x=yes ;;
X
X -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
X | --x-incl | --x-inc | --x-in | --x-i)
X ac_prev=x_includes ;;
X -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
X | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
X x_includes="$ac_optarg" ;;
X
X -x-libraries | --x-libraries | --x-librarie | --x-librari \
X | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
X ac_prev=x_libraries ;;
X -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
X | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
X x_libraries="$ac_optarg" ;;
X
X -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
X ;;
X
X *)
X if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
X echo "configure: warning: $ac_option: invalid host type" 1>&2
X fi
X if test "x$nonopt" != xNONE; then
X { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
X fi
X nonopt="$ac_option"
X ;;
X
X esac
Xdone
X
Xif test -n "$ac_prev"; then
X { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
Xfi
X
Xtrap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
X
X# File descriptor usage:
X# 0 standard input
X# 1 file creation
X# 2 errors and warnings
X# 3 some systems may open it to /dev/tty
X# 4 used on the Kubota Titan
X# 6 checking for... messages and results
X# 5 compiler messages saved in config.log
Xif test "$silent" = yes; then
X exec 6>/dev/null
Xelse
X exec 6>&1
Xfi
Xexec 5>./config.log
X
Xecho "\
XThis file contains any messages produced by compilers while
Xrunning configure, to aid debugging if configure makes a mistake.
X" 1>&5
X
X# Strip out --no-create and --no-recursion so they do not pile up.
X# Also quote any args containing shell metacharacters.
Xac_configure_args=
Xfor ac_arg
Xdo
X case "$ac_arg" in
X -no-create | --no-create | --no-creat | --no-crea | --no-cre \
X | --no-cr | --no-c) ;;
X -no-recursion | --no-recursion | --no-recursio | --no-recursi \
X | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
X *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
X ac_configure_args="$ac_configure_args '$ac_arg'" ;;
X *) ac_configure_args="$ac_configure_args $ac_arg" ;;
X esac
Xdone
X
X# NLS nuisances.
X# Only set LANG and LC_ALL to C if already set.
X# These must not be set unconditionally because not all systems understand
X# e.g. LANG=C (notably SCO).
Xif test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
Xif test "${LANG+set}" = set; then LANG=C; export LANG; fi
X
X# confdefs.h avoids OS command line length limits that DEFS can exceed.
Xrm -rf conftest* confdefs.h
X# AIX cpp loses on an empty file, so make sure it contains at least a newline.
Xecho > confdefs.h
X
X# A filename unique to this package, relative to the directory that
X# configure is in, which we can look for to find out if srcdir is correct.
Xac_unique_file=conflict.c
X
X# Find the source files, if location was not specified.
Xif test -z "$srcdir"; then
X ac_srcdir_defaulted=yes
X # Try the directory containing this script, then its parent.
X ac_prog=$0
X ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
X test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
X srcdir=$ac_confdir
X if test ! -r $srcdir/$ac_unique_file; then
X srcdir=..
X fi
Xelse
X ac_srcdir_defaulted=no
Xfi
Xif test ! -r $srcdir/$ac_unique_file; then
X if test "$ac_srcdir_defaulted" = yes; then
X { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
X else
X { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
X fi
Xfi
Xsrcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
X
X# Prefer explicitly selected file to automatically selected ones.
Xif test -z "$CONFIG_SITE"; then
X if test "x$prefix" != xNONE; then
X CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
X else
X CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
X fi
Xfi
Xfor ac_site_file in $CONFIG_SITE; do
X if test -r "$ac_site_file"; then
X echo "loading site script $ac_site_file"
X . "$ac_site_file"
X fi
Xdone
X
Xif test -r "$cache_file"; then
X echo "loading cache $cache_file"
X . $cache_file
Xelse
X echo "creating cache $cache_file"
X > $cache_file
Xfi
X
Xac_ext=c
X# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
Xac_cpp='$CPP $CPPFLAGS'
Xac_compile='${CC-cc} conftest.$ac_ext $CFLAGS $CPPFLAGS -c 1>&5 2>&5'
Xac_link='${CC-cc} conftest.$ac_ext $CFLAGS $CPPFLAGS $LDFLAGS -o conftest $LIBS 1>&5 2>&5'
X
Xif (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
X # Stardent Vistra SVR4 grep lacks -e, says gh...@caip.rutgers.edu.
X if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
X ac_n= ac_c='
X' ac_t=' '
X else
X ac_n=-n ac_c= ac_t=
X fi
Xelse
X ac_n= ac_c='\c' ac_t=
Xfi
X
X
X
X# Check whether --with-debugging or --without-debugging was given.
Xwithval="$with_debugging"
Xif test -n "$withval"; then
X CFLAGS="$CFLAGS -g"
Xelse
X CFLAGS="$CFLAGS -O"
Xfi
X
X
X# Extract the first word of "gcc", so it can be a program name with args.
Xset dummy gcc; ac_word=$2
Xecho $ac_n "checking for $ac_word""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X if test -n "$CC"; then
X ac_cv_prog_CC="$CC" # Let the user override the test.
Xelse
X IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
X for ac_dir in $PATH; do
X test -z "$ac_dir" && ac_dir=.
X if test -f $ac_dir/$ac_word; then
X ac_cv_prog_CC="gcc"
X break
X fi
X done
X IFS="$ac_save_ifs"
X test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc"
Xfi
Xfi
XCC="$ac_cv_prog_CC"
Xif test -n "$CC"; then
X echo "$ac_t""$CC" 1>&6
Xelse
X echo "$ac_t""no" 1>&6
Xfi
X
X
Xecho $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.c <<EOF
X#ifdef __GNUC__
X yes;
X#endif
XEOF
Xif ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then
X ac_cv_prog_gcc=yes
Xelse
X ac_cv_prog_gcc=no
Xfi
Xfi
Xecho "$ac_t""$ac_cv_prog_gcc" 1>&6
Xif test $ac_cv_prog_gcc = yes; then
X GCC=yes
X if test "${CFLAGS+set}" != set; then
X echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X echo 'void f(){}' > conftest.c
Xif test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
X ac_cv_prog_gcc_g=yes
Xelse
X ac_cv_prog_gcc_g=no
Xfi
Xrm -f conftest*
X
Xfi
X echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
X if test $ac_cv_prog_gcc_g = yes; then
X CFLAGS="-g -O"
X else
X CFLAGS="-O"
X fi
X fi
Xelse
X GCC=
X test "${CFLAGS+set}" = set || CFLAGS="-g"
Xfi
X
Xac_aux_dir=
Xfor ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
X if test -f $ac_dir/install-sh; then
X ac_aux_dir=$ac_dir
X ac_install_sh="$ac_aux_dir/install-sh -c"
X break
X elif test -f $ac_dir/install.sh; then
X ac_aux_dir=$ac_dir
X ac_install_sh="$ac_aux_dir/install.sh -c"
X break
X fi
Xdone
Xif test -z "$ac_aux_dir"; then
X { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
Xfi
Xac_config_guess=$ac_aux_dir/config.guess
Xac_config_sub=$ac_aux_dir/config.sub
Xac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
X
X# Find a good install program. We prefer a C program (faster),
X# so one script is as good as another. But avoid the broken or
X# incompatible versions:
X# SysV /etc/install, /usr/sbin/install
X# SunOS /usr/etc/install
X# IRIX /sbin/install
X# AIX /bin/install
X# AFS /usr/afsws/bin/install, which mishandles nonexistent args
X# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
X# ./install, which can be erroneously created by make from ./install.sh.
Xecho $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
Xif test -z "$INSTALL"; then
Xif eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
X for ac_dir in $PATH; do
X # Account for people who put trailing slashes in PATH elements.
X case "$ac_dir/" in
X /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
X *)
X # OSF1 and SCO ODT 3.0 have their own names for install.
X for ac_prog in ginstall installbsd scoinst install; do
X if test -f $ac_dir/$ac_prog; then
X if test $ac_prog = install &&
X grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
X # AIX install. It has an incompatible calling convention.
X # OSF/1 installbsd also uses dspmsg, but is usable.
X :
X else
X ac_cv_path_install="$ac_dir/$ac_prog -c"
X break 2
X fi
X fi
X done
X ;;
X esac
X done
X IFS="$ac_save_ifs"
X # As a last resort, use the slow shell script.
X test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh"
Xfi
X INSTALL="$ac_cv_path_install"
Xfi
Xecho "$ac_t""$INSTALL" 1>&6
X
X# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
X# It thinks the first close brace ends the variable substitution.
Xtest -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
X
Xtest -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
X
Xecho $ac_n "checking for working const""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.$ac_ext <<EOF
X#line 568 "configure"
X#include "confdefs.h"
X
Xint main() { return 0; }
Xint t() {
X
X/* Ultrix mips cc rejects this. */
Xtypedef int charset[2]; const charset x;
X/* SunOS 4.1.1 cc rejects this. */
Xchar const *const *ccp;
Xchar **p;
X/* NEC SVR4.0.2 mips cc rejects this. */
Xstruct point {int x, y;};
Xstatic struct point const zero;
X/* AIX XL C 1.02.0.0 rejects this.
X It does not let you subtract one const X* pointer from another in an arm
X of an if-expression whose if-part is not a constant expression */
Xconst char *g = "string";
Xccp = &g + (g ? g-g : 0);
X/* HPUX 7.0 cc rejects these. */
X++ccp;
Xp = (char**) ccp;
Xccp = (char const *const *) p;
X{ /* SCO 3.2v4 cc rejects this. */
X char *t;
X char const *s = 0 ? (char *) 0 : (char const *) 0;
X
X *t++ = 0;
X}
X{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
X int x[] = {25, 17};
X const int *foo = &x[0];
X ++foo;
X}
X{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
X typedef const int *iptr;
X iptr p = 0;
X ++p;
X}
X{ /* AIX XL C 1.02.0.0 rejects this saying
X "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
X struct s { int j; const int *ap[3]; };
X struct s *b; b->j = 5;
X}
X{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
X const int foo = 10;
X}
X
X; return 0; }
XEOF
Xif eval $ac_compile; then
X rm -rf conftest*
X ac_cv_c_const=yes
Xelse
X rm -rf conftest*
X ac_cv_c_const=no
Xfi
Xrm -f conftest*
X
Xfi
Xecho "$ac_t""$ac_cv_c_const" 1>&6
Xif test $ac_cv_c_const = no; then
X cat >> confdefs.h <<\EOF
X#define const
XEOF
X
Xfi
X
Xfor ac_prog in tdlint lint alint
Xdo
X# Extract the first word of "$ac_prog", so it can be a program name with args.
Xset dummy $ac_prog; ac_word=$2
Xecho $ac_n "checking for $ac_word""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_prog_LINT'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X if test -n "$LINT"; then
X ac_cv_prog_LINT="$LINT" # Let the user override the test.
Xelse
X IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
X for ac_dir in $PATH; do
X test -z "$ac_dir" && ac_dir=.
X if test -f $ac_dir/$ac_word; then
X ac_cv_prog_LINT="$ac_prog"
X break
X fi
X done
X IFS="$ac_save_ifs"
Xfi
Xfi
XLINT="$ac_cv_prog_LINT"
Xif test -n "$LINT"; then
X echo "$ac_t""$LINT" 1>&6
Xelse
X echo "$ac_t""no" 1>&6
Xfi
X
Xtest -n "$LINT" && break
Xdone
X
X
X
X
X
X
X
Xecho $ac_n "checking for working const""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.$ac_ext <<EOF
X#line 679 "configure"
X#include "confdefs.h"
X
Xint main() { return 0; }
Xint t() {
X
X/* Ultrix mips cc rejects this. */
Xtypedef int charset[2]; const charset x;
X/* SunOS 4.1.1 cc rejects this. */
Xchar const *const *ccp;
Xchar **p;
X/* NEC SVR4.0.2 mips cc rejects this. */
Xstruct point {int x, y;};
Xstatic struct point const zero;
X/* AIX XL C 1.02.0.0 rejects this.
X It does not let you subtract one const X* pointer from another in an arm
X of an if-expression whose if-part is not a constant expression */
Xconst char *g = "string";
Xccp = &g + (g ? g-g : 0);
X/* HPUX 7.0 cc rejects these. */
X++ccp;
Xp = (char**) ccp;
Xccp = (char const *const *) p;
X{ /* SCO 3.2v4 cc rejects this. */
X char *t;
X char const *s = 0 ? (char *) 0 : (char const *) 0;
X
X *t++ = 0;
X}
X{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
X int x[] = {25, 17};
X const int *foo = &x[0];
X ++foo;
X}
X{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
X typedef const int *iptr;
X iptr p = 0;
X ++p;
X}
X{ /* AIX XL C 1.02.0.0 rejects this saying
X "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
X struct s { int j; const int *ap[3]; };
X struct s *b; b->j = 5;
X}
X{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
X const int foo = 10;
X}
X
X; return 0; }
XEOF
Xif eval $ac_compile; then
X rm -rf conftest*
X ac_cv_c_const=yes
Xelse
X rm -rf conftest*
X ac_cv_c_const=no
Xfi
Xrm -f conftest*
X
Xfi
Xecho "$ac_t""$ac_cv_c_const" 1>&6
Xif test $ac_cv_c_const = no; then
X cat >> confdefs.h <<\EOF
X#define const
XEOF
X
Xfi
X
Xecho $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
X# On Suns, sometimes $CPP names a directory.
Xif test -n "$CPP" && test -d "$CPP"; then
X CPP=
Xfi
Xif test -z "$CPP"; then
Xif eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X # This must be in double quotes, not single quotes, because CPP may get
X # substituted into the Makefile and "${CC-cc}" will confuse make.
X CPP="${CC-cc} -E"
X # On the NeXT, cc -E runs the code through the compiler's parser,
X # not just through cpp.
X cat > conftest.$ac_ext <<EOF
X#line 762 "configure"
X#include "confdefs.h"
X#include <assert.h>
XSyntax Error
XEOF
Xeval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
Xac_err=`grep -v '^ *+' conftest.out`
Xif test -z "$ac_err"; then
X :
Xelse
X echo "$ac_err" >&5
X rm -rf conftest*
X CPP="${CC-cc} -E -traditional-cpp"
X cat > conftest.$ac_ext <<EOF
X#line 776 "configure"
X#include "confdefs.h"
X#include <assert.h>
XSyntax Error
XEOF
Xeval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
Xac_err=`grep -v '^ *+' conftest.out`
Xif test -z "$ac_err"; then
X :
Xelse
X echo "$ac_err" >&5
X rm -rf conftest*
X CPP=/lib/cpp
Xfi
Xrm -f conftest*
Xfi
Xrm -f conftest*
X ac_cv_prog_CPP="$CPP"
Xfi
Xfi
XCPP="$ac_cv_prog_CPP"
Xecho "$ac_t""$CPP" 1>&6
X
X# If we cannot run a trivial program, we must be cross compiling.
Xecho $ac_n "checking whether cross-compiling""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X if test "$cross_compiling" = yes; then
X ac_cv_c_cross=yes
Xelse
Xcat > conftest.$ac_ext <<EOF
X#line 808 "configure"
X#include "confdefs.h"
Xmain(){return(0);}
XEOF
Xeval $ac_link
Xif test -s conftest && (./conftest; exit) 2>/dev/null; then
X ac_cv_c_cross=no
Xelse
X ac_cv_c_cross=yes
Xfi
Xfi
Xrm -fr conftest*
Xfi
Xcross_compiling=$ac_cv_c_cross
Xecho "$ac_t""$ac_cv_c_cross" 1>&6
X
Xecho $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.$ac_ext <<EOF
X#line 829 "configure"
X#include "confdefs.h"
X#include <stdlib.h>
X#include <stdarg.h>
X#include <string.h>
X#include <float.h>
XEOF
Xeval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
Xac_err=`grep -v '^ *+' conftest.out`
Xif test -z "$ac_err"; then
X rm -rf conftest*
X ac_cv_header_stdc=yes
Xelse
X echo "$ac_err" >&5
X rm -rf conftest*
X ac_cv_header_stdc=no
Xfi
Xrm -f conftest*
X
Xif test $ac_cv_header_stdc = yes; then
X # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
Xcat > conftest.$ac_ext <<EOF
X#line 851 "configure"
X#include "confdefs.h"
X#include <string.h>
XEOF
Xif (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
X egrep "memchr" >/dev/null 2>&1; then
X :
Xelse
X rm -rf conftest*
X ac_cv_header_stdc=no
Xfi
Xrm -f conftest*
X
Xfi
X
Xif test $ac_cv_header_stdc = yes; then
X # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
Xcat > conftest.$ac_ext <<EOF
X#line 869 "configure"
X#include "confdefs.h"
X#include <stdlib.h>
XEOF
Xif (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
X egrep "free" >/dev/null 2>&1; then
X :
Xelse
X rm -rf conftest*
X ac_cv_header_stdc=no
Xfi
Xrm -f conftest*
X
Xfi
X
Xif test $ac_cv_header_stdc = yes; then
X # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
Xif test "$cross_compiling" = yes; then
X ac_cv_header_stdc=no
Xelse
Xcat > conftest.$ac_ext <<EOF
X#line 890 "configure"
X#include "confdefs.h"
X#include <ctype.h>
X#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
X#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
X#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
Xint main () { int i; for (i = 0; i < 256; i++)
Xif (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
Xexit (0); }
X
XEOF
Xeval $ac_link
Xif test -s conftest && (./conftest; exit) 2>/dev/null; then
X :
Xelse
X ac_cv_header_stdc=no
Xfi
Xfi
Xrm -fr conftest*
Xfi
Xfi
Xecho "$ac_t""$ac_cv_header_stdc" 1>&6
Xif test $ac_cv_header_stdc = yes; then
X cat >> confdefs.h <<\EOF
X#define STDC_HEADERS 1
XEOF
X
Xfi
X
Xfor ac_hdr in stdlib.h unistd.h
Xdo
Xac_safe=`echo "$ac_hdr" | tr './\055' '___'`
Xecho $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.$ac_ext <<EOF
X#line 927 "configure"
X#include "confdefs.h"
X#include <$ac_hdr>
XEOF
Xeval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
Xac_err=`grep -v '^ *+' conftest.out`
Xif test -z "$ac_err"; then
X rm -rf conftest*
X eval "ac_cv_header_$ac_safe=yes"
Xelse
X echo "$ac_err" >&5
X rm -rf conftest*
X eval "ac_cv_header_$ac_safe=no"
Xfi
Xrm -f conftest*
Xfi
Xif eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
X echo "$ac_t""yes" 1>&6
X ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
X cat >> confdefs.h <<EOF
X#define $ac_tr_hdr 1
XEOF
X
Xelse
X echo "$ac_t""no" 1>&6
Xfi
Xdone
X
Xfor ac_hdr in getopt.h string.h malloc.h sys/param.h
Xdo
Xac_safe=`echo "$ac_hdr" | tr './\055' '___'`
Xecho $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.$ac_ext <<EOF
X#line 963 "configure"
X#include "confdefs.h"
X#include <$ac_hdr>
XEOF
Xeval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
Xac_err=`grep -v '^ *+' conftest.out`
Xif test -z "$ac_err"; then
X rm -rf conftest*
X eval "ac_cv_header_$ac_safe=yes"
Xelse
X echo "$ac_err" >&5
X rm -rf conftest*
X eval "ac_cv_header_$ac_safe=no"
Xfi
Xrm -f conftest*
Xfi
Xif eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
X echo "$ac_t""yes" 1>&6
X ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
X cat >> confdefs.h <<EOF
X#define $ac_tr_hdr 1
XEOF
X
Xelse
X echo "$ac_t""no" 1>&6
Xfi
Xdone
X
Xac_header_dirent=no
Xfor ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
Xdo
Xac_safe=`echo "$ac_hdr" | tr './\055' '___'`
Xecho $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.$ac_ext <<EOF
X#line 1000 "configure"
X#include "confdefs.h"
X#include <sys/types.h>
X#include <$ac_hdr>
Xint main() { return 0; }
Xint t() {
XDIR *dirp = 0;
X; return 0; }
XEOF
Xif eval $ac_compile; then
X rm -rf conftest*
X eval "ac_cv_header_dirent_$ac_safe=yes"
Xelse
X rm -rf conftest*
X eval "ac_cv_header_dirent_$ac_safe=no"
Xfi
Xrm -f conftest*
X
Xfi
Xif eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
X echo "$ac_t""yes" 1>&6
X ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
X cat >> confdefs.h <<EOF
X#define $ac_tr_hdr 1
XEOF
X ac_header_dirent=$ac_hdr; break
Xelse
X echo "$ac_t""no" 1>&6
Xfi
Xdone
X# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
Xif test $ac_header_dirent = dirent.h; then
Xecho $ac_n "checking for -ldir""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_lib_dir'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X ac_save_LIBS="$LIBS"
XLIBS="-ldir $LIBS"
Xcat > conftest.$ac_ext <<EOF
X#line 1039 "configure"
X#include "confdefs.h"
X
Xint main() { return 0; }
Xint t() {
Xopendir()
X; return 0; }
XEOF
Xif eval $ac_link; then
X rm -rf conftest*
X eval "ac_cv_lib_dir=yes"
Xelse
X rm -rf conftest*
X eval "ac_cv_lib_dir=no"
Xfi
Xrm -f conftest*
XLIBS="$ac_save_LIBS"
X
Xfi
Xif eval "test \"`echo '$ac_cv_lib_'dir`\" = yes"; then
X echo "$ac_t""yes" 1>&6
X LIBS="$LIBS -ldir"
Xelse
X echo "$ac_t""no" 1>&6
Xfi
X
Xelse
Xecho $ac_n "checking for -lx""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_lib_x'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X ac_save_LIBS="$LIBS"
XLIBS="-lx $LIBS"
Xcat > conftest.$ac_ext <<EOF
X#line 1073 "configure"
X#include "confdefs.h"
X
Xint main() { return 0; }
Xint t() {
Xopendir()
X; return 0; }
XEOF
Xif eval $ac_link; then
X rm -rf conftest*
X eval "ac_cv_lib_x=yes"
Xelse
X rm -rf conftest*
X eval "ac_cv_lib_x=no"
Xfi
Xrm -f conftest*
XLIBS="$ac_save_LIBS"
X
Xfi
Xif eval "test \"`echo '$ac_cv_lib_'x`\" = yes"; then
X echo "$ac_t""yes" 1>&6
X LIBS="$LIBS -lx"
Xelse
X echo "$ac_t""no" 1>&6
Xfi
X
Xfi
X
X
Xecho $ac_n "checking for size_t""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.$ac_ext <<EOF
X#line 1107 "configure"
X#include "confdefs.h"
X#include <sys/types.h>
X#if STDC_HEADERS
X#include <stdlib.h>
X#endif
XEOF
Xif (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
X egrep "size_t" >/dev/null 2>&1; then
X rm -rf conftest*
X ac_cv_type_size_t=yes
Xelse
X rm -rf conftest*
X ac_cv_type_size_t=no
Xfi
Xrm -f conftest*
X
Xfi
Xecho "$ac_t""$ac_cv_type_size_t" 1>&6
Xif test $ac_cv_type_size_t = no; then
X cat >> confdefs.h <<\EOF
X#define size_t unsigned
XEOF
X
Xfi
X
Xecho $ac_n "checking for ino_t""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_type_ino_t'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.$ac_ext <<EOF
X#line 1138 "configure"
X#include "confdefs.h"
X#include <sys/types.h>
X#if STDC_HEADERS
X#include <stdlib.h>
X#endif
XEOF
Xif (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
X egrep "ino_t" >/dev/null 2>&1; then
X rm -rf conftest*
X ac_cv_type_ino_t=yes
Xelse
X rm -rf conftest*
X ac_cv_type_ino_t=no
Xfi
Xrm -f conftest*
X
Xfi
Xecho "$ac_t""$ac_cv_type_ino_t" 1>&6
Xif test $ac_cv_type_ino_t = no; then
X cat >> confdefs.h <<\EOF
X#define ino_t unsigned
XEOF
X
Xfi
X
Xecho $ac_n "checking for dev_t""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_type_dev_t'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.$ac_ext <<EOF
X#line 1169 "configure"
X#include "confdefs.h"
X#include <sys/types.h>
X#if STDC_HEADERS
X#include <stdlib.h>
X#endif
XEOF
Xif (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
X egrep "dev_t" >/dev/null 2>&1; then
X rm -rf conftest*
X ac_cv_type_dev_t=yes
Xelse
X rm -rf conftest*
X ac_cv_type_dev_t=no
Xfi
Xrm -f conftest*
X
Xfi
Xecho "$ac_t""$ac_cv_type_dev_t" 1>&6
Xif test $ac_cv_type_dev_t = no; then
X cat >> confdefs.h <<\EOF
X#define dev_t unsigned
XEOF
X
Xfi
X
X
Xfor ac_func in getcwd getopt link symlink realpath strrchr strdup
Xdo
Xecho $ac_n "checking for $ac_func""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.$ac_ext <<EOF
X#line 1203 "configure"
X#include "confdefs.h"
X/* System header to define __stub macros and hopefully few prototypes,
X which can conflict with char $ac_func(); below. */
X#include <assert.h>
X/* Override any gcc2 internal prototype to avoid an error. */
Xchar $ac_func();
X
Xint main() { return 0; }
Xint t() {
X
X/* The GNU C library defines this for functions which it implements
X to always fail with ENOSYS. Some functions are actually named
X something starting with __ and the normal name is an alias. */
X#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
Xchoke me
X#else
X$ac_func();
X#endif
X
X; return 0; }
XEOF
Xif eval $ac_link; then
X rm -rf conftest*
X eval "ac_cv_func_$ac_func=yes"
Xelse
X rm -rf conftest*
X eval "ac_cv_func_$ac_func=no"
Xfi
Xrm -f conftest*
X
Xfi
Xif eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
X echo "$ac_t""yes" 1>&6
X ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'`
X cat >> confdefs.h <<EOF
X#define $ac_tr_func 1
XEOF
X
Xelse
X echo "$ac_t""no" 1>&6
Xfi
Xdone
X
X
X# Check whether --with-warnings or --without-warnings was given.
Xwithval="$with_warnings"
Xif test -n "$withval"; then
X
Xif test -n "$GCC"
Xthen
XCFLAGS='-O -Wall -Wshadow -Wconversion -Wstrict-prototypes -Wmissing-prototypes'
Xfi
X
Xfi
X
X
X# Check whether --with-dbmalloc or --without-dbmalloc was given.
Xwithval="$with_dbmalloc"
Xif test -n "$withval"; then
X
Xac_safe=`echo "dbmalloc.h" | tr './\055' '___'`
Xecho $ac_n "checking for dbmalloc.h""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X cat > conftest.$ac_ext <<EOF
X#line 1270 "configure"
X#include "confdefs.h"
X#include <dbmalloc.h>
XEOF
Xeval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
Xac_err=`grep -v '^ *+' conftest.out`
Xif test -z "$ac_err"; then
X rm -rf conftest*
X eval "ac_cv_header_$ac_safe=yes"
Xelse
X echo "$ac_err" >&5
X rm -rf conftest*
X eval "ac_cv_header_$ac_safe=no"
Xfi
Xrm -f conftest*
Xfi
Xif eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
X echo "$ac_t""yes" 1>&6
X
Xecho $ac_n "checking for -ldbmalloc""... $ac_c" 1>&6
Xif eval "test \"`echo '$''{'ac_cv_lib_dbmalloc'+set}'`\" = set"; then
X echo $ac_n "(cached) $ac_c" 1>&6
Xelse
X ac_save_LIBS="$LIBS"
XLIBS="-ldbmalloc $LIBS"
Xcat > conftest.$ac_ext <<EOF
X#line 1296 "configure"
X#include "confdefs.h"
X
Xint main() { return 0; }
Xint t() {
Xdbmallopt()
X; return 0; }
XEOF
Xif eval $ac_link; then
X rm -rf conftest*
X eval "ac_cv_lib_dbmalloc=yes"
Xelse
X rm -rf conftest*
X eval "ac_cv_lib_dbmalloc=no"
Xfi
Xrm -f conftest*
XLIBS="$ac_save_LIBS"
X
Xfi
Xif eval "test \"`echo '$ac_cv_lib_'dbmalloc`\" = yes"; then
X echo "$ac_t""yes" 1>&6
X
Xcat >> confdefs.h <<\EOF
X#define HAVE_DBMALLOC_H 1
XEOF
X
XLIBS="$LIBS -ldbmalloc"
Xelse
X echo "$ac_t""no" 1>&6
Xfi
X
Xelse
X echo "$ac_t""no" 1>&6
Xfi
X
X
Xfi
X
X
X### output makefile and config.h
Xtrap '' 1 2 15
Xcat > confcache <<\EOF
X# This file is a shell script that caches the results of configure
X# tests run on this system so they can be shared between configure
X# scripts and configure runs. It is not useful on other systems.
X# If it contains results you don't want to keep, you may remove or edit it.
X#
X# By default, configure uses ./config.cache as the cache file,
X# creating it if it does not exist already. You can give configure
X# the --cache-file=FILE option to use a different cache file; that is
X# what configure does when it calls configure scripts in
X# subdirectories, so they share the cache.
X# Giving --cache-file=/dev/null disables caching, for debugging configure.
X# config.status only pays attention to the cache file if you give it the
X# --recheck option to rerun configure.
X#
XEOF
X# Ultrix sh set writes to stderr and can't be redirected directly,
X# and sets the high bit in the cache file unless we assign to the vars.
X(set) 2>&1 |
X sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \
X >> confcache
Xif cmp -s $cache_file confcache; then
X :
Xelse
X if test -w $cache_file; then
X echo "updating cache $cache_file"
X cat confcache > $cache_file
X else
X echo "not updating unwritable cache $cache_file"
X fi
Xfi
Xrm -f confcache
X
Xtrap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
X
Xtest "x$prefix" = xNONE && prefix=$ac_default_prefix
X# Let make expand exec_prefix.
Xtest "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
X
X# Any assignment to VPATH causes Sun make to only execute
X# the first set of double-colon rules, so remove it if not needed.
X# If there is a colon in the path, we need to keep it.
Xif test "x$srcdir" = x.; then
X ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
Xfi
X
Xtrap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
X
X# Transform confdefs.h into DEFS.
X# Protect against shell expansion while executing Makefile rules.
X# Protect against Makefile macro expansion.
Xcat > conftest.defs <<\EOF
Xs%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g
Xs%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
Xs%\[%\\&%g
Xs%\]%\\&%g
Xs%\$%$$%g
XEOF
XDEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
Xrm -f conftest.defs
X
X
X# Without the "./", some shells look in PATH for config.status.
X: ${CONFIG_STATUS=./config.status}
X
Xecho creating $CONFIG_STATUS
Xrm -f $CONFIG_STATUS
Xcat > $CONFIG_STATUS <<EOF
X#! /bin/sh
X# Generated automatically by configure.
X# Run this file to recreate the current configuration.
X# This directory was configured as follows,
X# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
X#
X# $0 $ac_configure_args
X#
X# Compiler output produced by configure, useful for debugging
X# configure, is in ./config.log if it exists.
X
Xac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
Xfor ac_option
Xdo
X case "\$ac_option" in
X -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
X echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
X exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
X -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
X echo "$CONFIG_STATUS generated by autoconf version 2.2"
X exit 0 ;;
X -help | --help | --hel | --he | --h)
X echo "\$ac_cs_usage"; exit 0 ;;
X *) echo "\$ac_cs_usage"; exit 1 ;;
X esac
Xdone
X
Xac_given_srcdir=$srcdir
Xac_given_INSTALL="$INSTALL"
X
Xtrap 'rm -f makefile config_h; exit 1' 1 2 15
X
X# Protect against being on the right side of a sed subst in config.status.
Xsed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g;
X s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
X$ac_vpsub
X$extrasub
Xs%@CFLAGS@%$CFLAGS%g
Xs%@CPPFLAGS@%$CPPFLAGS%g
Xs%@CXXFLAGS@%$CXXFLAGS%g
Xs%@DEFS@%$DEFS%g
Xs%@LDFLAGS@%$LDFLAGS%g
Xs%@LIBS@%$LIBS%g
Xs%@exec_prefix@%$exec_prefix%g
Xs%@prefix@%$prefix%g
Xs%@program_transform_name@%$program_transform_name%g
Xs%@CC@%$CC%g
Xs%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
Xs%@INSTALL_DATA@%$INSTALL_DATA%g
Xs%@LINT@%$LINT%g
Xs%@CPP@%$CPP%g
X
XCEOF
XEOF
Xcat >> $CONFIG_STATUS <<EOF
X
XCONFIG_FILES=\${CONFIG_FILES-"makefile config_h"}
XEOF
Xcat >> $CONFIG_STATUS <<\EOF
Xfor ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
X # Support "outfile[:infile]", defaulting infile="outfile.in".
X case "$ac_file" in
X *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
X ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
X *) ac_file_in="${ac_file}.in" ;;
X esac
X
X # Adjust relative srcdir, etc. for subdirectories.
X
X # Remove last slash and all that follows it. Not all systems have dirname.
X ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
X if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
X # The file is in a subdirectory.
X test ! -d "$ac_dir" && mkdir "$ac_dir"
X ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
X # A "../" for each directory in $ac_dir_suffix.
X ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
X else
X ac_dir_suffix= ac_dots=
X fi
X
X case "$ac_given_srcdir" in
X .) srcdir=.
X if test -z "$ac_dots"; then top_srcdir=.
X else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
X /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
X *) # Relative path.
X srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
X top_srcdir="$ac_dots$ac_given_srcdir" ;;
X esac
X
X case "$ac_given_INSTALL" in
X [/$]*) INSTALL="$ac_given_INSTALL" ;;
X *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
X esac
X echo creating "$ac_file"
X rm -f "$ac_file"
X configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
X case "$ac_file" in
X *Makefile*) ac_comsub="1i\\
X# $configure_input" ;;
X *) ac_comsub= ;;
X esac
X sed -e "$ac_comsub
Xs%@configure_input@%$configure_input%g
Xs%@srcdir@%$srcdir%g
Xs%@top_srcdir@%$top_srcdir%g
Xs%@INSTALL@%$INSTALL%g
X" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
Xfi; done
Xrm -f conftest.subs
X
X
X
Xecho creating config.h
Xsed -e '/^# /d' \
X -e 's/ -D/\
X#define /g' \
X -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \
X config_h >config.h
X
Xecho removing config_h
Xrm config_h
X
Xexit 0
XEOF
Xchmod +x $CONFIG_STATUS
Xrm -fr confdefs* $ac_clean_files
Xtest "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
X
END_OF_FILE
if test 41850 -ne `wc -c <'conflict-6.0/configure'`; then
echo shar: \"'conflict-6.0/configure'\" unpacked with wrong size!
fi
chmod +x 'conflict-6.0/configure'
# end of 'conflict-6.0/configure'
fi
if test -f 'conflict-6.0/conflict.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/conflict.h'\"
else
echo shar: Extracting \"'conflict-6.0/conflict.h'\" \(6349 characters\)
sed "s/^X//" >'conflict-6.0/conflict.h' <<'END_OF_FILE'
X/* $Id: conflict.h,v 6.0 1995/03/18 14:00:34 dickey Rel $
X *
X * Common/configurable definitions and types for 'conflict'.
X */
X
X#ifndef HAVE_CONFIG_H
X# define HAVE_CONFIG_H 0 /* Watcom's cpp isn't ANSI... */
X#endif
X
X#if HAVE_CONFIG_H
X#include "config.h"
X#else
X# define HAVE_LINK 0
X# define HAVE_REALPATH 0
X# define HAVE_SYMLINK 0
X# define HAVE_SYS_PARAM_H 0 /* only on real computers */
X# ifdef __TURBOC__
X# define SYS_MSDOS 1
X# define HAVE_STDLIB_H 1
X# define HAVE_DIRENT_H 1
X# define HAVE_STRING_H 1
X# define HAVE_GETCWD 1
X# define HAVE_STRRCHR 1
X# define HAVE_STRDUP 1
X# define ino_t short
X# define dev_t short
X# include <dir.h> /* ...to get MAXPATH */
X# include <io.h> /* ...to get isatty */
X# if defined(MAXPATH) && !defined(MAXPATHLEN)
X# define MAXPATHLEN MAXPATH
X# endif
X# endif
X# ifdef __WATCOMC__
X# define HAVE_STDLIB_H 1
X# define HAVE_UNISTD_H 1
X# define HAVE_MALLOC_H 1
X# define HAVE_DIRECT_H 1
X# define HAVE_STRING_H 1
X# define HAVE_GETCWD 1
X# define HAVE_STRRCHR 1
X# define HAVE_STRDUP 1
X/*# ifdef __MSDOS__*/
X/*# define SYS_MSDOS 1*/
X/*# endif*/
X# ifdef __OS2__
X# include <os2/os2.h>
X# define SYS_OS2 1
X# define MAXPATHLEN CCHMAXPATH /* in <os2/bsedos.h> */
X# endif
X# endif
X#endif
X
X/* Some compilers (e.g., Watcom 10.0a) don't treat conditionals properly
X * for undefined tokens.
X */
X#ifndef HAVE_DBMALLOC_H
X#define HAVE_DBMALLOC_H 0
X#endif
X
X#ifndef HAVE_DIRENT_H
X#define HAVE_DIRENT_H 0
X#endif
X
X#ifndef HAVE_GETOPT_H
X#define HAVE_GETOPT_H 0
X#endif
X
X#ifndef HAVE_STDLIB_H
X#define HAVE_STDLIB_H 0
X#endif
X
X#ifndef NO_LEAKS
X#define NO_LEAKS HAVE_DBMALLOC_H
X#endif
X
X#ifndef STDC_HEADERS
X#define STDC_HEADERS 0
X#endif
X
X#ifndef SYS_MSDOS
X#define SYS_MSDOS 0
X#endif
X
X#ifndef SYS_OS2
X#define SYS_OS2 0
X#endif
X
X#ifndef SYS_UNIX
X#define SYS_UNIX !(SYS_MSDOS || SYS_OS2)
X#endif
X
X/*
X * Include the stuff that's needed for our configuration.
X */
X#include <stdio.h>
X
X#if HAVE_STDLIB_H
X# include <stdlib.h>
X#endif
X
X#if HAVE_UNISTD_H
X# include <unistd.h>
X#endif
X
X#if STDC_HEADERS
X# include <string.h>
X#else
X# if HAVE_STRING_H
X# include <string.h>
X# ifndef HAVE_STRRCHR
X# define strrchr rindex
X# endif
X# endif
X# if HAVE_MALLOC_H
X# include <malloc.h>
X# endif
X#endif
X
X#include <sys/types.h>
X#include <sys/stat.h>
X
X#if HAVE_SYS_PARAM_H
X#include <sys/param.h>
X#endif
X
X#if HAVE_DIRENT_H
X# include <dirent.h>
X# define NAMLEN(dirent) strlen((dirent)->d_name)
X#else
X# define dirent direct
X# if HAVE_DIRECT_H
X# include <direct.h>
X# define NAMLEN(dirent) strlen((dirent)->d_name) /* Watcom OS/2 */
X# else
X# define NAMLEN(dirent) (dirent)->d_namlen
X# if HAVE_SYS_NDIR_H
X# include <sys/ndir.h>
X# endif
X# if HAVE_SYS_DIR_H
X# include <sys/dir.h>
X# endif
X# if HAVE_NDIR_H
X# include <ndir.h>
X# endif
X# endif
X#endif
X
X#if HAVE_GETOPT_H
X#include <getopt.h>
X#else
Xextern int getopt();
Xextern int optind;
Xextern char *optarg;
X#endif
X
X#if HAVE_GETCWD
X#define getwd(buffer) getcwd(buffer, sizeof(buffer))
X#endif
X
X#ifdef lint
X#define TypeRealloc(type,p,n) (type *)((p)+(n))
X#define TypeAlloc(type,n) (type *)(n)
X#define TypeAllocN(type,n) (type *)(n)
X#else
X#define TypeRealloc(type,p,n) (type *)realloc(p,(n)*sizeof(type))
X#define TypeAlloc(type,n) (type *)calloc(sizeof(type),n)
X#define TypeAllocN(type,n) (type *)calloc(sizeof(type)+n,1)
X#endif
X
X#undef SIZEOF
X#define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
X
X#ifndef TRUE
X#define TRUE 1
X#endif
X
X#ifndef FALSE
X#define FALSE 0
X#endif
X
X#define EOS '\0'
X
X#ifndef R_OK
X#define R_OK 1
X#define W_OK 2
X#define X_OK 4
X#endif
X
X#ifndef EXIT_SUCCESS
X#define EXIT_SUCCESS 0
X#define EXIT_FAILURE 1
X#endif
X
X#if __STDC__ || defined(__TURBOC__)
X#define ARGS(p) p
X#else
X#define ARGS(p) ()
X#endif
X
X#if SYS_MSDOS || SYS_OS2
X# define PATHNAME_SEP '\\'
X# define PATHLIST_SEP ';'
X#else
X# define PATHNAME_SEP '/'
X# define PATHLIST_SEP ':'
X#endif
X
Xtypedef unsigned type_t;
X
X/*
X * If files can be linked together, it's simplest to 'stat()' them to determine
X * if they're identical. Otherwise, we've got to expand the pathnames to
X * determine if they're the same place.
X */
X#if HAVE_LINK || HAVE_SYMLINK
X#define USE_INODE 1
X
X#define SAME_NODE(j,k) (ip->node[j].device == ip->node[k].device\
X && ip->node[j].inode == ip->node[k].inode)
X#define SAME_DIRS(j,k) (dirs[j].device == dirs[k].device\
X && dirs[j].inode == dirs[k].inode)
X
Xtypedef struct {
X type_t flags;
X dev_t device;
X ino_t inode;
X } NODE;
X
Xtypedef struct {
X char *name;
X dev_t device;
X ino_t inode;
X } DIRS;
X
X#else /* e.g., MSDOS */
X#define USE_INODE 0
X
X#define SAME_NODE(j,k) (j == k)
X#define SAME_DIRS(j,k) SameString(dirs[j].actual, dirs[k].actual)
X
Xtypedef struct {
X type_t flags;
X } NODE;
X
Xtypedef struct {
X char *name;
X char *actual;
X } DIRS;
X
X#endif
X
X#define NODEFLAGS(j) ip->node[j].flags
X#define IS_A_NODE(j) (NODEFLAGS(j) != 0)
X
Xtypedef struct {
X char *name; /* name of executable file */
X NODE *node; /* stat-result, for comparing */
X } INPATH;
X
X/*
X * Prototypes for functions defined in this program:
X */
Xextern int main ARGS((int argc, char *argv[]));
Xextern void failed ARGS((char *s));
Xextern char *fleaf ARGS((char *name));
Xextern char *ftype ARGS((char *name));
Xextern void blip ARGS((int c));
X
X/* MSDOS and OS/2 need a wrapper for 'chdir()' to also switch drives */
X#if SYS_MSDOS || SYS_OS2
Xextern int have_drive ARGS((char *name));
Xextern int same_drive ARGS((char *a, char *b));
Xextern int set_drive ARGS((char *name));
Xextern int set_directory ARGS((char *name));
X#else
X#define set_directory(path) (chdir(path) >= 0)
X#endif
X
X#define USE_TXTALLOC 1
X#if USE_TXTALLOC
Xextern char *txtalloc ARGS((char *s));
Xextern void free_txtalloc ARGS((void));
X
X# define MakeString(a) txtalloc(a)
X# define SameString(a,b) ((a) == (b)) /* txtalloc vs strcmp... */
X# define FreeString(a) /* ...actually we don't */
X#else
X# define MakeString(a) strdup(a)
X# define SameString(a,b) !strcmp(a,b)
X# define FreeString(a) free(a)
X#endif
X
X/*
X * Prototypes for functions that may be defined in this program (if the target
X * system doesn't have an equivalent):
X */
X#if !USE_INODE && !HAVE_REALPATH
X# define realpath my_realpath
Xchar *my_realpath ARGS((char *given, char *actual));
X#endif
X
X#if !HAVE_STRDUP
X# define strdup my_strdup
Xchar *my_strdup ARGS((char *s));
X#endif
X
X/*
X * Definitions for testing/debugging this program:
X */
X#if HAVE_DBMALLOC_H
X# include <dbmalloc.h>
X#endif
END_OF_FILE
if test 6349 -ne `wc -c <'conflict-6.0/conflict.h'`; then
echo shar: \"'conflict-6.0/conflict.h'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/conflict.h'
fi
if test -f 'conflict-6.0/install.sh' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/install.sh'\"
else
echo shar: Extracting \"'conflict-6.0/install.sh'\" \(4771 characters\)
sed "s/^X//" >'conflict-6.0/install.sh' <<'END_OF_FILE'
X#!/bin/sh
X#
X# install - install a program, script, or datafile
X# This comes from X11R5.
X#
X# Calling this script install-sh is preferred over install.sh, to prevent
X# `make' implicit rules from creating a file called install from it
X# when there is no Makefile.
X#
X# This script is compatible with the BSD install script, but was written
X# from scratch.
X#
X
X
X# set DOITPROG to echo to test this script
X
X# Don't use :- since 4.3BSD and earlier shells don't like it.
Xdoit="${DOITPROG-}"
X
X
X# put in absolute paths if you don't have them in your path; or use env. vars.
X
Xmvprog="${MVPROG-mv}"
Xcpprog="${CPPROG-cp}"
Xchmodprog="${CHMODPROG-chmod}"
Xchownprog="${CHOWNPROG-chown}"
Xchgrpprog="${CHGRPPROG-chgrp}"
Xstripprog="${STRIPPROG-strip}"
Xrmprog="${RMPROG-rm}"
Xmkdirprog="${MKDIRPROG-mkdir}"
X
Xtranformbasename=""
Xtransform_arg=""
Xinstcmd="$mvprog"
Xchmodcmd="$chmodprog 0755"
Xchowncmd=""
Xchgrpcmd=""
Xstripcmd=""
Xrmcmd="$rmprog -f"
Xmvcmd="$mvprog"
Xsrc=""
Xdst=""
Xdir_arg=""
X
Xwhile [ x"$1" != x ]; do
X case $1 in
X -c) instcmd="$cpprog"
X shift
X continue;;
X
X -d) dir_arg=true
X shift
X continue;;
X
X -m) chmodcmd="$chmodprog $2"
X shift
X shift
X continue;;
X
X -o) chowncmd="$chownprog $2"
X shift
X shift
X continue;;
X
X -g) chgrpcmd="$chgrpprog $2"
X shift
X shift
X continue;;
X
X -s) stripcmd="$stripprog"
X shift
X continue;;
X
X -t=*) transformarg=`echo $1 | sed 's/-t=//'`
X shift
X continue;;
X
X -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
X shift
X continue;;
X
X *) if [ x"$src" = x ]
X then
X src=$1
X else
X # this colon is to work around a 386BSD /bin/sh bug
X :
X dst=$1
X fi
X shift
X continue;;
X esac
Xdone
X
Xif [ x"$src" = x ]
Xthen
X echo "install: no input file specified"
X exit 1
Xelse
X true
Xfi
X
Xif [ x"$dir_arg" != x ]; then
X dst=$src
X src=""
X
X if [ -d $dst ]; then
X instcmd=:
X else
X instcmd=mkdir
X fi
Xelse
X
X# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
X# might cause directories to be created, which would be especially bad
X# if $src (and thus $dsttmp) contains '*'.
X
X if [ -f $src -o -d $src ]
X then
X true
X else
X echo "install: $src does not exist"
X exit 1
X fi
X
X if [ x"$dst" = x ]
X then
X echo "install: no destination specified"
X exit 1
X else
X true
X fi
X
X# If destination is a directory, append the input filename; if your system
X# does not like double slashes in filenames, you may need to add some logic
X
X if [ -d $dst ]
X then
X dst="$dst"/`basename $src`
X else
X true
X fi
Xfi
X
X## this sed command emulates the dirname command
Xdstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
X
X# Make sure that the destination directory exists.
X# this part is taken from Noah Friedman's mkinstalldirs script
X
X# Skip lots of stat calls in the usual case.
Xif [ ! -d "$dstdir" ]; then
XdefaultIFS='
X'
XIFS="${IFS-${defaultIFS}}"
X
XoIFS="${IFS}"
X# Some sh's can't handle IFS=/ for some reason.
XIFS='%'
Xset - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
XIFS="${oIFS}"
X
Xpathcomp=''
X
Xwhile [ $# -ne 0 ] ; do
X pathcomp="${pathcomp}${1}"
X shift
X
X if [ ! -d "${pathcomp}" ] ;
X then
X $mkdirprog "${pathcomp}"
X else
X true
X fi
X
X pathcomp="${pathcomp}/"
Xdone
Xfi
X
Xif [ x"$dir_arg" != x ]
Xthen
X $doit $instcmd $dst &&
X
X if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
X if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
X if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
X if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
Xelse
X
X# If we're going to rename the final executable, determine the name now.
X
X if [ x"$transformarg" = x ]
X then
X dstfile=`basename $dst`
X else
X dstfile=`basename $dst $transformbasename |
X sed $transformarg`$transformbasename
X fi
X
X# don't allow the sed command to completely eliminate the filename
X
X if [ x"$dstfile" = x ]
X then
X dstfile=`basename $dst`
X else
X true
X fi
X
X# Make a temp file name in the proper directory.
X
X dsttmp=$dstdir/#inst.$$#
X
X# Move or copy the file name to the temp name
X
X $doit $instcmd $src $dsttmp &&
X
X trap "rm -f ${dsttmp}" 0 &&
X
X# and set any options; do chmod last to preserve setuid bits
X
X# If any of these fail, we abort the whole thing. If we want to
X# ignore errors from any of these, just make sure not to ignore
X# errors from the above "$doit $instcmd $src $dsttmp" command.
X
X if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
X if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
X if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
X if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
X
X# Now rename the file to the real destination.
X
X $doit $rmcmd -f $dstdir/$dstfile &&
X $doit $mvcmd $dsttmp $dstdir/$dstfile
X
Xfi &&
X
X
Xexit 0
END_OF_FILE
if test 4771 -ne `wc -c <'conflict-6.0/install.sh'`; then
echo shar: \"'conflict-6.0/install.sh'\" unpacked with wrong size!
fi
chmod +x 'conflict-6.0/install.sh'
# end of 'conflict-6.0/install.sh'
fi
if test -f 'conflict-6.0/unix.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/unix.c'\"
else
echo shar: Extracting \"'conflict-6.0/unix.c'\" \(2058 characters\)
sed "s/^X//" >'conflict-6.0/unix.c' <<'END_OF_FILE'
X/******************************************************************************
X * Copyright 1995 by Thomas E. Dickey. All Rights Reserved. *
X * *
X * You may freely copy or redistribute this software, so long as there is no *
X * profit made from its use, sale trade or reproduction. You may not change *
X * this copyright notice, and it must be included in any copy made. *
X ******************************************************************************/
X#ifndef NO_IDENT
Xstatic char *Id = "$Id: unix.c,v 6.0 1995/03/15 00:12:22 dickey Rel $";
X#endif
X
X#include "conflict.h"
X
Xvoid blip(c)
X int c;
X{
X static char text[] = "?";
X text[0] = (char)c;
X write(fileno(stderr), text, 1);
X}
X
Xchar * fleaf(name)
X char *name;
X{
X char *leaf = strrchr(name, PATHNAME_SEP);
X if (leaf != 0)
X leaf++;
X else
X leaf = name;
X return leaf;
X}
X
Xchar *
Xftype (name)
X char *name;
X{
X char *leaf = fleaf(name);
X char *type = strrchr(leaf, '.');
X if (type == 0)
X type = leaf + strlen(leaf);
X return type;
X}
X
X#if !USE_INODE && !HAVE_REALPATH
Xchar *my_realpath(given, actual)
X char *given;
X char *actual;
X{
X char current[MAXPATHLEN];
X char *extra = 0;
X char *result = 0;
X
X if (getwd(current) != 0) {
X struct stat sb;
X
X if (stat(strcpy(actual, given), &sb) >= 0) {
X if ((sb.st_mode & S_IFMT) != S_IFDIR) {
X extra = fleaf(given);
X if (extra == given) {
X (void) strcpy(actual, current);
X } else {
X actual[(int)(extra-given)] = EOS;
X }
X }
X if (!strcmp(actual, current)) {
X result = actual;
X } else if (chdir(actual) >= 0) {
X if (getwd(actual) != 0) {
X result = actual;
X }
X (void)chdir(current);
X }
X if (result != 0 && extra != 0) {
X char *s = actual + strlen(actual);
X *s++ = PATHNAME_SEP;
X (void)strcpy(s, extra);
X }
X }
X }
X return result;
X}
X#endif
X
X#if !HAVE_STRDUP
Xchar *my_strdup(s)
X char *s;
X{
X if (s != 0) {
X char *t = malloc(strlen(s)+1);
X if (t != 0) {
X (void)strcpy(t, s);
X }
X s = t;
X }
X return s;
X}
X#endif
END_OF_FILE
if test 2058 -ne `wc -c <'conflict-6.0/unix.c'`; then
echo shar: \"'conflict-6.0/unix.c'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/unix.c'
fi
echo shar: End of archive 1 \(of 2\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked both archives.
rm -f ark[1-9]isdone
else
echo You still must unpack the following archives:
echo " " ${MISSING}
fi
exit 0
exit 0 # Just in case...

T.E.Dickey

unread,
Apr 16, 1995, 3:00:00 AM4/16/95
to
Submitted-by: dic...@clark.net ("T.E.Dickey")
Posting-number: Volume 47, Issue 142
Archive-name: conflict/part02
Environment: UNIX, MSDOS, OS/2

#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".

# Contents: conflict-6.0/CHANGES conflict-6.0/COPYING
# conflict-6.0/MANIFEST conflict-6.0/README conflict-6.0/config_h.in
# conflict-6.0/configure.in conflict-6.0/conflict.1
# conflict-6.0/conflict.c conflict-6.0/conflict.lsm
# conflict-6.0/makefile.in conflict-6.0/mkdirs.sh
# conflict-6.0/msdos.c conflict-6.0/os2.c conflict-6.0/patchlev.h
# conflict-6.0/run_test.sh conflict-6.0/txtalloc.c


# Wrapped by kent@ftp on Sun Apr 16 18:09:28 1995
PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
echo If this archive is complete, you will see the following message:

echo ' "shar: End of archive 2 (of 2)."'
if test -f 'conflict-6.0/CHANGES' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/CHANGES'\"
else
echo shar: Extracting \"'conflict-6.0/CHANGES'\" \(1315 characters\)
sed "s/^X//" >'conflict-6.0/CHANGES' <<'END_OF_FILE'
X$Id: CHANGES,v 6.0 1995/03/18 15:45:45 dickey Rel $
X------------------------------------------------------------------------------
X
X6.0 posted to comp.sources.misc
X---
X
X18 Mar 1995, added -p, -I, -L options. Made -t option work properly on UNIX.
X11 Mar 1995, use 'txtalloc()' to reduce calls on 'strcmp()', making this
X faster.
X07 Mar 1995, absorbed -a, -l options into -v to simplify use for library
X scanning.
X28 Nov 1993, adaptation to MS-DOS.
X22 Sep 1993, gcc-warnings, memory leaks.
X17 Jul 1992, corrected error parsing pathlist.
X22 Oct 1991, converted to ANSI
X21 May 1991, added "-a" option, making default more compact by
X suppressing directories which contain no conflicts
X07 Dec 1989, recoded so that we aren't constrained by the number
X of bits in a long to record information. A side-
X effect of this is that we can show instances of
X files linked (with the same name) to the first
X instance found.
X07 Dec 1989, added "-w" option, enhanced usage-message.
X Corrected bug which caused wrong behavior when
X options were given w/o names of files-to-find.
X25 Jul 1989, moved the code which lists the pathnames down past
X the point at which we have eliminated redundant
X paths, to avoid a confusing display.
X25 Jan 1989, corrected array-index variable
X11 Aug 1988, port to apollo sys5 environment
END_OF_FILE
if test 1315 -ne `wc -c <'conflict-6.0/CHANGES'`; then
echo shar: \"'conflict-6.0/CHANGES'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/CHANGES'
fi
if test -f 'conflict-6.0/COPYING' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/COPYING'\"
else
echo shar: Extracting \"'conflict-6.0/COPYING'\" \(417 characters\)
sed "s/^X//" >'conflict-6.0/COPYING' <<'END_OF_FILE'
X$Id: COPYING,v 6.0 1995/03/18 01:57:06 dickey Rel $
X
XCONFLICT
X
X--------------------------------------------------------------------------------
X
XCopyright 1995 by Thomas E. Dickey. All Rights Reserved.
X
XYou may freely copy or redistribute this software, so long as there is no profit
Xmade from its use, sale trade or reproduction. You may not change this copyright
Xnotice, and it must be included in any copy made.
X
END_OF_FILE
if test 417 -ne `wc -c <'conflict-6.0/COPYING'`; then
echo shar: \"'conflict-6.0/COPYING'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/COPYING'
fi
if test -f 'conflict-6.0/MANIFEST' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/MANIFEST'\"
else
echo shar: Extracting \"'conflict-6.0/MANIFEST'\" \(1343 characters\)
sed "s/^X//" >'conflict-6.0/MANIFEST' <<'END_OF_FILE'
XMANIFEST for conflict, version 6_0
X--------------------------------------------------------------------------------
XMANIFEST this file
XCHANGES change-log for 'conflict'
XCOPYING collective copyright notice for 'conflict'
XREADME brief description of 'conflict'
Xconfig_h.in template for config.h
Xconfigure.in template for configure-script
Xconfigure Configuration script for UNIX
Xconflict.1 UNIX manual-page for 'conflict'
Xconflict.c 'conflict' main program
Xconflict.h common include for 'conflict'
Xconflict.lsm Linux Software Map description of 'conflict'
Xinstall.sh install-script, from X11R5
Xmakefile.in template for UNIX makefile for 'conflict'
Xmkdirs.sh make directory-hierarchy (from X-windows)
Xmsdos.c MS-DOS support functions
Xos2.c OS/2 support functions
Xpatchlev.h current patch-level of 'conflict'
Xrun_test.sh UNIX test-script for 'conflict'
Xtxtalloc.c text-allocator
Xunix.c UNIX support functions
END_OF_FILE
if test 1343 -ne `wc -c <'conflict-6.0/MANIFEST'`; then
echo shar: \"'conflict-6.0/MANIFEST'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/MANIFEST'
fi
if test -f 'conflict-6.0/README' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/README'\"
else
echo shar: Extracting \"'conflict-6.0/README'\" \(318 characters\)
sed "s/^X//" >'conflict-6.0/README' <<'END_OF_FILE'
X$Id: README,v 6.0 1991/10/22 16:28:52 dickey Rel $
X
XCONFLICT
X
X--------------------------------------------------------------------------------
X
XCONFLICT examines the user-specifiable list of programs, looking for instances
Xin the user's path which conflict (i.e., the name appears in more than one
Xpoint in the path).
END_OF_FILE
if test 318 -ne `wc -c <'conflict-6.0/README'`; then
echo shar: \"'conflict-6.0/README'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/README'
fi
if test -f 'conflict-6.0/config_h.in' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/config_h.in'\"
else
echo shar: Extracting \"'conflict-6.0/config_h.in'\" \(252 characters\)
sed "s/^X//" >'conflict-6.0/config_h.in' <<'END_OF_FILE'
X/*
X * $Id: config_h.in,v 6.0 1994/06/12 23:48:18 dickey Rel $
X * config_h.in is a template file used by configure to produce config.h.
X * config_h is then transformed (by config.status) into the header file
X * config.h -- Kevin Buettner.
X */
X
X@DEFS@
END_OF_FILE
if test 252 -ne `wc -c <'conflict-6.0/config_h.in'`; then
echo shar: \"'conflict-6.0/config_h.in'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/config_h.in'
fi
if test -f 'conflict-6.0/configure.in' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/configure.in'\"
else
echo shar: Extracting \"'conflict-6.0/configure.in'\" \(1425 characters\)
sed "s/^X//" >'conflict-6.0/configure.in' <<'END_OF_FILE'
Xdnl Process this file with 'autoconf' to produce a 'configure' script
Xdnl $Id: configure.in,v 6.0 1995/03/18 14:22:35 dickey Rel $
XAC_REVISION($Revision: 6.0 $)
XAC_INIT(conflict.c)
X
XAC_ARG_WITH(debugging,
X[ --with-debugging turn on gcc debug-flag ],
X[CFLAGS="$CFLAGS -g"],
X[CFLAGS="$CFLAGS -O"])
X
XAC_PROG_CC
XAC_PROG_INSTALL
XAC_C_CONST
XAC_CHECK_PROGS(LINT, tdlint lint alint)
X
XAC_SUBST(CFLAGS)
XAC_SUBST(LDFLAGS)
XAC_SUBST(LIBS)
XAC_SUBST(LINT)
X
XAC_CONST
XAC_HEADER_STDC
XAC_CHECK_HEADERS(stdlib.h unistd.h)
XAC_CHECK_HEADERS(getopt.h string.h malloc.h sys/param.h)
XAC_HEADER_DIRENT
X
XAC_TYPE_SIZE_T
XAC_CHECK_TYPE(ino_t, unsigned)
XAC_CHECK_TYPE(dev_t, unsigned)
X
XAC_CHECK_FUNCS(getcwd getopt link symlink realpath strrchr strdup)
X
XAC_ARG_WITH(warnings,
X[ --with-warnings turn on gcc warnings, for debugging ],[


Xif test -n "$GCC"
Xthen
XCFLAGS='-O -Wall -Wshadow -Wconversion -Wstrict-prototypes -Wmissing-prototypes'
Xfi

X])
X
XAC_ARG_WITH(dbmalloc,
X[ --with-dbmalloc compile/link with dbmalloc if found ],[
XAC_CHECK_HEADER(dbmalloc.h,[
XAC_CHECK_LIB(dbmalloc,dbmallopt,[
XAC_DEFINE(HAVE_DBMALLOC_H)
XLIBS="$LIBS -ldbmalloc"])])
X])


X
X### output makefile and config.h

Xchangequote({,})dnl
XAC_OUTPUT(makefile config_h,


X{
Xecho creating config.h
Xsed -e '/^# /d' \
X -e 's/ -D/\
X#define /g' \
X -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \
X config_h >config.h
X}
Xecho removing config_h
Xrm config_h

X)
Xchangequote([,])dnl
END_OF_FILE
if test 1425 -ne `wc -c <'conflict-6.0/configure.in'`; then
echo shar: \"'conflict-6.0/configure.in'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/configure.in'
fi
if test -f 'conflict-6.0/conflict.1' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/conflict.1'\"
else
echo shar: Extracting \"'conflict-6.0/conflict.1'\" \(4073 characters\)
sed "s/^X//" >'conflict-6.0/conflict.1' <<'END_OF_FILE'
X.\"*****************************************************************************
X.\" Copyright 1995 by Thomas E. Dickey. All Rights Reserved. *
X.\" *
X.\" You may freely copy or redistribute this software, so long as there is no *
X.\" profit made from its use, sale trade or reproduction. You may not change *
X.\" this copyright notice, and it must be included in any copy made. *
X.\"*****************************************************************************
X.\" $Id: conflict.1,v 6.0 1995/03/18 01:54:28 dickey Rel $
X.de DS
X.RS
X.nf
X.sp
X..
X.de DE
X.fi
X.RE
X.sp .5
X..
X.TH CONFLICT 1
X.hy 0
X.
X.SH NAME
X\fBconflict\fR \- filename conflict listing
X.
X.SH USAGE
X\fBconflict\fI [options] [file-specifications]
X.
X.SH SYNOPSIS
X\fBConflict\fR displays conflicting filenames in your execution path.
XUnlike the csh command \fIwhich\fR,
Xit displays all of the (non-alias) executable files in your path.
X.
X.SH DESCRIPTION
X\fBConflict\fR reports pathname conflicts by making a list of the
Xdirectories which are listed in the environment variable PATH, and
Xthen scanning these directories for executable files.
XIf arguments are given to this program,
Xthe test for executable files is limited
Xto the given names (after stripping the directory-prefix).
X.PP
XThe first instance of a name in a given path
X(and those hard-linked to it) are marked with "*".
XSucceeding instances are marked with "+" marks.
X.PP
XThe report is sent to standard output and always shows the list of
Xdirectories.
XConflicting names are reported on succeeding lines.
X.
X.SH OPTIONS
X.TP
X.BI \-e " name"
Xspecify another environment variable than PATH
X(e.g., INFOPATH, LD_LIBRARY_PATH).
X.
X.TP
X.BI \-I " path"
Xfor compatibility with C-preprocessor options, build up the search path
Xwith the given directory.
X(The corresponding \-D and \-U options are ignored.)
XUsing the \-I or \-L options overrides the use of environment variables
Xfor the search path.
X.
X.TP
X.BI \-L " path"
Xfor compatibility with C-compiler options, build up the search path
Xwith the given directory.
X.
X.TP
X.B \-p
Xprint pathnames only, rather than the table.
X.
X.TP
X.B \-r
Xlook for readable files
X.
X.TP
X.BI \-t " types"
Xspecify a list of file types which are treated as conflicting.
X.
X.TP
X.B \-v
XUse verbose option to control how much is shown.
XRepeat the option for different levels:
X.RS
X.TP
X.I 1
Xshow all directory names
X.TP
X.I 2
Xshow all filenames which are found in the directories
X.TP
X.I 3
Xdirects \fBconflict\fR not only
Xto print a summary line for each file, but also to print a running
Xsummary, showing executable file (with its full path) as it is found).
X.RE
X.
X.TP
X.B \-w
Xlook for writable files
X.
X.TP
X.BI \-W " number"
Xexpand width of display by number of columns (default: one column per path).
X.
X.TP
X.B \-x
Xlook for executable files (the default).
X.
X.PP
XYou may combine the "\-r", "\-w" and "\-x" options.
XIf you do not specify one of these, \fBconflict\fR assumes "\-x".
X.
X.SH OPERATIONS
X\fBConflict\fR may be used to list all conflicting names in your
Xpath (if no arguments are given), or to find conflicts for a specified
Xname.
XTo list only conflicts from a particular directory "path"
Xyou may type
X.DS
Xconflict -a path/*
X.DE
X.PP
XAn example of the use of \fBconflict\fR is shown below
X.DS
Xbsd4.2(5) conflict
XCurrent working directory is "/home/dickey/src/conflict"
X-> .
X--> /home/dickey/bin
X---> /home/dickey/com
X----> /bin
X-----> /usr/bin
X------> /usr/ucb
X-------> /usr/local/bin
X-*----+: args
X----*-+: calendar
X---*--+: cc
X*+-----: conflict
X\&...
X.DE
X.
X.SH ENVIRONMENT
X\fBConflict\fR runs in a portable UNIX\*R environment, as well as
XMSDOS and OS/2 command-line.
X.
X.SH FILES
X\fBConflict\fR is a single binary module, which uses no auxiliary files.
X.
X.SH ANTICIPATED CHANGES
Xadd option to get aliases from the shell
X.PP
Xhandle compound directory structures such as MANPATH.
X.PP
Xshow symbol conflicts from object files and libraries.
X.
X.SH SEE ALSO
Xcsh (1) for a discussion of \fIwhich\fR.
X.
X.SH AUTHOR
XThomas Dickey (dic...@clark.net)
END_OF_FILE
if test 4073 -ne `wc -c <'conflict-6.0/conflict.1'`; then
echo shar: \"'conflict-6.0/conflict.1'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/conflict.1'
fi
if test -f 'conflict-6.0/conflict.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/conflict.c'\"
else
echo shar: Extracting \"'conflict-6.0/conflict.c'\" \(18101 characters\)
sed "s/^X//" >'conflict-6.0/conflict.c' <<'END_OF_FILE'


X/******************************************************************************
X * Copyright 1995 by Thomas E. Dickey. All Rights Reserved. *
X * *
X * You may freely copy or redistribute this software, so long as there is no *
X * profit made from its use, sale trade or reproduction. You may not change *
X * this copyright notice, and it must be included in any copy made. *
X ******************************************************************************/
X#ifndef NO_IDENT

Xstatic char Id[] = "$Header: /home/tom/src/conflict/RCS/conflict.c,v 6.0 1995/03/18 14:05:04 dickey Rel $";
X#endif
X
X/*
X * Title: conflict.c (path-conflict display)
X * Author: T.E.Dickey
X * Created: 15 Apr 1988
X *
X * Function: Reports pathname conflicts by making a list of the directories
X * which are listed in the environment variable PATH, and then
X * scanning these directories for executable files. If arguments
X * given to this program, the test for executable files is limited
X * to the given names (after stripping directory-prefix).
X *
X * The report is sent to standard output and always shows the
X * list of directories. Conflicts are reported on succeeding
X * lines.
X */
X
X#include "conflict.h"
X
X#define CHUNK 0xff /* (2**n) - 1 chunk for reducing realloc's */
X
Xstatic INPATH *inpath;
Xstatic DIRS *dirs;
Xstatic char *env_name; /* e.g., "PATH" */
Xstatic char *pathlist; /* e.g., ".:/bin:/usr/bin" */
Xstatic char **FileTypes;
Xstatic char *dot;
Xstatic size_t total,
X path_len, /* maximum number of items in path */
X num_types; /* number of file-types to scan */
Xstatic int acc_mask, /* permissions we're looking for */
X p_opt, /* print pathnames (not a table) */
X v_opt, /* verbose (repeat for different levels) */
X do_blips;
Xstatic char *w_opt = "", /* pads listing */
X *w_opt_text = "--------";
X
X#if SYS_MSDOS || SYS_OS2
X#define DOS_upper(s) strupr(s)
X#else
X#define DOS_upper(s) s
X#endif
X
X#if SYS_MSDOS
X#define TYPES_PATH ".COM.EXE.BAT.PIF"
X#endif
X
X#if SYS_OS2
X#define TYPES_PATH ".EXE.CMD.bat.com.sys"
X#endif
X
Xstatic char * TypesOf ARGS((size_t len, INPATH *ip));
Xstatic int LookupDirs ARGS((char *name, int n));
Xstatic int SameTypeless ARGS((char *a, char *b));
Xstatic int cmp_INPATH ARGS((const void *p1, const void *p2));
Xstatic int had_conflict ARGS((INPATH *ip));
Xstatic type_t LookupType ARGS((char *name));
Xstatic void AddToPath ARGS((char *path));
Xstatic void ScanConflicts ARGS((char *path, int inx, int argc, char **argv));
Xstatic void ShowConflicts ARGS((int len, INPATH *ip));
Xstatic void ShowPathnames ARGS((INPATH *ip));
Xstatic void compress_list ARGS((void));
Xstatic void usage ARGS((void));
X
X#if USE_INODE
Xstatic void node_found ARGS((INPATH *ip, int n, type_t f, struct stat *sb));
X#else
Xstatic void node_found ARGS((INPATH *ip, int n, type_t flags));
X#endif
X
X/*
X * comparison procedure used for sorting list of names for display
X */
Xstatic
Xint cmp_INPATH(p1, p2)
X const void *p1;
X const void *p2;
X{
X return strcmp(((INPATH *)(p1))->name, ((INPATH *)(p2))->name);
X}
X
X/*
X * save information from the current stat-block so we can test for repeated
X * instances of the file.
X */
X#if USE_INODE
Xstatic
Xvoid node_found(ip, n, flags, sb)
X INPATH * ip;
X int n;
X type_t flags;
X struct stat * sb;
X{
X NODEFLAGS(n) |= flags;
X ip->node[n].device = sb->st_dev;
X ip->node[n].inode = sb->st_ino;
X}
X#define FoundNode(ip,n) node_found(ip,n,ok,&sb)
X
X#else
Xstatic
Xvoid node_found(INPATH *ip, int n, type_t flags)
X{
X NODEFLAGS(n) |= flags;
X}
X#define FoundNode(ip,n) node_found(ip,n,ok)
X#endif /* USE_INODE */
X
X/*
X * Look up the given name and fill-in the n'th entry of the 'dirs[]' array.
X */
Xstatic
Xint LookupDirs(name, n)
X char *name;
X int n;
X{
X int found = FALSE;
X#if USE_INODE


X struct stat sb;
X

X if (stat(name, &sb) >= 0) {
X dirs[n].device = sb.st_dev;
X dirs[n].inode = sb.st_ino;
X found = TRUE;
X }
X#else
X char resolved[MAXPATHLEN];
X if (realpath(name, resolved) != 0) {
X dirs[n].actual = MakeString(resolved);
X found = TRUE;
X }
X#endif
X return found;
X}
X
X/*
X * Display the conflicting items
X */
Xstatic
Xvoid ShowConflicts(len, ip)
X int len;
X INPATH * ip;
X{
X register int j;
X int k = -1;
X char flags[BUFSIZ];
X
X for (j = 0; j < len; j++) {
X if (FileTypes == 0) {
X register int d = '-';
X if (ip != 0) {
X if (IS_A_NODE(j)) {
X d = '*';
X if (k < 0) {
X k = j; /* latch first index */
X } else {
X if (!SAME_NODE(j,k))
X d = '+';
X }
X }
X }
X (void)printf("%s%c", w_opt, d);
X continue;
X }
X
X for (k = 0; k < num_types+2; k++)
X flags[k] = '-';
X flags[k-1] = EOS;
X flags[0] = ':';
X if (ip != 0 && IS_A_NODE(j)) {
X for (k = 0; k < num_types; k++) {
X if ((1 << k) & NODEFLAGS(j)) {
X char *s = FileTypes[k];
X int c = *s++;
X if (c == EOS || *s == EOS)
X c = '.';
X else
X c = *s;
X flags[k+1] = c;
X }
X }
X }
X (void)printf("%s%s", w_opt, flags);
X }
X}
X
Xstatic
Xvoid ShowPathnames (ip)
X INPATH *ip;
X{
X int j, k;
X char bfr[MAXPATHLEN];
X
X if (num_types != 0) {
X (void)strcpy(bfr, ip->name);
X *ftype(bfr) = EOS;
X }
X
X if (p_opt) {
X for (j = 0; j < path_len; j++) {
X if (NODEFLAGS(j) != 0) {
X if (num_types != 0) {
X for (k = 0; k < num_types; k++) {
X if ((1<<k) & NODEFLAGS(j)) {
X (void)printf("%s%c%s%s\n",
X dirs[j].name,
X PATHNAME_SEP,
X bfr,
X FileTypes[k]);
X }
X }
X } else {
X (void)printf("%s%c%s\n",
X dirs[j].name,
X PATHNAME_SEP,
X ip->name);
X }
X }
X }
X } else if (num_types != 0) {
X (void)printf(": %s (%s)\n", bfr, TypesOf(path_len, ip));
X } else {
X (void)printf(": %s\n", ip->name);
X }
X}
X
Xstatic
Xchar * TypesOf(len, ip)
X size_t len;
X INPATH * ip;
X{
X register int j, mask, n, k;
X#if NO_LEAKS
X static char result[BUFSIZ];
X#else
X static char *result;
X
X if (result == 0)
X result = malloc((num_types*4) + 1);
X#endif
X
X for (j = mask = 0; j < len; j++)
X mask |= NODEFLAGS(j);
X
X result[0] = EOS;
X for (n = 0, k = 1; n < num_types; n++, k <<= 1) {
X if (k & mask) {
X if (result[0] != EOS)
X (void)strcat(result, ",");
X (void)strcat(result, FileTypes[n]);


X }
X }
X return result;
X}
X

X/*
X * Compress the list of paths, removing those which had no conflicts.
X */
Xstatic
Xvoid compress_list()
X{
X register int j, k, jj;
X int compress;
X type_t flags;
X
X for (j = 0; j < path_len; j++) {
X for (k = 0, compress = TRUE; compress && (k < total); k++) {
X register INPATH *ip = inpath + k;
X if ((flags = NODEFLAGS(j)) != 0) {
X /* If there's more than one suffix found for
X * the current entry, we cannot compress it.
X */
X while (flags != 0) {
X if ((flags & 1) != 0)
X break;
X flags >>= 1;
X }
X if (flags == 1) {
X for (jj = 0; jj < path_len; jj++) {
X if (jj == j)
X continue;
X if (IS_A_NODE(jj)) {
X compress = FALSE;
X break;
X }
X }
X } else {
X compress = FALSE;
X }
X }
X }
X if (compress) {
X if (v_opt) {
X (void)fprintf(stderr, "no conflict:%s\n", dirs[j].name);
X (void)fflush(stderr);
X }
X FreeString(dirs[j].name);
X for (jj = j+1; jj < path_len; jj++)
X dirs[jj-1] = dirs[jj];
X for (k = 0; k < total; k++) {
X register INPATH *ip = inpath + k;
X for (jj = j+1; jj < path_len; jj++)
X ip->node[jj-1] = ip->node[jj];
X }
X j--;
X path_len--;
X }
X }
X}
X
X/*
X * returns true iff we have two instances of the same name
X */
Xstatic
Xint had_conflict(ip)
X INPATH * ip;
X{
X register int j, k;
X int first = TRUE;
X type_t mask;
X
X for (j = 0; j < path_len; j++) {
X if ((mask = NODEFLAGS(j)) != 0) {
X
X if (FileTypes == 0) {
X if (!first)
X return TRUE;
X first = FALSE;
X continue;
X }
X
X for (k = 0; k < num_types; k++) {
X if (mask & (1<<k)) {
X if (!first)
X return TRUE;
X first = FALSE;
X }
X }
X }
X }
X return (FALSE);
X}
X
X/* Returns nonzero if the given filename has an executable-suffix */
Xstatic
Xtype_t LookupType(name)
X char * name;
X{
X register int k;
X char temp[MAXPATHLEN];
X char *type = DOS_upper(strcpy(temp, ftype(name)));
X
X for (k = 0; k < num_types; k++) {
X if (!strcmp(type, FileTypes[k]))
X return (1<<k);
X }
X return 0;
X}
X
X/* Compare two leaf-names, ignoring their suffix. */
Xstatic
Xint SameTypeless(a, b)
X char * a;
X char * b;
X{
X char *type_a = ftype(a);
X char *type_b = ftype(b);
X if (type_a - a == type_b - b) {
X if (!strncmp(a, b, (size_t)(type_a - a)))
X return TRUE;
X }
X return FALSE;
X}
X#define SameName(a,b) ((FileTypes == 0) ? SameString(a,b) : SameTypeless(a,b))
X
Xstatic
Xvoid ScanConflicts(path, inx, argc, argv)
X char * path;
X int inx;
X int argc;
X char ** argv;
X{
X DIR *dp;
X struct dirent *de;
X struct stat sb;
X register int j;
X#if SYS_MSDOS || SYS_OS2
X char save_wd[MAXPATHLEN];
X#endif
X
X /*
X * When scanning a directory, we first chdir to it, mostly to make
X * the scan+stat work faster, but also because some systems don't
X * scan properly otherwise.
X *
X * MSDOS and OS/2 are a little more complicated, because each drive
X * has its own current directory.
X */
X#if SYS_MSDOS || SYS_OS2
X (void) strcpy(save_wd, dot);
X if (!strcmp(".", path)) {
X path = dot;
X } else if (!same_drive(dot, path)) {
X if (!set_drive(path))
X return;
X getwd(save_wd);
X }
X#endif
X if (set_directory(path)
X && (dp = opendir(path)) != NULL) {
X
X while ((de = readdir(dp)) != NULL) {
X register
X type_t ok = 0;
X int found = FALSE;
X char buffer[MAXPATHLEN];
X char *the_name;
X
X if (do_blips)
X blip('.');
X
X (void)sprintf(buffer, "%.*s", (int)NAMLEN(de), de->d_name);
X the_name = MakeString(DOS_upper(buffer));
X
X /* If arguments are given, restrict search to them */
X if (argc > optind) {
X for (j = optind; j < argc; j++) {
X if (SameName(argv[j], the_name)) {
X found = TRUE;
X break;
X }
X }
X if (!found)
X continue;
X }
X
X /* Verify that the name is a file, and executable */
X if (stat(the_name, &sb) < 0)
X continue;
X if ((sb.st_mode & S_IFMT) != S_IFREG)
X continue;
X
X#if SYS_UNIX || SYS_OS2
X if (access(the_name, acc_mask) < 0)
X continue;
X ok = 1;
X#endif
X if (FileTypes != 0) {
X if ((ok = LookupType(the_name)) == 0)
X continue;
X }
X
X /* Find the name in our array of all names */
X found = FALSE;
X for (j = 0; j < total; j++) {
X if (SameName(inpath[j].name, the_name)) {
X FoundNode(&inpath[j], inx);
X found = TRUE;
X break;
X }
X }
X
X /* If not there, add it */
X if (!found) {
X if (!(total & CHUNK)) {
X size_t need = ((total*3)/2 | CHUNK) + 1;
X if (inpath != 0)
X inpath = TypeRealloc(INPATH,
X inpath, need);
X else
X inpath = TypeAlloc(INPATH, need);
X }
X j = total++;
X inpath[j].name = the_name;
X inpath[j].node = TypeAlloc(NODE, path_len);
X FoundNode(&inpath[j], inx);
X }
X if (v_opt > 2) {
X (void)printf("%c %s/%s\n",
X found ? '+' : '*',
X path, the_name);
X }
X }
X (void)closedir(dp);
X }
X#if SYS_MSDOS || SYS_OS2
X if (strcmp(dot, save_wd)) {
X chdir (save_wd);
X }
X#endif
X (void)set_directory(dot);
X}
X
X/*
X * Build up the 'pathlist' string in the same form as we expect from an
X * environment variable, from command-line option values.
X */
Xstatic
Xvoid AddToPath(path)
X char *path;
X{
X size_t need = strlen(path) + 1;
X
X if (pathlist != 0) {
X size_t have = strlen(pathlist);
X pathlist = realloc(pathlist, have + need + 1);
X (void)sprintf(pathlist + have, "%c%s", PATHLIST_SEP, path);
X } else {
X pathlist = malloc(need);
X (void)strcpy(pathlist, path);
X }
X}
X
Xstatic
Xvoid usage()
X{
X static char *tbl[] = {
X "Usage: conflict [options] [list_of_files]"
X ,""
X ,"Lists conflicts of executable files in current PATH."
X ,"First instance in path (and those linked to it) are marked"
X ,"with \"*\", succeeding instances with \"+\" marks."
X ,""
X ,"Options are:"
X ," -e name specify another environment variable than $PATH"
X ," -p print pathnames only"
X ," -r look for read-able files"
X ," -t types look only for given file-types"
X ," -v (verbose) show names found in each directory"
X ," once: shows all directory names"
X ," twice: shows all filenames"
X ," -w look for write-able files"
X ," -W number expand width of display by number of columns"
X ," -x look for execut-able files (default)"
X ,""
X ,"Also, C-preprocessor-style -I and -L options"
X };
X register int j;
X for (j = 0; j < SIZEOF(tbl); j++)
X (void)fprintf(stderr, "%s\n", tbl[j]);
X (void)fflush(stderr);
X (void)exit(EXIT_FAILURE);
X}
X
Xvoid failed(s)
X char *s;
X{
X perror(s);
X exit(EXIT_FAILURE);
X}
X
Xint main(argc, argv)
X int argc;
X char *argv[];
X{
X register int found, j, k;
X char *s, *t;
X char *type_list = 0;
X char bfr[MAXPATHLEN];
X
X while ((j = getopt(argc, argv, "D:e:I:prt:U:vwW:x")) != EOF) {
X switch (j) {
X case 'e': env_name = optarg; break;
X case 't': type_list = optarg; break;
X case 'v': v_opt++; break;
X case 'p': p_opt = TRUE; break;
X
X case 'W': k = (int)strtol(optarg, &t, 0);
X if (*t != EOS || k < 0)
X usage();
X k = strlen(w_opt_text) - k;
X if (k < 0)
X k = 0;
X w_opt = w_opt_text + k;
X break;
X
X case 'r': acc_mask |= R_OK; break;
X case 'w': acc_mask |= W_OK; break;
X case 'x': acc_mask |= X_OK; break;
X
X /*
X * The 'U' and 'D' options are parsed to simplify
X * using C-preprocessor options to scan for include-
X * files.
X */
X case 'U': /* ignored */ break;
X case 'D': /* ignored */ break;
X case 'I': AddToPath(optarg); break;
X case 'L': AddToPath(optarg); break;
X
X default: usage();
X /*NOTREACHED*/
X }
X }
X
X /* The "-v" and "-p" options aren't meaningful in combination */
X if (v_opt && p_opt)
X usage();
X
X /* The remaining arguments are the programs/symbols that we're looking
X * for. Reduce the argument-list to the leaf-names (stripping paths).
X */
X if (argc > optind) {
X for (j = optind; j < argc; j++) {
X argv[j] = MakeString(DOS_upper(fleaf(argv[j])));
X }
X }
X
X do_blips = ((v_opt > 1) && isatty(fileno(stderr)));
X
X if (acc_mask == 0)
X acc_mask = X_OK;
X
X /*
X * Get the current working-directory, so we have a reference point to
X * go back after scanning directories.
X */
X if (getwd(bfr) == 0)
X failed("getcwd");
X dot = MakeString(bfr);
X if (!p_opt)
X (void)printf("Current working directory is \"%s\"\n", dot);
X
X /*
X * Obtain the list of directories that we'll scan.
X */
X if (pathlist == 0) {
X if (env_name == 0)
X env_name = "PATH";
X
X if ((s = getenv(env_name)) != 0)
X pathlist = strdup(s);
X else
X failed(env_name);
X
X#if SYS_MSDOS || SYS_OS2
X if (!strcmp(env_name, "PATH")) {
X /* look in current directory before looking in $PATH */
X s = malloc(strlen(pathlist)+3);
X (void)sprintf(s, ".%c%s", PATHLIST_SEP, pathlist);
X free(pathlist);
X pathlist = s;
X }
X#endif
X }
X for (s = DOS_upper(pathlist), path_len = 1; *s != EOS; s++)
X if (*s == PATHLIST_SEP)
X path_len++;
X dirs = TypeAlloc(DIRS, path_len);
X
X /*
X * Reconstruct the type-list (if any) as an array to simplify scanning.
X */
X#if SYS_MSDOS || SYS_OS2
X if (type_list == 0) {
X if (!strcmp(env_name, "PATH"))
X type_list = TYPES_PATH;
X }
X#endif
X if (type_list != 0) {
X type_list = DOS_upper(strdup(type_list));
X for (s = type_list, num_types = 0; *s != EOS; s++) {
X if (*s == '.') {
X num_types++;
X#if SYS_UNIX /* "." and "" are different types */
X if ((s[1] == '.') || (s[1] == EOS))
X num_types++;
X#endif
X }
X }
X if (num_types == 0 || *type_list != '.') {
X (void)fprintf(stderr, "Type-list must be .-separated\n");
X exit(EXIT_FAILURE);
X }
X FileTypes = TypeAlloc(char *, num_types);
X j = num_types;
X do {
X if (*--s == '.') {
X FileTypes[--j] = strdup(s);
X#if SYS_UNIX /* "." and "" are different types */
X if (s[1] == EOS)
X FileTypes[--j] = strdup("");
X#endif
X *s = EOS;
X }
X } while (j != 0);
X free(type_list);
X }
X
X /*
X * Build a list of the directories in the $PATH variable, excluding any
X * that happen to be the same inode (e.g., ".", or symbolically linked
X * directories).
X */
X for (s = pathlist, j = 0; *s != EOS; s = t) {
X for (k = 0; s[k] != PATHLIST_SEP; k++)
X if ((bfr[k] = s[k]) == EOS)
X break;
X
X t = (s[k] != EOS) ? s+k+1 : s+k;
X if (k == 0)
X (void)strcpy(bfr, ".");
X else
X bfr[k] = EOS;
X
X if (LookupDirs(bfr, j)) {
X for (k = 0, found = FALSE; k < j; k++) {
X if (SAME_DIRS(j,k)) {
X found = TRUE;
X break;
X }
X }
X if (!found) {
X dirs[j].name = MakeString(bfr);
X j++;
X }
X }
X }
X path_len = j;
X
X /*
X * For each unique directory in $PATH, scan it, looking for executable
X * files.
X */
X for (j = 0; j < path_len; j++) {
X if (v_opt > 1) {
X ShowConflicts(j+1, (INPATH *)0);
X (void)printf("> %s\n", dirs[j].name);
X } else if (do_blips) {
X (void)fprintf(stderr, "%s", dirs[j].name);
X (void)fflush(stdout);
X (void)fflush(stderr);
X }
X ScanConflicts(dirs[j].name, j, argc, argv);
X if (do_blips)
X blip('\n');
X }
X
X /*
X * The normal (unverbose) listing shows only the conflicting files,
X * and the directories in which they are found.
X */
X if (!v_opt)
X compress_list();
X
X if (!p_opt) {
X for (j = 0; j < path_len; j++) {
X ShowConflicts(j+1, (INPATH *)0);
X (void)printf("> %s\n", dirs[j].name);
X }
X }
X
X if (total != 0) {
X qsort((char *)inpath, (size_t)total, sizeof(INPATH), cmp_INPATH);
X for (j = 0; j < total; j++) {
X if ((v_opt > 1) || had_conflict(&inpath[j])) {
X if (!p_opt)
X ShowConflicts((int)path_len, &inpath[j]);
X ShowPathnames(&inpath[j]);
X }
X }
X }
X
X /*
X * Test/debug: free all memory so we can validate the heap.
X */
X#if NO_LEAKS
X if (FileTypes != 0) {
X for (j = 0; j < num_types; j++)
X free(FileTypes[j]);
X free((char *)FileTypes);
X }
X if (dirs != 0) {
X# if !USE_TXTALLOC
X for (j = 0; j < path_len; j++) {
X FreeString(dirs[j].name);
X }
X# endif
X free((char *)dirs);
X }
X if (inpath != 0) {
X for (j = 0; j < total; j++) {
X FreeString(inpath[j].name);
X free((char *)(inpath[j].node));
X }
X free((char *)inpath);
X }
X free(pathlist);
X FreeString(dot);
X# if USE_TXTALLOC
X free_txtalloc();
X# endif
X# if HAVE_DBMALLOC_H
X malloc_dump(fileno(stdout));
X# endif
X#endif
X (void)fflush(stderr);
X (void)fflush(stdout);
X (void)exit(EXIT_SUCCESS);
X /*NOTREACHED*/
X return 0;
X}
END_OF_FILE
if test 18101 -ne `wc -c <'conflict-6.0/conflict.c'`; then
echo shar: \"'conflict-6.0/conflict.c'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/conflict.c'
fi
if test -f 'conflict-6.0/conflict.lsm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/conflict.lsm'\"
else
echo shar: Extracting \"'conflict-6.0/conflict.lsm'\" \(470 characters\)
sed "s/^X//" >'conflict-6.0/conflict.lsm' <<'END_OF_FILE'
XBegin3
XTitle: conflict
XVersion: 6.0
XEntered-date: 18MAR95
XDescription: Scans the user's path for conflicting filenames, showing table.
X Options for alternate path, suffixes and non-executable files.
XKeywords: which
XAuthor: dic...@clark.net (Thomas E. Dickey)
XMaintained-by: dic...@clark.net (Thomas E. Dickey)
XPrimary-site: sunsite.unc.edu /pub/Linux/utils/file
X 30kB conflict-6.0.tgz
XPlatforms: any UNIX (uses GNU configure), DOS, OS/2
XCopying-policy: BSD-like
XEnd
END_OF_FILE
if test 470 -ne `wc -c <'conflict-6.0/conflict.lsm'`; then
echo shar: \"'conflict-6.0/conflict.lsm'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/conflict.lsm'
fi
if test -f 'conflict-6.0/makefile.in' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/makefile.in'\"
else
echo shar: Extracting \"'conflict-6.0/makefile.in'\" \(2436 characters\)
sed "s/^X//" >'conflict-6.0/makefile.in' <<'END_OF_FILE'
X# $Id: makefile.in,v 6.0 1995/03/18 15:27:08 dickey Rel $
X# Makefile-template for 'conflict'
X
XTHIS = conflict
XSYSTEM = unix
X
X#### Start of system configuration section. ####
X
Xsrcdir = @srcdir@
XVPATH = @srcdir@
X
XCC = @CC@
XLINK = $(CC)
XLINT = @LINT@
XINSTALL = @INSTALL@
XINSTALL_PROGRAM = @INSTALL_PROGRAM@
XINSTALL_DATA = @INSTALL_DATA@
X
XLIBS = @LIBS@
XCFLAGS = @CFLAGS@
XLDFLAGS = @LDFLAGS@
X
Xprefix = @prefix@
Xexec_prefix = @exec_prefix@
X
Xbindir = $(exec_prefix)/bin
Xmandir = $(prefix)/man/man1
Xmanext = 1
X
X#### End of system configuration section. ####
X
XSHELL = /bin/sh
X
XCPPFLAGS = -I. -I$(srcdir) -DHAVE_CONFIG_H
X
X.c.o:
X $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
X
XSRC = patchlev.h \
X CHANGES COPYING README \
X $(THIS).lsm $(THIS).c $(THIS).h $(THIS).1 \
X txtalloc.c unix.c msdos.c os2.c \
X config_h.in install.sh mkdirs.sh makefile.in configure.in \
X run_test.sh
X
XOBJ = $(THIS).o $(SYSTEM).o txtalloc.o
X
XDISTFILES = MANIFEST configure $(SRC)
X
Xall: $(THIS)
X
X$(THIS): $(OBJ)
X -mv $(THIS) o$(THIS)
X $(LINK) $(CFLAGS) $(LDFLAGS) -o $(THIS) $(OBJ) $(LIBS)
X
X$(OBJ) : conflict.h
X
Xinstall: all installdirs
X $(INSTALL_PROGRAM) $(THIS) $(bindir)/$(THIS)
X $(INSTALL_DATA) $(srcdir)/$(THIS).1 $(mandir)/$(THIS).$(manext)
X
Xinstalldirs:
X $(SHELL) ${srcdir}/mkdirs.sh $(bindir) $(mandir)
X
Xuninstall:
X rm -f $(bindir)/$(THIS) $(mandir)/$(THIS).$(manext)
X
Xmakefile: makefile.in config.status
X ./config.status
X
Xconfig.h: configure
X ./configure
X
Xconfig.status: configure
X ./config.status --recheck
X
Xmostlyclean:
X rm -f *.o o$(THIS) core *~ *.BAK
X
Xclean: mostlyclean
X rm -f $(THIS)
X
Xdistclean: clean
X rm -f makefile config.log config.cache config.status config.h
X
Xrealclean: distclean
X rm -f tags TAGS # don't remove configure!
X
Xlint:
X $(LINT) $(LINTOPTS) -DNO_IDENT $(CPPFLAGS) $(THIS).c $(SYSTEM).c txtalloc.c
X
Xtags:
X ctags $(THIS).c $(HDRS)
X
XTAGS:
X etags $(THIS).c $(HDRS)
X
Xdist: makefile $(DISTFILES)
X echo $(THIS)-`sed \
X -e '/"$$[A-Za-z]*: .*$(THIS)\.c.*$$"/!d' \
X -e 's/^.*$(THIS)[^ ]*[ ]*//' \
X -e 's/[ ].*$$//' \
X -e q $(srcdir)/$(THIS).c` > .fname
X rm -rf `cat .fname`
X mkdir `cat .fname`
X for file in $(DISTFILES); do \
X ln $(srcdir)/$$file `cat .fname` \
X || { echo copying $$file instead; cp -p $$file `cat .fname`; }; \
X done
X tar -cf - `cat .fname` | gzip >`cat .fname`.tgz
X rm -rf `cat .fname` .fname
X
Xshar: $(DISTFILES)
X shar -a -m -M -L50 -n$(THIS) -oPart $(DISTFILES)
X
X$(THIS).o: config.h
X
Xcheck: $(THIS)
X sh ./run_test.sh
END_OF_FILE
if test 2436 -ne `wc -c <'conflict-6.0/makefile.in'`; then
echo shar: \"'conflict-6.0/makefile.in'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/makefile.in'
fi
if test -f 'conflict-6.0/mkdirs.sh' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/mkdirs.sh'\"
else
echo shar: Extracting \"'conflict-6.0/mkdirs.sh'\" \(649 characters\)
sed "s/^X//" >'conflict-6.0/mkdirs.sh' <<'END_OF_FILE'
X#!/bin/sh
X# mkinstalldirs --- make directory hierarchy
X# Author: Noah Friedman <frie...@prep.ai.mit.edu>
X# Created: 1993-05-16
X# Last modified: 1994-03-25
X# Public domain
X
Xerrstatus=0
X
Xfor file in ${1+"$@"} ; do
X set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
X shift
X
X pathcomp=
X for d in ${1+"$@"} ; do
X pathcomp="$pathcomp$d"
X case "$pathcomp" in
X -* ) pathcomp=./$pathcomp ;;
X esac
X
X if test ! -d "$pathcomp"; then
X echo "mkdir $pathcomp" 1>&2
X mkdir "$pathcomp" || errstatus=$?
X fi
X
X pathcomp="$pathcomp/"
X done
Xdone
X
Xexit $errstatus
X
X# mkinstalldirs ends here
END_OF_FILE
if test 649 -ne `wc -c <'conflict-6.0/mkdirs.sh'`; then
echo shar: \"'conflict-6.0/mkdirs.sh'\" unpacked with wrong size!
fi
chmod +x 'conflict-6.0/mkdirs.sh'
# end of 'conflict-6.0/mkdirs.sh'
fi
if test -f 'conflict-6.0/msdos.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/msdos.c'\"
else
echo shar: Extracting \"'conflict-6.0/msdos.c'\" \(2574 characters\)
sed "s/^X//" >'conflict-6.0/msdos.c' <<'END_OF_FILE'


X/******************************************************************************
X * Copyright 1995 by Thomas E. Dickey. All Rights Reserved. *
X * *
X * You may freely copy or redistribute this software, so long as there is no *
X * profit made from its use, sale trade or reproduction. You may not change *
X * this copyright notice, and it must be included in any copy made. *
X ******************************************************************************/
X#ifndef NO_IDENT

Xstatic char *Id = "$Id: msdos.c,v 6.0 1995/03/13 00:23:48 dickey Rel $";
X#endif
X
X/*
X * MSDOS (and some OS/2) support functions.
X */
X
X#include "conflict.h"
X#include <ctype.h>
X
Xchar *
Xfleaf (char *name)
X{
X char *s;
X
X while ((s = strpbrk(name, ":/\\")) != 0) {
X name = s+1;
X }
X return name;
X}
X
Xchar *
Xftype (char *name)


X{
X char *leaf = fleaf(name);
X char *type = strrchr(leaf, '.');
X if (type == 0)
X type = leaf + strlen(leaf);
X return type;
X}
X

Xvoid blip(int c)
X{
X putc(c, stderr);
X}
X
Xint
Xhave_drive (char *name)
X{
X return (isalpha(name[0]) && name[1] == ':');
X}
X
Xint
Xsame_drive (char *a, char *b)
X{
X return have_drive(a) && have_drive(b) && (*a == *b);
X}
X
Xint
Xset_directory (char *name)
X{
X return set_drive(name) && (chdir(name) >= 0);
X}
X
X#if SYS_MSDOS
X#include <dos.h> /* ...for _getdrive/_setdrive */
X
Xint
Xset_drive (char *name)
X{
X if (have_drive(name)) {
X unsigned want = name[0] - 'A';
X unsigned have;
X bdos(0x0e, want, 0); /* set drive */
X have = (bdos(0x19, 0, 0) & 0xff); /* get drive */
X if (want != have)
X return FALSE;
X }
X return TRUE;
X}
X#endif /* SYS_MSDOS */
X
X#ifndef HAVE_GETOPT
Xint optind;
Xchar *optarg;
X
X /*
X * This version of 'getopt()' uses either '/' or '-' for the switch
X * character to look more like a native dos or os/2 application.
X */
Xint getopt(int argc, char **argv, char *opts)
X{
X int code = EOF;
X char *s, *t;
X
X if (optind == 0) {
X optind = 1;
X optarg = "";
X }
X if (optind < argc) {
X s = argv[optind];
X if (*s == '/' || *s == '-') {
X optind++;
X code = '?';
X if (*++s != EOS) {
X t = strchr(opts, *s++);
X if (t != 0 && *t != ':') {
X code = *t++;
X if (*t == ':') {
X if (*s != EOS)
X optarg = s;
X else if (optind < argc)
X optarg = argv[optind++];
X } else if (*s != EOS) {
X optind--;
X while ((s[-1] = s[0]) != EOS)
X s++;


X }
X }
X }
X }
X }

X return code;
X}
X#endif
X
X#if !HAVE_REALPATH
Xchar *my_realpath(char *given, char *actual)
X{
X return (_fullpath(actual, given, MAXPATHLEN));
X}
X#endif
END_OF_FILE
if test 2574 -ne `wc -c <'conflict-6.0/msdos.c'`; then
echo shar: \"'conflict-6.0/msdos.c'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/msdos.c'
fi
if test -f 'conflict-6.0/os2.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/os2.c'\"
else
echo shar: Extracting \"'conflict-6.0/os2.c'\" \(1002 characters\)
sed "s/^X//" >'conflict-6.0/os2.c' <<'END_OF_FILE'


X/******************************************************************************
X * Copyright 1995 by Thomas E. Dickey. All Rights Reserved. *
X * *
X * You may freely copy or redistribute this software, so long as there is no *
X * profit made from its use, sale trade or reproduction. You may not change *
X * this copyright notice, and it must be included in any copy made. *
X ******************************************************************************/
X#ifndef NO_IDENT

Xstatic char *Id = "$Id: os2.c,v 6.0 1995/03/12 02:02:26 dickey Rel $";


X#endif
X
X#include "conflict.h"
X

X#if SYS_OS2
X#include <dos.h> /* ...for _getdrive/_setdrive */
X
Xint
Xset_drive (char *name)
X{
X if (have_drive(name)) {
X unsigned want = name[0] - 'A' + 1;
X unsigned have;
X unsigned total;
X _dos_setdrive(want, &total);
X _dos_getdrive(&have);
X if (want != have)
X return FALSE;
X }
X return TRUE;
X}
X#endif /* SYS_OS2 */
END_OF_FILE
if test 1002 -ne `wc -c <'conflict-6.0/os2.c'`; then
echo shar: \"'conflict-6.0/os2.c'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/os2.c'
fi
if test -f 'conflict-6.0/patchlev.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/patchlev.h'\"
else
echo shar: Extracting \"'conflict-6.0/patchlev.h'\" \(21 characters\)
sed "s/^X//" >'conflict-6.0/patchlev.h' <<'END_OF_FILE'
X#define PATCHLEVEL 0
END_OF_FILE
if test 21 -ne `wc -c <'conflict-6.0/patchlev.h'`; then
echo shar: \"'conflict-6.0/patchlev.h'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/patchlev.h'
fi
if test -f 'conflict-6.0/run_test.sh' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/run_test.sh'\"
else
echo shar: Extracting \"'conflict-6.0/run_test.sh'\" \(695 characters\)
sed "s/^X//" >'conflict-6.0/run_test.sh' <<'END_OF_FILE'
X#!/bin/sh
X# $Id: run_test.sh,v 6.0 1995/03/18 13:33:43 dickey Rel $
X# Run a test to show that CONFLICT is working
XBIN=`pwd`
XPROG=$BIN/conflict
XPATH=".:$BIN:/bin"; export PATH
X#
Xcat <<eof/
X**
X** Set PATH = $PATH
X** This produces no conflict (unless /bin contains conflict!):
Xeof/
X$PROG
X#
Xcat <<eof/
X**
X** Set PATH = $PATH
X** This shows conflict between different filetypes
Xeof/
X$PROG -r -t.c.o. conflict
Xcat <<eof/
X**
X** Set PATH = $PATH
X** This repeats the last test, with pathnames-only
Xeof/
X$PROG -p -r -t.c.o. conflict
Xcat <<eof/
X**
X** Add a dummy executable in the temp-directory, producing a conflict:
Xeof/
Xcd /tmp
Xrm -f conflict
Xecho test >conflict
Xchmod 755 conflict
X$PROG
Xrm -f conflict
END_OF_FILE
if test 695 -ne `wc -c <'conflict-6.0/run_test.sh'`; then
echo shar: \"'conflict-6.0/run_test.sh'\" unpacked with wrong size!
fi
chmod +x 'conflict-6.0/run_test.sh'
# end of 'conflict-6.0/run_test.sh'
fi
if test -f 'conflict-6.0/txtalloc.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conflict-6.0/txtalloc.c'\"
else
echo shar: Extracting \"'conflict-6.0/txtalloc.c'\" \(4475 characters\)
sed "s/^X//" >'conflict-6.0/txtalloc.c' <<'END_OF_FILE'


X/******************************************************************************
X * Copyright 1995 by Thomas E. Dickey. All Rights Reserved. *
X * *
X * You may freely copy or redistribute this software, so long as there is no *
X * profit made from its use, sale trade or reproduction. You may not change *
X * this copyright notice, and it must be included in any copy made. *
X ******************************************************************************/
X#ifndef NO_IDENT

Xstatic char Id[] = "$Id: txtalloc.c,v 6.0 1995/03/11 17:35:06 dickey Rel $";
X#endif
X
X/*
X * Title: txtalloc.c (text-allocator)
X * Author: T.E.Dickey
X * Created: 29 Apr 1988
X *
X * Function: Maintains a balanced binary tree of character strings.
X * The algorithm is taken from "The Art of Computer Programming
X * -- Volume 3 -- Sorting and Searching", by Donald Knuth.
X */
X
X#include "conflict.h"
X
Xtypedef struct _node {
X struct _node *links[2];
X char balance; /* holds 0, -1, +1 */
X char value[1]; /* 1 for the EOS... */
X } TNODE;
X
X#define llink links[0]
X#define rlink links[1]
X
X /* definitions to make this simple, like Knuth */
X#define LLINK(p) p->llink
X#define RLINK(p) p->rlink
X#define KEY(p) p->value
X#define B(p) p->balance
X
X#define LINK(a,p) p->links[(a)>0]
X
Xstatic TNODE head;
X
Xstatic
XTNODE * new_TNODE(text)
X char *text;
X{
X register TNODE *p = TypeAllocN(TNODE, strlen(text));
X (void)strcpy(KEY(p),text);
X LLINK(p) =
X RLINK(p) = 0;
X B(p) = 0;
X return (p);
X}
X
Xchar * txtalloc(text)
X char *text;
X{
X /* (A1:Initialize) */
Xregister
XTNODE *t = &head, /* 't' points to the father of 's' */
X *s = RLINK(t), /* 's' points to rebalancing point */
X *p = RLINK(t), /* 'p' moves down the tree */
X *q,
X *r;
Xregister
Xint a;
Xchar *value;
X
X if (p == 0) {
X RLINK(t) = p = new_TNODE(text);
X return (KEY(p));
X }
X /* (A2:Compare) */
X while ((a = strcmp(text, value = KEY(p))) != 0) {
X /* (A3,A4: move left/right accordingly) */
X if ((q = LINK(a,p)) != NULL) {
X if (B(q)) {
X t = p;
X s = q;
X }
X p = q;
X /* ...continue comparing */
X } else {
X /* (A5:Insert) */
X LINK(a,p) = q = new_TNODE(text);
X value = KEY(q);
X
X /* (A6:Adjust balance factors) */
X /*
X * Now the balance factors on nodes between 's' and 'q'
X * need to be changed from zero to +/- 1.
X */
X if (strcmp(text, KEY(s)) < 0)
X r = p = LLINK(s);
X else
X r = p = RLINK(s);
X
X while (p != q) {
X if ((a = strcmp(text, KEY(p))) != 0) {
X B(p) = (a < 0) ? -1 : 1;
X p = LINK(a,p);
X }
X }
X
X /* (A7:Balancing act) */
X a = (strcmp(text, KEY(s)) < 0) ? -1 : 1;
X
X if (B(s) == 0) {
X /* ...the tree has grown higher */
X B(s) = a;
X head.llink++;
X } else if (B(s) == -a) {
X /* ...the tree has gotten more balanced */
X B(s) = 0;
X } else if (B(s) == a) {
X /* ...the tree has gotten out of balance */
X if (B(r) == a) {
X /* (A8:Single rotation) */
X p = r;
X LINK(a,s) = LINK(-a,r);
X LINK(-a,r) = s;
X
X B(s) = B(r) = 0;
X } else if (B(r) == -a) {
X /* (A9: Double rotation) */
X p = LINK(-a,r);
X LINK(-a,r) = LINK(a,p);
X LINK(a,p) = r;
X LINK(a,s) = LINK(-a,p);
X LINK(-a,p) = s;
X
X if (B(p) == a)
X { B(s) = -a; B(r) = 0; }
X else if (B(p) == 0)
X { B(s) = B(r) = 0; }
X else if (B(p) == -a)
X { B(s) = 0; B(r) = a; }
X
X B(p) = 0;
X }
X /* A10:Finishing touch */
X t->links[(s == RLINK(t))] = p;
X }
X break;
X }
X }
X return (value);
X}
X
X/*
X * Dummy entry for consistency
X */
Xvoid txtfree(text)
X char *text;
X{
X /* patch */
X}
X
X/******************************************************************************/
X#if NO_LEAKS || defined(TEST)
Xstatic
Xvoid free_TNODE(p)
X TNODE *p;
X{
X if (p != 0) {
X free_TNODE(p->llink);
X free_TNODE(p->rlink);
X free((char *)p);
X }
X}
X
Xvoid free_txtalloc()
X{
X free_TNODE(head.rlink);
X}
X#endif /* NO_LEAKS */
X
X/******************************************************************************/
X#ifdef TEST
Xvoid txtdump(p, level)
X TNODE * p;
X int level;
X{
X register int j;
X
X if (p) {
X txtdump(LLINK(p), level+1);
X for (j = 0; j < level; j++)
X printf(". ");
X printf("%s (%d)\n", KEY(p), B(p));
X txtdump(RLINK(p), level+1);
X }
X}
X
Xint main(argc, argv)
X int argc;
X char *argv[];
X{
X register int j;
X for (j = 1; j < argc; j++)
X (void)txtalloc(argv[j]);
X txtdump(head.rlink,0);
X free_txtalloc();
X exit(SUCCESS);
X /*NOTREACHED*/
X}
X#endif
END_OF_FILE
if test 4475 -ne `wc -c <'conflict-6.0/txtalloc.c'`; then
echo shar: \"'conflict-6.0/txtalloc.c'\" unpacked with wrong size!
fi
# end of 'conflict-6.0/txtalloc.c'
fi
echo shar: End of archive 2 \(of 2\).
cp /dev/null ark2isdone

Reply all
Reply to author
Forward
0 new messages