diff options
25 files changed, 2628 insertions, 2329 deletions
diff --git a/gnu/usr.bin/cvs/configure b/gnu/usr.bin/cvs/configure index 775d6b3c540..8ed5f829c2a 100644 --- a/gnu/usr.bin/cvs/configure +++ b/gnu/usr.bin/cvs/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12 +# Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -61,6 +61,7 @@ mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 @@ -344,7 +345,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -514,9 +515,11 @@ ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross +ac_exeext= +ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -531,19 +534,97 @@ fi +if test "x$prefix" = xNONE; then +echo $ac_n "checking for prefix by $ac_c" 1>&6 +# Extract the first word of "cvs", so it can be a program name with args. +set dummy cvs; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:543: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_CVS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$CVS" in + /*) + ac_cv_path_CVS="$CVS" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_CVS="$CVS" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_CVS="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +CVS="$ac_cv_path_CVS" +if test -n "$CVS"; then + echo "$ac_t""$CVS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -n "$ac_cv_path_CVS"; then + prefix=`echo $ac_cv_path_CVS|sed 's%/[^/][^/]*//*[^/][^/]*$%%'` + fi +fi + + + +for ac_prog in mawk gawk nawk awk +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:587: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AWK="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AWK="$ac_cv_prog_AWK" +if test -n "$AWK"; then + echo "$ac_t""$AWK" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AWK" && break +done # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:539: checking for $ac_word" >&5 +echo "configure:619: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -564,16 +645,17 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:568: checking for $ac_word" >&5 +echo "configure:649: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then @@ -608,25 +690,61 @@ else echo "$ac_t""no" 1>&6 fi + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:700: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:616: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:732: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -cat > conftest.$ac_ext <<EOF -#line 626 "configure" +cat > conftest.$ac_ext << EOF + +#line 743 "configure" #include "confdefs.h" + main(){return(0);} EOF -if { (eval echo configure:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -640,18 +758,24 @@ else ac_cv_prog_cc_works=no fi rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:650: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:774: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:655: checking whether we are using GNU C" >&5 +echo "configure:779: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -660,7 +784,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:664: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:788: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -671,11 +795,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:679: checking whether ${CC-cc} accepts -g" >&5 +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:807: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -690,296 +818,22 @@ rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then CFLAGS="-g -O2" else - CFLAGS="-O2" + CFLAGS="-g" fi else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:708: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 723 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 740 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:746: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:769: checking for AIX" >&5 -cat > conftest.$ac_ext <<EOF -#line 771 "configure" -#include "confdefs.h" -#ifdef _AIX - yes -#endif - -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF -#define _ALL_SOURCE 1 -EOF - -else - rm -rf conftest* - echo "$ac_t""no" 1>&6 -fi -rm -f conftest* - - -ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:794: checking for minix/config.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 799 "configure" -#include "confdefs.h" -#include <minix/config.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - MINIX=yes -else - echo "$ac_t""no" 1>&6 -MINIX= -fi - -if test "$MINIX" = yes; then - cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - cat >> confdefs.h <<\EOF -#define _POSIX_1_SOURCE 2 -EOF - - cat >> confdefs.h <<\EOF -#define _MINIX 1 -EOF - -fi - -echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:842: checking for POSIXized ISC" >&5 -if test -d /etc/conf/kconfig.d && - grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 -then - echo "$ac_t""yes" 1>&6 - ISC=yes # If later tests want to check for ISC. - cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - if test "$GCC" = yes; then - CC="$CC -posix" + CFLAGS="-O2" else - CC="$CC -Xp" + CFLAGS= fi -else - echo "$ac_t""no" 1>&6 - ISC= fi -if test "$ISC" = yes; then -CFLAGS="$CFLAGS -D_SYSV3" -LIBS="-lcrypt $LIBS" -fi - -if test "x$prefix" = xNONE; then -echo $ac_n "checking for prefix by $ac_c" 1>&6 -# Extract the first word of "cvs", so it can be a program name with args. -set dummy cvs; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:872: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_CVS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$CVS" in - /*) - ac_cv_path_CVS="$CVS" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_CVS="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - ;; -esac -fi -CVS="$ac_cv_path_CVS" -if test -n "$CVS"; then - echo "$ac_t""$CVS" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -n "$ac_cv_path_CVS"; then - prefix=`echo $ac_cv_path_CVS|sed 's%/[^/][^/]*//*[^/][^/]*$%%'` - fi -fi - - - - -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:909: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 914 "configure" -#include "confdefs.h" - -int main() { - -/* Ultrix mips cc rejects this. */ -typedef int charset[2]; const charset x; -/* SunOS 4.1.1 cc rejects this. */ -char const *const *ccp; -char **p; -/* NEC SVR4.0.2 mips cc rejects this. */ -struct point {int x, y;}; -static struct point const zero = {0,0}; -/* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in an arm - of an if-expression whose if-part is not a constant expression */ -const char *g = "string"; -ccp = &g + (g ? g-g : 0); -/* HPUX 7.0 cc rejects these. */ -++ccp; -p = (char**) ccp; -ccp = (char const *const *) p; -{ /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; -} -{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; -} -{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; -} -{ /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - -; return 0; } -EOF -if { (eval echo configure:963: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_const=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 -if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF - -fi - - ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -1006,28 +860,30 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1014: checking for a BSD compatible install" >&5 +echo "configure:869: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. : else ac_cv_path_install="$ac_dir/$ac_prog -c" @@ -1057,20 +913,50 @@ echo "$ac_t""$INSTALL" 1>&6 # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:922: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1066: checking for $ac_word" >&5 +echo "configure:951: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="ranlib" @@ -1093,15 +979,16 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1097: checking for $ac_word" >&5 +echo "configure:983: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_YACC="$ac_prog" @@ -1122,38 +1009,11 @@ test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1127: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1157: checking for $ac_word" >&5 +echo "configure:1017: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_perl_path'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1161,9 +1021,13 @@ else /*) ac_cv_path_perl_path="$perl_path" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_perl_path="$perl_path" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_perl_path="$ac_dir/$ac_word" @@ -1185,7 +1049,7 @@ fi # Extract the first word of "csh", so it can be a program name with args. set dummy csh; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1189: checking for $ac_word" >&5 +echo "configure:1053: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_csh_path'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1193,9 +1057,13 @@ else /*) ac_cv_path_csh_path="$csh_path" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_csh_path="$csh_path" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_csh_path="$ac_dir/$ac_word" @@ -1218,7 +1086,7 @@ fi # Pull the hash mark out of the macro call to avoid m4 problems. ac_msg="whether #! works in shell scripts" echo $ac_n "checking $ac_msg""... $ac_c" 1>&6 -echo "configure:1222: checking $ac_msg" >&5 +echo "configure:1090: checking $ac_msg" >&5 if eval "test \"`echo '$''{'ac_cv_sys_interpreter'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1236,6 +1104,7 @@ rm -f conftest fi echo "$ac_t""$ac_cv_sys_interpreter" 1>&6 +interpval="$ac_cv_sys_interpreter" if test X"$ac_cv_sys_interpreter" != X"yes" ; then # silly trick to avoid problems in AC macros... @@ -1243,13 +1112,317 @@ if test X"$ac_cv_sys_interpreter" != X"yes" ; then echo "configure: warning: $ac_msg" 1>&2 fi +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1117: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +#line 1132 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1138: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +#line 1149 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext <<EOF +#line 1166 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for AIX""... $ac_c" 1>&6 +echo "configure:1197: checking for AIX" >&5 +cat > conftest.$ac_ext <<EOF +#line 1199 "configure" +#include "confdefs.h" +#ifdef _AIX + yes +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF +#define _ALL_SOURCE 1 +EOF + +else + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + + +ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 +echo "configure:1222: checking for minix/config.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1227 "configure" +#include "confdefs.h" +#include <minix/config.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1232: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + MINIX=yes +else + echo "$ac_t""no" 1>&6 +MINIX= +fi + +if test "$MINIX" = yes; then + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + cat >> confdefs.h <<\EOF +#define _POSIX_1_SOURCE 2 +EOF + + cat >> confdefs.h <<\EOF +#define _MINIX 1 +EOF + +fi + +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:1270: checking for POSIXized ISC" >&5 +if test -d /etc/conf/kconfig.d && + grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 +then + echo "$ac_t""yes" 1>&6 + ISC=yes # If later tests want to check for ISC. + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + echo "$ac_t""no" 1>&6 + ISC= +fi + +if test "$ISC" = yes; then +CFLAGS="$CFLAGS -D_SYSV3" +LIBS="-lcrypt $LIBS" +fi + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 +echo "configure:1300: checking for $ac_hdr that defines DIR" >&5 +if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1305 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } +EOF +if { (eval echo configure:1313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + ac_header_dirent=$ac_hdr; break +else + echo "$ac_t""no" 1>&6 +fi +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 +echo "configure:1338: checking for opendir in -ldir" >&5 +ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1346 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir(); + +int main() { +opendir() +; return 0; } +EOF +if { (eval echo configure:1357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" +else + echo "$ac_t""no" 1>&6 +fi + +else +echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 +echo "configure:1379: checking for opendir in -lx" >&5 +ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1387 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir(); + +int main() { +opendir() +; return 0; } +EOF +if { (eval echo configure:1398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lx" +else + echo "$ac_t""no" 1>&6 +fi + +fi + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1248: checking for ANSI C header files" >&5 +echo "configure:1421: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1253 "configure" +#line 1426 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1257,8 +1430,8 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1261: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` +{ (eval echo configure:1434: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes @@ -1274,7 +1447,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1278 "configure" +#line 1451 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1292,7 +1465,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1296 "configure" +#line 1469 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1313,7 +1486,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1317 "configure" +#line 1490 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1324,7 +1497,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1347,56 +1520,13 @@ EOF fi -for ac_hdr in errno.h unistd.h string.h memory.h utime.h fcntl.h ndbm.h \ - limits.h sys/file.h \ - sys/param.h sys/select.h sys/time.h sys/timeb.h \ - io.h direct.h sys/bsdtypes.h sys/resource.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1358: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1363 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1368: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1395: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1525: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1400 "configure" +#line 1530 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -1412,7 +1542,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1546: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1432,13 +1562,56 @@ EOF fi +for ac_hdr in errno.h unistd.h string.h memory.h utime.h fcntl.h ndbm.h \ + limits.h sys/file.h \ + sys/param.h sys/select.h sys/time.h sys/timeb.h \ + io.h direct.h sys/bsdtypes.h sys/resource.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1573: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1578 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1583: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:1437: checking whether stat file-mode macros are broken" >&5 +echo "configure:1610: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1442 "configure" +#line 1615 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1489,12 +1662,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1493: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1666: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1498 "configure" +#line 1671 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -1503,7 +1676,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1507: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1523,179 +1696,89 @@ EOF fi -ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1532: checking for $ac_hdr that defines DIR" >&5 -if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1537 "configure" -#include "confdefs.h" -#include <sys/types.h> -#include <$ac_hdr> -int main() { -DIR *dirp = 0; -; return 0; } -EOF -if { (eval echo configure:1545: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - eval "ac_cv_header_dirent_$ac_safe=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_dirent_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - ac_header_dirent=$ac_hdr; break -else - echo "$ac_t""no" 1>&6 -fi -done -# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. -if test $ac_header_dirent = dirent.h; then -echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1570: checking for opendir in -ldir" >&5 -ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldir $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1578 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir(); - -int main() { -opendir() -; return 0; } -EOF -if { (eval echo configure:1589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -ldir" -else - echo "$ac_t""no" 1>&6 -fi -else -echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1611: checking for opendir in -lx" >&5 -ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1702: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-lx $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1619 "configure" + cat > conftest.$ac_ext <<EOF +#line 1707 "configure" #include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir(); int main() { -opendir() -; return 0; } -EOF -if { (eval echo configure:1630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -lx" -else - echo "$ac_t""no" 1>&6 -fi -fi +/* Ultrix mips cc rejects this. */ +typedef int charset[2]; const charset x; +/* SunOS 4.1.1 cc rejects this. */ +char const *const *ccp; +char **p; +/* NEC SVR4.0.2 mips cc rejects this. */ +struct point {int x, y;}; +static struct point const zero = {0,0}; +/* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in an arm + of an if-expression whose if-part is not a constant expression */ +const char *g = "string"; +ccp = &g + (g ? g-g : 0); +/* HPUX 7.0 cc rejects these. */ +++ccp; +p = (char**) ccp; +ccp = (char const *const *) p; +{ /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; -echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1653: checking return type of signal handlers" >&5 -if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1658 "configure" -#include "confdefs.h" -#include <sys/types.h> -#include <signal.h> -#ifdef signal -#undef signal -#endif -#ifdef __cplusplus -extern "C" void (*signal (int, void (*)(int)))(int); -#else -void (*signal ()) (); -#endif + *t++ = 0; +} +{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; +} +{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; +} +{ /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} -int main() { -int i; ; return 0; } EOF -if { (eval echo configure:1675: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1756: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - ac_cv_type_signal=void + ac_cv_c_const=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_type_signal=int + ac_cv_c_const=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_type_signal" 1>&6 -cat >> confdefs.h <<EOF -#define RETSIGTYPE $ac_cv_type_signal +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const EOF +fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:1694: checking for uid_t in sys/types.h" >&5 +echo "configure:1777: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1699 "configure" +#line 1782 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -1724,12 +1807,12 @@ EOF fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:1728: checking for mode_t" >&5 +echo "configure:1811: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1733 "configure" +#line 1816 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1738,7 +1821,7 @@ else #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_mode_t=yes else @@ -1756,13 +1839,13 @@ EOF fi -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1761: checking for size_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:1844: checking for pid_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1766 "configure" +#line 1849 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1771,31 +1854,31 @@ else #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* - ac_cv_type_size_t=yes + ac_cv_type_pid_t=yes else rm -rf conftest* - ac_cv_type_size_t=no + ac_cv_type_pid_t=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_type_size_t" 1>&6 -if test $ac_cv_type_size_t = no; then +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then cat >> confdefs.h <<\EOF -#define size_t unsigned +#define pid_t int EOF fi -echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1794: checking for pid_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:1877: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1799 "configure" +#line 1882 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1804,31 +1887,73 @@ else #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* - ac_cv_type_pid_t=yes + ac_cv_type_size_t=yes else rm -rf conftest* - ac_cv_type_pid_t=no + ac_cv_type_size_t=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_type_pid_t" 1>&6 -if test $ac_cv_type_pid_t = no; then +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then cat >> confdefs.h <<\EOF -#define pid_t int +#define size_t unsigned EOF fi +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:1910: checking return type of signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1915 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <signal.h> +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:1932: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <<EOF +#define RETSIGTYPE $ac_cv_type_signal +EOF + + + echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:1827: checking for st_blksize in struct stat" >&5 +echo "configure:1952: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1832 "configure" +#line 1957 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1836,7 +1961,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:1840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -1856,15 +1981,49 @@ EOF fi +echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 +echo "configure:1986: checking for st_rdev in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1991 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_rdev; +; return 0; } +EOF +if { (eval echo configure:1999: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_rdev=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_rdev=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6 +if test $ac_cv_struct_st_rdev = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_RDEV 1 +EOF + +fi + for ac_func in mkdir rename strstr dup2 strerror valloc waitpid memmove strtoul do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1863: checking for $ac_func" >&5 +echo "configure:2022: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1868 "configure" +#line 2027 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1887,7 +2046,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1908,20 +2067,20 @@ EOF else echo "$ac_t""no" 1>&6 -LIBOBJS="$LIBOBJS ${ac_func}.o" +LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" fi done -for ac_func in fchmod fsync ftime mktemp putenv vprintf ftruncate timezone getpagesize initgroups fchdir sigaction sigprocmask sigvec sigsetmask sigblock tempnam tzset readlink wait3 +for ac_func in fchmod fsync ftime mktemp putenv vprintf ftruncate timezone getpagesize initgroups fchdir sigaction sigprocmask sigvec sigsetmask sigblock tempnam tzset readlink wait3 mknod getpassphrase do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1920: checking for $ac_func" >&5 +echo "configure:2079: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1925 "configure" +#line 2084 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1944,7 +2103,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1978,20 +2137,28 @@ cat >> confdefs.h <<\EOF EOF +cat >> confdefs.h <<\EOF +#define REGEX_MALLOC 1 +EOF + +cat >> confdefs.h <<\EOF +#define _REGEX_RE_COMP 1 +EOF + ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:1984: checking for vfork.h" >&5 +echo "configure:2151: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1989 "configure" +#line 2156 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` +{ (eval echo configure:2161: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" @@ -2015,18 +2182,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2019: checking for working vfork" >&5 +echo "configure:2186: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2025: checking for vfork" >&5 +echo "configure:2192: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2030 "configure" +#line 2197 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -2049,7 +2216,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:2053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -2068,9 +2235,10 @@ else echo "$ac_t""no" 1>&6 fi +ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext <<EOF -#line 2074 "configure" +#line 2242 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -2165,7 +2333,7 @@ main() { } } EOF -if { (eval echo configure:2169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -2188,7 +2356,7 @@ EOF fi echo $ac_n "checking whether closedir returns void""... $ac_c" 1>&6 -echo "configure:2192: checking whether closedir returns void" >&5 +echo "configure:2360: checking whether closedir returns void" >&5 if eval "test \"`echo '$''{'ac_cv_func_closedir_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2196,13 +2364,13 @@ else ac_cv_func_closedir_void=yes else cat > conftest.$ac_ext <<EOF -#line 2200 "configure" +#line 2368 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_header_dirent> int closedir(); main() { exit(closedir(opendir(".")) != 0); } EOF -if { (eval echo configure:2206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_closedir_void=no else @@ -2225,16 +2393,16 @@ EOF fi -echo $ac_n "checking for getspnam in -lsec""... $ac_c" 1>&6 -echo "configure:2230: checking for getspnam in -lsec" >&5 -ac_lib_var=`echo sec'_'getspnam | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + +echo $ac_n "checking for library containing getspnam""... $ac_c" 1>&6 +echo "configure:2399: checking for library containing getspnam" >&5 +if eval "test \"`echo '$''{'ac_cv_search_getspnam'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-lsec $LIBS" + ac_func_search_save_LIBS="$LIBS" +ac_cv_search_getspnam="no" cat > conftest.$ac_ext <<EOF -#line 2238 "configure" +#line 2406 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2245,91 +2413,54 @@ int main() { getspnam() ; return 0; } EOF -if { (eval echo configure:2249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + ac_cv_search_getspnam="none required" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo sec | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF - - LIBS="-lsec $LIBS" - -else - echo "$ac_t""no" 1>&6 -fi - -for ac_func in getspnam -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2279: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2284 "configure" +test "$ac_cv_search_getspnam" = "no" && for i in sec gen; do +LIBS="-l$i $ac_func_search_save_LIBS" +cat > conftest.$ac_ext <<EOF +#line 2428 "configure" #include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func(); +char getspnam(); int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - +getspnam() ; return 0; } EOF -if { (eval echo configure:2307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" + ac_cv_search_getspnam="-l$i" +break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" fi rm -f conftest* +done +LIBS="$ac_func_search_save_LIBS" fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 +echo "$ac_t""$ac_cv_search_getspnam" 1>&6 +if test "$ac_cv_search_getspnam" != "no"; then + test "$ac_cv_search_getspnam" = "none required" || LIBS="$ac_cv_search_getspnam $LIBS" + cat >> confdefs.h <<\EOF +#define HAVE_GETSPNAM 1 EOF - -else - echo "$ac_t""no" 1>&6 -fi -done +else : + +fi echo $ac_n "checking for zlibVersion in -lz""... $ac_c" 1>&6 -echo "configure:2333: checking for zlibVersion in -lz" >&5 +echo "configure:2464: checking for zlibVersion in -lz" >&5 ac_lib_var=`echo z'_'zlibVersion | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2337,7 +2468,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <<EOF -#line 2341 "configure" +#line 2472 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2348,7 +2479,7 @@ int main() { zlibVersion() ; return 0; } EOF -if { (eval echo configure:2352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2374,7 +2505,7 @@ fi echo $ac_n "checking whether utime accepts a null argument""... $ac_c" 1>&6 -echo "configure:2378: checking whether utime accepts a null argument" >&5 +echo "configure:2509: checking whether utime accepts a null argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_utime_null'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2384,7 +2515,7 @@ if test "$cross_compiling" = yes; then ac_cv_func_utime_null=no else cat > conftest.$ac_ext <<EOF -#line 2388 "configure" +#line 2519 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -2395,7 +2526,7 @@ exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0 && t.st_mtime - s.st_mtime < 120)); } EOF -if { (eval echo configure:2399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_utime_null=yes else @@ -2419,7 +2550,7 @@ EOF fi echo $ac_n "checking for long file names""... $ac_c" 1>&6 -echo "configure:2423: checking for long file names" >&5 +echo "configure:2554: checking for long file names" >&5 if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2463,209 +2594,157 @@ EOF fi -echo $ac_n "checking for working fnmatch function""... $ac_c" 1>&6 -echo "configure:2468: checking for working fnmatch function" >&5 -if eval "test \"`echo '$''{'ccvs_cv_sys_working_fnmatch'+set}'`\" = set"; then +echo $ac_n "checking for working fnmatch""... $ac_c" 1>&6 +echo "configure:2599: checking for working fnmatch" >&5 +if eval "test \"`echo '$''{'ac_cv_func_fnmatch_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - ccvs_cv_sys_working_fnmatch=no + # Some versions of Solaris or SCO have a broken fnmatch function. +# So we run a test program. If we are cross-compiling, take no chance. +# Thanks to John Oleynick and Franc,ois Pinard for this test. +if test "$cross_compiling" = yes; then + ac_cv_func_fnmatch_works=no else cat > conftest.$ac_ext <<EOF -#line 2476 "configure" +#line 2610 "configure" #include "confdefs.h" - -#include <fnmatch.h> -int -main () -{ - exit ((fnmatch ("a", "a", FNM_PATHNAME) == 0 - && fnmatch ("a", "b", FNM_PATHNAME) == FNM_NOMATCH) - ? 0 : 1); -} +main() { exit (fnmatch ("a*", "abc", 0) != 0); } EOF -if { (eval echo configure:2488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then - ccvs_cv_sys_working_fnmatch=yes + ac_cv_func_fnmatch_works=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* - ccvs_cv_sys_working_fnmatch=no + ac_cv_func_fnmatch_works=no fi rm -fr conftest* fi fi -if test $ccvs_cv_sys_working_fnmatch = no; then +echo "$ac_t""$ac_cv_func_fnmatch_works" 1>&6 +if test $ac_cv_func_fnmatch_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_FNMATCH 1 +EOF + +fi + +if test "$ac_cv_func_fnmatch_works" = no; then LIBOBJS="$LIBOBJS fnmatch.o" fi -echo "$ac_t""$ccvs_cv_sys_working_fnmatch" 1>&6 -# If we can't find connect, try looking in -lsocket, -lnsl, and -linet. -# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has -# libsocket.so which has a bad implementation of gethostbyname (it -# only looks in /etc/hosts), so we only look for -lsocket if we need -# it. -echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:2513: checking for connect" >&5 -if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then +# Try to find connect and gethostbyname. +echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6 +echo "configure:2642: checking for main in -lnsl" >&5 +ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <<EOF -#line 2518 "configure" + ac_save_LIBS="$LIBS" +LIBS="-lnsl $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2650 "configure" #include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char connect(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char connect(); int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_connect) || defined (__stub___connect) -choke me -#else -connect(); -#endif - +main() ; return 0; } EOF -if { (eval echo configure:2541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_func_connect=yes" + eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_func_connect=no" + eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -fi +LIBS="$ac_save_LIBS" -if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -case "$LIBS" in -*-lnsl*) ;; -*) echo $ac_n "checking for printf in -lnsl_s""... $ac_c" 1>&6 -echo "configure:2561: checking for printf in -lnsl_s" >&5 -ac_lib_var=`echo nsl_s'_'printf | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + +echo $ac_n "checking for library containing connect""... $ac_c" 1>&6 +echo "configure:2674: checking for library containing connect" >&5 +if eval "test \"`echo '$''{'ac_cv_search_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-lnsl_s $LIBS" + ac_func_search_save_LIBS="$LIBS" +ac_cv_search_connect="no" cat > conftest.$ac_ext <<EOF -#line 2569 "configure" +#line 2681 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char printf(); +char connect(); int main() { -printf() +connect() ; return 0; } EOF -if { (eval echo configure:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + ac_cv_search_connect="none required" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo nsl_s | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF - - LIBS="-lnsl_s $LIBS" - -else - echo "$ac_t""no" 1>&6 -fi - ;; -esac -case "$LIBS" in -*-lnsl*) ;; -*) echo $ac_n "checking for printf in -lnsl""... $ac_c" 1>&6 -echo "configure:2611: checking for printf in -lnsl" >&5 -ac_lib_var=`echo nsl'_'printf | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lnsl $LIBS" +test "$ac_cv_search_connect" = "no" && for i in xnet socket inet; do +LIBS="-l$i -lnsl $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 2619 "configure" +#line 2703 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char printf(); +char connect(); int main() { -printf() +connect() ; return 0; } EOF -if { (eval echo configure:2630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + ac_cv_search_connect="-l$i" +break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" - +done +LIBS="$ac_func_search_save_LIBS" fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF - LIBS="-lnsl $LIBS" +echo "$ac_t""$ac_cv_search_connect" 1>&6 +if test "$ac_cv_search_connect" != "no"; then + test "$ac_cv_search_connect" = "none required" || LIBS="$ac_cv_search_connect $LIBS" + cat >> confdefs.h <<\EOF +#define HAVE_CONNECT 1 +EOF +else : + +fi else echo "$ac_t""no" 1>&6 -fi - ;; -esac -case "$LIBS" in -*-lsocket*) ;; -*) echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:2661: checking for connect in -lsocket" >&5 -ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + +echo $ac_n "checking for library containing connect""... $ac_c" 1>&6 +echo "configure:2741: checking for library containing connect" >&5 +if eval "test \"`echo '$''{'ac_cv_search_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-lsocket $LIBS" + ac_func_search_save_LIBS="$LIBS" +ac_cv_search_connect="no" cat > conftest.$ac_ext <<EOF -#line 2669 "configure" +#line 2748 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2676,93 +2755,115 @@ int main() { connect() ; return 0; } EOF -if { (eval echo configure:2680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + ac_cv_search_connect="none required" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" +test "$ac_cv_search_connect" = "no" && for i in xnet socket inet; do +LIBS="-l$i $ac_func_search_save_LIBS" +cat > conftest.$ac_ext <<EOF +#line 2770 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect(); -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 +int main() { +connect() +; return 0; } EOF +if { (eval echo configure:2781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_search_connect="-l$i" +break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +LIBS="$ac_func_search_save_LIBS" +fi - LIBS="-lsocket $LIBS" +echo "$ac_t""$ac_cv_search_connect" 1>&6 +if test "$ac_cv_search_connect" != "no"; then + test "$ac_cv_search_connect" = "none required" || LIBS="$ac_cv_search_connect $LIBS" + cat >> confdefs.h <<\EOF +#define HAVE_CONNECT 1 +EOF -else - echo "$ac_t""no" 1>&6 +else : + fi - ;; -esac -case "$LIBS" in -*-linet*) ;; -*) echo $ac_n "checking for connect in -linet""... $ac_c" 1>&6 -echo "configure:2711: checking for connect in -linet" >&5 -ac_lib_var=`echo inet'_'connect | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +fi + + +echo $ac_n "checking for library containing gethostbyname""... $ac_c" 1>&6 +echo "configure:2808: checking for library containing gethostbyname" >&5 +if eval "test \"`echo '$''{'ac_cv_search_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-linet $LIBS" + ac_func_search_save_LIBS="$LIBS" +ac_cv_search_gethostbyname="no" cat > conftest.$ac_ext <<EOF -#line 2719 "configure" +#line 2815 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char connect(); +char gethostbyname(); int main() { -connect() +gethostbyname() ; return 0; } EOF -if { (eval echo configure:2730: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + ac_cv_search_gethostbyname="none required" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" +test "$ac_cv_search_gethostbyname" = "no" && for i in netinet nsl; do +LIBS="-l$i $ac_func_search_save_LIBS" +cat > conftest.$ac_ext <<EOF +#line 2837 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname(); -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo inet | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 +int main() { +gethostbyname() +; return 0; } EOF - - LIBS="-linet $LIBS" - +if { (eval echo configure:2848: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_search_gethostbyname="-l$i" +break else - echo "$ac_t""no" 1>&6 -fi - ;; -esac -if test "$ac_cv_lib_socket_connect" = "yes" || test "$ac_cv_lib_inet_connect" = "yes"; then - ac_cv_func_connect=yes - cat >> confdefs.h <<\EOF -#define HAVE_CONNECT 1 -EOF - + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi +rm -f conftest* +done +LIBS="$ac_func_search_save_LIBS" fi +echo "$ac_t""$ac_cv_search_gethostbyname" 1>&6 +if test "$ac_cv_search_gethostbyname" != "no"; then + test "$ac_cv_search_gethostbyname" = "none required" || LIBS="$ac_cv_search_gethostbyname $LIBS" + +else : + +fi KRB4=/usr/kerberos @@ -2776,19 +2877,19 @@ echo "default place for krb4 is $KRB4" krb_h= echo $ac_n "checking for krb.h""... $ac_c" 1>&6 -echo "configure:2780: checking for krb.h" >&5 +echo "configure:2881: checking for krb.h" >&5 if test "$cross_compiling" != yes && test -r $KRB4/include/krb.h; then hold_cflags=$CFLAGS CFLAGS="$CFLAGS -I$KRB4/include" cat > conftest.$ac_ext <<EOF -#line 2785 "configure" +#line 2886 "configure" #include "confdefs.h" #include <krb.h> int main() { int i; ; return 0; } EOF -if { (eval echo configure:2792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* krb_h=yes krb_incdir=$KRB4/include else @@ -2797,14 +2898,14 @@ else rm -rf conftest* CFLAGS=$hold_cflags cat > conftest.$ac_ext <<EOF -#line 2801 "configure" +#line 2902 "configure" #include "confdefs.h" #include <krb.h> int main() { int i; ; return 0; } EOF -if { (eval echo configure:2808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* krb_h=yes krb_incdir= else @@ -2817,14 +2918,14 @@ rm -f conftest* CFLAGS=$hold_cflags else cat > conftest.$ac_ext <<EOF -#line 2821 "configure" +#line 2922 "configure" #include "confdefs.h" #include <krb.h> int main() { int i; ; return 0; } EOF -if { (eval echo configure:2828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* krb_h=yes krb_incdir= else @@ -2835,14 +2936,14 @@ rm -f conftest* fi if test -z "$krb_h"; then cat > conftest.$ac_ext <<EOF -#line 2839 "configure" +#line 2940 "configure" #include "confdefs.h" #include <krb.h> int main() { int i; ; return 0; } EOF -if { (eval echo configure:2846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* krb_h=yes krb_incdir= else @@ -2853,14 +2954,14 @@ else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -I$KRB4/include/kerberosIV" cat > conftest.$ac_ext <<EOF -#line 2857 "configure" +#line 2958 "configure" #include "confdefs.h" #include <krb.h> int main() { int i; ; return 0; } EOF -if { (eval echo configure:2864: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* krb_h=yes krb_incdir=$KRB4/include/kerberosIV else @@ -2883,7 +2984,7 @@ if test -n "$krb_h"; then hold_ldflags=$LDFLAGS LDFLAGS="-L${KRB4}/lib $LDFLAGS" echo $ac_n "checking for printf in -lkrb""... $ac_c" 1>&6 -echo "configure:2887: checking for printf in -lkrb" >&5 +echo "configure:2988: checking for printf in -lkrb" >&5 ac_lib_var=`echo krb'_'printf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2891,7 +2992,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lkrb $LIBS" cat > conftest.$ac_ext <<EOF -#line 2895 "configure" +#line 2996 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2902,7 +3003,7 @@ int main() { printf() ; return 0; } EOF -if { (eval echo configure:2906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2924,7 +3025,7 @@ LDFLAGS=$hold_ldflags # Using open here instead of printf so we don't # get confused by the cached value for printf from above. echo $ac_n "checking for open in -lkrb""... $ac_c" 1>&6 -echo "configure:2928: checking for open in -lkrb" >&5 +echo "configure:3029: checking for open in -lkrb" >&5 ac_lib_var=`echo krb'_'open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2932,7 +3033,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lkrb $LIBS" cat > conftest.$ac_ext <<EOF -#line 2936 "configure" +#line 3037 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2943,7 +3044,7 @@ int main() { open() ; return 0; } EOF -if { (eval echo configure:2947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3048: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2968,7 +3069,7 @@ fi LDFLAGS=$hold_ldflags else echo $ac_n "checking for printf in -lkrb""... $ac_c" 1>&6 -echo "configure:2972: checking for printf in -lkrb" >&5 +echo "configure:3073: checking for printf in -lkrb" >&5 ac_lib_var=`echo krb'_'printf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2976,7 +3077,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lkrb $LIBS" cat > conftest.$ac_ext <<EOF -#line 2980 "configure" +#line 3081 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2987,7 +3088,7 @@ int main() { printf() ; return 0; } EOF -if { (eval echo configure:2991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3021,7 +3122,7 @@ EOF hold_ldflags=$LDFLAGS test -n "${krb_libdir}" && LDFLAGS="$LDFLAGS -L${krb_libdir}" echo $ac_n "checking for printf in -ldes""... $ac_c" 1>&6 -echo "configure:3025: checking for printf in -ldes" >&5 +echo "configure:3126: checking for printf in -ldes" >&5 ac_lib_var=`echo des'_'printf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3029,7 +3130,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldes $LIBS" cat > conftest.$ac_ext <<EOF -#line 3033 "configure" +#line 3134 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3040,7 +3141,7 @@ int main() { printf() ; return 0; } EOF -if { (eval echo configure:3044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3069,12 +3170,12 @@ fi for ac_func in krb_get_err_text do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3073: checking for $ac_func" >&5 +echo "configure:3174: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3078 "configure" +#line 3179 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3097,7 +3198,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3138,18 +3239,18 @@ for ac_hdr in krb5.h gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3142: checking for $ac_hdr" >&5 +echo "configure:3243: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3147 "configure" +#line 3248 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3152: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` +{ (eval echo configure:3253: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" @@ -3194,7 +3295,7 @@ EOF CPPFLAGS="-I$GSSAPI/include $CPPFLAGS" if test "$ac_cv_header_gssapi_h" = "yes"; then cat > conftest.$ac_ext <<EOF -#line 3198 "configure" +#line 3299 "configure" #include "confdefs.h" #include <gssapi.h> EOF @@ -3210,7 +3311,7 @@ rm -f conftest* else cat > conftest.$ac_ext <<EOF -#line 3214 "configure" +#line 3315 "configure" #include "confdefs.h" #include <gssapi/gssapi.h> EOF @@ -3229,7 +3330,7 @@ rm -f conftest* # This is necessary on Irix 5.3, in order to link against libkrb5 -- # there, an_to_ln.o refers to things defined only in -lgen. echo $ac_n "checking for compile in -lgen""... $ac_c" 1>&6 -echo "configure:3233: checking for compile in -lgen" >&5 +echo "configure:3334: checking for compile in -lgen" >&5 ac_lib_var=`echo gen'_'compile | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3237,7 +3338,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <<EOF -#line 3241 "configure" +#line 3342 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3248,7 +3349,7 @@ int main() { compile() ; return 0; } EOF -if { (eval echo configure:3252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3297,12 +3398,12 @@ EOF fi echo $ac_n "checking for gethostname""... $ac_c" 1>&6 -echo "configure:3301: checking for gethostname" >&5 +echo "configure:3402: checking for gethostname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3306 "configure" +#line 3407 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostname(); below. */ @@ -3325,7 +3426,7 @@ gethostname(); ; return 0; } EOF -if { (eval echo configure:3329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostname=yes" else @@ -3358,7 +3459,7 @@ EOF fi else - if test "$ac_cv_func_connect" = yes; then + if test "$ac_cv_search_connect" != no; then cat >> confdefs.h <<\EOF #define CLIENT_SUPPORT 1 EOF @@ -3376,7 +3477,7 @@ EOF fi else - if test "$ac_cv_func_connect" = yes; then + if test "$ac_cv_search_connect" != no; then cat >> confdefs.h <<\EOF #define SERVER_SUPPORT 1 EOF @@ -3404,12 +3505,12 @@ if test "$enable_server" = yes; then for ac_func in crypt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3408: checking for $ac_func" >&5 +echo "configure:3509: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3413 "configure" +#line 3514 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3432,7 +3533,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3458,7 +3559,7 @@ done if test "$ac_cv_func_crypt" = no; then echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:3462: checking for crypt in -lcrypt" >&5 +echo "configure:3563: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3466,7 +3567,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <<EOF -#line 3470 "configure" +#line 3571 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3477,7 +3578,7 @@ int main() { crypt() ; return 0; } EOF -if { (eval echo configure:3481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3507,12 +3608,12 @@ fi for ac_func in crypt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3511: checking for $ac_func" >&5 +echo "configure:3612: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3516 "configure" +#line 3617 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3535,7 +3636,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3569,25 +3670,21 @@ EOF fi fi # enable_server -cat >> confdefs.h <<\EOF -#define PRESERVE_PERMISSIONS_SUPPORT 1 -EOF - echo $ac_n "checking for cygwin32""... $ac_c" 1>&6 -echo "configure:3579: checking for cygwin32" >&5 +echo "configure:3676: checking for cygwin32" >&5 if eval "test \"`echo '$''{'ccvs_cv_sys_cygwin32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3584 "configure" +#line 3681 "configure" #include "confdefs.h" int main() { return __CYGWIN32__; ; return 0; } EOF -if { (eval echo configure:3591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3688: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ccvs_cv_sys_cygwin32=yes else @@ -3649,7 +3746,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1` in + case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -3716,7 +3813,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12" + echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -3741,9 +3838,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF $ac_vpsub $extrasub +s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g @@ -3762,16 +3861,18 @@ s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g -s%@CC@%$CC%g -s%@CPP@%$CPP%g s%@CVS@%$CVS%g +s%@AWK@%$AWK%g +s%@CC@%$CC%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@SET_MAKE@%$SET_MAKE%g s%@RANLIB@%$RANLIB%g s%@YACC@%$YACC%g -s%@SET_MAKE@%$SET_MAKE%g s%@perl_path@%$perl_path%g s%@csh_path@%$csh_path%g +s%@CPP@%$CPP%g s%@LIBOBJS@%$LIBOBJS%g s%@ZLIB@%$ZLIB%g s%@ZLIBSUBDIRS@%$ZLIBSUBDIRS%g diff --git a/gnu/usr.bin/cvs/configure.in b/gnu/usr.bin/cvs/configure.in index 83ecf1033e2..a3ec8e566ef 100644 --- a/gnu/usr.bin/cvs/configure.in +++ b/gnu/usr.bin/cvs/configure.in @@ -1,42 +1,15 @@ dnl configure.in for cvs AC_INIT(src/cvs.h) -dnl -AC_PREREQ(2.4)dnl Required Autoconf version. -dnl Do not use autoconf 2.12; it produces a configure script which produces -dnl a "internal 2K buffer" error on HPUX when run with /bin/sh. -dnl autoconf 2.10 seems like a good choice. -dnl -dnl It is possible that we should just change the above required version -dnl to 2.10; it seems like everyone is using 2.10 anyway, and there is -dnl at least some sentiment that we should be using a version which has -dnl --bindir (and correspondingly, using @bindir@ and friends in our -dnl Makefile.in files. Rumor has it that autoconf 2.7 -dnl introduced --bindir but the point is that 2.10 has it. +AC_PREREQ(2.13) +AC_PREFIX_PROGRAM(cvs) AC_CONFIG_HEADER(config.h src/options.h) +AC_PROG_AWK AC_PROG_CC - -AC_AIX -AC_MINIX -AC_ISC_POSIX -if test "$ISC" = yes; then -CFLAGS="$CFLAGS -D_SYSV3" -LIBS="-lcrypt $LIBS" -fi - -AC_PREFIX_PROGRAM(cvs) - -dnl FIXME: AC_C_CROSS is considered obsolete by autoconf 2.12, and is -dnl pretty ugly to start with. But it isn't obvious to me how we should -dnl be handling the uses of cross_compiling below. -AC_C_CROSS - -AC_C_CONST - AC_PROG_INSTALL +AC_PROG_MAKE_SET AC_PROG_RANLIB AC_PROG_YACC -AC_PROG_MAKE_SET AC_PATH_PROG(perl_path, perl, no) AC_PATH_PROG(csh_path, csh, no) @@ -48,23 +21,35 @@ if test X"$ac_cv_sys_interpreter" != X"yes" ; then AC_MSG_WARN($ac_msg) fi +AC_AIX +AC_MINIX +AC_ISC_POSIX +if test "$ISC" = yes; then +CFLAGS="$CFLAGS -D_SYSV3" +LIBS="-lcrypt $LIBS" +fi + +AC_HEADER_DIRENT AC_HEADER_STDC +AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(errno.h unistd.h string.h memory.h utime.h fcntl.h ndbm.h \ limits.h sys/file.h \ sys/param.h sys/select.h sys/time.h sys/timeb.h \ io.h direct.h sys/bsdtypes.h sys/resource.h) -AC_HEADER_SYS_WAIT AC_HEADER_STAT AC_HEADER_TIME -AC_HEADER_DIRENT -AC_TYPE_SIGNAL + +AC_C_CONST AC_TYPE_UID_T AC_TYPE_MODE_T -AC_TYPE_SIZE_T AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SIGNAL + AC_STRUCT_ST_BLKSIZE +AC_STRUCT_ST_RDEV AC_REPLACE_FUNCS(mkdir rename strstr dup2 strerror valloc waitpid memmove strtoul) -AC_CHECK_FUNCS(fchmod fsync ftime mktemp putenv vprintf ftruncate timezone getpagesize initgroups fchdir sigaction sigprocmask sigvec sigsetmask sigblock tempnam tzset readlink wait3) +AC_CHECK_FUNCS(fchmod fsync ftime mktemp putenv vprintf ftruncate timezone getpagesize initgroups fchdir sigaction sigprocmask sigvec sigsetmask sigblock tempnam tzset readlink wait3 mknod getpassphrase) dnl dnl The CVS coding standard (as specified in HACKING) is that if it exists @@ -75,6 +60,12 @@ AC_DEFINE(HAVE_STRCHR) AC_DEFINE(HAVE_MEMCHR) dnl +dnl Force lib/regex.c to use malloc instead of messing around with alloca +dnl and define the old re_comp routines that we use. +dnl +AC_DEFINE(REGEX_MALLOC) +AC_DEFINE(_REGEX_RE_COMP) +dnl dnl AC_FUNC_VFORK is rather baroque. It seems to be rather more picky dnl than, say, the Single Unix Specification (version 2), which simplifies dnl a lot of cases by saying that the child process can't set any variables @@ -96,8 +87,7 @@ dnl dnl We used to try to determine whether shadow passwords were actually in dnl use or not, but the code has been changed to work right reguardless, dnl so we can go back to a simple check. -AC_CHECK_LIB(sec, getspnam) -AC_CHECK_FUNCS(getspnam) +AC_SEARCH_LIBS(getspnam, sec gen, AC_DEFINE(HAVE_GETSPNAM)) dnl dnl Check for a system libz. @@ -128,53 +118,16 @@ dnl AC_CHECK_FUNC(re_exec, :, LIBOBJS="$LIBOBJS regex.o") AC_FUNC_UTIME_NULL AC_SYS_LONG_FILE_NAMES -AC_MSG_CHECKING([for working fnmatch function]) -AC_CACHE_VAL(ccvs_cv_sys_working_fnmatch, -[AC_TRY_RUN([ -#include <fnmatch.h> -int -main () -{ - exit ((fnmatch ("a", "a", FNM_PATHNAME) == 0 - && fnmatch ("a", "b", FNM_PATHNAME) == FNM_NOMATCH) - ? 0 : 1); -}], -ccvs_cv_sys_working_fnmatch=yes, -ccvs_cv_sys_working_fnmatch=no, -ccvs_cv_sys_working_fnmatch=no)]) -if test $ccvs_cv_sys_working_fnmatch = no; then +AC_FUNC_FNMATCH +if test "$ac_cv_func_fnmatch_works" = no; then LIBOBJS="$LIBOBJS fnmatch.o" fi -AC_MSG_RESULT($ccvs_cv_sys_working_fnmatch) - -# If we can't find connect, try looking in -lsocket, -lnsl, and -linet. -# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has -# libsocket.so which has a bad implementation of gethostbyname (it -# only looks in /etc/hosts), so we only look for -lsocket if we need -# it. -AC_CHECK_FUNC(connect, :, -[case "$LIBS" in -*-lnsl*) ;; -*) AC_CHECK_LIB(nsl_s, printf) ;; -esac -case "$LIBS" in -*-lnsl*) ;; -*) AC_CHECK_LIB(nsl, printf) ;; -esac -case "$LIBS" in -*-lsocket*) ;; -*) AC_CHECK_LIB(socket, connect) ;; -esac -case "$LIBS" in -*-linet*) ;; -*) AC_CHECK_LIB(inet, connect) ;; -esac -dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value -dnl has been cached. -if test "$ac_cv_lib_socket_connect" = "yes" || test "$ac_cv_lib_inet_connect" = "yes"; then - ac_cv_func_connect=yes - AC_DEFINE(HAVE_CONNECT) -fi]) + +# Try to find connect and gethostbyname. +AC_CHECK_LIB(nsl, main, + AC_SEARCH_LIBS(connect, xnet socket inet, AC_DEFINE(HAVE_CONNECT),, -lnsl), + AC_SEARCH_LIBS(connect, xnet socket inet, AC_DEFINE(HAVE_CONNECT))) +AC_SEARCH_LIBS(gethostbyname, netinet nsl) dnl dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4 @@ -322,7 +275,7 @@ AC_ARG_ENABLE(client, [if test "$enable_client" = yes; then AC_DEFINE(CLIENT_SUPPORT) fi], -[if test "$ac_cv_func_connect" = yes; then +[if test "$ac_cv_search_connect" != no; then AC_DEFINE(CLIENT_SUPPORT) fi]) AC_ARG_ENABLE(server, @@ -331,7 +284,7 @@ AC_ARG_ENABLE(server, [if test "$enable_server" = yes; then AC_DEFINE(SERVER_SUPPORT) fi], -[if test "$ac_cv_func_connect" = yes; then +[if test "$ac_cv_search_connect" != no; then AC_DEFINE(SERVER_SUPPORT) enable_server=yes fi]) @@ -366,7 +319,7 @@ dnl For the moment we will assume that all systems which have dnl the unixyness to run configure are unixy enough to do the dnl PreservePermissions stuff. I have this sinking feeling that dnl things won't be that simple, before long. -AC_DEFINE(PRESERVE_PERMISSIONS_SUPPORT) +dnl AC_DEFINE(PRESERVE_PERMISSIONS_SUPPORT) dnl On cygwin32, we configure like a Unix system, but we use the dnl Windows support code in lib/fncase.c to handle the case diff --git a/gnu/usr.bin/cvs/contrib/Makefile.in b/gnu/usr.bin/cvs/contrib/Makefile.in index 2ae38175549..71c56bb751e 100644 --- a/gnu/usr.bin/cvs/contrib/Makefile.in +++ b/gnu/usr.bin/cvs/contrib/Makefile.in @@ -22,7 +22,7 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ # Where to install the executables. -bindir = $(exec_prefix)/bin +bindir = @bindir@ # Where to put the system-wide .cvsrc file libexecdir = $(prefix)/libexec @@ -31,7 +31,7 @@ libexecdir = $(prefix)/libexec datadir = $(prefix)/share # Where to put the manual pages. -mandir = $(prefix)/man +mandir = @mandir@ # where to find command interpreters perl_path = @perl_path@ diff --git a/gnu/usr.bin/cvs/lib/Makefile.in b/gnu/usr.bin/cvs/lib/Makefile.in index f35baae0b60..736f1319e3f 100644 --- a/gnu/usr.bin/cvs/lib/Makefile.in +++ b/gnu/usr.bin/cvs/lib/Makefile.in @@ -52,7 +52,16 @@ SOURCES = \ HEADERS = getline.h getopt.h fnmatch.h regex.h system.h wait.h md5.h savecwd.h -# See long comment in ../configure.in concerning inclusion of regex.o. +# Always use CVS's regular expression matcher regex.o, because of +# variations in regular expression syntax - we want to be the same +# across systems and (probably) compared with old versions of CVS too. +# +# On a more mundane/detail level, having regex.h match regex.c can be +# an issue if we aren't careful. +# +# Also should look into unifying regular expression matching in CVS +# with the diff library (perhaps to have the caller, CVS, do the +# matching?) OBJECTS = \ @LIBOBJS@ \ argmatch.o \ diff --git a/gnu/usr.bin/cvs/lib/getdate.c b/gnu/usr.bin/cvs/lib/getdate.c index c02af2a5fc9..aed844da9c9 100644 --- a/gnu/usr.bin/cvs/lib/getdate.c +++ b/gnu/usr.bin/cvs/lib/getdate.c @@ -1,14 +1,17 @@ #ifndef lint -static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; +static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93 (BSDI)"; #endif +#include <stdlib.h> #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 -#define yyclearin (yychar=(-1)) +#define YYEMPTY (-1) +#define YYLEX yylex() +#define yyclearin (yychar=YYEMPTY) #define yyerrok (yyerrflag=0) #define YYRECOVERING (yyerrflag!=0) #define YYPREFIX "yy" -#line 2 "../../work/ccvs/lib/getdate.y" +#line 2 "/u/scjones/cvs-nightly/lib/getdate.y" /* ** Originally written by Steven M. Bellovin <smb@research.att.com> while ** at the University of North Carolina at Chapel Hill. Later tweaked by @@ -184,12 +187,12 @@ static MERIDIAN yyMeridian; static time_t yyRelMonth; static time_t yyRelSeconds; -#line 179 "../../work/ccvs/lib/getdate.y" +#line 179 "/u/scjones/cvs-nightly/lib/getdate.y" typedef union { time_t Number; enum _MERIDIAN Meridian; } YYSTYPE; -#line 193 "y.tab.c" +#line 196 "y.tab.c" #define tAGO 257 #define tDAY 258 #define tDAYZONE 259 @@ -387,22 +390,25 @@ char *yyrule[] = { #ifdef YYMAXDEPTH #define YYSTACKSIZE YYMAXDEPTH #else -#define YYSTACKSIZE 500 -#define YYMAXDEPTH 500 +#define YYSTACKSIZE 10000 +#define YYMAXDEPTH 10000 #endif #endif +#define YYINITSTACKSIZE 200 int yydebug; int yynerrs; -int yyerrflag; -int yychar; -short *yyssp; -YYSTYPE *yyvsp; -YYSTYPE yyval; +struct yystack { + short *ssp; + YYSTYPE *vsp; + short *ss; + YYSTYPE *vs; + int stacksize; + short *sslim; +}; +int yychar; /* some people use this, so we copy it in & out */ +int yyerrflag; /* must be global for yyerrok & YYRECOVERING */ YYSTYPE yylval; -short yyss[YYSTACKSIZE]; -YYSTYPE yyvs[YYSTACKSIZE]; -#define yystacksize YYSTACKSIZE -#line 392 "../../work/ccvs/lib/getdate.y" +#line 398 "/u/scjones/cvs-nightly/lib/getdate.y" /* Month and day table. */ static TABLE const MonthDayTable[] = { @@ -657,7 +663,9 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode) if (Year < 0) Year = -Year; - if (Year < 100) + if (Year < 69) + Year += 2000; + else if (Year < 100) Year += 1900; DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 29 : 28; @@ -971,7 +979,7 @@ get_date(p, now) } tm = localtime(&nowtime); - yyYear = tm->tm_year; + yyYear = tm->tm_year + 1900; yyMonth = tm->tm_mon + 1; yyDay = tm->tm_mday; yyTimezone = now->timezone; @@ -1044,7 +1052,60 @@ main(ac, av) /* NOTREACHED */ } #endif /* defined(TEST) */ -#line 1048 "y.tab.c" +#line 1056 "y.tab.c" +/* allocate initial stack */ +#if defined(__STDC__) || defined(__cplusplus) +static int yyinitstack(struct yystack *sp) +#else +static int yyinitstack(sp) + struct yystack *sp; +#endif +{ + int newsize; + short *newss; + YYSTYPE *newvs; + + newsize = YYINITSTACKSIZE; + newss = (short *)malloc(newsize * sizeof *newss); + newvs = (YYSTYPE *)malloc(newsize * sizeof *newvs); + sp->ss = sp->ssp = newss; + sp->vs = sp->vsp = newvs; + if (newss == NULL || newvs == NULL) return -1; + sp->stacksize = newsize; + sp->sslim = newss + newsize - 1; + return 0; +} + +/* double stack size, up to YYMAXDEPTH */ +#if defined(__STDC__) || defined(__cplusplus) +static int yygrowstack(struct yystack *sp) +#else +static int yygrowstack(sp) + struct yystack *sp; +#endif +{ + int newsize, i; + short *newss; + YYSTYPE *newvs; + + if ((newsize = sp->stacksize) >= YYMAXDEPTH) return -1; + if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; + i = sp->ssp - sp->ss; + if ((newss = (short *)realloc(sp->ss, newsize * sizeof *newss)) == NULL) + return -1; + sp->ss = newss; + sp->ssp = newss + i; + if ((newvs = (YYSTYPE *)realloc(sp->vs, newsize * sizeof *newvs)) == NULL) + return -1; + sp->vs = newvs; + sp->vsp = newvs + i; + sp->stacksize = newsize; + sp->sslim = newss + newsize - 1; + return 0; +} + +#define YYFREESTACK(sp) { free((sp)->ss); free((sp)->vs); } + #define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept @@ -1052,7 +1113,10 @@ main(ac, av) int yyparse() { - register int yym, yyn, yystate; + register int yym, yyn, yystate, yych; + register YYSTYPE *yyvsp; + YYSTYPE yyval; + struct yystack yystk; #if YYDEBUG register char *yys; extern char *getenv(); @@ -1067,48 +1131,46 @@ yyparse() yynerrs = 0; yyerrflag = 0; - yychar = (-1); + yychar = yych = YYEMPTY; - yyssp = yyss; - yyvsp = yyvs; - *yyssp = yystate = 0; + if (yyinitstack(&yystk)) goto yyoverflow; + *yystk.ssp = yystate = 0; yyloop: if (yyn = yydefred[yystate]) goto yyreduce; - if (yychar < 0) + if (yych < 0) { - if ((yychar = yylex()) < 0) yychar = 0; + if ((yych = YYLEX) < 0) yych = 0; + yychar = yych; #if YYDEBUG if (yydebug) { yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (yych <= YYMAXTOKEN) yys = yyname[yych]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, yystate, yychar, yys); + YYPREFIX, yystate, yych, yys); } #endif } - if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if ((yyn = yysindex[yystate]) && (yyn += yych) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == yych) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yyssp >= yyss + yystacksize - 1) - { + if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - yychar = (-1); + *++yystk.ssp = yystate = yytable[yyn]; + *++yystk.vsp = yylval; + yychar = yych = YYEMPTY; if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if ((yyn = yyrindex[yystate]) && (yyn += yych) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == yych) { yyn = yytable[yyn]; goto yyreduce; @@ -1130,20 +1192,19 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && + if ((yyn = yysindex[*yystk.ssp]) && + (yyn += YYERRCODE) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); + to state %d\n", YYPREFIX, *yystk.ssp, yytable[yyn]); #endif - if (yyssp >= yyss + yystacksize - 1) - { + if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; + *++yystk.ssp = yystate = yytable[yyn]; + *++yystk.vsp = yylval; goto yyloop; } else @@ -1151,28 +1212,28 @@ yyinrecovery: #if YYDEBUG if (yydebug) printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *yyssp); + YYPREFIX, *yystk.ssp); #endif - if (yyssp <= yyss) goto yyabort; - --yyssp; - --yyvsp; + if (yystk.ssp <= yystk.ss) goto yyabort; + --yystk.ssp; + --yystk.vsp; } } } else { - if (yychar == 0) goto yyabort; + if (yych == 0) goto yyabort; #if YYDEBUG if (yydebug) { yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (yych <= YYMAXTOKEN) yys = yyname[yych]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", - YYPREFIX, yystate, yychar, yys); + YYPREFIX, yystate, yych, yys); } #endif - yychar = (-1); + yychar = yych = YYEMPTY; goto yyloop; } yyreduce: @@ -1182,41 +1243,42 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; + yyvsp = yystk.vsp; /* for speed in code under switch() */ yyval = yyvsp[1-yym]; switch (yyn) { case 3: -#line 197 "../../work/ccvs/lib/getdate.y" +#line 197 "/u/scjones/cvs-nightly/lib/getdate.y" { yyHaveTime++; } break; case 4: -#line 200 "../../work/ccvs/lib/getdate.y" +#line 200 "/u/scjones/cvs-nightly/lib/getdate.y" { yyHaveZone++; } break; case 5: -#line 203 "../../work/ccvs/lib/getdate.y" +#line 203 "/u/scjones/cvs-nightly/lib/getdate.y" { yyHaveDate++; } break; case 6: -#line 206 "../../work/ccvs/lib/getdate.y" +#line 206 "/u/scjones/cvs-nightly/lib/getdate.y" { yyHaveDay++; } break; case 7: -#line 209 "../../work/ccvs/lib/getdate.y" +#line 209 "/u/scjones/cvs-nightly/lib/getdate.y" { yyHaveRel++; } break; case 9: -#line 215 "../../work/ccvs/lib/getdate.y" +#line 215 "/u/scjones/cvs-nightly/lib/getdate.y" { yyHour = yyvsp[-1].Number; yyMinutes = 0; @@ -1225,7 +1287,7 @@ case 9: } break; case 10: -#line 221 "../../work/ccvs/lib/getdate.y" +#line 221 "/u/scjones/cvs-nightly/lib/getdate.y" { yyHour = yyvsp[-3].Number; yyMinutes = yyvsp[-1].Number; @@ -1234,7 +1296,7 @@ case 10: } break; case 11: -#line 227 "../../work/ccvs/lib/getdate.y" +#line 227 "/u/scjones/cvs-nightly/lib/getdate.y" { yyHour = yyvsp[-3].Number; yyMinutes = yyvsp[-1].Number; @@ -1244,7 +1306,7 @@ case 11: } break; case 12: -#line 234 "../../work/ccvs/lib/getdate.y" +#line 234 "/u/scjones/cvs-nightly/lib/getdate.y" { yyHour = yyvsp[-5].Number; yyMinutes = yyvsp[-3].Number; @@ -1253,7 +1315,7 @@ case 12: } break; case 13: -#line 240 "../../work/ccvs/lib/getdate.y" +#line 240 "/u/scjones/cvs-nightly/lib/getdate.y" { yyHour = yyvsp[-5].Number; yyMinutes = yyvsp[-3].Number; @@ -1264,64 +1326,70 @@ case 13: } break; case 14: -#line 250 "../../work/ccvs/lib/getdate.y" +#line 250 "/u/scjones/cvs-nightly/lib/getdate.y" { yyTimezone = yyvsp[0].Number; yyDSTmode = DSToff; } break; case 15: -#line 254 "../../work/ccvs/lib/getdate.y" +#line 254 "/u/scjones/cvs-nightly/lib/getdate.y" { yyTimezone = yyvsp[0].Number; yyDSTmode = DSTon; } break; case 16: -#line 259 "../../work/ccvs/lib/getdate.y" +#line 259 "/u/scjones/cvs-nightly/lib/getdate.y" { yyTimezone = yyvsp[-1].Number; yyDSTmode = DSTon; } break; case 17: -#line 265 "../../work/ccvs/lib/getdate.y" +#line 265 "/u/scjones/cvs-nightly/lib/getdate.y" { yyDayOrdinal = 1; yyDayNumber = yyvsp[0].Number; } break; case 18: -#line 269 "../../work/ccvs/lib/getdate.y" +#line 269 "/u/scjones/cvs-nightly/lib/getdate.y" { yyDayOrdinal = 1; yyDayNumber = yyvsp[-1].Number; } break; case 19: -#line 273 "../../work/ccvs/lib/getdate.y" +#line 273 "/u/scjones/cvs-nightly/lib/getdate.y" { yyDayOrdinal = yyvsp[-1].Number; yyDayNumber = yyvsp[0].Number; } break; case 20: -#line 279 "../../work/ccvs/lib/getdate.y" +#line 279 "/u/scjones/cvs-nightly/lib/getdate.y" { yyMonth = yyvsp[-2].Number; yyDay = yyvsp[0].Number; } break; case 21: -#line 283 "../../work/ccvs/lib/getdate.y" +#line 283 "/u/scjones/cvs-nightly/lib/getdate.y" { - yyMonth = yyvsp[-4].Number; - yyDay = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; + if (yyvsp[-4].Number >= 100) { + yyYear = yyvsp[-4].Number; + yyMonth = yyvsp[-2].Number; + yyDay = yyvsp[0].Number; + } else { + yyMonth = yyvsp[-4].Number; + yyDay = yyvsp[-2].Number; + yyYear = yyvsp[0].Number; + } } break; case 22: -#line 288 "../../work/ccvs/lib/getdate.y" +#line 294 "/u/scjones/cvs-nightly/lib/getdate.y" { /* ISO 8601 format. yyyy-mm-dd. */ yyYear = yyvsp[-2].Number; @@ -1330,7 +1398,7 @@ case 22: } break; case 23: -#line 294 "../../work/ccvs/lib/getdate.y" +#line 300 "/u/scjones/cvs-nightly/lib/getdate.y" { /* e.g. 17-JUN-1992. */ yyDay = yyvsp[-2].Number; @@ -1339,14 +1407,14 @@ case 23: } break; case 24: -#line 300 "../../work/ccvs/lib/getdate.y" +#line 306 "/u/scjones/cvs-nightly/lib/getdate.y" { yyMonth = yyvsp[-1].Number; yyDay = yyvsp[0].Number; } break; case 25: -#line 304 "../../work/ccvs/lib/getdate.y" +#line 310 "/u/scjones/cvs-nightly/lib/getdate.y" { yyMonth = yyvsp[-3].Number; yyDay = yyvsp[-2].Number; @@ -1354,14 +1422,14 @@ case 25: } break; case 26: -#line 309 "../../work/ccvs/lib/getdate.y" +#line 315 "/u/scjones/cvs-nightly/lib/getdate.y" { yyMonth = yyvsp[0].Number; yyDay = yyvsp[-1].Number; } break; case 27: -#line 313 "../../work/ccvs/lib/getdate.y" +#line 319 "/u/scjones/cvs-nightly/lib/getdate.y" { yyMonth = yyvsp[-1].Number; yyDay = yyvsp[-2].Number; @@ -1369,68 +1437,68 @@ case 27: } break; case 28: -#line 320 "../../work/ccvs/lib/getdate.y" +#line 326 "/u/scjones/cvs-nightly/lib/getdate.y" { yyRelSeconds = -yyRelSeconds; yyRelMonth = -yyRelMonth; } break; case 30: -#line 327 "../../work/ccvs/lib/getdate.y" +#line 333 "/u/scjones/cvs-nightly/lib/getdate.y" { yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; } break; case 31: -#line 330 "../../work/ccvs/lib/getdate.y" +#line 336 "/u/scjones/cvs-nightly/lib/getdate.y" { yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; } break; case 32: -#line 333 "../../work/ccvs/lib/getdate.y" +#line 339 "/u/scjones/cvs-nightly/lib/getdate.y" { yyRelSeconds += yyvsp[0].Number * 60L; } break; case 33: -#line 336 "../../work/ccvs/lib/getdate.y" +#line 342 "/u/scjones/cvs-nightly/lib/getdate.y" { yyRelSeconds += yyvsp[-1].Number; } break; case 34: -#line 339 "../../work/ccvs/lib/getdate.y" +#line 345 "/u/scjones/cvs-nightly/lib/getdate.y" { yyRelSeconds += yyvsp[-1].Number; } break; case 35: -#line 342 "../../work/ccvs/lib/getdate.y" +#line 348 "/u/scjones/cvs-nightly/lib/getdate.y" { yyRelSeconds++; } break; case 36: -#line 345 "../../work/ccvs/lib/getdate.y" +#line 351 "/u/scjones/cvs-nightly/lib/getdate.y" { yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; } break; case 37: -#line 348 "../../work/ccvs/lib/getdate.y" +#line 354 "/u/scjones/cvs-nightly/lib/getdate.y" { yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; } break; case 38: -#line 351 "../../work/ccvs/lib/getdate.y" +#line 357 "/u/scjones/cvs-nightly/lib/getdate.y" { yyRelMonth += yyvsp[0].Number; } break; case 39: -#line 356 "../../work/ccvs/lib/getdate.y" +#line 362 "/u/scjones/cvs-nightly/lib/getdate.y" { if (yyHaveTime && yyHaveDate && !yyHaveRel) yyYear = yyvsp[0].Number; @@ -1458,23 +1526,24 @@ case 39: } break; case 40: -#line 383 "../../work/ccvs/lib/getdate.y" +#line 389 "/u/scjones/cvs-nightly/lib/getdate.y" { yyval.Meridian = MER24; } break; case 41: -#line 386 "../../work/ccvs/lib/getdate.y" +#line 392 "/u/scjones/cvs-nightly/lib/getdate.y" { yyval.Meridian = yyvsp[0].Meridian; } break; -#line 1473 "y.tab.c" +#line 1541 "y.tab.c" } - yyssp -= yym; - yystate = *yyssp; - yyvsp -= yym; + yystk.ssp -= yym; + yystate = *yystk.ssp; + yystk.vsp -= yym; yym = yylhs[yyn]; + yych = yychar; if (yystate == 0 && yym == 0) { #if YYDEBUG @@ -1483,23 +1552,24 @@ break; state %d\n", YYPREFIX, YYFINAL); #endif yystate = YYFINAL; - *++yyssp = YYFINAL; - *++yyvsp = yyval; - if (yychar < 0) + *++yystk.ssp = YYFINAL; + *++yystk.vsp = yyval; + if (yych < 0) { - if ((yychar = yylex()) < 0) yychar = 0; + if ((yych = YYLEX) < 0) yych = 0; + yychar = yych; #if YYDEBUG if (yydebug) { yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (yych <= YYMAXTOKEN) yys = yyname[yych]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, YYFINAL, yychar, yys); + YYPREFIX, YYFINAL, yych, yys); } #endif } - if (yychar == 0) goto yyaccept; + if (yych == 0) goto yyaccept; goto yyloop; } if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && @@ -1510,19 +1580,19 @@ break; #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *yyssp, yystate); +to state %d\n", YYPREFIX, *yystk.ssp, yystate); #endif - if (yyssp >= yyss + yystacksize - 1) - { + if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) goto yyoverflow; - } - *++yyssp = yystate; - *++yyvsp = yyval; + *++yystk.ssp = yystate; + *++yystk.vsp = yyval; goto yyloop; yyoverflow: yyerror("yacc stack overflow"); yyabort: + YYFREESTACK(&yystk); return (1); yyaccept: + YYFREESTACK(&yystk); return (0); } diff --git a/gnu/usr.bin/cvs/lib/getdate.y b/gnu/usr.bin/cvs/lib/getdate.y index b118f7d544e..776323cf4de 100644 --- a/gnu/usr.bin/cvs/lib/getdate.y +++ b/gnu/usr.bin/cvs/lib/getdate.y @@ -281,9 +281,15 @@ date : tUNUMBER '/' tUNUMBER { yyDay = $3; } | tUNUMBER '/' tUNUMBER '/' tUNUMBER { - yyMonth = $1; - yyDay = $3; - yyYear = $5; + if ($1 >= 100) { + yyYear = $1; + yyMonth = $3; + yyDay = $5; + } else { + yyMonth = $1; + yyDay = $3; + yyYear = $5; + } } | tUNUMBER tSNUMBER tSNUMBER { /* ISO 8601 format. yyyy-mm-dd. */ @@ -643,7 +649,9 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode) if (Year < 0) Year = -Year; - if (Year < 100) { + if (Year < 69) + Year += 2000; + else if (Year < 100) Year += 1900; if (Year < EPOCH) Year += 100; @@ -960,7 +968,7 @@ get_date(p, now) } tm = localtime(&nowtime); - yyYear = tm->tm_year; + yyYear = tm->tm_year + 1900; yyMonth = tm->tm_mon + 1; yyDay = tm->tm_mday; yyTimezone = now->timezone; diff --git a/gnu/usr.bin/cvs/lib/sighandle.c b/gnu/usr.bin/cvs/lib/sighandle.c index 5e552b94f29..f595dd24912 100644 --- a/gnu/usr.bin/cvs/lib/sighandle.c +++ b/gnu/usr.bin/cvs/lib/sighandle.c @@ -385,6 +385,16 @@ void SIG_beginCrSect() } /* + * Return nonzero if currently in a critical section. + * Otherwise return zero. + */ + +int SIG_inCrSect() +{ + return SIG_crSectNest > 0; +} + +/* * The following ends a critical section. */ diff --git a/gnu/usr.bin/cvs/man/cvs.1 b/gnu/usr.bin/cvs/man/cvs.1 index 515e03217e6..0dad4530f38 100644 --- a/gnu/usr.bin/cvs/man/cvs.1 +++ b/gnu/usr.bin/cvs/man/cvs.1 @@ -192,8 +192,10 @@ Use .I editor to enter revision log information. Overrides the setting of the -.SM CVSEDITOR -and the +.SM CVSEDITOR\c +, +.SM VISUAL\c +, and .SM EDITOR environment variables. .TP @@ -358,6 +360,11 @@ file; see Incorporate a set of updates from off-site into the source repository, as a ``vendor branch''. (Changes repository.) .TP +.B init +Initialize a repository by adding the CVSROOT subdirectory and some default +control files. You must use this command or initialize the repository in +some other way before you can use it. +.TP .B log Display log information. @@ -473,13 +480,6 @@ is available with these commands: .BR checkout ", " export ", " .BR rdiff ", " rtag ", and " update . .TP -.B \-H -Help; describe the options available for this command. This is the -only option supported for -.I all -.B cvs -commands. -.TP \fB\-k\fP \fIkflag\fP Alter the default processing of keywords. @@ -1684,7 +1684,7 @@ executes recursively through subdirectories; you can prevent this by using the standard \fB\-l\fP option, or specify the recursion explicitly by using \fB\-R\fP. .TP -\fBupdate\fP [\fB\-Adf\|lPpQqR\fP] [\fB\-d\fP] [\fB\-r\fP \fItag\fP|\fB\-D\fP \fIdate\fP] \fIfiles\|.\|.\|.\fP +\fBupdate\fP [\fB\-ACdf\|lPpQqR\fP] [\fB\-d\fP] [\fB\-r\fP \fItag\fP|\fB\-D\fP \fIdate\fP] \fIfiles\|.\|.\|.\fP .I Requires: repository, working directory. .br @@ -1841,6 +1841,12 @@ Use .` "\-I !" to avoid ignoring any files at all. .SP +Use the +.` "\-C" +option to overwrite locally modified files with clean copies from +the repository (the modified file is saved in +`\fB.#\fP\fIfile\fP\fB.\fP\fIrevision\fP', however). +.SP The standard \fBcvs\fP command options \fB\-f\fP, \fB\-k\fP, \fB\-l\fP, \fB\-P\fP, \fB\-p\fP, and \fB\-r\fP are also available with \fBupdate\fP. @@ -2035,12 +2041,13 @@ and Specifies the program to use for recording log messages during .BR commit . If not set, the +.SM VISUAL +and .SM EDITOR -environment variable is used instead. -If -.SM EDITOR -is not set either, the default is -.BR /usr/ucb/vi . +environment variables are tried (in that order). +If neither is set, a system-dependent default editor (e.g., +.BR vi ) +is used. .TP .SM CVS_IGNORE_REMOTE_ROOT If this variable is set then diff --git a/gnu/usr.bin/cvs/src/Makefile.in b/gnu/usr.bin/cvs/src/Makefile.in index 0caeb48f3f9..833d35780eb 100644 --- a/gnu/usr.bin/cvs/src/Makefile.in +++ b/gnu/usr.bin/cvs/src/Makefile.in @@ -22,13 +22,13 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ # Where to install the executables. -bindir = $(exec_prefix)/bin +bindir = @bindir@ # Where to put the system-wide .cvsrc file datadir = $(prefix)/share # Where to put the manual pages. -mandir = $(prefix)/man +mandir = @mandir@ # Use cp if you don't have install. INSTALL = @INSTALL@ diff --git a/gnu/usr.bin/cvs/src/checkout.c b/gnu/usr.bin/cvs/src/checkout.c index a7d942f5d35..1a66b5be6f9 100644 --- a/gnu/usr.bin/cvs/src/checkout.c +++ b/gnu/usr.bin/cvs/src/checkout.c @@ -37,11 +37,10 @@ #include "cvs.h" static char *findslash PROTO((char *start, char *p)); -static int checkout_proc PROTO((int *pargc, char **argv, char *where, +static int checkout_proc PROTO((int argc, char **argv, char *where, char *mwhere, char *mfile, int shorten, int local_specified, char *omodule, char *msg)); -static int safe_location PROTO((void)); static const char *const checkout_usage[] = { @@ -95,6 +94,7 @@ static char *join_rev2 = NULL; static int join_tags_validated = 0; static char *preload_update_dir = NULL; static char *history_name = NULL; +static enum mtype m_type; int checkout (argc, argv) @@ -111,7 +111,6 @@ checkout (argc, argv) char *where = NULL; char *valid_options; const char *const *valid_usage; - enum mtype m_type; /* * A smaller subset of options are allowed for the export command, which @@ -233,7 +232,7 @@ checkout (argc, argv) if (where && pipeout) error (1, 0, "-d and -p are mutually exclusive"); - if (strcmp (command_name, "export") == 0) + if (m_type == EXPORT) { if (!tag && !date) error (1, 0, "must specify a tag or date"); @@ -294,7 +293,7 @@ checkout (argc, argv) send_arg("-A"); if (!shorten) send_arg("-N"); - if (checkout_prune_dirs && strcmp (command_name, "export") != 0) + if (checkout_prune_dirs && m_type == CHECKOUT) send_arg("-P"); client_prune_dirs = checkout_prune_dirs; if (cat) @@ -325,10 +324,7 @@ checkout (argc, argv) client_nonexpanded_setup (); } - send_to_server (strcmp (command_name, "export") == 0 ? - "export\012" : "co\012", - 0); - + send_to_server (m_type == EXPORT ? "export\012" : "co\012", 0); return get_responses_and_close (); } #endif /* CLIENT_SUPPORT */ @@ -355,7 +351,7 @@ checkout (argc, argv) /* If we will be calling history_write, work out the name to pass it. */ - if (strcmp (command_name, "export") != 0 && !pipeout) + if (m_type == CHECKOUT && !pipeout) { if (tag && date) { @@ -379,7 +375,10 @@ checkout (argc, argv) return (err); } -static int +/* FIXME: This is and emptydir_name are in checkout.c for historical + reasons, probably want to move them. */ + +int safe_location () { char *current; @@ -455,7 +454,12 @@ build_one_dir (repository, dirpath, sticky) { FILE *fp; - if (!isfile (CVSADM) && strcmp (command_name, "export") != 0) + if (isfile (CVSADM)) + { + if (m_type == EXPORT) + error (1, 0, "cannot export into a working directory"); + } + else if (m_type == CHECKOUT) { /* I suspect that this check could be omitted. */ if (!isdir (repository)) @@ -471,7 +475,7 @@ build_one_dir (repository, dirpath, sticky) then rewrite it later via WriteTag, once we've had a chance to call RCS_nodeisbranch on each file. */ - 0, 1)) + 0, 1, 1)) return; if (!noexec) @@ -492,9 +496,9 @@ build_one_dir (repository, dirpath, sticky) */ /* ARGSUSED */ static int -checkout_proc (pargc, argv, where_orig, mwhere, mfile, shorten, +checkout_proc (argc, argv, where_orig, mwhere, mfile, shorten, local_specified, omodule, msg) - int *pargc; + int argc; char **argv; char *where_orig; char *mwhere; @@ -504,6 +508,7 @@ checkout_proc (pargc, argv, where_orig, mwhere, mfile, shorten, char *omodule; char *msg; { + char *myargv[2]; int err = 0; int which; char *cp; @@ -665,26 +670,10 @@ checkout_proc (pargc, argv, where_orig, mwhere, mfile, shorten, { /* It's a file, which means we have to screw around with argv. */ - - int i; - - - /* Paranoia check. */ - - if (*pargc > 1) - { - error (0, 0, "checkout_proc: trashing argv elements!"); - for (i = 1; i < *pargc; i++) - { - error (0, 0, "checkout_proc: argv[%d] `%s'", - i, argv[i]); - } - } - - for (i = 1; i < *pargc; i++) - free (argv[i]); - argv[1] = xstrdup (mfile); - (*pargc) = 2; + myargv[0] = argv[0]; + myargv[1] = mfile; + argc = 2; + argv = myargv; } free (path); } @@ -745,7 +734,7 @@ internal error: %s doesn't start with %s in checkout_proc", NT, &c, if the user specifies '\'. Likewise for the call to findslash. */ cp = where + strlen (where); - while (1) + while (cp > where) { struct dir_to_build *new; @@ -761,7 +750,7 @@ internal error: %s doesn't start with %s in checkout_proc", last path element we create should be the top-level directory. */ - if (cp - where) + if (cp > where) { strncpy (new->dirpath, where, cp - where); new->dirpath[cp - where] = '\0'; @@ -769,7 +758,7 @@ internal error: %s doesn't start with %s in checkout_proc", else { /* where should always be at least one character long. */ - assert (strlen (where)); + assert (where[0] != '\0'); strcpy (new->dirpath, "/"); } new->next = head; @@ -841,10 +830,11 @@ internal error: %s doesn't start with %s in checkout_proc", { /* It's a directory in the repository! */ - char *rp = strrchr (reposcopy, '/'); + char *rp; /* We'll always be below CVSROOT, but check for paranoia's sake. */ + rp = strrchr (reposcopy, '/'); if (rp == NULL) error (1, 0, "internal error: %s doesn't contain a slash", @@ -890,7 +880,7 @@ internal error: %s doesn't start with %s in checkout_proc", { /* It may be argued that we shouldn't set any sticky bits for the top-level repository. FIXME? */ - build_one_dir (CVSroot_directory, ".", *pargc <= 1); + build_one_dir (CVSroot_directory, ".", argc <= 1); #ifdef SERVER_SUPPORT /* We _always_ want to have a top-level admin @@ -912,7 +902,7 @@ internal error: %s doesn't start with %s in checkout_proc", contain a CVS subdir yet, but all the others contain CVS and Entries.Static files */ - if (build_dirs_and_chdir (head, *pargc <= 1) != 0) + if (build_dirs_and_chdir (head, argc <= 1) != 0) { error (0, 0, "ignoring module %s", omodule); err = 1; @@ -925,14 +915,15 @@ internal error: %s doesn't start with %s in checkout_proc", { FILE *fp; - if (!noexec && *pargc > 1) + if (!noexec && argc > 1) { /* I'm not sure whether this check is redundant. */ if (!isdir (repository)) error (1, 0, "there is no repository %s", repository); Create_Admin (".", preload_update_dir, repository, - (char *) NULL, (char *) NULL, 0, 0); + (char *) NULL, (char *) NULL, 0, 0, + m_type == CHECKOUT); fp = open_file (CVSADM_ENTSTAT, "w+"); if (fclose(fp) == EOF) error(1, errno, "cannot close %s", CVSADM_ENTSTAT); @@ -955,13 +946,16 @@ internal error: %s doesn't start with %s in checkout_proc", then rewrite it later via WriteTag, once we've had a chance to call RCS_nodeisbranch on each file. */ - 0, 0); + 0, 0, m_type == CHECKOUT); } } else { char *repos; + if (m_type == EXPORT) + error (1, 0, "cannot export into working directory"); + /* get the contents of the previously existing repository */ repos = Name_Repository ((char *) NULL, preload_update_dir); if (fncmp (repository, repos) != 0) @@ -993,7 +987,7 @@ internal error: %s doesn't start with %s in checkout_proc", which = W_REPOS; if (tag != NULL && !tag_validated) { - tag_check_valid (tag, *pargc - 1, argv + 1, 0, aflag, NULL); + tag_check_valid (tag, argc - 1, argv + 1, 0, aflag, NULL); tag_validated = 1; } } @@ -1002,7 +996,7 @@ internal error: %s doesn't start with %s in checkout_proc", which = W_LOCAL | W_REPOS; if (tag != NULL && !tag_validated) { - tag_check_valid (tag, *pargc - 1, argv + 1, 0, aflag, + tag_check_valid (tag, argc - 1, argv + 1, 0, aflag, repository); tag_validated = 1; } @@ -1014,10 +1008,10 @@ internal error: %s doesn't start with %s in checkout_proc", if (! join_tags_validated) { if (join_rev1 != NULL) - tag_check_valid_join (join_rev1, *pargc - 1, argv + 1, 0, aflag, + tag_check_valid_join (join_rev1, argc - 1, argv + 1, 0, aflag, repository); if (join_rev2 != NULL) - tag_check_valid_join (join_rev2, *pargc - 1, argv + 1, 0, aflag, + tag_check_valid_join (join_rev2, argc - 1, argv + 1, 0, aflag, repository); join_tags_validated = 1; } @@ -1027,12 +1021,12 @@ internal error: %s doesn't start with %s in checkout_proc", * update recursion processor. We will be recursive unless either local * only was specified, or we were passed arguments */ - if (!(local_specified || *pargc > 1)) + if (!(local_specified || argc > 1)) { - if (strcmp (command_name, "export") != 0 && !pipeout) + if (m_type == CHECKOUT && !pipeout) history_write ('O', preload_update_dir, history_name, where, repository); - else if (strcmp (command_name, "export") == 0 && !pipeout) + else if (m_type == EXPORT && !pipeout) history_write ('E', preload_update_dir, tag ? tag : date, where, repository); err += do_update (0, (char **) NULL, options, tag, date, @@ -1050,7 +1044,7 @@ internal error: %s doesn't start with %s in checkout_proc", /* we are only doing files, so register them */ entries = Entries_Open (0, NULL); - for (i = 1; i < *pargc; i++) + for (i = 1; i < argc; i++) { char *line; Vers_TS *vers; @@ -1087,12 +1081,12 @@ internal error: %s doesn't start with %s in checkout_proc", } /* Don't log "export", just regular "checkouts" */ - if (strcmp (command_name, "export") != 0 && !pipeout) + if (m_type == CHECKOUT && !pipeout) history_write ('O', preload_update_dir, history_name, where, repository); /* go ahead and call update now that everything is set */ - err += do_update (*pargc - 1, argv + 1, options, tag, date, + err += do_update (argc - 1, argv + 1, options, tag, date, force_tag_match, local_specified, 1 /* update -d */, aflag, checkout_prune_dirs, pipeout, which, join_rev1, join_rev2, preload_update_dir); @@ -1109,15 +1103,13 @@ findslash (start, p) char *start; char *p; { - while (p >= start && *p != '/') - p--; - /* FIXME: indexing off the start of the array like this is *NOT* - OK according to ANSI, and will break some of the time on certain - segmented architectures. */ - if (p < start) - return (NULL); - else - return (p); + for (;;) + { + if (*p == '/') return p; + if (p == start) break; + --p; + } + return NULL; } /* Return a newly malloc'd string containing a pathname for CVSNULLREPOS, @@ -1185,5 +1177,14 @@ build_dirs_and_chdir (dirs, sticky) } out: + while (dirs != NULL) + { + if (dirs->repository != NULL) + free (dirs->repository); + nextdir = dirs->next; + free (dirs->dirpath); + free (dirs); + dirs = nextdir; + } return retval; } diff --git a/gnu/usr.bin/cvs/src/client.c b/gnu/usr.bin/cvs/src/client.c index 8bc44b2bd38..c937e298986 100644 --- a/gnu/usr.bin/cvs/src/client.c +++ b/gnu/usr.bin/cvs/src/client.c @@ -1,3 +1,5 @@ +/* JT thinks BeOS is worth the trouble. */ + /* CVS client-related stuff. This program is free software; you can redistribute it and/or modify @@ -60,7 +62,6 @@ extern char *strerror (); #if HAVE_KERBEROS #define CVS_PORT 1999 -#if HAVE_KERBEROS #include <krb.h> extern char *krb_realmofhost (); @@ -74,8 +75,6 @@ static Key_schedule sched; #endif /* HAVE_KERBEROS */ -#endif /* HAVE_KERBEROS */ - #ifdef HAVE_GSSAPI #ifdef HAVE_GSSAPI_H @@ -1115,7 +1114,7 @@ call_in_directory (pathname, func, data) strcpy (r, "/."); Create_Admin (".", ".", repo, (char *) NULL, - (char *) NULL, 0, 1); + (char *) NULL, 0, 1, 1); free (repo); } @@ -1252,7 +1251,7 @@ warning: server is not creating directories one at a time"); strcpy (r, reposdirname); Create_Admin (dir, dir, repo, - (char *)NULL, (char *)NULL, 0, 0); + (char *)NULL, (char *)NULL, 0, 0, 1); free (repo); b = strrchr (dir, '/'); @@ -1760,6 +1759,7 @@ update_entries (data_arg, ent_list, short_pathname, filename) } free (mode_string); + free (scratch_entries); free (entries_line); /* The Mode, Mod-time, and Checksum responses should not carry @@ -1847,7 +1847,8 @@ update_entries (data_arg, ent_list, short_pathname, filename) if (use_gzip) { - if (gunzip_and_write (fd, short_pathname, buf, size)) + if (gunzip_and_write (fd, short_pathname, + (unsigned char *) buf, size)) error (1, 0, "aborting due to compression error"); } else if (write (fd, buf, size) != size) @@ -2025,6 +2026,8 @@ update_entries (data_arg, ent_list, short_pathname, filename) free (mode_string); free (buf); + free (scratch_entries); + free (entries_line); return; } @@ -2123,8 +2126,8 @@ update_entries (data_arg, ent_list, short_pathname, filename) if (file_timestamp) free (file_timestamp); - free (scratch_entries); } + free (scratch_entries); free (entries_line); } @@ -2490,7 +2493,11 @@ handle_set_checkin_prog (args, len) { char *prog; struct save_prog *p; + read_line (&prog); + if (strcmp (command_name, "export") == 0) + return; + p = (struct save_prog *) xmalloc (sizeof (struct save_prog)); p->next = checkin_progs; p->dir = xstrdup (args); @@ -2505,7 +2512,11 @@ handle_set_update_prog (args, len) { char *prog; struct save_prog *p; + read_line (&prog); + if (strcmp (command_name, "export") == 0) + return; + p = (struct save_prog *) xmalloc (sizeof (struct save_prog)); p->next = update_progs; p->dir = xstrdup (args); @@ -2683,7 +2694,7 @@ send_repository (dir, repos, update_dir) { Node *n; n = getnode (); - n->type = UNKNOWN; + n->type = NT_UNKNOWN; n->key = xstrdup (update_dir); n->data = NULL; @@ -3594,19 +3605,15 @@ get_responses_and_close () && waitpid (rsh_pid, (int *) 0, 0) == -1) error (1, errno, "waiting for process %d", rsh_pid); + buf_free (to_server); + buf_free (from_server); server_started = 0; - /* see if we need to sleep before returning */ + /* see if we need to sleep before returning to avoid time-stamp races */ if (last_register_time) { - time_t now; - - for (;;) - { - (void) time (&now); - if (now != last_register_time) break; - sleep (1); /* to avoid time-stamp races */ - } + while (time ((time_t *) NULL) == last_register_time) + sleep (1); } return errs; @@ -3774,6 +3781,7 @@ connect_to_pserver (tofdp, fromfdp, verify_only, do_gssapi) int port_number; struct sockaddr_in client_sai; struct hostent *hostinfo; + char no_passwd = 0; /* gets set if no password found */ sock = socket (AF_INET, SOCK_STREAM, 0); if (sock == -1) @@ -3818,6 +3826,14 @@ connect_to_pserver (tofdp, fromfdp, verify_only, do_gssapi) /* Get the password, probably from ~/.cvspass. */ password = get_cvs_password (); + + /* Send the empty string by default. This is so anonymous CVS + access doesn't require client to have done "cvs login". */ + if (password == NULL) + { + no_passwd = 1; + password = scramble (""); + } /* Announce that we're starting the authorization protocol. */ if (send (sock, begin, strlen (begin), 0) < 0) @@ -3841,8 +3857,8 @@ connect_to_pserver (tofdp, fromfdp, verify_only, do_gssapi) if (send (sock, end, strlen (end), 0) < 0) error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO)); - /* Paranoia. */ - memset (password, 0, strlen (password)); + /* Paranoia. */ + memset (password, 0, strlen (password)); } { @@ -3935,20 +3951,28 @@ connect_to_pserver (tofdp, fromfdp, verify_only, do_gssapi) return; rejected: + error (0, 0, + "authorization failed: server %s rejected access to %s for user %s", + CVSroot_hostname, CVSroot_directory, CVSroot_username); + + /* Output a special error message if authentication was attempted + with no password -- the user should be made aware that they may + have missed a step. */ + if (no_passwd) + { + error (0, 0, + "used empty password; try \"cvs login\" with a real password"); + } + if (shutdown (sock, 2) < 0) { - error (0, 0, - "authorization failed: server %s rejected access", - CVSroot_hostname); - error (1, 0, + error (0, 0, "shutdown() failed (server %s): %s", CVSroot_hostname, SOCK_STRERROR (SOCK_ERRNO)); } - error (1, 0, - "authorization failed: server %s rejected access", - CVSroot_hostname); + error_exit(); } #endif /* AUTH_CLIENT_SUPPORT */ @@ -4111,9 +4135,16 @@ connect_to_gserver (sock, hostinfo) if (stat_maj != GSS_S_COMPLETE && stat_maj != GSS_S_CONTINUE_NEEDED) { OM_uint32 message_context; + OM_uint32 new_stat_min; + + message_context = 0; + gss_display_status (&new_stat_min, stat_maj, GSS_C_GSS_CODE, + GSS_C_NULL_OID, &message_context, &tok_out); + error (0, 0, "GSSAPI authentication failed: %s", + (char *) tok_out.value); message_context = 0; - gss_display_status (&stat_min, stat_maj, GSS_C_GSS_CODE, + gss_display_status (&new_stat_min, stat_min, GSS_C_MECH_CODE, GSS_C_NULL_OID, &message_context, &tok_out); error (1, 0, "GSSAPI authentication failed: %s", (char *) tok_out.value); @@ -4137,7 +4168,29 @@ connect_to_gserver (sock, hostinfo) recv_bytes (sock, cbuf, 2); need = ((cbuf[0] & 0xff) << 8) | (cbuf[1] & 0xff); - assert (need <= sizeof buf); + + if (need > sizeof buf) + { + int got; + + /* This usually means that the server sent us an error + message. Read it byte by byte and print it out. + FIXME: This is a terrible error handling strategy. + However, even if we fix the server, we will still + want to do this to work with older servers. */ + buf[0] = cbuf[0]; + buf[1] = cbuf[1]; + got = recv (sock, buf + 2, sizeof buf - 2, 0); + if (got < 0) + error (1, 0, "recv() from server %s: %s", + CVSroot_hostname, SOCK_STRERROR (SOCK_ERRNO)); + buf[got + 2] = '\0'; + if (buf[got + 1] == '\n') + buf[got + 1] = '\0'; + error (1, 0, "error from server %s: %s", CVSroot_hostname, + buf); + } + recv_bytes (sock, buf, need); tok_in.length = need; } @@ -4171,7 +4224,7 @@ send_variable_proc (node, closure) void start_server () { - int tofd, fromfd; + int tofd, fromfd, rootless; char *log = getenv ("CVS_CLIENT_LOG"); @@ -4350,7 +4403,8 @@ the :server: access method is not supported by this port of CVS"); stored_mode = NULL; } - if (strcmp (command_name, "init") != 0) + rootless = (strcmp (command_name, "init") == 0); + if (!rootless) { send_to_server ("Root ", 0); send_to_server (CVSroot_directory, 0); @@ -4474,7 +4528,7 @@ the :server: access method is not supported by this port of CVS"); } } - if (cvsencrypt) + if (cvsencrypt && !rootless) { #ifdef ENCRYPTION /* Turn on encryption before turning on compression. We do @@ -4521,7 +4575,7 @@ the :server: access method is not supported by this port of CVS"); #endif /* ! ENCRYPTION */ } - if (gzip_level) + if (gzip_level && !rootless) { if (supported_request ("Gzip-stream")) { @@ -4563,7 +4617,7 @@ the :server: access method is not supported by this port of CVS"); } } - if (cvsauthenticate && ! cvsencrypt) + if (cvsauthenticate && ! cvsencrypt && !rootless) { /* Turn on authentication after turning on compression, so that we can compress the authentication information. We @@ -4594,7 +4648,7 @@ the :server: access method is not supported by this port of CVS"); } #ifdef FILENAMES_CASE_INSENSITIVE - if (supported_request ("Case")) + if (supported_request ("Case") && !rootless) send_to_server ("Case\012", 0); #endif @@ -4967,6 +5021,7 @@ struct send_data int build_dirs; int force; int no_contents; + int backup_modified; }; static int send_fileproc PROTO ((void *callerdat, struct file_info *finfo)); @@ -5088,6 +5143,18 @@ warning: ignoring -k options due to server limitations"); } else send_modified (filename, finfo->fullname, vers); + + if (args->backup_modified) + { + char *bakname; + bakname = backup_file (filename, vers->vn_user); + /* This behavior is sufficiently unexpected to + justify overinformativeness, I think. */ + if (! really_quiet) + printf ("(Locally modified %s moved to %s)\n", + filename, bakname); + free (bakname); + } } else { @@ -5196,9 +5263,6 @@ send_dirent_proc (callerdat, dir, repository, update_dir, entries) dir_exists = isdir (cvsadm_name); free (cvsadm_name); - /* initialize the ignore list for this directory */ - ignlist = getlist (); - /* * If there is an empty directory (e.g. we are doing `cvs add' on a * newly-created directory), the server still needs to know about it. @@ -5214,6 +5278,9 @@ send_dirent_proc (callerdat, dir, repository, update_dir, entries) char *repos = Name_Repository (dir, update_dir); send_a_repository (dir, repos, update_dir); free (repos); + + /* initialize the ignore list for this directory */ + ignlist = getlist (); } else { @@ -5238,6 +5305,29 @@ send_dirent_proc (callerdat, dir, repository, update_dir, entries) return (dir_exists ? R_PROCESS : R_SKIP_ALL); } +static int send_dirleave_proc PROTO ((void *, char *, int, char *, List *)); + +/* + * send_dirleave_proc () is called back by the recursion code upon leaving + * a directory. All it does is delete the ignore list if it hasn't already + * been done (by send_filesdone_proc). + */ +/* ARGSUSED */ +static int +send_dirleave_proc (callerdat, dir, err, update_dir, entries) + void *callerdat; + char *dir; + int err; + char *update_dir; + List *entries; +{ + + /* Delete the ignore list if it hasn't already been done. */ + if (ignlist) + dellist (&ignlist); + return err; +} + /* * Send each option in a string to the server, one by one. * This assumes that the options are separated by spaces, for example @@ -5429,9 +5519,10 @@ send_files (argc, argv, local, aflag, flags) args.build_dirs = flags & SEND_BUILD_DIRS; args.force = flags & SEND_FORCE; args.no_contents = flags & SEND_NO_CONTENTS; + args.backup_modified = flags & BACKUP_MODIFIED_FILES; err = start_recursion (send_fileproc, send_filesdoneproc, - send_dirent_proc, (DIRLEAVEPROC)NULL, (void *) &args, + send_dirent_proc, send_dirleave_proc, (void *) &args, argc, argv, local, W_LOCAL, aflag, 0, (char *)NULL, 0); if (err) error_exit (); diff --git a/gnu/usr.bin/cvs/src/commit.c b/gnu/usr.bin/cvs/src/commit.c index c4cbd24f18e..1c1f71c48a3 100644 --- a/gnu/usr.bin/cvs/src/commit.c +++ b/gnu/usr.bin/cvs/src/commit.c @@ -263,6 +263,7 @@ find_fileproc (callerdat, finfo) else error (0, 0, "use `%s add' to create an entry for %s", program_name, finfo->fullname); + freevers_ts (&vers); return 1; } else if (vers->ts_user != NULL @@ -284,6 +285,7 @@ find_fileproc (callerdat, finfo) cases. FIXME: we probably should be printing a message and returning 1 for many of those cases (but I'm not sure exactly which ones). */ + freevers_ts (&vers); return 0; } @@ -421,28 +423,12 @@ commit (argc, argv) /* some checks related to the "-F logfile" option */ if (logfile) { - int n, logfd; - struct stat statbuf; + size_t size = 0, len; if (saved_message) error (1, 0, "cannot specify both a message and a log file"); - /* FIXME: Why is this binary? Needs more investigation. */ - if ((logfd = CVS_OPEN (logfile, O_RDONLY | OPEN_BINARY)) < 0) - error (1, errno, "cannot open log file %s", logfile); - - if (fstat(logfd, &statbuf) < 0) - error (1, errno, "cannot find size of log file %s", logfile); - - saved_message = xmalloc (statbuf.st_size + 1); - - /* FIXME: Should keep reading until EOF, rather than assuming the - first read gets the whole thing. */ - if ((n = read (logfd, saved_message, statbuf.st_size + 1)) < 0) - error (1, errno, "cannot read log message from %s", logfile); - - (void) close (logfd); - saved_message[n] = '\0'; + get_file (logfile, logfile, "r", &saved_message, &size, &len); } #ifdef CLIENT_SUPPORT @@ -473,11 +459,14 @@ commit (argc, argv) error (1, 0, "correct above errors first!"); if (find_args.argc == 0) + { /* Nothing to commit. Exit now without contacting the server (note that this means that we won't print "? foo" for files which merit it, because we don't know what is in the CVSROOT/cvsignore file). */ + dellist (&find_args.ulist); return 0; + } /* Now we keep track of which files we actually are going to operate on, and only work with those files in the future. @@ -583,6 +572,8 @@ commit (argc, argv) previous versions of client/server CVS, but it probably is a Good Thing, or at least Not Such A Bad Thing. */ send_file_names (find_args.argc, find_args.argv, 0); + free (find_args.argv); + dellist (&find_args.ulist); send_to_server ("ci\012", 0); err = get_responses_and_close (); @@ -672,16 +663,11 @@ commit (argc, argv) Lock_Cleanup (); dellist (&mulist); + /* see if we need to sleep before returning to avoid time-stamp races */ if (last_register_time) { - time_t now; - - for (;;) - { - (void) time (&now); - if (now != last_register_time) break; - sleep (1); /* to avoid time-stamp races */ - } + while (time ((time_t *) NULL) == last_register_time) + sleep (1); } return (err); @@ -794,6 +780,12 @@ check_fileproc (callerdat, finfo) size_t cvsroot_len = strlen (CVSroot_directory); + if (!finfo->repository) + { + error (0, 0, "nothing known about `%s'", finfo->fullname); + return (1); + } + if (strncmp (finfo->repository, CVSroot_directory, cvsroot_len) == 0 && ISDIRSEP (finfo->repository[cvsroot_len]) && strncmp (finfo->repository + cvsroot_len + 1, @@ -1290,6 +1282,8 @@ commit_fileproc (callerdat, finfo) { if (finfo->rcs == NULL) error (1, 0, "internal error: no parsed RCS file"); + if (ci->rev) + free (ci->rev); ci->rev = RCS_whatbranch (finfo->rcs, ci->tag); err = Checkin ('A', finfo, finfo->rcs->path, ci->rev, ci->tag, ci->options, saved_message); @@ -1400,6 +1394,8 @@ out: } } } + if (SIG_inCrSect ()) + SIG_endCrSect (); return (err); } @@ -1500,6 +1496,7 @@ commit_filesdoneproc (callerdat, err, repository, update_dir, entries) cvs_output (": Executing '", 0); run_print (stdout); cvs_output ("'\n", 0); + cvs_flushout (); (void) run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL); free (repos); } @@ -1582,8 +1579,10 @@ commit_dirleaveproc (callerdat, dir, err, update_dir, entries) this being a confusing feature! */ if (err == 0 && write_dirtag != NULL) { + char *repos = Name_Repository (dir, update_dir); WriteTag (NULL, write_dirtag, NULL, write_dirnonbranch, - update_dir, Name_Repository (dir, update_dir)); + update_dir, repos); + free (repos); } return (err); @@ -1751,6 +1750,9 @@ remove_file (finfo, tag, message) "failed to commit dead revision for `%s'", finfo->fullname); return (1); } + /* At this point, the file has been committed as removed. We should + probably tell the history file about it */ + history_write ('R', NULL, finfo->rcs->head, finfo->file, finfo->repository); if (rev != NULL) free (rev); @@ -1962,6 +1964,11 @@ checkaddfile (file, repository, tag, options, rcsnode) sprintf (rcs, "%s/%s%s", repository, file, RCSEXT); + /* Begin a critical section around the code that spans the + first commit on the trunk of a file that's already been + committed on a branch. */ + SIG_beginCrSect (); + if (RCS_setattic (rcsfile, 0)) { retval = 1; @@ -2044,74 +2051,76 @@ checkaddfile (file, repository, tag, options, rcsnode) newfile = 1; if (desc != NULL) free (desc); + if (rcsnode != NULL) + { + assert (*rcsnode == NULL); + *rcsnode = rcsfile; + } } /* when adding a file for the first time, and using a tag, we need to create a dead revision on the trunk. */ - if (adding_on_branch && newfile) + if (adding_on_branch) { - char *tmp; - FILE *fp; - - /* move the new file out of the way. */ - fname = xmalloc (strlen (file) + sizeof (CVSADM) - + sizeof (CVSPREFIX) + 10); - (void) sprintf (fname, "%s/%s%s", CVSADM, CVSPREFIX, file); - rename_file (file, fname); - - /* Create empty FILE. Can't use copy_file with a DEVNULL - argument -- copy_file now ignores device files. */ - fp = fopen (file, "w"); - if (fp == NULL) - error (1, errno, "cannot open %s for writing", file); - if (fclose (fp) < 0) - error (0, errno, "cannot close %s", file); - - tmp = xmalloc (strlen (file) + strlen (tag) + 80); - /* commit a dead revision. */ - (void) sprintf (tmp, "file %s was initially added on branch %s.", - file, tag); - retcode = RCS_checkin (rcsfile, NULL, tmp, NULL, - RCS_FLAGS_DEAD | RCS_FLAGS_QUIET); - free (tmp); - if (retcode != 0) + if (newfile) { - error (retcode == -1 ? 1 : 0, retcode == -1 ? errno : 0, - "could not create initial dead revision %s", rcs); - retval = 1; - goto out; - } + char *tmp; + FILE *fp; - /* put the new file back where it was */ - rename_file (fname, file); - free (fname); + /* move the new file out of the way. */ + fname = xmalloc (strlen (file) + sizeof (CVSADM) + + sizeof (CVSPREFIX) + 10); + (void) sprintf (fname, "%s/%s%s", CVSADM, CVSPREFIX, file); + rename_file (file, fname); - /* double-check that the file was written correctly */ - freercsnode (&rcsfile); - rcsfile = RCS_parse (file, repository); - if (rcsfile == NULL) - { - error (0, 0, "could not read %s", rcs); - retval = 1; - goto out; - } - if (rcsnode != NULL) - { - assert (*rcsnode == NULL); - *rcsnode = rcsfile; - } + /* Create empty FILE. Can't use copy_file with a DEVNULL + argument -- copy_file now ignores device files. */ + fp = fopen (file, "w"); + if (fp == NULL) + error (1, errno, "cannot open %s for writing", file); + if (fclose (fp) < 0) + error (0, errno, "cannot close %s", file); + + tmp = xmalloc (strlen (file) + strlen (tag) + 80); + /* commit a dead revision. */ + (void) sprintf (tmp, "file %s was initially added on branch %s.", + file, tag); + retcode = RCS_checkin (rcsfile, NULL, tmp, NULL, + RCS_FLAGS_DEAD | RCS_FLAGS_QUIET); + free (tmp); + if (retcode != 0) + { + error (retcode == -1 ? 1 : 0, retcode == -1 ? errno : 0, + "could not create initial dead revision %s", rcs); + retval = 1; + goto out; + } - /* and lock it once again. */ - if (lock_RCS (file, rcsfile, NULL, repository)) - { - error (0, 0, "cannot lock `%s'.", rcs); - retval = 1; - goto out; + /* put the new file back where it was */ + rename_file (fname, file); + free (fname); + + /* double-check that the file was written correctly */ + freercsnode (&rcsfile); + rcsfile = RCS_parse (file, repository); + if (rcsfile == NULL) + { + error (0, 0, "could not read %s", rcs); + retval = 1; + goto out; + } + if (rcsnode != NULL) + *rcsnode = rcsfile; + + /* and lock it once again. */ + if (lock_RCS (file, rcsfile, NULL, repository)) + { + error (0, 0, "cannot lock `%s'.", rcs); + retval = 1; + goto out; + } } - } - if (adding_on_branch) - { /* when adding with a tag, we need to stub a branch, if it doesn't already exist. */ @@ -2194,6 +2203,8 @@ checkaddfile (file, repository, tag, options, rcsnode) retval = 0; out: + if (retval != 0 && SIG_inCrSect ()) + SIG_endCrSect (); free (rcs); return retval; } diff --git a/gnu/usr.bin/cvs/src/cvs.h b/gnu/usr.bin/cvs/src/cvs.h index 1ffa7d91ae6..40892ceb3fb 100644 --- a/gnu/usr.bin/cvs/src/cvs.h +++ b/gnu/usr.bin/cvs/src/cvs.h @@ -393,6 +393,7 @@ extern List *root_directories; extern char *current_root; extern char *emptydir_name PROTO ((void)); +extern int safe_location PROTO ((void)); extern int trace; /* Show all commands */ extern int noexec; /* Don't modify disk anywhere */ @@ -503,7 +504,7 @@ void *valloc PROTO((size_t bytes)); time_t get_date PROTO((char *date, struct timeb *now)); extern int Create_Admin PROTO ((char *dir, char *update_dir, char *repository, char *tag, char *date, - int nonbranch, int warn)); + int nonbranch, int warn, int dotemplate)); extern int expand_at_signs PROTO ((char *, off_t, FILE *)); /* Locking subsystem (implemented in lock.c). */ @@ -529,7 +530,7 @@ void cat_module PROTO((int status)); void check_entries PROTO((char *dir)); void close_module PROTO((DBM * db)); void copy_file PROTO((const char *from, const char *to)); -void fperror PROTO((FILE * fp, int status, int errnum, char *message,...)); +void fperrmsg PROTO((FILE * fp, int status, int errnum, char *message,...)); void free_names PROTO((int *pargc, char *argv[])); extern int ign_name PROTO ((char *name)); @@ -550,6 +551,7 @@ void make_directories PROTO((const char *name)); void make_directory PROTO((const char *name)); extern int mkdir_if_needed PROTO ((char *name)); void rename_file PROTO((const char *from, const char *to)); +char *backup_file PROTO((const char *file, const char *suffix)); /* Expand wildcards in each element of (ARGC,ARGV). This is according to the files which exist in the current directory, and accordingly to OS-specific conventions regarding wildcard syntax. It might be desirable to change the @@ -581,7 +583,7 @@ void do_editor PROTO((char *dir, char **messagep, void do_verify PROTO((char *message, char *repository)); -typedef int (*CALLBACKPROC) PROTO((int *pargc, char *argv[], char *where, +typedef int (*CALLBACKPROC) PROTO((int argc, char *argv[], char *where, char *mwhere, char *mfile, int shorten, int local_specified, char *omodule, char *msg)); @@ -640,6 +642,7 @@ int start_recursion PROTO((FILEPROC fileproc, FILESDONEPROC filesdoneproc, int dosrcs)); void SIG_beginCrSect PROTO((void)); void SIG_endCrSect PROTO((void)); +int SIG_inCrSect PROTO((void)); void read_cvsrc PROTO((int *argc, char ***argv, char *cmdname)); char *make_message_rcslegal PROTO((char *message)); @@ -857,6 +860,7 @@ extern int cvsremove PROTO((int argc, char **argv)); extern int rtag PROTO((int argc, char **argv)); extern int cvsstatus PROTO((int argc, char **argv)); extern int cvstag PROTO((int argc, char **argv)); +extern int version PROTO((int argc, char **argv)); extern unsigned long int lookup_command_attribute PROTO((char *)); @@ -873,6 +877,8 @@ extern void tag_check_valid PROTO ((char *, int, char **, int, int, char *)); extern void tag_check_valid_join PROTO ((char *, int, char **, int, int, char *)); +#include "server.h" + /* From server.c and documented there. */ extern void cvs_output PROTO ((const char *, size_t)); extern void cvs_output_binary PROTO ((char *, size_t)); @@ -880,7 +886,3 @@ extern void cvs_outerr PROTO ((const char *, size_t)); extern void cvs_flusherr PROTO ((void)); extern void cvs_flushout PROTO ((void)); extern void cvs_output_tagged PROTO ((char *, char *)); - -#if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT) -#include "server.h" -#endif diff --git a/gnu/usr.bin/cvs/src/ignore.c b/gnu/usr.bin/cvs/src/ignore.c index c2147cb1cad..ebcdf853754 100644 --- a/gnu/usr.bin/cvs/src/ignore.c +++ b/gnu/usr.bin/cvs/src/ignore.c @@ -333,9 +333,7 @@ ign_dir_add (name) (dir_ign_max + 1) * sizeof (char *)); } - dir_ign_list[dir_ign_current] = name; - - dir_ign_current += 1 ; + dir_ign_list[dir_ign_current++] = xstrdup (name); } @@ -414,9 +412,9 @@ ignore_files (ilist, entries, update_dir, proc) { file = dp->d_name; if (strcmp (file, ".") == 0 || strcmp (file, "..") == 0) - continue; + goto continue_loop; if (findnode_fn (ilist, file) != NULL) - continue; + goto continue_loop; if (subdirs) { Node *node; @@ -437,14 +435,14 @@ ignore_files (ilist, entries, update_dir, proc) dir = isdir (p); free (p); if (dir) - continue; + goto continue_loop; } } /* We could be ignoring FIFOs and other files which are neither regular files nor directories here. */ if (ign_name (file)) - continue; + goto continue_loop; if ( #ifdef DT_DIR @@ -455,9 +453,12 @@ ignore_files (ilist, entries, update_dir, proc) if ( #ifdef DT_DIR - dp->d_type == DT_DIR || dp->d_type == DT_UNKNOWN && + dp->d_type == DT_DIR + || (dp->d_type == DT_UNKNOWN && S_ISDIR (sb.st_mode)) +#else + S_ISDIR (sb.st_mode) #endif - S_ISDIR(sb.st_mode)) + ) { if (! subdirs) { @@ -468,7 +469,7 @@ ignore_files (ilist, entries, update_dir, proc) if (isdir (temp)) { free (temp); - continue; + goto continue_loop; } free (temp); } @@ -476,16 +477,20 @@ ignore_files (ilist, entries, update_dir, proc) #ifdef S_ISLNK else if ( #ifdef DT_DIR - dp->d_type == DT_LNK || dp->d_type == DT_UNKNOWN && + dp->d_type == DT_LNK + || (dp->d_type == DT_UNKNOWN && S_ISLNK(sb.st_mode)) +#else + S_ISLNK (sb.st_mode) #endif - S_ISLNK(sb.st_mode)) + ) { - continue; + goto continue_loop; } #endif } (*proc) (file, xdir); + continue_loop: errno = 0; } if (errno != 0) diff --git a/gnu/usr.bin/cvs/src/import.c b/gnu/usr.bin/cvs/src/import.c index 911ef930d19..3387914fb02 100644 --- a/gnu/usr.bin/cvs/src/import.c +++ b/gnu/usr.bin/cvs/src/import.c @@ -266,12 +266,22 @@ import (argc, argv) client_import_setup (repository); err = import_descend (message, argv[1], argc - 2, argv + 2); client_import_done (); + if (message) + free (message); + free (repository); + free (vbranch); + free (vhead); send_to_server ("import\012", 0); err += get_responses_and_close (); return err; } #endif + if (!safe_location ()) + { + error (1, 0, "attempt to import the repository"); + } + /* * Make all newly created directories writable. Should really use a more * sophisticated security mechanism here. @@ -453,9 +463,12 @@ import_descend (message, vtag, targc, targv) } else if ( #ifdef DT_DIR - dp->d_type == DT_LNK || dp->d_type == DT_UNKNOWN && + dp->d_type == DT_LNK + || (dp->d_type == DT_UNKNOWN && islink (dp->d_name)) +#else + islink (dp->d_name) #endif - islink (dp->d_name)) + ) { add_log ('L', dp->d_name); err++; @@ -725,8 +738,8 @@ add_rev (message, rcs, vfile, vers) { if (!noexec) { - fperror (logfp, 0, status == -1 ? ierrno : 0, - "ERROR: Check-in of %s failed", rcs->path); + fperrmsg (logfp, 0, status == -1 ? ierrno : 0, + "ERROR: Check-in of %s failed", rcs->path); error (0, status == -1 ? ierrno : 0, "ERROR: Check-in of %s failed", rcs->path); } @@ -765,8 +778,8 @@ add_tags (rcs, vfile, vtag, targc, targv) if ((retcode = RCS_settag(rcs, vtag, vbranch)) != 0) { ierrno = errno; - fperror (logfp, 0, retcode == -1 ? ierrno : 0, - "ERROR: Failed to set tag %s in %s", vtag, rcs->path); + fperrmsg (logfp, 0, retcode == -1 ? ierrno : 0, + "ERROR: Failed to set tag %s in %s", vtag, rcs->path); error (0, retcode == -1 ? ierrno : 0, "ERROR: Failed to set tag %s in %s", vtag, rcs->path); return (1); @@ -789,9 +802,9 @@ add_tags (rcs, vfile, vtag, targc, targv) else { ierrno = errno; - fperror (logfp, 0, retcode == -1 ? ierrno : 0, - "WARNING: Couldn't add tag %s to %s", targv[i], - rcs->path); + fperrmsg (logfp, 0, retcode == -1 ? ierrno : 0, + "WARNING: Couldn't add tag %s to %s", targv[i], + rcs->path); error (0, retcode == -1 ? ierrno : 0, "WARNING: Couldn't add tag %s to %s", targv[i], rcs->path); @@ -1054,7 +1067,14 @@ add_rcs_file (message, rcs, user, add_vhead, key_opt, stat the file before opening it. -twp */ if (CVS_LSTAT (userfile, &sb) < 0) - error (1, errno, "cannot lstat %s", user); + { + /* not fatal, continue import */ + if (add_logfp != NULL) + fperrmsg (add_logfp, 0, errno, + "ERROR: cannot lstat file %s", userfile); + error (0, errno, "cannot lstat file %s", userfile); + goto read_error; + } file_type = sb.st_mode & S_IFMT; fpuser = NULL; @@ -1069,8 +1089,8 @@ add_rcs_file (message, rcs, user, add_vhead, key_opt, { /* not fatal, continue import */ if (add_logfp != NULL) - fperror (add_logfp, 0, errno, - "ERROR: cannot read file %s", userfile); + fperrmsg (add_logfp, 0, errno, + "ERROR: cannot read file %s", userfile); error (0, errno, "ERROR: cannot read file %s", userfile); goto read_error; } @@ -1202,12 +1222,18 @@ add_rcs_file (message, rcs, user, add_vhead, key_opt, case S_IFREG: break; case S_IFCHR: case S_IFBLK: +#ifdef HAVE_ST_RDEV if (fprintf (fprcs, "special\t%s %lu;\012", (file_type == S_IFCHR ? "character" : "block"), (unsigned long) sb.st_rdev) < 0) goto write_error; +#else + error (0, 0, +"can't import %s: unable to import device files on this system", +userfile); +#endif break; default: error (0, 0, @@ -1253,12 +1279,18 @@ add_rcs_file (message, rcs, user, add_vhead, key_opt, case S_IFREG: break; case S_IFCHR: case S_IFBLK: +#ifdef HAVE_ST_RDEV if (fprintf (fprcs, "special\t%s %lu;\012", (file_type == S_IFCHR ? "character" : "block"), (unsigned long) sb.st_rdev) < 0) goto write_error; +#else + error (0, 0, +"can't import %s: unable to import device files on this system", +userfile); +#endif break; default: error (0, 0, @@ -1377,8 +1409,8 @@ add_rcs_file (message, rcs, user, add_vhead, key_opt, { ierrno = errno; if (add_logfp != NULL) - fperror (add_logfp, 0, ierrno, - "WARNING: cannot change mode of file %s", rcs); + fperrmsg (add_logfp, 0, ierrno, + "WARNING: cannot change mode of file %s", rcs); error (0, ierrno, "WARNING: cannot change mode of file %s", rcs); err++; } @@ -1397,14 +1429,14 @@ write_error_noclose: if (fclose (fpuser) < 0) error (0, errno, "cannot close %s", user); if (add_logfp != NULL) - fperror (add_logfp, 0, ierrno, "ERROR: cannot write file %s", rcs); + fperrmsg (add_logfp, 0, ierrno, "ERROR: cannot write file %s", rcs); error (0, ierrno, "ERROR: cannot write file %s", rcs); if (ierrno == ENOSPC) { if (CVS_UNLINK (rcs) < 0) error (0, errno, "cannot remove %s", rcs); if (add_logfp != NULL) - fperror (add_logfp, 0, 0, "ERROR: out of space - aborting"); + fperrmsg (add_logfp, 0, 0, "ERROR: out of space - aborting"); error (1, 0, "ERROR: out of space - aborting"); } read_error: @@ -1513,7 +1545,7 @@ import_descend_dir (message, dir, vtag, targc, targv) return (0); if (save_cwd (&cwd)) { - fperror (logfp, 0, 0, "ERROR: cannot get working directory"); + fperrmsg (logfp, 0, 0, "ERROR: cannot get working directory"); return (1); } @@ -1544,7 +1576,7 @@ import_descend_dir (message, dir, vtag, targc, targv) if ( CVS_CHDIR (dir) < 0) { ierrno = errno; - fperror (logfp, 0, ierrno, "ERROR: cannot chdir to %s", repository); + fperrmsg (logfp, 0, ierrno, "ERROR: cannot chdir to %s", repository); error (0, ierrno, "ERROR: cannot chdir to %s", repository); err = 1; goto out; @@ -1559,9 +1591,9 @@ import_descend_dir (message, dir, vtag, targc, targv) (void) sprintf (rcs, "%s%s", repository, RCSEXT); if (isfile (repository) || isfile(rcs)) { - fperror (logfp, 0, 0, - "ERROR: %s is a file, should be a directory!", - repository); + fperrmsg (logfp, 0, 0, + "ERROR: %s is a file, should be a directory!", + repository); error (0, 0, "ERROR: %s is a file, should be a directory!", repository); err = 1; @@ -1570,8 +1602,8 @@ import_descend_dir (message, dir, vtag, targc, targv) if (noexec == 0 && CVS_MKDIR (repository, 0777) < 0) { ierrno = errno; - fperror (logfp, 0, ierrno, - "ERROR: cannot mkdir %s -- not added", repository); + fperrmsg (logfp, 0, ierrno, + "ERROR: cannot mkdir %s -- not added", repository); error (0, ierrno, "ERROR: cannot mkdir %s -- not added", repository); err = 1; diff --git a/gnu/usr.bin/cvs/src/lock.c b/gnu/usr.bin/cvs/src/lock.c index f962d183551..b0c75ab3d93 100644 --- a/gnu/usr.bin/cvs/src/lock.c +++ b/gnu/usr.bin/cvs/src/lock.c @@ -175,8 +175,12 @@ lock_name (repository, name) assert (CVSroot_directory != NULL); assert (strncmp (repository, CVSroot_directory, strlen (CVSroot_directory)) == 0); - short_repos = repository + strlen (CVSroot_directory); - assert (*short_repos++ == '/'); + short_repos = repository + strlen (CVSroot_directory) + 1; + + if (strcmp (repository, CVSroot_directory) == 0) + short_repos = "."; + else + assert (short_repos[-1] == '/'); retval = xmalloc (strlen (lock_dir) + strlen (short_repos) @@ -755,8 +759,8 @@ set_lock (lock, will_wait) if (errno != EEXIST) { error (0, errno, - "failed to create lock directory in repository `%s'", - lock->repository); + "failed to create lock directory for `%s' (%s)", + lock->repository, masterlock); return (L_ERROR); } diff --git a/gnu/usr.bin/cvs/src/main.c b/gnu/usr.bin/cvs/src/main.c index 8e18b907b2f..40a0f3bba2c 100644 --- a/gnu/usr.bin/cvs/src/main.c +++ b/gnu/usr.bin/cvs/src/main.c @@ -113,30 +113,31 @@ static const struct cmd { "history", "hi", "his", history }, { "import", "im", "imp", import }, { "init", NULL, NULL, init }, -#ifdef SERVER_SUPPORT +#if defined (HAVE_KERBEROS) && defined (SERVER_SUPPORT) { "kserver", NULL, NULL, server }, /* placeholder */ #endif { "log", "lo", "rlog", cvslog }, #ifdef AUTH_CLIENT_SUPPORT { "login", "logon", "lgn", login }, { "logout", NULL, NULL, logout }, -#ifdef SERVER_SUPPORT +#endif /* AUTH_CLIENT_SUPPORT */ +#if (defined(AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)) && defined(SERVER_SUPPORT) { "pserver", NULL, NULL, server }, /* placeholder */ #endif -#endif /* AUTH_CLIENT_SUPPORT */ { "rdiff", "patch", "pa", patch }, { "release", "re", "rel", release }, { "remove", "rm", "delete", cvsremove }, - { "status", "st", "stat", cvsstatus }, { "rtag", "rt", "rfreeze", rtag }, +#ifdef SERVER_SUPPORT + { "server", NULL, NULL, server }, +#endif + { "status", "st", "stat", cvsstatus }, { "tag", "ta", "freeze", cvstag }, { "unedit", NULL, NULL, unedit }, { "update", "up", "upd", update }, + { "version", "ve", "ver", version }, { "watch", NULL, NULL, watch }, { "watchers", NULL, NULL, watchers }, -#ifdef SERVER_SUPPORT - { "server", NULL, NULL, server }, -#endif { NULL, NULL, NULL, NULL }, }; @@ -181,7 +182,7 @@ static const char *const usg[] = version control means. */ "For CVS updates and additional information, see\n", - " Cyclic Software at http://www.cyclic.com/ or\n", + " the CVS home page at http://www.cvshome.org/ or\n", " Pascal Molli's CVS site at http://www.loria.fr/~molli/cvs-index.html\n", NULL, }; @@ -201,15 +202,24 @@ static const char *const cmd_usage[] = " history Show repository access history\n", " import Import sources into CVS, using vendor branches\n", " init Create a CVS repository if it doesn't exist\n", +#if defined (HAVE_KERBEROS) && defined (SERVER_SUPPORT) + " kserver Kerberos server mode\n", +#endif " log Print out history information for files\n", #ifdef AUTH_CLIENT_SUPPORT - " login Prompt for password for authenticating server.\n", - " logout Removes entry in .cvspass for remote repository.\n", + " login Prompt for password for authenticating server\n", + " logout Removes entry in .cvspass for remote repository\n", #endif /* AUTH_CLIENT_SUPPORT */ +#if (defined(AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)) && defined(SERVER_SUPPORT) + " pserver Password server mode\n", +#endif " rdiff Create 'patch' format diffs between releases\n", " release Indicate that a Module is no longer in use\n", " remove Remove an entry from the repository\n", " rtag Add a symbolic tag to a module\n", +#ifdef SERVER_SUPPORT + " server Server mode\n", +#endif " status Display status information on checked out files\n", " tag Add a symbolic tag to checked out version of files\n", " unedit Undo an edit command\n", @@ -346,6 +356,7 @@ lookup_command_attribute (cmd_name) (strcmp (cmd_name, "log") != 0) && (strcmp (cmd_name, "noop") != 0) && (strcmp (cmd_name, "watchers") != 0) && + (strcmp (cmd_name, "release") != 0) && (strcmp (cmd_name, "status") != 0)) { ret |= CVS_CMD_MODIFIES_REPOSITORY; @@ -365,6 +376,11 @@ main_cleanup (sig) switch (sig) { +#ifdef SIGABRT + case SIGABRT: + name = "abort"; + break; +#endif #ifdef SIGHUP case SIGHUP: name = "hangup"; @@ -408,8 +424,6 @@ main (argc, argv) char **argv; { char *CVSroot = CVSROOT_DFLT; - extern char *version_string; - extern char *config_string; char *cp, *end; const struct cmd *cm; int c, err = 0; @@ -421,6 +435,7 @@ main (argc, argv) int help = 0; /* Has the user asked for help? This lets us support the `cvs -H cmd' convention to give help for cmd. */ + static const char short_options[] = "+Qqrwtnlvb:T:e:d:Hfz:s:xaR"; static struct option long_options[] = { {"help", 0, NULL, 'H'}, @@ -499,7 +514,7 @@ main (argc, argv) opterr = 0; while ((c = getopt_long - (argc, argv, "+f", NULL, NULL)) + (argc, argv, short_options, long_options, &option_index)) != EOF) { if (c == 'f') @@ -516,7 +531,7 @@ main (argc, argv) opterr = 1; while ((c = getopt_long - (argc, argv, "+Qqrwtnlvb:T:e:d:Hfz:s:xaR", long_options, &option_index)) + (argc, argv, short_options, long_options, &option_index)) != EOF) { switch (c) @@ -562,14 +577,11 @@ main (argc, argv) readonlyfs = 1; break; case 'v': - /* Having the year here is a good idea, so people have - some idea of how long ago their version of CVS was - released. */ - (void) fputs (version_string, stdout); - (void) fputs (config_string, stdout); + (void) fputs ("\n", stdout); + version (0, (char **) NULL); (void) fputs ("\n", stdout); (void) fputs ("\ -Copyright (c) 1989-1998 Brian Berliner, david d `zoo' zuhn, \n\ +Copyright (c) 1989-2000 Brian Berliner, david d `zoo' zuhn, \n\ Jeff Polk, and other authors\n", stdout); (void) fputs ("\n", stdout); (void) fputs ("CVS may be copied only under the terms of the GNU General Public License,\n", stdout); @@ -613,9 +625,9 @@ Copyright (c) 1989-1998 Brian Berliner, david d `zoo' zuhn, \n\ case 'z': #ifdef CLIENT_SUPPORT gzip_level = atoi (optarg); - if (gzip_level <= 0 || gzip_level > 9) + if (gzip_level < 0 || gzip_level > 9) error (1, 0, - "gzip compression level must be between 1 and 9"); + "gzip compression level must be between 0 and 9"); #endif /* If no CLIENT_SUPPORT, we just silently ignore the gzip level, so that users can have it in their .cvsrc and not @@ -668,7 +680,10 @@ Copyright (c) 1989-1998 Brian Berliner, david d `zoo' zuhn, \n\ } if (!cm->fullname) - usage (cmd_usage); /* no match */ + { + fprintf (stderr, "Unknown command: `%s'\n\n", command_name); + usage (cmd_usage); + } else command_name = cm->fullname; /* Global pointer for later use */ @@ -776,25 +791,23 @@ Copyright (c) 1989-1998 Brian Berliner, david d `zoo' zuhn, \n\ #ifndef DONT_USE_SIGNALS /* make sure we clean up on error */ +#ifdef SIGABRT + (void) SIG_register (SIGABRT, main_cleanup); +#endif #ifdef SIGHUP (void) SIG_register (SIGHUP, main_cleanup); - (void) SIG_register (SIGHUP, Lock_Cleanup); #endif #ifdef SIGINT (void) SIG_register (SIGINT, main_cleanup); - (void) SIG_register (SIGINT, Lock_Cleanup); #endif #ifdef SIGQUIT (void) SIG_register (SIGQUIT, main_cleanup); - (void) SIG_register (SIGQUIT, Lock_Cleanup); #endif #ifdef SIGPIPE (void) SIG_register (SIGPIPE, main_cleanup); - (void) SIG_register (SIGPIPE, Lock_Cleanup); #endif #ifdef SIGTERM (void) SIG_register (SIGTERM, main_cleanup); - (void) SIG_register (SIGTERM, Lock_Cleanup); #endif #endif /* !DONT_USE_SIGNALS */ @@ -889,7 +902,7 @@ Copyright (c) 1989-1998 Brian Berliner, david d `zoo' zuhn, \n\ { Node *n; n = getnode (); - n->type = UNKNOWN; + n->type = NT_UNKNOWN; n->key = xstrdup (CVSroot); n->data = NULL; @@ -932,11 +945,8 @@ Copyright (c) 1989-1998 Brian Berliner, david d `zoo' zuhn, \n\ current_root); /* - * Check to see if we can write into the history file. If not, - * we assume that we can't work in the repository. - * BUT, only if the history file exists. + * Check to see if the repository exists. */ - if (!client_active) { char *path; @@ -944,10 +954,9 @@ Copyright (c) 1989-1998 Brian Berliner, david d `zoo' zuhn, \n\ path = xmalloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM) - + 20 - + sizeof (CVSROOTADM_HISTORY)); + + 20); (void) sprintf (path, "%s/%s", CVSroot_directory, CVSROOTADM); - if (!isaccessible (path, R_OK | X_OK)) + if (readonlyfs == 0 && !isaccessible (path, R_OK | X_OK)) { save_errno = errno; /* If this is "cvs init", the root need not exist yet. */ @@ -956,14 +965,6 @@ Copyright (c) 1989-1998 Brian Berliner, david d `zoo' zuhn, \n\ error (1, save_errno, "%s", path); } } - (void) strcat (path, "/"); - (void) strcat (path, CVSROOTADM_HISTORY); - if (readonlyfs == 0 && isfile (path) && !isaccessible (path, R_OK | W_OK)) - { - save_errno = errno; - error (0, 0, "Sorry, you don't have read/write access to the history file"); - error (1, save_errno, "%s", path); - } free (path); } @@ -972,12 +973,17 @@ Copyright (c) 1989-1998 Brian Berliner, david d `zoo' zuhn, \n\ /* FIXME (njc): should we always set this with the CVSROOT from the command line? */ if (cvs_update_env) { + static char *prev; char *env; env = xmalloc (strlen (CVSROOT_ENV) + strlen (CVSroot) + 1 + 1); (void) sprintf (env, "%s=%s", CVSROOT_ENV, CVSroot); (void) putenv (env); - /* do not free env, as putenv has control of it */ + /* do not free env yet, as putenv has control of it */ + /* but do free the previous value, if any */ + if (prev != NULL) + free (prev); + prev = env; } #endif } diff --git a/gnu/usr.bin/cvs/src/mkmodules.c b/gnu/usr.bin/cvs/src/mkmodules.c index cf2ae7a0585..a18a161c815 100644 --- a/gnu/usr.bin/cvs/src/mkmodules.c +++ b/gnu/usr.bin/cvs/src/mkmodules.c @@ -280,10 +280,15 @@ static const char *const config_contents[] = { "# Set this to \"no\" if pserver shouldn't check system users/passwords\n", "#SystemAuth=no\n", "\n", + "# Put CVS lock files in this directory rather than directly in the repository.\n", + "#LockDir=/var/lock/cvs\n", + "\n", +#ifdef PRESERVE_PERMISSIONS_SUPPORT "# Set `PreservePermissions' to `yes' to save file status information\n", "# in the repository.\n", "#PreservePermissions=no\n", "\n", +#endif "# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top\n", "# level of the new working directory when using the `cvs checkout'\n", "# command.\n", @@ -297,6 +302,10 @@ static const char *const config_contents[] = { "\n", "# Set this to the default data resource limit to use\n", "#dlimit=65536\n", + "\n", + "# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the\n", + "# history file, or a subset as needed (ie `TMAR' logs all write operations)\n", + "#LogHistory=TOFEWGCMAR\n", NULL }; @@ -381,6 +390,9 @@ mkmodules (dir) size_t line_allocated = 0; const struct admin_file *fileptr; + if (noexec) + return 0; + if (save_cwd (&cwd)) error_exit (); @@ -874,6 +886,9 @@ init (argc, argv) if ( CVS_CHDIR (adm) < 0) error (1, errno, "cannot change to directory %s", adm); + /* Make Emptydir so it's there if we need it */ + mkdir_if_needed (CVSNULLREPOS); + /* 80 is long enough for all the administrative file names, plus "/" and so on. */ info = xmalloc (strlen (adm) + 80); @@ -935,6 +950,29 @@ init (argc, argv) fp = open_file (info, "w"); if (fclose (fp) < 0) error (1, errno, "cannot close %s", info); + + /* Make the new history file world-writeable, since every CVS + user will need to be able to write to it. We use chmod() + because xchmod() is too shy. */ + chmod (info, 0666); + } + + /* Make an empty val-tags file to prevent problems creating it later. */ + strcpy (info, adm); + strcat (info, "/"); + strcat (info, CVSROOTADM_VALTAGS); + if (!isfile (info)) + { + FILE *fp; + + fp = open_file (info, "w"); + if (fclose (fp) < 0) + error (1, errno, "cannot close %s", info); + + /* Make the new val-tags file world-writeable, since every CVS + user will need to be able to write to it. We use chmod() + because xchmod() is too shy. */ + chmod (info, 0666); } free (info); diff --git a/gnu/usr.bin/cvs/src/parseinfo.c b/gnu/usr.bin/cvs/src/parseinfo.c index a5629a3fb78..6d5b481ec49 100644 --- a/gnu/usr.bin/cvs/src/parseinfo.c +++ b/gnu/usr.bin/cvs/src/parseinfo.c @@ -10,6 +10,8 @@ #include "getline.h" #include <assert.h> +extern char *logHistory; + /* * Parse the INFOFILE file for the specified REPOSITORY. Invoke CALLPROC for * the first line in the file that matches the REPOSITORY, or if ALL != 0, any lines @@ -32,7 +34,7 @@ Parse_Info (infofile, repository, callproc, all) char *default_value = NULL; char *expanded_value= NULL; int callback_done, line_number; - char *cp, *exp, *value, *srepos; + char *cp, *exp, *value, *srepos, bad; const char *regex_err; if (CVSroot_original == NULL) @@ -110,10 +112,6 @@ Parse_Info (infofile, repository, callproc, all) if (expanded_value != NULL) free (expanded_value); expanded_value = expand_path (value, infofile, line_number); - if (!expanded_value) - { - continue; - } /* * At this point, exp points to the regular expression, and value @@ -127,9 +125,10 @@ Parse_Info (infofile, repository, callproc, all) { /* Is it OK to silently ignore all but the last DEFAULT expression? */ - if (default_value != NULL) + if (default_value != NULL && default_value != &bad) free (default_value); - default_value = xstrdup (expanded_value); + default_value = (expanded_value != NULL ? + xstrdup (expanded_value) : &bad); continue; } @@ -140,11 +139,13 @@ Parse_Info (infofile, repository, callproc, all) */ if (strcmp (exp, "ALL") == 0) { - if (all) - err += callproc (repository, expanded_value); - else + if (!all) error(0, 0, "Keyword `ALL' is ignored at line %d in %s file", line_number, infofile); + else if (expanded_value != NULL) + err += callproc (repository, expanded_value); + else + err++; continue; } @@ -163,7 +164,10 @@ Parse_Info (infofile, repository, callproc, all) continue; /* no match */ /* it did, so do the callback and note that we did one */ - err += callproc (repository, expanded_value); + if (expanded_value != NULL) + err += callproc (repository, expanded_value); + else + err++; callback_done = 1; } if (ferror (fp_info)) @@ -173,10 +177,15 @@ Parse_Info (infofile, repository, callproc, all) /* if we fell through and didn't callback at all, do the default */ if (callback_done == 0 && default_value != NULL) - err += callproc (repository, default_value); + { + if (default_value != &bad) + err += callproc (repository, default_value); + else + err++; + } /* free up space if necessary */ - if (default_value != NULL) + if (default_value != NULL && default_value != &bad) free (default_value); if (expanded_value != NULL) free (expanded_value); @@ -391,6 +400,14 @@ warning: this CVS does not support PreservePermissions"); opendir it or something, but I don't see any particular reason to do that now rather than waiting until lock.c. */ } + else if (strcmp (line, "LogHistory") == 0) + { + if (strcmp (p, "all") != 0) + { + logHistory=malloc(strlen (p) + 1); + strcpy (logHistory, p); + } + } else { /* We may be dealing with a keyword which was added in a diff --git a/gnu/usr.bin/cvs/src/patch.c b/gnu/usr.bin/cvs/src/patch.c index f16a3318890..9aa26f3342e 100644 --- a/gnu/usr.bin/cvs/src/patch.c +++ b/gnu/usr.bin/cvs/src/patch.c @@ -20,7 +20,7 @@ static Dtype patch_dirproc PROTO ((void *callerdat, char *dir, char *repos, char *update_dir, List *entries)); static int patch_fileproc PROTO ((void *callerdat, struct file_info *finfo)); -static int patch_proc PROTO((int *pargc, char **argv, char *xwhere, +static int patch_proc PROTO((int argc, char **argv, char *xwhere, char *mwhere, char *mfile, int shorten, int local_specified, char *mname, char *msg)); @@ -230,6 +230,9 @@ patch (argc, argv) #endif /* clean up if we get a signal */ +#ifdef SIGABRT + (void) SIG_register (SIGABRT, patch_cleanup); +#endif #ifdef SIGHUP (void) SIG_register (SIGHUP, patch_cleanup); #endif @@ -261,9 +264,9 @@ patch (argc, argv) */ /* ARGSUSED */ static int -patch_proc (pargc, argv, xwhere, mwhere, mfile, shorten, local_specified, +patch_proc (argc, argv, xwhere, mwhere, mfile, shorten, local_specified, mname, msg) - int *pargc; + int argc; char **argv; char *xwhere; char *mwhere; @@ -273,6 +276,7 @@ patch_proc (pargc, argv, xwhere, mwhere, mfile, shorten, local_specified, char *mname; char *msg; { + char *myargv[2]; int err = 0; int which; char *repository; @@ -314,13 +318,10 @@ patch_proc (pargc, argv, xwhere, mwhere, mfile, shorten, local_specified, } else { - int i; - - /* a file means muck argv */ - for (i = 1; i < *pargc; i++) - free (argv[i]); - argv[1] = xstrdup (mfile); - (*pargc) = 2; + myargv[0] = argv[0]; + myargv[1] = mfile; + argc = 2; + argv = myargv; } free (path); } @@ -341,19 +342,19 @@ patch_proc (pargc, argv, xwhere, mwhere, mfile, shorten, local_specified, if (rev1 != NULL && !rev1_validated) { - tag_check_valid (rev1, *pargc - 1, argv + 1, local, 0, NULL); + tag_check_valid (rev1, argc - 1, argv + 1, local, 0, NULL); rev1_validated = 1; } if (rev2 != NULL && !rev2_validated) { - tag_check_valid (rev2, *pargc - 1, argv + 1, local, 0, NULL); + tag_check_valid (rev2, argc - 1, argv + 1, local, 0, NULL); rev2_validated = 1; } /* start the recursion processor */ err = start_recursion (patch_fileproc, (FILESDONEPROC) NULL, patch_dirproc, (DIRLEAVEPROC) NULL, NULL, - *pargc - 1, argv + 1, local, + argc - 1, argv + 1, local, which, 0, 1, where, 1); free (where); @@ -735,6 +736,10 @@ failed to read diff file header %s for %s: end of file", tmpfile3, rcs); tmpfile1 = tmpfile2 = tmpfile3 = NULL; out2: + if (vers_tag != NULL) + free (vers_tag); + if (vers_head != NULL) + free (vers_head); if (rcs != NULL) free (rcs); return (ret); diff --git a/gnu/usr.bin/cvs/src/rcs.c b/gnu/usr.bin/cvs/src/rcs.c index e8c64749d0a..0ffe73f0658 100644 --- a/gnu/usr.bin/cvs/src/rcs.c +++ b/gnu/usr.bin/cvs/src/rcs.c @@ -60,6 +60,7 @@ static int rcsbuf_getkey PROTO ((struct rcsbuffer *, char **keyp, static int rcsbuf_getrevnum PROTO ((struct rcsbuffer *, char **revp)); static char *rcsbuf_fill PROTO ((struct rcsbuffer *, char *ptr, char **keyp, char **valp)); +static int rcsbuf_valcmp PROTO ((struct rcsbuffer *)); static char *rcsbuf_valcopy PROTO ((struct rcsbuffer *, char *val, int polish, size_t *lenp)); static void rcsbuf_valpolish PROTO ((struct rcsbuffer *, char *val, int polish, @@ -154,6 +155,7 @@ static const char spacetab[] = { #define whitespace(c) (spacetab[(unsigned char)c] != 0) static char *rcs_lockfile; +static int rcs_lockfd = -1; /* A few generic thoughts on error handling, in particular the printing of unexpected characters that we find in the RCS file @@ -542,9 +544,10 @@ RCS_reparsercsfile (rdata, pfp, rcsbufp) if (rdata->other == NULL) rdata->other = getlist (); kv = getnode (); - kv->type = RCSFIELD; + kv->type = rcsbuf_valcmp (&rcsbuf) ? RCSCMPFLD : RCSFIELD; kv->key = xstrdup (key); - kv->data = rcsbuf_valcopy (&rcsbuf, value, 1, (size_t *) NULL); + kv->data = rcsbuf_valcopy (&rcsbuf, value, kv->type == RCSFIELD, + (size_t *) NULL); if (addnode (rdata->other, kv) != 0) { error (0, 0, "warning: duplicate key `%s' in RCS file `%s'", @@ -590,9 +593,7 @@ RCS_reparsercsfile (rdata, pfp, rcsbufp) key, rcsfile); free (rdata->desc); } - /* Don't need to rcsbuf_valcopy `value' because - getdelta already did that. */ - rdata->desc = xstrdup (value); + rdata->desc = rcsbuf_valcopy (&rcsbuf, value, 1, (size_t *) NULL); } rdata->delta_pos = rcsbuf_ftell (&rcsbuf); @@ -748,9 +749,10 @@ RCS_fully_parse (rcs) if (vnode->other == NULL) vnode->other = getlist (); kv = getnode (); - kv->type = RCSFIELD; + kv->type = rcsbuf_valcmp (&rcsbuf) ? RCSCMPFLD : RCSFIELD; kv->key = xstrdup (key); - kv->data = rcsbuf_valcopy (&rcsbuf, value, 1, (size_t *) NULL); + kv->data = rcsbuf_valcopy (&rcsbuf, value, kv->type == RCSFIELD, + (size_t *) NULL); if (addnode (vnode->other, kv) != 0) { error (0, 0, @@ -1028,6 +1030,9 @@ rcsbuf_close (rcsbuf) characters. Call rcsbuf_valcopy or rcsbuf_valpolish to do appropriate massaging. */ +/* Note that the extreme hair in rcsbuf_getkey is because profiling + statistics show that it was worth it. */ + static int rcsbuf_getkey (rcsbuf, keyp, valp) struct rcsbuffer *rcsbuf; @@ -1283,13 +1288,10 @@ rcsbuf_getkey (rcsbuf, keyp, valp) } /* The value extends past the '@' string. We need to undo the - closing of the '@' done in the default case above. This + '@' stripping done in the default case above. This case never happens in a plain RCS file, but it can happen if user defined phrases are used. */ - if (rcsbuf->vlen != 0) - (*valp)[rcsbuf->vlen] = ' '; - else - *valp = ptr; + ((*valp)--)[rcsbuf->vlen++] = '@'; } /* Here we have a value which is not a simple '@' string. We need @@ -1346,8 +1348,8 @@ rcsbuf_getkey (rcsbuf, keyp, valp) return 1; } - /* We found an '@' string in the value. We set - RCSBUF->AT_STRING, which means that we won't be able to + /* We found an '@' string in the value. We set RCSBUF->AT_STRING + and RCSBUF->EMBEDDED_AT to indicate that we won't be able to compress whitespace correctly for this type of value. Since this type of value never arises in a normal RCS file, this should not be a big deal. It means that if anybody @@ -1356,8 +1358,7 @@ rcsbuf_getkey (rcsbuf, keyp, valp) themselves. */ rcsbuf->at_string = 1; - - *pat = ' '; + rcsbuf->embedded_at = -1; ptr = pat + 1; @@ -1392,495 +1393,16 @@ rcsbuf_getkey (rcsbuf, keyp, valp) break; /* We found an '@' pair in the string. Keep looking. */ - ++rcsbuf->embedded_at; ptr = pat + 2; } /* Here PAT points to the final '@' in the string. */ - - *pat = ' '; - ptr = pat + 1; } #undef my_whitespace } -/* TODO: Eliminate redundant code in rcsbuf_getkey, rcsbuf_getid, - rcsbuf_getstring, rcsbuf_getword. These last three functions were - all created by hacking monstrous swaths of code from rcsbuf_getkey, - and some engineering would make the code easier to read and - maintain. - - Note that the extreme hair in rcsbuf_getkey is because profiling - statistics show that it was worth it. - - We probably could be processing "hardlinks" by first calling - rcsbuf_getkey, and breaking up the value afterwards; the code to - break it up would not need to be hacked for speed. This would - remove the need for rcsbuf_getword, rcsbuf_getid, and - rcsbuf_getstring, as the other calls are easy to remove. */ - -/* Read an `id' (in the sense of rcsfile(5)) from RCSBUF, and store in - IDP. */ - -static int -rcsbuf_getid (rcsbuf, idp) - struct rcsbuffer *rcsbuf; - char **idp; -{ - register const char * const my_spacetab = spacetab; - register char *ptr, *ptrend; - char c; - -#define my_whitespace(c) (my_spacetab[(unsigned char)c] != 0) - - rcsbuf->vlen = 0; - rcsbuf->at_string = 0; - rcsbuf->embedded_at = 0; - - ptr = rcsbuf->ptr; - ptrend = rcsbuf->ptrend; - - /* Sanity check. */ - if (ptr < rcsbuf_buffer || ptr > rcsbuf_buffer + rcsbuf_buffer_size) - abort (); - - /* If the pointer is more than RCSBUF_BUFSIZE bytes into the - buffer, move back to the start of the buffer. This keeps the - buffer from growing indefinitely. */ - if (ptr - rcsbuf_buffer >= RCSBUF_BUFSIZE) - { - int len; - - len = ptrend - ptr; - - /* Sanity check: we don't read more than RCSBUF_BUFSIZE bytes - at a time, so we can't have more bytes than that past PTR. */ - if (len > RCSBUF_BUFSIZE) - abort (); - - /* Update the POS field, which holds the file offset of the - first byte in the RCSBUF_BUFFER buffer. */ - rcsbuf->pos += ptr - rcsbuf_buffer; - - memcpy (rcsbuf_buffer, ptr, len); - ptr = rcsbuf_buffer; - ptrend = ptr + len; - rcsbuf->ptrend = ptrend; - } - - /* Skip leading whitespace. */ - - while (1) - { - if (ptr >= ptrend) - { - ptr = rcsbuf_fill (rcsbuf, ptr, (char **) NULL, (char **) NULL); - if (ptr == NULL) - return 0; - ptrend = rcsbuf->ptrend; - } - - c = *ptr; - if (! my_whitespace (c)) - break; - - ++ptr; - } - - /* We've found the start of the key. */ - - *idp = ptr; - - if (c != ';') - { - while (1) - { - ++ptr; - if (ptr >= ptrend) - { - ptr = rcsbuf_fill (rcsbuf, ptr, idp, (char **) NULL); - if (ptr == NULL) - error (1, 0, "EOF in key in RCS file %s", - rcsbuf->filename); - ptrend = rcsbuf->ptrend; - } - c = *ptr; - if (c == ';' || my_whitespace (c)) - break; - } - } - - /* Here *IDP points to the id in the buffer, C is the character - we found at the end of the key, and PTR points to the location in - the buffer where we found C. We may not set *PTR to \0, because - it may overwrite a terminating semicolon. The calling function - must copy and terminate the id on its own. */ - - rcsbuf->ptr = ptr; - return 1; - -#undef my_whitespace -} - -/* Read an RCS @-delimited string. Store the result in STRP. */ - -static int -rcsbuf_getstring (rcsbuf, strp) - struct rcsbuffer *rcsbuf; - char **strp; -{ - register const char * const my_spacetab = spacetab; - register char *ptr, *ptrend; - char *pat; - size_t vlen; - char c; - -#define my_whitespace(c) (my_spacetab[(unsigned char)c] != 0) - - rcsbuf->vlen = 0; - rcsbuf->at_string = 0; - rcsbuf->embedded_at = 0; - - ptr = rcsbuf->ptr; - ptrend = rcsbuf->ptrend; - - /* Sanity check. */ - if (ptr < rcsbuf_buffer || ptr > rcsbuf_buffer + rcsbuf_buffer_size) - abort (); - - /* If the pointer is more than RCSBUF_BUFSIZE bytes into the - buffer, move back to the start of the buffer. This keeps the - buffer from growing indefinitely. */ - if (ptr - rcsbuf_buffer >= RCSBUF_BUFSIZE) - { - int len; - - len = ptrend - ptr; - - /* Sanity check: we don't read more than RCSBUF_BUFSIZE bytes - at a time, so we can't have more bytes than that past PTR. */ - if (len > RCSBUF_BUFSIZE) - abort (); - - /* Update the POS field, which holds the file offset of the - first byte in the RCSBUF_BUFFER buffer. */ - rcsbuf->pos += ptr - rcsbuf_buffer; - - memcpy (rcsbuf_buffer, ptr, len); - ptr = rcsbuf_buffer; - ptrend = ptr + len; - rcsbuf->ptrend = ptrend; - } - - /* Skip leading whitespace. */ - - while (1) - { - if (ptr >= ptrend) - { - ptr = rcsbuf_fill (rcsbuf, ptr, (char **) NULL, (char **) NULL); - if (ptr == NULL) - error (1, 0, "unexpected end of file reading %s", - rcsbuf->filename); - ptrend = rcsbuf->ptrend; - } - - c = *ptr; - if (! my_whitespace (c)) - break; - - ++ptr; - } - - /* PTR should now point to the start of a string. */ - if (c != '@') - error (1, 0, "expected @-string at '\\x%x' in %s", - c, rcsbuf->filename); - - /* Optimize the common case of a value composed of a single - '@' string. */ - - rcsbuf->at_string = 1; - - ++ptr; - - *strp = ptr; - - while (1) - { - while ((pat = memchr (ptr, '@', ptrend - ptr)) == NULL) - { - /* Note that we pass PTREND as the PTR value to - rcsbuf_fill, so that we will wind up setting PTR to - the location corresponding to the old PTREND, so - that we don't search the same bytes again. */ - ptr = rcsbuf_fill (rcsbuf, ptrend, NULL, strp); - if (ptr == NULL) - error (1, 0, - "EOF while looking for end of string in RCS file %s", - rcsbuf->filename); - ptrend = rcsbuf->ptrend; - } - - /* Handle the special case of an '@' right at the end of - the known bytes. */ - if (pat + 1 >= ptrend) - { - /* Note that we pass PAT, not PTR, here. */ - pat = rcsbuf_fill (rcsbuf, pat, NULL, strp); - if (pat == NULL) - { - /* EOF here is OK; it just means that the last - character of the file was an '@' terminating a - value for a key type which does not require a - trailing ';'. */ - pat = rcsbuf->ptrend - 1; - - } - ptrend = rcsbuf->ptrend; - - /* Note that the value of PTR is bogus here. This is - OK, because we don't use it. */ - } - - if (pat + 1 >= ptrend || pat[1] != '@') - break; - - /* We found an '@' pair in the string. Keep looking. */ - ++rcsbuf->embedded_at; - ptr = pat + 2; - } - - /* Here PAT points to the final '@' in the string. */ - - *pat = '\0'; - - vlen = pat - *strp; - if (vlen == 0) - *strp = NULL; - rcsbuf->vlen = vlen; - rcsbuf->ptr = pat + 1; - - return 1; - -#undef my_whitespace -} - -/* Read an RCS `word', in the sense of rcsfile(5) (an id, a num, a - @-delimited string, or `:'). Store the result in WORDP. If a - `;' is reached without reading any text, the result is NULL. */ - -static int -rcsbuf_getword (rcsbuf, wordp) - struct rcsbuffer *rcsbuf; - char **wordp; -{ - register const char * const my_spacetab = spacetab; - register char *ptr, *ptrend; - char c; - -#define my_whitespace(c) (my_spacetab[(unsigned char)c] != 0) - - rcsbuf->vlen = 0; - rcsbuf->at_string = 0; - rcsbuf->embedded_at = 0; - - ptr = rcsbuf->ptr; - ptrend = rcsbuf->ptrend; - - /* Sanity check. */ - if (ptr < rcsbuf_buffer || ptr > rcsbuf_buffer + rcsbuf_buffer_size) - abort (); - - /* If the pointer is more than RCSBUF_BUFSIZE bytes into the - buffer, move back to the start of the buffer. This keeps the - buffer from growing indefinitely. */ - if (ptr - rcsbuf_buffer >= RCSBUF_BUFSIZE) - { - int len; - - len = ptrend - ptr; - - /* Sanity check: we don't read more than RCSBUF_BUFSIZE bytes - at a time, so we can't have more bytes than that past PTR. */ - if (len > RCSBUF_BUFSIZE) - abort (); - - /* Update the POS field, which holds the file offset of the - first byte in the RCSBUF_BUFFER buffer. */ - rcsbuf->pos += ptr - rcsbuf_buffer; - - memcpy (rcsbuf_buffer, ptr, len); - ptr = rcsbuf_buffer; - ptrend = ptr + len; - rcsbuf->ptrend = ptrend; - } - - /* Skip leading whitespace. */ - - while (1) - { - if (ptr >= ptrend) - { - ptr = rcsbuf_fill (rcsbuf, ptr, (char **) NULL, (char **) NULL); - if (ptr == NULL) - error (1, 0, "unexpected end of file reading %s", - rcsbuf->filename); - ptrend = rcsbuf->ptrend; - } - - c = *ptr; - if (! my_whitespace (c)) - break; - - ++ptr; - } - - /* If we have reached `;', there is no value. */ - if (c == ';') - { - *wordp = NULL; - *ptr++ = '\0'; - rcsbuf->ptr = ptr; - rcsbuf->vlen = 0; - return 1; - } - - /* PTR now points to the start of a value. Find out whether it is - a num, an id, a string or a colon. */ - if (c == ':') - { - *wordp = ptr++; - rcsbuf->ptr = ptr; - rcsbuf->vlen = 1; - return 1; - } - - if (c == '@') - { - char *pat; - size_t vlen; - - /* Optimize the common case of a value composed of a single - '@' string. */ - - rcsbuf->at_string = 1; - - ++ptr; - - *wordp = ptr; - - while (1) - { - while ((pat = memchr (ptr, '@', ptrend - ptr)) == NULL) - { - /* Note that we pass PTREND as the PTR value to - rcsbuf_fill, so that we will wind up setting PTR to - the location corresponding to the old PTREND, so - that we don't search the same bytes again. */ - ptr = rcsbuf_fill (rcsbuf, ptrend, NULL, wordp); - if (ptr == NULL) - error (1, 0, - "EOF while looking for end of string in RCS file %s", - rcsbuf->filename); - ptrend = rcsbuf->ptrend; - } - - /* Handle the special case of an '@' right at the end of - the known bytes. */ - if (pat + 1 >= ptrend) - { - /* Note that we pass PAT, not PTR, here. */ - pat = rcsbuf_fill (rcsbuf, pat, NULL, wordp); - if (pat == NULL) - { - /* EOF here is OK; it just means that the last - character of the file was an '@' terminating a - value for a key type which does not require a - trailing ';'. */ - pat = rcsbuf->ptrend - 1; - - } - ptrend = rcsbuf->ptrend; - - /* Note that the value of PTR is bogus here. This is - OK, because we don't use it. */ - } - - if (pat + 1 >= ptrend || pat[1] != '@') - break; - - /* We found an '@' pair in the string. Keep looking. */ - ++rcsbuf->embedded_at; - ptr = pat + 2; - } - - /* Here PAT points to the final '@' in the string. */ - - *pat = '\0'; - - vlen = pat - *wordp; - if (vlen == 0) - *wordp = NULL; - rcsbuf->vlen = vlen; - rcsbuf->ptr = pat + 1; - - return 1; - } - - /* C is neither `:', `;' nor `@', so it should be the start of a num - or an id. Make sure it is not another special character. */ - if (c == '$' || c == '.' || c == ',') - { - error (1, 0, "illegal special character in RCS field in %s", - rcsbuf->filename); - } - - *wordp = ptr; - while (1) - { - if (ptr >= ptrend) - { - ptr = rcsbuf_fill (rcsbuf, ptr, (char **) NULL, wordp); - if (ptr == NULL) - error (1, 0, "unexpected end of file reading %s", - rcsbuf->filename); - ptrend = rcsbuf->ptrend; - } - - /* Legitimate ID characters are digits, dots and any `graphic - printing character that is not a special.' This test ought - to do the trick. */ - c = *ptr; - if (isprint ((unsigned char) c) && - c != ';' && c != '$' && c != ',' && c != '@' && c != ':') - { - ++ptr; - continue; - } - break; - } - - /* PTR points to the last non-id character in this word, and C is - the character in its memory cell. Check to make sure that it - is a legitimate word delimiter -- whitespace or semicolon. */ - if (c == ';' || my_whitespace (c)) - { - rcsbuf->vlen = ptr - *wordp; - rcsbuf->ptr = ptr; - return 1; - } - - error (1, 0, "illegal special character in RCS field in %s", - rcsbuf->filename); - /* Shut up compiler warnings. */ - return 0; - -#undef my_whitespace -} - /* Read an RCS revision number from an RCS file. This sets *REVP to point to the revision number; it will point to space that is managed by the rcsbuf functions, and is only good until the next @@ -1984,6 +1506,8 @@ rcsbuf_fill (rcsbuf, ptr, keyp, valp) koff = *keyp - rcsbuf_buffer; if (valp != NULL && *valp != NULL) voff = *valp - rcsbuf_buffer; + koff = keyp == NULL ? 0 : *keyp - rcsbuf_buffer; + voff = valp == NULL ? 0 : *valp - rcsbuf_buffer; expand_string (&rcsbuf_buffer, &rcsbuf_buffer_size, rcsbuf_buffer_size + RCSBUF_BUFSIZE); @@ -2009,6 +1533,16 @@ rcsbuf_fill (rcsbuf, ptr, keyp, valp) return ptr; } +/* Test whether the last value returned by rcsbuf_getkey is a composite + value or not. */ + +static int +rcsbuf_valcmp (rcsbuf) + struct rcsbuffer *rcsbuf; +{ + return rcsbuf->at_string && rcsbuf->embedded_at < 0; +} + /* Copy the value VAL returned by rcsbuf_getkey into a memory buffer, returning the memory buffer. Polish the value like rcsbuf_valpolish, q.v. */ @@ -2032,7 +1566,7 @@ rcsbuf_valcopy (rcsbuf, val, polish, lenp) } vlen = rcsbuf->vlen; - embedded_at = rcsbuf->embedded_at; + embedded_at = rcsbuf->embedded_at < 0 ? 0 : rcsbuf->embedded_at; ret = xmalloc (vlen - embedded_at + 1); @@ -2139,6 +1673,7 @@ rcsbuf_valpolish_internal (rcsbuf, to, from, lenp) orig_to = to; embedded_at = rcsbuf->embedded_at; + assert (embedded_at > 0); if (lenp != NULL) *lenp = len - embedded_at; @@ -2187,6 +1722,112 @@ rcsbuf_valpolish_internal (rcsbuf, to, from, lenp) } } +#ifdef PRESERVE_PERMISSIONS_SUPPORT + +/* Copy the next word from the value VALP returned by rcsbuf_getkey into a + memory buffer, updating VALP and returning the memory buffer. Return + NULL when there are no more words. */ + +static char * +rcsbuf_valword (rcsbuf, valp) + struct rcsbuffer *rcsbuf; + char **valp; +{ + register const char * const my_spacetab = spacetab; + register char *ptr, *pat; + char c; + +#define my_whitespace(c) (my_spacetab[(unsigned char)c] != 0) + + if (*valp == NULL) + return NULL; + + for (ptr = *valp; my_whitespace (*ptr); ++ptr) ; + if (*ptr == '\0') + { + assert (ptr - *valp == rcsbuf->vlen); + *valp = NULL; + rcsbuf->vlen = 0; + return NULL; + } + + /* PTR now points to the start of a value. Find out whether it is + a num, an id, a string or a colon. */ + c = *ptr; + if (c == ':') + { + rcsbuf->vlen -= ++ptr - *valp; + *valp = ptr; + return xstrdup (":"); + } + + if (c == '@') + { + int embedded_at = 0; + size_t vlen; + + pat = ++ptr; + while ((pat = strchr (pat, '@')) != NULL) + { + if (pat[1] != '@') + break; + ++embedded_at; + pat += 2; + } + + /* Here PAT points to the final '@' in the string. */ + *pat++ = '\0'; + assert (rcsbuf->at_string); + vlen = rcsbuf->vlen - (pat - *valp); + rcsbuf->vlen = pat - ptr - 1; + rcsbuf->embedded_at = embedded_at; + ptr = rcsbuf_valcopy (rcsbuf, ptr, 0, (size_t *) NULL); + *valp = pat; + rcsbuf->vlen = vlen; + if (strchr (pat, '@') == NULL) + rcsbuf->at_string = 0; + else + rcsbuf->embedded_at = -1; + return ptr; + } + + /* *PTR is neither `:', `;' nor `@', so it should be the start of a num + or an id. Make sure it is not another special character. */ + if (c == '$' || c == '.' || c == ',') + { + error (1, 0, "illegal special character in RCS field in %s", + rcsbuf->filename); + } + + pat = ptr; + while (1) + { + /* Legitimate ID characters are digits, dots and any `graphic + printing character that is not a special.' This test ought + to do the trick. */ + c = *++pat; + if (!isprint ((unsigned char) c) || + c == ';' || c == '$' || c == ',' || c == '@' || c == ':') + break; + } + + /* PAT points to the last non-id character in this word, and C is + the character in its memory cell. Check to make sure that it + is a legitimate word delimiter -- whitespace or end. */ + if (c != '\0' && !my_whitespace (c)) + error (1, 0, "illegal special character in RCS field in %s", + rcsbuf->filename); + + *pat = '\0'; + rcsbuf->vlen -= pat - *valp; + *valp = pat; + return xstrdup (ptr); + +#undef my_whitespace +} + +#endif + /* Return the current position of an rcsbuf. */ static unsigned long @@ -2864,8 +2505,8 @@ RCS_nodeisbranch (rcs, rev) return (1); } free (magic); - free (version); } + free (version); return (0); } @@ -2914,8 +2555,8 @@ RCS_whatbranch (rcs, rev) return (magic); } free (magic); - free (version); } + free (version); return ((char *) NULL); } @@ -4075,6 +3716,7 @@ expand_keywords (rcs, ver, name, log, loglen, expand, buf, len, retbuf, retlen) uses for ci -k. */ if (kw == KEYWORD_LOG && (sizeof "checked in with -k by " <= loglen + || log == NULL || strncmp (log, "checked in with -k by ", sizeof "checked in with -k by " - 1) != 0)) { @@ -4093,6 +3735,10 @@ expand_keywords (rcs, ver, name, log, loglen, expand, buf, len, retbuf, retlen) if (expand != KFLAG_V) ++s; + /* CVS never has empty log messages, but old RCS files might. */ + if (log == NULL) + log = ""; + /* Find the start of the line. */ start = srch; while (start > buf && start[-1] != '\n') @@ -4663,6 +4309,7 @@ RCS_checkout (rcs, workfile, rev, nametag, options, sout, pfn, callerdat) #ifdef PRESERVE_PERMISSIONS_SUPPORT else if (special_file) { +#ifdef HAVE_MKNOD char *dest; /* Can send either to WORKFILE or to SOUT, as long as SOUT is @@ -4683,6 +4330,11 @@ RCS_checkout (rcs, workfile, rev, nametag, options, sout, pfn, callerdat) if (mknod (dest, special_file, devnum) < 0) error (1, errno, "could not create special file %s", dest); +#else + error (1, 0, +"cannot create %s: unable to create special files on this system", +workfile); +#endif } #endif else @@ -5046,8 +4698,10 @@ RCS_addbranch (rcs, branch) if (nodep == NULL) { error (0, 0, "%s: can't find branch point %s", rcs->path, branchpoint); + free (branchpoint); return NULL; } + free (branchpoint); branchnode = (RCSVers *) nodep->data; /* If BRANCH was a full branch number, make sure it is higher than MAX. */ @@ -5189,9 +4843,6 @@ RCS_checkin (rcs, workfile, message, rev, flags) allocated_workfile = 1; } - /* Is the backend file a symbolic link? Follow it and replace the - filename with the destination of the link. */ - /* If the filename is a symbolic link, follow it and replace it with the destination of the link. We need to do this before calling rcs_internal_lockfile, or else we won't put the lock in @@ -5252,6 +4903,7 @@ RCS_checkin (rcs, workfile, message, rev, flags) if (S_ISLNK (sb.st_mode)) { np = getnode(); + np->type = RCSFIELD; np->key = xstrdup ("symlink"); np->data = xreadlink (workfile); addnode (delta->other_delta, np); @@ -5260,18 +4912,21 @@ RCS_checkin (rcs, workfile, message, rev, flags) { (void) sprintf (buf, "%u", sb.st_uid); np = getnode(); + np->type = RCSFIELD; np->key = xstrdup ("owner"); np->data = xstrdup (buf); addnode (delta->other_delta, np); (void) sprintf (buf, "%u", sb.st_gid); np = getnode(); + np->type = RCSFIELD; np->key = xstrdup ("group"); np->data = xstrdup (buf); addnode (delta->other_delta, np); (void) sprintf (buf, "%o", sb.st_mode & 07777); np = getnode(); + np->type = RCSFIELD; np->key = xstrdup ("permissions"); np->data = xstrdup (buf); addnode (delta->other_delta, np); @@ -5282,7 +4937,9 @@ RCS_checkin (rcs, workfile, message, rev, flags) case S_IFREG: break; case S_IFCHR: case S_IFBLK: +#ifdef HAVE_ST_RDEV np = getnode(); + np->type = RCSFIELD; np->key = xstrdup ("special"); sprintf (buf, "%s %lu", ((sb.st_mode & S_IFMT) == S_IFCHR @@ -5290,6 +4947,11 @@ RCS_checkin (rcs, workfile, message, rev, flags) (unsigned long) sb.st_rdev); np->data = xstrdup (buf); addnode (delta->other_delta, np); +#else + error (0, 0, +"can't preserve %s: unable to save device files on this system", +workfile); +#endif break; default: @@ -5334,8 +4996,9 @@ RCS_checkin (rcs, workfile, message, rev, flags) delta->version = xstrdup (newrev); nodep = getnode(); nodep->type = RCSVERS; - nodep->key = xstrdup (newrev); + nodep->delproc = rcsvers_delproc; nodep->data = (char *) delta; + nodep->key = delta->version; (void) addnode (rcs->versions, nodep); dtext->version = xstrdup (newrev); @@ -5369,7 +5032,6 @@ RCS_checkin (rcs, workfile, message, rev, flags) error (1, errno, "cannot ftell for %s", rcs->path); putdeltatext (fout, dtext); rcs_internal_unlockfile (fout, rcs->path); - freedeltatext (dtext); if ((flags & RCS_FLAGS_KEEPFILE) == 0) { @@ -5381,7 +5043,8 @@ RCS_checkin (rcs, workfile, message, rev, flags) if (!checkin_quiet) cvs_output ("done\n", 5); - return 0; + status = 0; + goto checkin_done; } /* Derive a new revision number. From the `ci' man page: @@ -5477,6 +5140,13 @@ RCS_checkin (rcs, workfile, message, rev, flags) goto checkin_done; } delta->version = RCS_addbranch (rcs, branch); + if (!delta->version) + { + free (branch); + free (newrev); + status = 1; + goto checkin_done; + } adding_branch = 1; p = strrchr (branch, '.'); *p = '\0'; @@ -5701,8 +5371,9 @@ RCS_checkin (rcs, workfile, message, rev, flags) rcs->versions = getlist(); nodep = getnode(); nodep->type = RCSVERS; - nodep->key = xstrdup (delta->version); + nodep->delproc = rcsvers_delproc; nodep->data = (char *) delta; + nodep->key = delta->version; (void) addnode (rcs->versions, nodep); /* Write the new RCS file, inserting the new delta at COMMITPT. */ @@ -5725,8 +5396,10 @@ RCS_checkin (rcs, workfile, message, rev, flags) } if (unlink_file (tmpfile) < 0) error (0, errno, "cannot remove %s", tmpfile); + free (tmpfile); if (unlink_file (changefile) < 0) error (0, errno, "cannot remove %s", changefile); + free (changefile); if (!checkin_quiet) cvs_output ("done\n", 5); @@ -5809,6 +5482,7 @@ RCS_cmp_file (rcs, rev, options, filename) retcode = xcmp (tmp, filename); if (CVS_UNLINK (tmp) < 0) error (0, errno, "cannot remove %s", tmp); + free (tmp); return retcode; } else @@ -6169,17 +5843,14 @@ RCS_unlock (rcs, rev, unlock_quiet) lock = NULL; for (p = locks->list->next; p != locks->list; p = p->next) { - if (STREQ (p->data, user)) + if (lock != NULL) { - if (lock != NULL) - { - if (!unlock_quiet) - error (0, 0, "\ + if (!unlock_quiet) + error (0, 0, "\ %s: multiple revisions locked by %s; please specify one", rcs->path, user); - return 1; - } - lock = p; + return 1; } + lock = p; } if (lock == NULL) return 0; /* no lock found, ergo nothing to do */ @@ -6259,6 +5930,7 @@ RCS_addaccess (rcs, user) return; } } + free (access); rcs->access = (char *) xrealloc (rcs->access, strlen (rcs->access) + strlen (user) + 2); strcat (rcs->access, " "); @@ -6282,13 +5954,19 @@ RCS_delaccess (rcs, user) if (rcs->access == NULL) return; + if (user == NULL) + { + free (rcs->access); + rcs->access = NULL; + return; + } + p = rcs->access; ulen = strlen (user); while (p != NULL) { - if (p[ulen] == '\0' || p[ulen] == ' ') - if (strncmp (p, user, ulen) == 0) - break; + if (strncmp (p, user, ulen) == 0 && (p[ulen] == '\0' || p[ulen] == ' ')) + break; p = strchr (p, ' '); if (p != NULL) ++p; @@ -7687,7 +7365,7 @@ getdelta (rcsbuf, rcsfile, keyp, valp) char **valp; { RCSVers *vnode; - char *key, *value, *keybuf, *valbuf, *cp; + char *key, *value, *cp; Node *kv; /* Get revision number if it wasn't passed in. This uses @@ -7805,81 +7483,32 @@ unable to parse %s; `state' not in the expected place", rcsfile); */ while (1) { - int len; - size_t valbuflen; - - key = NULL; - - if (! rcsbuf_getid (rcsbuf, &keybuf)) + if (! rcsbuf_getkey (rcsbuf, &key, &value)) error (1, 0, "unexpected end of file reading %s", rcsfile); - /* rcsbuf_getid did not terminate the key, so copy it to new space. */ - len = rcsbuf->ptr - keybuf; - key = (char *) xmalloc (sizeof(char) * (len + 1)); - strncpy (key, keybuf, len); - key[len] = '\0'; - - /* The `desc' keyword has only a single string value, with no - trailing semicolon, so it must be handled specially. */ - if (STREQ (key, RCSDESC)) - { - (void) rcsbuf_getstring (rcsbuf, &valbuf); - value = rcsbuf_valcopy (rcsbuf, valbuf, 1, &valbuflen); + /* The `desc' keyword is the end of the deltas. */ + if (strcmp (key, RCSDESC) == 0) break; - } #ifdef PRESERVE_PERMISSIONS_SUPPORT + /* The `hardlinks' value is a group of words, which must be parsed separately and added as a list to vnode->hardlinks. */ - if (STREQ (key, "hardlinks")) + if (strcmp (key, "hardlinks") == 0) { - Node *n; + char *word; vnode->hardlinks = getlist(); - while (1) + while ((word = rcsbuf_valword (rcsbuf, &value)) != NULL) { - if (! rcsbuf_getword (rcsbuf, &valbuf)) - error (1, 0, "unexpected end of file reading %s", rcsfile); - if (valbuf == NULL) - break; - n = getnode(); - n->key = rcsbuf_valcopy (rcsbuf, valbuf, 1, NULL); + Node *n = getnode(); + n->key = word; addnode (vnode->hardlinks, n); } continue; } #endif - /* Get the value. */ - value = NULL; - while (1) - { - if (! rcsbuf_getword (rcsbuf, &valbuf)) - error (1, 0, "unexpected end of file reading %s", rcsfile); - if (valbuf == NULL) - break; - - /* Copy valbuf to new space so we can polish it, then - append it to value. */ - - if (value == NULL) - { - value = rcsbuf_valcopy (rcsbuf, valbuf, 1, &valbuflen); - } - else - { - char *temp_value; - - temp_value = rcsbuf_valcopy (rcsbuf, valbuf, 1, &valbuflen); - len = strlen (value); - value = (char *) xrealloc - (value, sizeof(char) * (len + valbuflen + 2)); - value[len] = ' '; - strcpy (value + len + 1, temp_value); - free (temp_value); - } - } - /* Enable use of repositories created by certain obsolete versions of CVS. This code should remain indefinately; there is no procedure for converting old repositories, and @@ -7908,9 +7537,10 @@ unable to parse %s; `state' not in the expected place", rcsfile); if (vnode->other_delta == NULL) vnode->other_delta = getlist (); kv = getnode (); - kv->type = RCSFIELD; - kv->key = key; - kv->data = value; + kv->type = rcsbuf_valcmp (rcsbuf) ? RCSCMPFLD : RCSFIELD; + kv->key = xstrdup (key); + kv->data = rcsbuf_valcopy (rcsbuf, value, kv->type == RCSFIELD, + (size_t *) NULL); if (addnode (vnode->other_delta, kv) != 0) { /* Complaining about duplicate keys in newphrases seems @@ -7995,9 +7625,10 @@ RCS_getdeltatext (rcs, fp, rcsbuf) break; p = getnode(); - p->type = RCSFIELD; + p->type = rcsbuf_valcmp (rcsbuf) ? RCSCMPFLD : RCSFIELD; p->key = xstrdup (key); - p->data = rcsbuf_valcopy (rcsbuf, value, 1, (size_t *) NULL); + p->data = rcsbuf_valcopy (rcsbuf, value, p->type == RCSFIELD, + (size_t *) NULL); if (addnode (d->other, p) < 0) { error (0, 0, "warning: %s, delta %s: duplicate field `%s'", @@ -8078,8 +7709,8 @@ putrcsfield_proc (node, vfp) A case where we are wrong in a much more clear-cut way is that we let through non-graphic characters such as whitespace and control characters. */ - int n = strcspn (node->data, "$,.:;@"); - if (node->data[n] == 0) + + if (node->type == RCSCMPFLD || strpbrk (node->data, "$,.:;@") == NULL) fputs (node->data, fp); else { @@ -8240,7 +7871,13 @@ RCS_putdtree (rcs, rev, fp) /* Find the delta node for this revision. */ p = findnode (rcs->versions, rev); - assert (p != NULL); + if (p == NULL) + { + error (1, 0, + "error parsing repository file %s, file may be corrupt.", + rcs->path); + } + versp = (RCSVers *) p->data; /* Print the delta node and recurse on its `next' node. This prints @@ -8361,6 +7998,7 @@ RCS_copydeltas (rcs, fin, rcsbufin, fout, newdtext, insertpt) /* If this revision has been outdated, just skip it. */ if (dadmin->outdated) { + freedeltatext (dtext); --actions; continue; } @@ -8480,7 +8118,7 @@ count_delta_actions (np, ignore) /* * Clean up temporary files */ -static RETSIGTYPE +RETSIGTYPE rcs_cleanup () { /* Note that the checks for existence_error are because we are @@ -8494,11 +8132,18 @@ rcs_cleanup () of a just-created file) reentrancy won't be an issue. */ if (rcs_lockfile != NULL) { - if (unlink_file (rcs_lockfile) < 0 + char *tmp = rcs_lockfile; + rcs_lockfile = NULL; + if (rcs_lockfd >= 0) + { + if (close (rcs_lockfd) != 0) + error (0, errno, "error closing lock file %s", tmp); + rcs_lockfd = -1; + } + if (unlink_file (tmp) < 0 && !existence_error (errno)) - error (0, errno, "cannot remove %s", rcs_lockfile); + error (0, errno, "cannot remove %s", tmp); } - rcs_lockfile = NULL; } /* RCS_internal_lockfile and RCS_internal_unlockfile perform RCS-style @@ -8532,7 +8177,6 @@ static FILE * rcs_internal_lockfile (rcsfile) char *rcsfile; { - int fd; struct stat rstat; FILE *fp; static int first_call = 1; @@ -8541,6 +8185,9 @@ rcs_internal_lockfile (rcsfile) { first_call = 0; /* clean up if we get a signal */ +#ifdef SIGABRT + (void) SIG_register (SIGABRT, rcs_cleanup); +#endif #ifdef SIGHUP (void) SIG_register (SIGHUP, rcs_cleanup); #endif @@ -8560,6 +8207,7 @@ rcs_internal_lockfile (rcsfile) /* Get the lock file name: `,file,' for RCS file `file,v'. */ assert (rcs_lockfile == NULL); + assert (rcs_lockfd < 0); rcs_lockfile = rcs_lockfilename (rcsfile); /* Use the existing RCS file mode, or read-only if this is a new @@ -8586,11 +8234,11 @@ rcs_internal_lockfile (rcsfile) rely on O_EXCL these days. This might be true for unix (I don't really know), but I am still pretty skeptical in the case of the non-unix systems. */ - fd = open (rcs_lockfile, - OPEN_BINARY | O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, - S_IRUSR | S_IRGRP | S_IROTH); + rcs_lockfd = open (rcs_lockfile, + OPEN_BINARY | O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, + S_IRUSR | S_IRGRP | S_IROTH); - if (fd < 0) + if (rcs_lockfd < 0) { error (1, errno, "could not open lock file `%s'", rcs_lockfile); } @@ -8599,10 +8247,10 @@ rcs_internal_lockfile (rcsfile) /* Because we change the modes later, we don't worry about this in the non-HAVE_FCHMOD case. */ #ifdef HAVE_FCHMOD - if (fchmod (fd, rstat.st_mode) < 0) + if (fchmod (rcs_lockfd, rstat.st_mode) < 0) error (1, errno, "cannot change mode for %s", rcs_lockfile); #endif - fp = fdopen (fd, FOPEN_BINARY_WRITE); + fp = fdopen (rcs_lockfd, FOPEN_BINARY_WRITE); if (fp == NULL) error (1, errno, "cannot fdopen %s", rcs_lockfile); @@ -8615,6 +8263,7 @@ rcs_internal_unlockfile (fp, rcsfile) char *rcsfile; { assert (rcs_lockfile != NULL); + assert (rcs_lockfd >= 0); /* Abort if we could not write everything successfully to LOCKFILE. This is not a great error-handling mechanism, but should prevent @@ -8630,6 +8279,7 @@ rcs_internal_unlockfile (fp, rcsfile) error (1, 0, "error writing to lock file %s", rcs_lockfile); if (fclose (fp) == EOF) error (1, errno, "error closing lock file %s", rcs_lockfile); + rcs_lockfd = -1; rename_file (rcs_lockfile, rcsfile); @@ -8723,6 +8373,22 @@ RCS_rewrite (rcs, newdtext, insertpt) rcs_internal_unlockfile (fout, rcs->path); } +/* Abandon changes to an RCS file. */ + +void +RCS_abandon (rcs) + RCSNode *rcs; +{ + free_rcsnode_contents (rcs); + rcs->symbols_data = NULL; + rcs->expand = NULL; + rcs->access = NULL; + rcs->locks_data = NULL; + rcs->comment = NULL; + rcs->desc = NULL; + rcs->flags |= PARTIAL; +} + /* Annotate command. In rcs.c for historical reasons (from back when what is now RCS_deltas was part of annotate_fileproc). */ diff --git a/gnu/usr.bin/cvs/src/recurse.c b/gnu/usr.bin/cvs/src/recurse.c index e93afbf39cd..1cb2fbbf35d 100644 --- a/gnu/usr.bin/cvs/src/recurse.c +++ b/gnu/usr.bin/cvs/src/recurse.c @@ -173,6 +173,7 @@ start_recursion (fileproc, filesdoneproc, direntproc, dirleaveproc, callerdat, seems to be handled somewhere (else) but why should it be a separate case? Needs investigation... */ just_subdirs = 1; + free (root); } #endif @@ -590,7 +591,7 @@ do_recursion (frame) /* Add it to our list. */ Node *n = getnode (); - n->type = UNKNOWN; + n->type = NT_UNKNOWN; n->key = xstrdup (this_root); if (addnode (root_directories, n)) @@ -1015,7 +1016,7 @@ but CVS uses %s for its own purposes; skipping %s directory", /* Add it to our list. */ Node *n = getnode (); - n->type = UNKNOWN; + n->type = NT_UNKNOWN; n->key = xstrdup (this_root); if (addnode (root_directories, n)) @@ -1132,6 +1133,7 @@ addfile (listp, dir, file) char *file; { Node *n; + List *fl; /* add this dir. */ addlist (listp, dir); @@ -1144,7 +1146,9 @@ addfile (listp, dir, file) } n->type = DIRS; - addlist ((List **) &n->data, file); + fl = (List *) n->data; + addlist (&fl, file); + n->data = (char *) fl; return; } @@ -1204,6 +1208,7 @@ unroll_files_proc (p, closure) } dirlist = save_dirlist; - filelist = NULL; + if (filelist) + dellist (&filelist); return(err); } diff --git a/gnu/usr.bin/cvs/src/root.c b/gnu/usr.bin/cvs/src/root.c index 99e9396699b..1007fc422b4 100644 --- a/gnu/usr.bin/cvs/src/root.c +++ b/gnu/usr.bin/cvs/src/root.c @@ -174,9 +174,9 @@ Create_Root (dir, rootdir) directories. Then we can check against them when a remote user hands us a CVSROOT directory. */ -static unsigned int root_allow_count; +static int root_allow_count; static char **root_allow_vector; -static unsigned int root_allow_size; +static int root_allow_size; void root_allow_add (arg) @@ -233,8 +233,7 @@ void root_allow_free () { if (root_allow_vector != NULL) - free (root_allow_vector); - root_allow_count = 0; + free_names (&root_allow_count, root_allow_vector); root_allow_size = 0; } @@ -242,7 +241,7 @@ int root_allow_ok (arg) char *arg; { - unsigned int i; + int i; if (root_allow_count == 0) { @@ -295,7 +294,7 @@ parse_cvsroot (CVSroot) char *CVSroot; { static int cvsroot_parsed = 0; - char *cvsroot_copy, *p; + char *cvsroot_copy, *cvsroot_save, *p; int check_hostname; /* Don't go through the trouble twice. */ @@ -305,10 +304,19 @@ parse_cvsroot (CVSroot) return 0; } + if (CVSroot_original != NULL) + free (CVSroot_original); + if (CVSroot_directory != NULL) + free (CVSroot_directory); + if (CVSroot_username != NULL) + free (CVSroot_username); + if (CVSroot_hostname != NULL) + free (CVSroot_hostname); + CVSroot_original = xstrdup (CVSroot); - cvsroot_copy = xstrdup (CVSroot); + cvsroot_save = cvsroot_copy = xstrdup (CVSroot); - if ((*cvsroot_copy == ':')) + if (*cvsroot_copy == ':') { char *method = ++cvsroot_copy; @@ -324,6 +332,7 @@ parse_cvsroot (CVSroot) if (! (p = strchr (method, ':'))) { error (0, 0, "bad CVSroot: %s", CVSroot); + free (cvsroot_save); return 1; } *p = '\0'; @@ -348,6 +357,7 @@ parse_cvsroot (CVSroot) else { error (0, 0, "unknown method in CVSroot: %s", CVSroot); + free (cvsroot_save); return 1; } } @@ -378,19 +388,19 @@ parse_cvsroot (CVSroot) { /* Check to see if there is a username in the string. */ - if ((p = strchr (cvsroot_copy, '@'))) + if ((p = strchr (cvsroot_copy, '@')) != NULL) { - CVSroot_username = cvsroot_copy; *p = '\0'; + CVSroot_username = xstrdup (cvsroot_copy); cvsroot_copy = ++p; if (*CVSroot_username == '\0') CVSroot_username = NULL; } - if ((p = strchr (cvsroot_copy, ':'))) + if ((p = strchr (cvsroot_copy, ':')) != NULL) { - CVSroot_hostname = cvsroot_copy; *p = '\0'; + CVSroot_hostname = xstrdup (cvsroot_copy); cvsroot_copy = ++p; if (*CVSroot_hostname == '\0') @@ -398,7 +408,8 @@ parse_cvsroot (CVSroot) } } - CVSroot_directory = cvsroot_copy; + CVSroot_directory = xstrdup(cvsroot_copy); + free (cvsroot_save); #if ! defined (CLIENT_SUPPORT) && ! defined (DEBUG) if (CVSroot_method != local_method) @@ -422,12 +433,10 @@ parse_cvsroot (CVSroot) switch (CVSroot_method) { case local_method: - case fork_method: if (CVSroot_username || CVSroot_hostname) { error (0, 0, "can't specify hostname and username in CVSROOT"); - error (0, 0, "when using %s access method", - CVSroot_method == local_method ? "local" : "fork"); + error (0, 0, "when using local access method"); error (0, 0, "(%s)", CVSroot); return 1; } @@ -440,6 +449,18 @@ parse_cvsroot (CVSroot) error (1, 0, "CVSROOT %s must be an absolute pathname", CVSroot_directory); break; + case fork_method: + /* We want :fork: to behave the same as other remote access + methods. Therefore, don't check to see that the repository + name is absolute -- let the server do it. */ + if (CVSroot_username || CVSroot_hostname) + { + error (0, 0, "can't specify hostname and username in CVSROOT"); + error (0, 0, "when using fork access method"); + error (0, 0, "(%s)", CVSroot); + return 1; + } + break; case kserver_method: #ifndef HAVE_KERBEROS error (0, 0, "Your CVSROOT is set for a kerberos access method"); @@ -488,18 +509,24 @@ parse_cvsroot (CVSroot) /* Set up the global CVSroot* variables as if we're using the local - repository DIR. DIR must point to storage which will last for the - rest of the CVS invocation (for example, the caller might malloc it - and never free it, or free it just before exiting CVS). */ + repository DIR. */ void set_local_cvsroot (dir) char *dir; { - CVSroot_original = dir; + if (CVSroot_original != NULL) + free (CVSroot_original); + CVSroot_original = xstrdup(dir); CVSroot_method = local_method; - CVSroot_directory = CVSroot_original; + if (CVSroot_directory != NULL) + free (CVSroot_directory); + CVSroot_directory = xstrdup(dir); + if (CVSroot_username != NULL) + free (CVSroot_username); CVSroot_username = NULL; + if (CVSroot_hostname != NULL) + free (CVSroot_hostname); CVSroot_hostname = NULL; client_active = 0; } diff --git a/gnu/usr.bin/cvs/src/server.c b/gnu/usr.bin/cvs/src/server.c index da9ea2b5fd7..c55c416d484 100644 --- a/gnu/usr.bin/cvs/src/server.c +++ b/gnu/usr.bin/cvs/src/server.c @@ -183,6 +183,7 @@ static int fd_buffer_input PROTO((void *, char *, int, int, int *)); static int fd_buffer_output PROTO((void *, const char *, int, int *)); static int fd_buffer_flush PROTO((void *)); static int fd_buffer_block PROTO((void *, int)); +static int fd_buffer_shutdown PROTO((void *)); /* Initialize a buffer built on a file descriptor. FD is the file descriptor. INPUT is nonzero if this is for input, zero if this is @@ -204,7 +205,7 @@ fd_buffer_initialize (fd, input, memory) input ? NULL : fd_buffer_output, input ? NULL : fd_buffer_flush, fd_buffer_block, - (int (*) PROTO((void *))) NULL, + fd_buffer_shutdown, memory, n); } @@ -341,6 +342,16 @@ fd_buffer_block (closure, block) return 0; } +/* The buffer shutdown function for a buffer built on a file descriptor. */ + +static int +fd_buffer_shutdown (closure) + void *closure; +{ + free (closure); + return 0; +} + /* Populate all of the directories between BASE_DIR and its relative subdirectory DIR with CVSADM directories. Return 0 for success or errno value. */ @@ -738,8 +749,6 @@ serve_root (arg) { char *env; char *path; - int save_errno; - char *arg_dup; if (error_pending()) return; @@ -781,14 +790,7 @@ E Protocol error: Root says \"%s\" but pserver says \"%s\"", } } #endif - arg_dup = malloc (strlen (arg) + 1); - if (arg_dup == NULL) - { - pending_error = ENOMEM; - return; - } - strcpy (arg_dup, arg); - set_local_cvsroot (arg_dup); + set_local_cvsroot (arg); /* For pserver, this will already have happened, and the call will do nothing. But for rsh, we need to do it now. */ @@ -796,7 +798,6 @@ E Protocol error: Root says \"%s\" but pserver says \"%s\"", path = malloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM) - + sizeof (CVSROOTADM_HISTORY) + 10); if (path == NULL) { @@ -804,25 +805,13 @@ E Protocol error: Root says \"%s\" but pserver says \"%s\"", return; } (void) sprintf (path, "%s/%s", CVSroot_directory, CVSROOTADM); - if (!isaccessible (path, R_OK | X_OK)) + if (readonlyfs == 0 && !isaccessible (path, R_OK | X_OK)) { - save_errno = errno; - pending_error_text = malloc (80 + strlen (path)); - if (pending_error_text != NULL) + int save_errno = errno; + if (alloc_pending (80 + strlen (path))) sprintf (pending_error_text, "E Cannot access %s", path); pending_error = save_errno; } - (void) strcat (path, "/"); - (void) strcat (path, CVSROOTADM_HISTORY); - if (readonlyfs == 0 && isfile (path) && !isaccessible (path, R_OK | W_OK)) - { - save_errno = errno; - pending_error_text = malloc (80 + strlen (path)); - if (pending_error_text != NULL) - sprintf (pending_error_text, "E \ -Sorry, you don't have read/write access to the history file %s", path); - pending_error = save_errno; - } free (path); #ifdef HAVE_PUTENV @@ -1036,9 +1025,9 @@ dirswitch (dir, repos) if (status != 0 && status != EEXIST) { - pending_error = status; if (alloc_pending (80 + strlen (dir_name))) sprintf (pending_error_text, "E cannot mkdir %s", dir_name); + pending_error = status; return; } @@ -1051,17 +1040,18 @@ dirswitch (dir, repos) status = create_adm_p (server_temp_dir, dir); if (status != 0) { - pending_error = status; if (alloc_pending (80 + strlen (dir_name))) sprintf (pending_error_text, "E cannot create_adm_p %s", dir_name); + pending_error = status; return; } if ( CVS_CHDIR (dir_name) < 0) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (dir_name))) sprintf (pending_error_text, "E cannot change to %s", dir_name); + pending_error = save_errno; return; } /* @@ -1070,10 +1060,14 @@ dirswitch (dir, repos) */ if ((CVS_MKDIR (CVSADM, 0777) < 0) && (errno != EEXIST)) { - pending_error = errno; + int save_errno = errno; + if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM))) + sprintf (pending_error_text, + "E cannot mkdir %s/%s", dir_name, CVSADM); + pending_error = save_errno; return; } - + /* The following will overwrite the contents of CVSADM_REP. This is the correct behavior -- mkdir_p may have written a placeholder value to this file and we need to insert the @@ -1082,12 +1076,20 @@ dirswitch (dir, repos) f = CVS_FOPEN (CVSADM_REP, "w"); if (f == NULL) { - pending_error = errno; + int save_errno = errno; + if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM_REP))) + sprintf (pending_error_text, + "E cannot open %s/%s", dir_name, CVSADM_REP); + pending_error = save_errno; return; } if (fprintf (f, "%s", repos) < 0) { - pending_error = errno; + int save_errno = errno; + if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM_REP))) + sprintf (pending_error_text, + "E error writing %s/%s", dir_name, CVSADM_REP); + pending_error = save_errno; fclose (f); return; } @@ -1100,20 +1102,32 @@ dirswitch (dir, repos) { if (fprintf (f, "/.") < 0) { - pending_error = errno; + int save_errno = errno; + if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM_REP))) + sprintf (pending_error_text, + "E error writing %s/%s", dir_name, CVSADM_REP); + pending_error = save_errno; fclose (f); return; } } if (fprintf (f, "\n") < 0) { - pending_error = errno; + int save_errno = errno; + if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM_REP))) + sprintf (pending_error_text, + "E error writing %s/%s", dir_name, CVSADM_REP); + pending_error = save_errno; fclose (f); return; } if (fclose (f) == EOF) { - pending_error = errno; + int save_errno = errno; + if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM_REP))) + sprintf (pending_error_text, + "E error closing %s/%s", dir_name, CVSADM_REP); + pending_error = save_errno; return; } /* We open in append mode because we don't want to clobber an @@ -1121,16 +1135,18 @@ dirswitch (dir, repos) f = CVS_FOPEN (CVSADM_ENT, "a"); if (f == NULL) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_ENT))) sprintf (pending_error_text, "E cannot open %s", CVSADM_ENT); + pending_error = save_errno; return; } if (fclose (f) == EOF) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_ENT))) sprintf (pending_error_text, "E cannot close %s", CVSADM_ENT); + pending_error = save_errno; return; } } @@ -1139,10 +1155,7 @@ static void serve_repository (arg) char *arg; { - pending_error_text = malloc (80); - if (pending_error_text == NULL) - pending_error = ENOMEM; - else + if (alloc_pending (80)) strcpy (pending_error_text, "E Repository request is obsolete; aborted"); return; @@ -1158,9 +1171,8 @@ serve_directory (arg) status = buf_read_line (buf_from_net, &repos, (int *) NULL); if (status == 0) { - if (outside_root (repos)) - return; - dirswitch (arg, repos); + if (!outside_root (repos)) + dirswitch (arg, repos); free (repos); } else if (status == -2) @@ -1199,16 +1211,18 @@ serve_static_directory (arg) f = CVS_FOPEN (CVSADM_ENTSTAT, "w+"); if (f == NULL) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_ENTSTAT))) sprintf (pending_error_text, "E cannot open %s", CVSADM_ENTSTAT); + pending_error = save_errno; return; } if (fclose (f) == EOF) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_ENTSTAT))) sprintf (pending_error_text, "E cannot close %s", CVSADM_ENTSTAT); + pending_error = save_errno; return; } } @@ -1224,23 +1238,26 @@ serve_sticky (arg) f = CVS_FOPEN (CVSADM_TAG, "w+"); if (f == NULL) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_TAG))) sprintf (pending_error_text, "E cannot open %s", CVSADM_TAG); + pending_error = save_errno; return; } if (fprintf (f, "%s\n", arg) < 0) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_TAG))) sprintf (pending_error_text, "E cannot write to %s", CVSADM_TAG); + pending_error = save_errno; return; } if (fclose (f) == EOF) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_TAG))) sprintf (pending_error_text, "E cannot close %s", CVSADM_TAG); + pending_error = save_errno; return; } } @@ -1299,10 +1316,10 @@ receive_partial_file (size, file) nwrote = write (file, data, nread); if (nwrote < 0) { - pending_error_text = malloc (40); - if (pending_error_text != NULL) - sprintf (pending_error_text, "E unable to write"); - pending_error = errno; + int save_errno = errno; + if (alloc_pending (40)) + strcpy (pending_error_text, "E unable to write"); + pending_error = save_errno; /* Read and discard the file data. */ while (size > 0) @@ -1338,10 +1355,10 @@ receive_file (size, file, gzipped) fd = CVS_OPEN (arg, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd < 0) { - pending_error_text = malloc (40 + strlen (arg)); - if (pending_error_text) + int save_errno = errno; + if (alloc_pending (40 + strlen (arg))) sprintf (pending_error_text, "E cannot open %s", arg); - pending_error = errno; + pending_error = save_errno; return; } @@ -1407,7 +1424,7 @@ receive_file (size, file, gzipped) goto out; } - if (gunzip_and_write (fd, file, filebuf, size)) + if (gunzip_and_write (fd, file, (unsigned char *) filebuf, size)) { if (alloc_pending (80)) sprintf (pending_error_text, @@ -1433,10 +1450,10 @@ receive_file (size, file, gzipped) out: if (close (fd) < 0 && !error_pending ()) { - pending_error_text = malloc (40 + strlen (arg)); - if (pending_error_text) + int save_errno = errno; + if (alloc_pending (40 + strlen (arg))) sprintf (pending_error_text, "E cannot close %s", arg); - pending_error = errno; + pending_error = save_errno; return; } } @@ -1515,10 +1532,11 @@ serve_modified (arg) { sprintf (pending_error_text, "E error reading size for %s", arg); - pending_error = errno; + pending_error = status; } } } + free (mode_text); return; } if (size_text[0] == 'z') @@ -1543,16 +1561,24 @@ serve_modified (arg) return; size -= nread; } + free (mode_text); return; } if (outside_dir (arg)) + { + free (mode_text); return; + } if (size >= 0) { receive_file (size, arg, gzipped); - if (error_pending ()) return; + if (error_pending ()) + { + free (mode_text); + return; + } } if (checkin_time_valid) @@ -1563,9 +1589,11 @@ serve_modified (arg) t.modtime = t.actime = checkin_time; if (utime (arg, &t) < 0) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (arg))) sprintf (pending_error_text, "E cannot utime %s", arg); + pending_error = save_errno; + free (mode_text); return; } checkin_time_valid = 0; @@ -1576,8 +1604,7 @@ serve_modified (arg) free (mode_text); if (status) { - pending_error_text = malloc (40 + strlen (arg)); - if (pending_error_text) + if (alloc_pending (40 + strlen (arg))) sprintf (pending_error_text, "E cannot change mode for %s", arg); pending_error = status; @@ -1852,9 +1879,10 @@ server_write_entries () f = CVS_FOPEN (CVSADM_ENT, "a"); if (f == NULL) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_ENT))) sprintf (pending_error_text, "E cannot open %s", CVSADM_ENT); + pending_error = save_errno; } } for (p = entries; p != NULL;) @@ -1863,10 +1891,11 @@ server_write_entries () { if (fprintf (f, "%s\n", p->entry) < 0) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen(CVSADM_ENT))) sprintf (pending_error_text, "E cannot write to %s", CVSADM_ENT); + pending_error = save_errno; } } free (p->entry); @@ -1877,9 +1906,10 @@ server_write_entries () entries = NULL; if (f != NULL && fclose (f) == EOF && !error_pending ()) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_ENT))) sprintf (pending_error_text, "E cannot close %s", CVSADM_ENT); + pending_error = save_errno; } } @@ -1911,8 +1941,8 @@ static void serve_notify (arg) char *arg; { - struct notify_note *new; - char *data; + struct notify_note *new = NULL; + char *data = NULL; int status; if (error_pending ()) return; @@ -1920,27 +1950,26 @@ serve_notify (arg) if (outside_dir (arg)) return; + if (dir_name == NULL) + goto error; + new = (struct notify_note *) malloc (sizeof (struct notify_note)); if (new == NULL) { pending_error = ENOMEM; return; } - if (dir_name == NULL) - goto error; new->dir = malloc (strlen (dir_name) + 1); - if (new->dir == NULL) - { - pending_error = ENOMEM; - return; - } - strcpy (new->dir, dir_name); new->filename = malloc (strlen (arg) + 1); - if (new->filename == NULL) + if (new->dir == NULL || new->filename == NULL) { pending_error = ENOMEM; + if (new->dir != NULL) + free (new->dir); + free (new); return; } + strcpy (new->dir, dir_name); strcpy (new->filename, arg); status = buf_read_line (buf_from_net, &data, (int *) NULL); @@ -1966,6 +1995,9 @@ serve_notify (arg) } } } + free (new->filename); + free (new->dir); + free (new); } else { @@ -2013,11 +2045,18 @@ serve_notify (arg) } return; error: - pending_error_text = malloc (80); - if (pending_error_text) + pending_error = 0; + if (alloc_pending (80)) strcpy (pending_error_text, "E Protocol error; misformed Notify request"); - pending_error = 0; + if (data != NULL) + free (data); + if (new != NULL) + { + free (new->filename); + free (new->dir); + free (new); + } return; } @@ -2060,6 +2099,7 @@ server_notify () buf_append_char (buf_to_net, '/'); buf_output0 (buf_to_net, notify_list->filename); buf_append_char (buf_to_net, '\n'); + free (repos); p = notify_list->next; free (notify_list->filename); @@ -2647,22 +2687,26 @@ error \n"); if (pipe (stdout_pipe) < 0) { + buf_output0 (buf_to_net, "E pipe failed\n"); print_error (errno); goto error_exit; } if (pipe (stderr_pipe) < 0) { + buf_output0 (buf_to_net, "E pipe failed\n"); print_error (errno); goto error_exit; } if (pipe (protocol_pipe) < 0) { + buf_output0 (buf_to_net, "E pipe failed\n"); print_error (errno); goto error_exit; } #ifdef SERVER_FLOWCONTROL if (pipe (flowcontrol_pipe) < 0) { + buf_output0 (buf_to_net, "E pipe failed\n"); print_error (errno); goto error_exit; } @@ -2673,6 +2717,7 @@ error \n"); dev_null_fd = CVS_OPEN (DEVNULL, O_RDONLY); if (dev_null_fd < 0) { + buf_output0 (buf_to_net, "E open /dev/null failed\n"); print_error (errno); goto error_exit; } @@ -2700,6 +2745,7 @@ error \n"); command_pid = fork (); if (command_pid < 0) { + buf_output0 (buf_to_net, "E fork failed\n"); print_error (errno); goto error_exit; } @@ -2733,8 +2779,11 @@ error \n"); error (1, errno, "can't set up pipes"); if (dup2 (stderr_pipe[1], STDERR_FILENO) < 0) error (1, errno, "can't set up pipes"); + close (dev_null_fd); close (stdout_pipe[0]); + close (stdout_pipe[1]); close (stderr_pipe[0]); + close (stderr_pipe[1]); close (protocol_pipe[0]); #ifdef SERVER_FLOWCONTROL close (flowcontrol_pipe[1]); @@ -2769,6 +2818,7 @@ error \n"); * When we exit, that will close the pipes, giving an EOF to * the parent. */ + buf_free (protocol); exit (exitstatus); } @@ -2825,6 +2875,7 @@ error \n"); if (close (stdout_pipe[1]) < 0) { + buf_output0 (buf_to_net, "E close failed\n"); print_error (errno); goto error_exit; } @@ -2832,6 +2883,7 @@ error \n"); if (close (stderr_pipe[1]) < 0) { + buf_output0 (buf_to_net, "E close failed\n"); print_error (errno); goto error_exit; } @@ -2839,6 +2891,7 @@ error \n"); if (close (protocol_pipe[1]) < 0) { + buf_output0 (buf_to_net, "E close failed\n"); print_error (errno); goto error_exit; } @@ -2847,6 +2900,7 @@ error \n"); #ifdef SERVER_FLOWCONTROL if (close (flowcontrol_pipe[0]) < 0) { + buf_output0 (buf_to_net, "E close failed\n"); print_error (errno); goto error_exit; } @@ -2855,6 +2909,7 @@ error \n"); if (close (dev_null_fd) < 0) { + buf_output0 (buf_to_net, "E close failed\n"); print_error (errno); goto error_exit; } @@ -2922,6 +2977,7 @@ error \n"); if (numfds < 0 && errno != EINTR) { + buf_output0 (buf_to_net, "E select failed\n"); print_error (errno); goto error_exit; } @@ -2933,48 +2989,6 @@ error \n"); buf_send_output (buf_to_net); } - if (stdout_pipe[0] >= 0 - && (FD_ISSET (stdout_pipe[0], &readfds))) - { - int status; - - status = buf_input_data (stdoutbuf, (int *) NULL); - - buf_copy_lines (buf_to_net, stdoutbuf, 'M'); - - if (status == -1) - stdout_pipe[0] = -1; - else if (status > 0) - { - print_error (status); - goto error_exit; - } - - /* What should we do with errors? syslog() them? */ - buf_send_output (buf_to_net); - } - - if (stderr_pipe[0] >= 0 - && (FD_ISSET (stderr_pipe[0], &readfds))) - { - int status; - - status = buf_input_data (stderrbuf, (int *) NULL); - - buf_copy_lines (buf_to_net, stderrbuf, 'E'); - - if (status == -1) - stderr_pipe[0] = -1; - else if (status > 0) - { - print_error (status); - goto error_exit; - } - - /* What should we do with errors? syslog() them? */ - buf_send_output (buf_to_net); - } - if (protocol_pipe[0] >= 0 && (FD_ISSET (protocol_pipe[0], &readfds))) { @@ -2985,9 +2999,13 @@ error \n"); status = buf_input_data (protocol_inbuf, &count_read); if (status == -1) + { + close (protocol_pipe[0]); protocol_pipe[0] = -1; + } else if (status > 0) { + buf_output0 (buf_to_net, "E buf_input_data failed\n"); print_error (status); goto error_exit; } @@ -3024,6 +3042,56 @@ error \n"); } } } + + if (stdout_pipe[0] >= 0 + && (FD_ISSET (stdout_pipe[0], &readfds))) + { + int status; + + status = buf_input_data (stdoutbuf, (int *) NULL); + + buf_copy_lines (buf_to_net, stdoutbuf, 'M'); + + if (status == -1) + { + close (stdout_pipe[0]); + stdout_pipe[0] = -1; + } + else if (status > 0) + { + buf_output0 (buf_to_net, "E buf_input_data failed\n"); + print_error (status); + goto error_exit; + } + + /* What should we do with errors? syslog() them? */ + buf_send_output (buf_to_net); + } + + if (stderr_pipe[0] >= 0 + && (FD_ISSET (stderr_pipe[0], &readfds))) + { + int status; + + status = buf_input_data (stderrbuf, (int *) NULL); + + buf_copy_lines (buf_to_net, stderrbuf, 'E'); + + if (status == -1) + { + close (stderr_pipe[0]); + stderr_pipe[0] = -1; + } + else if (status > 0) + { + buf_output0 (buf_to_net, "E buf_input_data failed\n"); + print_error (status); + goto error_exit; + } + + /* What should we do with errors? syslog() them? */ + buf_send_output (buf_to_net); + } } /* @@ -3045,6 +3113,11 @@ error \n"); buf_output0 (buf_to_net, "E Protocol error: uncounted data discarded\n"); +#ifdef SERVER_FLOWCONTROL + close (flowcontrol_pipe[1]); + flowcontrol_pipe[1] = -1; +#endif /* SERVER_FLOWCONTROL */ + errs = 0; while (command_pid > 0) @@ -3099,6 +3172,12 @@ E CVS locks may need cleaning up.\n"); */ set_block (buf_to_net); buf_flush (buf_to_net, 1); + buf_shutdown (protocol_inbuf); + buf_free (protocol_inbuf); + buf_shutdown (stderrbuf); + buf_free (stderrbuf); + buf_shutdown (stdoutbuf); + buf_free (stdoutbuf); } if (errs) @@ -3129,6 +3208,10 @@ E CVS locks may need cleaning up.\n"); close (stderr_pipe[1]); close (stdout_pipe[0]); close (stdout_pipe[1]); +#ifdef SERVER_FLOWCONTROL + close (flowcontrol_pipe[0]); + close (flowcontrol_pipe[1]); +#endif /* SERVER_FLOWCONTROL */ free_args_and_return: /* Now free the arguments. */ @@ -3184,6 +3267,7 @@ server_pause_check() if (numfds < 0 && errno != EINTR) { + buf_output0 (buf_to_net, "E select failed\n"); print_error (errno); return; } @@ -3624,23 +3708,29 @@ serve_editors (arg) do_cvs_command ("editors", editors); } -static int noop PROTO ((int, char **)); +static void serve_noop PROTO ((char *)); -static int -noop (argc, argv) - int argc; - char **argv; +static void +serve_noop (arg) + char *arg; { - return 0; + + server_write_entries (); + if (!print_pending_error ()) + { + (void) server_notify (); + buf_output0 (buf_to_net, "ok\n"); + } + buf_flush (buf_to_net, 1); } -static void serve_noop PROTO ((char *)); +static void serve_version PROTO ((char *)); static void -serve_noop (arg) +serve_version (arg) char *arg; { - do_cvs_command ("noop", noop); + do_cvs_command ("version", version); } static void serve_init PROTO ((char *)); @@ -4017,7 +4107,7 @@ CVS server internal error: unhandled case in server_updated"); if (file != NULL) { - buf_output (protocol, file, file_used); + buf_output (protocol, (char *) file, file_used); free (file); file = NULL; } @@ -4314,9 +4404,9 @@ serve_ignore (arg) } static int -expand_proc (pargc, argv, where, mwhere, mfile, shorten, +expand_proc (argc, argv, where, mwhere, mfile, shorten, local_specified, omodule, msg) - int *pargc; + int argc; char **argv; char *where; char *mwhere; @@ -4355,7 +4445,7 @@ expand_proc (pargc, argv, where, mwhere, mfile, shorten, { /* We may not need to do this anymore -- check the definition of aliases before removing */ - if (*pargc == 1) + if (argc == 1) { buf_output0 (buf_to_net, "Module-expansion "); if (server_dir != NULL) @@ -4368,7 +4458,7 @@ expand_proc (pargc, argv, where, mwhere, mfile, shorten, } else { - for (i = 1; i < *pargc; ++i) + for (i = 1; i < argc; ++i) { buf_output0 (buf_to_net, "Module-expansion "); if (server_dir != NULL) @@ -4460,24 +4550,27 @@ serve_checkin_prog (arg) f = CVS_FOPEN (CVSADM_CIPROG, "w+"); if (f == NULL) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_CIPROG))) sprintf (pending_error_text, "E cannot open %s", CVSADM_CIPROG); + pending_error = save_errno; return; } if (fprintf (f, "%s\n", arg) < 0) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_CIPROG))) sprintf (pending_error_text, "E cannot write to %s", CVSADM_CIPROG); + pending_error = save_errno; return; } if (fclose (f) == EOF) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_CIPROG))) sprintf (pending_error_text, "E cannot close %s", CVSADM_CIPROG); + pending_error = save_errno; return; } } @@ -4503,23 +4596,26 @@ E Flag -u in modules not allowed in readonly mode"); f = CVS_FOPEN (CVSADM_UPROG, "w+"); if (f == NULL) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_UPROG))) sprintf (pending_error_text, "E cannot open %s", CVSADM_UPROG); + pending_error = save_errno; return; } if (fprintf (f, "%s\n", arg) < 0) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_UPROG))) sprintf (pending_error_text, "E cannot write to %s", CVSADM_UPROG); + pending_error = save_errno; return; } if (fclose (f) == EOF) { - pending_error = errno; + int save_errno = errno; if (alloc_pending (80 + strlen (CVSADM_UPROG))) sprintf (pending_error_text, "E cannot close %s", CVSADM_UPROG); + pending_error = save_errno; return; } } @@ -4572,7 +4668,7 @@ struct request requests[] = REQ_LINE("Case", serve_case, 0), REQ_LINE("Argument", serve_argument, RQ_ESSENTIAL), REQ_LINE("Argumentx", serve_argumentx, RQ_ESSENTIAL), - REQ_LINE("Global_option", serve_global_option, 0), + REQ_LINE("Global_option", serve_global_option, RQ_ROOTLESS), REQ_LINE("Gzip-stream", serve_gzip_stream, 0), REQ_LINE("wrapper-sendme-rcsOptions", serve_wrapper_sendme_rcs_options, @@ -4616,7 +4712,8 @@ struct request requests[] = REQ_LINE("editors", serve_editors, 0), REQ_LINE("init", serve_init, RQ_ROOTLESS), REQ_LINE("annotate", serve_annotate, 0), - REQ_LINE("noop", serve_noop, 0), + REQ_LINE("noop", serve_noop, RQ_ROOTLESS), + REQ_LINE("version", serve_version, RQ_ROOTLESS), REQ_LINE(NULL, NULL, 0) #undef REQ_LINE @@ -4843,16 +4940,10 @@ server (argc, argv) for that case. */ if (!isabsolute (Tmpdir)) { - pending_error_text = malloc (80 + strlen (Tmpdir)); - if (pending_error_text == NULL) - { - pending_error = ENOMEM; - } - else - { + if (alloc_pending (80 + strlen (Tmpdir))) sprintf (pending_error_text, "E Value of %s for TMPDIR is not absolute", Tmpdir); - } + /* FIXME: we would like this error to be persistent, that is, not cleared by print_pending_error. The current client will exit as soon as it gets an error, but the protocol spec @@ -4861,6 +4952,7 @@ server (argc, argv) else { int status; + int i = 0; server_temp_dir = malloc (strlen (Tmpdir) + 80); if (server_temp_dir == NULL) @@ -4907,12 +4999,21 @@ error ENOMEM Virtual memory exhausted.\n"); /* Create the temporary directory, and set the mode to 700, to discourage random people from tampering with it. */ - status = mkdir_p (server_temp_dir); - if (status != 0 && status != EEXIST) + while ((status = mkdir_p (server_temp_dir)) == EEXIST) { - if (alloc_pending (80)) - strcpy (pending_error_text, - "E can't create temporary directory"); + static const char suffix[] = "abcdefghijklmnopqrstuvwxyz"; + + if (i >= sizeof suffix - 1) break; + if (i == 0) p = server_temp_dir + strlen (server_temp_dir); + p[0] = suffix[i++]; + p[1] = '\0'; + } + if (status != 0) + { + if (alloc_pending (80 + strlen (server_temp_dir))) + sprintf (pending_error_text, + "E can't create temporary directory %s", + server_temp_dir); pending_error = status; } #ifndef CHMOD_BROKEN @@ -4921,9 +5022,10 @@ error ENOMEM Virtual memory exhausted.\n"); if (chmod (server_temp_dir, S_IRWXU) < 0) { int save_errno = errno; - if (alloc_pending (80)) - strcpy (pending_error_text, "\ -E cannot change permissions on temporary directory"); + if (alloc_pending (80 + strlen (server_temp_dir))) + sprintf (pending_error_text, +"E cannot change permissions on temporary directory %s", + server_temp_dir); pending_error = save_errno; } } @@ -4931,6 +5033,9 @@ E cannot change permissions on temporary directory"); } } +#ifdef SIGABRT + (void) SIG_register (SIGABRT, server_cleanup); +#endif #ifdef SIGHUP (void) SIG_register (SIGHUP, server_cleanup); #endif @@ -5110,7 +5215,7 @@ error 0 %s: no such user\n", username); if (setgid (getegid ()) < 0) { /* See comments at setuid call below for more discussion. */ - printf ("error 0 setuid failed: %s\n", strerror (errno)); + printf ("error 0 setgid failed: %s\n", strerror (errno)); /* Don't worry about server_cleanup; server_active isn't set yet. */ error_exit (); @@ -5122,7 +5227,7 @@ error 0 %s: no such user\n", username); if (setgid (pw->pw_gid) < 0) { /* See comments at setuid call below for more discussion. */ - printf ("error 0 setuid failed: %s\n", strerror (errno)); + printf ("error 0 setgid failed: %s\n", strerror (errno)); /* Don't worry about server_cleanup; server_active isn't set yet. */ error_exit (); @@ -5147,6 +5252,12 @@ error 0 %s: no such user\n", username); the client. */ umask (0); +#ifdef AUTH_SERVER_SUPPORT + /* Make sure our CVS_Username has been set. */ + if (CVS_Username == NULL) + CVS_Username = xstrdup (username); +#endif + #if HAVE_PUTENV /* Set LOGNAME and USER in the environment, in case they are already set to something else. */ @@ -5172,14 +5283,15 @@ extern char *crypt PROTO((const char *, const char *)); /* * 0 means no entry found for this user. - * 1 means entry found and password matches. + * 1 means entry found and password matches (or found password is empty) * 2 means entry found, but password does not match. * - * If success, host_user_ptr will be set to point at the system + * If 1, host_user_ptr will be set to point at the system * username (i.e., the "real" identity, which may or may not be the * CVS username) of this user; caller may free this. Global * CVS_Username will point at an allocated copy of cvs username (i.e., * the username argument below). + * kff todo: FIXME: last sentence is not true, it applies to caller. */ static int check_repository_password (username, password, repository, host_user_ptr) @@ -5232,18 +5344,72 @@ check_repository_password (username, password, repository, host_user_ptr) if (fclose (fp) < 0) error (0, errno, "cannot close %s", filename); - /* If found_it != 0, then linebuf contains the information we need. */ + /* If found_it, then linebuf contains the information we need. */ if (found_it) { char *found_password, *host_user_tmp; + char *non_cvsuser_portion; + + /* We need to make sure lines such as + * + * "username::sysuser\n" + * "username:\n" + * "username: \n" + * + * all result in a found_password of NULL, but we also need to + * make sure that + * + * "username: :sysuser\n" + * "username: <whatever>:sysuser\n" + * + * continues to result in an impossible password. That way, + * an admin would be on safe ground by going in and tacking a + * space onto the front of a password to disable the account + * (a technique some people use to close accounts + * temporarily). + */ + + /* Make `non_cvsuser_portion' contain everything after the CVS + username, but null out any final newline. */ + non_cvsuser_portion = linebuf + namelen; + strtok (non_cvsuser_portion, "\n"); + + /* If there's a colon now, we just want to inch past it. */ + if (strchr (non_cvsuser_portion, ':') == non_cvsuser_portion) + non_cvsuser_portion++; + + /* Okay, after this conditional chain, found_password and + host_user_tmp will have useful values: */ + + if ((non_cvsuser_portion == NULL) + || (strlen (non_cvsuser_portion) == 0) + || ((strspn (non_cvsuser_portion, " \t")) + == strlen (non_cvsuser_portion))) + { + found_password = NULL; + host_user_tmp = NULL; + } + else if (strncmp (non_cvsuser_portion, ":", 1) == 0) + { + found_password = NULL; + host_user_tmp = non_cvsuser_portion + 1; + if (strlen (host_user_tmp) == 0) + host_user_tmp = NULL; + } + else + { + found_password = strtok (non_cvsuser_portion, ":"); + host_user_tmp = strtok (NULL, ":"); + } - strtok (linebuf, ":"); - found_password = strtok (NULL, ": \n"); - host_user_tmp = strtok (NULL, ": \n"); + /* Of course, maybe there was no system user portion... */ if (host_user_tmp == NULL) host_user_tmp = username; - if (strcmp (found_password, crypt (password, found_password)) == 0) + /* Verify blank passwords directly, otherwise use crypt(). */ + if ((found_password == NULL) + || ((strcmp (found_password, crypt (password, found_password)) + == 0))) { /* Give host_user_ptr permanent storage. */ *host_user_ptr = xstrdup (host_user_tmp); @@ -5255,7 +5421,7 @@ check_repository_password (username, password, repository, host_user_ptr) retval = 2; } } - else + else /* Didn't find this user, so deny access. */ { *host_user_ptr = NULL; retval = 0; @@ -5338,14 +5504,14 @@ error 0 %s: no such user\n", username); /* user exists and has a password */ host_user = ((! strcmp (found_passwd, crypt (password, found_passwd))) - ? username : NULL); + ? xstrdup (username) : NULL); goto handle_return; } else if (password && *password) { /* user exists and has no system password, but we got one as parameter */ - host_user = username; + host_user = xstrdup (username); goto handle_return; } else @@ -5475,7 +5641,7 @@ pserver_authenticate_connection () #endif /* Make sure the protocol starts off on the right foot... */ - if (getline (&tmp, &tmp_allocated, stdin) < 0) + if (getline_safe (&tmp, &tmp_allocated, stdin, PATH_MAX) < 0) /* FIXME: what? We could try writing error/eof, but chances are the network connection is dead bidirectionally. log it somewhere? */ @@ -5506,9 +5672,9 @@ pserver_authenticate_connection () /* Get the three important pieces of information in order. */ /* See above comment about error handling. */ - getline (&repository, &repository_allocated, stdin); - getline (&username, &username_allocated, stdin); - getline (&password, &password_allocated, stdin); + getline_safe (&repository, &repository_allocated, stdin, PATH_MAX); + getline_safe (&username, &username_allocated, stdin, PATH_MAX); + getline_safe (&password, &password_allocated, stdin, PATH_MAX); /* Make them pure. */ strip_trailing_newlines (repository); @@ -5517,7 +5683,7 @@ pserver_authenticate_connection () /* ... and make sure the protocol ends on the right foot. */ /* See above comment about error handling. */ - getline (&tmp, &tmp_allocated, stdin); + getline_safe (&tmp, &tmp_allocated, stdin, PATH_MAX); if (strcmp (tmp, verify_and_exit ? "END VERIFICATION REQUEST\n" : "END AUTH REQUEST\n") @@ -5579,6 +5745,7 @@ pserver_authenticate_connection () /* Switch to run as this user. */ switch_to_user (host_user); + free (host_user); free (tmp); free (repository); free (username); diff --git a/gnu/usr.bin/cvs/src/update.c b/gnu/usr.bin/cvs/src/update.c index 17a2e82aed1..fc93e0da6a7 100644 --- a/gnu/usr.bin/cvs/src/update.c +++ b/gnu/usr.bin/cvs/src/update.c @@ -94,6 +94,7 @@ static char *tag_update_dir; static char *join_rev1, *date_rev1; static char *join_rev2, *date_rev2; static int aflag = 0; +static int toss_local_changes = 0; static int force_tag_match = 1; static int update_build_dirs = 0; static int update_prune_dirs = 0; @@ -110,6 +111,7 @@ static const char *const update_usage[] = " [-I ign] [-W spec] [files...]\n", "\t-A\tReset any sticky tags/date/kopts.\n", "\t-P\tPrune empty directories.\n", + "\t-C\tOverwrite locally modified files with clean repository copies.\n", "\t-d\tBuild directories, like checkout does.\n", "\t-f\tForce a head revision match if tag/date not found.\n", "\t-l\tLocal directory only, no recursion.\n", @@ -145,13 +147,16 @@ update (argc, argv) /* parse the args */ optind = 0; - while ((c = getopt (argc, argv, "+ApPflRQqduk:r:D:j:I:W:")) != -1) + while ((c = getopt (argc, argv, "+ApCPflRQqduk:r:D:j:I:W:")) != -1) { switch (c) { case 'A': aflag = 1; break; + case 'C': + toss_local_changes = 1; + break; case 'I': ign_add (optarg, 0); break; @@ -252,6 +257,8 @@ update (argc, argv) send_arg("-f"); if (aflag) send_arg("-A"); + if (toss_local_changes) + send_arg("-C"); if (update_prune_dirs) send_arg("-P"); client_prune_dirs = update_prune_dirs; @@ -266,28 +273,35 @@ update (argc, argv) option_with_arg ("-j", join_rev2); wrap_send (); - /* If the server supports the command "update-patches", that means - that it knows how to handle the -u argument to update, which - means to send patches instead of complete files. - - We don't send -u if failed_patches != NULL, so that the - server doesn't try to send patches which will just fail - again. At least currently, the client also clobbers the - file and tells the server it is lost, which also will get - a full file instead of a patch, but it seems clean to omit - -u. */ - if (failed_patches == NULL) + if (failed_patches_count == 0) { + unsigned int flags = 0; + + /* If the server supports the command "update-patches", that + means that it knows how to handle the -u argument to update, + which means to send patches instead of complete files. + + We don't send -u if failed_patches != NULL, so that the + server doesn't try to send patches which will just fail + again. At least currently, the client also clobbers the + file and tells the server it is lost, which also will get + a full file instead of a patch, but it seems clean to omit + -u. */ if (supported_request ("update-patches")) send_arg ("-u"); - } - if (failed_patches == NULL) - { + if (update_build_dirs) + flags |= SEND_BUILD_DIRS; + + if (toss_local_changes) { + flags |= SEND_NO_CONTENTS; + flags |= BACKUP_MODIFIED_FILES; + } + /* If noexec, probably could be setting SEND_NO_CONTENTS. Same caveats as for "cvs status" apply. */ - send_files (argc, argv, local, aflag, - update_build_dirs ? SEND_BUILD_DIRS : 0); + + send_files (argc, argv, local, aflag, flags); send_file_names (argc, argv, SEND_EXPAND_WILD); } else @@ -311,11 +325,9 @@ update (argc, argv) send_files (failed_patches_count, failed_patches, local, aflag, update_build_dirs ? SEND_BUILD_DIRS : 0); send_file_names (failed_patches_count, failed_patches, 0); + free_names (&failed_patches_count, failed_patches); } - failed_patches = NULL; - failed_patches_count = 0; - send_to_server ("update\012", 0); status = get_responses_and_close (); @@ -334,13 +346,15 @@ update (argc, argv) conflict-and-patch-failed case. */ if (status != 0 - && (failed_patches == NULL || pass > 1)) + && (failed_patches_count == 0 || pass > 1)) { + if (failed_patches_count > 0) + free_names (&failed_patches_count, failed_patches); return status; } ++pass; - } while (failed_patches != NULL); + } while (failed_patches_count > 0); return 0; } @@ -366,15 +380,20 @@ update (argc, argv) error (1, errno, "cannot remove file %s", CVSADM_ENTSTAT); #ifdef SERVER_SUPPORT if (server_active) - server_clear_entstat (".", Name_Repository (NULL, NULL)); + { + char *repos = Name_Repository (NULL, NULL); + server_clear_entstat (".", repos); + free (repos); + } #endif } /* keep the CVS/Tag file current with the specified arguments */ if (aflag || tag || date) { - WriteTag ((char *) NULL, tag, date, 0, - ".", Name_Repository (NULL, NULL)); + char *repos = Name_Repository (NULL, NULL); + WriteTag ((char *) NULL, tag, date, 0, ".", repos); + free (repos); rewrite_tag = 1; nonbranch = 0; } @@ -484,17 +503,11 @@ do_update (argc, argv, xoptions, xtag, xdate, xforce, local, xbuild, xaflag, argc, argv, local, which, aflag, 1, preload_update_dir, 1); - /* see if we need to sleep before returning */ + /* see if we need to sleep before returning to avoid time-stamp races */ if (last_register_time) { - time_t now; - - for (;;) - { - (void) time (&now); - if (now != last_register_time) break; - sleep (1); /* to avoid time-stamp races */ - } + while (time ((time_t *) NULL) == last_register_time) + sleep (1); } return (err); @@ -641,54 +654,82 @@ update_fileproc (callerdat, finfo) break; case T_MODIFIED: /* locally modified */ retval = 0; - if (vers->ts_conflict) - { - char *filestamp; - int retcode; + if (toss_local_changes) + { + char *bakname; + bakname = backup_file (finfo->file, vers->vn_user); + /* This behavior is sufficiently unexpected to + justify overinformativeness, I think. */ +#ifdef SERVER_SUPPORT + if ((! really_quiet) && (! server_active)) +#else /* ! SERVER_SUPPORT */ + if (! really_quiet) +#endif /* SERVER_SUPPORT */ + (void) printf ("(Locally modified %s moved to %s)\n", + finfo->file, bakname); + free (bakname); + + /* The locally modified file is still present, but + it will be overwritten by the repository copy + after this. */ + status = T_CHECKOUT; + retval = checkout_file (finfo, vers, 0, 0, 1); + } + else + { + if (vers->ts_conflict) + { + char *filestamp; + int retcode; + + /* + * If the timestamp has changed and no + * conflict indicators are found, it isn't a + * 'C' any more. + */ - /* - * If the timestamp has changed and no conflict indicators - * are found, it isn't a 'C' any more. - */ #ifdef SERVER_SUPPORT - if (server_active) - retcode = vers->ts_conflict[0] != '='; - else { - filestamp = time_stamp (finfo->file); - retcode = strcmp (vers->ts_conflict, filestamp); - free (filestamp); - } + if (server_active) + retcode = vers->ts_conflict[0] != '='; + else + { + filestamp = time_stamp (finfo->file); + retcode = strcmp (vers->ts_conflict, filestamp); + free (filestamp); + } #else - filestamp = time_stamp (finfo->file); - retcode = strcmp (vers->ts_conflict, filestamp); - free (filestamp); + filestamp = time_stamp (finfo->file); + retcode = strcmp (vers->ts_conflict, filestamp); + free (filestamp); #endif - if (retcode) - { - /* The timestamps differ. But if there are conflict - markers print 'C' anyway. */ - retcode = !file_has_markers (finfo); - } - - if (!retcode) - { - write_letter (finfo, 'C'); - retval = 1; - } - else - { - /* Reregister to clear conflict flag. */ - Register (finfo->entries, finfo->file, vers->vn_rcs, vers->ts_rcs, - vers->options, vers->tag, - vers->date, (char *)0); - } - } - if (!retval) - { - write_letter (finfo, 'M'); - retval = 0; - } + if (retcode) + { + /* The timestamps differ. But if there + are conflict markers print 'C' anyway. */ + retcode = !file_has_markers (finfo); + } + + if (!retcode) + { + write_letter (finfo, 'C'); + retval = 1; + } + else + { + /* Reregister to clear conflict flag. */ + Register (finfo->entries, finfo->file, + vers->vn_rcs, vers->ts_rcs, + vers->options, vers->tag, + vers->date, (char *)0); + } + } + if (!retval) + { + write_letter (finfo, 'M'); + retval = 0; + } + } break; #ifdef SERVER_SUPPORT case T_PATCH: /* needs patch */ @@ -928,7 +969,8 @@ update_dirent_proc (callerdat, dir, repository, update_dir, entries) /* This is a guess. We will rewrite it later via WriteTag. */ 0, - 0); + 0, + 1); rewrite_tag = 1; nonbranch = 0; Subdir_Register (entries, (char *) NULL, dir); @@ -1014,6 +1056,10 @@ update_dirleave_proc (callerdat, dir, err, update_dir, entries) { FILE *fp; + /* Delete the ignore list if it hasn't already been done. */ + if (ignlist) + dellist (&ignlist); + /* If we set the tag or date for a new subdirectory in update_dirent_proc, and we're now done with that subdirectory, undo the tag/date setting. Note that we know that the tag and @@ -1059,6 +1105,7 @@ update_dirleave_proc (callerdat, dir, err, update_dir, entries) cvs_output (": Executing '", 0); run_print (stdout); cvs_output ("'\n", 0); + cvs_flushout (); (void) run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL); } else if (ferror (fp)) @@ -2063,7 +2110,7 @@ join_file (finfo, vers) Vers_TS *vers; { char *backup; - char *options; + char *t_options; int status; char *rev1; @@ -2298,6 +2345,13 @@ join_file (finfo, vers) xvers = Version_TS (finfo, vers->options, jrev2, jdate2, 1, 0); + /* Reset any keyword expansion option. Otherwise, when a + command like `cvs update -kk -jT1 -jT2' creates a new file + (because a file had the T2 tag, but not T1), the subsequent + commit of that just-added file effectively would set the + admin `-kk' option for that file in the repository. */ + options = NULL; + /* FIXME: If checkout_file fails, we should arrange to return a non-zero exit status. */ status = checkout_file (finfo, xvers, 1, 0, 1); @@ -2340,11 +2394,11 @@ join_file (finfo, vers) if (jdate2 != NULL) error (0, 0, - "file %s is present in revision %s as of %s", + "file %s does not exist, but is present in revision %s as of %s", finfo->fullname, jrev2, jdate2); else error (0, 0, - "file %s is present in revision %s", + "file %s does not exist, but is present in revision %s", finfo->fullname, jrev2); /* FIXME: Should we arrange to return a non-zero exit status? */ @@ -2386,10 +2440,10 @@ join_file (finfo, vers) copy_file (finfo->file, backup); xchmod (finfo->file, 1); - options = vers->options; + t_options = vers->options; #if 0 - if (*options == '\0') - options = "-kk"; /* to ignore keyword expansions */ + if (*t_options == '\0') + t_options = "-kk"; /* to ignore keyword expansions */ #endif /* If the source of the merge is the same as the working file @@ -2407,12 +2461,12 @@ join_file (finfo, vers) /* This is because of the worry below about $Name. If that isn't a problem, I suspect this code probably works for text files too. */ - && (strcmp (options, "-kb") == 0 + && (strcmp (t_options, "-kb") == 0 || wrap_merge_is_copy (finfo->file))) { /* FIXME: what about nametag? What does RCS_merge do with $Name? */ - if (RCS_checkout (finfo->rcs, finfo->file, rev2, NULL, options, + if (RCS_checkout (finfo->rcs, finfo->file, rev2, NULL, t_options, RUN_TTY, (RCSCHECKOUTPROC)0, NULL) != 0) status = 2; else @@ -2436,7 +2490,7 @@ join_file (finfo, vers) print. */ write_letter (finfo, 'U'); } - else if (strcmp (options, "-kb") == 0 + else if (strcmp (t_options, "-kb") == 0 || wrap_merge_is_copy (finfo->file) || special_file_mismatch (finfo, rev1, rev2)) { @@ -2446,7 +2500,7 @@ join_file (finfo, vers) the two files, and let them resolve it. It is possible that we should require a "touch foo" or similar step before we allow a checkin. */ - if (RCS_checkout (finfo->rcs, finfo->file, rev2, NULL, options, + if (RCS_checkout (finfo->rcs, finfo->file, rev2, NULL, t_options, RUN_TTY, (RCSCHECKOUTPROC)0, NULL) != 0) status = 2; else @@ -2477,7 +2531,7 @@ join_file (finfo, vers) } else status = RCS_merge (finfo->rcs, vers->srcfile->path, finfo->file, - options, rev1, rev2); + t_options, rev1, rev2); if (status != 0 && status != 1) { @@ -2508,9 +2562,9 @@ join_file (finfo, vers) (void) time (&last_register_time); cp = time_stamp (finfo->file); } - Register (finfo->entries, finfo->file, vers->vn_rcs, - "Result of merge", vers->options, vers->tag, - vers->date, cp); + Register (finfo->entries, finfo->file, + vers->vn_rcs ? vers->vn_rcs : "0", "Result of merge", + vers->options, vers->tag, vers->date, cp); if (cp) free(cp); } @@ -2558,8 +2612,8 @@ special_file_mismatch (finfo, rev1, rev2) dev_t rev1_dev, rev2_dev; char *rev1_symlink = NULL; char *rev2_symlink = NULL; - List *rev1_hardlinks; - List *rev2_hardlinks; + List *rev1_hardlinks = NULL; + List *rev2_hardlinks = NULL; int check_uids, check_gids, check_modes; int result; @@ -2588,6 +2642,7 @@ special_file_mismatch (finfo, rev1, rev2) rev1_symlink = xreadlink (finfo->file); else { +#ifdef HAVE_ST_RDEV if (CVS_LSTAT (finfo->file, &sb) < 0) error (1, errno, "could not get file information for %s", finfo->file); @@ -2596,6 +2651,10 @@ special_file_mismatch (finfo, rev1, rev2) rev1_mode = sb.st_mode; if (S_ISBLK (rev1_mode) || S_ISCHR (rev1_mode)) rev1_dev = sb.st_rdev; +#else + error (1, 0, "cannot handle device files on this system (%s)", + finfo->file); +#endif } rev1_hardlinks = list_linked_files_on_disk (finfo->file); } @@ -2661,6 +2720,7 @@ special_file_mismatch (finfo, rev1, rev2) rev2_symlink = xreadlink (finfo->file); else { +#ifdef HAVE_ST_RDEV if (CVS_LSTAT (finfo->file, &sb) < 0) error (1, errno, "could not get file information for %s", finfo->file); @@ -2669,6 +2729,10 @@ special_file_mismatch (finfo, rev1, rev2) rev2_mode = sb.st_mode; if (S_ISBLK (rev2_mode) || S_ISCHR (rev2_mode)) rev2_dev = sb.st_rdev; +#else + error (1, 0, "cannot handle device files on this system (%s)", + finfo->file); +#endif } rev2_hardlinks = list_linked_files_on_disk (finfo->file); } |