diff -Nru ncftp-3.2.5/autoconf_local/acconfig.h ncftp-3.2.6/autoconf_local/acconfig.h --- ncftp-3.2.5/autoconf_local/acconfig.h 2009-08-17 19:11:40.000000000 +0000 +++ ncftp-3.2.6/autoconf_local/acconfig.h 2016-11-13 02:17:24.000000000 +0000 @@ -258,6 +258,9 @@ /* Define to `int' if doesn't define. */ #undef mode_t +/* Define this because you definitely don't have it. Used only for testing configure. */ +#undef negative_control_t + /* Define if you don't have , but have . */ #undef NDIR @@ -335,6 +338,8 @@ /* Format string for the scanf() family for 64 bit integers. */ #undef SCANF_LONG_LONG +#undef sa_family_t + /* Define if scanning a "long long" with "%lld" works. */ #undef SCANF_LONG_LONG_LLD @@ -405,6 +410,9 @@ #undef SPRINTF_RETURNS_PTR +/* Define to `long' if doesn't define. */ +#undef ssize_t + /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. diff -Nru ncftp-3.2.5/autoconf_local/aclocal.m4 ncftp-3.2.6/autoconf_local/aclocal.m4 --- ncftp-3.2.5/autoconf_local/aclocal.m4 2011-02-02 23:17:12.000000000 +0000 +++ ncftp-3.2.6/autoconf_local/aclocal.m4 2016-12-04 18:54:01.000000000 +0000 @@ -272,10 +272,11 @@ dnl AC_DEFUN(wi_EXTRA_IDIR, [ incdir="$1" -if test -r $incdir ; then +echo "wi_extra_idir $incdir" 1>&5 +if test -r "$incdir" ; then case "$CPPFLAGS" in *${incdir}*) - # echo " + already had $incdir" 1>&6 + echo " + already had $incdir" 1>&5 ;; *) if test "$CPPFLAGS" = "" ; then @@ -283,7 +284,7 @@ else CPPFLAGS="$CPPFLAGS -I$incdir" fi - echo " + found $incdir" 1>&6 + echo " + found $incdir" 1>&5 ;; esac fi @@ -294,10 +295,11 @@ dnl AC_DEFUN(wi_EXTRA_LDIR, [ libdir="$1" -if test -r $libdir ; then +echo "wi_extra_ldir $libdir" 1>&5 +if test -r "$libdir" ; then case "$LDFLAGS" in *${libdir}*) - # echo " + already had $libdir" 1>&6 + echo " + already had $libdir" 1>&5 ;; *) if test "$LDFLAGS" = "" ; then @@ -305,7 +307,7 @@ else LDFLAGS="$LDFLAGS -L$libdir" fi - echo " + found $libdir" 1>&6 + echo " + found $libdir" 1>&5 ;; esac fi @@ -679,8 +681,28 @@ ;; esac +CC_is_clang="no" +case "$CC" in + *clang*) + CC_is_clang="yes" + ;; + *) + cc_dash_v=`${CC-gcc} -v 2>&1 | grep clang 2>/dev/null` + if test -n "$cc_dash_v" ; then + CC_is_clang="yes" + fi + ;; +esac + if test "$wi_os_default_cflags" = yes ; then - if test "$GCC" = yes ; then + if test "$CC_is_clang" = yes ; then + wi_os_default_cflags="-Weverything -Wno-unknown-warning-option -Wno-disabled-macro-expansion -Wno-missing-variable-declarations -Wno-date-time" + if test "$wi_replace_O_with_g" = yes ; then + wi_os_default_cflags="-g $wi_os_default_cflags" + else + wi_os_default_cflags="-O2 $wi_os_default_cflags" + fi + elif test "$GCC" = yes ; then # # gcc # @@ -689,7 +711,7 @@ 2.7.*|2.8.*|2.9*) wi_os_default_cflags="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wbad-function-cast -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-declarations -Winline" ;; - 3.*) + [345].*) wi_os_default_cflags="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wbad-function-cast -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-declarations -Winline -Wmissing-format-attribute -Wformat-security" wi_gcc_optimizer_flags='-Wdisabled-optimization' ;; @@ -1106,11 +1128,65 @@ dnl dnl dnl +AC_DEFUN(wi_OS_SPECIFIC_CFLAGS, [ + case "$OS" in + "solaris"*"-x86_64") + if test "$GCC" = "yes" ; then + case "$CFLAGS" in + *"-m64"*) + ;; + *) + CFLAGS="-m64 $CFLAGS" + ;; + esac + fi + ;; + esac +]) +dnl +dnl +dnl +AC_DEFUN(wi_PROG_CC, [ + if test "x$had_CC" = "x" ; then + AC_MSG_CHECKING([for CC environment variable]) + AC_MSG_RESULT(["${CC-no}"]) + fi + + AC_MSG_CHECKING([for clang C compiler]) + CLANG_CC=`which "clang" 2>/dev/null` + old_CC="$CC" + CC="$CLANG_CC" + AC_TRY_COMPILE([#include ],[extern void exit(int status);],[ + AC_MSG_RESULT(["$CLANG_CC"]) + ],[ + AC_MSG_RESULT(["no"]) + unset CLANG_CC + ]) + CC="$old_CC"; unset old_CC + + AC_MSG_CHECKING([if CC should now be set]) + if test "x$CC" = "x" ; then + if test "x$CLANG_CC" != "x" ; then + CC="$CLANG_CC" + export CC + AC_MSG_RESULT(["$CC"]) + else + AC_MSG_RESULT([no]) + fi + else + AC_MSG_RESULT([no]) + fi + AC_PROG_CC +]) +dnl +dnl +dnl AC_DEFUN(wi_CFLAGS, [AC_REQUIRE([AC_PROG_CC]) wi_PROG_GCC_VERSION AC_REQUIRE_CPP() wi_PROG_SUN_WORKSHOP_CC_VERSION wi_OS_DEFAULT_CFLAGS + wi_OS_SPECIFIC_CFLAGS wi_CFLAGS_NO_Y2K_WARNINGS wi_PROG_LDD if test "$use_ssp" = yes ;then @@ -1203,9 +1279,11 @@ AC_DEFUN(wi_ENV_VAR_MESSAGES, [ AC_MSG_CHECKING([if you set and exported the environment variable CC]) if test "x$CC" = x ; then - AC_MSG_RESULT([no (you may want to do that since configure scripts look for gcc first)]) + AC_MSG_RESULT([no (configure will try to locate a suitable C compiler)]) + had_CC="no" else AC_MSG_RESULT($CC) + had_CC="yes" fi AC_MSG_CHECKING([for environment variable CFLAGS]) if test "x$CFLAGS" = x ; then @@ -1300,6 +1378,9 @@ if test "x$ac_cv_sizeof_off_t" = x ; then wi_SIZEOF_OFF_T fi +if test "x$ac_cv_sizeof_size_t" = x ; then + wi_SIZEOF_SIZE_T +fi orig_CFLAGS="$CFLAGS" if test "$ac_cv_sizeof_stat_st_size" -le 4 || test "$ac_cv_sizeof_off_t" -le 4 ; then unset ac_cv_sizeof_stat_st_size ac_cv_sizeof_off_t @@ -1321,6 +1402,7 @@ # Recheck, to see if the defines took effect. wi_SIZEOF_ST_SIZE wi_SIZEOF_OFF_T + wi_SIZEOF_SIZE_T if test "$ac_cv_sizeof_stat_st_size" -le 4 || test "$ac_cv_sizeof_off_t" -le 4 ; then CFLAGS="$orig_CFLAGS" unset orig_CFLAGS @@ -2384,6 +2466,69 @@ dnl dnl dnl +AC_DEFUN(wi_SIZEOF_SIZE_T, [ +AC_MSG_CHECKING(size of size_t) +wi_PREREQ_UNISTD_H([$0]) +AC_TRY_RUN([ + /* program */ +#if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__) +# define _ALL_SOURCE 1 +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#include +#include +#include +#include + +main() +{ + size_t x = 0; + FILE *fp; + + fp = fopen("conftest.out", "w"); + if (fp != NULL) { + fprintf(fp, "%u\n", (unsigned int) sizeof(x)); + fclose(fp); + exit(0); /* OK */ + } + exit(1); /* Not OK */ +} +],[ + # action if true + x=`cat conftest.out` + case "$x" in +changequote(<<, >>)dnl + [0-9]*) +changequote([, ])dnl + dnl Do not define here... we may redefine it when we re-run this macro. + dnl Manually AC_DEFINE_UNQUOTED when you are finished with this macro. + dnl AC_DEFINE_UNQUOTED(SIZEOF_SIZE_T, $x) + ac_cv_sizeof_size_t="$x" + ;; + *) + x="failed" + ac_cv_sizeof_size_t="4" + ;; + esac + rm -f conftest.out +],[ + # action if false + x="failed" + ac_cv_sizeof_size_t="4" + rm -f conftest.out +],[ + # action if cross compiling + x="unknown" + ac_cv_sizeof_size_t="4" + rm -f conftest.out +]) +AC_MSG_RESULT($x) +]) +dnl +dnl +dnl AC_DEFUN(wi_SIZEOF_OFF_T, [ AC_MSG_CHECKING(size of off_t) wi_PREREQ_UNISTD_H([$0]) @@ -4033,6 +4178,33 @@ dnl dnl dnl +dnl wi_CHECK_TYPE(TYPE, DEFAULT, INCLUDES) +AC_DEFUN(wi_CHECK_TYPE, +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(ac_cv_type_$1, +[AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl +changequote([,]), [ +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#if STDC_HEADERS +#include +#include +#endif +$3], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl +AC_MSG_RESULT($ac_cv_type_$1) +if test $ac_cv_type_$1 = no; then + AC_DEFINE($1, $2) +fi +]) +dnl +dnl +dnl +dnl AC_DEFUN(wi_UNISTD_FUNC_PARAM_TYPES, [ AC_REQUIRE([AC_PROG_CPP]) AC_REQUIRE([wi_PATH_PERL]) @@ -4413,7 +4585,7 @@ #define TEXT_BLOCK_SIZE 8192 #define INDENT 2 -#define TERMS "vt100:vt102:vt220:vt320:xterm:xterm-color:ansi:linux:scoterm:scoansi:dtterm:cons25:cygwin:screen" +#define TERMS "vt100:vt102:vt220:vt320:xterm:xterm-color:xterm-256color:ansi:linux:scoterm:scoansi:dtterm:cons25:cygwin:screen" size_t gNBufUsed = 0, gNBufAllocated = 0; char *gBuf = NULL; @@ -5467,15 +5639,17 @@ wi_CFLAGS_TO_ADD_LATER="" changequote(!@, @!)dnl if [ -x "$HOME/bin/OS" ] ; then - HOME_OS=`$HOME/bin/OS` + HOME_OS=`$HOME/bin/OS 2>/dev/null` HOME_OS="$HOME/$HOME_OS" +else + HOME_OS="$HOME" fi host=`uname -n 2>/dev/null | tr '[A-Z]' '[a-z]'` os=`uname -s 2>/dev/null | tr '[A-Z]' '[a-z]'` if [ "$os" = "TvoPT" ] ; then os="sunos" ; fi dnl work around inability to use $1 -os_v=`uname -v 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.].*$//;' | awk '-F[-/: ]' '{n = 1; print $n; }'` -os_r=`uname -r 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.].*$//;' | awk '-F[-/: ]' '{n = 1; print $n; }'` +os_v=`uname -v 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.].*$//;'` +os_r=`uname -r 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.].*$//;'` os_r1=`echo "${os_r}" | cut -c1` arch=`uname -m 2>/dev/null | tr '[A-Z]' '[a-z]'` archp=`uname -p 2>/dev/null | tr '[A-Z]' '[a-z]'` @@ -5623,6 +5797,7 @@ esac libc="" + [ -z "$os_r" ] && os_r="2.2.26" os_r1=`echo "$os_r" | cut -d. -f1` os_r2=`echo "$os_r" | cut -d. -f2` os_r3=`echo "$os_r" | cut -d- -f1 | cut -d. -f3` @@ -5680,22 +5855,22 @@ if test "$glibc_r1" = "" ; then glibc_r1=0 ; fi if test "$glibc_r2" = "" ; then glibc_r2=0 ; fi if test "$glibc_r3" = "" ; then glibc_r3=0 ; fi - glibc_int=`expr "$glibc_r1" '*' 10000 + "$glibc_r2" '*' 1000 + "$glibc_r3"` + glibc_int=`expr "$glibc_r1" '*' 10000 + "$glibc_r2" '*' 100 + "$glibc_r3"` NDEFS="$NDEFS -DLINUX_GLIBC=$glibc_int" libc="glibc${glibc_r1}.${glibc_r2}" OS="linux-$arch" ;; *) if test -f /lib/libc-2.1.3.so ; then - NDEFS="$NDEFS -DLINUX_GLIBC=21003" + NDEFS="$NDEFS -DLINUX_GLIBC=20103" libc="glibc2.1" OS="linux-$arch" elif test -f /lib/libc-2.1.2.so ; then - NDEFS="$NDEFS -DLINUX_GLIBC=21002" + NDEFS="$NDEFS -DLINUX_GLIBC=20102" libc="glibc2.1" OS="linux-$arch" elif test -f /lib/libc-2.1.1.so ; then - NDEFS="$NDEFS -DLINUX_GLIBC=21001" + NDEFS="$NDEFS -DLINUX_GLIBC=20101" libc="glibc2.1" OS="linux-$arch" elif test -f /lib/libc.so.6 ; then @@ -5905,6 +6080,9 @@ fi wi_cv_OS="$OS" +if test "x$HOME_OS" = "x" && test "x$OS" != "x" ; then + HOME_OS="$HOME/$OS" +fi AC_SUBST(NDEFS) AC_SUBST(OS) AC_SUBST(host) diff -Nru ncftp-3.2.5/config.h.in ncftp-3.2.6/config.h.in --- ncftp-3.2.5/config.h.in 2009-10-23 23:37:29.000000000 +0000 +++ ncftp-3.2.6/config.h.in 2016-11-13 02:19:27.000000000 +0000 @@ -93,6 +93,9 @@ /* Define to `int' if doesn't define. */ #undef mode_t +/* Define this because you definitely don't have it. Used only for testing configure. */ +#undef negative_control_t + /* Define if optind, optarg, etc., need to be declared as extern. */ #undef NEED_GETOPT_EXTERN_DECLS @@ -133,6 +136,8 @@ /* Format string for the scanf() family for 64 bit integers. */ #undef SCANF_LONG_LONG +#undef sa_family_t + /* Define if scanning a "long long" with "%lld" works. */ #undef SCANF_LONG_LONG_LLD @@ -193,6 +198,9 @@ #undef sockopt_size_t +/* Define to `long' if doesn't define. */ +#undef ssize_t + /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. @@ -355,9 +363,21 @@ /* Define if you have the readlink function. */ #undef HAVE_READLINK +/* Define if you have the recvfile function. */ +#undef HAVE_RECVFILE + /* Define if you have the res_init function. */ #undef HAVE_RES_INIT +/* Define if you have the sendfile function. */ +#undef HAVE_SENDFILE + +/* Define if you have the sendfilev function. */ +#undef HAVE_SENDFILEV + +/* Define if you have the sendfilev64 function. */ +#undef HAVE_SENDFILEV64 + /* Define if you have the setlocale function. */ #undef HAVE_SETLOCALE @@ -484,6 +504,9 @@ /* Define if you have the header file. */ #undef HAVE_SYS_IOCTL_H +/* Define if you have the header file. */ +#undef HAVE_SYS_SENDFILE_H + /* Define if you have the header file. */ #undef HAVE_SYS_SOCKET_H @@ -526,6 +549,9 @@ /* Define if you have the 44bsd library (-l44bsd). */ #undef HAVE_LIB44BSD +/* Define if you have the dl library (-ldl). */ +#undef HAVE_LIBDL + /* Define if you have the gen library (-lgen). */ #undef HAVE_LIBGEN @@ -538,6 +564,9 @@ /* Define if you have the resolv library (-lresolv). */ #undef HAVE_LIBRESOLV +/* Define if you have the sendfile library (-lsendfile). */ +#undef HAVE_LIBSENDFILE + /* Define if you have the snprintf library (-lsnprintf). */ #undef HAVE_LIBSNPRINTF diff -Nru ncftp-3.2.5/configure ncftp-3.2.6/configure --- ncftp-3.2.5/configure 2011-02-02 23:17:19.000000000 +0000 +++ ncftp-3.2.6/configure 2016-12-04 18:54:11.000000000 +0000 @@ -638,42 +638,319 @@ echo $ac_n "checking if you set and exported the environment variable CC""... $ac_c" 1>&6 echo "configure:640: checking if you set and exported the environment variable CC" >&5 if test "x$CC" = x ; then - echo "$ac_t""no (you may want to do that since configure scripts look for gcc first)" 1>&6 + echo "$ac_t""no (configure will try to locate a suitable C compiler)" 1>&6 + had_CC="no" else echo "$ac_t""$CC" 1>&6 + had_CC="yes" fi echo $ac_n "checking for environment variable CFLAGS""... $ac_c" 1>&6 -echo "configure:647: checking for environment variable CFLAGS" >&5 +echo "configure:649: checking for environment variable CFLAGS" >&5 if test "x$CFLAGS" = x ; then echo "$ac_t""no (we will choose a default set for you)" 1>&6 else echo "$ac_t""$CFLAGS" 1>&6 fi echo $ac_n "checking for environment variable CPPFLAGS""... $ac_c" 1>&6 -echo "configure:654: checking for environment variable CPPFLAGS" >&5 +echo "configure:656: checking for environment variable CPPFLAGS" >&5 echo "$ac_t""${CPPFLAGS-no}" 1>&6 echo $ac_n "checking for environment variable LDFLAGS""... $ac_c" 1>&6 -echo "configure:657: checking for environment variable LDFLAGS" >&5 +echo "configure:659: checking for environment variable LDFLAGS" >&5 echo "$ac_t""${LDFLAGS-no}" 1>&6 echo $ac_n "checking for environment variable LIBS""... $ac_c" 1>&6 -echo "configure:660: checking for environment variable LIBS" >&5 +echo "configure:662: checking for environment variable LIBS" >&5 echo "$ac_t""${LIBS-no}" 1>&6 + if test "x$had_CC" = "x" ; then + echo $ac_n "checking for CC environment variable""... $ac_c" 1>&6 +echo "configure:668: checking for CC environment variable" >&5 + echo "$ac_t"""${CC-no}"" 1>&6 + fi + + echo $ac_n "checking for clang C compiler""... $ac_c" 1>&6 +echo "configure:673: checking for clang C compiler" >&5 + CLANG_CC=`which "clang" 2>/dev/null` + old_CC="$CC" + CC="$CLANG_CC" + cat > conftest.$ac_ext < +int main() { +extern void exit(int status); +; return 0; } +EOF +if { (eval echo configure:685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + echo "$ac_t"""$CLANG_CC"" 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + echo "$ac_t"""no"" 1>&6 + unset CLANG_CC + +fi +rm -rf conftest* + CC="$old_CC"; unset old_CC + + echo $ac_n "checking if CC should now be set""... $ac_c" 1>&6 +echo "configure:703: checking if CC should now be set" >&5 + if test "x$CC" = "x" ; then + if test "x$CLANG_CC" != "x" ; then + CC="$CLANG_CC" + export CC + echo "$ac_t"""$CC"" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + else + echo "$ac_t""no" 1>&6 + fi + # 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:718: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:748: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:799: 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:831: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 842 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:873: 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:878: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:906: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -rf conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + + + # # Take note if the user is or is not exporting a CFLAGS env var. # wi_orig_CFLAGS="$CFLAGS" wi_CFLAGS_TO_ADD_LATER="" if [ -x "$HOME/bin/OS" ] ; then - HOME_OS=`$HOME/bin/OS` + HOME_OS=`$HOME/bin/OS 2>/dev/null` HOME_OS="$HOME/$HOME_OS" +else + HOME_OS="$HOME" fi host=`uname -n 2>/dev/null | tr '[A-Z]' '[a-z]'` os=`uname -s 2>/dev/null | tr '[A-Z]' '[a-z]'` if [ "$os" = "TvoPT" ] ; then os="sunos" ; fi -os_v=`uname -v 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.].*$//;' | awk '-F[-/: ]' '{n = 1; print $n; }'` -os_r=`uname -r 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.].*$//;' | awk '-F[-/: ]' '{n = 1; print $n; }'` +os_v=`uname -v 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.].*$//;'` +os_r=`uname -r 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.].*$//;'` os_r1=`echo "${os_r}" | cut -c1` arch=`uname -m 2>/dev/null | tr '[A-Z]' '[a-z]'` archp=`uname -p 2>/dev/null | tr '[A-Z]' '[a-z]'` @@ -821,6 +1098,7 @@ esac libc="" + [ -z "$os_r" ] && os_r="2.2.26" os_r1=`echo "$os_r" | cut -d. -f1` os_r2=`echo "$os_r" | cut -d. -f2` os_r3=`echo "$os_r" | cut -d- -f1 | cut -d. -f3` @@ -878,22 +1156,22 @@ if test "$glibc_r1" = "" ; then glibc_r1=0 ; fi if test "$glibc_r2" = "" ; then glibc_r2=0 ; fi if test "$glibc_r3" = "" ; then glibc_r3=0 ; fi - glibc_int=`expr "$glibc_r1" '*' 10000 + "$glibc_r2" '*' 1000 + "$glibc_r3"` + glibc_int=`expr "$glibc_r1" '*' 10000 + "$glibc_r2" '*' 100 + "$glibc_r3"` NDEFS="$NDEFS -DLINUX_GLIBC=$glibc_int" libc="glibc${glibc_r1}.${glibc_r2}" OS="linux-$arch" ;; *) if test -f /lib/libc-2.1.3.so ; then - NDEFS="$NDEFS -DLINUX_GLIBC=21003" + NDEFS="$NDEFS -DLINUX_GLIBC=20103" libc="glibc2.1" OS="linux-$arch" elif test -f /lib/libc-2.1.2.so ; then - NDEFS="$NDEFS -DLINUX_GLIBC=21002" + NDEFS="$NDEFS -DLINUX_GLIBC=20102" libc="glibc2.1" OS="linux-$arch" elif test -f /lib/libc-2.1.1.so ; then - NDEFS="$NDEFS -DLINUX_GLIBC=21001" + NDEFS="$NDEFS -DLINUX_GLIBC=20101" libc="glibc2.1" OS="linux-$arch" elif test -f /lib/libc.so.6 ; then @@ -1103,267 +1381,48 @@ fi wi_cv_OS="$OS" - - - - - -echo $ac_n "checking platform""... $ac_c" 1>&6 -echo "configure:1113: checking platform" >&5 -echo "$ac_t"""$OS"" 1>&6 - - -case "$os" in - linux) - OS="linux-$arch-$libc" - ;; -esac - -if test -f sh/install-sh ; then chmod 755 sh/*.sh sh/config.* sh/install-sh ; fi -ac_aux_dir= -for ac_dir in sh $srcdir/sh; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in sh $srcdir/sh" 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - -# 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:1146: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1176: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1227: 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:1259: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 1270 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:1275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1301: 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:1306: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1334: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -rf conftest* - +if test "x$HOME_OS" = "x" && test "x$OS" != "x" ; then + HOME_OS="$HOME/$OS" fi -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= + + + + +echo $ac_n "checking platform""... $ac_c" 1>&6 +echo "configure:1394: checking platform" >&5 +echo "$ac_t"""$OS"" 1>&6 + + +case "$os" in + linux) + OS="linux-$arch-$libc" + ;; +esac + +if test -f sh/install-sh ; then chmod 755 sh/*.sh sh/config.* sh/install-sh ; fi +ac_aux_dir= +for ac_dir in sh $srcdir/sh; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in sh $srcdir/sh" 1>&2; exit 1; } fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. echo $ac_n "checking if the C compiler can use precompiled headers""... $ac_c" 1>&6 -echo "configure:1367: checking if the C compiler can use precompiled headers" >&5 +echo "configure:1426: checking if the C compiler can use precompiled headers" >&5 if eval "test \"`echo '$''{'wi_cv_cc_precomp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1407,14 +1466,14 @@ # echo "Successfully compiled pchtest.h into the precompiled header file pchtest.h.gch." >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1477: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* result="yes" ; wi_cv_cc_precomp_type="gcc_gch_files" else @@ -1433,14 +1492,14 @@ ${CC-cc} $CPPFLAGS -precomp pchtest.h -o pchtest.p >&5 2>&5 if test -s pchtest.p ; then cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* result="yes" ; wi_cv_cc_precomp_type="gcc_dash_precomp" else @@ -1518,7 +1577,7 @@ wi_request_no_y2k_warnings=yes echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1522: checking how to run the C preprocessor" >&5 +echo "configure:1581: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1533,13 +1592,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1543: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1602: \"$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 : @@ -1550,13 +1609,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1560: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1619: \"$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 : @@ -1567,13 +1626,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1636: \"$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 : @@ -1631,7 +1690,7 @@ if test "$GCC" = yes ; then echo $ac_n "checking the version of GCC""... $ac_c" 1>&6 -echo "configure:1635: checking the version of GCC" >&5 +echo "configure:1694: checking the version of GCC" >&5 if eval "test \"`echo '$''{'wi_cv_gcc_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1654,7 +1713,7 @@ wi_cv_sunwspro_cc_version2="0" else echo $ac_n "checking if the C compiler is Sun WorkShop C""... $ac_c" 1>&6 -echo "configure:1658: checking if the C compiler is Sun WorkShop C" >&5 +echo "configure:1717: checking if the C compiler is Sun WorkShop C" >&5 if eval "test \"`echo '$''{'wi_cv_cc_is_sunwspro_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1688,14 +1747,14 @@ echo "$ac_t""$wi_cv_cc_is_sunwspro_cc" 1>&6 if test "$wi_cv_cc_is_sunwspro_cc" = yes ; then echo $ac_n "checking output of "cc -V" to determine version of Sun WorkShop C""... $ac_c" 1>&6 -echo "configure:1692: checking output of "cc -V" to determine version of Sun WorkShop C" >&5 +echo "configure:1751: checking output of "cc -V" to determine version of Sun WorkShop C" >&5 echo "$ac_t"""version $wi_cv_sunwspro_cc_version"" 1>&6 fi fi echo $ac_n "checking if we should customize your CFLAGS environment variable""... $ac_c" 1>&6 -echo "configure:1699: checking if we should customize your CFLAGS environment variable" >&5 +echo "configure:1758: checking if we should customize your CFLAGS environment variable" >&5 wi_replace_O_with_g="no" case "$wi_orig_CFLAGS" in "") @@ -1755,8 +1814,28 @@ ;; esac +CC_is_clang="no" +case "$CC" in + *clang*) + CC_is_clang="yes" + ;; + *) + cc_dash_v=`${CC-gcc} -v 2>&1 | grep clang 2>/dev/null` + if test -n "$cc_dash_v" ; then + CC_is_clang="yes" + fi + ;; +esac + if test "$wi_os_default_cflags" = yes ; then - if test "$GCC" = yes ; then + if test "$CC_is_clang" = yes ; then + wi_os_default_cflags="-Weverything -Wno-unknown-warning-option -Wno-disabled-macro-expansion -Wno-missing-variable-declarations -Wno-date-time" + if test "$wi_replace_O_with_g" = yes ; then + wi_os_default_cflags="-g $wi_os_default_cflags" + else + wi_os_default_cflags="-O2 $wi_os_default_cflags" + fi + elif test "$GCC" = yes ; then # # gcc # @@ -1765,7 +1844,7 @@ 2.7.*|2.8.*|2.9*) wi_os_default_cflags="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wbad-function-cast -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-declarations -Winline" ;; - 3.*) + 345.*) wi_os_default_cflags="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wbad-function-cast -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-declarations -Winline -Wmissing-format-attribute -Wformat-security" wi_gcc_optimizer_flags='-Wdisabled-optimization' ;; @@ -1884,6 +1963,21 @@ echo "$ac_t""$wi_os_default_cflags" 1>&6 + case "$OS" in + "solaris"*"-x86_64") + if test "$GCC" = "yes" ; then + case "$CFLAGS" in + *"-m64"*) + ;; + *) + CFLAGS="-m64 $CFLAGS" + ;; + esac + fi + ;; + esac + + if test "x$wi_request_no_y2k_warnings" = xyes ; then case "${wi_cv_gcc_version-0}" in @@ -1901,14 +1995,14 @@ # accepts this flag... # cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -1926,7 +2020,7 @@ echo $ac_n "checking for ldd""... $ac_c" 1>&6 -echo "configure:1930: checking for ldd" >&5 +echo "configure:2024: checking for ldd" >&5 if eval "test \"`echo '$''{'wi_cv_prog_ldd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1961,7 +2055,7 @@ # try these CFLAGS="$CFLAGS $ac_cv_ssp_flags" cat > conftest.$ac_ext < @@ -1973,7 +2067,7 @@ ; return 0; } EOF -if { (eval echo configure:1977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -1989,13 +2083,13 @@ fi unset oldCFLAGS echo $ac_n "checking if stack protection CFLAGS can be used""... $ac_c" 1>&6 -echo "configure:1993: checking if stack protection CFLAGS can be used" >&5 +echo "configure:2087: checking if stack protection CFLAGS can be used" >&5 echo "$ac_t""$ac_cv_ssp_flags" 1>&6 fi echo $ac_n "checking if compiled programs use a shared library version of libgcc""... $ac_c" 1>&6 -echo "configure:1999: checking if compiled programs use a shared library version of libgcc" >&5 +echo "configure:2093: checking if compiled programs use a shared library version of libgcc" >&5 if eval "test \"`echo '$''{'wi_cv_shared_libgcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2034,7 +2128,7 @@ # accepts this flag... # cat > conftest.$ac_ext < @@ -2044,7 +2138,7 @@ strncpy(testvar, "hello world", sizeof(testvar) - 1); ; return 0; } EOF -if { (eval echo configure:2048: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -2075,7 +2169,7 @@ # accepts this flag... # cat > conftest.$ac_ext < @@ -2085,7 +2179,7 @@ strncpy(testvar, "hello world", sizeof(testvar) - 1); ; return 0; } EOF -if { (eval echo configure:2089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -2125,7 +2219,7 @@ # Was it ./configure --enable-debug ? # echo $ac_n "checking if this is a debug build""... $ac_c" 1>&6 -echo "configure:2129: checking if this is a debug build" >&5 +echo "configure:2223: checking if this is a debug build" >&5 if test "$DEBUGBUILD" = yes ; then echo "$ac_t""yes" 1>&6 CFLAGS="$DEBUGCFLAGS" @@ -2139,7 +2233,7 @@ CFLAGS=`echo "$CFLAGS" | sed s/-D__STDC_EXT__//g` echo $ac_n "checking if -D__STDC_EXT__ is needed with GCC on HP-UX""... $ac_c" 1>&6 -echo "configure:2143: checking if -D__STDC_EXT__ is needed with GCC on HP-UX" >&5 +echo "configure:2237: checking if -D__STDC_EXT__ is needed with GCC on HP-UX" >&5 if test "$cross_compiling" = yes; then # action if cross-compiling, guess @@ -2148,7 +2242,7 @@ else cat > conftest.$ac_ext < @@ -2164,7 +2258,7 @@ #endif } EOF -if { (eval echo configure:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -2197,17 +2291,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2201: checking for $ac_hdr" >&5 +echo "configure:2295: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2305: \"$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* @@ -2236,7 +2330,7 @@ if test "x$ac_cv_sizeof_stat_st_size" = x ; then echo $ac_n "checking size of st_size field in struct stat""... $ac_c" 1>&6 -echo "configure:2240: checking size of st_size field in struct stat" >&5 +echo "configure:2334: checking size of st_size field in struct stat" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SIZEOF_ST_SIZE." 1>&2; exit 1; } @@ -2251,7 +2345,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -2317,7 +2411,7 @@ if test "x$ac_cv_sizeof_off_t" = x ; then echo $ac_n "checking size of off_t""... $ac_c" 1>&6 -echo "configure:2321: checking size of off_t" >&5 +echo "configure:2415: checking size of off_t" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SIZEOF_OFF_T." 1>&2; exit 1; } @@ -2332,7 +2426,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -2411,7 +2505,7 @@ wi_cv_lfs64="yes" echo $ac_n "checking size of st_size field in struct stat64""... $ac_c" 1>&6 -echo "configure:2415: checking size of st_size field in struct stat64" >&5 +echo "configure:2509: checking size of st_size field in struct stat64" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SIZEOF_STAT64_ST_SIZE." 1>&2; exit 1; } @@ -2426,7 +2520,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -2494,7 +2588,7 @@ echo $ac_n "checking size of off64_t""... $ac_c" 1>&6 -echo "configure:2498: checking size of off64_t" >&5 +echo "configure:2592: checking size of off64_t" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SIZEOF_OFF64_T." 1>&2; exit 1; } @@ -2509,7 +2603,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -2577,7 +2671,7 @@ echo $ac_n "checking size of st_size field in struct stat""... $ac_c" 1>&6 -echo "configure:2581: checking size of st_size field in struct stat" >&5 +echo "configure:2675: checking size of st_size field in struct stat" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SIZEOF_ST_SIZE." 1>&2; exit 1; } @@ -2592,7 +2686,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -2656,7 +2750,7 @@ echo $ac_n "checking size of off_t""... $ac_c" 1>&6 -echo "configure:2660: checking size of off_t" >&5 +echo "configure:2754: checking size of off_t" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SIZEOF_OFF_T." 1>&2; exit 1; } @@ -2671,7 +2765,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -2749,7 +2843,7 @@ fi echo $ac_n "checking if we should add CFLAGS for LFS64 support""... $ac_c" 1>&6 -echo "configure:2753: checking if we should add CFLAGS for LFS64 support" >&5 +echo "configure:2847: checking if we should add CFLAGS for LFS64 support" >&5 echo "$ac_t""$result" 1>&6 else @@ -2760,7 +2854,7 @@ if test "$GCC" = yes ; then echo $ac_n "checking the version of GCC""... $ac_c" 1>&6 -echo "configure:2764: checking the version of GCC" >&5 +echo "configure:2858: checking the version of GCC" >&5 if eval "test \"`echo '$''{'wi_cv_gcc_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2783,7 +2877,7 @@ wi_cv_sunwspro_cc_version2="0" else echo $ac_n "checking if the C compiler is Sun WorkShop C""... $ac_c" 1>&6 -echo "configure:2787: checking if the C compiler is Sun WorkShop C" >&5 +echo "configure:2881: checking if the C compiler is Sun WorkShop C" >&5 if eval "test \"`echo '$''{'wi_cv_cc_is_sunwspro_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2817,14 +2911,14 @@ echo "$ac_t""$wi_cv_cc_is_sunwspro_cc" 1>&6 if test "$wi_cv_cc_is_sunwspro_cc" = yes ; then echo $ac_n "checking output of "cc -V" to determine version of Sun WorkShop C""... $ac_c" 1>&6 -echo "configure:2821: checking output of "cc -V" to determine version of Sun WorkShop C" >&5 +echo "configure:2915: checking output of "cc -V" to determine version of Sun WorkShop C" >&5 echo "$ac_t"""version $wi_cv_sunwspro_cc_version"" 1>&6 fi fi echo $ac_n "checking if we should customize your CFLAGS environment variable""... $ac_c" 1>&6 -echo "configure:2828: checking if we should customize your CFLAGS environment variable" >&5 +echo "configure:2922: checking if we should customize your CFLAGS environment variable" >&5 wi_replace_O_with_g="no" case "$wi_orig_CFLAGS" in "") @@ -2884,8 +2978,28 @@ ;; esac +CC_is_clang="no" +case "$CC" in + *clang*) + CC_is_clang="yes" + ;; + *) + cc_dash_v=`${CC-gcc} -v 2>&1 | grep clang 2>/dev/null` + if test -n "$cc_dash_v" ; then + CC_is_clang="yes" + fi + ;; +esac + if test "$wi_os_default_cflags" = yes ; then - if test "$GCC" = yes ; then + if test "$CC_is_clang" = yes ; then + wi_os_default_cflags="-Weverything -Wno-unknown-warning-option -Wno-disabled-macro-expansion -Wno-missing-variable-declarations -Wno-date-time" + if test "$wi_replace_O_with_g" = yes ; then + wi_os_default_cflags="-g $wi_os_default_cflags" + else + wi_os_default_cflags="-O2 $wi_os_default_cflags" + fi + elif test "$GCC" = yes ; then # # gcc # @@ -2894,7 +3008,7 @@ 2.7.*|2.8.*|2.9*) wi_os_default_cflags="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wbad-function-cast -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-declarations -Winline" ;; - 3.*) + 345.*) wi_os_default_cflags="-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wbad-function-cast -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-declarations -Winline -Wmissing-format-attribute -Wformat-security" wi_gcc_optimizer_flags='-Wdisabled-optimization' ;; @@ -3013,6 +3127,21 @@ echo "$ac_t""$wi_os_default_cflags" 1>&6 + case "$OS" in + "solaris"*"-x86_64") + if test "$GCC" = "yes" ; then + case "$CFLAGS" in + *"-m64"*) + ;; + *) + CFLAGS="-m64 $CFLAGS" + ;; + esac + fi + ;; + esac + + if test "x$wi_request_no_y2k_warnings" = xyes ; then case "${wi_cv_gcc_version-0}" in @@ -3030,14 +3159,14 @@ # accepts this flag... # cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3170: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -3055,7 +3184,7 @@ echo $ac_n "checking for ldd""... $ac_c" 1>&6 -echo "configure:3059: checking for ldd" >&5 +echo "configure:3188: checking for ldd" >&5 if eval "test \"`echo '$''{'wi_cv_prog_ldd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3090,7 +3219,7 @@ # try these CFLAGS="$CFLAGS $ac_cv_ssp_flags" cat > conftest.$ac_ext < @@ -3102,7 +3231,7 @@ ; return 0; } EOF -if { (eval echo configure:3106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -3118,13 +3247,13 @@ fi unset oldCFLAGS echo $ac_n "checking if stack protection CFLAGS can be used""... $ac_c" 1>&6 -echo "configure:3122: checking if stack protection CFLAGS can be used" >&5 +echo "configure:3251: checking if stack protection CFLAGS can be used" >&5 echo "$ac_t""$ac_cv_ssp_flags" 1>&6 fi echo $ac_n "checking if compiled programs use a shared library version of libgcc""... $ac_c" 1>&6 -echo "configure:3128: checking if compiled programs use a shared library version of libgcc" >&5 +echo "configure:3257: checking if compiled programs use a shared library version of libgcc" >&5 if eval "test \"`echo '$''{'wi_cv_shared_libgcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3163,7 +3292,7 @@ # accepts this flag... # cat > conftest.$ac_ext < @@ -3173,7 +3302,7 @@ strncpy(testvar, "hello world", sizeof(testvar) - 1); ; return 0; } EOF -if { (eval echo configure:3177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -3204,7 +3333,7 @@ # accepts this flag... # cat > conftest.$ac_ext < @@ -3214,7 +3343,7 @@ strncpy(testvar, "hello world", sizeof(testvar) - 1); ; return 0; } EOF -if { (eval echo configure:3218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3347: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -3254,7 +3383,7 @@ # Was it ./configure --enable-debug ? # echo $ac_n "checking if this is a debug build""... $ac_c" 1>&6 -echo "configure:3258: checking if this is a debug build" >&5 +echo "configure:3387: checking if this is a debug build" >&5 if test "$DEBUGBUILD" = yes ; then echo "$ac_t""yes" 1>&6 CFLAGS="$DEBUGCFLAGS" @@ -3268,7 +3397,7 @@ CFLAGS=`echo "$CFLAGS" | sed s/-D__STDC_EXT__//g` echo $ac_n "checking if -D__STDC_EXT__ is needed with GCC on HP-UX""... $ac_c" 1>&6 -echo "configure:3272: checking if -D__STDC_EXT__ is needed with GCC on HP-UX" >&5 +echo "configure:3401: checking if -D__STDC_EXT__ is needed with GCC on HP-UX" >&5 if test "$cross_compiling" = yes; then # action if cross-compiling, guess @@ -3277,7 +3406,7 @@ else cat > conftest.$ac_ext < @@ -3293,7 +3422,7 @@ #endif } EOF -if { (eval echo configure:3297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -3326,17 +3455,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3330: checking for $ac_hdr" >&5 +echo "configure:3459: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3340: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3469: \"$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* @@ -3365,7 +3494,7 @@ if test "x$ac_cv_sizeof_stat_st_size" = x ; then echo $ac_n "checking size of st_size field in struct stat""... $ac_c" 1>&6 -echo "configure:3369: checking size of st_size field in struct stat" >&5 +echo "configure:3498: checking size of st_size field in struct stat" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SIZEOF_ST_SIZE." 1>&2; exit 1; } @@ -3380,7 +3509,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -3445,23 +3574,203 @@ fi if test "x$ac_cv_sizeof_off_t" = x ; then -echo $ac_n "checking size of off_t""... $ac_c" 1>&6 -echo "configure:3450: checking size of off_t" >&5 +echo $ac_n "checking size of off_t""... $ac_c" 1>&6 +echo "configure:3579: checking size of off_t" >&5 + + if test "x$ac_cv_header_unistd_h" = x ; then + { echo "configure: error: Script needs to check for before calling wi_SIZEOF_OFF_T." 1>&2; exit 1; } + fi + +if test "$cross_compiling" = yes; then + + # action if cross compiling + x="unknown" + ac_cv_sizeof_off_t="4" + rm -f conftest.out + +else + cat > conftest.$ac_ext < +#endif +#include +#include +#include +#include + +main() +{ + off_t x = 0; + FILE *fp; + + fp = fopen("conftest.out", "w"); + if (fp != NULL) { + fprintf(fp, "%u\n", (unsigned int) sizeof(x)); + fclose(fp); + exit(0); /* OK */ + } + exit(1); /* Not OK */ +} + +EOF +if { (eval echo configure:3624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + + # action if true + x=`cat conftest.out` + case "$x" in + [0-9]*) + ac_cv_sizeof_off_t="$x" + ;; + *) + x="failed" + ac_cv_sizeof_off_t="4" + ;; + esac + rm -f conftest.out + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + + # action if false + x="failed" + ac_cv_sizeof_off_t="4" + rm -f conftest.out + +fi +rm -fr conftest* +fi + +echo "$ac_t""$x" 1>&6 + +fi +if test "x$ac_cv_sizeof_size_t" = x ; then + +echo $ac_n "checking size of size_t""... $ac_c" 1>&6 +echo "configure:3660: checking size of size_t" >&5 + + if test "x$ac_cv_header_unistd_h" = x ; then + { echo "configure: error: Script needs to check for before calling wi_SIZEOF_SIZE_T." 1>&2; exit 1; } + fi + +if test "$cross_compiling" = yes; then + + # action if cross compiling + x="unknown" + ac_cv_sizeof_size_t="4" + rm -f conftest.out + +else + cat > conftest.$ac_ext < +#endif +#include +#include +#include +#include + +main() +{ + size_t x = 0; + FILE *fp; + + fp = fopen("conftest.out", "w"); + if (fp != NULL) { + fprintf(fp, "%u\n", (unsigned int) sizeof(x)); + fclose(fp); + exit(0); /* OK */ + } + exit(1); /* Not OK */ +} + +EOF +if { (eval echo configure:3705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + + # action if true + x=`cat conftest.out` + case "$x" in + [0-9]*) + ac_cv_sizeof_size_t="$x" + ;; + *) + x="failed" + ac_cv_sizeof_size_t="4" + ;; + esac + rm -f conftest.out + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + + # action if false + x="failed" + ac_cv_sizeof_size_t="4" + rm -f conftest.out + +fi +rm -fr conftest* +fi + +echo "$ac_t""$x" 1>&6 + +fi +orig_CFLAGS="$CFLAGS" +if test "$ac_cv_sizeof_stat_st_size" -le 4 || test "$ac_cv_sizeof_off_t" -le 4 ; then + unset ac_cv_sizeof_stat_st_size ac_cv_sizeof_off_t + CFLAGS=`echo "$CFLAGS" | sed 's/-D_LARGEFILE64_SOURCE//g'` + case "$CFLAGS" in + *-D_LARGEFILE_SOURCE*) + result="already included -D_LARGEFILE_SOURCE" + ;; + *) + CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $CFLAGS" + DEBUGCFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $DEBUGCFLAGS" + NOOPTCFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $NOOPTCFLAGS" + result="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + ;; + esac + wi_cv_lfs="yes" +fi +if test "x$ac_cv_sizeof_off_t" = x ; then + # Recheck, to see if the defines took effect. + +echo $ac_n "checking size of st_size field in struct stat""... $ac_c" 1>&6 +echo "configure:3759: checking size of st_size field in struct stat" >&5 if test "x$ac_cv_header_unistd_h" = x ; then - { echo "configure: error: Script needs to check for before calling wi_SIZEOF_OFF_T." 1>&2; exit 1; } + { echo "configure: error: Script needs to check for before calling wi_SIZEOF_ST_SIZE." 1>&2; exit 1; } fi if test "$cross_compiling" = yes; then # action if cross compiling x="unknown" - ac_cv_sizeof_off_t="4" + ac_cv_sizeof_stat_st_size="4" rm -f conftest.out else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true x=`cat conftest.out` case "$x" in [0-9]*) - ac_cv_sizeof_off_t="$x" + ac_cv_sizeof_stat_st_size="$x" ;; *) x="failed" - ac_cv_sizeof_off_t="4" + ac_cv_sizeof_stat_st_size="4" ;; esac rm -f conftest.out @@ -3514,7 +3823,7 @@ # action if false x="failed" - ac_cv_sizeof_off_t="4" + ac_cv_sizeof_stat_st_size="4" rm -f conftest.out fi @@ -3523,44 +3832,24 @@ echo "$ac_t""$x" 1>&6 -fi -orig_CFLAGS="$CFLAGS" -if test "$ac_cv_sizeof_stat_st_size" -le 4 || test "$ac_cv_sizeof_off_t" -le 4 ; then - unset ac_cv_sizeof_stat_st_size ac_cv_sizeof_off_t - CFLAGS=`echo "$CFLAGS" | sed 's/-D_LARGEFILE64_SOURCE//g'` - case "$CFLAGS" in - *-D_LARGEFILE_SOURCE*) - result="already included -D_LARGEFILE_SOURCE" - ;; - *) - CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $CFLAGS" - DEBUGCFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $DEBUGCFLAGS" - NOOPTCFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $NOOPTCFLAGS" - result="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" - ;; - esac - wi_cv_lfs="yes" -fi -if test "x$ac_cv_sizeof_off_t" = x ; then - # Recheck, to see if the defines took effect. -echo $ac_n "checking size of st_size field in struct stat""... $ac_c" 1>&6 -echo "configure:3549: checking size of st_size field in struct stat" >&5 +echo $ac_n "checking size of off_t""... $ac_c" 1>&6 +echo "configure:3838: checking size of off_t" >&5 if test "x$ac_cv_header_unistd_h" = x ; then - { echo "configure: error: Script needs to check for before calling wi_SIZEOF_ST_SIZE." 1>&2; exit 1; } + { echo "configure: error: Script needs to check for before calling wi_SIZEOF_OFF_T." 1>&2; exit 1; } fi if test "$cross_compiling" = yes; then # action if cross compiling x="unknown" - ac_cv_sizeof_stat_st_size="4" + ac_cv_sizeof_off_t="4" rm -f conftest.out else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true x=`cat conftest.out` case "$x" in [0-9]*) - ac_cv_sizeof_stat_st_size="$x" + ac_cv_sizeof_off_t="$x" ;; *) x="failed" - ac_cv_sizeof_stat_st_size="4" + ac_cv_sizeof_off_t="4" ;; esac rm -f conftest.out @@ -3613,7 +3902,7 @@ # action if false x="failed" - ac_cv_sizeof_stat_st_size="4" + ac_cv_sizeof_off_t="4" rm -f conftest.out fi @@ -3623,23 +3912,23 @@ echo "$ac_t""$x" 1>&6 -echo $ac_n "checking size of off_t""... $ac_c" 1>&6 -echo "configure:3628: checking size of off_t" >&5 +echo $ac_n "checking size of size_t""... $ac_c" 1>&6 +echo "configure:3917: checking size of size_t" >&5 if test "x$ac_cv_header_unistd_h" = x ; then - { echo "configure: error: Script needs to check for before calling wi_SIZEOF_OFF_T." 1>&2; exit 1; } + { echo "configure: error: Script needs to check for before calling wi_SIZEOF_SIZE_T." 1>&2; exit 1; } fi if test "$cross_compiling" = yes; then # action if cross compiling x="unknown" - ac_cv_sizeof_off_t="4" + ac_cv_sizeof_size_t="4" rm -f conftest.out else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true x=`cat conftest.out` case "$x" in [0-9]*) - ac_cv_sizeof_off_t="$x" + ac_cv_sizeof_size_t="$x" ;; *) x="failed" - ac_cv_sizeof_off_t="4" + ac_cv_sizeof_size_t="4" ;; esac rm -f conftest.out @@ -3692,7 +3981,7 @@ # action if false x="failed" - ac_cv_sizeof_off_t="4" + ac_cv_sizeof_size_t="4" rm -f conftest.out fi @@ -3713,7 +4002,7 @@ unset ac_cv_sizeof_stat_st_size ac_cv_sizeof_off_t echo $ac_n "checking size of st_size field in struct stat64""... $ac_c" 1>&6 -echo "configure:3717: checking size of st_size field in struct stat64" >&5 +echo "configure:4006: checking size of st_size field in struct stat64" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SIZEOF_STAT64_ST_SIZE." 1>&2; exit 1; } @@ -3728,7 +4017,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -3796,7 +4085,7 @@ echo $ac_n "checking size of off64_t""... $ac_c" 1>&6 -echo "configure:3800: checking size of off64_t" >&5 +echo "configure:4089: checking size of off64_t" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SIZEOF_OFF64_T." 1>&2; exit 1; } @@ -3811,7 +4100,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -3879,7 +4168,7 @@ echo $ac_n "checking size of st_size field in struct stat""... $ac_c" 1>&6 -echo "configure:3883: checking size of st_size field in struct stat" >&5 +echo "configure:4172: checking size of st_size field in struct stat" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SIZEOF_ST_SIZE." 1>&2; exit 1; } @@ -3894,7 +4183,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -3958,7 +4247,7 @@ echo $ac_n "checking size of off_t""... $ac_c" 1>&6 -echo "configure:3962: checking size of off_t" >&5 +echo "configure:4251: checking size of off_t" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SIZEOF_OFF_T." 1>&2; exit 1; } @@ -3973,7 +4262,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -4038,7 +4327,7 @@ fi fi echo $ac_n "checking if we should add CFLAGS for Large File Support""... $ac_c" 1>&6 -echo "configure:4042: checking if we should add CFLAGS for Large File Support" >&5 +echo "configure:4331: checking if we should add CFLAGS for Large File Support" >&5 echo "$ac_t""$result" 1>&6 unset orig_CFLAGS @@ -4070,7 +4359,7 @@ ;; esac echo $ac_n "checking if we should add CFLAGS for reentrancy""... $ac_c" 1>&6 -echo "configure:4074: checking if we should add CFLAGS for reentrancy" >&5 +echo "configure:4363: checking if we should add CFLAGS for reentrancy" >&5 echo "$ac_t""$result" 1>&6 @@ -4080,7 +4369,7 @@ ac_cv_macosx_ldflags=no echo $ac_n "checking if MACOSX_DEPLOYMENT_TARGET environment variable is set""... $ac_c" 1>&6 -echo "configure:4084: checking if MACOSX_DEPLOYMENT_TARGET environment variable is set" >&5 +echo "configure:4373: checking if MACOSX_DEPLOYMENT_TARGET environment variable is set" >&5 echo "$ac_t""${MACOSX_DEPLOYMENT_TARGET-no}" 1>&6 test_macosx_sdk_path=`/bin/ls -1d /Developer/SDKs/MacOSX10.*u.sdk 2>/dev/null | sed -n 1,1p` @@ -4108,7 +4397,7 @@ ;; esac echo $ac_n "checking if Mac OS X universal SDK is available""... $ac_c" 1>&6 -echo "configure:4112: checking if Mac OS X universal SDK is available" >&5 +echo "configure:4401: checking if Mac OS X universal SDK is available" >&5 echo "$ac_t""${test_macosx_sdk_path-no}" 1>&6 if test "${use_macosx_universal}" != no && test "${test_macosx_sdk_path}" != "no" ; then @@ -4162,13 +4451,13 @@ # esac fi echo $ac_n "checking if we should add CFLAGS for Mac OS X""... $ac_c" 1>&6 -echo "configure:4166: checking if we should add CFLAGS for Mac OS X" >&5 +echo "configure:4455: checking if we should add CFLAGS for Mac OS X" >&5 echo "$ac_t""$ac_cv_macosx_cflags" 1>&6 fi echo $ac_n "checking for strip""... $ac_c" 1>&6 -echo "configure:4172: checking for strip" >&5 +echo "configure:4461: checking for strip" >&5 STRIP="strip" if [ "x$cross_compiling" = "xyes" ] ; then machine=`${CC-gcc} -dumpmachine 2>/dev/null` @@ -4222,7 +4511,7 @@ STRIPFLAG="$SFLAG" echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:4226: checking for object suffix" >&5 +echo "configure:4515: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4231,7 +4520,7 @@ ac_cv_objext="o" else echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:4235: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4524: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -4250,12 +4539,12 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:4254: checking for Cygwin environment" >&5 +echo "configure:4543: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4559: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -4283,19 +4572,19 @@ CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:4287: checking for mingw32 environment" >&5 +echo "configure:4576: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4588: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -4314,7 +4603,7 @@ echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:4318: checking for executable suffix" >&5 +echo "configure:4607: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4326,7 +4615,7 @@ rm -rf conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:4330: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:4619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -4360,14 +4649,15 @@ if test "${SYS-sunos}" = sunos ; then echo $ac_n "checking for System V compatibility directories""... $ac_c" 1>&6 -echo "configure:4364: checking for System V compatibility directories" >&5 +echo "configure:4653: checking for System V compatibility directories" >&5 echo "$ac_t""" 1>&6 incdir=""/usr/5include"" -if test -r $incdir ; then +echo "wi_extra_idir $incdir" 1>&5 +if test -r "$incdir" ; then case "$CPPFLAGS" in *${incdir}*) - # echo " + already had $incdir" 1>&6 + echo " + already had $incdir" 1>&5 ;; *) if test "$CPPFLAGS" = "" ; then @@ -4375,17 +4665,18 @@ else CPPFLAGS="$CPPFLAGS -I$incdir" fi - echo " + found $incdir" 1>&6 + echo " + found $incdir" 1>&5 ;; esac fi libdir=""/usr/5lib"" -if test -r $libdir ; then +echo "wi_extra_ldir $libdir" 1>&5 +if test -r "$libdir" ; then case "$LDFLAGS" in *${libdir}*) - # echo " + already had $libdir" 1>&6 + echo " + already had $libdir" 1>&5 ;; *) if test "$LDFLAGS" = "" ; then @@ -4393,7 +4684,7 @@ else LDFLAGS="$LDFLAGS -L$libdir" fi - echo " + found $libdir" 1>&6 + echo " + found $libdir" 1>&5 ;; esac fi @@ -4410,12 +4701,12 @@ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:4414: checking for ANSI C header files" >&5 +echo "configure:4705: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -4423,7 +4714,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4427: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4718: \"$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* @@ -4440,7 +4731,7 @@ 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 @@ -4458,7 +4749,7 @@ 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 @@ -4479,7 +4770,7 @@ : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -4490,7 +4781,7 @@ exit (0); } EOF -if { (eval echo configure:4494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -4513,21 +4804,21 @@ fi -for ac_hdr in arpa/nameser.h gnu/libc-version.h locale.h net/errno.h nserve.h resolv.h sgtty.h string.h strings.h sys/id.h sys/ioctl.h syslog.h sys/socket.h sys/time.h sys/types.h sys/utsname.h sys/systeminfo.h termio.h termios.h time.h utime.h unistd.h gnu/libc-version.h +for ac_hdr in arpa/nameser.h gnu/libc-version.h locale.h net/errno.h nserve.h resolv.h sgtty.h string.h strings.h sys/id.h sys/ioctl.h syslog.h sys/sendfile.h sys/socket.h sys/time.h sys/types.h sys/utsname.h sys/systeminfo.h termio.h termios.h time.h utime.h unistd.h gnu/libc-version.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4521: checking for $ac_hdr" >&5 +echo "configure:4812: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4531: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4822: \"$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* @@ -4554,12 +4845,12 @@ done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:4558: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:4849: 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 < #include @@ -4568,7 +4859,7 @@ struct tm *tp; ; return 0; } EOF -if { (eval echo configure:4572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -4599,17 +4890,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4603: checking for $ac_hdr" >&5 +echo "configure:4894: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4904: \"$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* @@ -4636,7 +4927,7 @@ done echo $ac_n "checking for UNIX domain sockets""... $ac_c" 1>&6 -echo "configure:4640: checking for UNIX domain sockets" >&5 +echo "configure:4931: checking for UNIX domain sockets" >&5 if eval "test \"`echo '$''{'wi_cv_unix_domain_sockets'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4649,7 +4940,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -4709,13 +5000,13 @@ fi echo $ac_n "checking for sun_len field in struct sockaddr_un""... $ac_c" 1>&6 -echo "configure:4713: checking for sun_len field in struct sockaddr_un" >&5 +echo "configure:5004: checking for sun_len field in struct sockaddr_un" >&5 if eval "test \"`echo '$''{'wi_cv_sockaddr_un_sun_len'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_sockaddr_un_sun_len=yes @@ -4776,12 +5067,12 @@ # Mostly for SunOS 4 -- needs to come first because other libs depend on it echo $ac_n "checking for strerror""... $ac_c" 1>&6 -echo "configure:4780: checking for strerror" >&5 +echo "configure:5071: checking for strerror" >&5 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strerror=yes" else @@ -4827,7 +5118,7 @@ if test "$a" = no ; then # Not in libc, try lib44bsd. echo $ac_n "checking for strerror in -l44bsd""... $ac_c" 1>&6 -echo "configure:4831: checking for strerror in -l44bsd" >&5 +echo "configure:5122: checking for strerror in -l44bsd" >&5 ac_lib_var=`echo 44bsd'_'strerror | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4835,7 +5126,7 @@ ac_save_LIBS="$LIBS" LIBS="-l44bsd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5141: \"$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 @@ -4878,12 +5169,12 @@ echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:4882: checking for socket" >&5 +echo "configure:5173: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -4929,7 +5220,7 @@ if test "$a" = no ; then # Not in libc, try libsocket. echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:4933: checking for socket in -lsocket" >&5 +echo "configure:5224: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4937,7 +5228,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5243: \"$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 @@ -4983,7 +5274,7 @@ unixware2*) # So far, only UnixWare needs this. echo $ac_n "checking for syslog in -lgen""... $ac_c" 1>&6 -echo "configure:4987: checking for syslog in -lgen" >&5 +echo "configure:5278: checking for syslog in -lgen" >&5 ac_lib_var=`echo gen'_'syslog | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4991,7 +5282,7 @@ ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5297: \"$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 @@ -5049,12 +5340,12 @@ # AC_CHECK_FUNC(socket,[a=yes],[a=no]) # echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:5053: checking for socket" >&5 +echo "configure:5344: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -5110,7 +5401,7 @@ hpux1123456789*) # HP-UX 11 uses NSL for YP services echo $ac_n "checking for getpwent in -lnsl""... $ac_c" 1>&6 -echo "configure:5114: checking for getpwent in -lnsl" >&5 +echo "configure:5405: checking for getpwent in -lnsl" >&5 ac_lib_var=`echo nsl'_'getpwent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5118,7 +5409,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5424: \"$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 @@ -5160,12 +5451,12 @@ *) echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:5164: checking for gethostbyname" >&5 +echo "configure:5455: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -5211,7 +5502,7 @@ if test "$a" = no ; then # Not in libc, try libnsl. echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:5215: checking for gethostbyname in -lnsl" >&5 +echo "configure:5506: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5219,7 +5510,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5525: \"$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 @@ -5266,7 +5557,7 @@ # See if we could access two well-known sites without help of any special # libraries, like resolv. echo $ac_n "checking if we need to look for a separate DNS resolver library""... $ac_c" 1>&6 -echo "configure:5270: checking if we need to look for a separate DNS resolver library" >&5 +echo "configure:5561: checking if we need to look for a separate DNS resolver library" >&5 if eval "test \"`echo '$''{'wi_cv_look_for_resolv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5284,7 +5575,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -5339,7 +5630,7 @@ if test "$wi_cv_look_for_resolv" = yes ; then echo $ac_n "checking for main in -lresolv""... $ac_c" 1>&6 -echo "configure:5343: checking for main in -lresolv" >&5 +echo "configure:5634: checking for main in -lresolv" >&5 ac_lib_var=`echo resolv'_'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 @@ -5347,14 +5638,14 @@ ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5649: \"$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 @@ -5405,7 +5696,7 @@ # if test "x$ac_cv_lib_db_main" = "x" ; then echo $ac_n "checking for main in -ldb""... $ac_c" 1>&6 -echo "configure:5409: checking for main in -ldb" >&5 +echo "configure:5700: checking for main in -ldb" >&5 ac_lib_var=`echo db'_'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 @@ -5413,14 +5704,14 @@ ac_save_LIBS="$LIBS" LIBS="-ldb $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5715: \"$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 @@ -5443,7 +5734,7 @@ fi if test "x$ac_cv_lib_isode_main" = "x" ; then echo $ac_n "checking for main in -lisode""... $ac_c" 1>&6 -echo "configure:5447: checking for main in -lisode" >&5 +echo "configure:5738: checking for main in -lisode" >&5 ac_lib_var=`echo isode'_'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 @@ -5451,14 +5742,14 @@ ac_save_LIBS="$LIBS" LIBS="-lisode $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5753: \"$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 @@ -5481,7 +5772,7 @@ fi if test "x$ac_cv_lib_com_err_main" = "x" ; then echo $ac_n "checking for main in -lcom_err""... $ac_c" 1>&6 -echo "configure:5485: checking for main in -lcom_err" >&5 +echo "configure:5776: checking for main in -lcom_err" >&5 ac_lib_var=`echo com_err'_'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 @@ -5489,14 +5780,14 @@ ac_save_LIBS="$LIBS" LIBS="-lcom_err $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5791: \"$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 @@ -5516,25 +5807,242 @@ echo "$ac_t""no" 1>&6 fi - fi - if test "x$ac_cv_lib_crypto_main" = "x" ; then - echo $ac_n "checking for main in -lcrypto""... $ac_c" 1>&6 -echo "configure:5523: checking for main in -lcrypto" >&5 -ac_lib_var=`echo crypto'_'main | sed 'y%./+-%__p_%'` + fi + if test "x$ac_cv_lib_crypto_main" = "x" ; then + echo $ac_n "checking for main in -lcrypto""... $ac_c" 1>&6 +echo "configure:5814: checking for main in -lcrypto" >&5 +ac_lib_var=`echo crypto'_'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 + ac_save_LIBS="$LIBS" +LIBS="-lcrypto $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -rf conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SOCKS_LIBS="$SOCKS_LIBS -lcrypto" +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test "x$ac_cv_lib_krb5_main" = "x" ; then + echo $ac_n "checking for main in -lkrb5""... $ac_c" 1>&6 +echo "configure:5852: checking for main in -lkrb5" >&5 +ac_lib_var=`echo krb5'_'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 + ac_save_LIBS="$LIBS" +LIBS="-lkrb5 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -rf conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SOCKS_LIBS="$SOCKS_LIBS -lkrb5" +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test "x$ac_cv_lib_gssapi_krb5_main" = "x" ; then + echo $ac_n "checking for main in -lgssapi_krb5""... $ac_c" 1>&6 +echo "configure:5890: checking for main in -lgssapi_krb5" >&5 +ac_lib_var=`echo gssapi_krb5'_'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 + ac_save_LIBS="$LIBS" +LIBS="-lgssapi_krb5 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -rf conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SOCKS_LIBS="$SOCKS_LIBS -lgssapi_krb5" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + echo $ac_n "checking for SOCKSinit in -lsocks5""... $ac_c" 1>&6 +echo "configure:5928: checking for SOCKSinit in -lsocks5" >&5 +ac_lib_var=`echo socks5'_'SOCKSinit | 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="-lsocks5 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -rf conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SOCKS_LIBS="$SOCKS_LIBS -lsocks5" +else + echo "$ac_t""no" 1>&6 +fi + + for ac_hdr in socks.h socks5p.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:5971: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:5981: \"$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 -rf conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + + if test "$ac_cv_lib_socks5_SOCKSinit" != yes ; then + ac_cv_lib_socks5_SOCKSinit=no + unset SOCKS_LIBS + else + + cat >> confdefs.h <<\EOF +#define SOCKS 5 +EOF + + fi + fi + echo $ac_n "checking if SOCKS5 will be used""... $ac_c" 1>&6 +echo "configure:6020: checking if SOCKS5 will be used" >&5 + echo "$ac_t""$ac_cv_lib_socks5_SOCKSinit" 1>&6 + +case "$OS" in + solaris8-*) + saved_LIBS="$LIBS" + echo $ac_n "checking for sendfilev in -lsendfile""... $ac_c" 1>&6 +echo "configure:6027: checking for sendfilev in -lsendfile" >&5 +ac_lib_var=`echo sendfile'_'sendfilev | 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="-lcrypto $LIBS" +LIBS="-lsendfile $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6046: \"$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 @@ -5549,68 +6057,95 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - SOCKS_LIBS="$SOCKS_LIBS -lcrypto" + ac_tr_lib=HAVE_LIB`echo sendfile | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 fi - fi - if test "x$ac_cv_lib_krb5_main" = "x" ; then - echo $ac_n "checking for main in -lkrb5""... $ac_c" 1>&6 -echo "configure:5561: checking for main in -lkrb5" >&5 -ac_lib_var=`echo krb5'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + for ac_func in sendfilev sendfilev64 +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:6076: 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 - ac_save_LIBS="$LIBS" -LIBS="-lkrb5 $LIBS" -cat > conftest.$ac_ext < conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); int main() { -main() + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + ; return 0; } EOF -if { (eval echo configure:5576: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6104: \"$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" + eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + eval "ac_cv_func_$ac_func=no" fi rm -rf conftest* -LIBS="$ac_save_LIBS" - fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 - SOCKS_LIBS="$SOCKS_LIBS -lkrb5" + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 fi +done - fi - if test "x$ac_cv_lib_gssapi_krb5_main" = "x" ; then - echo $ac_n "checking for main in -lgssapi_krb5""... $ac_c" 1>&6 -echo "configure:5599: checking for main in -lgssapi_krb5" >&5 -ac_lib_var=`echo gssapi_krb5'_'main | sed 'y%./+-%__p_%'` + LIBS="$saved_LIBS" + echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "configure:6130: checking for dlopen in -ldl" >&5 +ac_lib_var=`echo dl'_'dlopen | 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="-lgssapi_krb5 $LIBS" +LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6149: \"$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 @@ -5625,34 +6160,41 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - SOCKS_LIBS="$SOCKS_LIBS -lgssapi_krb5" + ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 fi - fi - - echo $ac_n "checking for SOCKSinit in -lsocks5""... $ac_c" 1>&6 -echo "configure:5637: checking for SOCKSinit in -lsocks5" >&5 -ac_lib_var=`echo socks5'_'SOCKSinit | sed 'y%./+-%__p_%'` + ;; + solaris9-*|solaris1[0-9]-*) + echo $ac_n "checking for sendfilev in -lsendfile""... $ac_c" 1>&6 +echo "configure:6179: checking for sendfilev in -lsendfile" >&5 +ac_lib_var=`echo sendfile'_'sendfilev | 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="-lsocks5 $LIBS" +LIBS="-lsendfile $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6198: \"$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 @@ -5667,44 +6209,66 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - SOCKS_LIBS="$SOCKS_LIBS -lsocks5" + ac_tr_lib=HAVE_LIB`echo sendfile | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 fi - for ac_hdr in socks.h socks5p.h + for ac_func in sendfilev sendfilev64 do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5680: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:6228: 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 < +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5690: \"$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 +if { (eval echo configure:6256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" + eval "ac_cv_func_$ac_func=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" + eval "ac_cv_func_$ac_func=no" fi rm -rf conftest* fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <> confdefs.h <<\EOF -#define SOCKS 5 -EOF - - fi - fi - echo $ac_n "checking if SOCKS5 will be used""... $ac_c" 1>&6 -echo "configure:5729: checking if SOCKS5 will be used" >&5 - echo "$ac_t""$ac_cv_lib_socks5_SOCKSinit" 1>&6 - + ;; +esac LIBCURSES='' if test "$nc_cv_curses" = yes ; then echo $ac_n "checking for curses library headers""... $ac_c" 1>&6 -echo "configure:5738: checking for curses library headers" >&5 +echo "configure:6288: checking for curses library headers" >&5 if test "$wi_cv_ncurses" != "no" ; then for ac_hdr in ncurses.h curses.h termios.h termio.h sgtty.h sys/ioctl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5744: checking for $ac_hdr" >&5 +echo "configure:6294: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5754: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6304: \"$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* @@ -5781,17 +6331,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5785: checking for $ac_hdr" >&5 +echo "configure:6335: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6345: \"$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* @@ -5829,7 +6379,7 @@ fi echo $ac_n "checking for curses library""... $ac_c" 1>&6 -echo "configure:5833: checking for curses library" >&5 +echo "configure:6383: checking for curses library" >&5 wi_cv_lib_curses=no wi_cv_lib_curses_result=no @@ -5842,7 +6392,7 @@ fi LIBS="$ac_save_LIBS $LIBCURSES" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* linked_with_LIBCURSES=yes @@ -5889,7 +6439,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -5993,17 +6543,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5997: checking for $ac_hdr" >&5 +echo "configure:6547: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6007: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6557: \"$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* @@ -6033,7 +6583,7 @@ { echo "configure: error: Can't find validator.h" 1>&2; exit 1; } fi echo $ac_n "checking for SHA1_Init in -lssl""... $ac_c" 1>&6 -echo "configure:6037: checking for SHA1_Init in -lssl" >&5 +echo "configure:6587: checking for SHA1_Init in -lssl" >&5 ac_lib_var=`echo ssl'_'SHA1_Init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6041,7 +6591,7 @@ ac_save_LIBS="$LIBS" LIBS="-lssl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6606: \"$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 @@ -6081,7 +6631,7 @@ fi echo $ac_n "checking for query_send in -lsres""... $ac_c" 1>&6 -echo "configure:6085: checking for query_send in -lsres" >&5 +echo "configure:6635: checking for query_send in -lsres" >&5 ac_lib_var=`echo sres'_'query_send | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6089,7 +6639,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsres $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6654: \"$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 @@ -6129,7 +6679,7 @@ fi echo $ac_n "checking for p_val_status in -lval""... $ac_c" 1>&6 -echo "configure:6133: checking for p_val_status in -lval" >&5 +echo "configure:6683: checking for p_val_status in -lval" >&5 ac_lib_var=`echo val'_'p_val_status | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6137,7 +6687,7 @@ ac_save_LIBS="$LIBS" LIBS="-lval $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6702: \"$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 @@ -6168,7 +6718,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_rwlock_init in -lpthread""... $ac_c" 1>&6 -echo "configure:6172: checking for pthread_rwlock_init in -lpthread" >&5 +echo "configure:6722: checking for pthread_rwlock_init in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_rwlock_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6176,7 +6726,7 @@ ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6741: \"$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 @@ -6215,7 +6765,7 @@ fi echo $ac_n "checking for p_val_status in -lval-threads""... $ac_c" 1>&6 -echo "configure:6219: checking for p_val_status in -lval-threads" >&5 +echo "configure:6769: checking for p_val_status in -lval-threads" >&5 ac_lib_var=`echo val-threads'_'p_val_status | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6223,7 +6773,7 @@ ac_save_LIBS="$LIBS" LIBS="-lval-threads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6788: \"$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 @@ -6269,12 +6819,12 @@ echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:6273: checking for working const" >&5 +echo "configure:6823: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6877: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -6344,12 +6894,12 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:6348: checking for size_t" >&5 +echo "configure:6898: 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 < #if STDC_HEADERS @@ -6377,12 +6927,12 @@ fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:6381: checking for off_t" >&5 +echo "configure:6931: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6410,12 +6960,12 @@ fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:6414: checking for mode_t" >&5 +echo "configure:6964: 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 < #if STDC_HEADERS @@ -6443,12 +6993,12 @@ fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:6447: checking for pid_t" >&5 +echo "configure:6997: 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 < #if STDC_HEADERS @@ -6476,12 +7026,12 @@ fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:6480: checking for uid_t in sys/types.h" >&5 +echo "configure:7030: 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 @@ -6511,7 +7061,7 @@ echo $ac_n "checking what type main() should return""... $ac_c" 1>&6 -echo "configure:6515: checking what type main() should return" >&5 +echo "configure:7065: checking what type main() should return" >&5 if eval "test \"`echo '$''{'wi_cv_main_void_return_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6538,7 +7088,7 @@ fi echo $ac_n "checking for 64-bit integral type: long long""... $ac_c" 1>&6 -echo "configure:6542: checking for 64-bit integral type: long long" >&5 +echo "configure:7092: checking for 64-bit integral type: long long" >&5 LONGEST_INT="long" if test "$cross_compiling" = yes; then @@ -6549,7 +7099,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -6603,7 +7153,7 @@ if test "$wi_cv_type_long_long" = yes ; then echo $ac_n "checking how to print a 64-bit integral type""... $ac_c" 1>&6 -echo "configure:6607: checking how to print a 64-bit integral type" >&5 +echo "configure:7157: checking how to print a 64-bit integral type" >&5 wi_cv_printf_long_long=fail if test "$cross_compiling" = yes; then @@ -6614,7 +7164,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -6673,7 +7223,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -6732,7 +7282,7 @@ echo $ac_n "checking how to scan a 64-bit integral type""... $ac_c" 1>&6 -echo "configure:6736: checking how to scan a 64-bit integral type" >&5 +echo "configure:7286: checking how to scan a 64-bit integral type" >&5 wi_cv_scanf_long_long=fail if test "$cross_compiling" = yes; then @@ -6743,7 +7293,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -6805,7 +7355,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -6868,7 +7418,7 @@ fi echo $ac_n "checking if everything was available to use the 64-bit integral type""... $ac_c" 1>&6 -echo "configure:6872: checking if everything was available to use the 64-bit integral type" >&5 +echo "configure:7422: checking if everything was available to use the 64-bit integral type" >&5 if test "$wi_cv_type_long_long" = no ; then wi_cv_use_long_long_msg_result="no (long long type not available)" @@ -6947,7 +7497,7 @@ wi_struct_timeval_field_checks="cached" echo $ac_n "checking what type the tv_sec field of struct timeval is""... $ac_c" 1>&6 -echo "configure:6951: checking what type the tv_sec field of struct timeval is" >&5 +echo "configure:7501: checking what type the tv_sec field of struct timeval is" >&5 if eval "test \"`echo '$''{'wi_cv_struct_timeval_tv_sec'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6968,7 +7518,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -7082,12 +7632,12 @@ if test "$wi_struct_timeval_field_checks" = "uncached" ; then guess="$guess2" echo $ac_n "checking what type the tv_usec field of struct timeval is""... $ac_c" 1>&6 -echo "configure:7086: checking what type the tv_usec field of struct timeval is" >&5 +echo "configure:7636: checking what type the tv_usec field of struct timeval is" >&5 echo "$ac_t""$guess$wi_cv_struct_timeval_tv_usec" 1>&6 else guess="$guess2" echo $ac_n "checking what type the tv_usec field of struct timeval is""... $ac_c" 1>&6 -echo "configure:7091: checking what type the tv_usec field of struct timeval is" >&5 +echo "configure:7641: checking what type the tv_usec field of struct timeval is" >&5 if eval "test \"`echo '$''{'wi_cv_struct_timeval_tv_usec'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7111,7 +7661,7 @@ # 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:7115: checking for $ac_word" >&5 +echo "configure:7665: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7149,7 +7699,7 @@ # Extract the first word of ""mktemp"", so it can be a program name with args. set dummy "mktemp"; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7153: checking for $ac_word" >&5 +echo "configure:7703: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MKTEMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7194,7 +7744,7 @@ fi echo $ac_n "checking for return type from write""... $ac_c" 1>&6 -echo "configure:7198: checking for return type from write" >&5 +echo "configure:7748: checking for return type from write" >&5 if eval "test \"`echo '$''{'wi_cv_write_return_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7505,35 +8055,35 @@ echo "$ac_t""$wi_cv_write_return_t" 1>&6 if test "x$used_cache_for_wi_unistd_fpt" = "xno" ; then echo $ac_n "checking for size parameter to write""... $ac_c" 1>&6 -echo "configure:7509: checking for size parameter to write" >&5 +echo "configure:8059: checking for size parameter to write" >&5 echo "$ac_t""$wi_cv_write_size_t" 1>&6 echo $ac_n "checking for return type from send""... $ac_c" 1>&6 -echo "configure:7512: checking for return type from send" >&5 +echo "configure:8062: checking for return type from send" >&5 echo "$ac_t""$wi_cv_send_return_t" 1>&6 echo $ac_n "checking for size parameter to send""... $ac_c" 1>&6 -echo "configure:7515: checking for size parameter to send" >&5 +echo "configure:8065: checking for size parameter to send" >&5 echo "$ac_t""$wi_cv_send_size_t" 1>&6 echo $ac_n "checking for size parameter to connect""... $ac_c" 1>&6 -echo "configure:7518: checking for size parameter to connect" >&5 +echo "configure:8068: checking for size parameter to connect" >&5 echo "$ac_t""$wi_cv_sockaddr_size_t" 1>&6 echo $ac_n "checking for size parameter to setsockopt""... $ac_c" 1>&6 -echo "configure:7521: checking for size parameter to setsockopt" >&5 +echo "configure:8071: checking for size parameter to setsockopt" >&5 echo "$ac_t""$wi_cv_sockopt_size_t" 1>&6 echo $ac_n "checking for backlog parameter to listen""... $ac_c" 1>&6 -echo "configure:7524: checking for backlog parameter to listen" >&5 +echo "configure:8074: checking for backlog parameter to listen" >&5 echo "$ac_t""$wi_cv_listen_backlog_t" 1>&6 echo $ac_n "checking for seconds parameter to alarm""... $ac_c" 1>&6 -echo "configure:7527: checking for seconds parameter to alarm" >&5 +echo "configure:8077: checking for seconds parameter to alarm" >&5 echo "$ac_t""$wi_cv_alarm_time_t" 1>&6 echo $ac_n "checking for address parameter to gethostbyaddr""... $ac_c" 1>&6 -echo "configure:7530: checking for address parameter to gethostbyaddr" >&5 +echo "configure:8080: checking for address parameter to gethostbyaddr" >&5 echo "$ac_t""$wi_cv_gethost_addrptr_t" 1>&6 echo $ac_n "checking for size parameter to gethostname""... $ac_c" 1>&6 -echo "configure:7533: checking for size parameter to gethostname" >&5 +echo "configure:8083: checking for size parameter to gethostname" >&5 echo "$ac_t""$wi_cv_gethostname_size_t" 1>&6 else echo $ac_n "checking for size parameter to write""... $ac_c" 1>&6 -echo "configure:7537: checking for size parameter to write" >&5 +echo "configure:8087: checking for size parameter to write" >&5 if eval "test \"`echo '$''{'wi_cv_write_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7542,7 +8092,7 @@ echo "$ac_t""$wi_cv_write_size_t" 1>&6 echo $ac_n "checking for return type from send""... $ac_c" 1>&6 -echo "configure:7546: checking for return type from send" >&5 +echo "configure:8096: checking for return type from send" >&5 if eval "test \"`echo '$''{'wi_cv_send_return_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7551,7 +8101,7 @@ echo "$ac_t""$wi_cv_send_return_t" 1>&6 echo $ac_n "checking for size parameter to send""... $ac_c" 1>&6 -echo "configure:7555: checking for size parameter to send" >&5 +echo "configure:8105: checking for size parameter to send" >&5 if eval "test \"`echo '$''{'wi_cv_send_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7560,7 +8110,7 @@ echo "$ac_t""$wi_cv_send_size_t" 1>&6 echo $ac_n "checking for size parameter to connect""... $ac_c" 1>&6 -echo "configure:7564: checking for size parameter to connect" >&5 +echo "configure:8114: checking for size parameter to connect" >&5 if eval "test \"`echo '$''{'wi_cv_sockaddr_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7569,7 +8119,7 @@ echo "$ac_t""$wi_cv_sockaddr_size_t" 1>&6 echo $ac_n "checking for size parameter to setsockopt""... $ac_c" 1>&6 -echo "configure:7573: checking for size parameter to setsockopt" >&5 +echo "configure:8123: checking for size parameter to setsockopt" >&5 if eval "test \"`echo '$''{'wi_cv_sockopt_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7578,7 +8128,7 @@ echo "$ac_t""$wi_cv_sockopt_size_t" 1>&6 echo $ac_n "checking for backlog parameter to listen""... $ac_c" 1>&6 -echo "configure:7582: checking for backlog parameter to listen" >&5 +echo "configure:8132: checking for backlog parameter to listen" >&5 if eval "test \"`echo '$''{'wi_cv_listen_backlog_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7587,7 +8137,7 @@ echo "$ac_t""$wi_cv_listen_backlog_t" 1>&6 echo $ac_n "checking for seconds parameter to alarm""... $ac_c" 1>&6 -echo "configure:7591: checking for seconds parameter to alarm" >&5 +echo "configure:8141: checking for seconds parameter to alarm" >&5 if eval "test \"`echo '$''{'wi_cv_alarm_time_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7596,7 +8146,7 @@ echo "$ac_t""$wi_cv_alarm_time_t" 1>&6 echo $ac_n "checking for address parameter to gethostbyaddr""... $ac_c" 1>&6 -echo "configure:7600: checking for address parameter to gethostbyaddr" >&5 +echo "configure:8150: checking for address parameter to gethostbyaddr" >&5 if eval "test \"`echo '$''{'wi_cv_gethost_addrptr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7605,7 +8155,7 @@ echo "$ac_t""$wi_cv_gethost_addrptr_t" 1>&6 echo $ac_n "checking for size parameter to gethostname""... $ac_c" 1>&6 -echo "configure:7609: checking for size parameter to gethostname" >&5 +echo "configure:8159: checking for size parameter to gethostname" >&5 if eval "test \"`echo '$''{'wi_cv_gethostname_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7672,6 +8222,124 @@ EOF +echo $ac_n "checking for negative_control_t""... $ac_c" 1>&6 +echo "configure:8227: checking for negative_control_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_negative_control_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#endif +#include +#if STDC_HEADERS +#include +#include +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])negative_control_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_negative_control_t=yes +else + rm -rf conftest* + ac_cv_type_negative_control_t=no +fi +rm -rf conftest* + +fi +echo "$ac_t""$ac_cv_type_negative_control_t" 1>&6 +if test $ac_cv_type_negative_control_t = no; then + cat >> confdefs.h <<\EOF +#define negative_control_t long +EOF + +fi + +echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 +echo "configure:8265: checking for ssize_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#endif +#include +#if STDC_HEADERS +#include +#include +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_ssize_t=yes +else + rm -rf conftest* + ac_cv_type_ssize_t=no +fi +rm -rf conftest* + +fi +echo "$ac_t""$ac_cv_type_ssize_t" 1>&6 +if test $ac_cv_type_ssize_t = no; then + cat >> confdefs.h <<\EOF +#define ssize_t long +EOF + +fi + +echo $ac_n "checking for sa_family_t""... $ac_c" 1>&6 +echo "configure:8303: checking for sa_family_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_sa_family_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#endif +#include +#if STDC_HEADERS +#include +#include +#endif +#include +#include +#include +#include + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])sa_family_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_sa_family_t=yes +else + rm -rf conftest* + ac_cv_type_sa_family_t=no +fi +rm -rf conftest* + +fi +echo "$ac_t""$ac_cv_type_sa_family_t" 1>&6 +if test $ac_cv_type_sa_family_t = no; then + cat >> confdefs.h <<\EOF +#define sa_family_t unsigned short +EOF + +fi + if test "x$ac_cv_header_unistd_h" = x ; then @@ -7679,7 +8347,7 @@ fi echo $ac_n "checking types of arguments for select()""... $ac_c" 1>&6 -echo "configure:7683: checking types of arguments for select()" >&5 +echo "configure:8351: checking types of arguments for select()" >&5 if eval "test \"`echo '$''{'ac_cv_func_select_arg234'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7693,7 +8361,7 @@ for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8384: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_not_found=no ; break 3 else @@ -7753,14 +8421,14 @@ if test "$wi_cv_lfs64" != "yes" ; then echo $ac_n "checking for struct stat64""... $ac_c" 1>&6 -echo "configure:7757: checking for struct stat64" >&5 +echo "configure:8425: checking for struct stat64" >&5 echo "$ac_t""not needed" 1>&6 wi_cv_struct_stat64=no else echo $ac_n "checking for struct stat64""... $ac_c" 1>&6 -echo "configure:7762: checking for struct stat64" >&5 +echo "configure:8430: checking for struct stat64" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_struct_stat64=yes @@ -7805,9 +8473,9 @@ fi echo $ac_n "checking for sig_atomic_t""... $ac_c" 1>&6 -echo "configure:7809: checking for sig_atomic_t" >&5 +echo "configure:8477: checking for sig_atomic_t" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_type_sig_atomic_t=yes @@ -7856,7 +8524,7 @@ echo $ac_n "checking how to access getopt() global variables""... $ac_c" 1>&6 -echo "configure:7860: checking how to access getopt() global variables" >&5 +echo "configure:8528: checking how to access getopt() global variables" >&5 if eval "test \"`echo '$''{'wi_cv_getopt_decl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7867,7 +8535,7 @@ fi cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8558: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wi_cv_getopt_decl="automatic" else @@ -7901,7 +8569,7 @@ if test "$wi_cv_getopt_decl" = unknown ; then cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # @@ -7959,9 +8627,9 @@ echo $ac_n "checking for useable _res global variable""... $ac_c" 1>&6 -echo "configure:7963: checking for useable _res global variable" >&5 +echo "configure:8631: checking for useable _res global variable" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv__res_defdname=yes @@ -8009,13 +8677,13 @@ echo "$ac_t""$wi_cv__res_defdname" 1>&6 echo $ac_n "checking for struct cmsghdr""... $ac_c" 1>&6 -echo "configure:8013: checking for struct cmsghdr" >&5 +echo "configure:8681: checking for struct cmsghdr" >&5 if eval "test \"`echo '$''{'wi_cv_struct_cmsghdr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_struct_cmsghdr=yes @@ -8062,13 +8730,13 @@ fi echo $ac_n "checking for msg_control field in struct msghdr""... $ac_c" 1>&6 -echo "configure:8066: checking for msg_control field in struct msghdr" >&5 +echo "configure:8734: checking for msg_control field in struct msghdr" >&5 if eval "test \"`echo '$''{'wi_cv_msghdr_control'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_msghdr_control=yes @@ -8114,13 +8782,13 @@ fi echo $ac_n "checking for msg_accrights field in struct msghdr""... $ac_c" 1>&6 -echo "configure:8118: checking for msg_accrights field in struct msghdr" >&5 +echo "configure:8786: checking for msg_accrights field in struct msghdr" >&5 if eval "test \"`echo '$''{'wi_cv_msghdr_accrights'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_msghdr_accrights=yes @@ -8180,17 +8848,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8184: checking for $ac_hdr" >&5 +echo "configure:8852: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8194: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8862: \"$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* @@ -8218,11 +8886,11 @@ if test "$ac_cv_header_sys_select_h" = yes ; then echo $ac_n "checking if is compatible with ""... $ac_c" 1>&6 -echo "configure:8222: checking if is compatible with " >&5 +echo "configure:8890: checking if is compatible with " >&5 selecth=yes if test "$ac_cv_header_sys_time_h" = yes ; then cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8914: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* selecth=yes else @@ -8271,12 +8939,12 @@ for ac_func in getwd do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8275: checking for $ac_func" >&5 +echo "configure:8943: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8971: \"$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 @@ -8327,12 +8995,12 @@ for ac_func in getcwd getwd do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8331: checking for $ac_func" >&5 +echo "configure:8999: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9027: \"$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 @@ -8390,15 +9058,15 @@ echo "configure: warning: and look for anomalies." 1>&2 fi -for ac_func in fstat64 getdomainname gethostname getpass getpassphrase gnu_get_libc_release gnu_get_libc_version inet_aton inet_ntop llseek lseek64 lstat64 memmove mktime open64 pathconf readlink res_init setlocale setpgid setpgrp setsid setvbuf sigaction sigsetjmp stat64 strcasecmp strcoll strdup strerror strncoll strstr strtoq symlink sysconf sysctl sysinfo syslog tcgetattr uname waitpid +for ac_func in fstat64 getdomainname gethostname getpass getpassphrase gnu_get_libc_release gnu_get_libc_version inet_aton inet_ntop llseek lseek64 lstat64 memmove mktime open64 pathconf readlink recvfile res_init sendfile setlocale setpgid setpgrp setsid setvbuf sigaction sigsetjmp stat64 strcasecmp strcoll strdup strerror strncoll strstr strtoq symlink sysconf sysctl sysinfo syslog tcgetattr uname waitpid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8397: checking for $ac_func" >&5 +echo "configure:9065: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9093: \"$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 @@ -8448,12 +9116,12 @@ for ac_func in gethostbyaddr_r gethostbyname_r gethostbyname2_r getlogin_r getpwnam_r _posix_getpwnam_r getpwuid_r _posix_getpwuid_r getservbyname_r getservbyport_r gmtime_r localtime_r readdir_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8452: checking for $ac_func" >&5 +echo "configure:9120: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9148: \"$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 @@ -8507,12 +9175,12 @@ for ac_func in snprintf vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8511: checking for $ac_func" >&5 +echo "configure:9179: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9207: \"$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 @@ -8563,7 +9231,7 @@ if test "$ac_cv_func_snprintf" != "no" ; then echo $ac_n "checking if snprintf works correctly""... $ac_c" 1>&6 -echo "configure:8567: checking if snprintf works correctly" >&5 +echo "configure:9235: checking if snprintf works correctly" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SNPRINTF_TERMINATES." 1>&2; exit 1; } @@ -8582,7 +9250,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -8651,7 +9319,7 @@ echo $ac_n "checking what snprintf() returns""... $ac_c" 1>&6 -echo "configure:8655: checking what snprintf() returns" >&5 +echo "configure:9323: checking what snprintf() returns" >&5 if test "$cross_compiling" = yes; then # action if cross compiling @@ -8661,7 +9329,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -8725,7 +9393,7 @@ if [ "$ac_cv_func_snprintf" = "no" ] || [ "$wi_cv_snprintf_terminates" = "no" ] || [ "$wi_cv_snprintf_returns_ptr" = "yes" ] ; then echo $ac_n "checking for snprintf in -lsnprintf""... $ac_c" 1>&6 -echo "configure:8729: checking for snprintf in -lsnprintf" >&5 +echo "configure:9397: checking for snprintf in -lsnprintf" >&5 ac_lib_var=`echo snprintf'_'snprintf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8733,7 +9401,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsnprintf $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9416: \"$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 @@ -8777,17 +9445,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8781: checking for $ac_hdr" >&5 +echo "configure:9449: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8791: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9459: \"$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* @@ -8816,12 +9484,12 @@ for ac_func in snprintf vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8820: checking for $ac_func" >&5 +echo "configure:9488: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9516: \"$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 @@ -8875,7 +9543,7 @@ if [ "$ac_cv_func_snprintf" = "no" ] || [ "$wi_cv_snprintf_terminates" = "no" ] || [ "$wi_cv_snprintf_returns_ptr" = "yes" ] ; then echo $ac_n "checking for snprintf in -lsnprintf""... $ac_c" 1>&6 -echo "configure:8879: checking for snprintf in -lsnprintf" >&5 +echo "configure:9547: checking for snprintf in -lsnprintf" >&5 ac_lib_var=`echo snprintf'_'snprintf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8883,7 +9551,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsnprintf $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9566: \"$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 @@ -8927,17 +9595,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8931: checking for $ac_hdr" >&5 +echo "configure:9599: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8941: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9609: \"$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* @@ -8966,12 +9634,12 @@ for ac_func in snprintf vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8970: checking for $ac_func" >&5 +echo "configure:9638: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9666: \"$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 @@ -9024,7 +9692,7 @@ if test "$ac_cv_func_snprintf" != "no" ; then echo $ac_n "checking if snprintf works correctly""... $ac_c" 1>&6 -echo "configure:9028: checking if snprintf works correctly" >&5 +echo "configure:9696: checking if snprintf works correctly" >&5 if test "x$ac_cv_header_unistd_h" = x ; then { echo "configure: error: Script needs to check for before calling wi_SNPRINTF_TERMINATES." 1>&2; exit 1; } @@ -9043,7 +9711,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -9112,7 +9780,7 @@ echo $ac_n "checking what snprintf() returns""... $ac_c" 1>&6 -echo "configure:9116: checking what snprintf() returns" >&5 +echo "configure:9784: checking what snprintf() returns" >&5 if test "$cross_compiling" = yes; then # action if cross compiling @@ -9122,7 +9790,7 @@ else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # action if true @@ -9192,14 +9860,14 @@ fi echo $ac_n "checking for sigsetjmp and siglongjmp""... $ac_c" 1>&6 -echo "configure:9196: checking for sigsetjmp and siglongjmp" >&5 +echo "configure:9864: checking for sigsetjmp and siglongjmp" >&5 if eval "test \"`echo '$''{'wi_cv_func_sigsetjmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wi_cv_func_sigsetjmp=yes @@ -9252,12 +9920,12 @@ for ac_func in setpgid setpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:9256: checking for $ac_func" >&5 +echo "configure:9924: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9952: \"$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 @@ -9306,7 +9974,7 @@ fi echo $ac_n "checking if setpgrp behavior needs to be checked""... $ac_c" 1>&6 -echo "configure:9310: checking if setpgrp behavior needs to be checked" >&5 +echo "configure:9978: checking if setpgrp behavior needs to be checked" >&5 if test "x$ac_cv_func_setpgid" = "xyes" ; then # OK, we will be using setpgid instead of setpgrp then... echo "$ac_t""no" 1>&6 @@ -9314,7 +9982,7 @@ elif test "x$cross_compiling" = "xyes" ; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:9318: checking whether setpgrp takes no argument" >&5 +echo "configure:9986: checking whether setpgrp takes no argument" >&5 case "`uname -a`" in *BSD*|*bsd*) ac_cv_func_setpgrp_void="no" @@ -9332,7 +10000,7 @@ # We're not cross compiling, so we can try this check echo "$ac_t""yes" 1>&6 echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:9336: checking whether setpgrp takes no argument" >&5 +echo "configure:10004: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9340,7 +10008,7 @@ { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else @@ -9387,13 +10055,13 @@ echo $ac_n "checking whether setvbuf behavior can be checked""... $ac_c" 1>&6 -echo "configure:9391: checking whether setvbuf behavior can be checked" >&5 +echo "configure:10059: checking whether setvbuf behavior can be checked" >&5 if test "x$cross_compiling" = "xyes" ; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6 -echo "configure:9397: checking whether setvbuf arguments are reversed" >&5 +echo "configure:10065: checking whether setvbuf arguments are reversed" >&5 if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9401,7 +10069,7 @@ ac_cv_func_setvbuf_reversed=no else cat > conftest.$ac_ext < /* If setvbuf has the reversed format, exit 0. */ @@ -9415,7 +10083,7 @@ exit(0); /* Non-reversed systems segv here. */ } EOF -if { (eval echo configure:9419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setvbuf_reversed=yes else @@ -9442,19 +10110,19 @@ # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:9446: checking for working alloca.h" >&5 +echo "configure:10114: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:9458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -9475,12 +10143,12 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:9479: checking for alloca" >&5 +echo "configure:10147: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -9540,12 +10208,12 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:9544: checking whether alloca needs Cray hooks" >&5 +echo "configure:10212: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:9574: checking for $ac_func" >&5 +echo "configure:10242: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10270: \"$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 @@ -9625,7 +10293,7 @@ fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:9629: checking stack direction for C alloca" >&5 +echo "configure:10297: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9633,7 +10301,7 @@ ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -9693,7 +10361,7 @@ fi echo $ac_n "checking string parameter to waddstr""... $ac_c" 1>&6 -echo "configure:9697: checking string parameter to waddstr" >&5 +echo "configure:10365: checking string parameter to waddstr" >&5 if eval "test \"`echo '$''{'wi_cv_waddstr_str_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9897,9 +10565,9 @@ # maxx or _maxx echo $ac_n "checking whether curses structure has maxx or _maxx field""... $ac_c" 1>&6 -echo "configure:9901: checking whether curses structure has maxx or _maxx field" >&5 +echo "configure:10569: checking whether curses structure has maxx or _maxx field" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10602: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""maxx" 1>&6 @@ -9953,12 +10621,12 @@ for ac_func in __getcurx __getcury __getmaxx __getmaxy __getbegx __getbegy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:9957: checking for $ac_func" >&5 +echo "configure:10625: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10653: \"$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 @@ -10009,9 +10677,9 @@ # getcurx echo $ac_n "checking for getcurx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:10013: checking for getcurx() functionality in curses library" >&5 +echo "configure:10681: checking for getcurx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -10063,9 +10731,9 @@ # getyx echo $ac_n "checking for getyx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:10067: checking for getyx() functionality in curses library" >&5 +echo "configure:10735: checking for getyx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -10117,9 +10785,9 @@ # getmaxx echo $ac_n "checking for getmaxx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:10121: checking for getmaxx() functionality in curses library" >&5 +echo "configure:10789: checking for getmaxx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -10170,9 +10838,9 @@ # getmaxyx echo $ac_n "checking for getmaxyx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:10174: checking for getmaxyx() functionality in curses library" >&5 +echo "configure:10842: checking for getmaxyx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -10223,9 +10891,9 @@ # getbegx echo $ac_n "checking for getbegx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:10227: checking for getbegx() functionality in curses library" >&5 +echo "configure:10895: checking for getbegx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -10277,9 +10945,9 @@ # getbegyx echo $ac_n "checking for getbegyx() functionality in curses library""... $ac_c" 1>&6 -echo "configure:10281: checking for getbegyx() functionality in curses library" >&5 +echo "configure:10949: checking for getbegyx() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -10330,9 +10998,9 @@ # touchwin echo $ac_n "checking for touchwin() functionality in curses library""... $ac_c" 1>&6 -echo "configure:10334: checking for touchwin() functionality in curses library" >&5 +echo "configure:11002: checking for touchwin() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -10381,9 +11049,9 @@ # beep echo $ac_n "checking for beep() functionality in curses library""... $ac_c" 1>&6 -echo "configure:10385: checking for beep() functionality in curses library" >&5 +echo "configure:11053: checking for beep() functionality in curses library" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -10432,12 +11100,12 @@ for ac_func in keypad nodelay curs_set doupdate wnoutrefresh do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10436: checking for $ac_func" >&5 +echo "configure:11104: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11132: \"$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 @@ -10497,7 +11165,7 @@ echo $ac_n "checking for long file names""... $ac_c" 1>&6 -echo "configure:10501: checking for long file names" >&5 +echo "configure:11169: 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 @@ -10541,7 +11209,7 @@ fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:10545: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:11213: 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 @@ -10571,7 +11239,7 @@ # Extract the first word of ""gtar"", so it can be a program name with args. set dummy "gtar"; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:10575: checking for $ac_word" >&5 +echo "configure:11243: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10610,7 +11278,7 @@ # Extract the first word of ""tar"", so it can be a program name with args. set dummy "tar"; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:10614: checking for $ac_word" >&5 +echo "configure:11282: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10658,7 +11326,7 @@ echo $ac_n "checking how to create TAR files""... $ac_c" 1>&6 -echo "configure:10662: checking how to create TAR files" >&5 +echo "configure:11330: checking how to create TAR files" >&5 x="" if [ -x /usr/bin/what ] ; then x=`/usr/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'` @@ -10716,7 +11384,7 @@ # 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:10720: checking for $ac_word" >&5 +echo "configure:11388: 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 @@ -10746,7 +11414,7 @@ echo $ac_n "checking for ar""... $ac_c" 1>&6 -echo "configure:10750: checking for ar" >&5 +echo "configure:11418: checking for ar" >&5 AR="ar" if [ "x$cross_compiling" = "xyes" ] ; then machine=`${CC-gcc} -dumpmachine 2>/dev/null` @@ -10777,7 +11445,7 @@ # 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:10781: checking for a BSD compatible install" >&5 +echo "configure:11449: 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 @@ -10833,7 +11501,7 @@ # Extract the first word of ""pwd"", so it can be a program name with args. set dummy "pwd"; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:10837: checking for $ac_word" >&5 +echo "configure:11505: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_wi_PWD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10870,13 +11538,13 @@ if test "x$use_ccdv" = "xno" ; then echo $ac_n "checking for ccdv""... $ac_c" 1>&6 -echo "configure:10874: checking for ccdv" >&5 +echo "configure:11542: checking for ccdv" >&5 echo "$ac_t""(disabled)" 1>&6 else unset wi_cv_path_ccdv # can't use cache if it was a temp prog last time wi_used_cache_path_ccdv="yes" echo $ac_n "checking for ccdv""... $ac_c" 1>&6 -echo "configure:10880: checking for ccdv" >&5 +echo "configure:11548: checking for ccdv" >&5 if eval "test \"`echo '$''{'wi_cv_path_ccdv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10917,7 +11585,7 @@ #define TEXT_BLOCK_SIZE 8192 #define INDENT 2 -#define TERMS "vt100:vt102:vt220:vt320:xterm:xterm-color:ansi:linux:scoterm:scoansi:dtterm:cons25:cygwin:screen" +#define TERMS "vt100:vt102:vt220:vt320:xterm:xterm-color:xterm-256color:ansi:linux:scoterm:scoansi:dtterm:cons25:cygwin:screen" size_t gNBufUsed = 0, gNBufAllocated = 0; char *gBuf = NULL; @@ -11386,7 +12054,7 @@ echo $ac_n "checking if shell can test for symlinks""... $ac_c" 1>&6 -echo "configure:11390: checking if shell can test for symlinks" >&5 +echo "configure:12058: checking if shell can test for symlinks" >&5 if eval "test \"`echo '$''{'wi_cv_shell_test_symlinks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11867,42 +12535,27 @@ q }' Strn/Strncpy.c` -Z00="unknown_id" -Z31='' -if [ -x /sbin/md5 ] ; then - Z00=`hostname | tr '[A-Z]' '[a-z]' | /sbin/md5` -elif [ -x /usr/bin/md5sum ] ; then - Z00=`hostname -f | tr '[A-Z]' '[a-z]' | /usr/bin/md5sum | cut -d ' ' -f1` -fi - -case "$Z00" in - 'e85dfd19937dece65225d717f4cd5f22'|'816c501837158512dc4f606d58f4993b'|'9aa70fa2084f59bab13fe52bdfff65f4') - Z31=' scp -p "$(STGZFILE)" build@Src:src/ncftp/current/ ; mv ncftp-*-src.* /ztmp/' - ;; - -esac - echo $ac_n "checking CC""... $ac_c" 1>&6 -echo "configure:11888: checking CC" >&5 +echo "configure:12541: checking CC" >&5 echo "$ac_t""$CC" 1>&6 echo $ac_n "checking CFLAGS""... $ac_c" 1>&6 -echo "configure:11891: checking CFLAGS" >&5 +echo "configure:12544: checking CFLAGS" >&5 echo "$ac_t""$CFLAGS" 1>&6 echo $ac_n "checking CPPFLAGS""... $ac_c" 1>&6 -echo "configure:11894: checking CPPFLAGS" >&5 +echo "configure:12547: checking CPPFLAGS" >&5 echo "$ac_t""$CPPFLAGS" 1>&6 echo $ac_n "checking DEFS""... $ac_c" 1>&6 -echo "configure:11897: checking DEFS" >&5 +echo "configure:12550: checking DEFS" >&5 echo "$ac_t""$DEFS" 1>&6 echo $ac_n "checking NDEFS""... $ac_c" 1>&6 -echo "configure:11900: checking NDEFS" >&5 +echo "configure:12553: checking NDEFS" >&5 echo "$ac_t""$NDEFS" 1>&6 echo $ac_n "checking LDFLAGS""... $ac_c" 1>&6 -echo "configure:11903: checking LDFLAGS" >&5 +echo "configure:12556: checking LDFLAGS" >&5 echo "$ac_t""$LDFLAGS" 1>&6 echo $ac_n "checking LIBS""... $ac_c" 1>&6 -echo "configure:11906: checking LIBS" >&5 +echo "configure:12559: checking LIBS" >&5 echo "$ac_t""$LIBS" 1>&6 # # Also take the opportunity to do some post-configure clean-up @@ -11928,7 +12581,6 @@ - trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -12062,12 +12714,12 @@ s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g +s%@CC@%$CC%g s%@NDEFS@%$NDEFS%g s%@OS@%$OS%g s%@host@%$host%g s%@SYS@%$SYS%g s%@HOME_OS@%$HOME_OS%g -s%@CC@%$CC%g s%@CPP@%$CPP%g s%@STRIP@%$STRIP%g s%@OBJEXT@%$OBJEXT%g @@ -12096,7 +12748,6 @@ s%@SFLAG@%$SFLAG%g s%@MAKE@%$MAKE%g s%@Z30@%$Z30%g -s%@Z31@%$Z31%g s%@LIBSET@%$LIBSET%g s%@MAINDIR@%$MAINDIR%g s%@NCFTP_VERSION@%$NCFTP_VERSION%g diff -Nru ncftp-3.2.5/configure.in ncftp-3.2.6/configure.in --- ncftp-3.2.5/configure.in 2010-04-07 15:23:14.000000000 +0000 +++ ncftp-3.2.6/configure.in 2016-12-04 18:38:54.000000000 +0000 @@ -20,6 +20,7 @@ dnl --------------------------------------------------------------------------- dnl wi_ENV_VAR_MESSAGES +wi_PROG_CC wi_OS_VAR case "$os" in @@ -30,7 +31,6 @@ if test -f sh/install-sh ; then chmod 755 sh/*.sh sh/config.* sh/install-sh ; fi AC_CONFIG_AUX_DIR([sh]) -AC_PROG_CC wi_CC_PRECOMP wi_REQUEST_NO_Y2K_WARNINGS wi_CFLAGS_LFS_OR_LFS64 @@ -55,7 +55,7 @@ dnl AC_HEADER_STDC dnl Readline headers #ifdefs for string.h, sio needs strings.h for AIX -AC_CHECK_HEADERS(arpa/nameser.h gnu/libc-version.h locale.h net/errno.h nserve.h resolv.h sgtty.h string.h strings.h sys/id.h sys/ioctl.h syslog.h sys/socket.h sys/time.h sys/types.h sys/utsname.h sys/systeminfo.h termio.h termios.h time.h utime.h unistd.h gnu/libc-version.h) +AC_CHECK_HEADERS(arpa/nameser.h gnu/libc-version.h locale.h net/errno.h nserve.h resolv.h sgtty.h string.h strings.h sys/id.h sys/ioctl.h syslog.h sys/sendfile.h sys/socket.h sys/time.h sys/types.h sys/utsname.h sys/systeminfo.h termio.h termios.h time.h utime.h unistd.h gnu/libc-version.h) AC_TIME_WITH_SYS_TIME dnl # sio wi_UNIX_DOMAIN_SOCKETS @@ -77,6 +77,25 @@ dnl wi_NET_LIBS wi_LIB_SOCKS5 +case "$OS" in + solaris8-*) +dnl +dnl Older Solaris 8 versions don't have it, but we try to +dnl manually dynamically load the library if available. +dnl + saved_LIBS="$LIBS" + AC_CHECK_LIB(sendfile,sendfilev) + AC_CHECK_FUNCS(sendfilev sendfilev64) + LIBS="$saved_LIBS" + AC_CHECK_LIB(dl,dlopen) + ;; +changequote(<<, >>)dnl + solaris9-*|solaris1[0-9]-*) +changequote([, ])dnl + AC_CHECK_LIB(sendfile,sendfilev) + AC_CHECK_FUNCS(sendfilev sendfilev64) + ;; +esac LIBCURSES='' if test "$nc_cv_curses" = yes ; then @@ -129,6 +148,13 @@ wi_USE_LONG_LONG wi_STRUCT_TIMEVAL_FIELD_TYPES wi_UNISTD_FUNC_PARAM_TYPES +wi_CHECK_TYPE(negative_control_t, long, []) +wi_CHECK_TYPE(ssize_t, long, []) +wi_CHECK_TYPE(sa_family_t, unsigned short, [#include +#include +#include +#include +]) wi_FUNC_SELECT_ARGTYPES wi_STRUCT_STAT64 wi_TYPE_SIG_ATOMIC_T @@ -146,7 +172,7 @@ dnl --------------------------------------------------------------------------- dnl wi_FUNC_GETCWD -AC_CHECK_FUNCS(fstat64 getdomainname gethostname getpass getpassphrase gnu_get_libc_release gnu_get_libc_version inet_aton inet_ntop llseek lseek64 lstat64 memmove mktime open64 pathconf readlink res_init setlocale setpgid setpgrp setsid setvbuf sigaction sigsetjmp stat64 strcasecmp strcoll strdup strerror strncoll strstr strtoq symlink sysconf sysctl sysinfo syslog tcgetattr uname waitpid) +AC_CHECK_FUNCS(fstat64 getdomainname gethostname getpass getpassphrase gnu_get_libc_release gnu_get_libc_version inet_aton inet_ntop llseek lseek64 lstat64 memmove mktime open64 pathconf readlink recvfile res_init sendfile setlocale setpgid setpgrp setsid setvbuf sigaction sigsetjmp stat64 strcasecmp strcoll strdup strerror strncoll strstr strtoq symlink sysconf sysctl sysinfo syslog tcgetattr uname waitpid) AC_CHECK_FUNCS(gethostbyaddr_r gethostbyname_r gethostbyname2_r getlogin_r getpwnam_r _posix_getpwnam_r getpwuid_r _posix_getpwuid_r getservbyname_r getservbyport_r gmtime_r localtime_r readdir_r) wi_SNPRINTF wi_FUNC_SIGSETJMP @@ -252,21 +278,6 @@ p q }' Strn/Strncpy.c` - -Z00="unknown_id" -Z31='' -if [ -x /sbin/md5 ] ; then - Z00=`hostname | tr '[A-Z]' '[a-z]' | /sbin/md5` -elif [ -x /usr/bin/md5sum ] ; then - Z00=`hostname -f | tr '[A-Z]' '[a-z]' | /usr/bin/md5sum | cut -d ' ' -f1` -fi - -case "$Z00" in - 'e85dfd19937dece65225d717f4cd5f22'|'816c501837158512dc4f606d58f4993b'|'9aa70fa2084f59bab13fe52bdfff65f4') - Z31=' scp -p "$(STGZFILE)" build@Src:src/ncftp/current/ ; mv ncftp-*-src.* /ztmp/' - ;; - -esac changequote([, ])dnl dnl --------------------------------------------------------------------------- @@ -283,7 +294,6 @@ AC_SUBST(DEFS) AC_SUBST(MAKE) AC_SUBST(Z30) -AC_SUBST(Z31) AC_SUBST(LIBSET) AC_SUBST(MAINDIR) AC_SUBST(NCFTP_VERSION) diff -Nru ncftp-3.2.5/debian/changelog ncftp-3.2.6/debian/changelog --- ncftp-3.2.5/debian/changelog 2020-08-18 17:17:17.000000000 +0000 +++ ncftp-3.2.6/debian/changelog 2022-07-17 18:24:42.000000000 +0000 @@ -1,3 +1,16 @@ +ncftp (2:3.2.6-1) unstable; urgency=medium + + * new upstream release from 2016-11-27 ;) + closes: Bug#1006421 + * updated Homepage and watch file closes: Bug#1006423 + * fix tar path in debian/rules. Thanks Simon! closes: Bug#992645 + * include architecture.mk in debian/rules to fix cross building. + Thanks Helmut! closes: Bug#902803 + * raised to debhelper 13 + * updated to Standards-Version 4.6.1 + + -- Noël Köthe Sun, 17 Jul 2022 20:24:42 +0200 + ncftp (2:3.2.5-2.2) unstable; urgency=medium * Non-maintainer upload. @@ -193,7 +206,7 @@ ncftp (2:3.1.1-3) unstable; urgency=low - * Amended debian/control file to detail Readline support. + * Amended debian/control file to detail Readline support. -- Muhammad Hussain Yusuf Sat, 19 Jan 2002 15:32:52 +0000 @@ -207,12 +220,12 @@ * New Upstream Release. * Closes: #128637, #128636 - + -- Muhammad Hussain Yusuf Fri, 11 Jan 2002 11:37:38 +0000 ncftp (2:3.0.4-1) unstable; urgency=low - * New Upstream Release. + * New Upstream Release. * Includes readline patch from Shane Wegner -- Muhammad Hussain Yusuf Thu, 8 Nov 2001 15:06:54 +0000 @@ -239,14 +252,14 @@ ncftp (2:3.0.3-3) unstable; urgency=low - * Enabled Readline support. + * Enabled Readline support. -- Muhammad Hussain Yusuf Thu, 31 May 2001 18:41:10 +0100 ncftp (2:3.0.3-2) unstable; urgency=low * Re-integrated update-alternatives support and compatability with - ncftp2. Closes: #99321, #95893 + ncftp2. Closes: #99321, #95893 -- Muhammad Hussain Yusuf Thu, 31 May 2001 11:15:03 +0100 @@ -274,14 +287,14 @@ * Added menu hint. * Updated to policy 3.5.0.0 * Modified ncftpbookmarks so that "bookmarks" now runs in ncftp, even if - there are no bookmarks. (Closes: #65341) + there are no bookmarks. (Closes: #65341) -- Chris Lawrence Sat, 3 Feb 2001 22:42:23 -0600 ncftp (2:3.0.2-2) unstable; urgency=low * Reenabled readline support, as the FSF claims the Clarified Artistic - License is GPL-compatible. See + License is GPL-compatible. See http://www.gnu.org/philosophy/license-list.html#GPLCompatibleLicenses for details. * Clarify the "not saved" message. (Closes: #81483) @@ -482,4 +495,3 @@ package to try. -- Michael Alan Dorman Wed, 14 Aug 1996 13:23:05 -0400 - diff -Nru ncftp-3.2.5/debian/compat ncftp-3.2.6/debian/compat --- ncftp-3.2.5/debian/compat 2020-08-18 16:51:35.000000000 +0000 +++ ncftp-3.2.6/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -9 diff -Nru ncftp-3.2.5/debian/control ncftp-3.2.6/debian/control --- ncftp-3.2.5/debian/control 2020-08-18 16:51:35.000000000 +0000 +++ ncftp-3.2.6/debian/control 2022-07-17 18:24:42.000000000 +0000 @@ -2,9 +2,10 @@ Section: net Priority: optional Maintainer: Noël Köthe -Build-Depends: debhelper (>> 9.0.0), libncurses5-dev, libreadline-dev -Standards-Version: 3.9.8 -Homepage: http://www.ncftpd.com/ncftp/ +Build-Depends: debhelper-compat (= 13), debhelper (>> 13.0.0), libncurses5-dev, libreadline-dev +Standards-Version: 4.6.1 +Homepage: https://www.ncftp.com/ncftp/ +Rules-Requires-Root: no Package: ncftp Architecture: any @@ -13,4 +14,3 @@ Ncftp allows a user to transfer files to and from a remote network site, and offers additional features that are not found in the standard interface, ftp. This version has Readline support enabled. - diff -Nru ncftp-3.2.5/debian/ncftpbookmarks.1 ncftp-3.2.6/debian/ncftpbookmarks.1 --- ncftp-3.2.5/debian/ncftpbookmarks.1 1970-01-01 00:00:00.000000000 +0000 +++ ncftp-3.2.6/debian/ncftpbookmarks.1 2020-08-18 16:51:35.000000000 +0000 @@ -0,0 +1,55 @@ +.TH ncftpbookmarks 1 2003-07-09 "NcFTP Software" + +.SH NAME +ncftpbookmarks \- full screen bookmarks editor for ncftp + +.SH SYNOPSIS +ncftpbookmarks + +.SH DESCRIPTION +.PP +.I ncftpbookmarks +is a full-screen bookmark editor for the +.I "File Transfer Protocol" +client +.IR "ncftp". +.PP +.I ncftp +can bookmark server name, login name and password +of your favorite ftp servers. +.I ncftpbookmarks +is used to handle these +bookmarks. + +This full-screen editor can also be launched from the ncftp prompt with +the +.I bookmarks +command. + +While using +.IR ncftpbookmarks , +the screen is divided into two parts. +The left one gives a brief description of keyboard controls. +The right one lists all existing bookmarks. +Up and down arrows (or "u" and "d" keys) are used to move the cursor +in this list. +The "x" key is used to quit the editor. +Other commands have to be typed in full (e.g.\& +.IR /ed , +.IR /del ). + +.SH FILES +.IP $HOME/\.ncftp/bookmarks +Saves bookmark and host information. + +.SH AUTHORS +.PP +Mike Gleason, NcFTP Software (mgleason@ncftp.com). + +This man page was written by Nicolas Duboc (nicolas@duboc.net) for +the Debian distribution of the ncftp package. + +.SH "SEE ALSO" +.PP +.IR ncftp (1) + diff -Nru ncftp-3.2.5/debian/patches/ncftpbookmarks.1 ncftp-3.2.6/debian/patches/ncftpbookmarks.1 --- ncftp-3.2.5/debian/patches/ncftpbookmarks.1 2020-08-18 16:51:35.000000000 +0000 +++ ncftp-3.2.6/debian/patches/ncftpbookmarks.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -.TH ncftpbookmarks 1 2003-07-09 "NcFTP Software" - -.SH NAME -ncftpbookmarks \- full screen bookmarks editor for ncftp - -.SH SYNOPSIS -ncftpbookmarks - -.SH DESCRIPTION -.PP -.I ncftpbookmarks -is a full-screen bookmark editor for the -.I "File Transfer Protocol" -client -.IR "ncftp". -.PP -.I ncftp -can bookmark server name, login name and password -of your favorite ftp servers. -.I ncftpbookmarks -is used to handle these -bookmarks. - -This full-screen editor can also be launched from the ncftp prompt with -the -.I bookmarks -command. - -While using -.IR ncftpbookmarks , -the screen is divided into two parts. -The left one gives a brief description of keyboard controls. -The right one lists all existing bookmarks. -Up and down arrows (or "u" and "d" keys) are used to move the cursor -in this list. -The "x" key is used to quit the editor. -Other commands have to be typed in full (e.g.\& -.IR /ed , -.IR /del ). - -.SH FILES -.IP $HOME/\.ncftp/bookmarks -Saves bookmark and host information. - -.SH AUTHORS -.PP -Mike Gleason, NcFTP Software (mgleason@ncftp.com). - -This man page was written by Nicolas Duboc (nicolas@duboc.net) for -the Debian distribution of the ncftp package. - -.SH "SEE ALSO" -.PP -.IR ncftp (1) - diff -Nru ncftp-3.2.5/debian/rules ncftp-3.2.6/debian/rules --- ncftp-3.2.5/debian/rules 2020-08-18 16:51:35.000000000 +0000 +++ ncftp-3.2.6/debian/rules 2022-07-17 18:24:42.000000000 +0000 @@ -3,24 +3,18 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -DEB_HOST_GNU_TYPE ?=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) - -ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) -confflags= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) -else -confflags= --build $(DEB_BUILD_GNU_TYPE) -endif +include /usr/share/dpkg/architecture.mk export DEB_BUILD_MAINT_OPTIONS = hardening=+all DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk CFLAGS += -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall -config.status: +config.status: dh_testdir cp /usr/share/misc/config.guess /usr/share/misc/config.sub . # Add here commands to configure the package. + TAR=/bin/tar \ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure \ --prefix=/usr \ --mandir=\$${prefix}/share/man \ @@ -43,7 +37,7 @@ touch build-stamp -clean: +clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp @@ -78,7 +72,7 @@ dh_installexamples dh_installmenu dh_installcron - dh_installman debian/patches/ncftpbookmarks.1 + dh_installman debian/ncftpbookmarks.1 dh_installinfo dh_installchangelogs doc/CHANGELOG.txt dh_link diff -Nru ncftp-3.2.5/debian/watch ncftp-3.2.6/debian/watch --- ncftp-3.2.5/debian/watch 2020-08-18 16:51:35.000000000 +0000 +++ ncftp-3.2.6/debian/watch 2022-07-17 18:24:42.000000000 +0000 @@ -1,3 +1,2 @@ version=3 -http://www.ncftpd.com/download/ .*/ncftp-(\d.*)-src\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz)) - +https://www.ncftp.com/download/ .*/ncftp-(\d.*)-src\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz)) diff -Nru ncftp-3.2.5/doc/CHANGELOG.txt ncftp-3.2.6/doc/CHANGELOG.txt --- ncftp-3.2.5/doc/CHANGELOG.txt 2010-11-26 23:05:35.000000000 +0000 +++ ncftp-3.2.6/doc/CHANGELOG.txt 2016-12-04 18:59:38.000000000 +0000 @@ -1,6 +1,59 @@ NcFTP Change Log: ================ +3.2.6, 2016-12-04 + + + If a recursive download operation is also requested with delete mode, + attempt to remove empty directories after all files have completed + successfully. + + + No longer trying to utime() after every single block on downloads, + which could cause noticable performance degradation when the local + filesystem was not local. + + + Changed behavior of resuming downloads where the timestamp wasn't + preserved (because of the utime change, above). The new behavior is + to resume the download when the local copy has a recent timestamp + (less than a week). + + + You can now disable use of MFMT like you could similarly disable + SITE UTIME (e.g., "-o noMFMT" and "-o noSITE_UTIME"). + + + Now able to use sendfile() for uploads, on Linux/FreeBSD/Mac. + Progress reports work too, with a small performance penalty. + Ncftpput has a "-s" option to toggle whether it is used (defaults + to on in ncftpput and ncftpbatch, off in ncftp). + + + Ncftpbatch/spooler now use larger buffers for pathnames, allowing + for deeper directory trees. + + + Ncftpbatch/spooler now interpret a received SIGUSR1 as a hint to + exit when the current file has finished. + + + Ncftpbatch/spooler now interpret a received SIGUSR2 to request it + to stop sleeping and recheck the queue immediately. + + + Ncftpbatch/spooler's spool files now allow for you to specify that + the local and/or remote file be renamed after a successful transfer. + + + Ncftpbatch/spooler now a little less chatty by reducing the number + of PWD/CWD operations. + + + Ncftpbatch/spooler now log some xfer stats in its general log file, + and ncftpspooler has a new "-x" option to specify a separate + xfer log file. + + + Ncftpbatch/spooler now use a larger default maximum for its log + file (10 MiB rather than 200 kB), and ncftpspooler has an -O command + line option that can set this limit. Use "-O 0" for no maximum. + + + Ncftpbatch/spooler now try to present time in local timezone rather + than UTC where possible. + + + Ncftpbatch/spooler now support multiple items per transaction + (spool) file. + + 3.2.5, 2011-01-01 + Fixed a problem on Mac OS X Snow Leopard for universal binary support. diff -Nru ncftp-3.2.5/doc/html/bug.html ncftp-3.2.6/doc/html/bug.html --- ncftp-3.2.5/doc/html/bug.html 1970-01-01 00:00:00.000000000 +0000 +++ ncftp-3.2.6/doc/html/bug.html 2003-08-27 19:53:14.000000000 +0000 @@ -0,0 +1,106 @@ + + + +NcFTP Client + + + + +

How to Report Bugs in NcFTP Client

+ +

Because each FTP server program has its own quirks and unique +interpretation of the FTP protocol, most bugs in +NcFTP Client +are caused by an unexpected interaction with a particular type of +server software. +What helps us fix our own bugs or work-around server bugs is the actual FTP +protocol dialogue that was exchanged, and we call this a FTP protocol trace. + +

NcFTP Client (the interactive ncftp program) +automatically stores the trace in the file $HOME/.ncftp/trace. +Simply run ncftp, recreate the problem, quit the program, and +inspect the $HOME/.ncftp/trace file. + +

+The other programs +(ncftpget, +ncftpput, +etc.) have a special command-line option (-d) which saves +the trace to a log file. For example, if your original command was: +

+

    + ncftpget ftp.freebsd.org . /pub/FreeBSD/README.TXT +
+Then here is the same thing, with the trace information saved to +/tmp/ncftpget.log: +

+

    + ncftpget -d /tmp/ncftpget.log ftp.freebsd.org . /pub/FreeBSD/README.TXT +
+ +

A sample $HOME/.ncftp/trace file follows. +When +sending us your bug report, +please include a trace with your e-mail. +This will help us diagnose the problem, and recreate the problem as closely +as possible. + +

+

    +
    SESSION STARTED at:  Wed Aug 27 14:18:41 2003
    +   Program Version:  NcFTP 3.1.6/102 Aug 25 2003, 08:04 PM
    +   Library Version:  LibNcFTP 3.1.6 (August 24, 2003)
    +        Process ID:  1174
    +          Platform:  linux-x86
    +          Hostname:  pc.example.com  (rc=3)
    +          Terminal:  vt100
    +14:18:41  Fw: firewall.example.com  Type: 0  User: joseph  Pass: ********  Port: 21
    +14:18:41  FwExceptions: .example.com,localhost,localdomain
    +14:18:51  > o ftp.example.com
    +
    +14:18:51  Resolving ftp.example.com...
    +14:18:51  Connecting to 172.16.75.25...
    +14:18:51  LibNcFTP 3.1.6 (August 24, 2003) compiled for linux-x86
    +14:18:51  Uname: Linux|pc|2.4.20|#2 SMP Mon Feb 17 15:36:45 CST 2003|i686
    +14:18:51  Glibc: 2.2.4 (stable)
    +14:18:51  Remote server is running wu-ftpd.
    +14:18:51  Logging in...
    +14:18:51  220: ftp.example.com FTP server (Version wu-2.6.1-18) ready.
    +14:18:51  Connected to 172.16.75.25.
    +14:18:51  Cmd: USER anonymous
    +14:18:51  331: Guest login ok, send your complete e-mail address as password.
    +14:18:51  Cmd: PASS joseph@example.com
    +14:18:51  Logging in...
    +14:18:51  230: Guest login ok, access restrictions apply.
    +14:18:51  Cmd: PWD
    +14:18:51  257: "/" is current directory.
    +14:18:51  Logged in to 172.16.75.25 as anonymous.
    +14:19:31  > get secretfile.txt
    +
    +14:19:31  Cmd: SIZE secretfile.txt
    +14:19:31  550: secretfile.txt: No such file or directory.
    +14:19:31  Cmd: PASV
    +14:19:31  227: Entering Passive Mode (172,16,75,25,49,39)
    +14:19:31  Cmd: RETR secretfile.txt
    +14:19:31  550: secretfile.txt: No such file or directory.
    +14:19:44  > quit
    +
    +14:19:46  Cmd: QUIT
    +14:19:46  221: You have transferred 0 bytes in 0 files.
    +14:19:46       Total traffic for this session was 1011 bytes in 0 transfers.
    +14:19:46       Thank you for using the FTP service on ftp.example.com.
    +SESSION ENDED at:    Wed Aug 27 14:19:46 2003
    +
+ + diff -Nru ncftp-3.2.5/doc/html/changelog.html ncftp-3.2.6/doc/html/changelog.html --- ncftp-3.2.5/doc/html/changelog.html 1970-01-01 00:00:00.000000000 +0000 +++ ncftp-3.2.6/doc/html/changelog.html 2011-01-18 04:13:03.000000000 +0000 @@ -0,0 +1,1797 @@ + + + + + NcFTP Client: Change Log + + + + + +

3.2.5, 2011-01-17

+
    + +
  • Fixed a problem on Mac OS X Snow Leopard for universal binary support. +

  • + +
  • ncftpls now prefers that you omit the leading dash when you use the -x +option. For example, if you wanted to try "ls -lrt", then try doing +"ncftpls -x lrt" rather than "ncftpls -x -lrt". +

  • + +
  • If a server's MLSx output returns both the "UNIX.mode" and the "perm" +parameters, UNIX.mode will take precedence (Thanks, Jay Kulpinski). +

  • + +
  • confirm-close is now off by default. +

  • + +
+ + + + +

3.2.4, 2010-04-07

+
    + +
  • Ncftpget and ncftpput can now read $HOME/.ncftp/bookmarks and take a +bookmark name in place of a hostname. If the hostname specified is +not fully qualified (i.e. does not contain a period), then bookmarks +will be queried; if no bookmarks match, then a local hostname is +assumed. Bookmarks are also queried for the config file option, +-f, when the file specified by -f does not exist. +

  • + +
  • Compatibility fixes for FreeBSD 8. +

  • + +
  • Support for local validation of DNSSEC when combined with libraries +available from the DNSSEC Tools project (Thanks, Robert Story). +

  • + +
  • Microsoft disabled recursive directory listings altogether when fixing +KB975254 (Thanks, Andrew Coggeshall). When entire directories are +downloaded, instead of using "LIST -R" for one efficient listing of +all files, the directories are manually traversed with one directory +listing for each subdirectory. This will improve reliability of +recursive downloads, except for the case when their are circular +symbolic links (which is why "LIST -R" had been favored, which the +server can easily handle). +

  • + +
  • Compatibility fixes for Mac OS X for building from source code +(Thanks, Mathieu Rene) +

  • + +
+ + + + +

3.2.3, 2009-07-28

+
    + +
  • Large File Support has been updated internally to use newer APIs, +rather than the transitional API. +

  • + +
  • You can now specify an IP address for binding the local end of +sockets. Useful if you need connections to originate from a +specific IP on the system. +

  • + +
  • Bug fixed where binding an ephemeral port number in a specified +range (rare) may not have used all available retries for binding. +

  • + +
  • Local writes now "retry" when the write returns less than the full +number of bytes specified, and will call write() again to write +out the remaining bytes. This bug is very rare since local write +almost always write out the full number of bytes. This bug may +have been limited to a particular type of filesystem. +

  • + +
  • Using a higher resolution timer on Windows, so that the timer +no longer wraps over after a month. +

  • + +
  • The minimum version of Windows that the source code will now +compile on is Windows 2000, although with a little tweaking you +could compile for Windows NT 4 again. +

  • + +
  • Compatibility fix for Mac OS X when compiling from source to build +universal binaries (Thanks, Toshi NAGATA) +

  • + +
  • Compatibility fix for FreeBSD, where a connection attempt may +have failed with "Operation now in progress." +

  • + +
  • Fixed a bug where the global firewall pref files were not read +if the user's home directory was the root directory. +

  • + +
  • Using MFMT command to set remote timestamps, if available, in +preference to SITE UTIME or MDTM. +

  • + +
  • New configure flag, --enable-ssp, will turn on stack smashing +protection (if available by compiler) by adding to CFLAGS. +

  • + +
  • Host, user, and pass fields have been increased in size. +

  • + +
  • Bug fixed where the firewall preference files were ignored for +the root user. +

  • + +
  • Ncftpls now has a "-Z" option that will disable doing the actual +directory listing. This is useful for use with the "-Y" option +to send a raw FTP command without doing a listing. +

  • + +
+ + + + +

3.2.2, 2008-08-18

+
    + +
  • Fixed an assertion failure in NcFTP's "help" command that appeared +in a 2008-08-09 release. +

  • + +
  • PASV mode will now be retried, in case of a transient failure. +(Thanks, Steven Frank). +

  • + +
  • The directory listing parser now can recognize dates in the format +of YYYY-mm-dd HH:MM[:SS]. +

  • + +
  • Fixed feature detection for WS_FTP servers. +

  • + +
  • Workaround bug in REST on WS_FTP 6.0 (Thanks, Dan Nelson). +

  • + +
  • Fixed a problem where doing a get on a remote file that did not exist, +but a file by the same name existed locally, would err out but truncate +the local file anyway. +

  • + +
  • Fix for ncftpget on Windows to write in binary to stdout when needed +(Thanks, Michael Langguth). +

  • + +
  • HOME, END, and DEL keys may work on more terminal types +(Thanks, Anton Khramov). +

  • + +
  • You can now type just ".." or the absolute path of a directory in +the ncftp command shell to "cd" to the directory (Thanks, Anton +Khramov). +

  • + +
  • Added command aliases "mv" and "ll" which alias to "rename" and "dir" +respectively (Thanks, Anton Khramov). +

  • + +
  • ncftpbatch now has an -L option to specify the name of a log file +to write progress meter output to. Combined with "tail -f", this can +be used to monitor a batch file transfer in progress. +

  • + +
  • On Mac OS X, the configure script will now try to build universal +binaries by default. If you don't want that, pass --disable-universal +to configure. +

  • + +
  • The default connect timeout has been reduced from 30 to 10 seconds to +reflect the increase in the typical user's network speed. +

  • + +
+ + + + +

3.2.1, 2007-07-29

+
    + +
  • Now a little more tolerant of FTP servers who send their internal network +IP addresses in their PASV response. When this is detected, it will be +ignored and the data connection will connect to the same IP that is used +for the control connection. +

  • + +
  • Resuming of uploads can now work for servers that do not support +REST + STOR. The APPE command will be used instead. +

  • + +
  • Fixed problem with Resume All [R!] in ncftp, which was just appending +to subsequent files rather than resuming them. (Thanks, Terry Brown) +

  • + +
  • ncftpput for version 3.2.0 did not work correctly when both -f +and -c/-C were used. This has now been fixed. In addition, the +host command line argument is optional when the config file specifies +the host. +

  • + +
  • Various small fixes. +

  • + +
+ + + + +

3.2.0, 2006-08-05

+
    + +
  • Fixed problem where ncftpbatch may requeue downloads when the local file +was the same as the remote file. +

  • + +
  • ncftpls has been enhanced so that using the new -m option will +have it try a machine-readable list command. These commands need to be +implemented on the remote server for it to work. +

  • + +
  • ncftpls can now try to attempt to filter the files with a wildcard +with the new -i option. For this option to work, this functionality +must be properly implemented in the FTP server software. +

  • + +
  • ncftpls can also now behave similar to /usr/bin/find, with the new -g +option. When invoked with -gg, it appends a slash to directory pathnames +so you can distinguish files from directories. +

  • + +
  • Fixed a problem with ASCII translation where a CR+LF may not have +been converted to the local text EOLN format if the CR+LF was split +over an internal block boundary. The ASCII translation code has +been rewritten so it is also more tolerant of malformatted text, +such as CR+CR+LF end-of-lines. +

  • + +
  • You can now edit remote files, thanks to <jess AT thrysoee.dk>. The +new "edit" command downloads to a temporary file, runs your $EDITOR, +and uploads any changes back to the remote server. Naturally this +requires both read and write permission on the remote server. +

  • + +
  • Handling "~" in paths a little better. Try to expand it to the +remote home directory for remote commands, and the local home directory +for local commands. +

  • + +
  • Progress meters now output to stderr. This eliminates a problem +when using ncftpput with "-c" mode, which would result in a corrupted +file. +

  • + +
  • More careful about trimming the $HOME/.ncftp/log file so it does not +get too small. +

  • + +
  • You can now resume uploads when uploading into a temporary file +(e.g. ncftpput's -S and -T options for using a temporary suffix or prefix). +

  • + +
  • The utility programs' "-X" option has been enhanced so it will +automatically translate some /usr/bin/ftp commands into the raw RFC 959 +FTP protcool commands that are required for this feature. +

  • + +
  • Fixes for Cygwin. +

  • + +
  • Some fixes for largefile support on Windows. +

  • + +
  • You can now resume transfers in ASCII mode, rather than just binary. +

  • + +
  • Fixed a problem with recursive uploads for Windows. +

  • + +
  • Opening a site with a bookmark no longer assumes that the server's +software has the same configuration (i.e. if it did not support SIZE +before, it now checks for SIZE each time rather than assuming each +time the site is opened that the server does not support SIZE). +

  • + +
  • You can now use an empty password if your user account does not have +a password. +

  • + +
  • Fixed a problem in the "ls" implementation for international +month names. +

  • + +
  • Fixed a bug where Type of Service socket options were being set +with IPPROTO_TCP instead of IPPROTO_IP. +

  • + +
+ + + + +

3.1.9, 2005-04-06

+
    + +
  • Renamed internal library function getline() to gl_getline() +to avoid namespace collision with glibc. +

  • + +
  • Renamed internal library function Duration() to FTPDuration() +to avoid namespace collision on Mac OS X. +

  • + +
  • Recognize additional error response codes to SITE UTIME, to prevent +using it if the server doesn't support it. +

  • + +
  • If the server does not support setting timestamps in MDTM, quit +trying it if it fails the first time. +

  • + +
  • Do not allow control characters such as NUL, CR, LF in FTP URLs, to +avoid command injection as described by +Albert Puigsech Galicia <ripe AT 7a69ezine.org>. +

  • + +
  • Fixed a problem where a timed-out transfer may have been detected +but still locked up the process (Thanks, IWAI, Masaharu). +

  • + +
  • Ncftpget and ncftpput now accept a "-C" parameter which is similar +to the "-c" option (ftp "cat" mode), where stdin (stdout) is not used +and the filename is specified as a parameter instead. This is useful +if you don't want to specify a password on the command line. +

  • + +
  • Ncftpput now allows the "-m" option in conjunction with the "-c" or "-C" +options. +

  • + +
  • Small compatibility fixes for Mac OS X, Solaris 10, Linux. +

  • + +
+ + + + +

3.1.8.1, 2004-07-27

+
    + +
  • A fix for some DNS resolution problems on Linux. +

  • + +
+ + + + +

3.1.8, 2004-07-07

+
    + +
  • Ncftpget, ncftpput, and ncftpls now try to erase the arguments to the +-u/-p/-j (user, password, account) options so they do not show in +a "ps" command (Thanks, Konstantin Gavrilenko). +

  • + +
  • Recognize broken IBM mainframe FTP servers and work around them. +

  • + +
  • Working around a problem with ProFTPD 1.2.9 and later which would +cause recursive downloads to fail. +

  • + +
  • Fixed a bug where ncftpput in recursive mode could lock up if you +used a trailing slash on the directory to upload. +

  • + +
  • For the malicious server problem that was addressed in 3.1.5, enhanced +the fix for better compatibility with mainframe FTP servers. +

  • + +
  • Ncftpget, ncftpput, and ncftpls, and ncftp's open command now accept +an additional advanced option (-o) which lets you do things like disable +NcFTP's use of SITE UTIME, FEAT, HELP SITE, etc. +

  • + +
  • Several HP-UX 10 compatibility bugs fixed (Thanks, Laurent FAILLIE). +

  • + +
  • A couple of looping problems with ncftpbatch fixed (Thanks, George Goffe). +

  • + +
  • Bug fixed with the upload socket buffer not being set (Thanks, ybobble). +

  • + +
  • The utility programs now accept "-" for the config file name used +with "-f" to denote standard input (Thanks, Jeremy Monin). +

  • + +
  • Bug fixed with ncftpput when using both -c and -A (Thanks, Ken Woodmansee). +

  • + +
  • Support for boldface text in Windows version (Thanks, Adam Gates). +

  • + +
+ + + + +

3.1.7, 2004-01-07

+
    + +
  • Fixed a memory leak introduced in 3.1.6. +

  • + +
  • Fixed problem where it was assumed that daylight saving's time occurred +at the same time each year for all timezones. +

  • + +
  • Bug fixed with running a shell escape. +

  • + +
  • Ncftpget now uses passive-with-fall-back-to-port mode like ncftpput and +ncftpls. +

  • + +
  • Problem fixed with "ls -a" where occasionally a row with ".." and another +file would be omitted. +

  • + +
  • Ncftpbatch now uses the UTC timezone for spool files. +

  • + +
  • The configure script can now detect when the config.cache file has been +improperly recycled from a machine with a different OS. +

  • + +
  • The Windows version now uses the USERPROFILE environment variable, if it +was set, as the location of the user's home directory. +

  • + +
  • Recognize broken DG/UX servers and work around them. +

  • + +
+ + + + +

3.1.6, 2003-08-25

+
    + +
  • Fixed an important bug that was causing socket leaks on Windows. +

  • + +
  • Added support for GCC 3.4 precompiled headers. +

  • + +
  • Aborting transfers is now more robust. +

  • + +
  • Re-fixed a problem where high ASCII characters at the NcFTP prompt +could cause it to exit. +

  • + +
  • Bug fixed where timeouts may not have worked. +

  • + +
  • To the improved ASCII handling from 3.1.5, added another case where we +workaround files sent by a buggy FTP server implementation whose +files have CR+CR+LF end-of-lines. +

  • + +
  • More fixes related to the above, as well as few other fixes from +Martin Storsj. +

  • + +
  • Bug fixed where an upload filename could have been limited to 127 +characters. +

  • + +
  • Firewall exception hosts are no longer case sensitive. +

  • + +
  • Bug fixed in ncftpput's "-c" option so it works with the "-f" option +(Thanks, ITO Tsuyoshi). +

  • + +
  • Ncftpbatch will now try to temporarily skip a failing host in the +current run (Thanks, Eric Engstrom). +

  • + +
  • Bug fixed where a several minute delay would be incurred if you +tried to transfer a file that did not exist. +

  • + +
  • For the malicious server problem that was addressed in 3.1.5, enhanced +the fix for better compatibility with Serv-U and WS_FTP servers. +

  • + +
+ + + + +

3.1.5, 2002-10-13

+
    + +
  • Problem fixed where a malicious or trojaned FTP server could send back +pathnames with directories different from the directory requested. +For example, if you did: +cd /pub ; +get *.zip +the malicious server could +send back a pathname like ../../../some/other/dir/filename.here +rather than pathnames such as filename.zip and trick NcFTP into writing +into a different local pathname if your user privileges had permission +to write it. +

  • + +
  • Bug fixed where cd messages from remote server were not being displayed. +

  • + +
  • It's now possible to capture the output of the progress reports from +ncftpget/put by redirecting descriptor(s) to a file. Previous releases +required a "tty" to enable progress reports. +

  • + +
  • Compatibility fixes for AIX, Linux, Mac OS X, IRIX 6.2 and SunOS 4. +

  • + +
  • Be less pedantic about incorrectly formatted multi-line responses. +

  • + +
  • Bug fixed where NcFTP could hang at exit. +

  • + +
  • For ASCII transfers, try harder to handle non-native end-of-line formats. +

  • + +
+ + + + +

3.1.4, 2002-07-02

+
    + +
  • Bug fixed in Win32 port which could cause NcFTP to mis-parse output +from Roxen FTP servers. +

  • + +
  • We now try to have ncftpbatch leave a core file for debugging if it +exits with SIGSEGV, SIGBUS, or SIGILL. +

  • + +
  • Fixed(?) an elusive bug which had been present for the past few versions +which could cause ncftpbatch to infinite loop or sleep too long. +

  • + +
  • New configure flag, --disable-ccdv. +

  • + +
  • Compatibility fixes for C++ and Linux. +

  • + +
  • Fixed a socket leak and a crash on Win32. +

  • + +
  • A few minor fixes for firewall logins (Thanks, Jochen Schnapka). +

  • + +
  • By default, proxy connections for PORT are no longer allowed. This is +mostly an extra security precaution, to eliminate cases where someone +could hijack a data connection by connecting to us after we issue PORT +but before the server could connect to us. +

  • + +
  • ncftpls now accepts a "-R" flag which is equivalent to "-x -lR". +

  • + +
  • Bugs fixed in configure script for our "--with-*" arguments +(Thanks, David Kaelbling). +

  • + +
  • A few new firewalls (permutations of type 1). (Thanks, Felix Buenemann) +

  • + +
+ + + + +

3.1.3, 2002-03-27

+
    + +
  • Bug fixed on Solaris where a socket could be left in non-blocking mode. +

  • + +
  • Ls parsing is now more forgiving of weird /bin/ls implementations (AIX). +

  • + +
  • Be more lenient on broken server implementations which include extra +blank lines in the control connection conversation. +

  • + +
  • Fix for ncftpget which was exiting with code 3 if URL mode was used +and the file already existed. +

  • + +
  • Fix for resume prompts which in some cases was printing dates in the +format like "Sun Feb 20:02:15 CST 2002" instead of +"Sun Feb 24 20:02:15 CST 2002". (I.e. the day of the month was +missing.) +

  • + +
  • Compatibility fixes for IRIX 5.x and AIX 4.2.x. +

  • + +
  • Compatibility fixes for Cygwin +(Thanks, Charles Wilson <cwilson AT ece.gatech.edu>). +

  • + +
  • Some extra debugging information is now logged to the trace logs. +

  • + +
  • When running the Windows bookmark editor in standalone mode, the +program may not have launched NcFTP correctly with the selected +bookmark (Thanks, Jochen.Erwied AT mbs-software.de). +

  • + +
+ + + + +

3.1.2, 2002-01-30:

+
    + +
  • A fix for the local hostname detection code which could result with only +the first character of the domain appended, rather than the entire domain +(Thanks, Bernhard Sadlowski <sadlowsk AT mathematik.uni-bielefeld.de>). +

  • + +
  • Another bug fixed in local hostname detection where looking up the host +by IP address was not done correctly. +

  • + +
  • Fixed a few portability problems on HP-UX 10.20 which were introduced +in 3.1.0. +

  • + +
  • Fixed bug with readdir_r usage on Solaris, which could cause crashes +when doing "put -R", among other things. +

  • + +
  • On Linux, use gethostbyname2_r() to specify that we only want IPv4 +addresses returned. +

  • + +
  • Reversing behavior from 3.1.0 where we did a shutdown() on the half +of the socket that wasn't used. We suspect this was causing some +firewalls and routers to panic and assume the whole connection was +to be closed. +

  • + +
  • Bug fixed where an unresolvable hostname caused a pointless connection +attempt which would fail. +

  • + +
  • Shell utilities now print an error message when incompatible flags +are used in conjunction with "-b" or "-c". +

  • + +
  • A few fixes for ncftpbatch. +

  • + +
  • Numerous fixes for SOCKS5. +

  • + +
+ + + + +

3.1.1, 2001-12-23:

+
    + +
  • Fixed bugs with our use of gethostbyname_r/addr_r on Linux. +

  • + +
  • Fixed bugs with our implementation of stat64() on Windows, which caused +problems when querying information about local directories. +

  • + +
  • Source distributions now include install-sh again. +

  • + +
  • Bug fixed with Win32 version of ncftpbookmarks, which could look +in $HOME/.ncftp rather than $HOME/ncftp. Many Win32 users weren't +affected, since the HOME environment variable is not always set. +

  • + +
+ + + + +

3.1.0, 2001-12-17:

+
    + +
  • ACCT is now always sent if the server requests it and you're going +through the firewall. +

  • + +
  • Bug fixed where puts could delay a few seconds unnecessarily after +the file had been sent. +

  • + +
  • Bug fixed where passwords were saved if you chose to autosave bookmarks. +NcFTP also makes an effort to avoid saving passwords in the history +and trace files if you foolishly use passwords on your command lines. +

  • + +
  • Bug fixed on Win32 port where putting a file that did not exist could +cause a crash. +

  • + +
  • The "-r" (recursive) flag is back for "bgget" and "bgput". We now spool +the directory by creating individual spool files for each file in the +directory, which should increase reliability and usability of this feature. +

  • + +
  • The binary packages should be a bit leaner, since ncftpls wasn't getting +stripped. +

  • + +
  • Library optimizations should result in less unneeded code included with +programs that use the libraries. The binaries should be smaller as a +result. +

  • + +
  • Recursive uploading has been substantially reworked. "put -R" should now +work better, especially on the Win32 port. Arbitrary pathname sizes have +also been removed, so directory trees should only be limited by available +memory and stack space. +

  • + +
  • Huge number of lint fixes. NcFTP now compiles cleanly on several +platforms even with extra warning options enabled. +

  • + +
  • Large number of internal changes to the configure scripts. +

  • + +
  • Using my cool hack, "ccdv", in Makefiles. Originally this became a +necessity since some platforms could have $CFLAGS 4 or 5 lines long! +Besides streamlining the build process so that lint warnings can +easily be spotted, the builds are pleasing to the eye with ANSI color +if your $TERM supports it. +

  • + +
  • Fixed bug where Win32 $HOME bug fixed for 3.0.4 wasn't fixed for +ncftpbookmarks. +

  • + +
  • Fixes for large file support for the Win32 port. +

  • + +
  • Bugs fixed in Win32 port of ncftpbatch. +

  • + +
  • A few bug fixes for getline. +

  • + +
  • The default ASCII extensions list no longer include ".sh", since Sun +apparently distributes the JDK as a shell script with binary data +appended. +

  • + +
+ + + + +

3.0.4, 2001-10-24:

+
    + +
  • Workaround new "feature" of glibc which defines printf as a macro if +gcc is version 2.97 or later. +

  • + +
  • Bug fixed from 3.0.3 that caused ^Z (suspend) to quit ncftp when it +was brought back to the foreground. +

  • + +
  • Bug fixed where large file support (LFS) was disabled on most systems. +

  • + +
  • New "ncftpspooler" utility program (actually a hard link to +"ncftpbatch") serves as a "Global batch FTP job processor daemon." +

  • + +
  • The utility program ncftpget now has a "-c" flag like ncftpput has. +

  • + +
  • Utility programs can now accept more than one -W/-X/-Y option, if +multiple commands are needed. +

  • + +
  • When changing directories, programs will try to change to the full path +first, then fall back to using "change one subdir at a time" mode. +

  • + +
  • Bug fixed where using the "delete local file after upload" option +and the "upload into temp file, then rename" option, the local file +would get deleted anyway if the rename failed. +

  • + +
  • Compatibility fixes for HP-UX. +

  • + +
  • Internal limits increased to handle longer command lines and more parameters. +

  • + +
  • Improvement to the reliability of the Win32 version by using the +_snprintf and _vsnprintf functions rather than sprintf and vsprintf. +

  • + +
  • A few more tweaks for MS-DOS pathname compatibility. +

  • + +
  • A tweak for better compatibility with Microsoft IIS. +

  • + +
  • A few tweaks for Cygwin support. +

  • + +
  • Fixes for --sysconfdir configure option courtesy of Christian Wiesgerber. +

  • + +
  • SOCKS5 is back in, but we don't support it. +

  • + +
  • Improved Y2K bug detection in remote servers. +

  • + +
  • Changed naming format for bgget/put spool files. The contents are now +documented; see the ncftpspooler man page. +

  • + +
  • Bug fixed in Win32 port which used $HOME rather than $HOME/ncftp as the +UNIX equivalent of the $HOME/.ncftp directory. Since most folks won't +have a $HOME environment variable on Win32, you'll probably not notice +the change. +

  • + +
+ + + + +

3.0.3, 2001-04-11:

+
    + +
  • Preference options can now be "file" completed on the command line with +the set/show/prefs commands. +

  • + +
  • NcFTP directory changes are now always one subdirectory at a time, for +better portability on remote servers with non-UNIX filesystems. +

  • + +
  • NcFTP tries to maintain the current directory itself, like /bin/ksh and +Bash do, which means that symlinks remain part of the current working +directory when possible. For example, on ftp.freesoftware.com if your +current directory is /pub and you "cd linux", NcFTP will use /pub/linux +as the current directory, even though the canonical directory on the +server is /.0/linux. This is also useful for things like Linux's +Kernel.org mirrors, so if you bgget a kernel.tar.gz file the "virtual" +current directory is used rather than a specific-machine's layout. +

  • + +
  • Mac OS X support added. No Mac or Aqua specific features yet. +

  • + +
  • NcFTP now has an option to automatically use ASCII mode for transfers +if the file's extension corresponds to a textual data file type. +

  • + +
  • Using homegrown gl_getpass in place of getpass() and getpassphrase for +all platforms, not just Windows.. +

  • + +
  • Incorporating a few getline suggestions from Ken Cox. +

  • + +
  • Configuration tweaks for Cygwin port. +

  • + +
  • Removed some arbitrary buffer size limits. +

  • + +
  • Lint fixes. +

  • + +
  • Curses configuration fixes for HP-UX. +

  • + +
  • Shell utilities now have a "-bb" flag which is just like "-b" only +the job is submitted only (and no ncftpbatch is spawned). +

  • + +
  • More problems fixed with interaction with Windows FTP servers. +

  • + +
  • Better compatibility with non-standard extensions to the FTP which +allow for TCP Large Windows (specifically, SITE BUFSIZE). +

  • + +
  • Win32 port had a bug which leaked file handles. +

  • + +
  • Miscellaneous Win32 port fixes. +

  • + +
  • Changed default anonymous password to NcFTP@, since no one really cares +any more about using a real e-mail address. +

  • + +
  • Bug fixed where some types of servers' features might not be queried. +

  • + +
  • Fixed some inconsistencies with the -a and -A flags among NcFTP and the +shell utilities. "-a" is now ASCII mode across the board, and "-A" is +the flag to use for append mode (which not many people use anyway). +

  • + +
  • Bug fixed where the flag for delete after upload (-DD) was being +ignored. +

  • + +
  • You can now do "set yes-i-know-about-NcFTPd yes" from a NcFTP prompt to get +it to quit plugging NcFTPd every 7th time you run the program. +

  • + +
  • Like the system-wide /etc/ncftp.firewall and /etc/ncftp.firewall.fixed +files for global preferences, there is now the equivalent for regular +preference files (/etc/ncftp.prefs_v3 and /etc/ncftp.prefs_v3.fixed). +

  • + +
  • The ncftpbatch spool files now support some additional options for sending +additional FTP commands. The options are called "pre-command", +"post-command", and "per-file-command". This is useful if you need to +send some odd SITE command before transfer, for example. +

  • + +
  • Similarly, ncftpget and ncftpput have new -W/-X/-Y switches so you can +send pre/each/post commands. (i.e. "-W SITE MY_WEIRD_IBM_MAINFRAME_OPTION"). +

  • + +
  • Bug fixed where NcFTP was not taking advantage of re-using a currently +open host when exiting and launching ncftpbatch. If you bgget a file +from within NcFTP, then exit while the host is still connected, +ncftpbatch is supposed to inherit that existing context without having +to reopen the host. +

  • + +
  • When using a URL with ncftpget, you can do "-a" to have it use ASCII. +Prior versions forced to you use the little-known URL syntax to specify +ASCII mode (btw, example of that is "ftp://ftp.foo.com/pub/README.TXT;a") +

  • + +
  • Bug fixed where our handling of the TCP_NODELAY option was not getting +enabled. +

  • + +
  • A few tweaks for C++ compatibility. +

  • + +
+ + + + +

3.0.2, 2000-10-18:

+
    + +
  • Fixed bug introduced in 3.0.1 which stripped off the leading slash +for the directory parameter of ncftpget and ncftpput. +

  • + +
  • Problem where NcFTP would not timeout a hung data transfer fixed. +

  • + +
  • Improved support for large files (> 2 GB). +

  • + +
  • Increased some internal buffers to handle longer response lines. +

  • + +
  • Pagers are now enabled on the Win32 port. +

  • + +
  • Format bug in quote and site commands fixed. +

  • + +
  • Possibly fix problem with Solaris 2.5 complaining about "pollable +event." +

  • + +
  • Win32 port bug fixed where NcFTP was not stripping off the quotation +marks on your HOME or NCFTPDIR environment variable. +

  • + +
  • Fixed bug where your firewall information could be ignored. +

  • + +
  • Utilities now accept a "-j" flag for an account (ACCT) if you need +to use that in addition to a USER and PASSword. +

  • + +
  • License has been changed. +

  • + +
+ + + + +

3.0.1, 2000-03-27:

+
    + +
  • ncftpput has been changed to cd to the destination directory on the +remote host before storing files. In addition, it does it one +subdirectory node at a time, like URL mode does for ncftpget. +

  • + +
  • Bug fixed where the "ncftpbookmarks --dimensions-terse" hack could +be closed and generate a SIGPIPE which caused it to exit uncleanly, +and possibly leave the terminal state hosed. +

  • + +
  • Added a snippet from Felix von Leitner <leitner AT fefe.de> to get the +terminal width fairly painlessly, so the aforementioned hack should +not be necessary in many cases. +

  • + +
  • Dtterm and vt220 added to the short list of vt100ish term types. +

  • + +
  • Win32 version bug fixed where ncftpbookmarks was not honoring the +HOME enviornment variable, instead writing data to the install +directory under Program Files. +

  • + +
  • Win32 version now uses Wise installer instead of InstallShield. +

  • + +
+ + + + +

3.0.0, 2000-03-19:

+
    + +
  • New "redial-delay" preference setting, so you can easily set it and +forget it rather than doing "-r 30" on each open. +

  • + +
  • NcFTP's "file exists" prompt now includes options to apply the same +action to all files in the batch. This should alleviate concerns by +users who didn't want to babysit NcFTP through a large batch of files +which exist locally. +

  • + +
  • Work around Y2K bug in old wu-ftpd servers. +

  • + +
  • Work around broken Novell 5.00 ftp servers. +

  • + +
  • Fixed a getline problem where entering a character with the high-bit +set would cause NcFTP to exit. +

  • + +
  • NcFTP now no longer complains when you redirect a file into it as stdin. +

  • + +
  • NcFTP's getline now recognizes alternate escape sequences for the arrow +keys. +

  • + +
  • NcFTP now allows a user to cancel an mget at the "file exists" prompt. +

  • + +
  • Continue redialing if the server returns a bad user reply, since +some servers do their "too many users logged in check" at that time. +

  • + +
  • Try harder to display remote connect banner. +

  • + +
  • Fixed bug in remote mkdir which would fail if the subdirectory was in +the root directory. +

  • + +
  • A few small memory leaks plugged. +

  • + +
  • Try to remove extraneous slashes from paths when possible, since Win32 +doesn't like them. +

  • + +
  • Win32 version tries harder to sleep the actual number of seconds +requested even if means busy waiting, since Sleep() may return +immediately if the system has nothing else to do. +

  • + +
  • Win32 version now checks for a HOME or NCFTPDIR environment variable. +

  • + +
  • Win32 version of ncftpbookmarks no longer locks up when trying to +send a bookmark back to NcFTP. +

  • + +
  • The firewall password no longer echoes to the screen on the Win32 version. +

  • + +
  • NcFTP tries harder to get the actual screen width so that getline +can use the whole line for input. ncftpbookmarks has to be built +and installed where NcFTP can find it for this ugly hack to work. +

  • + +
  • NcFTP now sends your anonymous password to batch jobs, rather than +having NcFTPBatch compute a default value. +

  • + +
  • Shell utilities now default to PASV-then-PORT mode like NcFTP does, +rather than use PORT only. +

  • + +
  • NcFTPGet and Put are now better about reporting a server error, +rather than simply printing the worthless "could not start data +transfer" message. +

  • + +
  • Getline now handles emacs ^W sequence. +

  • + +
  • Included HTML versions of the manual pages. This is mostly for the +Win32 port. +

  • + +
  • Bug fixed in ncftpls which was printing lines with \r\n instead of +just \n. +

  • + +
  • NcFTP 3 is now covered by the Artistic License. See the LICENSE.txt +file for details. +

  • + +
  • The "prefs" file is now called "prefs_v3" for better coexistence with +NcFTP 2. +

  • + +
  • Win32 (Windows 95/98/NT) supported natively! You can download a pre-fab +Setup, or build it yourself from the same source base that is used for +UNIX. +

  • + +
  • Readline is out, Getline is in! +

  • + +
  • Using my "sio" library in conjunction with LibNcFTP. This was done +to be consistent with other platforms, which don't use alarm() and +signal handline. +

  • + +
  • Change of licensing. Specifically, GPL was shown the door. NcFTP is, +has always been, and will continue to be free software. +

  • + +
  • Firewall type 6 bug fixed. +

  • + +
  • "put -f" fixed. +

  • + +
  • When the server asks for a password, NcFTP will print the text, in case +you need that for a one-time password scheme like S/Key. +

  • + +
  • "get -R" asks for all files by using the equivalent of /bin/ls -lRa on +the remote server. +

  • + +
  • A couple of small fixes for Cygwin, although in light of native support +for Windows this seems moot. +

  • + +
  • Changed behavior so when auto-resume is off (still the default) +NcFTP will automatically continue without prompting if the remote +file's size and timestamp exactly match an existing local file. +This will make auto-resume=no a more friendly default, since you'll +still get prompted when the files differ, but won't bother you +like beta 18 did if the files are the same. +

  • + +
  • Bug fixed where "get -f" on an existing file would still have the +existing file prompt come up. +

  • + +
  • Work around bug with "-s" linker flag on IRIX 6.5. +

  • + +
  • Small fixes to support Mac OS X Server. +

  • + +
  • Using inet_ntop function if available to work around IRIX +DNS resolution problems. +

  • + +
  • NcFTP's "rm -r" fixed to better handle empty directories and .dotfiles. +

  • + +
  • Using SITE RETRBUFSIZE/RBUFSIZ/STORBUFSIZE/SBUFSIZ commands, if +available, to try and coordinate large TCP window support between +client and server. +

  • + +
  • Special case the IIS FTP server, so if it prints directory listings +in DOS mode, then NcFTP can parse them for file completion. +

  • + +
  • A few more changes for Cygwin/32. +

  • + +
  • Workaround definition of "lines" by AIX headers. +

  • + +
  • Yet another permutation of firewall added. +

  • + +
  • NcFTP 3 now keeps a simple transfer log like NcFTP 2 did. +

  • + +
  • Bug fixed in ncftpbatch which was looping if the file to get already +existed and was identical to the remote file. +

  • + +
  • Local commands now work better with wildcards. +

  • + +
  • Bug fixed where one of the firewall handlers was not prompting you +for your firewall password. +

  • + +
  • Bug fixed where logging in succeeded but NcFTP could not "pwd" +caused a crash. +

  • + +
  • You can now "ncftp -F" to dump a new firewall configuration template +to stdout. +

  • + +
  • Bug fixed which caused downloads from servers other than wu-ftpd and +NcFTPd to skip the first byte in the file. +

  • + +
  • NcFTP's new prompting-before-transferring feature had a bug which +occasionally caused it to detect a non-existant remote file as +existant. +

  • + +
  • New feature: NcFTP now prompts you by default when you try to +get/put a file that already exists. +

  • + +
  • A few resume bugs fixed in both get and put. +

  • + +
  • New "jobs" command to list any running "ncftpbatch" tasks. +

  • + +
  • Shell utilities now honor the ~/.ncftp/firewall file so they +can use the firewall settings. +

  • + +
  • If you're using the global version of the .firewall file, +as /etc/ncftp.firewall, you can also set the "passive" setting +in there. +

  • + +
  • Better large-file support for FreeBSD. +

  • + +
  • Capitulated to using the "install" utility in the Makefile. +

  • + +
  • Using autoconf-2.13 and new functionality to assist in configuring +for UNIX on Win32 environments. +

  • + +
  • Avoiding problems in Solaris 7 headers which cause curses to not +be autodetected. +

  • + +
  • Various improvements in FTP engine, including new support for +proposed FTP standard.. +

  • + +
  • TCP Large Window support, for those of you with obnoxiously large +pipes to the internet. Use the new "so-bufsize" option for "set", +and "-B" options with ncftpget/put. +

  • + +
  • NcFTP now notes the server type, when possible, and works-around +problems with certain ones. +

  • + +
  • NcFTP now does timestamp checking in addition to size checking to +determine when to reget/reput. NcFTP 2 did this, but NcFTP 3 will +not be as aggressive to reduce the number of timezone synchronization +problems. +

  • + +
  • Fixed a problem where if the remote server suddenly disconnected +NcFTP would report the wrong error. +

  • + +
  • NcFTP tries to print a message when it doesn't need to get a file. +

  • + +
  • Fixed more problems related to NcFTP being inconsistent about printing +startup messages and responses from the remote server. +

  • + +
  • User names, passwords, and accounts maximum length extended. +

  • + +
  • NcFTP now tries reput by default (ncftpput still does not). +

  • + +
  • Bug fixed in ncftpbatch which caused relative directory paths on +the second and successive transfers on the same host to fail. +

  • + +
  • ncftpbatch now unspools an entry if a directory did not exist at +connect time. +

  • + +
  • Account option added to shell utilties. +

  • + +
  • More readline band-aids. +

  • + +
  • --bindir change was not pointing to ncftpbatch correctly. +

  • + +
  • "get -R -a" is now detected and treated as "get -R". +

  • + +
  • getpassphrase() function is used in place of getpass(), where available. +

  • + +
  • NcFTP can now cope with cd'ing to unreadable directories. +

  • + +
  • The curses support (i.e. ncftpbookmarks) is now much more portable (for +example, FreeBSD 3, SunOS 4, BSD/OS). Still, your best bet is to install +ncurses if you can. At least one system's curses (HP-UX) compiles fine +but doesn't work worth jack, so use ncurses there. +

  • + +
  • Firewall not being used correctly when you ran NcFTP with a host from the +shell command-line. +

  • + +
  • Bug fixed where 32 spaces were being printed before running the pager. +

  • + +
  • configure now recognizes --bindir. +

  • + +
  • NcFTP now tries to print "server said" for a server related error, +so NcFTP quits getting blamed for server problems. +

  • + +
  • More readline band-aids. +

  • + +
  • Rare problem fixed where a null pointer was being passed to a socket +library function was causing core dumps and, in some cases, kernel +panics. +

  • + +
  • Problem fixed with the new auto-TAR feature if the directory to download +was a first level directory. +

  • + +
  • When auto-TAR mode is on, you can tell in the progress meter. +

  • + +
  • When auto-TAR is used for the first time, a one-time message is printed. +

  • + +
  • Bug fixed when using -R with a directory URL. +

  • + +
  • Doing a better job about displaying login and welcome messages. +

  • + +
  • Memory leak found and fixed. +

  • + +
  • Failed logins as non-anonymous no longer continue redialing and refailing. +

  • + +
  • Problem fixed where firewall user's firewall password could be logged +in the trace log. +

  • + +
  • URLs displayed include the port number, if non-standard. +

  • + +
  • ncftpbatch resets it's exponential waiting period. +

  • + +
  • Problem fixed where uploading invalid files wasn't considered an error. +

  • + +
  • Local filesystem commands (lmkdir, etc) weren't handling files with +spaces in them correctly. +

  • + +
  • Firewall Type 5 now works. +

  • + +
  • "cd" command now properly recognizes a wildcard. +

  • + +
  • NcFTP was failing to report an error when a wildcard did not match anything. +

  • + +
  • Progress reports on downloads had a bug where it wouldn't update as often +as it should have been. +

  • + +
  • A "put" on a short file is now more likely to errout with a timeout +error when the remote host is not responsive. +

  • + +
  • Bookmarks and commands now readline-complete without regards to case +sensitivity. +

  • + +
  • Big change again -- NcFTP now automatically tries to take advantage of +servers that do on-the-fly TAR. NcFTP can dynamically fallback to the +regular, non-TAR method when needed, so this should be somewhat +transparent. You can tell when NcFTP uses TAR when the progress +meter shows only a directory being downloaded, instead of individual +items within the directory tree. Of course the advantage to using +TAR mode is that the exact timestamps, permissions, etc can be +preserved, as well as reducing the number of total connections to the +server. +

  • + +
  • Bug fixed for regular get -R mode, which was causing failures on +some servers. +

  • + +
  • There is a now a "local directory" field for bookmarks. This is only +settable using the Bookmark Editor. +

  • + +
  • Bug fixed where NcFTP wouldn't always fallback to PORT from PASV. +

  • + +
  • Bug fixed where NcFTP was not handling relative pathnames with more +than one node correctly (i.e. "foo" was okay, but "foo/bar" was not.) +

  • + +
  • The "-@" flag has been enhanced a little so it accepts a few more +types of date/time specifications. +

  • + +
  • Bug fixed where NcFTP could be fooled into thinking a bookmark was not +saved. +

  • + +
  • Trying harder to print the host list if the Bookmark Editor is not +installed. +

  • + +
  • Main usage message was not always printed. +

  • + +
  • Small tweaks to the progress meters. +

  • + +
  • Shell utilities now identify themselves using CLNT command. +

  • + +
  • Completion bug fixed where a "/" was being appended for bookmarks and +commands. +

  • + +
  • Big change -- curses is back, in limited form. The bookmark editor +runs as the fullscreen applet that NcFTP 2.4 has. It is a separate +program now (ncftpbookmarks) which is run by NcFTP (or you can run +it in stand-alone mode). Note that if you have problems getting +the curses support to work, you do NOT have to build ncftpbookmarks. +To do that, remove the config.cache file and +"./configure --disable-curses". +

  • + +
  • Bookmark completion and command name completion added. +

  • + +
  • Recursive remote deletes are now possible (i.e. rm -r). +

  • + +
  • Shell command ("!") back. +

  • + +
  • Bug fixed where NcFTP would ignore ls output from OS/2 servers. +

  • + +
  • Bug fixed where a trailing slash was confusing put -R. +

  • + +
  • Bug fixed where a trailing slash was confusing file completion. +

  • + +
  • ncftpget and ncftpput now have a "-b" flag which lets you submit +a batch job to ncftpbatch. Now you don't need to run ncftp, +open the site, and do bgget commands. +

  • + +
  • NcFTP now accepts URLs with the open command. +

  • + +
  • A bit more lenient when using directory URLs with NcFTP without the +proper trailing slash. +

  • + +
  • Various small configure script bugs fixed. +

  • + +
  • Another problem with Auto-resume-downloads fixed. +

  • + +
  • The xterm title setting feature is now configurable from "prefs" and +is off by default. +

  • + +
  • Problem fixed where files newer than the current date could be listed +as the year before. +

  • + +
  • Small firewall support problem fixed. +

  • + +
  • Several problems with Auto-resume-downloads fixed. +

  • + +
  • Several problems with Redial fixed. It is on by default -- let me know +the specifics if it fails. +

  • + +
  • Problem fixed where a multiple get would try re-downloading files +over and over again. +

  • + +
  • Problem fixed where if a multiple get failed the files that were downloaded +successfully were deleted. +

  • + +
  • Bug fixed where "get -R" would create files as directories. +

  • + +
  • Master source drive lost -- some things had to be restored from backup +and rebuilt entirely (such as the configure script stuff). So, many things +which were fixed may suddenly be un-fixed again. +

  • + +
  • Readline completion works with local directories and remote symlinks. +

  • + +
  • NcFTP recovers better from aborted transfers. +

  • + +
  • New signal handling, which will hopefully have the same behavior across +platforms. +

  • + +
  • A few minor firewall problems fixed. +

  • + +
  • You can now have system-wide firewall settings stored in /etc/ncftp.firewall +and /etc/ncftp.firewall.fixed, if you create them from a ~/.ncftp/firewall +file. +

  • + +
  • You can now spool transfers to FTP servers on non-standard ports. +

  • + +
  • NcFTP now changes your xterm window title. +

  • + +
  • Bug fixed with spool files using the firewall's IP number. +

  • + +
  • ncftpbatch now works on case-insensitive filesystems. +

  • + +
  • configure's readline check now runs the test program to be sure it was +linked correctly. +

  • + +
  • Bug fixed that was introduced in b8 that caused a crash after a transfer. +

  • + +
  • Readline completion with <TAB><TAB> should work better. +

  • + +
  • Bookmark lookups changed to full bookmark name only. +

  • + +
  • Configure bug where scanf("%qd") wasn't checked right. +

  • + +
  • Bug fix that broke the firewall support that used to work in Beta 6. +

  • + +
  • Bug fixes with RESTarting. +

  • + +
  • Smarter about using 64-bit or 32-bit mode (long longs or longs). +

  • + +
  • Yet another firewall added. +

  • + +
  • Fixes for HP-UX. +

  • + +
  • Readline 2.1 dependency worked around, so that Readline 2.0 is useable. +

  • + +
  • Unsupported -J flag added to use an ACCT name. +

  • + +
  • Uses NcFTPd's new "CLNT" command to specify FTP client type. +

  • + +
  • Hack so "open -u host" works like it did in earlier versions of NcFTP. +

  • + +
  • Should now be able to retrieve very large files (> 2 gig), depending +on the libc and OS. +

  • + +
  • Namespace collision with GNU libc fixed (errno field). +

  • + +
  • get -R xxx now creates a ./xxx directory instead of dropping xxx/* +in the local directory. +

  • + +
  • New firewall type added. +

  • + +
  • Many file completion tweaks. +

  • + +
  • Another bug fixed where ASCII mode was getting turned on. +

  • + +
  • If you use a firewall, the firewall is now responsible for resolving +host names. +

  • + +
  • Bug fixed with bgget/bgput with absolute pathnames. +

  • + +
  • Plug frequency reduced. +

  • + +
  • Bug fixed where command-line switches were not overriding bookmark settings. +

  • + +
  • Bug fixed where "set" commands were not taking effect until the current +connection was closed. +

  • + +
  • StatBar progress meter revised. +

  • + +
  • ncftp_batch back-off revised. +

  • + +
  • ncftpget transfer type bug fixed. +

  • + +
  • Bookmark command bug fixed. +

  • + +
  • Bug with bookmarks fixed that could save the transfer type as ASCII. +

  • + +
  • Symlink hidden command added (only works with NcFTPd). +

  • + +
  • Including man page for ncftpls +

  • + +
  • Mkdir dirties cache +

  • + +
  • site and quote fixed +

  • + +
  • Fixes for AIX 4.1 +

  • + +
  • Bug in put -R fixed. +

  • + +
  • Bug fixed that caused pdir/pls to act like ls. +

  • + +
  • Fixes for SunOS. +

  • + +
  • ncftpls added. +

  • + +
  • The philbar is back; you can now choose it as a progress meter +if you don't like the statbar. +

  • + +
  • Checking for ncftpbatch before trying to run it. +

  • + +
  • Try not to use Readline when it is older than 2.0, or when its headers +aren't installed correctly. +

  • + +
  • Fix for get -R, which could cause a crash during the post-downloading +cleanup. +

  • + +
  • A little extra tracing for the firewall code. +

  • + +
  • Fix for unrecognized ls flags that would cause a crash. +

  • + +
  • NcFTP 3.0 prefers GNU Readline version 2.1, but it should now also +work with version 2.0. +

  • + +
  • A few portability/lint fixes. +

  • + +
+ + diff -Nru ncftp-3.2.5/doc/html/faq.html ncftp-3.2.6/doc/html/faq.html --- ncftp-3.2.5/doc/html/faq.html 1970-01-01 00:00:00.000000000 +0000 +++ ncftp-3.2.6/doc/html/faq.html 2009-03-21 17:46:33.000000000 +0000 @@ -0,0 +1,182 @@ + + + + NcFTP Client: Frequently Asked Questions + + + +

Documentation Links

+ +

+You can also download the source code or compiled executables which contain the documentation. + +

Frequently Asked Questions about NcFTP

+
    + +
  1. +

    Q. +Is there a registration or licensing fee to use +NcFTP Client? +

    A. +No, it is free! +We would appreciate a donation if you find it useful. Your support allows us to keep maintaining the project! +

    +

    +

    + + + + +
    +
    +
  2. + +

    +
    +

  3. +

    Q. +How do I connect to a non-standard port number? +

    A. +Use the -P option (i.e. +ncftp -P 2121 ftp.example.com). +This works with all the programs +as well as the open command in the NcFTP shell. +

  4. + +

    +
    +

  5. +

    Q. +Does NcFTP support any secure FTP modes a la SFTP/SSL/SSH Tunnels? +

    A. +NcFTP does not have any built-in support for encryption or secure +FTP of any type. +We do not support any type of interaction with hacks such as FTP +over SSH tunnels. +We may implement a secure FTP mode at a future date, but please +do not ask for an ETA. +

  6. + +

    +
    +

  7. +

    Q. +How do I login to a server using a regular username instead of anonymous? +

    A. +Use the -u option (i.e. +ncftp -u joeuser ftp.example.com). +This works with all the programs +as well as the open command in the NcFTP shell. +

  8. + +

    +
    +

  9. +

    Q. +Do the utility programs +(ncftpget, +ncftpput, +ncftpls, +ncftpbatch) +use my preferences or bookmarks files in $HOME/.ncftp? +

    A. +No. The utility programs have a complete set of command-line +switches and the current behavior is to require the user to +explicity choose each option needed. +

  10. + +

    +
    +

  11. +

    Q. +How do I change NcFTP's redial delay from 20 seconds? +

    A. +From within the NcFTP shell, you can simply do +set redial-delay 60 to set it to 60 seconds. +When using the utility programs, you need to use the +-r flag to specify both the number of redials +and the redial delay, such as +ncftpget -r 3,60 ... which would try 3 dials with +a delay of 60 seconds between each. +

    Note that you cannot change what ncftpbatch uses, +since it is uses an internal algorithm to wait progressively +longer between redials. +

  12. + +

    +
    +

  13. +

    Q. +How do I make the default behavior to always ask for a username/password +rather than using anonymous logins? +

    A. +Sorry, you can't do that unless you want to hack on the source code. +

  14. + +

    +
    +

  15. +

    Q. +My macros from NcFTP 2 or NcFTP 1 do not work with NcFTP version 3! +

    A. +We removed that feature as it was unnecessary bloat which 99% of the +users were not using. +Besides, you should use the command-line utility programs if you need +to do any kind of automation. +

  16. + +

    +
    +

  17. +

    Q. +NcFTP doesn't always preserve the timestamps of downloaded files. +When using other client programs to download the identical file from +the same server, they are preserving the timestamp. +

    A. +Those client programs are probably parsing the date and time from the +directory listing. +That should not be done because most servers use local time +for their directory listings rather than GMT. +NcFTP would rather preserve the timestamps only when the server implements +MDTM, which requires that the time be in GMT. This guarantees that +if the time is preserved, it is the correct time, and not some +half-assed guess which could be hours off. +

  18. + +

    +
    +

  19. +

    Q. +What happened to Visual Mode like NcFTP 2.4.3 used? +

    A. +That was removed because of too many problems with the Curses library. +Specifically, there were too many bugs, ambiguities, and missing +features with various implementations of curses. +

    However, NcFTP 3 still tries to use curses for the +bookmark editor, ncftpbookmarks. +When you do an open without a hostname from the +NcFTP shell, you will get the +visual bookmark editor if it could be compiled and installed. +This way, if curses is too broken, you can build and run +the NcFTP shell without it. +

  20. + +

    +
    +

  21. +

    Q. +NcFTP's command-line editor seems to work differently than +the one with Bash. +

    A. +That's because NcFTP doesn't use GNU Readline by default. +

  22. + +
+ diff -Nru ncftp-3.2.5/doc/html/index.html ncftp-3.2.6/doc/html/index.html --- ncftp-3.2.5/doc/html/index.html 2001-10-24 22:29:37.000000000 +0000 +++ ncftp-3.2.6/doc/html/index.html 2012-09-11 16:17:17.000000000 +0000 @@ -7,6 +7,9 @@

Documentation:

+
+

+

+ + + + +
+
+

Online Resources

diff -Nru ncftp-3.2.5/doc/html/ncftpbatch.html ncftp-3.2.6/doc/html/ncftpbatch.html --- ncftp-3.2.5/doc/html/ncftpbatch.html 2006-08-05 18:41:03.000000000 +0000 +++ ncftp-3.2.6/doc/html/ncftpbatch.html 2012-09-11 15:59:02.000000000 +0000 @@ -28,17 +28,10 @@

- - - - - - - - - - - + + + +
@@ -64,7 +57,7 @@
-D
This is like -d, except that the process does not -become a daemon. +become a background daemon process.
diff -Nru ncftp-3.2.5/doc/html/ncftpget.html ncftp-3.2.6/doc/html/ncftpget.html --- ncftp-3.2.5/doc/html/ncftpget.html 2010-04-06 16:36:21.000000000 +0000 +++ ncftp-3.2.6/doc/html/ncftpget.html 2012-09-11 15:59:09.000000000 +0000 @@ -24,17 +24,10 @@

- - - - - - - - - - - + + + +
diff -Nru ncftp-3.2.5/doc/html/ncftp.html ncftp-3.2.6/doc/html/ncftp.html --- ncftp-3.2.5/doc/html/ncftp.html 2010-04-06 20:13:05.000000000 +0000 +++ ncftp-3.2.6/doc/html/ncftp.html 2012-09-11 15:58:40.000000000 +0000 @@ -44,17 +44,10 @@

- - - - - - - - - - - + + + +
diff -Nru ncftp-3.2.5/doc/html/ncftpls.html ncftp-3.2.6/doc/html/ncftpls.html --- ncftp-3.2.5/doc/html/ncftpls.html 2006-03-13 20:03:01.000000000 +0000 +++ ncftp-3.2.6/doc/html/ncftpls.html 2012-09-11 15:59:50.000000000 +0000 @@ -15,6 +15,17 @@ ncftpls [options] ftp://url.style/host/path/name/ + +
+

+

+ + + + +
+
+

Options

Command line flags:
diff -Nru ncftp-3.2.5/doc/html/ncftpput.html ncftp-3.2.6/doc/html/ncftpput.html --- ncftp-3.2.5/doc/html/ncftpput.html 2010-04-08 00:32:31.000000000 +0000 +++ ncftp-3.2.6/doc/html/ncftpput.html 2012-09-11 16:00:08.000000000 +0000 @@ -25,22 +25,17 @@

ncftpput -C remote-host local-path-name remote-path-name

+

- - - - - - - - - - - + + + +
+

Options

Command line flags:
diff -Nru ncftp-3.2.5/doc/html/ncftpspooler.html ncftp-3.2.6/doc/html/ncftpspooler.html --- ncftp-3.2.5/doc/html/ncftpspooler.html 2006-08-05 18:41:37.000000000 +0000 +++ ncftp-3.2.6/doc/html/ncftpspooler.html 2012-09-11 16:00:17.000000000 +0000 @@ -22,20 +22,14 @@ ncftpspooler -l [options]

+

- - - - - - - - - - - + + + +
@@ -54,6 +48,11 @@

+

-D
+
This is like -d, except that the process does not +become a background daemon process. +
+
-q XX
Use this option to specify a directory to use as the FTP job queue instead of the default directory, diff -Nru ncftp-3.2.5/doc/manifest ncftp-3.2.6/doc/manifest --- ncftp-3.2.5/doc/manifest 2011-02-02 23:17:35.000000000 +0000 +++ ncftp-3.2.6/doc/manifest 2016-12-04 19:00:34.000000000 +0000 @@ -5,6 +5,9 @@ configure.in doc/CHANGELOG.txt doc/FIREWALLS_AND_PROXIES.txt +doc/html/bug.html +doc/html/changelog.html +doc/html/faq.html doc/html/index.html doc/html/ncftp.html doc/html/ncftpbatch.html @@ -65,6 +68,8 @@ libncftp/io_putfiles.c libncftp/io_putmem.c libncftp/io_putonefile.c +libncftp/io_sendfile.c +libncftp/io_sendfile.h libncftp/io_util.c libncftp/lglob.c libncftp/lglobr.c @@ -142,6 +147,8 @@ ncftp/ncftp.dsw ncftp/ncftp.ico ncftp/ncftp.vcproj +ncftp/ncftp.xcodeproj/project.pbxproj +ncftp/ncftp.xcodeproj/project.xcworkspace/contents.xcworkspacedata ncftp/pref.c ncftp/pref.h ncftp/preffw.c @@ -178,6 +185,7 @@ sh/mksrctar.sh sh/mksrczip.bat sh/ncftpput_schedule.sh +sh/ncftpspooler_add_file_to_upload.pl sh/unix2dos.sh sh/winsetver.pl sh_util/gpshare.c @@ -308,5 +316,6 @@ win/bmed/util.c win/bmed/util.h win/setup/ncftp.wse +win/setup/setup.nsi win/setup/Windows Installer Wizard/NcFTP/NcFTP.sln win/setup/Windows Installer Wizard/NcFTP/NcFTP.vdproj diff -Nru ncftp-3.2.5/doc/manifest.txt ncftp-3.2.6/doc/manifest.txt --- ncftp-3.2.5/doc/manifest.txt 2011-02-02 23:17:35.000000000 +0000 +++ ncftp-3.2.6/doc/manifest.txt 2016-12-04 19:00:34.000000000 +0000 @@ -5,6 +5,9 @@ configure.in doc/CHANGELOG.txt doc/FIREWALLS_AND_PROXIES.txt +doc/html/bug.html +doc/html/changelog.html +doc/html/faq.html doc/html/index.html doc/html/ncftp.html doc/html/ncftpbatch.html @@ -65,6 +68,8 @@ libncftp/io_putfiles.c libncftp/io_putmem.c libncftp/io_putonefile.c +libncftp/io_sendfile.c +libncftp/io_sendfile.h libncftp/io_util.c libncftp/lglob.c libncftp/lglobr.c @@ -142,6 +147,8 @@ ncftp/ncftp.dsw ncftp/ncftp.ico ncftp/ncftp.vcproj +ncftp/ncftp.xcodeproj/project.pbxproj +ncftp/ncftp.xcodeproj/project.xcworkspace/contents.xcworkspacedata ncftp/pref.c ncftp/pref.h ncftp/preffw.c @@ -178,6 +185,7 @@ sh/mksrctar.sh sh/mksrczip.bat sh/ncftpput_schedule.sh +sh/ncftpspooler_add_file_to_upload.pl sh/unix2dos.sh sh/winsetver.pl sh_util/gpshare.c @@ -308,5 +316,6 @@ win/bmed/util.c win/bmed/util.h win/setup/ncftp.wse +win/setup/setup.nsi win/setup/Windows Installer Wizard/NcFTP/NcFTP.sln win/setup/Windows Installer Wizard/NcFTP/NcFTP.vdproj diff -Nru ncftp-3.2.5/doc/readme_windows.txt ncftp-3.2.6/doc/readme_windows.txt --- ncftp-3.2.5/doc/readme_windows.txt 2006-08-05 22:31:02.000000000 +0000 +++ ncftp-3.2.6/doc/readme_windows.txt 2016-10-23 18:14:40.000000000 +0000 @@ -2,8 +2,6 @@ Transfer Protocol. It's been around for UNIX for quite some time now (circa 1992) and many people still use the program and contribute suggestions and feedback. -There have also been unofficial ports of NcFTP for -Windows, but this is the first official port. The main program is simply called "ncftp". There are also separate utility programs for one-shot FTP @@ -21,9 +19,7 @@ to manipulate user's FTP bookmarks. As always, your feedback and input is welcome; Visit -http://www.ncftp.com/support/ . Unfortunately I can't -guarantee a response due to the volume of mail, so I -thank you in advance. +http://www.ncftp.com/support/ . If you are one of the many people since 1992 to find NcFTP Client useful, we would appreciate a donation, diff -Nru ncftp-3.2.5/libncftp/c_chdir.c ncftp-3.2.6/libncftp/c_chdir.c --- ncftp-3.2.5/libncftp/c_chdir.c 2010-04-06 16:09:51.000000000 +0000 +++ ncftp-3.2.6/libncftp/c_chdir.c 2015-09-26 03:10:16.000000000 +0000 @@ -32,6 +32,8 @@ result = FTPCmd(cip, "CWD %s", cdCwd); if (result >= 0) { if (result == 2) { + if (cip->currentWorkingDirectory != NULL) + cip->currentWorkingDirectory[0] = '\0'; /* Invalidate pwd cache. */ result = kNoErr; } else { result = kErrCWDFailed; diff -Nru ncftp-3.2.5/libncftp/c_chdirlist.c ncftp-3.2.6/libncftp/c_chdirlist.c --- ncftp-3.2.5/libncftp/c_chdirlist.c 2008-07-14 00:43:38.000000000 +0000 +++ ncftp-3.2.6/libncftp/c_chdirlist.c 2016-10-30 17:38:00.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif int FTPChdirList(FTPCIPtr cip, FTPLineListPtr const cdlist, char *const newCwd, const size_t newCwdSize, int flags) diff -Nru ncftp-3.2.5/libncftp/c_getcwd.c ncftp-3.2.6/libncftp/c_getcwd.c --- ncftp-3.2.5/libncftp/c_getcwd.c 2005-01-01 21:28:46.000000000 +0000 +++ ncftp-3.2.6/libncftp/c_getcwd.c 2015-09-26 03:20:12.000000000 +0000 @@ -25,6 +25,11 @@ if ((newCwd == NULL) || (newCwdSize == 0)) { result = kErrInvalidDirParam; cip->errNo = kErrInvalidDirParam; + } else if ((cip->currentWorkingDirectory != NULL) && (cip->currentWorkingDirectory[0] != '\0')) { + /* Already have it cached. */ + if (newCwd != cip->currentWorkingDirectory) + (void) Strncpy(newCwd, cip->currentWorkingDirectory, newCwdSize); + result = kNoErr; } else { rp = InitResponse(); if (rp == NULL) { @@ -33,6 +38,10 @@ FTPLogError(cip, kDontPerror, "Malloc failed.\n"); } else { result = RCmd(cip, rp, "PWD"); + if (cip->currentWorkingDirectory != NULL) { + cip->currentWorkingDirectory[0] = '\0'; + cip->currentWorkingDirectory[cip->currentWorkingDirectorySize - 2] = '\0'; + } if (result == 2) { if ((r = strrchr(rp->msg.first->line, '"')) != NULL) { /* "xxxx" is current directory. @@ -42,7 +51,10 @@ if ((l != NULL) && (l != r)) { *r = '\0'; ++l; - (void) Strncpy(newCwd, l, newCwdSize); + if (cip->currentWorkingDirectory != NULL) + (void) Strncpy(cip->currentWorkingDirectory, l, cip->currentWorkingDirectorySize); + if (newCwd != cip->currentWorkingDirectory) + (void) Strncpy(newCwd, l, newCwdSize); *r = '"'; /* Restore, so response prints correctly. */ } } else { @@ -51,7 +63,10 @@ */ if ((r = strchr(rp->msg.first->line, ' ')) != NULL) { *r = '\0'; - (void) Strncpy(newCwd, (rp->msg.first->line), newCwdSize); + if (cip->currentWorkingDirectory != NULL) + (void) Strncpy(cip->currentWorkingDirectory, (rp->msg.first->line), cip->currentWorkingDirectorySize); + if (newCwd != cip->currentWorkingDirectory) + (void) Strncpy(newCwd, (rp->msg.first->line), newCwdSize); *r = ' '; /* Restore, so response prints correctly. */ } } @@ -63,6 +78,14 @@ DoneWithResponse(cip, rp); } } + if (result == kNoErr) { + if (cip->currentWorkingDirectory[cip->currentWorkingDirectorySize - 2] != '\0') { + cip->currentWorkingDirectory[0] = '\0'; + result = kErrPathTooLong; + } + if (newCwd[newCwdSize - 2] != '\0') + result = kErrPathTooLong; + } return (result); } /* FTPGetCWD */ @@ -100,6 +123,8 @@ else result = RCmd(cip, rp, "CWD %s", cdCwd); if (result == 2) { + if (cip->currentWorkingDirectory != NULL) + cip->currentWorkingDirectory[0] = '\0'; /* Invalidate pwd cache. */ l = strchr(rp->msg.first->line, '"'); if ((l == rp->msg.first->line) && ((r = strrchr(rp->msg.first->line, '"')) != NULL) && (l != r)) { /* "xxxx" is current directory. @@ -109,7 +134,10 @@ */ *r = '\0'; ++l; - (void) Strncpy(newCwd, l, newCwdSize); + if (cip->currentWorkingDirectory != NULL) + (void) Strncpy(cip->currentWorkingDirectory, l, cip->currentWorkingDirectorySize); + if (newCwd != cip->currentWorkingDirectory) + (void) Strncpy(newCwd, l, newCwdSize); *r = '"'; /* Restore, so response prints correctly. */ DoneWithResponse(cip, rp); result = kNoErr; diff -Nru ncftp-3.2.5/libncftp/c_opennologin.c ncftp-3.2.6/libncftp/c_opennologin.c --- ncftp-3.2.5/libncftp/c_opennologin.c 2005-01-01 21:28:55.000000000 +0000 +++ ncftp-3.2.6/libncftp/c_opennologin.c 2016-11-13 00:36:30.000000000 +0000 @@ -77,10 +77,10 @@ elapsed = (int) (t1 - t0); if (elapsed < cip->redialDelay) { PrintF(cip, "Sleeping %u seconds.\n", - (unsigned) cip->redialDelay - elapsed); + (unsigned int) (cip->redialDelay - elapsed)); if (cip->redialStatusProc != 0) (*cip->redialStatusProc)(cip, kRedialStatusSleeping, cip->redialDelay - elapsed); - (void) sleep((unsigned) cip->redialDelay - elapsed); + (void) sleep((unsigned int) (cip->redialDelay - elapsed)); } } } diff -Nru ncftp-3.2.5/libncftp/c_rmdirr.c ncftp-3.2.6/libncftp/c_rmdirr.c --- ncftp-3.2.5/libncftp/c_rmdirr.c 2005-01-01 21:29:05.000000000 +0000 +++ ncftp-3.2.6/libncftp/c_rmdirr.c 2013-01-04 18:06:46.000000000 +0000 @@ -11,7 +11,7 @@ #endif static int -FTPRmdirRecursiveL2(const FTPCIPtr cip) +FTPRmdirRecursiveL2(const FTPCIPtr cip, const int rmEmptyDirsOnly) { FTPLineList fileList; FTPLinePtr filePtr; @@ -36,11 +36,11 @@ if ((file[0] == '.') && ((file[1] == '\0') || ((file[1] == '.') && (file[2] == '\0')))) continue; /* Skip . and .. */ - if (FTPChdir(cip, file) == kNoErr) { + if (FTPIsDir(cip, file) > 0) { /* It was a directory. * Go in and wax it. */ - result = FTPRmdirRecursiveL2(cip); + result = FTPRmdirRecursiveL2(cip, rmEmptyDirsOnly); if (FTPChdir(cip, "..") != kNoErr) { /* Panic -- we can no longer @@ -61,9 +61,11 @@ * directory. Perhaps we screwed up * and the directory wasn't empty. */ - return (result); + if (rmEmptyDirsOnly == 0) + return (result); + /* else keep trying to remove empty dirs */ } - } else { + } else if (rmEmptyDirsOnly == 0) { /* Assume it was a file -- remove it. */ result = FTPDelete(cip, file, kRecursiveNo, kGlobNo); /* Try continuing to remove the rest, @@ -79,19 +81,24 @@ int -FTPRmdirRecursive(const FTPCIPtr cip, const char *const dir) +FTPRmdirRecursive2(const FTPCIPtr cip, const char *const dir, const int rmEmptyDirsOnly) { int result, result2; /* Preserve old working directory. */ (void) FTPGetCWD(cip, cip->buf, cip->bufSize); + result = FTPIsDir(cip, dir); + if (result != kNoErr) { + return (result); + } + result = FTPChdir(cip, dir); if (result != kNoErr) { return (result); } - result = FTPRmdirRecursiveL2(cip); + result = FTPRmdirRecursiveL2(cip, rmEmptyDirsOnly); if (FTPChdir(cip, cip->buf) != kNoErr) { /* Could not cd back to the original user directory -- bad. */ @@ -110,4 +117,12 @@ result = result2; return (result); +} /* FTPRmdirRecursive2 */ + + + +int +FTPRmdirRecursive(const FTPCIPtr cip, const char *const dir) +{ + return (FTPRmdirRecursive2(cip, dir, 0)); } /* FTPRmdirRecursive */ diff -Nru ncftp-3.2.5/libncftp/c_size.c ncftp-3.2.6/libncftp/c_size.c --- ncftp-3.2.5/libncftp/c_size.c 2008-07-14 00:43:21.000000000 +0000 +++ ncftp-3.2.6/libncftp/c_size.c 2016-10-30 17:37:37.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif /* If the remote host supports the SIZE command, we can find out the exact * size of a remote file, depending on the transfer type in use. SIZE diff -Nru ncftp-3.2.5/libncftp/c_utime.c ncftp-3.2.6/libncftp/c_utime.c --- ncftp-3.2.5/libncftp/c_utime.c 2009-01-28 17:24:14.000000000 +0000 +++ ncftp-3.2.6/libncftp/c_utime.c 2016-10-30 17:24:54.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif static void GmTimeStr(char *const dst, const size_t dstsize, time_t t) @@ -24,16 +26,25 @@ #ifdef HAVE_SNPRINTF buf[sizeof(buf) - 1] = '\0'; (void) snprintf(buf, sizeof(buf) - 1, "%04d%02d%02d%02d%02d%02d", + /* YYYYMMDDhhmmss */ + gt.tm_year + 1900, + gt.tm_mon + 1, + gt.tm_mday, + gt.tm_hour, + gt.tm_min, + gt.tm_sec + ); #else (void) sprintf(buf, "%04d%02d%02d%02d%02d%02d", + /* YYYYMMDDhhmmss */ + gt.tm_year + 1900, + gt.tm_mon + 1, + gt.tm_mday, + gt.tm_hour, + gt.tm_min, + gt.tm_sec + ); #endif - gt.tm_year + 1900, - gt.tm_mon + 1, - gt.tm_mday, - gt.tm_hour, - gt.tm_min, - gt.tm_sec - ); (void) Strncpy(dst, buf, dstsize); } } /* GmTimeStr */ diff -Nru ncftp-3.2.5/libncftp/errno.c ncftp-3.2.6/libncftp/errno.c --- ncftp-3.2.5/libncftp/errno.c 2010-04-07 23:24:18.000000000 +0000 +++ ncftp-3.2.6/libncftp/errno.c 2015-09-26 02:29:05.000000000 +0000 @@ -118,6 +118,7 @@ "ascii seek error", /* -204 */ "you have encountered a bug that we have not fixed yet, sorry!",/* -205 */ "could not bind the control connection socket", /* -206 */ + "pathname too long (internal buffer too small to hold it)", /* -207 */ NULL, }; diff -Nru ncftp-3.2.5/libncftp/ftp.c ncftp-3.2.6/libncftp/ftp.c --- ncftp-3.2.5/libncftp/ftp.c 2009-10-23 23:31:22.000000000 +0000 +++ ncftp-3.2.6/libncftp/ftp.c 2016-11-15 20:26:02.000000000 +0000 @@ -10,12 +10,21 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif const char gLibNcFTPVersion[] = kLibraryVersion; #ifdef NO_SIGNALS +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-const-variable" +#endif static const char gNoSignalsMarker[] = "@(#) LibNcFTP - NO_SIGNALS"; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #else static int gGotSig = 0; @@ -29,7 +38,14 @@ #ifndef lint +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-const-variable" +#endif static const char gCopyright[] = "@(#) LibNcFTP Copyright 1995-2001, by Mike Gleason. All rights reserved."; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #endif #ifdef HAVE_LIBSOCKS5 @@ -208,7 +224,7 @@ cip->servCtlAddr.sin_addr.s_addr = ip_address.s_addr; } else { hpok = 1; - cip->servCtlAddr.sin_family = hp.h_addrtype; + cip->servCtlAddr.sin_family = (sa_family_t) hp.h_addrtype; /* We'll fill in the rest of the structure below. */ } @@ -544,7 +560,7 @@ if ((hpok == 0) || (hp.h_name == NULL)) (void) STRNCPY(cip->actualHost, fhost); else - (void) STRNCPY(cip->actualHost, (char *) hp.h_name); + (void) STRNCPY(cip->actualHost, (const char *) hp.h_name); /* Read the startup message from the server. */ rp = InitResponse(); @@ -978,6 +994,7 @@ int setsbufs; size_t rbs, sbs; int passiveAttemptsRemaining = cip->maxNumberOfSuccessivePASVAttempts; + char servDataAddrStr[64]; /* Before we can transfer any data, and before we even ask the * remote server to start transferring via RETR/NLST/etc, we have @@ -1085,6 +1102,7 @@ goto bad; } FTPFixServerDataAddr(cip); + AddrToAddrStr(servDataAddrStr, sizeof(servDataAddrStr), &cip->servDataAddr, 0, NULL); #ifdef HAVE_LIBSOCKS cip->ourDataAddr.sin_port = 0; @@ -1105,13 +1123,14 @@ if (result == kTimeoutErr) { if (mode == kFallBackToSendPortMode) { - FTPLogError(cip, kDontPerror, "Data connection timed out.\n"); + FTPLogError(cip, kDontPerror, "Data connection to %s timed out.\n", servDataAddrStr); if (passiveAttemptsRemaining == 0) { - FTPLogError(cip, kDontPerror, "Falling back to PORT instead of PASV mode.\n"); (void) DisposeSocket(dataSocket); dataSocket = kClosedFileDescriptor; if (cip->hasPASV == kCommandAvailabilityUnknown) cip->hasPASV = kCommandNotAvailable; + if (cip->hasPASV == kCommandNotAvailable) + FTPLogError(cip, kDontPerror, "Falling back to PORT instead of PASV mode.\n"); goto tryPort2; } } else { @@ -1145,19 +1164,21 @@ goto bad; } if ((mode == kFallBackToSendPortMode) && (passiveAttemptsRemaining == 0)) { - FTPLogError(cip, kDoPerror, "connect failed.\n"); - FTPLogError(cip, kDontPerror, "Falling back to PORT instead of PASV mode.\n"); + FTPLogError(cip, kDoPerror, "connect to %s failed.\n", servDataAddrStr); (void) DisposeSocket(dataSocket); dataSocket = kClosedFileDescriptor; if (cip->hasPASV == kCommandAvailabilityUnknown) cip->hasPASV = kCommandNotAvailable; + if (cip->hasPASV == kCommandNotAvailable) + FTPLogError(cip, kDontPerror, "Falling back to PORT instead of PASV mode.\n"); goto tryPort2; } - FTPLogError(cip, kDoPerror, "connect failed.\n"); + FTPLogError(cip, kDoPerror, "connect to %s failed.\n", servDataAddrStr); result = kErrConnectDataSocket; cip->errNo = kErrConnectDataSocket; } else { /* Success, break loop because we do not need to do PASV again. */ + PrintF(cip, "Connected to %s for PASV.\n", servDataAddrStr); break; } diff -Nru ncftp-3.2.5/libncftp/ftw.c ncftp-3.2.6/libncftp/ftw.c --- ncftp-3.2.5/libncftp/ftw.c 2006-06-19 00:53:03.000000000 +0000 +++ ncftp-3.2.6/libncftp/ftw.c 2016-11-13 00:35:25.000000000 +0000 @@ -14,6 +14,11 @@ # pragma hdrstop #endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + /* Internal to ftw.c */ typedef struct FtwSubDirList *FtwSubDirListPtr; typedef struct FtwSubDirList { @@ -23,6 +28,10 @@ char name[1]; } FtwSubDirList; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + struct dirent *Readdir(DIR *const dir, struct dirent *const dp, const size_t sz); @@ -172,7 +181,7 @@ static int -FtwTraverse(const FtwInfoPtr ftwip, size_t dirPathLen, int depth) +FtwTraverse(const FtwInfoPtr ftwip, size_t dirPathLen, size_t depth) { DIR *DIRp; char *cp; @@ -297,7 +306,7 @@ if ((*ftwip->proc)(ftwip) < 0) { goto panic; } - if (FtwTraverse(ftwip, dirPathLen + fnLen - 1, depth + 1) < 0) + if (((ftwip->maxDepthAllowed == 0) || (depth < ftwip->maxDepthAllowed)) && (FtwTraverse(ftwip, dirPathLen + fnLen - 1, depth + 1) < 0)) goto panic; /* Reset these, since buffer could have @@ -391,7 +400,7 @@ #ifdef HAVE_PATHCONF nmx = pathconf(ftwip->curPath, _PC_NAME_MAX); if (nmx >= 256) - debufsize = nmx; + debufsize = (size_t) nmx; #endif debufsize += sizeof(struct dirent) + 8; ftwip->direntbuf = calloc(debufsize, (size_t) 1); @@ -400,12 +409,14 @@ } ftwip->direntbufSize = debufsize; + ftwip->isBaseDir = 1; ftwip->proc = proc; if ((*proc)(ftwip) < 0) { free(ftwip->direntbuf); ftwip->direntbuf = NULL; return (-1); } + ftwip->isBaseDir = 0; ftwip->depth = ftwip->maxDepth = ftwip->numDirs = ftwip->numFiles = ftwip->numLinks = 0; rc = FtwTraverse(ftwip, len, 1); diff -Nru ncftp-3.2.5/libncftp/io_get.c ncftp-3.2.6/libncftp/io_get.c --- ncftp-3.2.5/libncftp/io_get.c 2009-02-21 19:18:30.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_get.c 2016-10-30 17:37:44.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif #if 0 /* For now, don't do this, which takes a shortcut. */ #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) @@ -79,6 +81,11 @@ int is_dev; time_t now; + if (cip == NULL) + return (kErrBadParameter); + if ((memcmp(cip->magic, kLibraryMagic, kLibraryMagicLen) != 0) || (memcmp(cip->tailMagic, kLibraryMagic, kLibraryMagicLen) != 0)) + return (kErrBadMagic); + if (cip->buf == NULL) { FTPLogError(cip, kDoPerror, "Transfer buffer not allocated.\n"); cip->errNo = kErrNoBuf; @@ -177,7 +184,7 @@ } /* If the local file exists and has a recent - * modification time (< 12 hours) and + * modification time (< threshold) and * the remote file's modtime is not recent, * then heuristically conclude that the * local modtime should not be trusted @@ -185,10 +192,20 @@ * the local modtime could be preserved). */ noMdtmCheck = 0; - if (mdtm != kModTimeUnknown) { - time(&now); - if ((st.st_mtime > now) || (((now - st.st_mtime) < 46200) && ((now - mdtm) >= 46200))) - noMdtmCheck = 1; + time(&now); + if ( + (mdtm != kModTimeUnknown) && + (cip->recentMdtmHeuristic & 00001) && + (cip->recentMdtmThreshold > 0) && + ( + (st.st_mtime > now) || + ( + ((now - st.st_mtime) < cip->recentMdtmThreshold) && + ((now - mdtm) >= cip->recentMdtmThreshold) + ) + ) + ) { + noMdtmCheck = 1; } if ((mdtm == kModTimeUnknown) || (noMdtmCheck != 0)) { @@ -233,11 +250,32 @@ } } else if (mdtm < st.st_mtime) { /* Remote file is older than - * local file. Don't overwrite - * our file. + * local file, but this may be + * a result of the download + * being killed prematurely, + * leaving a recently-modified + * local file, which we would + * like to resume. */ - cip->errNo = kErrLocalFileNewer; - return (cip->errNo); + if ( + (mdtm != kModTimeUnknown) && + (cip->recentMdtmHeuristic & 00002) && + (cip->recentMdtmThreshold > 0) && + ( + (st.st_mtime > now) || + ((now - st.st_mtime) < cip->recentMdtmThreshold) + ) + ) { + /* Resume at startPoint */ + /* (already done) zaction = kConfirmResumeProcSaidResume; */ + } else { + /* Remote file is older than + * local file. Don't overwrite + * our file. + */ + cip->errNo = kErrLocalFileNewer; + return (cip->errNo); + } } else /* if (mdtm > st.st_mtime) */ { /* File has a newer timestamp * altogether, assume the remote @@ -653,7 +691,7 @@ } } - if (mdtm != kModTimeUnknown) { + if ((cip->utimeBlocks != 0) && (mdtm != kModTimeUnknown)) { (void) utime(dstfile, &ut); } cip->bytesTransferred += (longest_int) nread; @@ -769,11 +807,11 @@ break; } - /* Ugggh... do this after each write operation - * so it minimizes the chance of a user killing - * the process before we reset the timestamps. - */ - if (mdtm != kModTimeUnknown) { + if ((cip->utimeBlocks != 0) && (mdtm != kModTimeUnknown)) { + /* Ugggh... do this after each write operation + * so it minimizes the chance of a user killing + * the process before we reset the timestamps. + */ (void) utime(dstfile, &ut); } cip->bytesTransferred += (longest_int) nread; diff -Nru ncftp-3.2.5/libncftp/io_getfiles.c ncftp-3.2.6/libncftp/io_getfiles.c --- ncftp-3.2.5/libncftp/io_getfiles.c 2010-04-04 00:59:18.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_getfiles.c 2016-10-30 17:38:27.000000000 +0000 @@ -10,27 +10,10 @@ # pragma hdrstop #endif -#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) -# define ASCII_TRANSLATION 0 -#endif - -#ifndef ASCII_TRANSLATION -# define ASCII_TRANSLATION 1 -#endif - #ifndef NO_SIGNALS # define NO_SIGNALS 1 #endif -#ifndef O_BINARY - /* Needed for platforms using different EOLN sequence (i.e. DOS) */ -# ifdef _O_BINARY -# define O_BINARY _O_BINARY -# else -# define O_BINARY 0 -# endif -#endif - int FTPGetFiles3( const FTPCIPtr cip, @@ -161,8 +144,9 @@ } #endif - + result = kNoErr; for (filePtr = files.first; filePtr != NULL; filePtr = filePtr->next) { + result = kNoErr; if (cip->connected == 0) { if (batchResult == kNoErr) batchResult = kErrRemoteHostClosedConnection; @@ -256,6 +240,16 @@ } #endif /* HAVE_SYMLINK */ + /* Try to clean up empty directories */ + if ((result == kNoErr) && (recurse1 == kRecursiveYes) && (deleteflag == kDeleteYes)) { + (void) FTPRmdirRecursive2(cip, itemPtr->line, /* remove only empty directories: */ 1); +#ifdef TAR + /* We could do rm -rf here if Tar was successful, but above + * we never use tar mode when delete mode is on. + */ +#endif /* TAR */ + } + DisposeFileInfoListContents(&files); } diff -Nru ncftp-3.2.5/libncftp/io_getmem.c ncftp-3.2.6/libncftp/io_getmem.c --- ncftp-3.2.5/libncftp/io_getmem.c 2005-01-04 06:18:06.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_getmem.c 2016-11-13 00:33:18.000000000 +0000 @@ -216,7 +216,7 @@ break; } - numberOfBytesLeftInMemBuf -= nread; + numberOfBytesLeftInMemBuf -= (size_t) nread; if (numberOfBytesLeftInMemBuf == 0) { /* Done (but maybe not at EOF of remote file). */ atEOF = 0; diff -Nru ncftp-3.2.5/libncftp/io_getonefile.c ncftp-3.2.6/libncftp/io_getonefile.c --- ncftp-3.2.5/libncftp/io_getonefile.c 2005-01-01 21:29:38.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_getonefile.c 2016-10-30 17:38:36.000000000 +0000 @@ -10,27 +10,10 @@ # pragma hdrstop #endif -#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) -# define ASCII_TRANSLATION 0 -#endif - -#ifndef ASCII_TRANSLATION -# define ASCII_TRANSLATION 1 -#endif - #ifndef NO_SIGNALS # define NO_SIGNALS 1 #endif -#ifndef O_BINARY - /* Needed for platforms using different EOLN sequence (i.e. DOS) */ -# ifdef _O_BINARY -# define O_BINARY _O_BINARY -# else -# define O_BINARY 0 -# endif -#endif - int FTPGetOneFile3( const FTPCIPtr cip, diff -Nru ncftp-3.2.5/libncftp/io_gettar.c ncftp-3.2.6/libncftp/io_gettar.c --- ncftp-3.2.5/libncftp/io_gettar.c 2010-04-04 00:58:34.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_gettar.c 2016-10-30 17:38:47.000000000 +0000 @@ -10,27 +10,10 @@ # pragma hdrstop #endif -#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) -# define ASCII_TRANSLATION 0 -#endif - -#ifndef ASCII_TRANSLATION -# define ASCII_TRANSLATION 1 -#endif - #ifndef NO_SIGNALS # define NO_SIGNALS 1 #endif -#ifndef O_BINARY - /* Needed for platforms using different EOLN sequence (i.e. DOS) */ -# ifdef _O_BINARY -# define O_BINARY _O_BINARY -# else -# define O_BINARY 0 -# endif -#endif - /* Nice for UNIX, but not necessary otherwise. */ #ifdef TAR diff -Nru ncftp-3.2.5/libncftp/io_list.c ncftp-3.2.6/libncftp/io_list.c --- ncftp-3.2.5/libncftp/io_list.c 2005-01-01 21:29:43.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_list.c 2016-11-12 22:14:18.000000000 +0000 @@ -10,27 +10,10 @@ # pragma hdrstop #endif -#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) -# define ASCII_TRANSLATION 0 -#endif - -#ifndef ASCII_TRANSLATION -# define ASCII_TRANSLATION 1 -#endif - #ifndef NO_SIGNALS # define NO_SIGNALS 1 #endif -#ifndef O_BINARY - /* Needed for platforms using different EOLN sequence (i.e. DOS) */ -# ifdef _O_BINARY -# define O_BINARY _O_BINARY -# else -# define O_BINARY 0 -# endif -#endif - /* This isn't too useful -- it mostly serves as an example so you can write * your own function to do what you need to do with the listing. */ @@ -92,7 +75,11 @@ break; } - (void) write(outfd, line, (write_size_t) strlen(line)); + if (write(outfd, line, (write_size_t) strlen(line)) < 0) { + result = kErrLISTFailed; + cip->errNo = kErrLISTFailed; + break; + } } DisposeSReadlineInfo(&lsSrl); diff -Nru ncftp-3.2.5/libncftp/io_listmem.c ncftp-3.2.6/libncftp/io_listmem.c --- ncftp-3.2.5/libncftp/io_listmem.c 2010-04-03 20:57:04.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_listmem.c 2016-10-30 17:33:38.000000000 +0000 @@ -10,27 +10,10 @@ # pragma hdrstop #endif -#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) -# define ASCII_TRANSLATION 0 -#endif - -#ifndef ASCII_TRANSLATION -# define ASCII_TRANSLATION 1 -#endif - #ifndef NO_SIGNALS # define NO_SIGNALS 1 #endif -#ifndef O_BINARY - /* Needed for platforms using different EOLN sequence (i.e. DOS) */ -# ifdef _O_BINARY -# define O_BINARY _O_BINARY -# else -# define O_BINARY 0 -# endif -#endif - int FTPListToMemory2(const FTPCIPtr cip, const char *const pattern, const FTPLineListPtr llines, const char *const lsflags, const int blankLines, int *const tryMLSD) { diff -Nru ncftp-3.2.5/libncftp/io_put.c ncftp-3.2.6/libncftp/io_put.c --- ncftp-3.2.5/libncftp/io_put.c 2009-02-21 19:08:55.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_put.c 2016-10-30 17:44:20.000000000 +0000 @@ -10,7 +10,11 @@ # pragma hdrstop #endif +#include "io_sendfile.h" + +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif #ifndef O_BINARY /* Needed for platforms using different EOLN sequence (i.e. DOS) */ @@ -21,6 +25,60 @@ # endif #endif +typedef struct MyDoSendfileProgressInfo { + DoSendfileProgressInfo d; + longest_int osize; + FTPCIPtr cip; +} MyDoSendfileProgressInfo; + + + + +static int +MyDoSendfileProgressProc(DoSendfileProgressInfo *const dspip) +{ + MyDoSendfileProgressInfo *mp = (MyDoSendfileProgressInfo *) dspip; + FTPCIPtr cip; + + if (mp == NULL) return 0; + cip = mp->cip; + if (dspip->current > 0) /* Will be 0 if DoSendfile wasn't using its progress meter */ + cip->bytesTransferred = dspip->current; + FTPUpdateIOTimer(cip); + return 1; +} /* MyDoSendfileProgressProc */ + + + + +static void +MyDoSendfileErrPrintF(DoSendfileParamsPtr dspp, const char *const fmt, ...) +{ + va_list ap; + MyDoSendfileProgressInfo *mp; + FTPCIPtr cip; + + if (dspp != NULL) { + mp = (MyDoSendfileProgressInfo *) dspp->dspip; + cip = mp->cip; + if (cip != NULL) { + va_start(ap, fmt); +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif + PrintF(cip, fmt, ap); +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + va_end(ap); + } + } +} /* DoSendfileErrPrintF */ + + + + static int FTPASCIILocalFileSeek(const int fd, const longest_int howMuchToSkip, char *const inbuf, const size_t bufsize) { @@ -145,7 +203,9 @@ const char *volatile tmpsfx, const int resumeflag, const int deleteflag, - const FTPConfirmResumeUploadProc resumeProc) + const FTPConfirmResumeUploadProc resumeProc, + const time_t batchStartTime, + const time_t origLmtime) { char *buf, *cp; const char *cmd; @@ -172,6 +232,13 @@ int skiprc; size_t skipbufsize; longstring cmdStr; + MyDoSendfileProgressInfo dspi; + DoSendfileParams dsp; + + if (cip == NULL) + return (kErrBadParameter); + if ((memcmp(cip->magic, kLibraryMagic, kLibraryMagicLen) != 0) || (memcmp(cip->tailMagic, kLibraryMagic, kLibraryMagicLen) != 0)) + return (kErrBadMagic); if (cip->buf == NULL) { FTPLogError(cip, kDoPerror, "Transfer buffer not allocated.\n"); @@ -206,6 +273,14 @@ localsize = FTPLocalASCIIFileSize(file, cip->buf, cip->bufSize); } + cip->usingSendfile = 0; + if ((cip->useSendfile != 0) && (DoSendfileAvailable() != 0)) { + /* Don't bother with small files. */ + if (localsize >= 65536) { + cip->usingSendfile = 1; + } + } + /* For Put, we can't recover very well if it turns out restart * didn't work, so check beforehand. */ @@ -244,7 +319,6 @@ if (appendflag == kAppendYes) { zaction = kConfirmResumeProcSaidAppend; } else if ( - /* (cip->hasREST == kCommandNotAvailable) || We can now try to use APPE when REST is not availble. */ /* (xtype != kTypeBinary) || We can now resume in ASCII too. */ (fstatrc < 0) ) { @@ -304,8 +378,41 @@ /* Already sent file, done. */ zaction = kConfirmResumeProcSaidSkip; sameAsRemote = 1; - } else if ((startPoint != kSizeUnknown) && (localsize > startPoint)) { - zaction = kConfirmResumeProcSaidResume; + } else if ((startPoint != kSizeUnknown) && (localsize > startPoint) && ((cip->hasREST == kCommandAvailable) || (cip->hasAPPE == kCommandAvailable))) { + if (batchStartTime != 0) { + /* If we had previously tried to upload this file, + * then batchStartTime denotes the time we first + * started trying. + * + * An incomplete upload should result in the remote + * file timestamp that is newer than this time. + */ + if ((mdtm != kModTimeUnknown) && (mdtm >= batchStartTime)) { + /* If the remote file's timestamp looks recent, it should have the + * the timestamp when the last block was written to the file. + * If we know we started an upload prior to when this last block was written, + * then we know this file didn't finish and we can resume it. + */ + if ((origLmtime != 0) && (origLmtime != st.st_mtime)) { + /* Local changed since last time. */ + zaction = kConfirmResumeProcSaidOverwrite; + } else if (st.st_mtime > (mdtm + 1)) { + /* Local file is newer than remote */ + zaction = kConfirmResumeProcSaidOverwrite; + } else { + /* Local file is older than remote */ + zaction = kConfirmResumeProcSaidResume; + } + } else { + zaction = kConfirmResumeProcSaidOverwrite; + } + } else if ((mdtm != kModTimeUnknown) && (st.st_mtime > (mdtm + 1))) { + /* Local file is newer than remote */ + zaction = kConfirmResumeProcSaidOverwrite; + } else { + /* Local file is older than remote */ + zaction = kConfirmResumeProcSaidResume; + } } else { zaction = kConfirmResumeProcSaidOverwrite; } @@ -343,6 +450,7 @@ } return (kNoErr); } else if (xtype == kTypeAscii) { + cip->usingSendfile = 0; skipbufsize = cip->bufSize; if ((fdtouse >= 0) && (skipbufsize > 4096)) skipbufsize = 4096; @@ -351,7 +459,7 @@ if (skiprc == -2) { cip->errNo = kErrAsciiSeekErr; return (cip->errNo); - } else if (skiprc == -1) { + } else if ((cip->hasAPPE != kCommandNotAvailable) && (skiprc == -1)) { /* Overwrite */ cip->startPoint = startPoint = 0; } else { @@ -363,6 +471,15 @@ zaction = kConfirmResumeProcSaidAppend; cip->startPoint = startPoint = 0; } + } else if (cip->hasREST == kCommandNotAvailable) { + /* Overwrite */ + cip->startPoint = startPoint = 0; + } else if (cip->usingSendfile != 0) { + /* Do not set the file position. + * sendfile() will be able to start from the offset + * without seeking. + */ + cip->startPoint = startPoint; } else if (Lseek(fd, startPoint, SEEK_SET) != -1) { cip->startPoint = startPoint; } @@ -419,7 +536,7 @@ * * So now we have to undo our seek. */ - if (Lseek(fd, 0, SEEK_SET) != 0) { + if ((cip->usingSendfile == 0) && (Lseek(fd, 0, SEEK_SET) != 0)) { cip->errNo = kErrLseekFailed; if (fdtouse < 0) { (void) close(fd); @@ -440,8 +557,10 @@ } cip->lname = file; /* could be NULL */ cip->rname = odstfile; - if (fdtouse >= 0) + if (fdtouse >= 0) { cip->useProgressMeter = 0; + cip->usingSendfile = 0; + } FTPStartIOTimer(cip); /* Note: On Windows, we don't have to do anything special @@ -451,6 +570,7 @@ if (xtype == kTypeAscii) { /* ascii */ + cip->usingSendfile = 0; if (cip->asciiTranslationMode == kAsciiTranslationModeNone) { /* Warning: this is really just for testing FTP server software. @@ -575,8 +695,50 @@ } } } + } else if (cip->usingSendfile != 0) { + /* binary, but use sendfile() */ + DoSendfileProgressInfoInit((DoSendfileProgressInfo *) &dspi, sizeof(dspi)); + DoSendfileParamsInit(&dsp, sizeof(dsp)); + dsp.dspip = (DoSendfileProgressInfo *) &dspi; + dsp.dsppp = MyDoSendfileProgressProc; + dsp.dseppp = MyDoSendfileErrPrintF; + dspi.cip = cip; + dsp.buf = buf; + dsp.bufSize = bufSize; + dsp.handleSIGINT = 0; + dsp.xferTimeout = cip->xferTimeout; + + if ((cip->progress != (FTPProgressMeterProc) 0) && (cip->useProgressMeter != 0)) + dsp.nonBlockingOutput = 1; + +#ifdef O_NONBLOCK + if (dsp.nonBlockingOutput != 0) { + if (fcntl(cip->dataSocket, F_SETFL, O_NONBLOCK) < 0) { + FTPLogError(cip, kDoPerror, "Could not set nonblocking mode on output socket.\n"); + dsp.nonBlockingOutput = 0; + } + } + + if (dsp.nonBlockingInput != 0) { + if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { + FTPLogError(cip, kDoPerror, "Could not set nonblocking mode on input file.\n"); + dsp.nonBlockingInput = 0; + } + } +#else + dsp.nonBlockingOutput = 0; + dsp.nonBlockingInput = 0; +#endif /* O_NONBLOCK */ + + PrintF(cip, "Using sendfile for " PRINTF_LONG_LONG " bytes.\n", localsize); + result = DoSendfile(fd, localsize, cip->dataSocket, &dspi.osize, &dsp); + if (result == 0) { + cip->bytesTransferred = dspi.osize; + MyDoSendfileProgressProc((DoSendfileProgressInfo *) &dspi); + } } else { /* binary */ + cip->usingSendfile = 0; for (;;) { cp = buf; nread = read(fd, cp, (read_size_t) bufSize); @@ -645,6 +807,10 @@ */ cip->numUploads++; + if (strncmp(cmd, "APPE", 4) == 0) { + cip->hasAPPE = kCommandAvailable; + } + if ((tmppfx[0] != '\0') || (tmpsfx[0] != '\0')) { if ((result = FTPRename(cip, dstfile, odstfile)) < 0) { /* May fail if file was already there, diff -Nru ncftp-3.2.5/libncftp/io_putfiles.c ncftp-3.2.6/libncftp/io_putfiles.c --- ncftp-3.2.5/libncftp/io_putfiles.c 2005-01-01 21:29:55.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_putfiles.c 2016-10-30 17:38:17.000000000 +0000 @@ -10,42 +10,26 @@ # pragma hdrstop #endif -#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) -# define ASCII_TRANSLATION 0 -#endif - -#ifndef ASCII_TRANSLATION -# define ASCII_TRANSLATION 1 -#endif - #ifndef NO_SIGNALS # define NO_SIGNALS 1 #endif -#ifndef O_BINARY - /* Needed for platforms using different EOLN sequence (i.e. DOS) */ -# ifdef _O_BINARY -# define O_BINARY _O_BINARY -# else -# define O_BINARY 0 -# endif -#endif - int -FTPPutFiles3( +FTPPutFiles4( const FTPCIPtr cip, const char *const pattern, const char *const dstdir1, const int recurse, const int doGlob, const int xtype, - int appendflag, + const int appendflag, const char *const tmppfx, const char *const tmpsfx, const int resumeflag, const int deleteflag, const FTPConfirmResumeUploadProc resumeProc, - int UNUSED(reserved)) + const time_t batchStartTime, + const time_t origLmtime) { FTPLineList globList; FTPFileInfoList files; @@ -54,8 +38,8 @@ int result; const char *dstdir; char dstdir2[512]; + int appendflag2 = appendflag; - LIBNCFTP_USE_VAR(reserved); if (cip == NULL) return (kErrBadParameter); if (strcmp(cip->magic, kLibraryMagic)) @@ -70,7 +54,7 @@ (void) FTPLocalGlob(cip, &globList, pattern, doGlob); if (recurse == kRecursiveYes) { - appendflag = kAppendNo; + appendflag2 = kAppendNo; (void) FTPLocalRecursiveFileList(cip, &globList, &files); if (files.first == NULL) { cip->errNo = kErrNoValidFilesSpecified; @@ -118,7 +102,7 @@ (void) FTPSymlink(cip, filePtr->rname, filePtr->rlinkto); #endif } else if (recurse != kRecursiveYes) { - result = FTPPutOneF(cip, filePtr->lname, filePtr->rname, xtype, -1, appendflag, tmppfx, tmpsfx, resumeflag, deleteflag, resumeProc); + result = FTPPutOneF(cip, filePtr->lname, filePtr->rname, xtype, -1, appendflag2, tmppfx, tmpsfx, resumeflag, deleteflag, resumeProc, batchStartTime, origLmtime); if (files.nFileInfos == 1) { if (result != kNoErr) batchResult = result; @@ -131,7 +115,7 @@ if (cip->cancelXfer > 0) break; } else { - result = FTPPutOneF(cip, filePtr->lname, filePtr->rname, xtype, -1, appendflag, tmppfx, tmpsfx, resumeflag, deleteflag, resumeProc); + result = FTPPutOneF(cip, filePtr->lname, filePtr->rname, xtype, -1, appendflag2, tmppfx, tmpsfx, resumeflag, deleteflag, resumeProc, batchStartTime, origLmtime); if (files.nFileInfos == 1) { if (result != kNoErr) batchResult = result; @@ -149,7 +133,7 @@ if (batchResult < 0) cip->errNo = batchResult; return (batchResult); -} /* FTPPutFiles3 */ +} /* FTPPutFiles4 */ @@ -157,7 +141,7 @@ int FTPPutFiles(const FTPCIPtr cip, const char *const pattern, const char *const dstdir, const int recurse, const int doGlob) { - return (FTPPutFiles3(cip, pattern, dstdir, recurse, doGlob, kTypeBinary, 0, NULL, NULL, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0)); + return (FTPPutFiles4(cip, pattern, dstdir, recurse, doGlob, kTypeBinary, 0, NULL, NULL, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0, 0)); } /* FTPPutFiles */ @@ -166,14 +150,20 @@ int FTPPutFiles2(const FTPCIPtr cip, const char *const pattern, const char *const dstdir, const int recurse, const int doGlob, const int xtype, const int appendflag, const char *const tmppfx, const char *const tmpsfx) { - return (FTPPutFiles3(cip, pattern, dstdir, recurse, doGlob, xtype, appendflag, tmppfx, tmpsfx, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0)); + return (FTPPutFiles4(cip, pattern, dstdir, recurse, doGlob, xtype, appendflag, tmppfx, tmpsfx, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0, 0)); } /* FTPPutFiles2 */ +int +FTPPutFiles3(const FTPCIPtr cip, const char *const pattern, const char *const dstdir1, const int recurse, const int doGlob, const int xtype, int appendflag, const char *const tmppfx, const char *const tmpsfx, const int resumeflag, const int deleteflag, const FTPConfirmResumeUploadProc resumeProc, int UNUSED(reserved)) +{ + LIBNCFTP_USE_VAR(reserved); + return (FTPPutFiles4(cip, pattern, dstdir1, recurse, doGlob, xtype, appendflag, tmppfx, tmpsfx, resumeflag, deleteflag, resumeProc, 0, 0)); +} /* FTPPutFiles3 */ int FTPPutFilesAscii(const FTPCIPtr cip, const char *const pattern, const char *const dstdir, const int recurse, const int doGlob) { - return (FTPPutFiles3(cip, pattern, dstdir, recurse, doGlob, kTypeAscii, 0, NULL, NULL, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0)); + return (FTPPutFiles4(cip, pattern, dstdir, recurse, doGlob, kTypeAscii, 0, NULL, NULL, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0, 0)); } /* FTPPutFilesAscii */ diff -Nru ncftp-3.2.5/libncftp/io_putonefile.c ncftp-3.2.6/libncftp/io_putonefile.c --- ncftp-3.2.5/libncftp/io_putonefile.c 2005-01-01 21:30:01.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_putonefile.c 2016-10-30 17:36:53.000000000 +0000 @@ -10,29 +10,12 @@ # pragma hdrstop #endif -#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) -# define ASCII_TRANSLATION 0 -#endif - -#ifndef ASCII_TRANSLATION -# define ASCII_TRANSLATION 1 -#endif - #ifndef NO_SIGNALS # define NO_SIGNALS 1 #endif -#ifndef O_BINARY - /* Needed for platforms using different EOLN sequence (i.e. DOS) */ -# ifdef _O_BINARY -# define O_BINARY _O_BINARY -# else -# define O_BINARY 0 -# endif -#endif - int -FTPPutOneFile3( +FTPPutOneFile4( const FTPCIPtr cip, const char *const file, const char *const dstfile, @@ -44,11 +27,11 @@ const int resumeflag, const int deleteflag, const FTPConfirmResumeUploadProc resumeProc, - int UNUSED(reserved)) + const time_t batchStartTime, + const time_t origLmtime) { int result; - LIBNCFTP_USE_VAR(reserved); if (cip == NULL) return (kErrBadParameter); if (strcmp(cip->magic, kLibraryMagic)) @@ -60,9 +43,9 @@ if ((file == NULL) || (file[0] == '\0')) return (kErrBadParameter); } - result = FTPPutOneF(cip, file, dstfile, xtype, fdtouse, appendflag, tmppfx, tmpsfx, resumeflag, deleteflag, resumeProc); + result = FTPPutOneF(cip, file, dstfile, xtype, fdtouse, appendflag, tmppfx, tmpsfx, resumeflag, deleteflag, resumeProc, batchStartTime, origLmtime); return (result); -} /* FTPPutOneFile3 */ +} /* FTPPutOneFile4 */ @@ -70,7 +53,7 @@ int FTPPutOneFile(const FTPCIPtr cip, const char *const file, const char *const dstfile) { - return (FTPPutOneFile3(cip, file, dstfile, kTypeBinary, -1, 0, NULL, NULL, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0)); + return (FTPPutOneFile4(cip, file, dstfile, kTypeBinary, -1, 0, NULL, NULL, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0, 0)); } /* FTPPutOneFile */ @@ -79,14 +62,24 @@ int FTPPutOneFile2(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int appendflag, const char *const tmppfx, const char *const tmpsfx) { - return (FTPPutOneFile3(cip, file, dstfile, xtype, fdtouse, appendflag, tmppfx, tmpsfx, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0)); + return (FTPPutOneFile4(cip, file, dstfile, xtype, fdtouse, appendflag, tmppfx, tmpsfx, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0, 0)); } /* FTPPutOneFile2 */ int +FTPPutOneFile3(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int appendflag, const char *const tmppfx, const char *const tmpsfx, const int resumeflag, const int deleteflag, const FTPConfirmResumeUploadProc resumeProc, int UNUSED(reserved)) +{ + LIBNCFTP_USE_VAR(reserved); + return (FTPPutOneFile4(cip, file, dstfile, xtype, fdtouse, appendflag, tmppfx, tmpsfx, resumeflag, deleteflag, resumeProc, 0, 0)); +} /* FTPPutOneFile3 */ + + + + +int FTPPutOneFileAscii(const FTPCIPtr cip, const char *const file, const char *const dstfile) { - return (FTPPutOneFile3(cip, file, dstfile, kTypeAscii, -1, 0, NULL, NULL, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0)); + return (FTPPutOneFile4(cip, file, dstfile, kTypeAscii, -1, 0, NULL, NULL, kResumeNo, kDeleteNo, kNoFTPConfirmResumeUploadProc, 0, 0)); } /* FTPPutOneFileAscii */ diff -Nru ncftp-3.2.5/libncftp/io_sendfile.c ncftp-3.2.6/libncftp/io_sendfile.c --- ncftp-3.2.5/libncftp/io_sendfile.c 1970-01-01 00:00:00.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_sendfile.c 2016-11-13 00:47:20.000000000 +0000 @@ -0,0 +1,780 @@ +/* io_sendfile.c + * + * Copyright (c) 2016 Mike Gleason, NcFTP Software. + * All rights reserved. + * + */ + +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) +# define WIN 1 +# include +# define longest_int _int64 +# define PRINTF_LONG_LONG "%I64d" +# define GETSOCKOPT_ARG4 (char *) +# define NO_SENDFILE 1 +#else +# if defined(HAVE_CONFIG_H) +# include +# define NO_DEFAULT_DEFS +# endif +#endif + +#ifdef __FreeBSD__ +# ifndef FREEBSD +# define FREEBSD 1000 +# endif +#endif + +#if defined( __APPLE__) && defined(__MACH__) && !defined(MACOSX) +# define MACOSX 1 +#endif + +#ifdef FREEBSD +# ifndef HAVE_SYS_SELECT_H +# define HAVE_SYS_SELECT_H 1 +# endif +#endif + +#if defined(__linux__) && !defined(LINUX) +# define LINUX 26000 +#endif + +#ifdef LINUX +# ifndef HAVE_SYS_SENDFILE_H +# define HAVE_SYS_SENDFILE_H 1 +# endif +#endif + +#ifdef WIN +# define off_t __int64 +#elif !defined(NO_DEFAULT_DEFS) +# ifndef HAVE_UNISTD_H +# define HAVE_UNISTD_H 1 +# endif +# ifndef _FILE_OFFSET_BITS +# define _FILE_OFFSET_BITS 64 +# endif +# ifndef HAVE_SNPRINTF +# define HAVE_SNPRINTF 1 +# endif +# ifndef HAVE_USLEEP +# define HAVE_USLEEP 1 +# endif +# ifndef HAVE_POSIX_MEMALIGN +# define HAVE_POSIX_MEMALIGN 1 +# endif +# ifndef Socklen_t +# define Socklen_t socklen_t +# endif +# ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +# endif +#endif + +#ifdef HAVE_UNISTD_H +# include +#endif +#ifndef WIN +# include +# include +# include +# include +# include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_SELECT_H +# include +#endif +#ifdef HAVE_SYS_SENDFILE_H +# include +#endif + +#ifndef Socklen_t +# define Socklen_t int +#endif + +#ifndef GETSOCKOPT_ARG4 +# define GETSOCKOPT_ARG4 +#endif + +#ifndef PRINTF_LONG_LONG +# define PRINTF_LONG_LONG "%lld" +#endif + +#ifndef longest_int +# define longest_int long long int +#endif + +#if defined(FREEBSD) && (FREEBSD >= 301) +# define FREEBSD_SENDFILE 1 +#endif + +#ifdef MACOSX +# define MACOSX_SENDFILE 1 +#endif + +#include "io_sendfile.h" + +/* Global variables. */ +int gSendfileInProgress = 0; + + + + +int +DoSendfileAvailable(void) +{ +#if defined(FREEBSD_SENDFILE) || defined(MACOSX_SENDFILE) + return 1; +#elif defined(LINUX) && (LINUX >= 22000) + return 1; +#else + return 0; +#endif +} /* DoSendfileAvailable */ + + + + +void +DoSendfileParamsInit(DoSendfileParams *const dspp, const size_t siz) +{ + memset(dspp, 0, siz ? siz : sizeof(DoSendfileParams)); + dspp->size = siz ? siz : sizeof(DoSendfileParams); + dspp->id = 0xD053F113; + dspp->version = kDoSendfileVersion; +} /* DoSendfileParamsInit */ + + + + +void +DoSendfileProgressInfoInit(DoSendfileProgressInfo *const dspip, const size_t siz) +{ + memset(dspip, 0, siz ? siz : sizeof(DoSendfileProgressInfo)); + dspip->size = siz ? siz : sizeof(DoSendfileProgressInfo); + dspip->id = 0xD053F113; + dspip->version = kDoSendfileVersion; +} /* DoSendfileProgressInfoInit */ + + + + +/*VARARGS*/ +void +DoSendfileErrPrintF(DoSendfileParamsPtr dspp, const char *const fmt, ...) +{ + va_list ap; + FILE *x = stderr; + + va_start(ap, fmt); + if ((x != NULL) && (dspp != NULL)) + (void) vfprintf(x, fmt, ap); + va_end(ap); +} /* DoSendfileErrPrintF */ + + + + +static void +DoSendfileTimeout(int sigNum) +{ + if (gSendfileInProgress > 0) { + gSendfileInProgress = -sigNum; + /* fprintf(stderr, "Canceler caught sendfile timeout, returning.\n"); */ + errno = EINTR; + } else { + /* fprintf(stderr, "Caught spurious SIGALRM, ignoring.\n"); */ + } + return; /* Break out of sendfile with EINTR or (nwrote < ntoread) */ +} /* DoSendfileTimeout */ + + + + +static void +DoSendfileCancel(int sigNum) +{ + /* Can be SIGPIPE or SIGURG */ + if (gSendfileInProgress > 0) { + gSendfileInProgress = -sigNum; + /* fprintf(stderr, "Canceler caught signal %d, returning.\n", sigNum); */ + errno = EPIPE; + } else { + /* fprintf(stderr, "Caught spurious SIGPIPE, ignoring.\n"); */ + } + return; /* Break out of sendfile with EPIPE */ +} /* DoSendfileCancel */ + + + +#ifdef NO_SENDFILE +int +DoSendfile(const int ifd, const longest_int isize, const int ofd, longest_int *const osize, DoSendfileParams *const dspp) +{ + errno = ENOSYS; + if ((ifd == -666) && (isize == 0) && (ofd == 0) && (osize == 0) && (dspp == 0)) errno = 1; /* ignore unused */ + return -1; +} +#else + +int +DoSendfile(const int ifd, const longest_int isize, const int ofd, longest_int *const osize, DoSendfileParams *const dspp) +{ + longest_int twrote; + longest_int tntoread; + struct sigaction sa; + struct sigaction oldsa, oldsp, oldsi; + int result; + int oerrno; + volatile int using_alarm; + unsigned int amt; + ssize_t nread; + ssize_t nwrote; + longest_int ntowrite; + longest_int ntoread; + fd_set rfds, wfds, xfds; + int nready, maxfd; + struct timeval sel_tmout; + int do_perror; + int xferTimeoutSec; + int xferTimeoutUSec; + DoSendfileProgressInfo *dspip; + DoSendfileProgressProc dsppp; + DoSendfileErrPrintFProc dseppp; + +#ifdef SO_SNDTIMEO + struct timeval tmout; +#endif /* SO_SNDTIMEO */ + +#ifdef SIGURG + struct sigaction oldsu; +#endif /* SIGURG */ + +#if defined(FREEBSD_SENDFILE) || defined(MACOSX_SENDFILE) + struct sf_hdtr sf; + off_t off, off1; +#else + struct stat st; +#endif /* FREEBSD, MACOSX */ + +#if defined(LINUX) && (LINUX >= 22000) + off_t off, off1; +#endif /* LINUX */ + + if (osize != NULL) + *osize = (longest_int) 0; + + if ((ifd < 0) || (ofd < 0)) { + errno = EBADF; + return (-1); + } + + if ((dspp == NULL) || (dspp->id != kDoSendfileID)) { + errno = EINVAL; + return (-1); + } + dspip = dspp->dspip; + dsppp = dspp->dsppp; + if (dspp->dseppp == NULL) + dspp->dseppp = DoSendfileErrPrintF; + dseppp = dspp->dseppp; + do_perror = dspp->printError; + + maxfd = (ifd > ofd) ? ifd : ofd; + tntoread = ntoread = isize; + twrote = 0; + using_alarm = 0; + gSendfileInProgress = 0; + + (void) sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = DoSendfileTimeout; + (void) sigaction(SIGALRM, &sa, (struct sigaction *) &oldsa); + + sa.sa_handler = DoSendfileCancel; + (void) sigaction(SIGPIPE, &sa, (struct sigaction *) &oldsp); + + if (dspp->handleSIGINT) { + sa.sa_handler = DoSendfileCancel; + (void) sigaction(SIGINT, &sa, (struct sigaction *) &oldsi); + } + +#ifdef SIGURG + (void) sigaction(SIGURG, &sa, (struct sigaction *) &oldsu); +#endif /* SIGURG */ + + result = -1; + +#ifndef O_NONBLOCK + dspp->nonBlockingOutput = dspp->nonBlockingInput = 0; +#endif + + xferTimeoutSec = (int) dspp->xferTimeout; + xferTimeoutUSec = (int) ((dspp->xferTimeout - (double) xferTimeoutSec) * 1000000.0); + + if ((dspp->xferTimeout > 0) && (dspp->nonBlockingOutput == 0)) { +#ifdef SO_SNDTIMEO + tmout.tv_sec = xferTimeoutSec; + tmout.tv_usec = xferTimeoutUSec; + if (setsockopt(ofd, SOL_SOCKET, SO_SNDTIMEO, GETSOCKOPT_ARG4 &tmout, (Socklen_t) sizeof(tmout)) != 0) { +#endif /* SO_SNDTIMEO */ + + /* Set the timer. */ + using_alarm = 1; + if ((isize <= 0) || (isize > (longest_int) 1000000000)) { + (void) alarm(65535); + } else { + amt = (unsigned int) (isize / 4096); + if ((int) amt < xferTimeoutSec) + amt = (unsigned int) xferTimeoutSec; + if (amt > 65535) + amt = 65535; + (void) alarm(amt); + } + +#ifdef SO_SNDTIMEO + } +#endif /* SO_SNDTIMEO */ + } + + oerrno = 0; + + if (dspp->userSpaceModeOnly != 0) { + if (dspp->buf == NULL) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: Buffer size was not set for regular userspace mode.\n"); + errno = EINVAL; + return (-1); + } + result = 0; + goto userspace_loop; + } + +#if defined(LINUX) && (LINUX >= 22000) + if ((tntoread == 0) && (fstat(ifd, &st) == 0)) { + tntoread = ntoread = st.st_size; + } + + off = off1 = dspp->initialOffset; + + for (;;) { + errno = 0; + if (ntoread <= 0) + break; + if (gSendfileInProgress == 0) + gSendfileInProgress = 1; + + if (gSendfileInProgress < 0) { + nwrote = -1; + errno = oerrno; + } else { + off1 = off; + nwrote = (ssize_t) sendfile(ofd, ifd, &off, (size_t) ntoread); + oerrno = errno; + } + + if (nwrote <= 0) { + /* Error; note EINTR is not handled in the + * usual fashion. If we get it, it should + * mean that may have caught an alarm (so we would + * not want to do the usual retry). + */ + if ((errno == EINVAL) && (ntoread == tntoread)) + break; /* Didn't work, but can still fall back to regular non-sendfile mode. */ + if ((nwrote == 0) && (tntoread > 0)) { + /* EOF ??? */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: Error occurred after " + PRINTF_LONG_LONG + " of " + PRINTF_LONG_LONG + " bytes were sent: %s\n", + twrote, + tntoread, + "Unexpected EOF" + ); + errno = EEXIST; + } else if (gSendfileInProgress == -SIGURG) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by SIGURG.\n"); + errno = EINTR; + } else if (gSendfileInProgress == -SIGINT) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by SIGINT.\n"); + errno = EINTR; + } else if ((gSendfileInProgress == -SIGALRM) || ((oerrno == EINTR) && (using_alarm != 0))) { + /* Timed-out */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by timeout alarm after " + PRINTF_LONG_LONG + " of " + PRINTF_LONG_LONG + " bytes were sent.\n", + twrote, + tntoread + ); + errno = ETIMEDOUT; + } else if (oerrno == EINTR) { + /* Used to just retry (continue;) + * like you would with a regular + * system call; It is unclear + * if we can really call sendfile again + * and have it resume where it left off. + */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: EINTR, aborting.\n"); + } else if ((gSendfileInProgress == -SIGPIPE) || (oerrno == EPIPE)) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: broken pipe.\n"); + errno = EPIPE; + } else if (oerrno == EAGAIN) { + if ((dspp->nonBlockingOutput != 0) || (dspp->nonBlockingInput != 0)) { + /* Retry; should only do this if the socket was set to non-blocking. */ + /* The ending offset was in "off". */ + twrote = off; + ntoread -= (off - off1); + if (dspip != NULL) { + /* Progress meter update */ + dspip->current = twrote; + if (dsppp != NULL) + (*dsppp)(dspip); + } + + /* fprintf(stderr, "DoSendfile: LINUX: EAGAIN started at " PRINTF_LONG_LONG " of " PRINTF_LONG_LONG " bytes; ended at " PRINTF_LONG_LONG " bytes.\n", (longest_int) off1, tntoread, (longest_int) off); */ + + FD_ZERO(&wfds); FD_SET(ofd, &wfds); + FD_ZERO(&xfds); FD_SET(ifd, &xfds); FD_SET(ofd, &xfds); + sel_tmout.tv_sec = xferTimeoutSec; + sel_tmout.tv_usec = xferTimeoutUSec; + nready = select(maxfd + 1, NULL, &wfds, &xfds, &sel_tmout); + if (nready > 0) + continue; /* Ready to write again. */ + if (nready == 0) { + /* Timed out */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: socket write timed out after " + PRINTF_LONG_LONG + " of " + PRINTF_LONG_LONG + " bytes were sent.\n", + twrote, + tntoread + ); + errno = ETIMEDOUT; + break; + } + if (do_perror) (*dseppp)(dspp, "DoSendfile: select error: %s.\n", strerror(errno)); + } else { + /* Linux also returns this if the SO_SNDTIMEO + * is triggered. + */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: socket send timeout after " + PRINTF_LONG_LONG + " of " + PRINTF_LONG_LONG + " bytes were sent.\n", + twrote, + tntoread + ); + errno = ETIMEDOUT; + } + } else { + if (do_perror) (*dseppp)(dspp, "DoSendfile: Error occurred after " + PRINTF_LONG_LONG + " of " + PRINTF_LONG_LONG + " bytes were sent: %s\n", + twrote, + tntoread, + strerror(oerrno) + ); + } + break; + } + + ntoread -= nwrote; + twrote += nwrote; + } + if (ntoread <= 0) { + /* twrote == tntoread */ + result = 0; + gSendfileInProgress = 0; + } + /* end LINUX */ + +#elif defined(FREEBSD_SENDFILE) || defined(MACOSX_SENDFILE) + off = off1 = dspp->initialOffset; + for (;;) { + if (off >= 0) + off1 = off; + off = (off_t) 0; + sf.headers = NULL; + sf.hdr_cnt = 0; + sf.trailers = NULL; + sf.trl_cnt = 0; + + errno = 0; + gSendfileInProgress = 1; + +#ifdef MACOSX_SENDFILE + /* int sendfile(int fd, int s, off_t offset, off_t *len, struct sf_hdtr *hdtr, int flags); */ + nwrote = (ssize_t) sendfile(ifd, ofd, off1, &off, &sf, 0); + +#else /* FreeBSD */ + + /* int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); */ + nwrote = (ssize_t) sendfile(ifd, ofd, off1, (size_t) 0 /* send to EOF */, &sf, &off, 0); +#endif + oerrno = errno; + + if (nwrote >= 0) { + twrote += off; + if ((twrote < tntoread) && (tntoread > 0)) { + /* short */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: Short send: At most " PRINTF_LONG_LONG " of " PRINTF_LONG_LONG " bytes were received by client host.\n", twrote, tntoread); + errno = EAGAIN; + break; + } else { + /* complete */ + ntoread = 0; + result = 0; + gSendfileInProgress = 0; + } + break; + } else { + /* Error; note EINTR is not handled in the + * usual fashion. If we get it, it should + * mean that may have caught an alarm (so we would + * not want to do the usual retry). + */ + if (gSendfileInProgress == -SIGURG) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by SIGURG.\n"); + errno = EINTR; + } else if (gSendfileInProgress == -SIGINT) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by SIGINT.\n"); + errno = EINTR; + } else if ((gSendfileInProgress == -SIGALRM) || ((oerrno == EINTR) && (using_alarm != 0))) { + /* Timed-out */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by timeout alarm.\n"); + errno = ETIMEDOUT; + } else if (oerrno == EINTR) { + /* Retry */ + continue; + } else if (oerrno == EAGAIN) { + /* Retry; should only get here if the socket was set to non-blocking */ + /* The number of bytes that were written was set in "off" */ + twrote += off; + off = twrote; + if (dspip != NULL) { + /* Progress meter update */ + dspip->current = twrote; + if (dsppp != NULL) + (*dsppp)(dspip); + } + + /* fprintf(stderr, "FREEBSD: EAGAIN started at " PRINTF_LONG_LONG " of " PRINTF_LONG_LONG " bytes; ended at " PRINTF_LONG_LONG " bytes.\n", (longest_int) off1, tntoread, (longest_int) off); */ + + FD_ZERO(&wfds); FD_SET(ofd, &wfds); + FD_ZERO(&xfds); FD_SET(ifd, &xfds); FD_SET(ofd, &xfds); + sel_tmout.tv_sec = xferTimeoutSec; + sel_tmout.tv_usec = xferTimeoutUSec; + nready = select(maxfd + 1, NULL, &wfds, &xfds, &sel_tmout); + if (nready > 0) + continue; /* Ready to write again. */ + if (nready == 0) { + /* Timed out */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: socket write timed out after " + PRINTF_LONG_LONG + " of " + PRINTF_LONG_LONG + " bytes were sent.\n", + twrote, + tntoread + ); + errno = ETIMEDOUT; + break; + } + if (do_perror) (*dseppp)(dspp, "DoSendfile: select error: %s.\n", strerror(errno)); + } else if ((gSendfileInProgress == -SIGPIPE) || (oerrno == EPIPE)) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: broken pipe.\n"); + errno = EPIPE; + } else if (oerrno == EWOULDBLOCK) { + /* FreeBSD returns this if no data was sent + * through sendfile. + */ + gSendfileInProgress = -SIGALRM; + } else { + if (do_perror) (*dseppp)(dspp, "DoSendfile: Error occurred after " PRINTF_LONG_LONG " of " PRINTF_LONG_LONG " bytes were sent: %s.\n", twrote, tntoread, strerror(oerrno)); + } + break; + } + } + /* end FREEBSD, MACOSX */ +#else + if ((tntoread == 0) && (fstat(ifd, &st) == 0)) { + tntoread = ntoread = st.st_size; + } + if (dspp->sendfileModeOnly != 0) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: Don't know how to sendfile() on this platform.\n"); + errno = ENOSYS; + return (-1); + } else if (dspp->buf == NULL) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: Don't know how to sendfile() on this platform and buffer size was not set for regular userspace mode.\n"); + errno = ENOSYS; + return (-1); + } +#endif /* OTHER */ + +userspace_loop: + ntowrite = 0; + if ((ntoread == tntoread) && (tntoread > 0) && (dspp->sendfileModeOnly != 0)) { + errno = ENOSYS; + result = -1; + } else if ((ntoread == tntoread) && (tntoread > 0) && (dspp->buf != NULL)) { + memset(dspp->buf, 0, dspp->bufSize); + gSendfileInProgress = 1; + while (ntoread > 0) { + ntowrite = 0; + + if (gSendfileInProgress == -SIGURG) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by SIGURG.\n"); + errno = EINTR; + goto umodebreak; + } else if (gSendfileInProgress == -SIGINT) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by SIGINT.\n"); + errno = EINTR; + goto umodebreak; + } else if ((gSendfileInProgress == -SIGPIPE) || (oerrno == EPIPE)) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: broken pipe.\n"); + errno = EPIPE; + goto umodebreak; + } else if ((gSendfileInProgress == -SIGALRM) || ((oerrno == EINTR) && (using_alarm != 0))) { + /* Timed-out */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by timeout alarm.\n"); + errno = ETIMEDOUT; + goto umodebreak; + } + + nread = read(ifd, dspp->buf, dspp->bufSize); + if (nread == 0) + break; + if (nread < 0) { + if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { + FD_ZERO(&rfds); FD_SET(ifd, &rfds); + FD_ZERO(&xfds); FD_SET(ifd, &xfds); + sel_tmout.tv_sec = xferTimeoutSec; + sel_tmout.tv_usec = xferTimeoutUSec; + nready = select(maxfd + 1, NULL, &wfds, &xfds, &sel_tmout); + if (nready > 0) + continue; /* Ready to read again. */ + if (nready == 0) { + /* Timed out */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: read timed out after " + PRINTF_LONG_LONG + " of " + PRINTF_LONG_LONG + " bytes were sent.\n", + twrote, + tntoread + ); + errno = ETIMEDOUT; + goto umodebreak; + } + /* select failed */ + if (errno == EINTR) + continue; + if (do_perror) (*dseppp)(dspp, "DoSendfile: select error: %s.\n", strerror(errno)); + goto umodebreak; + } + if (errno == EINTR) + continue; + if (do_perror) (*dseppp)(dspp, "DoSendfile: read error on fd=%d: %s\n", ifd, strerror(errno)); + return (-1); + } + ntoread -= nread; + + ntowrite = nread; + while (ntowrite > 0) { + if (gSendfileInProgress == -SIGURG) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by SIGURG.\n"); + errno = EINTR; + goto umodebreak; + } else if (gSendfileInProgress == -SIGINT) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by SIGINT.\n"); + errno = EINTR; + goto umodebreak; + } else if ((gSendfileInProgress == -SIGPIPE) || (oerrno == EPIPE)) { + if (do_perror) (*dseppp)(dspp, "DoSendfile: broken pipe.\n"); + errno = EPIPE; + goto umodebreak; + } else if ((gSendfileInProgress == -SIGALRM) || ((oerrno == EINTR) && (using_alarm != 0))) { + /* Timed-out */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: interrupted by timeout alarm.\n"); + errno = ETIMEDOUT; + goto umodebreak; + } + nwrote = (ssize_t) write(ofd, dspp->buf + (nread - ntowrite), (size_t) ntowrite); + if (nwrote < 0) { + if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { + FD_ZERO(&wfds); FD_SET(ofd, &wfds); + FD_ZERO(&xfds); FD_SET(ifd, &xfds); FD_SET(ofd, &xfds); + sel_tmout.tv_sec = xferTimeoutSec; + sel_tmout.tv_usec = xferTimeoutUSec; + nready = select(maxfd + 1, NULL, &wfds, &xfds, &sel_tmout); + if (nready > 0) + continue; /* Ready to write again. */ + if (nready == 0) { + /* Timed out */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: socket write timed out after " + PRINTF_LONG_LONG + " of " + PRINTF_LONG_LONG + " bytes were sent.\n", + twrote, + tntoread + ); + errno = ETIMEDOUT; + goto umodebreak; + } + /* select failed */ + if (do_perror) (*dseppp)(dspp, "DoSendfile: select error: %s.\n", strerror(errno)); + goto umodebreak; + } + if (errno == EINTR) + continue; + if (do_perror) (*dseppp)(dspp, "DoSendfile: write error on fd=%d: %s\n", ofd, strerror(errno)); + goto umodebreak; + } + twrote += nwrote; + ntowrite -= nwrote; + if (dspip != NULL) { + /* Progress meter update */ + dspip->current = twrote; + if (dsppp != NULL) + (*dsppp)(dspip); + } + } + } +umodebreak: + result = ((ntoread > 0) || (ntowrite > 0)) ? -1 : 0; + } + + gSendfileInProgress = 0; + if (using_alarm != 0) + (void) alarm(0); + (void) sigaction(SIGALRM, (struct sigaction *) &oldsa, NULL); + (void) sigaction(SIGPIPE, (struct sigaction *) &oldsp, NULL); + if (dspp->handleSIGINT) { + (void) sigaction(SIGINT, (struct sigaction *) &oldsi, NULL); + } +#ifdef SIGURG + (void) sigaction(SIGURG, (struct sigaction *) &oldsu, NULL); +#endif /* SIGURG */ + + if (osize != NULL) + *osize = twrote; + return (result); +} /* DoSendfile */ + +#endif diff -Nru ncftp-3.2.5/libncftp/io_sendfile.h ncftp-3.2.6/libncftp/io_sendfile.h --- ncftp-3.2.5/libncftp/io_sendfile.h 1970-01-01 00:00:00.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_sendfile.h 2016-10-30 16:57:08.000000000 +0000 @@ -0,0 +1,61 @@ +/* dosendfile.h + * + * Copyright (c) 2016 Mike Gleason, NcFTP Software. + * All rights reserved. + * + */ + +#ifndef longest_int +# define longest_int long long int +# define longest_uint unsigned long long int +#endif + +#define kDoSendfileID 0xD053F113 +#define kDoSendfileVersion 1 + +typedef struct { + unsigned int id; + int version; + size_t size; + longest_int current; +} DoSendfileProgressInfo; + +typedef struct DoSendfileParams *DoSendfileParamsPtr; + +typedef int (*DoSendfileProgressProc)(DoSendfileProgressInfo *const dspip); +typedef void (*DoSendfileErrPrintFProc)(DoSendfileParamsPtr dspp, const char *const fmt, ...) +#if (defined(__GNUC__)) && (__GNUC__ >= 2) +__attribute__ ((format (printf, 2, 3))) +#endif +; + +typedef struct DoSendfileParams { + unsigned int id; + int version; + size_t size; + int printError; + int userSpaceModeOnly; + int sendfileModeOnly; + int nonBlockingOutput; + int nonBlockingInput; + int handleSIGINT; + off_t initialOffset; + double xferTimeout; + char *buf; /* Can be NULL */ + size_t bufSize; + DoSendfileErrPrintFProc dseppp; /* Can be NULL */ + DoSendfileProgressInfo *dspip; /* Can be NULL */ + DoSendfileProgressProc dsppp; /* Can be NULL */ +} DoSendfileParams; + +extern int gSendfileInProgress; + +int DoSendfileAvailable(void); +void DoSendfileParamsInit(DoSendfileParams *const dspp, const size_t siz); +void DoSendfileProgressInfoInit(DoSendfileProgressInfo *const dspip, const size_t siz); +void DoSendfileErrPrintF(DoSendfileParamsPtr dspp, const char *const fmt, ...) +#if (defined(__GNUC__)) && (__GNUC__ >= 2) +__attribute__ ((format (printf, 2, 3))) +#endif +; +int DoSendfile(const int ifd, const longest_int isize, const int ofd, longest_int *const osize, DoSendfileParams *const dspp); diff -Nru ncftp-3.2.5/libncftp/io_util.c ncftp-3.2.6/libncftp/io_util.c --- ncftp-3.2.5/libncftp/io_util.c 2009-12-17 17:44:08.000000000 +0000 +++ ncftp-3.2.6/libncftp/io_util.c 2016-11-13 00:32:36.000000000 +0000 @@ -14,17 +14,8 @@ # define NO_SIGNALS 1 #endif -#ifndef O_BINARY - /* Needed for platforms using different EOLN sequence (i.e. DOS) */ -# ifdef _O_BINARY -# define O_BINARY _O_BINARY -# else -# define O_BINARY 0 -# endif -#endif - double -FTPDuration(struct timeval *t0) +FTPDuration(struct timeval *const t0) { struct timeval t1; double sec; @@ -43,6 +34,24 @@ +double +FTPDuration2(struct timeval *const xt0, struct timeval *const xt1) +{ + double sec; + + if (xt0->tv_usec > xt1->tv_usec) { + xt1->tv_usec += 1000000; + xt1->tv_sec--; + } + sec = ((double) (xt1->tv_usec - xt0->tv_usec) * 0.000001) + + (xt1->tv_sec - xt0->tv_sec); + + return (sec); +} /* FTPDuration2 */ + + + + void FTPInitIOTimer(const FTPCIPtr cip) { @@ -157,7 +166,7 @@ int xferTimeout; int ocancelXfer; - xferTimeout = cip->xferTimeout; + xferTimeout = (int) cip->xferTimeout; if (xferTimeout < 1) return (1); @@ -236,7 +245,7 @@ int xferTimeout; int ocancelXfer; - xferTimeout = cip->xferTimeout; + xferTimeout = (int) cip->xferTimeout; if (xferTimeout < 1) return (1); diff -Nru ncftp-3.2.5/libncftp/lglobr.c ncftp-3.2.6/libncftp/lglobr.c --- ncftp-3.2.5/libncftp/lglobr.c 2005-01-01 21:30:09.000000000 +0000 +++ ncftp-3.2.6/libncftp/lglobr.c 2016-10-30 17:32:31.000000000 +0000 @@ -10,12 +10,22 @@ # pragma hdrstop #endif + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + /* Used by FTPLocalRecursiveFileList */ typedef struct LRFLState { - int relativePathStartOffset; FTPFileInfoListPtr filp; + int relativePathStartOffset; } LRFLState; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + static int FTPLocalRecursiveFileListFtwProc(const FtwInfoPtr ftwip) diff -Nru ncftp-3.2.5/libncftp/libncftp.vcproj ncftp-3.2.6/libncftp/libncftp.vcproj --- ncftp-3.2.5/libncftp/libncftp.vcproj 2010-04-07 23:31:04.000000000 +0000 +++ ncftp-3.2.6/libncftp/libncftp.vcproj 2016-10-23 15:32:42.000000000 +0000 @@ -943,6 +943,10 @@ + + + + diff -Nru ncftp-3.2.5/libncftp/Makefile.in ncftp-3.2.6/libncftp/Makefile.in --- ncftp-3.2.5/libncftp/Makefile.in 2009-11-30 18:32:47.000000000 +0000 +++ ncftp-3.2.6/libncftp/Makefile.in 2016-08-13 19:06:14.000000000 +0000 @@ -31,11 +31,11 @@ LIBSO=libncftp.so.3 LIBSOS=libncftp.so -CFILES=c_chdir.c c_chdir3.c c_chdirlist.c c_chmod.c c_delete.c c_exists.c c_filetype.c c_getcwd.c c_mkdir.c c_mlist1.c c_modtime.c c_opennologin.c c_rename.c c_rhelp.c c_rmdir.c c_rmdirr.c c_size.c c_sizemdtm.c c_symlink.c c_type.c c_umask.c c_utime.c errno.c ftp.c ftw.c io_get.c io_getfiles.c io_getmem.c io_getonefile.c io_gettar.c io_list.c io_listmem.c io_put.c io_putfiles.c io_putmem.c io_putonefile.c io_util.c lglob.c lglobr.c linelist.c open.c rcmd.c rftw.c rglob.c rglobr.c u_close.c u_decodeurl.c u_decodehost.c u_error.c u_fileextn.c u_getcwd.c u_gethome.c u_getopt.c u_getpass.c u_getpw.c u_getusr.c u_getutc.c u_gmtime.c u_localtime.c u_misc.c u_miscdebug.c u_mkdirs.c u_pathcat.c u_printf.c u_rebuildci.c u_scram.c u_shutdownci.c u_signal.c u_slash.c u_unmdtm.c unls.c u_feat.c +CFILES=c_chdir.c c_chdir3.c c_chdirlist.c c_chmod.c c_delete.c c_exists.c c_filetype.c c_getcwd.c c_mkdir.c c_mlist1.c c_modtime.c c_opennologin.c c_rename.c c_rhelp.c c_rmdir.c c_rmdirr.c c_size.c c_sizemdtm.c c_symlink.c c_type.c c_umask.c c_utime.c errno.c ftp.c ftw.c io_get.c io_getfiles.c io_getmem.c io_getonefile.c io_gettar.c io_list.c io_listmem.c io_put.c io_putfiles.c io_putmem.c io_putonefile.c io_sendfile.c io_util.c lglob.c lglobr.c linelist.c open.c rcmd.c rftw.c rglob.c rglobr.c u_close.c u_decodeurl.c u_decodehost.c u_error.c u_fileextn.c u_getcwd.c u_gethome.c u_getopt.c u_getpass.c u_getpw.c u_getusr.c u_getutc.c u_gmtime.c u_localtime.c u_misc.c u_miscdebug.c u_mkdirs.c u_pathcat.c u_printf.c u_rebuildci.c u_scram.c u_shutdownci.c u_signal.c u_slash.c u_unmdtm.c unls.c u_feat.c -OBJS=c_chdir.@OBJEXT@ c_chdir3.@OBJEXT@ c_chdirlist.@OBJEXT@ c_chmod.@OBJEXT@ c_delete.@OBJEXT@ c_exists.@OBJEXT@ c_filetype.@OBJEXT@ c_getcwd.@OBJEXT@ c_mkdir.@OBJEXT@ c_mlist1.@OBJEXT@ c_modtime.@OBJEXT@ c_opennologin.@OBJEXT@ c_rename.@OBJEXT@ c_rhelp.@OBJEXT@ c_rmdir.@OBJEXT@ c_rmdirr.@OBJEXT@ c_size.@OBJEXT@ c_sizemdtm.@OBJEXT@ c_symlink.@OBJEXT@ c_type.@OBJEXT@ c_umask.@OBJEXT@ c_utime.@OBJEXT@ errno.@OBJEXT@ ftp.@OBJEXT@ ftw.@OBJEXT@ io_get.@OBJEXT@ io_getfiles.@OBJEXT@ io_getmem.@OBJEXT@ io_getonefile.@OBJEXT@ io_gettar.@OBJEXT@ io_list.@OBJEXT@ io_listmem.@OBJEXT@ io_put.@OBJEXT@ io_putfiles.@OBJEXT@ io_putmem.@OBJEXT@ io_putonefile.@OBJEXT@ io_util.@OBJEXT@ lglob.@OBJEXT@ lglobr.@OBJEXT@ linelist.@OBJEXT@ open.@OBJEXT@ rcmd.@OBJEXT@ rftw.@OBJEXT@ rglob.@OBJEXT@ rglobr.@OBJEXT@ u_close.@OBJEXT@ u_decodeurl.@OBJEXT@ u_decodehost.@OBJEXT@ u_error.@OBJEXT@ u_fileextn.@OBJEXT@ u_getcwd.@OBJEXT@ u_gethome.@OBJEXT@ u_getpass.@OBJEXT@ u_getopt.@OBJEXT@ u_getpw.@OBJEXT@ u_getusr.@OBJEXT@ u_getutc.@OBJEXT@ u_gmtime.@OBJEXT@ u_localtime.@OBJEXT@ u_misc.@OBJEXT@ u_miscdebug.@OBJEXT@ u_mkdirs.@OBJEXT@ u_pathcat.@OBJEXT@ u_printf.@OBJEXT@ u_rebuildci.@OBJEXT@ u_scram.@OBJEXT@ u_shutdownci.@OBJEXT@ u_signal.@OBJEXT@ u_slash.@OBJEXT@ u_unmdtm.@OBJEXT@ unls.@OBJEXT@ u_feat.@OBJEXT@ +OBJS=c_chdir.@OBJEXT@ c_chdir3.@OBJEXT@ c_chdirlist.@OBJEXT@ c_chmod.@OBJEXT@ c_delete.@OBJEXT@ c_exists.@OBJEXT@ c_filetype.@OBJEXT@ c_getcwd.@OBJEXT@ c_mkdir.@OBJEXT@ c_mlist1.@OBJEXT@ c_modtime.@OBJEXT@ c_opennologin.@OBJEXT@ c_rename.@OBJEXT@ c_rhelp.@OBJEXT@ c_rmdir.@OBJEXT@ c_rmdirr.@OBJEXT@ c_size.@OBJEXT@ c_sizemdtm.@OBJEXT@ c_symlink.@OBJEXT@ c_type.@OBJEXT@ c_umask.@OBJEXT@ c_utime.@OBJEXT@ errno.@OBJEXT@ ftp.@OBJEXT@ ftw.@OBJEXT@ io_get.@OBJEXT@ io_getfiles.@OBJEXT@ io_getmem.@OBJEXT@ io_getonefile.@OBJEXT@ io_gettar.@OBJEXT@ io_list.@OBJEXT@ io_listmem.@OBJEXT@ io_put.@OBJEXT@ io_putfiles.@OBJEXT@ io_putmem.@OBJEXT@ io_putonefile.@OBJEXT@ io_sendfile.@OBJEXT@ io_util.@OBJEXT@ lglob.@OBJEXT@ lglobr.@OBJEXT@ linelist.@OBJEXT@ open.@OBJEXT@ rcmd.@OBJEXT@ rftw.@OBJEXT@ rglob.@OBJEXT@ rglobr.@OBJEXT@ u_close.@OBJEXT@ u_decodeurl.@OBJEXT@ u_decodehost.@OBJEXT@ u_error.@OBJEXT@ u_fileextn.@OBJEXT@ u_getcwd.@OBJEXT@ u_gethome.@OBJEXT@ u_getpass.@OBJEXT@ u_getopt.@OBJEXT@ u_getpw.@OBJEXT@ u_getusr.@OBJEXT@ u_getutc.@OBJEXT@ u_gmtime.@OBJEXT@ u_localtime.@OBJEXT@ u_misc.@OBJEXT@ u_miscdebug.@OBJEXT@ u_mkdirs.@OBJEXT@ u_pathcat.@OBJEXT@ u_printf.@OBJEXT@ u_rebuildci.@OBJEXT@ u_scram.@OBJEXT@ u_shutdownci.@OBJEXT@ u_signal.@OBJEXT@ u_slash.@OBJEXT@ u_unmdtm.@OBJEXT@ unls.@OBJEXT@ u_feat.@OBJEXT@ -SOBJS=c_chdir.so c_chdir3.so c_chdirlist.so c_chmod.so c_delete.so c_exists.so c_filetype.so c_getcwd.so c_mkdir.so c_mlist1.so c_modtime.so c_opennologin.so c_rename.so c_rhelp.so c_rmdir.so c_rmdirr.so c_size.so c_sizemdtm.so c_symlink.so c_type.so c_umask.so c_utime.so errno.so ftp.so ftw.so io_get.so io_getfiles.so io_getmem.so io_getonefile.so io_gettar.so io_list.so io_listmem.so io_put.so io_putfiles.so io_putmem.so io_putonefile.so io_util.so lglob.so lglobr.so linelist.so open.so rcmd.so rftw.so rglob.so rglobr.so u_close.so u_decodeurl.so u_decodehost.so u_error.so u_fileextn.so u_getcwd.so u_gethome.so u_getopt.so u_getpass.so u_getpw.so u_getusr.so u_getutc.so u_gmtime.so u_localtime.so u_misc.so u_miscdebug.so u_mkdirs.so u_pathcat.so u_printf.so u_rebuildci.so u_scram.so u_shutdownci.so u_signal.so u_slash.so u_unmdtm.so unls.so u_feat.so +SOBJS=c_chdir.so c_chdir3.so c_chdirlist.so c_chmod.so c_delete.so c_exists.so c_filetype.so c_getcwd.so c_mkdir.so c_mlist1.so c_modtime.so c_opennologin.so c_rename.so c_rhelp.so c_rmdir.so c_rmdirr.so c_size.so c_sizemdtm.so c_symlink.so c_type.so c_umask.so c_utime.so errno.so ftp.so ftw.so io_get.so io_getfiles.so io_getmem.so io_getonefile.so io_gettar.so io_list.so io_listmem.so io_put.so io_putfiles.so io_putmem.so io_putonefile.so io_sendfile.so io_util.so lglob.so lglobr.so linelist.so open.so rcmd.so rftw.so rglob.so rglobr.so u_close.so u_decodeurl.so u_decodehost.so u_error.so u_fileextn.so u_getcwd.so u_gethome.so u_getopt.so u_getpass.so u_getpw.so u_getusr.so u_getutc.so u_gmtime.so u_localtime.so u_misc.so u_miscdebug.so u_mkdirs.so u_pathcat.so u_printf.so u_rebuildci.so u_scram.so u_shutdownci.so u_signal.so u_slash.so u_unmdtm.so unls.so u_feat.so # LIBSET=@LIBSET@ LIBSET=$(LIB) @@ -265,6 +265,9 @@ io_putonefile.o: io_putonefile.c $(SYSHDRS_DEP) io_putonefile.so: io_putonefile.c $(SYSHDRS_DEP) +io_sendfile.o: io_sendfile.c io_sendfile.h +io_sendfile.so: io_sendfile.c io_sendfile.h + io_util.o: io_util.c $(SYSHDRS_DEP) io_util.so: io_util.c $(SYSHDRS_DEP) diff -Nru ncftp-3.2.5/libncftp/ncftp_errno.h ncftp-3.2.6/libncftp/ncftp_errno.h --- ncftp-3.2.5/libncftp/ncftp_errno.h 2008-10-05 19:41:26.000000000 +0000 +++ ncftp-3.2.6/libncftp/ncftp_errno.h 2015-09-26 02:29:35.000000000 +0000 @@ -121,4 +121,5 @@ #define kErrAsciiSeekErr (-204) #define kErrKnownBug (-205) #define kErrBindCtrlSocket (-206) -#define kErrLast (206) +#define kErrPathTooLong (-207) +#define kErrLast (207) diff -Nru ncftp-3.2.5/libncftp/ncftp.h ncftp-3.2.6/libncftp/ncftp.h --- ncftp-3.2.5/libncftp/ncftp.h 2011-01-19 01:10:16.000000000 +0000 +++ ncftp-3.2.6/libncftp/ncftp.h 2016-11-12 19:16:23.000000000 +0000 @@ -1,6 +1,6 @@ /* ncftp.h * - * Copyright (c) 1996-2011 Mike Gleason, NcFTP Software. + * Copyright (c) 1996-2016 Mike Gleason, NcFTP Software. * All rights reserved. * */ @@ -13,10 +13,11 @@ { #endif /* __cplusplus */ -#define kLibraryVersion "@(#) LibNcFTP 3.2.5 (January 17, 2011)" +#define kLibraryVersion "@(#) LibNcFTP 3.2.6 (November 12, 2016)" /* This is used to verify validty of the data passed in. */ -#define kLibraryMagic "LibNcFTP 3.2.5" +#define kLibraryMagic "LibNcFTP 3.2.6" +#define kLibraryMagicLen 14 #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) /* Includes for Windows */ @@ -222,6 +223,11 @@ char *line; } FTPLine; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + typedef struct FTPLineList { FTPLinePtr first, last; int nLines; @@ -236,8 +242,8 @@ int hadEof; } Response, *ResponsePtr; -#if USE_SIO && !defined(_SReadlineInfo_) -#define _SReadlineInfo_ 1 +#if USE_SIO && !defined(defined_SReadlineInfo) +#define defined_SReadlineInfo 1 typedef struct SReadlineInfo { char *buf; /* Pointer to beginning of buffer. */ char *bufPtr; /* Pointer to current position in buffer. */ @@ -250,6 +256,10 @@ int requireEOLN; /* When buffer is full, continue reading and discarding until \n? */ } SReadlineInfo; #endif + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif typedef struct FTPLibraryInfo { char magic[16]; /* Don't modify this field. */ @@ -280,12 +290,12 @@ int errNo; /* You may modify this if you want. */ char lastFTPCmdResultStr[128]; /* You may modify this if you want. */ + int lastFTPCmdResultNum; /* You may modify this if you want. */ FTPLineList lastFTPCmdResultLL; /* Use, but do not modify. */ - int lastFTPCmdResultNum; /* You may modify this if you want. */ FILE *debugLog; /* OPTIONAL input parameter. */ - int debugTimestamping; /* OPTIONAL input parameter. */ FTPLogProc debugLogProc; /* OPTIONAL input parameter. */ + int debugTimestamping; /* OPTIONAL input parameter. */ unsigned int xferTimeout; /* OPTIONAL input parameter. */ unsigned int connTimeout; /* OPTIONAL input parameter. */ @@ -324,7 +334,6 @@ /* Used during transfers; valid during progress meter updates. */ FTPProgressMeterProc progress; /* OPTIONAL input parameter. */ longest_int bytesTransferred; /* Do not modify this field. */ - int useProgressMeter; /* Used internally. */ struct timeval t0; /* Do not modify this field. */ double sec; /* Do not modify this field. */ double secLeft; /* Do not modify this field. */ @@ -335,6 +344,7 @@ time_t nextProgressUpdate; /* Do not modify this field. */ const char *rname; /* Do not modify this field. */ const char *lname; /* Do not modify this field. */ + int useProgressMeter; /* Used internally. */ int stalled; /* Do not modify this field. */ int dataTimedOut; /* Do not modify this field. */ int cancelXfer; /* You may modify this. */ @@ -345,10 +355,13 @@ char ip[32]; /* Do not modify this field. */ char *startingWorkingDirectory; /* Use, but do not modify. */ + char *currentWorkingDirectory; /* Use, but do not modify. */ + size_t currentWorkingDirectorySize; /* Use, but do not modify. */ int connected; /* Do not modify this field. */ int loggedIn; /* Do not modify this field. */ int curTransferType; /* Do not modify this field. */ + int reserved2; longest_int startPoint; /* Do not modify this field. */ FILE *errLog; /* DEPRECATED input parameter. */ FTPLogProc errLogProc; /* DEPRECATED input parameter. */ @@ -361,6 +374,7 @@ int hasMFMT; /* Do not modify this field. */ int hasMFF; /* Do not modify this field. */ int hasREST; /* Do not modify this field. */ + int hasAPPE; /* You may modify this. */ int hasNLST_a; /* Do not modify this field. */ int hasNLST_d; /* Do not modify this field. */ int hasFEAT; /* Do not modify this field. */ @@ -387,9 +401,9 @@ struct sockaddr_in ourCtlAddr; /* Do not modify this field. */ struct sockaddr_in ourDataAddr; /* Do not modify this field. */ int netMode; /* Do not use or modify. */ + int doAllocBuf; /* Do not modify this field. */ char *buf; /* Do not modify this field. */ size_t bufSize; /* Do not modify this field. */ - int doAllocBuf; /* Do not modify this field. */ FILE *cin; /* Do not use or modify. */ FILE *cout; /* Do not use or modify. */ int ctrlSocketR; /* You may use but not modify/close. */ @@ -406,7 +420,8 @@ int numDials; /* Do not modify. */ int totalDials; /* Do not modify. */ - struct timeval initTime; /* Do not modify. */ + int doNotGetStartingWorkingDirectory; /* You may modify this. */ + struct timeval initTime; /* Do not modify. */ struct timeval startTime; /* Do not modify. */ struct timeval connectTime; /* Do not modify. */ struct timeval loginTime; /* Do not modify. */ @@ -416,8 +431,7 @@ int numDownloads; /* Do not modify. */ int numUploads; /* Do not modify. */ int numListings; /* Do not modify. */ - - int doNotGetStartingWorkingDirectory; /* You may modify this. */ + int reserved3; char textEOLN[4]; /* Set automatically per platform. */ int asciiTranslationMode; /* You may modify this. */ const char *manualOverrideFeatures; /* You may modify this. */ @@ -432,15 +446,24 @@ struct sockaddr_in preferredLocalAddr; /* You may modify this. */ int maxNumberOfSuccessivePASVAttempts; /* You may modify this. */ + int recentMdtmHeuristic; /* You may modify this. */ + time_t recentMdtmThreshold; /* You may modify this. */ + time_t timeBetweenUtimeBlocks; /* You may modify this. */ + int utimeBlocks; /* You may modify this. */ + int useSendfile; /* You may modify this. */ + int usingSendfile; /* Do not use or modify. */ #if USE_SIO - char srlBuf[768]; + int srlReserved; + char srlBuf[1024]; SReadlineInfo ctrlSrl; /* Do not use or modify. */ #endif - int iUser; /* Scratch integer field you can use. */ + int iUser; /* Scratch integer field you can use. */ + int iUser2; /* Scratch integer field you can use. */ void *pUser; /* Scratch pointer field you can use. */ longest_int llUser; /* Scratch long long field you can use. */ int reserved[32]; /* Do not use or modify. */ + char tailMagic[16]; /* Do not use or modify. */ } FTPConnectionInfo; typedef struct FTPFileInfo *FTPFileInfoPtr, **FTPFileInfoVec; @@ -452,10 +475,10 @@ char *lname; char *plug; /* permissions, links, user, group */ int type; + int mode; /* Only set by UnMlsD() */ time_t mdtm; longest_int size; size_t relnameLen; - int mode; /* Only set by UnMlsD() */ } FTPFileInfo; typedef struct FTPFileInfoList { @@ -466,15 +489,16 @@ int nFileInfos; int sortKey; int sortOrder; + int reserved; } FTPFileInfoList, *FTPFileInfoListPtr; /* Used with UnMlsT() */ typedef struct MLstItem{ char fname[512]; char linkto[512]; - int ftype; longest_int fsize; time_t ftime; + int ftype; int mode; /* "UNIX.mode" fact */ int uid; /* "UNIX.uid" fact */ int gid; /* "UNIX.gid" fact */ @@ -514,6 +538,8 @@ # define kDefaultFTPBufSize 32768 #endif +#define kDefaultPathBufSize 4096 + #ifdef USE_SIO /* This version of the library can handle timeouts without * a user-installed signal handler. @@ -733,6 +759,8 @@ # define TVFSPathToLocalPath(s) # define LocalPathToTVFSPath(s) #endif +#define LocalPathBuild(dst,dsize,dlen,pdir,fn) PathBuild(dst, dsize, dlen, LOCAL_PATH_DELIM, pdir, fn) +#define TVFSPathBuild(dst,dsize,dlen,pdir,fn) PathBuild(dst, dsize, dlen, '/', pdir, fn) #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) typedef struct dirent { @@ -790,7 +818,7 @@ typedef int (*FtwProc)(const FtwInfoPtr ftwip); typedef struct FtwInfo { - unsigned int init; + unsigned int magic, init; FtwProc proc; char *curPath; size_t curPathLen; @@ -798,14 +826,16 @@ size_t startPathLen; char *curFile; size_t curFileLen; - int curType; struct Stat curStat; + int curType; int noAutoMallocAndFree; int dirSeparator; char rootDir[4]; int autoGrow; + int isBaseDir; size_t depth; size_t maxDepth; + size_t maxDepthAllowed; size_t numDirs; size_t numFiles; size_t numLinks; @@ -910,8 +940,8 @@ int FTPOpenHostNoLogin(const FTPCIPtr cip); void FTPPerror(const FTPCIPtr cip, const int err, const int eerr, const char *const s1, const char *const s2); int FTPPutFileFromMemory(const FTPCIPtr cip, const char *volatile dstfile, const char *volatile src, const size_t srcLen, const int appendflag); -int FTPPutFiles3(const FTPCIPtr cip, const char *const pattern, const char *const dstdir1, const int recurse, const int doGlob, const int xtype, int appendflag, const char *const tmppfx, const char *const tmpsfx, const int resumeflag, const int deleteflag, const FTPConfirmResumeUploadProc resumeProc, int UNUSED(reserved)); -int FTPPutOneFile3(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int appendflag, const char *const tmppfx, const char *const tmpsfx, const int resumeflag, const int deleteflag, const FTPConfirmResumeUploadProc resumeProc, int UNUSED(reserved)); +int FTPPutOneFile4(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int appendflag, const char *const tmppfx, const char *const tmpsfx, const int resumeflag, const int deleteflag, const FTPConfirmResumeUploadProc resumeProc, const time_t batchStartTime, const time_t origLmtime); +int FTPPutFiles4(const FTPCIPtr cip, const char *const pattern, const char *const dstdir1, const int recurse, const int doGlob, const int xtype, const int appendflag, const char *const tmppfx, const char *const tmpsfx, const int resumeflag, const int deleteflag, const FTPConfirmResumeUploadProc resumeProc, const time_t batchStartTime, const time_t origLmtime); int FTPReadLoginConfigFile(FTPCIPtr cip, const char *const fn); int FTPRemoteGlob(FTPCIPtr cip, FTPLineListPtr fileList, const char *pattern, int doGlob); int FTPRename(const FTPCIPtr cip, const char *const oldname, const char *const newname); @@ -954,7 +984,11 @@ void GetTmpDir(char *const dst, const size_t size); void GetUsrName(char *, size_t); void Scramble(unsigned char *dst, size_t dsize, unsigned char *src, char *key); -double FTPDuration(struct timeval *t0); +#ifndef tvcopy +# define tvcopy(dst,src) dst.tv_sec = src.tv_sec; dst.tv_usec = src.tv_usec +#endif +double FTPDuration(struct timeval *const t0); +double FTPDuration2(struct timeval *const xt0, struct timeval *const xt1); struct tm *Gmtime(time_t t, struct tm *const tp); struct tm *Localtime(time_t t, struct tm *const tp); time_t GetUTCOffset(const int mon, const int mday); @@ -973,6 +1007,7 @@ void TVFSPathToLocalPath(char *dst); void LocalPathToTVFSPath(char *dst); #endif +int PathBuild(char *const dst, const size_t dsize, size_t *const dResultingLength, int dirSep, const char *const parentDir, const char *const fileName); #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) int gettimeofday(struct timeval *const tp, void *junk); void WinSleep(unsigned int seconds); @@ -993,8 +1028,10 @@ int FTPGetFilesAscii(const FTPCIPtr cip, const char *const pattern, const char *const dstdir, const int recurse, const int doGlob); int FTPPutOneFile(const FTPCIPtr cip, const char *const file, const char *const dstfile); int FTPPutOneFile2(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int appendflag, const char *const tmppfx, const char *const tmpsfx); +int FTPPutOneFile3(const FTPCIPtr cip, const char *const file, const char *const dstfile, const int xtype, const int fdtouse, const int appendflag, const char *const tmppfx, const char *const tmpsfx, const int resumeflag, const int deleteflag, const FTPConfirmResumeUploadProc resumeProc, int UNUSED(reserved)); int FTPPutFiles(const FTPCIPtr cip, const char *const pattern, const char *const dstdir, const int recurse, const int doGlob); int FTPPutFiles2(const FTPCIPtr cip, const char *const pattern, const char *const dstdir, const int recurse, const int doGlob, const int xtype, const int appendflag, const char *const tmppfx, const char *const tmpsfx); +int FTPPutFiles3(const FTPCIPtr cip, const char *const pattern, const char *const dstdir1, const int recurse, const int doGlob, const int xtype, int appendflag, const char *const tmppfx, const char *const tmpsfx, const int resumeflag, const int deleteflag, const FTPConfirmResumeUploadProc resumeProc, int UNUSED(reserved)); int FTPPutOneFileAscii(const FTPCIPtr cip, const char *const file, const char *const dstfile); int FTPPutFilesAscii(const FTPCIPtr cip, const char *const pattern, const char *const dstdir, const int recurse, const int doGlob); diff -Nru ncftp-3.2.5/libncftp/open.c ncftp-3.2.6/libncftp/open.c --- ncftp-3.2.5/libncftp/open.c 2010-06-16 12:48:21.000000000 +0000 +++ ncftp-3.2.6/libncftp/open.c 2016-11-13 00:28:08.000000000 +0000 @@ -63,6 +63,12 @@ } } + if (cip->currentWorkingDirectory != NULL) { + free(cip->currentWorkingDirectory); + cip->currentWorkingDirectory = NULL; + cip->currentWorkingDirectorySize = 0; + } + if (cip->startingWorkingDirectory != NULL) { free(cip->startingWorkingDirectory); cip->startingWorkingDirectory = NULL; @@ -141,7 +147,7 @@ if ((cip->firewallType < kFirewallNotInUse) || (cip->firewallType > kFirewallLastType)) return (kErrBadParameter); - if (strcmp(cip->magic, kLibraryMagic)) + if ((memcmp(cip->magic, kLibraryMagic, kLibraryMagicLen) != 0) || (memcmp(cip->tailMagic, kLibraryMagic, kLibraryMagicLen) != 0)) return (kErrBadMagic); anonLogin = 0; @@ -323,10 +329,20 @@ free(cip->startingWorkingDirectory); cip->startingWorkingDirectory = NULL; } - if ((cip->doNotGetStartingWorkingDirectory == 0) && - (FTPGetCWD(cip, cwd, sizeof(cwd)) == kNoErr)) - { - cip->startingWorkingDirectory = StrDup(cwd); + /* We'll setup the pwd cache now unless you've disabled it or already customized its setup. */ + if ((cip->currentWorkingDirectory == NULL) && (cip->currentWorkingDirectorySize > 0)) { + cip->currentWorkingDirectory = malloc(cip->currentWorkingDirectorySize); + if (cip->currentWorkingDirectory == NULL) + cip->currentWorkingDirectorySize = 0; + else + memset(cip->currentWorkingDirectory, 0, cip->currentWorkingDirectorySize); + } + if (cip->doNotGetStartingWorkingDirectory == 0) { + if ((cip->currentWorkingDirectory != NULL) && (FTPGetCWD(cip, cip->currentWorkingDirectory, cip->currentWorkingDirectorySize) == kNoErr)) { + cip->startingWorkingDirectory = StrDup(cip->currentWorkingDirectory); + } else if (FTPGetCWD(cip, cwd, sizeof(cwd)) == kNoErr) { + cip->startingWorkingDirectory = StrDup(cwd); + } } /* When a new site is opened, ASCII mode is assumed (by protocol). */ @@ -618,7 +634,7 @@ if (cip == NULL) return (kErrBadParameter); - if (strcmp(cip->magic, kLibraryMagic)) + if ((memcmp(cip->magic, kLibraryMagic, kLibraryMagicLen) != 0) || (memcmp(cip->tailMagic, kLibraryMagic, kLibraryMagicLen) != 0)) return (kErrBadMagic); /* Data connection shouldn't be open normally. */ @@ -875,7 +891,7 @@ if (cip == NULL) return (kErrBadParameter); - if (strcmp(cip->magic, kLibraryMagic)) + if ((memcmp(cip->magic, kLibraryMagic, kLibraryMagicLen) != 0) || (memcmp(cip->tailMagic, kLibraryMagic, kLibraryMagicLen) != 0)) return (kErrBadMagic); if (cip->host[0] == '\0') { @@ -962,10 +978,10 @@ elapsed = (int) (t1 - t0); if (elapsed < cip->redialDelay) { PrintF(cip, "Sleeping %u seconds.\n", - (unsigned) cip->redialDelay - elapsed); + (unsigned int) (cip->redialDelay - elapsed)); if (cip->redialStatusProc != 0) (*cip->redialStatusProc)(cip, kRedialStatusSleeping, cip->redialDelay - elapsed); - (void) sleep((unsigned) cip->redialDelay - elapsed); + (void) sleep((unsigned int) (cip->redialDelay - elapsed)); } } } @@ -1044,8 +1060,22 @@ cip->hasRETR_tar = kCommandAvailabilityUnknown; cip->firewallType = kFirewallNotInUse; cip->startingWorkingDirectory = NULL; + cip->currentWorkingDirectory = NULL; + cip->currentWorkingDirectorySize = kDefaultPathBufSize; cip->shutdownUnusedSideOfSockets = 0; cip->asciiTranslationMode = kAsciiTranslationModeDefault; + + /* Previous versions (<= 3.2.5) used the equivalent of these defaults: + cip->recentMdtmHeuristic = 00001; + cip->recentMdtmThreshold = 86400 / 2; + cip->utimeBlocks = 1; + cip->timeBetweenUtimeBlocks = 0; + */ + + cip->recentMdtmHeuristic = 00002; + cip->recentMdtmThreshold = 86400 * 7; + cip->utimeBlocks = 0; + cip->timeBetweenUtimeBlocks = 2; #ifdef MACOSX /* For Mac OS 9 compatibility you could set this to '\r' */ @@ -1059,6 +1089,7 @@ InitLineList(&cip->lastFTPCmdResultLL); (void) STRNCPY(cip->magic, kLibraryMagic); + (void) STRNCPY(cip->tailMagic, kLibraryMagic); (void) STRNCPY(cip->user, "anonymous"); (void) gettimeofday(&cip->initTime, NULL); return (kNoErr); diff -Nru ncftp-3.2.5/libncftp/rcmd.c ncftp-3.2.6/libncftp/rcmd.c --- ncftp-3.2.5/libncftp/rcmd.c 2008-07-14 00:40:23.000000000 +0000 +++ ncftp-3.2.6/libncftp/rcmd.c 2016-10-30 17:22:21.000000000 +0000 @@ -14,7 +14,9 @@ # define NO_SIGNALS 1 #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif @@ -568,7 +570,7 @@ startPoint = (longest_int) 0; } else if (FTPSetStartOffset(cip, startPoint) != 0) { /* REST failed */ - if ((cmdstr != NULL) && (ISTRNEQ(cmdstr, "STOR ", 5))) { + if ((cip->hasAPPE != kCommandNotAvailable) && (cmdstr != NULL) && (ISTRNEQ(cmdstr, "STOR ", 5))) { memcpy(cmdstr, "APPE ", 5); } else { startPoint = (longest_int) 0; @@ -614,7 +616,7 @@ respCode = rp->codeType; DoneWithResponse(cip, rp); - if ((respCode > 2) && (cmdstr != NULL) && (ISTRNEQ(cmdstr, "STOR ", 5)) && (startPoint != (longest_int) 0)) { + if ((respCode > 2) && (cmdstr != NULL) && (ISTRNEQ(cmdstr, "STOR ", 5)) && (cip->hasAPPE != kCommandNotAvailable) && (startPoint != (longest_int) 0)) { /* Special case: REST + STOR is the same as APPE */ (void) FTPCmd(cip, "REST 0"); memcpy(cmdstr, "APPE ", 4 + 1); diff -Nru ncftp-3.2.5/libncftp/rftw.c ncftp-3.2.6/libncftp/rftw.c --- ncftp-3.2.5/libncftp/rftw.c 2005-01-01 21:30:19.000000000 +0000 +++ ncftp-3.2.6/libncftp/rftw.c 2016-11-13 00:26:45.000000000 +0000 @@ -10,6 +10,12 @@ # pragma hdrstop #endif + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + /* Internal to rftw.c */ typedef struct FtwSubDirList *FtwSubDirListPtr; typedef struct FtwSubDirList { @@ -19,6 +25,10 @@ char name[1]; } FtwSubDirList; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + /* This mess is essentially the local version of Ftw with FTP * grafted onto it, so see that and grok that before studying this. */ @@ -100,7 +110,7 @@ nSubdirs = 0; ++ftwip->numDirs; - ftwip->depth = depth; + ftwip->depth = (size_t) depth; if (ftwip->maxDepth < ftwip->depth) { ftwip->maxDepth = ftwip->depth; } diff -Nru ncftp-3.2.5/libncftp/rglob.c ncftp-3.2.6/libncftp/rglob.c --- ncftp-3.2.5/libncftp/rglob.c 2010-04-07 02:24:04.000000000 +0000 +++ ncftp-3.2.6/libncftp/rglob.c 2016-10-30 17:37:31.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif static void diff -Nru ncftp-3.2.5/libncftp/rglobr.c ncftp-3.2.6/libncftp/rglobr.c --- ncftp-3.2.5/libncftp/rglobr.c 2010-04-03 20:49:39.000000000 +0000 +++ ncftp-3.2.6/libncftp/rglobr.c 2016-11-13 00:26:19.000000000 +0000 @@ -94,7 +94,7 @@ fi.mdtm = ftwip->curStat.st_mtime; fi.size = (longest_int) ftwip->curStat.st_size; fi.type = ftwip->curType; - fi.mode = ftwip->curStat.st_mode; + fi.mode = (int) ftwip->curStat.st_mode; AddFileInfo(xinfop->fileList, &fi); /* diff -Nru ncftp-3.2.5/libncftp/u_decodehost.c ncftp-3.2.6/libncftp/u_decodehost.c --- ncftp-3.2.5/libncftp/u_decodehost.c 2005-01-01 21:30:29.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_decodehost.c 2016-11-13 00:24:56.000000000 +0000 @@ -80,7 +80,7 @@ port = atoi(cp); if ((port <= 0) || (port > 65535)) return (-2); - cip->port = port; + cip->port = (unsigned int) port; } (void) STRNCPY(cip->host, hcp); diff -Nru ncftp-3.2.5/libncftp/u_decodeurl.c ncftp-3.2.6/libncftp/u_decodeurl.c --- ncftp-3.2.5/libncftp/u_decodeurl.c 2008-07-14 00:39:22.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_decodeurl.c 2016-11-13 00:25:29.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif -#define _CRT_SECURE_NO_WARNINGS 1 +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) +# define _CRT_SECURE_NO_WARNINGS 1 +#endif void URLCopyToken(char *dst, size_t dsize, const char *src, size_t howmuch) @@ -165,7 +167,7 @@ URLCopyToken(portstr, sizeof(portstr), cp + 1, (size_t) (hend - (cp + 1))); port = atoi(portstr); if (port > 0) - cip->port = port; + cip->port = (unsigned int) port; } *hend = (char) sc; diff -Nru ncftp-3.2.5/libncftp/u_error.c ncftp-3.2.6/libncftp/u_error.c --- ncftp-3.2.5/libncftp/u_error.c 2009-02-21 17:53:37.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_error.c 2016-10-30 17:37:49.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif /*VARARGS*/ void diff -Nru ncftp-3.2.5/libncftp/u_feat.c ncftp-3.2.6/libncftp/u_feat.c --- ncftp-3.2.5/libncftp/u_feat.c 2007-07-29 14:38:29.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_feat.c 2015-09-23 20:41:24.000000000 +0000 @@ -58,6 +58,7 @@ "MDTM", "MDTM_set", "REST", + "APPE", "NLST_a", "NLST_d", "FEAT", @@ -66,6 +67,7 @@ "CLNT", "HELP_SITE", "SITE_UTIME", + "MFMT", "STATfileParamWorks", "NLSTfileParamWorks", "require20", @@ -80,6 +82,7 @@ kOptMDTM, kOptMDTM_set, kOptREST, + kOptAPPE, kOptNLST_a, kOptNLST_d, kOptFEAT, @@ -88,6 +91,7 @@ kOptCLNT, kOptHELP_SITE, kOptSITE_UTIME, + kOptMFMT, kOptSTATfileParamWorks, kOptNLSTfileParamWorks, kOptRequire20, @@ -163,6 +167,9 @@ case kOptREST: cip->hasREST = intval; break; + case kOptAPPE: + cip->hasAPPE = intval; + break; case kOptNLST_a: cip->hasNLST_a = intval; break; @@ -187,6 +194,9 @@ case kOptSITE_UTIME: cip->hasSITE_UTIME = intval; break; + case kOptMFMT: + cip->hasMFMT = intval; + break; case kOptSTATfileParamWorks: cip->STATfileParamWorks = intval; break; diff -Nru ncftp-3.2.5/libncftp/u_fileextn.c ncftp-3.2.6/libncftp/u_fileextn.c --- ncftp-3.2.5/libncftp/u_fileextn.c 2008-07-14 00:38:10.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_fileextn.c 2016-10-30 17:36:53.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif int FilenameExtensionIndicatesASCII(const char *const pathName, const char *const extnList) @@ -40,12 +42,15 @@ } #ifdef HAVE_SNPRINTF snprintf(extnPattern, sizeof(extnPattern), + "|.%s|", + extn + ); #else sprintf(extnPattern, + "|.%s|", + extn + ); #endif - "|.%s|", - extn - ); cp = extnPattern; forever { diff -Nru ncftp-3.2.5/libncftp/u_getpass.c ncftp-3.2.6/libncftp/u_getpass.c --- ncftp-3.2.5/libncftp/u_getpass.c 2006-08-05 23:46:40.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_getpass.c 2016-11-13 00:24:30.000000000 +0000 @@ -67,7 +67,7 @@ if (tcgetattr(fileno(stdout), &old_ti) != 0) return (pwbuf); new_ti = old_ti; - new_ti.c_lflag &= ~ECHO; + new_ti.c_lflag &= (unsigned int) ~ECHO; if (tcsetattr(fileno(stdout), TCSAFLUSH, &new_ti) != 0) return (pwbuf); (void) FGets(pwbuf, pwbufsize, stdin); diff -Nru ncftp-3.2.5/libncftp/u_getusr.c ncftp-3.2.6/libncftp/u_getusr.c --- ncftp-3.2.5/libncftp/u_getusr.c 2008-07-14 00:37:33.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_getusr.c 2016-10-30 17:37:18.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif void GetUsrName(char *dst, size_t size) diff -Nru ncftp-3.2.5/libncftp/u_gmtime.c ncftp-3.2.6/libncftp/u_gmtime.c --- ncftp-3.2.5/libncftp/u_gmtime.c 2008-07-14 00:37:08.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_gmtime.c 2016-10-30 17:22:21.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif struct tm * Gmtime(time_t t, struct tm *const tp) @@ -18,11 +20,15 @@ #if defined(HAVE_GMTIME_R) && (defined(HPUX)) && (HPUX < 1100) if (t == 0) time(&t); + if (tp != NULL) + memset(tp, 0, sizeof(struct tm)); if (gmtime_r(&t, tp) == 0) return (tp); #elif defined(HAVE_GMTIME_R) && !defined(MACOSX) if (t == 0) time(&t); + if (tp != NULL) + memset(tp, 0, sizeof(struct tm)); if (gmtime_r(&t, tp) != NULL) return (tp); #else @@ -36,6 +42,7 @@ return (tp); } #endif - memset(tp, 0, sizeof(struct tm)); + if (tp != NULL) + memset(tp, 0, sizeof(struct tm)); return NULL; } /* Gmtime */ diff -Nru ncftp-3.2.5/libncftp/u_localtime.c ncftp-3.2.6/libncftp/u_localtime.c --- ncftp-3.2.5/libncftp/u_localtime.c 2008-07-14 00:37:03.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_localtime.c 2016-10-30 17:36:53.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif struct tm * Localtime(time_t t, struct tm *const tp) @@ -18,11 +20,15 @@ #if defined(HAVE_LOCALTIME_R) && (defined(HPUX)) && (HPUX < 1100) if (t == 0) time(&t); + if (tp != NULL) + memset(tp, 0, sizeof(struct tm)); if (localtime_r(&t, tp) == 0) return (tp); #elif defined(HAVE_LOCALTIME_R) && !defined(MACOSX) if (t == 0) time(&t); + if (tp != NULL) + memset(tp, 0, sizeof(struct tm)); if (localtime_r(&t, tp) != NULL) return (tp); #else @@ -36,6 +42,7 @@ return (tp); } #endif - memset(tp, 0, sizeof(struct tm)); + if (tp != NULL) + memset(tp, 0, sizeof(struct tm)); return NULL; } /* Localtime */ diff -Nru ncftp-3.2.5/libncftp/u_misc.c ncftp-3.2.6/libncftp/u_misc.c --- ncftp-3.2.5/libncftp/u_misc.c 2009-11-30 18:08:47.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_misc.c 2016-11-13 00:23:32.000000000 +0000 @@ -240,6 +240,7 @@ } /* TVFSPathToLocalPath */ + void LocalPathToTVFSPath(char *dst) { @@ -260,6 +261,82 @@ +int +PathBuild(char *const dst, const size_t dsize, size_t *const dResultingLength, int dirSep, const char *const parentDir, const char *const fileName) +{ + char *dEnd = NULL; + char dirSepStr[4]; + size_t nUsed; + +#ifdef EINVAL + errno = 0; +#endif + + if (dsize < 4) { +#ifdef EINVAL + errno = EINVAL; +#endif + return (-3); + } + if (dResultingLength != NULL) + *dResultingLength = 0; + memset(dst, 0, dsize); + + if ((parentDir == NULL) || (parentDir[0] == '\0') || ((parentDir[0] == '.') && (parentDir[1] == '\0'))) { + dEnd = Strnpcpy(dst, ((fileName == NULL) || (fileName[0] == '\0')) ? "." : fileName, dsize); + } else if ((fileName == NULL) || (fileName[0] == '\0')) { + dEnd = Strnpcpy(dst, parentDir, dsize); + } else { + dirSepStr[0] = (char) dirSep; + dirSepStr[1] = '\0'; + dEnd = Strnpcpy(dst, parentDir, dsize); + nUsed = (size_t) (dEnd - dst); + if (nUsed >= (dsize - 3)) { +#ifdef ENAMETOOLONG + errno = ENAMETOOLONG; +#elif defined(ERANGE) + errno = ERANGE; +#endif + return (-1); + } + if (strcmp(dst, dirSepStr) != 0) { + /* Append the separator, unless the file is in the root directory. */ + if (dEnd != NULL) dEnd = Strnpcpy(dEnd, dirSepStr, dsize - nUsed); + } + if (nUsed >= (dsize - 2)) { +#ifdef ENAMETOOLONG + errno = ENAMETOOLONG; +#elif defined(ERANGE) + errno = ERANGE; +#endif + return (-1); + } + if (dEnd != NULL) dEnd = Strnpcpy(dEnd, fileName, dsize - nUsed); + } + + if (dEnd == NULL) { +#ifdef EINVAL + errno = EINVAL; +#endif + return (-2); + } + + if (dResultingLength != NULL) + *dResultingLength = (size_t) (dEnd - dst); + + if (dst[dsize - 2] != '\0') { +#ifdef ENAMETOOLONG + errno = ENAMETOOLONG; +#elif defined(ERANGE) + errno = ERANGE; +#endif + return (-1); /* Truncation likely occurred */ + } + return ((int) (dEnd - dst)); +} /* PathBuild */ + + + #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) int diff -Nru ncftp-3.2.5/libncftp/u_mkdirs.c ncftp-3.2.6/libncftp/u_mkdirs.c --- ncftp-3.2.5/libncftp/u_mkdirs.c 2008-07-14 00:36:41.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_mkdirs.c 2016-10-30 17:24:54.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif int MkDirs(const char *const newdir, int mode1) @@ -33,7 +35,7 @@ errno = 0; /* We can return 0 but set errno to EEXIST */ #if defined(WIN32) || defined(_WINDOWS) || defined(__CYGWIN__) - if ((isalpha(newdir[0])) && (newdir[1] == ':')) { + if ((isalpha((int) newdir[0])) && (newdir[1] == ':')) { if (! IsLocalPathDelim(newdir[2])) { /* Special case "c:blah", and errout. * "c:\blah" must be used or _access GPFs. @@ -84,8 +86,8 @@ errno = ENAMETOOLONG; #else errno = EINVAL; - return (-1); #endif + return (-1); } cp = StrRFindLocalPathDelim(s); diff -Nru ncftp-3.2.5/libncftp/unls.c ncftp-3.2.6/libncftp/unls.c --- ncftp-3.2.5/libncftp/unls.c 2010-11-26 22:47:56.000000000 +0000 +++ ncftp-3.2.6/libncftp/unls.c 2016-10-30 17:35:42.000000000 +0000 @@ -989,12 +989,15 @@ if (mli.group[0] != '\0') { #ifdef HAVE_SNPRINTF snprintf(og, sizeof(og) - 1, + " %-8.8s %s", + mli.owner, mli.group + ); #else sprintf(og, + " %-8.8s %s", + mli.owner, mli.group + ); #endif /* HAVE_SNPRINTF */ - " %-8.8s %s", - mli.owner, mli.group - ); STRNCAT(plug, og); } else { STRNCAT(plug, " "); diff -Nru ncftp-3.2.5/libncftp/u_pathcat.c ncftp-3.2.6/libncftp/u_pathcat.c --- ncftp-3.2.5/libncftp/u_pathcat.c 2006-07-27 15:48:57.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_pathcat.c 2016-11-13 00:23:04.000000000 +0000 @@ -290,7 +290,7 @@ *cp++ = '/'; } *cp = '\0'; - (void) Strnpcat(cp, src, sizeof(tmp) - (cp - tmp)); + (void) Strnpcat(cp, src, sizeof(tmp) - (size_t) (cp - tmp)); CompressPath(dst, tmp, dsize, dosCompat); } /* PathCat */ @@ -370,7 +370,7 @@ *cp++ = '/'; } *cp = '\0'; - (void) Strnpcat(cp, src, dsize - (cp - tmp)); + (void) Strnpcat(cp, src, dsize - (size_t) (cp - tmp)); CompressPath(dst, tmp, dsize, dosCompat); free(tmp); return (0); diff -Nru ncftp-3.2.5/libncftp/u_printf.c ncftp-3.2.6/libncftp/u_printf.c --- ncftp-3.2.5/libncftp/u_printf.c 2009-07-28 20:24:24.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_printf.c 2016-10-30 17:22:21.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif /*VARARGS*/ void diff -Nru ncftp-3.2.5/libncftp/u_rebuildci.c ncftp-3.2.6/libncftp/u_rebuildci.c --- ncftp-3.2.5/libncftp/u_rebuildci.c 2008-07-13 23:01:00.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_rebuildci.c 2016-05-29 03:39:09.000000000 +0000 @@ -33,8 +33,12 @@ cip->onLoginMsgProc = NULL; cip->passphraseProc = NULL; cip->startingWorkingDirectory = NULL; + cip->currentWorkingDirectory = NULL; + if (cip->currentWorkingDirectorySize == 0) + cip->currentWorkingDirectorySize = kDefaultPathBufSize; /* Will automatically reallocate at this size */ cip->asciiFilenameExtensions = NULL; cip->dataTimedOut = 0; + cip->pUser = NULL; (void) memset(&cip->lastFTPCmdResultLL, 0, sizeof(FTPLineList)); diff -Nru ncftp-3.2.5/libncftp/u_scram.c ncftp-3.2.6/libncftp/u_scram.c --- ncftp-3.2.5/libncftp/u_scram.c 2005-01-01 21:31:29.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_scram.c 2016-11-13 00:22:03.000000000 +0000 @@ -24,7 +24,7 @@ ch = src[i]; if (ch == 0) break; - dst[i] = (unsigned char) (ch ^ (int) (k2[i % (int) keyLen])); + dst[i] = (unsigned char) (ch ^ (unsigned int) (k2[i % (int) keyLen])); } dst[i] = '\0'; } /* Scramble */ diff -Nru ncftp-3.2.5/libncftp/util.h ncftp-3.2.6/libncftp/util.h --- ncftp-3.2.5/libncftp/util.h 2008-07-14 02:01:28.000000000 +0000 +++ ncftp-3.2.6/libncftp/util.h 2016-05-28 18:19:16.000000000 +0000 @@ -122,7 +122,9 @@ const char *volatile tmpsfx, const int resumeflag, const int deleteflag, - const FTPConfirmResumeUploadProc resumeProc); + const FTPConfirmResumeUploadProc resumeProc, + const time_t batchStartTime, + const time_t origLmtime); int FTPGetOneTarF(const FTPCIPtr cip, const char *file, const char *const dstdir); @@ -133,6 +135,7 @@ /* cmds misc */ int FTPRmdirRecursive(const FTPCIPtr cip, const char *const dir); +int FTPRmdirRecursive2(const FTPCIPtr cip, const char *const dir, const int rmEmptyDirsOnly); void FTPRequestMlsOptions(const FTPCIPtr cip); void RemoteGlobCollapse(const FTPCIPtr, const char *pattern, FTPLineListPtr fileList); int PathContainsIntermediateDotDotSubDir(const char *s); diff -Nru ncftp-3.2.5/libncftp/u_unmdtm.c ncftp-3.2.6/libncftp/u_unmdtm.c --- ncftp-3.2.5/libncftp/u_unmdtm.c 2008-07-14 00:32:02.000000000 +0000 +++ ncftp-3.2.6/libncftp/u_unmdtm.c 2016-10-30 17:38:04.000000000 +0000 @@ -10,7 +10,9 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif /* Converts a MDTM date, like "19930602204445" * format to a time_t. diff -Nru ncftp-3.2.5/libncftp/wincfg.h ncftp-3.2.6/libncftp/wincfg.h --- ncftp-3.2.5/libncftp/wincfg.h 2001-11-17 11:03:04.000000000 +0000 +++ ncftp-3.2.6/libncftp/wincfg.h 2016-11-27 20:25:35.000000000 +0000 @@ -16,6 +16,7 @@ #define recv_size_t unsigned int #define send_return_t int #define send_size_t unsigned int +#define sa_family_t short #define SELECT_TYPE_ARG1 int diff -Nru ncftp-3.2.5/Makefile.in ncftp-3.2.6/Makefile.in --- ncftp-3.2.5/Makefile.in 2009-07-22 23:41:30.000000000 +0000 +++ ncftp-3.2.6/Makefile.in 2016-08-14 02:16:09.000000000 +0000 @@ -123,4 +123,3 @@ sgz gz: ./sh/mksrctar.sh $(TARDIR) $(STGZFILE) '@TAR@' '@TARFLAGS@' -@Z31@ diff -Nru ncftp-3.2.5/ncftp/bookmark.c ncftp-3.2.6/ncftp/bookmark.c --- ncftp-3.2.5/ncftp/bookmark.c 2010-04-07 23:13:26.000000000 +0000 +++ ncftp-3.2.6/ncftp/bookmark.c 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* bookmark.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -547,7 +547,7 @@ if ((nb != gNumBookmarks) && (gBookmarkTable != NULL)) { /* Re-loading the table from disk. */ gBookmarkTable = (Bookmark *) realloc(gBookmarkTable, (size_t) (nb + 1) * sizeof(Bookmark)); - memset(gBookmarkTable, 0, (nb + 1) * sizeof(Bookmark)); + memset(gBookmarkTable, 0, (size_t) (nb + 1) * sizeof(Bookmark)); } else { gBookmarkTable = calloc((size_t) (nb + 1), (size_t) sizeof(Bookmark)); } diff -Nru ncftp-3.2.5/ncftp/bookmark.h ncftp-3.2.6/ncftp/bookmark.h --- ncftp-3.2.5/ncftp/bookmark.h 2008-08-02 03:13:29.000000000 +0000 +++ ncftp-3.2.6/ncftp/bookmark.h 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* bookmark.h * - * Copyright (c) 1992-2004 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -25,8 +25,8 @@ char comment[128]; int xferMode; int hasUTIME; - int deleted; + int reserved; } Bookmark; #define kBookmarkVersion 8 diff -Nru ncftp-3.2.5/ncftp/cmdlist.c ncftp-3.2.6/ncftp/cmdlist.c --- ncftp-3.2.5/ncftp/cmdlist.c 2008-07-08 23:04:55.000000000 +0000 +++ ncftp-3.2.6/ncftp/cmdlist.c 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* cmdlist.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ diff -Nru ncftp-3.2.5/ncftp/cmds.c ncftp-3.2.6/ncftp/cmds.c --- ncftp-3.2.5/ncftp/cmds.c 2010-04-05 19:33:21.000000000 +0000 +++ ncftp-3.2.6/ncftp/cmds.c 2016-11-13 00:07:27.000000000 +0000 @@ -1,6 +1,6 @@ /* cmds.c * - * Copyright (c) 1992-2006 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -63,6 +63,10 @@ /* Did the user stupidly type passwords, etc., on our command line? */ int gUserTypedSensitiveInfoAtShellSoDoNotSaveItToDisk = 0; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif typedef struct SpoolCmdInfo { int xtype; int deleteFlag; @@ -73,6 +77,9 @@ const char *rcwd; int base; } SpoolCmdInfo; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif extern FTPConnectionInfo gConn; extern char gOurDirectoryPath[]; @@ -239,7 +246,8 @@ (void) fflush(stdout); (void) fflush(stdin); (void) memset(ans, 0, sizeof(ans)); - (void) fgets(ans, sizeof(ans) - 1, stdin); + if (fgets(ans, sizeof(ans) - 1, stdin) == NULL) + ans[0] = '\0'; Trace(0, "%s%s", buf, ans); switch ((int) ans[0]) { case 'y': @@ -1156,7 +1164,8 @@ printf(" [R!]esume all?"); printf(" [S!]kip all? [C]ancel > "); fflush(stdin); - (void) fgets(ans, sizeof(ans) - 1, stdin); + if (fgets(ans, sizeof(ans) - 1, stdin) == NULL) + ans[0] = '\0'; switch ((int) ans[0]) { case 'c': case 'C': @@ -1224,7 +1233,8 @@ (void) memset(newname, 0, sizeof(newname)); printf("\tSave as: "); fflush(stdin); - (void) fgets(newname, sizeof(newname) - 1, stdin); + if (fgets(newname, sizeof(newname) - 1, stdin) == NULL) + newname[0] = '\0'; newname[strlen(newname) - 1] = '\0'; if (newname[0] == '\0') { /* Nevermind. */ @@ -1440,7 +1450,14 @@ (void) sprintf(spec, "%%-%ds", (j < nCols - 1) ? widestName : widestName - 2 ); +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif (void) printf(spec, cmdnames[k]); +#ifdef __clang__ +#pragma clang diagnostic pop +#endif } } (void) printf("\n"); @@ -1667,9 +1684,8 @@ Trace(0, "Selected bookmark from editor: [%s]\n", selectedBmName); } } - return (0); } - return (-1); + return (0); #endif /* ! Windows */ } /* RunBookmarkEditor */ @@ -1733,7 +1749,7 @@ #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #else int sj; - vsigproc_t osigpipe, osigint; + vsigproc_t osigpipe = 0, osigint = 0; #endif ARGSUSED(gUnusedArg); @@ -1811,10 +1827,8 @@ #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #elif defined(HAVE_SIGSETJMP) - osigpipe = osigint = (sigproc_t) 0; sj = sigsetjmp(gCancelJmp, 1); #else /* HAVE_SIGSETJMP */ - osigpipe = osigint = (sigproc_t) 0; sj = setjmp(gCancelJmp); #endif /* HAVE_SIGSETJMP */ @@ -2081,7 +2095,8 @@ fprintf(stderr, "Cannot run command: %s\n", cmd); #else Trace(0, "Sys: %s\n", cmd); - (void) system(cmd); + if ((i = system(cmd)) != 0) + Trace(0, "Sys: %s = %d\n", cmd, i); #endif } /* Sys */ @@ -2677,7 +2692,8 @@ /* If the bookmark specified a local directory, change to it now. */ if ((gLoadedBm != 0) && (gBm.ldir[0] != '\0')) { - (void) chdir(gBm.ldir); + if (chdir(gBm.ldir) != 0) + Trace(-1, "Could not chdir to %s.\n", gBm.ldir); (void) STRNCPY(gPrevLocalCWD, gLocalCWD); if (FTPGetLocalCWD(gLocalCWD, sizeof(gLocalCWD)) != NULL) { Trace(-1, "Current local directory is %s.\n", gLocalCWD); @@ -2839,7 +2855,7 @@ (void) STRNCPY(gConn.acct, ""); break; case 'P': - gConn.port = atoi(opt.arg); + gConn.port = (unsigned int) atoi(opt.arg); break; case 'u': if (uOptInd <= argc) @@ -3126,7 +3142,8 @@ if (remotesize < localsize) printf(" [R!]esume all?"); printf(" [S!]kip all? [C]ancel > "); - (void) fgets(ans, sizeof(ans) - 1, stdin); + if (fgets(ans, sizeof(ans) - 1, stdin) == NULL) + ans[0] = '\0'; switch ((int) ans[0]) { case 'c': case 'C': @@ -3194,7 +3211,8 @@ (void) memset(newname, 0, sizeof(newname)); printf("\tSave as: "); fflush(stdin); - (void) fgets(newname, sizeof(newname) - 1, stdin); + if (fgets(newname, sizeof(newname) - 1, stdin) == NULL) + newname[0] = '\0'; newname[strlen(newname) - 1] = '\0'; if (newname[0] == '\0') { /* Nevermind. */ @@ -3238,7 +3256,7 @@ gResumeAnswerAll = kConfirmResumeProcNotUsed; /* Ask at least once each time */ ARGSUSED(gUnusedArg); GetoptReset(&opt); - while ((optrc = Getopt(&opt, argc, argv, "AafZzrRD")) >= 0) switch (optrc) { + while ((optrc = Getopt(&opt, argc, argv, "AafZzrRDS")) >= 0) switch (optrc) { case 'a': xtype = kTypeAscii; break; @@ -3282,6 +3300,12 @@ */ nD++; break; + case 'S': + /* Hidden option because this changes it for all uploads, not just this one. + * We currently don't have a parameter to pass to PutFiles(). + */ + gConn.useSendfile = !kNcFTPDefaultUseSendfile; + break; default: PrintCmdUsage(cmdp); return; @@ -3800,7 +3824,7 @@ return (0); /* ignore root directory */ lpath = NULL; - dirsep[0] = ftwip->dirSeparator; + dirsep[0] = (char) ftwip->dirSeparator; dirsep[1] = '\0'; toplevel = 0; if ((strrchr(ftwip->curPath, '/') == ftwip->curPath) || (strrchr(ftwip->curPath, '\\') == ftwip->curPath)) { @@ -3892,12 +3916,21 @@ /* File */ rc = SpoolX( NULL, + stderr, NULL, "get", ftwip->curFile, rdir, + (double) ftwip->curStat.st_size, + ftwip->curStat.st_mtime, ftwip->curFile, ldir, + -1, + 0, + NULL, + NULL, + NULL, + NULL, gConn.host, gConn.ip, gConn.port, @@ -3917,6 +3950,8 @@ 0, gConn.manualOverrideFeatures, preferredLocalAddrStr, + (time_t) 0, + (time_t) 0, 0 ); if (rc == 0) { @@ -4033,12 +4068,21 @@ } rc = SpoolX( NULL, + stderr, NULL, "get", argv[opt.ind], gRemoteCWD, + -1, + 0, argv[opt.ind + 1], gLocalCWD, + -1, + 0, + NULL, + NULL, + NULL, + NULL, gConn.host, gConn.ip, gConn.port, @@ -4058,6 +4102,8 @@ 0, gConn.manualOverrideFeatures, preferredLocalAddrStr, + (time_t) 0, + (time_t) 0, 0 ); if (rc == 0) { @@ -4089,12 +4135,21 @@ lname++; rc = SpoolX( NULL, + stderr, NULL, "get", lp->line, gRemoteCWD, + -1, + 0, lname, gLocalCWD, + -1, + 0, + NULL, + NULL, + NULL, + NULL, gConn.host, gConn.ip, gConn.port, @@ -4114,6 +4169,8 @@ 0, gConn.manualOverrideFeatures, preferredLocalAddrStr, + (time_t) 0, + (time_t) 0, 0 ); if (rc == 0) { @@ -4171,7 +4228,7 @@ return (0); /* ignore root directory */ rpath = NULL; - dirsep[0] = ftwip->dirSeparator; + dirsep[0] = (char) ftwip->dirSeparator; dirsep[1] = '\0'; toplevel = 0; if ((strrchr(ftwip->curPath, '/') == ftwip->curPath) || (strrchr(ftwip->curPath, '\\') == ftwip->curPath)) { @@ -4259,12 +4316,21 @@ /* File */ rc = SpoolX( NULL, + stderr, NULL, "put", ftwip->curFile, rdir, + -1, + 0, ftwip->curFile, ldir, + (double) ftwip->curStat.st_size, + ftwip->curStat.st_mtime, + NULL, + NULL, + NULL, + NULL, gConn.host, gConn.ip, gConn.port, @@ -4284,6 +4350,8 @@ 0, gConn.manualOverrideFeatures, preferredLocalAddrStr, + (time_t) 0, + (time_t) 0, 0 ); if (rc == 0) { @@ -4402,12 +4470,21 @@ } rc = SpoolX( NULL, + stderr, NULL, "put", argv[opt.ind + 1], gRemoteCWD, + -1, + 0, argv[opt.ind + 0], gLocalCWD, + -1, + 0, + NULL, + NULL, + NULL, + NULL, gConn.host, gConn.ip, gConn.port, @@ -4427,6 +4504,8 @@ 0, gConn.manualOverrideFeatures, preferredLocalAddrStr, + (time_t) 0, + (time_t) 0, 0 ); if (rc == 0) { @@ -4458,12 +4537,21 @@ rname++; rc = SpoolX( NULL, + stderr, NULL, "put", rname, gRemoteCWD, + -1, + 0, lp->line, gLocalCWD, + -1, + 0, + NULL, + NULL, + NULL, + NULL, gConn.host, gConn.ip, gConn.port, @@ -4483,6 +4571,8 @@ 0, gConn.manualOverrideFeatures, preferredLocalAddrStr, + (time_t) 0, + (time_t) 0, 0 ); if (rc == 0) { diff -Nru ncftp-3.2.5/ncftp/cmds.h ncftp-3.2.6/ncftp/cmds.h --- ncftp-3.2.5/ncftp/cmds.h 2006-08-02 22:32:51.000000000 +0000 +++ ncftp-3.2.6/ncftp/cmds.h 2016-10-30 20:24:13.000000000 +0000 @@ -1,10 +1,12 @@ /* cmds.h * - * Copyright (c) 1992-2006 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ +#define kNcFTPDefaultUseSendfile 0 + /* cmds.c */ int PromptForBookmarkName(BookmarkPtr); void CurrentURL(char *, size_t, int); diff -Nru ncftp-3.2.5/ncftp/gl_getline.c ncftp-3.2.6/ncftp/gl_getline.c --- ncftp-3.2.5/ncftp/gl_getline.c 2008-07-14 02:35:48.000000000 +0000 +++ ncftp-3.2.6/ncftp/gl_getline.c 2016-11-12 23:57:17.000000000 +0000 @@ -139,13 +139,11 @@ # define IsLocalPathDelim(c) ((c == LOCAL_PATH_DELIM) || (c == LOCAL_PATH_ALTDELIM)) # define UNC_PATH_PREFIX "//" # define IsUNCPrefixed(s) (IsLocalPathDelim(s[0]) && IsLocalPathDelim(s[1])) -/* _StrFindLocalPathDelim(a) -- use windows-specific function; understands '/' and '\\' */ -/* _StrRFindLocalPathDelim(a) -- use windows-specific function; understands '/' and '\\' */ # else # define LOCAL_PATH_DELIM '/' # define LOCAL_PATH_DELIM_STR "/" -# define _StrFindLocalPathDelim(a) strchr(a, LOCAL_PATH_DELIM) -# define _StrRFindLocalPathDelim(a) strrchr(a, LOCAL_PATH_DELIM) +# define My_StrFindLocalPathDelim(a) strchr(a, LOCAL_PATH_DELIM) +# define My_StrRFindLocalPathDelim(a) strrchr(a, LOCAL_PATH_DELIM) # define IsLocalPathDelim(c) (c == LOCAL_PATH_DELIM) # endif #endif @@ -251,19 +249,19 @@ #ifdef __unix__ # ifdef HAVE_TERMIOS_H /* Use POSIX */ if (tcgetattr(0, &old_termios) == 0) { - gl_intrc = old_termios.c_cc[VINTR]; - gl_quitc = old_termios.c_cc[VQUIT]; + gl_intrc = (char) old_termios.c_cc[VINTR]; + gl_quitc = (char) old_termios.c_cc[VQUIT]; # ifdef VSUSP - gl_suspc = old_termios.c_cc[VSUSP]; + gl_suspc = (char) old_termios.c_cc[VSUSP]; # endif # ifdef VDSUSP - gl_dsuspc = old_termios.c_cc[VDSUSP]; + gl_dsuspc = (char) old_termios.c_cc[VDSUSP]; # endif } new_termios = old_termios; - new_termios.c_iflag &= ~(BRKINT|ISTRIP|IXON|IXOFF); + new_termios.c_iflag &= (unsigned int) ~(BRKINT|ISTRIP|IXON|IXOFF); new_termios.c_iflag |= (IGNBRK|IGNPAR); - new_termios.c_lflag &= ~(ICANON|ISIG|IEXTEN|ECHO); + new_termios.c_lflag &= (unsigned int) ~(ICANON|ISIG|IEXTEN|ECHO); new_termios.c_cc[VMIN] = 1; new_termios.c_cc[VTIME] = 0; tcsetattr(0, TCSANOW, &new_termios); @@ -502,12 +500,14 @@ gl_putc(int c) { char ch = (char) (unsigned char) c; + long rc; - (void) write(1, &ch, (write_size_t) 1); + rc = (long) write(1, &ch, (write_size_t) 1); if (ch == '\n') { ch = '\r'; - (void) write(1, &ch, (write_size_t) 1); /* RAW mode needs '\r', does not hurt */ + rc = (long) write(1, &ch, (write_size_t) 1); /* RAW mode needs '\r', does not hurt */ } + if (rc == -666) gl_error("\nDon't care about compiler warning\n"); } /******************** fairly portable part *********************************/ @@ -553,18 +553,23 @@ if (buf) { len = (write_size_t) strlen(buf); - (void) write(1, buf, len); + if (write(1, buf, len) < 0) + gl_error("\ngl_puts failed\n"); } #endif } static void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) +__attribute__ ((noreturn)) +#endif gl_error(const char *const buf) { write_size_t len = (write_size_t) strlen(buf); gl_cleanup(); - (void) write(2, buf, len); + if (write(2, buf, len) < 0) + exit(2); exit(1); } @@ -1883,7 +1888,7 @@ gl_putc('\n'); return; } - imaxlen -= glen; + imaxlen -= (size_t) glen; ncol = (gl_termw - 8) / ((int) imaxlen + 2); if (ncol < 1) @@ -1969,7 +1974,7 @@ bufsize -= 4; /* leave room for a NUL, space, and two quotes. */ curposp = buf + *loc; wasateol = (*curposp == '\0'); - lenaftercursor = llen - (curposp - buf); + lenaftercursor = llen - (size_t) (curposp - buf); if (gl_ellipses_during_completion != 0) { memcpy(ellipsessave, curposp, (size_t) 4); memcpy(curposp, "... ", (size_t) 4); @@ -2015,7 +2020,7 @@ startp = buf; cp = startp; - mlen = (curposp - cp); + mlen = (size_t) (curposp - cp); matchpfx = (char *) malloc(mlen + 1); memcpy(matchpfx, cp, mlen); @@ -2025,7 +2030,7 @@ nused = 0; ntoalloc = GL_COMPLETE_VECTOR_BLOCK_SIZE; - newgl_matchlist = (char **) malloc((size_t) (sizeof(char *) * (ntoalloc + 1))); + newgl_matchlist = (char **) malloc((size_t) (sizeof(char *) * ((size_t) ntoalloc + 1))); if (newgl_matchlist == NULL) { free(matchpfx); gl_beep(); @@ -2040,7 +2045,7 @@ for (nprocused = 0;; nprocused++) { if (nused == nalloced) { ntoalloc += GL_COMPLETE_VECTOR_BLOCK_SIZE; - newgl_matchlist = (char **) realloc((char *) gl_matchlist, (size_t) (sizeof(char *) * (ntoalloc + 1))); + newgl_matchlist = (char **) realloc((char *) gl_matchlist, (size_t) (sizeof(char *) * ((size_t) ntoalloc + 1))); if (newgl_matchlist == NULL) { /* not enough memory to expand list -- abort */ for (i=0; i 0) memcpy(cp, start, (size_t) filepfxoffset); @@ -2501,7 +2506,7 @@ if (searchHandle == NULL) { dirtoopen1 = NULL; dirtoopen2 = NULL; - cp = _StrRFindLocalPathDelim(start); + cp = My_StrRFindLocalPathDelim(start); if (cp == start) { dirtoopen = LOCAL_PATH_DELIM_STR; /* root dir */ filepfxoffset = 1; diff -Nru ncftp-3.2.5/ncftp/log.c ncftp-3.2.6/ncftp/log.c --- ncftp-3.2.5/ncftp/log.c 2006-07-27 19:52:56.000000000 +0000 +++ ncftp-3.2.6/ncftp/log.c 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* log.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ diff -Nru ncftp-3.2.5/ncftp/log.h ncftp-3.2.6/ncftp/log.h --- ncftp-3.2.5/ncftp/log.h 2004-01-06 21:41:59.000000000 +0000 +++ ncftp-3.2.6/ncftp/log.h 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* log.h * - * Copyright (c) 1992-2004 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ diff -Nru ncftp-3.2.5/ncftp/ls.c ncftp-3.2.6/ncftp/ls.c --- ncftp-3.2.5/ncftp/ls.c 2006-05-10 20:39:23.000000000 +0000 +++ ncftp-3.2.6/ncftp/ls.c 2016-11-13 00:20:28.000000000 +0000 @@ -1,6 +1,6 @@ /* ls.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -13,6 +13,10 @@ #include "ls.h" #include "trace.h" +#ifndef PRINTF_LONG_LONG +# define PRINTF_LONG_LONG "%ld" +#endif + /* The program keeps a timestamp of 6 months ago and an hour from now, because * the standard /bin/ls command will print the time (i.e. "Nov 8 09:20") * instead of the year (i.e. "Oct 27 1996") if a file's timestamp is within @@ -266,26 +270,37 @@ if ((ts > gNowPlus1Hr) || (ts < gNowMinus6Mon)) { #ifdef HAVE_SNPRINTF (void) snprintf(dstr, dsiz, + "%s %2d %4d", + gLsMon[t.tm_mon], + t.tm_mday, + t.tm_year + 1900 + ); #else (void) sprintf(dstr, + "%s %2d %4d", + gLsMon[t.tm_mon], + t.tm_mday, + t.tm_year + 1900 + ); #endif - "%s %2d %4d", - gLsMon[t.tm_mon], - t.tm_mday, - t.tm_year + 1900 - ); } else { #ifdef HAVE_SNPRINTF (void) snprintf(dstr, dsiz, + "%s %2d %02d:%02d", + gLsMon[t.tm_mon], + t.tm_mday, + t.tm_hour, + t.tm_min + ); #else (void) sprintf(dstr, + "%s %2d %02d:%02d", + gLsMon[t.tm_mon], + t.tm_mday, + t.tm_hour, + t.tm_min + ); #endif - "%s %2d %02d:%02d", - gLsMon[t.tm_mon], - t.tm_mday, - t.tm_hour, - t.tm_min - ); } } /* LsDate */ @@ -320,13 +335,16 @@ (void) snprintf( plugspec, sizeof(plugspec) - 1, + "%%-%ds", + (int) dirp->maxPlugLen + ); #else (void) sprintf( plugspec, + "%%-%ds", + (int) dirp->maxPlugLen + ); #endif - "%%-%ds", - (int) dirp->maxPlugLen - ); if (dirp->maxPlugLen < 29) { /* We have some extra space to work with, @@ -372,30 +390,41 @@ (void) snprintf( sizestr, sizeof(sizestr) - 1, + PRINTF_LONG_LONG, + (longest_int) diritemp->size + ); #else (void) sprintf( sizestr, + PRINTF_LONG_LONG, + (longest_int) diritemp->size + ); #endif -#if defined(HAVE_LONG_LONG) && defined(PRINTF_LONG_LONG) - PRINTF_LONG_LONG, -#else - "%ld", -#endif - (longest_int) diritemp->size - ); } +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif + #ifdef HAVE_SNPRINTF (void) snprintf( plugstr, sizeof(plugstr) - 1, + plugspec, + diritemp->plug + ); #else (void) sprintf( plugstr, + plugspec, + diritemp->plug + ); +#endif + +#ifdef __clang__ +#pragma clang diagnostic pop #endif - plugspec, - diritemp->plug - ); (void) fprintf(stream, "%s %12s %s%s %s%s%s%s%s\n", plugstr, @@ -542,7 +571,7 @@ break; default: if (unknownOpts < ((int) sizeof(unoptstr) - 2)) - unoptstr[unknownOpts + 1] = opt; + unoptstr[unknownOpts + 1] = (char) opt; unknownOpts++; break; } @@ -559,7 +588,7 @@ Trace(0, "ls caching not used because of ls flags: %s\n", unoptstr); optstr[0] = '-'; - optstr[1] = listmode; + optstr[1] = (char) listmode; optstr[2] = '\0'; (void) STRNCAT(optstr, options); if ((FTPListToMemory2(&gConn, (item == NULL) ? "" : item, &dirContents, optstr, 1, 0)) < 0) { diff -Nru ncftp-3.2.5/ncftp/ls.h ncftp-3.2.6/ncftp/ls.h --- ncftp-3.2.5/ncftp/ls.h 2006-05-10 20:38:54.000000000 +0000 +++ ncftp-3.2.6/ncftp/ls.h 2016-11-13 00:18:57.000000000 +0000 @@ -1,12 +1,17 @@ /* ls.h * - * Copyright (c) 1992-2004 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ #define kLsCacheItemLifetime 900 /* seconds */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + typedef struct LsCacheItem { char *itempath; FTPFileInfoList fil; @@ -14,6 +19,10 @@ int hits; } LsCacheItem; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #define kLsCacheSize 32 /* ls.c */ diff -Nru ncftp-3.2.5/ncftp/main.c ncftp-3.2.6/ncftp/main.c --- ncftp-3.2.5/ncftp/main.c 2008-08-29 02:34:46.000000000 +0000 +++ ncftp-3.2.6/ncftp/main.c 2016-11-16 00:29:47.000000000 +0000 @@ -1,6 +1,6 @@ /* main.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -59,6 +59,9 @@ extern char gStartDir[]; static void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) +__attribute__ ((noreturn)) +#endif Usage(void) { FILE *fp; @@ -122,15 +125,16 @@ gTransferTypeInitialized = 0; gTransferType = kTypeBinary; gConn.leavePass = 1; /* Don't let the lib zap it. */ - gConn.connTimeout = gConnTimeout; - gConn.xferTimeout = gXferTimeout; - gConn.ctrlTimeout = gCtrlTimeout; + gConn.connTimeout = (unsigned int) gConnTimeout; + gConn.xferTimeout = (unsigned int) gXferTimeout; + gConn.ctrlTimeout = (unsigned int) gCtrlTimeout; gConn.dataPortMode = gDataPortMode; + gConn.useSendfile = kNcFTPDefaultUseSendfile; gConn.maxDials = (-1); /* Dial forever, until they hit ^C. */ gUnprocessedJobs = 0; gPrevRemoteCWD[0] = '\0'; gStartDir[0] = '\0'; - gConn.dataSocketRBufSize = gConn.dataSocketSBufSize = gSOBufsize; + gConn.dataSocketRBufSize = gConn.dataSocketSBufSize = (size_t) gSOBufsize; if (gRedialDelay >= 10) gConn.redialDelay = gRedialDelay; if ((gAutoAscii[0] == '\0') || (ISTREQ(gAutoAscii, "no")) || (ISTREQ(gAutoAscii, "off")) || (ISTREQ(gAutoAscii, "false"))) { @@ -440,7 +444,7 @@ GetoptReset(&opt); while ((c = Getopt(&opt, argc, argv, "P:u:p:j:rd:eg:o:FVLD")) > 0) switch(c) { case 'P': - gConn.port = atoi(opt.arg); + gConn.port = (unsigned int) atoi(opt.arg); break; case 'u': (void) STRNCPY(gConn.user, opt.arg); @@ -454,11 +458,6 @@ (void) STRNCPY(gConn.acct, opt.arg); memset(opt.arg, '*', strlen(opt.arg)); break; - case 'e': - gGetOurHostNameResult = GetOurHostName(gOurHostName, sizeof(gOurHostName)); - printf("%s\n", gOurHostName); - exit(0); - break; case 'r': /* redial is always on */ break; @@ -473,11 +472,6 @@ case 'o': gConn.manualOverrideFeatures = opt.arg; break; - case 'F': - DumpFirewallPrefsTemplate(); - exit(0); - /*NOTREACHED*/ - break; case 'V': /*FALLTHROUGH*/ case 'L': @@ -485,6 +479,15 @@ case 'D': /* silently ignore these legacy options */ break; + case 'F': + DumpFirewallPrefsTemplate(); + exit(0); + /*NOTREACHED*/ + case 'e': + gGetOurHostNameResult = GetOurHostName(gOurHostName, sizeof(gOurHostName)); + printf("%s\n", gOurHostName); + exit(0); + /*NOTREACHED*/ default: Usage(); } diff -Nru ncftp-3.2.5/ncftp/main.h ncftp-3.2.6/ncftp/main.h --- ncftp-3.2.5/ncftp/main.h 2004-01-06 21:40:01.000000000 +0000 +++ ncftp-3.2.6/ncftp/main.h 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* main.h * - * Copyright (c) 1992-2004 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ diff -Nru ncftp-3.2.5/ncftp/ncftp.xcodeproj/project.pbxproj ncftp-3.2.6/ncftp/ncftp.xcodeproj/project.pbxproj --- ncftp-3.2.5/ncftp/ncftp.xcodeproj/project.pbxproj 1970-01-01 00:00:00.000000000 +0000 +++ ncftp-3.2.6/ncftp/ncftp.xcodeproj/project.pbxproj 2016-10-30 19:57:26.000000000 +0000 @@ -0,0 +1,430 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 2DE571461DC6799600FEDC58 /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE571261DC6799600FEDC58 /* version.c */; }; + 2DE571471DC6799600FEDC58 /* cmds.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE571271DC6799600FEDC58 /* cmds.c */; }; + 2DE571481DC6799600FEDC58 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE571291DC6799600FEDC58 /* main.c */; }; + 2DE571491DC6799600FEDC58 /* spoolutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE5712A1DC6799600FEDC58 /* spoolutil.c */; }; + 2DE5714A1DC6799600FEDC58 /* util.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE5712C1DC6799600FEDC58 /* util.c */; }; + 2DE5714B1DC6799600FEDC58 /* pref.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE5712D1DC6799600FEDC58 /* pref.c */; }; + 2DE5714C1DC6799600FEDC58 /* bookmark.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE5712F1DC6799600FEDC58 /* bookmark.c */; }; + 2DE5714D1DC6799600FEDC58 /* spool.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE571301DC6799600FEDC58 /* spool.c */; }; + 2DE5714E1DC6799600FEDC58 /* shell.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE571311DC6799600FEDC58 /* shell.c */; }; + 2DE5714F1DC6799600FEDC58 /* preffw.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE571321DC6799600FEDC58 /* preffw.c */; }; + 2DE571501DC6799600FEDC58 /* trace.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE571331DC6799600FEDC58 /* trace.c */; }; + 2DE571511DC6799600FEDC58 /* gl_getline.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE571351DC6799600FEDC58 /* gl_getline.c */; }; + 2DE571521DC6799600FEDC58 /* readln.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE571361DC6799600FEDC58 /* readln.c */; }; + 2DE571531DC6799600FEDC58 /* cmdlist.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE571371DC6799600FEDC58 /* cmdlist.c */; }; + 2DE571541DC6799600FEDC58 /* log.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE571381DC6799600FEDC58 /* log.c */; }; + 2DE571551DC6799600FEDC58 /* ls.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE5713A1DC6799600FEDC58 /* ls.c */; }; + 2DE571561DC6799600FEDC58 /* progress.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE5713D1DC6799600FEDC58 /* progress.c */; }; + 2DE5715D1DC6843B00FEDC58 /* libncftp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DE5715A1DC6843B00FEDC58 /* libncftp.a */; }; + 2DE5715E1DC6843B00FEDC58 /* libsio.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DE5715B1DC6843B00FEDC58 /* libsio.a */; }; + 2DE5715F1DC6843B00FEDC58 /* libStrn.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DE5715C1DC6843B00FEDC58 /* libStrn.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 2DE571181DC6786700FEDC58 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 2DE5711A1DC6786700FEDC58 /* ncftp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ncftp; sourceTree = BUILT_PRODUCTS_DIR; }; + 2DE571241DC6799600FEDC58 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 2DE571251DC6799600FEDC58 /* syshdrs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = syshdrs.h; sourceTree = ""; }; + 2DE571261DC6799600FEDC58 /* version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = ""; }; + 2DE571271DC6799600FEDC58 /* cmds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cmds.c; sourceTree = ""; }; + 2DE571281DC6799600FEDC58 /* cmds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cmds.h; sourceTree = ""; }; + 2DE571291DC6799600FEDC58 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; + 2DE5712A1DC6799600FEDC58 /* spoolutil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spoolutil.c; sourceTree = ""; }; + 2DE5712B1DC6799600FEDC58 /* spool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spool.h; sourceTree = ""; }; + 2DE5712C1DC6799600FEDC58 /* util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = util.c; sourceTree = ""; }; + 2DE5712D1DC6799600FEDC58 /* pref.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pref.c; sourceTree = ""; }; + 2DE5712E1DC6799600FEDC58 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; + 2DE5712F1DC6799600FEDC58 /* bookmark.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bookmark.c; sourceTree = ""; }; + 2DE571301DC6799600FEDC58 /* spool.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spool.c; sourceTree = ""; }; + 2DE571311DC6799600FEDC58 /* shell.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = shell.c; sourceTree = ""; }; + 2DE571321DC6799600FEDC58 /* preffw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = preffw.c; sourceTree = ""; }; + 2DE571331DC6799600FEDC58 /* trace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = trace.c; sourceTree = ""; }; + 2DE571341DC6799600FEDC58 /* bookmark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bookmark.h; sourceTree = ""; }; + 2DE571351DC6799600FEDC58 /* gl_getline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gl_getline.c; sourceTree = ""; }; + 2DE571361DC6799600FEDC58 /* readln.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readln.c; sourceTree = ""; }; + 2DE571371DC6799600FEDC58 /* cmdlist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cmdlist.c; sourceTree = ""; }; + 2DE571381DC6799600FEDC58 /* log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = log.c; sourceTree = ""; }; + 2DE571391DC6799600FEDC58 /* shell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shell.h; sourceTree = ""; }; + 2DE5713A1DC6799600FEDC58 /* ls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ls.c; sourceTree = ""; }; + 2DE5713B1DC6799600FEDC58 /* ls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ls.h; sourceTree = ""; }; + 2DE5713C1DC6799600FEDC58 /* Makefile.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.in; sourceTree = ""; }; + 2DE5713D1DC6799600FEDC58 /* progress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = progress.c; sourceTree = ""; }; + 2DE5713E1DC6799600FEDC58 /* gl_getline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_getline.h; sourceTree = ""; }; + 2DE5713F1DC6799600FEDC58 /* trace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = trace.h; sourceTree = ""; }; + 2DE571401DC6799600FEDC58 /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = ""; }; + 2DE571411DC6799600FEDC58 /* readln.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readln.h; sourceTree = ""; }; + 2DE571421DC6799600FEDC58 /* progress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = progress.h; sourceTree = ""; }; + 2DE571431DC6799600FEDC58 /* pref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pref.h; sourceTree = ""; }; + 2DE571441DC6799600FEDC58 /* main.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = main.h; sourceTree = ""; }; + 2DE5715A1DC6843B00FEDC58 /* libncftp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libncftp.a; path = ../../../../../../local/lib/libncftp.a; sourceTree = ""; }; + 2DE5715B1DC6843B00FEDC58 /* libsio.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libsio.a; path = ../../../../../../local/lib/libsio.a; sourceTree = ""; }; + 2DE5715C1DC6843B00FEDC58 /* libStrn.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libStrn.a; path = ../../../../../../local/lib/libStrn.a; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2DE571171DC6786700FEDC58 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2DE5715D1DC6843B00FEDC58 /* libncftp.a in Frameworks */, + 2DE5715E1DC6843B00FEDC58 /* libsio.a in Frameworks */, + 2DE5715F1DC6843B00FEDC58 /* libStrn.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2DE571111DC6786700FEDC58 = { + isa = PBXGroup; + children = ( + 2DE571571DC679B600FEDC58 /* Autotools */, + 2DE571581DC679CB00FEDC58 /* Headers */, + 2DE571261DC6799600FEDC58 /* version.c */, + 2DE571271DC6799600FEDC58 /* cmds.c */, + 2DE571291DC6799600FEDC58 /* main.c */, + 2DE5712A1DC6799600FEDC58 /* spoolutil.c */, + 2DE5712C1DC6799600FEDC58 /* util.c */, + 2DE5712D1DC6799600FEDC58 /* pref.c */, + 2DE5712F1DC6799600FEDC58 /* bookmark.c */, + 2DE571301DC6799600FEDC58 /* spool.c */, + 2DE571311DC6799600FEDC58 /* shell.c */, + 2DE571321DC6799600FEDC58 /* preffw.c */, + 2DE571331DC6799600FEDC58 /* trace.c */, + 2DE571351DC6799600FEDC58 /* gl_getline.c */, + 2DE571361DC6799600FEDC58 /* readln.c */, + 2DE571371DC6799600FEDC58 /* cmdlist.c */, + 2DE571381DC6799600FEDC58 /* log.c */, + 2DE5713A1DC6799600FEDC58 /* ls.c */, + 2DE5713B1DC6799600FEDC58 /* ls.h */, + 2DE5713D1DC6799600FEDC58 /* progress.c */, + 2DE5711B1DC6786700FEDC58 /* Products */, + 2DE571591DC6843B00FEDC58 /* Frameworks */, + ); + sourceTree = ""; + }; + 2DE5711B1DC6786700FEDC58 /* Products */ = { + isa = PBXGroup; + children = ( + 2DE5711A1DC6786700FEDC58 /* ncftp */, + ); + name = Products; + sourceTree = ""; + }; + 2DE571571DC679B600FEDC58 /* Autotools */ = { + isa = PBXGroup; + children = ( + 2DE571241DC6799600FEDC58 /* Makefile */, + 2DE5713C1DC6799600FEDC58 /* Makefile.in */, + ); + name = Autotools; + sourceTree = ""; + }; + 2DE571581DC679CB00FEDC58 /* Headers */ = { + isa = PBXGroup; + children = ( + 2DE571251DC6799600FEDC58 /* syshdrs.h */, + 2DE571281DC6799600FEDC58 /* cmds.h */, + 2DE5712B1DC6799600FEDC58 /* spool.h */, + 2DE5712E1DC6799600FEDC58 /* util.h */, + 2DE571341DC6799600FEDC58 /* bookmark.h */, + 2DE571391DC6799600FEDC58 /* shell.h */, + 2DE5713E1DC6799600FEDC58 /* gl_getline.h */, + 2DE5713F1DC6799600FEDC58 /* trace.h */, + 2DE571401DC6799600FEDC58 /* log.h */, + 2DE571411DC6799600FEDC58 /* readln.h */, + 2DE571421DC6799600FEDC58 /* progress.h */, + 2DE571431DC6799600FEDC58 /* pref.h */, + 2DE571441DC6799600FEDC58 /* main.h */, + ); + name = Headers; + sourceTree = ""; + }; + 2DE571591DC6843B00FEDC58 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2DE5715A1DC6843B00FEDC58 /* libncftp.a */, + 2DE5715B1DC6843B00FEDC58 /* libsio.a */, + 2DE5715C1DC6843B00FEDC58 /* libStrn.a */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2DE571191DC6786700FEDC58 /* ncftp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2DE571211DC6786700FEDC58 /* Build configuration list for PBXNativeTarget "ncftp" */; + buildPhases = ( + 2DE571161DC6786700FEDC58 /* Sources */, + 2DE571171DC6786700FEDC58 /* Frameworks */, + 2DE571181DC6786700FEDC58 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ncftp; + productName = ncftp; + productReference = 2DE5711A1DC6786700FEDC58 /* ncftp */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2DE571121DC6786700FEDC58 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0810; + ORGANIZATIONNAME = "NcFTP Software"; + TargetAttributes = { + 2DE571191DC6786700FEDC58 = { + CreatedOnToolsVersion = 8.1; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 2DE571151DC6786700FEDC58 /* Build configuration list for PBXProject "ncftp" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 2DE571111DC6786700FEDC58; + productRefGroup = 2DE5711B1DC6786700FEDC58 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2DE571191DC6786700FEDC58 /* ncftp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 2DE571161DC6786700FEDC58 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2DE571551DC6799600FEDC58 /* ls.c in Sources */, + 2DE571511DC6799600FEDC58 /* gl_getline.c in Sources */, + 2DE571481DC6799600FEDC58 /* main.c in Sources */, + 2DE5714C1DC6799600FEDC58 /* bookmark.c in Sources */, + 2DE571561DC6799600FEDC58 /* progress.c in Sources */, + 2DE571531DC6799600FEDC58 /* cmdlist.c in Sources */, + 2DE571521DC6799600FEDC58 /* readln.c in Sources */, + 2DE5714B1DC6799600FEDC58 /* pref.c in Sources */, + 2DE571501DC6799600FEDC58 /* trace.c in Sources */, + 2DE5714F1DC6799600FEDC58 /* preffw.c in Sources */, + 2DE571541DC6799600FEDC58 /* log.c in Sources */, + 2DE571471DC6799600FEDC58 /* cmds.c in Sources */, + 2DE5714E1DC6799600FEDC58 /* shell.c in Sources */, + 2DE571461DC6799600FEDC58 /* version.c in Sources */, + 2DE571491DC6799600FEDC58 /* spoolutil.c in Sources */, + 2DE5714D1DC6799600FEDC58 /* spool.c in Sources */, + 2DE5714A1DC6799600FEDC58 /* util.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 2DE5711F1DC6786700FEDC58 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 2DE571201DC6786700FEDC58 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 2DE571221DC6786700FEDC58 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_ASSIGN_ENUM = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "ncftp=1", + "O_S=\\\"macosx10.9\\\"", + "SYSCONFDIR=\\\"/etc\\\"", + "BINDIR=\\\"/usr/bin\\\"", + "HAVE_CONFIG_H=1", + "MACOSX=10900", + "_DEBUG=1", + "DEBUG=1", + ); + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + HEADER_SEARCH_PATHS = ( + ../Strn, + ../sio, + ../libncftp, + .., + ); + LIBRARY_SEARCH_PATHS = /usr/local/lib; + OTHER_CFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 2DE571231DC6786700FEDC58 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_ASSIGN_ENUM = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "ncftp=1", + "O_S=\\\"macosx10.9\\\"", + "SYSCONFDIR=\\\"/etc\\\"", + "BINDIR=\\\"/usr/bin\\\"", + "HAVE_CONFIG_H=1", + "MACOSX=10900", + "NDEBUG=1", + ); + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + HEADER_SEARCH_PATHS = ( + ../Strn, + ../sio, + ../libncftp, + .., + ); + LIBRARY_SEARCH_PATHS = /usr/local/lib; + OTHER_CFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2DE571151DC6786700FEDC58 /* Build configuration list for PBXProject "ncftp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2DE5711F1DC6786700FEDC58 /* Debug */, + 2DE571201DC6786700FEDC58 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2DE571211DC6786700FEDC58 /* Build configuration list for PBXNativeTarget "ncftp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2DE571221DC6786700FEDC58 /* Debug */, + 2DE571231DC6786700FEDC58 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2DE571121DC6786700FEDC58 /* Project object */; +} diff -Nru ncftp-3.2.5/ncftp/ncftp.xcodeproj/project.xcworkspace/contents.xcworkspacedata ncftp-3.2.6/ncftp/ncftp.xcodeproj/project.xcworkspace/contents.xcworkspacedata --- ncftp-3.2.5/ncftp/ncftp.xcodeproj/project.xcworkspace/contents.xcworkspacedata 1970-01-01 00:00:00.000000000 +0000 +++ ncftp-3.2.6/ncftp/ncftp.xcodeproj/project.xcworkspace/contents.xcworkspacedata 2016-10-30 18:50:15.000000000 +0000 @@ -0,0 +1,7 @@ + + + + + diff -Nru ncftp-3.2.5/ncftp/pref.c ncftp-3.2.6/ncftp/pref.c --- ncftp-3.2.5/ncftp/pref.c 2010-11-26 23:04:54.000000000 +0000 +++ ncftp-3.2.6/ncftp/pref.c 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* pref.c * - * Copyright (c) 1992-2006 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -188,7 +188,8 @@ if (fp != NULL) { (void) fprintf(fp, "%d", gConnTimeout); } else { - gConn.connTimeout = gConnTimeout = atoi(val); + gConn.connTimeout = (unsigned int) atoi(val); + gConnTimeout = atoi(val); } } /* SetConnTimeout */ @@ -200,7 +201,8 @@ if (fp != NULL) { (void) fprintf(fp, "%d", gCtrlTimeout); } else { - gConn.ctrlTimeout = gCtrlTimeout = atoi(val); + gConn.ctrlTimeout = (unsigned int) atoi(val); + gCtrlTimeout = atoi(val); } } /* SetCtrlTimeout */ @@ -363,7 +365,8 @@ if (gSOBufsize <= 0) (void) fprintf(fp, "%s", " (use system default)"); } else { - gConn.dataSocketRBufSize = gConn.dataSocketSBufSize = gSOBufsize = atoi(val); + gConn.dataSocketRBufSize = gConn.dataSocketSBufSize = (size_t) atoi(val); + gSOBufsize = atoi(val); } } /* SetSOBufsize */ @@ -376,7 +379,8 @@ if (fp != NULL) { (void) fprintf(fp, "%d", gXferTimeout); } else { - gConn.xferTimeout = gXferTimeout = atoi(val); + gConn.xferTimeout = (unsigned int) atoi(val); + gXferTimeout = atoi(val); } } /* SetXferTimeout */ diff -Nru ncftp-3.2.5/ncftp/preffw.c ncftp-3.2.6/ncftp/preffw.c --- ncftp-3.2.5/ncftp/preffw.c 2009-02-11 01:05:47.000000000 +0000 +++ ncftp-3.2.6/ncftp/preffw.c 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* preffw.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ diff -Nru ncftp-3.2.5/ncftp/pref.h ncftp-3.2.6/ncftp/pref.h --- ncftp-3.2.5/ncftp/pref.h 2004-01-06 21:40:14.000000000 +0000 +++ ncftp-3.2.6/ncftp/pref.h 2016-10-30 20:49:25.000000000 +0000 @@ -1,6 +1,6 @@ /* pref.h * - * Copyright (c) 1992-2004 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -27,6 +27,12 @@ #define kOpenSelectedBookmarkFileName "bm2open" + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + typedef void (*PrefProc)(const char *const, FILE *const fp); typedef struct PrefOpt { const char *varname; @@ -34,6 +40,10 @@ int visible; } PrefOpt; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #define kPrefOptObselete (-1) #define kPrefOptInvisible 0 #define kPrefOptVisible 1 diff -Nru ncftp-3.2.5/ncftp/progress.c ncftp-3.2.6/ncftp/progress.c --- ncftp-3.2.5/ncftp/progress.c 2005-01-01 21:23:49.000000000 +0000 +++ ncftp-3.2.6/ncftp/progress.c 2016-11-13 00:17:58.000000000 +0000 @@ -1,6 +1,6 @@ /* progress.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -29,6 +29,11 @@ #endif /* ncftp */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif + double FileSize(const double size, const char **uStr0, double *const uMult0) { @@ -499,3 +504,7 @@ break; } } /* PrPhilBar */ + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif diff -Nru ncftp-3.2.5/ncftp/progress.h ncftp-3.2.6/ncftp/progress.h --- ncftp-3.2.5/ncftp/progress.h 2004-01-06 21:40:34.000000000 +0000 +++ ncftp-3.2.6/ncftp/progress.h 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* progress.h * - * Copyright (c) 1992-2004 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ diff -Nru ncftp-3.2.5/ncftp/rc.rc ncftp-3.2.6/ncftp/rc.rc --- ncftp-3.2.5/ncftp/rc.rc 2011-01-18 03:50:47.000000000 +0000 +++ ncftp-3.2.6/ncftp/rc.rc 2013-01-08 04:34:01.000000000 +0000 @@ -63,8 +63,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,2,5,19 - PRODUCTVERSION 3,2,5,19 + FILEVERSION 3,2,6,20 + PRODUCTVERSION 3,2,6,20 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x29L @@ -82,14 +82,14 @@ VALUE "Comments", " \0" VALUE "CompanyName", "NcFTP Software\0" VALUE "FileDescription", " \0" - VALUE "FileVersion", "3.2.5\0" + VALUE "FileVersion", "3.2.6\0" VALUE "InternalName", " \0" - VALUE "LegalCopyright", "Copyright © 2011\0" + VALUE "LegalCopyright", "Copyright © 2013\0" VALUE "LegalTrademarks", " \0" VALUE "OriginalFilename", "ncftp.exe\0" VALUE "PrivateBuild", " \0" VALUE "ProductName", " \0" - VALUE "ProductVersion", "3.2.5\0" + VALUE "ProductVersion", "3.2.6\0" VALUE "SpecialBuild", " \0" END END diff -Nru ncftp-3.2.5/ncftp/readln.c ncftp-3.2.6/ncftp/readln.c --- ncftp-3.2.5/ncftp/readln.c 2008-07-14 02:17:01.000000000 +0000 +++ ncftp-3.2.6/ncftp/readln.c 2016-11-12 22:16:28.000000000 +0000 @@ -1,6 +1,6 @@ /* rdline.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * * Note: It should still be simple to backport the old GNU Readline @@ -135,8 +135,8 @@ osigpipe = NcSignal(SIGPIPE, SIG_IGN); infp = popen(ncftpbookmarks, "r"); if (infp != NULL) { - columns = 0; - (void) fscanf(infp, "%d", &columns); + if (fscanf(infp, "%d", &columns) != 1) + columns = 0; while (getc(infp) != EOF) {} (void) pclose(infp); @@ -380,7 +380,7 @@ return (NULL); (void) memcpy(cp, diritemp->relname, mlen); } else { - mlen = textdirlen + 1 + flen + 2; + mlen = (size_t) textdirlen + 1 + flen + 2; cp = (char *) malloc(mlen); if (cp == NULL) return (NULL); diff -Nru ncftp-3.2.5/ncftp/readln.h ncftp-3.2.6/ncftp/readln.h --- ncftp-3.2.5/ncftp/readln.h 2004-01-06 21:40:48.000000000 +0000 +++ ncftp-3.2.6/ncftp/readln.h 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* readln.h * - * Copyright (c) 1992-2004 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ diff -Nru ncftp-3.2.5/ncftp/shell.c ncftp-3.2.6/ncftp/shell.c --- ncftp-3.2.5/ncftp/shell.c 2009-07-30 02:26:31.000000000 +0000 +++ ncftp-3.2.6/ncftp/shell.c 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* shell.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -323,7 +323,7 @@ /* Add char. */ if (dcp >= dlim) goto toolong; - *dcp++ = c; + *dcp++ = (char) c; if (strchr(kGlobChars, c) != NULL) { /* User quoted glob characters, @@ -349,7 +349,7 @@ /* Add char. */ if (dcp >= dlim) goto toolong; - *dcp++ = c; + *dcp++ = (char) c; if (strchr(kGlobChars, c) != NULL) { /* User quoted glob characters, @@ -373,12 +373,12 @@ /* Add char. */ if (dcp >= dlim) goto toolong; - *dcp++ = c; + *dcp++ = (char) c; } else { /* Add char. */ if (dcp >= dlim) goto toolong; - *dcp++ = c; + *dcp++ = (char) c; } } diff -Nru ncftp-3.2.5/ncftp/shell.h ncftp-3.2.6/ncftp/shell.h --- ncftp-3.2.5/ncftp/shell.h 2006-07-27 18:34:12.000000000 +0000 +++ ncftp-3.2.6/ncftp/shell.h 2016-11-13 00:08:13.000000000 +0000 @@ -1,15 +1,14 @@ /* shell.h * - * Copyright (c) 1992-2004 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ typedef struct ArgvInfo { - char *cargv[255]; + char *cargv[256]; int cargc; int noglobargv[255]; - int reserved; char argbuf[2048]; } ArgvInfo, *ArgvInfoPtr; @@ -39,6 +38,10 @@ * table, so each command doesn't have to check the number of * arguments and print it's own usage messages if it doesn't want to. */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif typedef struct Command { const char *name; CmdProc proc; @@ -46,6 +49,9 @@ int flags; int minargs, maxargs; } Command; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /* Parameter to GetCommandOrMacro(). */ #define kAbbreviatedMatchAllowed 0 diff -Nru ncftp-3.2.5/ncftp/spool.c ncftp-3.2.6/ncftp/spool.c --- ncftp-3.2.5/ncftp/spool.c 2010-04-07 15:22:28.000000000 +0000 +++ ncftp-3.2.6/ncftp/spool.c 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* spool.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ diff -Nru ncftp-3.2.5/ncftp/spool.h ncftp-3.2.6/ncftp/spool.h --- ncftp-3.2.5/ncftp/spool.h 2008-10-05 20:45:18.000000000 +0000 +++ ncftp-3.2.6/ncftp/spool.h 2016-05-31 02:26:46.000000000 +0000 @@ -1,6 +1,6 @@ /* spool.h * - * Copyright (c) 1992-2004 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -12,20 +12,83 @@ # define kSpoolLog "log" #endif +#define kSpoolEntryBegin "#BEGIN#" +#define kSpoolEntryBeginLine kSpoolEntryBegin " This is a NcFTP spool file entry." + /* spool.c */ void TruncBatchLog(void); int MkSpoolDir(char *, size_t); void SpoolName(char *const sp, const size_t size, const int flag, const int serial, time_t when); int CanSpool(void); int HaveSpool(void); +char *SpoolFilePath(char *const dst, size_t dsize, const char *sdir, const char *const sname); +FILE *OpenSpoolFile( + FILE *const ofp, + char *const initialpath, + const size_t ipsize, + char *const finalpath, + const size_t fpsize, + char *const sname, + const size_t snsize, + const char *sdir, + const char *const op, + const time_t when + ); +int WriteSpoolEntry( + FILE *const fp, + const char *const op, + const char *const jobname, + const char *const rfile, + const char *const rdir, + double rfilesize, + time_t rmtime, + const char *const lfile, + const char *const ldir, + double lfilesize, + time_t lmtime, + const char *const rnewfile, + const char *const rnewdir, + const char *const lnewfile, + const char *const lnewdir, + const char *const host, + const char *const ip, + const unsigned int port, + const char *const user, + const char *const passclear, + const char *const xacct, + const int xtype, + const int recursive, + const int deleteflag, + const int passive, + const char *const preftpcmd, + const char *const perfileftpcmd, + const char *const postftpcmd, + const char *const preshellcmd, + const char *const postshellcmd, + const unsigned int delaySinceLastFailure, + const char *const manualOverrideFeatures, + const char *const preferredLocalAddrStr, + const time_t timeOfFirstAttempt, + const time_t timeOfLastFailure + ); +int CloseSpoolFileAndRename(FILE *const fp, FILE *const efp, char *const initialpath, char *const finalpath); int SpoolX( FILE *const ofp, + FILE *const efp, const char *sdir, const char *const op, const char *const rfile, const char *const rdir, + double rfilesize, + time_t rmtime, const char *const lfile, const char *const ldir, + double lfilesize, + time_t lmtime, + const char *const rnewfile, + const char *const rnewdir, + const char *const lnewfile, + const char *const lnewdir, const char *const host, const char *const ip, const unsigned int port, @@ -45,6 +108,8 @@ const unsigned int delaySinceLastFailure, const char *const manualOverrideFeatures, const char *const preferredLocalAddrStr, + const time_t timeOfFirstAttempt, + const time_t timeOfLastFailure, const int reserved); void RunBatch(void); void RunBatchWithCore(const FTPCIPtr); diff -Nru ncftp-3.2.5/ncftp/spoolutil.c ncftp-3.2.6/ncftp/spoolutil.c --- ncftp-3.2.5/ncftp/spoolutil.c 2008-10-05 20:45:01.000000000 +0000 +++ ncftp-3.2.6/ncftp/spoolutil.c 2016-11-15 17:42:13.000000000 +0000 @@ -1,6 +1,6 @@ /* spoolutil.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -47,6 +47,7 @@ + void SpoolName(char *const sp, const size_t size, const int flag, const int serial, time_t when) { @@ -71,15 +72,21 @@ #else # ifdef HAVE_SNPRINTF (void) snprintf(sp, size - 1, + "%c-%s-%06d-%d", + flag, + dstr, + (unsigned int) getpid(), + serial + ); # else (void) sprintf(sp, + "%c-%s-%06d-%d", + flag, + dstr, + (unsigned int) getpid(), + serial + ); # endif - "%c-%s-%06d-%d", - flag, - dstr, - (unsigned int) getpid(), - serial - ); #endif } /* SpoolName */ @@ -95,6 +102,8 @@ c = 0; for (cp = line; *cp; cp++) { c = (int) *cp; + if (c == '\r') + continue; if ((c == '\n') && (cp[1] != '\0')) { if (putc('\\', ofp) == EOF) return (-1); @@ -112,15 +121,132 @@ -int -SpoolX( +char * +SpoolFilePath( + char *const dst, + size_t dsize, + const char *sdir, + const char *const sname +) +{ + char sdir2[256]; + + if (dst == NULL) + return NULL; + + memset(dst, 0, dsize); + if ((sname == NULL) || (sname[0] == '\0')) + return NULL; + + if (sdir == NULL) { + if (MkSpoolDir(sdir2, sizeof(sdir2)) < 0) + return NULL; + sdir = sdir2; + } + + Path(dst, dsize, sdir, sname); + return (dst); +} /* SpoolFilePath */ + + + + +FILE * +OpenSpoolFile( FILE *const ofp, + char *const initialpath, + const size_t ipsize, + char *const finalpath, + const size_t fpsize, + char *const sname, + const size_t snsize, const char *sdir, const char *const op, + const time_t when +) +{ + FILE *fp = NULL; +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) +#else + mode_t um; +#endif + + if (op == NULL) + return NULL; + + for (;;) { + memset(initialpath, 0, ipsize); + memset(finalpath, 0, fpsize); + memset(sname, 0, snsize); + + ++gSpoolSerial; + + SpoolName(sname, snsize, 'z', gSpoolSerial, when); + if (SpoolFilePath(initialpath, ipsize, sdir, sname) == NULL) return NULL; +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) + if ((fp = _fsopen(finalpath, FOPEN_READ_TEXT, _SH_DENYNO)) != NULL) +#else + if ((fp = fopen(finalpath, "r")) != NULL) +#endif + { + /* File existed already! Choose a different one. */ + (void) fclose(fp); + fp = NULL; + continue; + } + + SpoolName(sname, snsize, op[0], gSpoolSerial, when); + if (SpoolFilePath(finalpath, fpsize, sdir, sname) == NULL) return NULL; +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) + if ((fp = _fsopen(finalpath, FOPEN_READ_TEXT, _SH_DENYNO)) != NULL) +#else + if ((fp = fopen(finalpath, "r")) != NULL) +#endif + { + /* File existed already! Choose a different one. */ + (void) fclose(fp); + fp = NULL; + continue; + } + + /* Neither file existed. Done. */ + break; + } + + if (ofp != NULL) + return (ofp); + +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) + fp = fopen(initialpath, FOPEN_WRITE_TEXT); +#else + /* Make sure file is private */ + um = umask(077); + fp = fopen(initialpath, FOPEN_WRITE_TEXT); + (void) umask(um); +#endif + + return (fp); +} /* OpenSpoolFile */ + + + +int +WriteSpoolEntry( + FILE *const fp, + const char *const op, + const char *const jobname, const char *const rfile, const char *const rdir, + double rfilesize, + time_t rmtime, const char *const lfile, const char *const ldir, + double lfilesize, + time_t lmtime, + const char *const rnewfile, + const char *const rnewdir, + const char *const lnewfile, + const char *const lnewdir, const char *const host, const char *const ip, const unsigned int port, @@ -136,77 +262,67 @@ const char *const postftpcmd, const char *const preshellcmd, const char *const postshellcmd, - const time_t when, const unsigned int delaySinceLastFailure, const char *const manualOverrideFeatures, const char *const preferredLocalAddrStr, - const int UNUSED(reserved) + const time_t timeOfFirstAttempt, + const time_t timeOfLastFailure ) { - char sdir2[256]; char pass[160]; - char sname[64], sname2[64]; - char spathname[256]; - char spathname2[256]; + char lpathname[1024]; char ldir2[256]; char *ldir3; - FILE *fp; + struct Stat st; + + if ((op != NULL) && (op[0] == 'p') && ((lfilesize <= 0) || (lmtime == 0))) { + /* Also include the size and time of the file when the + * item was first spooled, if not already supplied. + */ + Path(lpathname, sizeof(lpathname), ldir, lfile); #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) + if (WinStat64(lpathname, &st) == 0) { #else - mode_t um; + if (lstat(lpathname, &st) == 0) { #endif - - LIBNCFTP_USE_VAR(reserved); - gSpoolSerial++; - SpoolName(sname2, sizeof(sname2), op[0], gSpoolSerial, when); - - if (ofp == NULL) { - if (sdir == NULL) { - if (MkSpoolDir(sdir2, sizeof(sdir2)) < 0) - return (-1); - sdir = sdir2; + if (lfilesize <= 0) + lfilesize = (double) st.st_size; + if (lmtime == 0) + lmtime = st.st_mtime; } - Path(spathname2, sizeof(spathname2), sdir, sname2); - STRNCPY(sname, sname2); - sname[0] = 'z'; - Path(spathname, sizeof(spathname), sdir, sname); } -#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) - fp = (ofp == NULL) ? fopen(spathname, FOPEN_WRITE_TEXT) : ofp; -#else - um = umask(077); - fp = (ofp == NULL) ? fopen(spathname, FOPEN_WRITE_TEXT) : ofp; - (void) umask(um); -#endif - if (fp == NULL) - return (-1); - - if (fprintf(fp, "# This is a NcFTP spool file entry.\n") < 0) - goto err; - if ((ofp == NULL) && (fprintf(fp, "# Run the \"ncftpbatch\" program to process the spool directory.\n#\n") < 0)) + /* This starting comment line is now important. + * It will serve as the delineator between multiple entries in the same transaction file. + */ + if (fprintf(fp, "%s\n", kSpoolEntryBeginLine) < 0) goto err; - if (fprintf(fp, "job-name=%s\n", sname2) < 0) + + if (fprintf(fp, "job-name=%s\n", jobname) < 0) goto err; if (fprintf(fp, "op=%s\n", op) < 0) goto err; if ((delaySinceLastFailure != 0) && (fprintf(fp, "delay-since-last-failure=%u\n", delaySinceLastFailure) < 0)) goto err; + if ((timeOfFirstAttempt != 0) && (fprintf(fp, "time-of-first-attempt=%lu\n", (unsigned long) timeOfFirstAttempt) < 0)) + goto err; + if ((timeOfLastFailure != 0) && (fprintf(fp, "time-of-last-failure=%lu\n", (unsigned long) timeOfLastFailure) < 0)) + goto err; if (fprintf(fp, "hostname=%s\n", host) < 0) goto err; if ((ip != NULL) && (ip[0] != '\0') && (fprintf(fp, "host-ip=%s\n", ip) < 0)) goto err; if ((port != 0) && (port != (unsigned int) kDefaultFTPPort) && (fprintf(fp, "port=%u\n", port) < 0)) goto err; - if ((user != NULL) && (user[0] != '\0') && (strcmp(user, "anonymous") != 0) && (fprintf(fp, "user=%s\n", user) < 0)) + if ((user != NULL) && (user[0] != '\0') && (strcmp(user, "anonymous") != 0) && (fprintf(fp, "username=%s\n", user) < 0)) goto err; if ((strcmp(user, "anonymous") != 0) && (passclear != NULL) && (passclear[0] != '\0')) { (void) memcpy(pass, kPasswordMagic, kPasswordMagicLen); ToBase64(pass + kPasswordMagicLen, passclear, strlen(passclear), 1); - if (fprintf(fp, "pass=%s\n", pass) < 0) + if (fprintf(fp, "password=%s\n", pass) < 0) goto err; } else if ((strcmp(user, "anonymous") == 0) && (gLib.defaultAnonPassword[0] != '\0')) { - if (fprintf(fp, "pass=%s\n", gLib.defaultAnonPassword) < 0) + if (fprintf(fp, "password=%s\n", gLib.defaultAnonPassword) < 0) goto err; } if ((xacct != NULL) && (xacct[0] != '\0') && (fprintf(fp, "acct=%s\n", xacct) < 0)) @@ -249,18 +365,40 @@ } if (fprintf(fp, "remote-file=%s\n", rfile) < 0) goto err; + if ((rfilesize > 0) && (fprintf(fp, "remote-file-size=%.0f\n", rfilesize) < 0)) + goto err; + if ((rmtime > 0) && (fprintf(fp, "remote-file-mtime=%lu\n", (unsigned long) rmtime) < 0)) + goto err; if (fprintf(fp, "local-file=%s\n", lfile) < 0) goto err; - if ((manualOverrideFeatures != NULL) && (manualOverrideFeatures[0] != '\0')) { - if (fprintf(fp, "manual-override-features=") < 0) + if ((lfilesize > 0) && (fprintf(fp, "local-file-size=%.0f\n", lfilesize) < 0)) + goto err; + if ((lmtime > 0) && (fprintf(fp, "local-file-mtime=%lu\n", (unsigned long) lmtime) < 0)) + goto err; + if ((lnewdir != NULL) && (lnewdir[0] != '\0')) { + if (fprintf(fp, "local-rename-dir=%s\n", lnewdir) < 0) goto err; - if (WriteSpoolLine(fp, manualOverrideFeatures) < 0) + } + if ((lnewfile != NULL) && (lnewfile[0] != '\0')) { + if (fprintf(fp, "local-rename-file=%s\n", lnewfile) < 0) + goto err; + } + if ((rnewdir != NULL) && (rnewdir[0] != '\0')) { + if (fprintf(fp, "remote-rename-dir=%s\n", rnewdir) < 0) + goto err; + } + if ((rnewfile != NULL) && (rnewfile[0] != '\0')) { + if (fprintf(fp, "remote-rename-file=%s\n", rnewfile) < 0) goto err; } if ((preferredLocalAddrStr != NULL) && (preferredLocalAddrStr[0] != '\0')) { - if (fprintf(fp, "source-address=") < 0) + if (fprintf(fp, "source-address=%s\n", preferredLocalAddrStr) < 0) goto err; - if (WriteSpoolLine(fp, preferredLocalAddrStr) < 0) + } + if ((manualOverrideFeatures != NULL) && (manualOverrideFeatures[0] != '\0')) { + if (fprintf(fp, "manual-override-features=") < 0) + goto err; + if (WriteSpoolLine(fp, manualOverrideFeatures) < 0) goto err; } if ((preftpcmd != NULL) && (preftpcmd[0] != '\0')) { @@ -294,28 +432,158 @@ goto err; } - if ((fp != ofp) && (fclose(fp) < 0)) - goto err2; + if (fflush(fp) < 0) + goto err; + return (0); - /* Move the spool file into its "live" name. */ - if ((fp != ofp) && (rename(spathname, spathname2) < 0)) { - perror("rename spoolfile failed"); - goto err3; +err: + return (-1); +} /* WriteSpoolEntry */ + + + + + +int +CloseSpoolFileAndRename( + FILE *const fp, + FILE *const efp, + char *const initialpath, + char *const finalpath +) +{ + int closed = 0, renamed = 0; + + if (fp != NULL) { + if (fclose(fp) < 0) { + if (efp != NULL) + fprintf(efp, "write to spoolfile (%s) failed: %s\n", initialpath, strerror(errno)); + } else { + closed = 1; + } } + + /* Move the spool file into its "live" name. */ + if ((initialpath != NULL) && (initialpath[0] != '\0') && (finalpath != NULL) && (finalpath[0] != '\0')) { + if (rename(initialpath, finalpath) < 0) { + if (efp != NULL) + fprintf(efp, "rename spoolfile failed (%s --> %s): %s\n", initialpath, finalpath, strerror(errno)); + (void) unlink(initialpath); + } else { #ifdef ncftp - gUnprocessedJobs++; + gUnprocessedJobs++; #endif - return (0); + renamed = 1; + } + } + return ((renamed && closed) ? 0 : -1); +} /* CloseSpoolFileAndRename */ -err: - if (fp != ofp) - (void) fclose(fp); -err2: - perror("write to spool file failed"); -err3: - if (fp != ofp) - (void) unlink(spathname); - return (-1); + + + +int +SpoolX( + FILE *const ofp, + FILE *const efp, + const char *sdir, + const char *const op, + const char *const rfile, + const char *const rdir, + double rfilesize, + time_t rmtime, + const char *const lfile, + const char *const ldir, + double lfilesize, + time_t lmtime, + const char *const rnewfile, + const char *const rnewdir, + const char *const lnewfile, + const char *const lnewdir, + const char *const host, + const char *const ip, + const unsigned int port, + const char *const user, + const char *const passclear, + const char *const xacct, + const int xtype, + const int recursive, + const int deleteflag, + const int passive, + const char *const preftpcmd, + const char *const perfileftpcmd, + const char *const postftpcmd, + const char *const preshellcmd, + const char *const postshellcmd, + const time_t when, + const unsigned int delaySinceLastFailure, + const char *const manualOverrideFeatures, + const char *const preferredLocalAddrStr, + const time_t timeOfFirstAttempt, + const time_t timeOfLastFailure, + const int UNUSED(reserved) + ) +{ + char sname[64]; + char initialpath[256]; + char finalpath[256]; + FILE *fp; + + LIBNCFTP_USE_VAR(reserved); + + fp = OpenSpoolFile(ofp, initialpath, sizeof(initialpath), finalpath, sizeof(finalpath), sname, sizeof(sname), sdir, op, when); + if (fp == NULL) { + if (efp != NULL) + fprintf(efp, "Could not open spool file for writing: %s\n", strerror(errno)); + return (-1); + } + + if (WriteSpoolEntry( + fp, + op, + sname, + rfile, + rdir, + rfilesize, + rmtime, + lfile, + ldir, + lfilesize, + lmtime, + rnewfile, + rnewdir, + lnewfile, + lnewdir, + host, + ip, + port, + user, + passclear, + xacct, + xtype, + recursive, + deleteflag, + passive, + preftpcmd, + perfileftpcmd, + postftpcmd, + preshellcmd, + postshellcmd, + delaySinceLastFailure, + manualOverrideFeatures, + preferredLocalAddrStr, + timeOfFirstAttempt, + timeOfLastFailure + ) < 0) { + if (efp != NULL) + fprintf(efp, "write to spoolfile (%s) failed: %s\n", initialpath, strerror(errno)); + return (-1); + } + + if ((fp != ofp) && (CloseSpoolFileAndRename(fp, efp, initialpath, finalpath) < 0)) + return (-1); + + return (0); } /* SpoolX */ diff -Nru ncftp-3.2.5/ncftp/syshdrs.h ncftp-3.2.6/ncftp/syshdrs.h --- ncftp-3.2.5/ncftp/syshdrs.h 2009-11-30 18:50:28.000000000 +0000 +++ ncftp-3.2.6/ncftp/syshdrs.h 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* syshdrs.h * - * Copyright (c) 1992-2004 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -39,6 +39,7 @@ # define _WIN32_WINNT 0x0500 # endif # include /* includes if _WIN32_WINNT >= 0x400 */ +# include # include # include # include diff -Nru ncftp-3.2.5/ncftp/trace.c ncftp-3.2.6/ncftp/trace.c --- ncftp-3.2.5/ncftp/trace.c 2008-08-18 20:49:20.000000000 +0000 +++ ncftp-3.2.6/ncftp/trace.c 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* trace.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ diff -Nru ncftp-3.2.5/ncftp/trace.h ncftp-3.2.6/ncftp/trace.h --- ncftp-3.2.5/ncftp/trace.h 2004-01-06 21:42:13.000000000 +0000 +++ ncftp-3.2.6/ncftp/trace.h 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* trace.h * - * Copyright (c) 1992-2004 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ diff -Nru ncftp-3.2.5/ncftp/util.c ncftp-3.2.6/ncftp/util.c --- ncftp-3.2.5/ncftp/util.c 2010-10-30 21:34:25.000000000 +0000 +++ ncftp-3.2.6/ncftp/util.c 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* util.c * - * Copyright (c) 1992-2006 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -177,6 +177,9 @@ * usefully without the memory requested. */ void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) +__attribute__ ((noreturn)) +#endif OutOfMemory(void) { (void) fprintf(stderr, "Out of memory!\n"); @@ -193,7 +196,7 @@ (void) Strncpy(dst, "???", siz); if (src != NULL) { ia = ((struct in_addr **) src)[i]; - InetNtoA(dst, ia, siz); + InetNtoA(dst, ia, (unsigned int) siz); } } /* MyInetAddr */ @@ -519,7 +522,7 @@ while (*dst != '\0') { if (isupper((int) *dst)) - *dst = (char) tolower(*dst); + *dst = (char) tolower((int) *dst); dst++; } return (dst); @@ -646,6 +649,9 @@ /* Some commands may want to jump back to the start too. */ static void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) +__attribute__ ((noreturn)) +#endif CancelGetHostByName(int sigNum) { #ifdef ncftp @@ -752,7 +758,7 @@ } #endif if (hp != NULL) { - InetNtoA(dst, ((struct in_addr **) hp->h_addr_list)[0], dsize); + InetNtoA(dst, ((struct in_addr **) hp->h_addr_list)[0], (unsigned int) dsize); return (0); } } diff -Nru ncftp-3.2.5/ncftp/util.h ncftp-3.2.6/ncftp/util.h --- ncftp-3.2.5/ncftp/util.h 2010-10-30 21:34:14.000000000 +0000 +++ ncftp-3.2.6/ncftp/util.h 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* util.h * - * Copyright (c) 1992-2006 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ diff -Nru ncftp-3.2.5/ncftp/version.c ncftp-3.2.6/ncftp/version.c --- ncftp-3.2.5/ncftp/version.c 2011-02-02 23:13:08.000000000 +0000 +++ ncftp-3.2.6/ncftp/version.c 2016-12-04 19:00:12.000000000 +0000 @@ -6,7 +6,7 @@ /******************************************************************************/ -const char gVersion[] = "@(#) NcFTP 3.2.5/474 Feb 02 2011, 05:13 PM"; +const char gVersion[] = "@(#) NcFTP 3.2.6/575 Dec 04 2016, 01:00 PM"; /******************************************************************************/ @@ -23,7 +23,7 @@ /******************************************************************************/ const char gCopyright[] = "@(#) \ -Copyright (c) 1992-2011 by Mike Gleason.\n\ +Copyright (c) 1992-2016 by Mike Gleason.\n\ All rights reserved.\n\ "; diff -Nru ncftp-3.2.5/sh/mksrctar.sh ncftp-3.2.6/sh/mksrctar.sh --- ncftp-3.2.5/sh/mksrctar.sh 2010-04-07 18:25:20.000000000 +0000 +++ ncftp-3.2.6/sh/mksrctar.sh 2016-11-27 21:16:20.000000000 +0000 @@ -14,6 +14,7 @@ TMPDIR=/tmp TAR="" TARFLAGS="" +GZIPFLAGS="-9" if [ "$#" -lt 2 ] ; then TARDIR="ncftp" @@ -28,13 +29,15 @@ fi fi -if [ -x /usr/bin/bzip2 ] ; then - BZIP="/usr/bin/bzip2" -elif [ -x /usr/local/bin/bzip2 ] ; then - BZIP="/usr/local/bin/bzip2" -else - BZIP=":" + +XZ=`which xz 2>/dev/null` +if [ -z "$XZ" ] ; then + XZ=":" + BZIP=`which bzip2 2>/dev/null` # Only look for ol' bzip unless we don't have xz fi +[ -z "$BZIP" ] && BZIP=":" + +SXGZFILE=`echo "$STGZFILE" | sed 's/\.tar\.gz/.tar.xz/g'` SBGZFILE=`echo "$STGZFILE" | sed 's/\.tar\.gz/.tar.bz2/g'` ZIPFILE=`echo "$STGZFILE" | sed 's/\.tar\.gz/.zip/g'` rm -rf $TMPDIR/TAR @@ -50,10 +53,18 @@ /libncftp\/configure$/d /sio\/configure$/d /Strn\/configure$/d +/\.git$/d +/\.svn$/d +/DerivedData/d +/xcuserdata/d +/\.xcuserstate/d /\.o$/d /\.so$/d +/\.dylib$/d /\.a$/d /\.lib$/d +/\.la$/d +/\.lo$/d /\.ncb$/d /\.suo$/d /\.user$/d @@ -64,6 +75,8 @@ /\.gch$/d /\.cpch$/d /\.dSYM/d +/\.ipa$/d +/\.hmap$/d /SunWS_cache/d /\.ilk$/d /\.res$/d @@ -72,8 +85,10 @@ /\.plg$/d /\.obj$/d /\.exe$/d +/\.app$/d /\.zip$/d /\.gz$/d +/\.xz$/d /\.bz2$/d /\.tgz$/d /\.tar$/d @@ -134,19 +149,32 @@ esac fi -( cd $TMPDIR/TAR ; $TAR $TARFLAGS - $TARDIR | gzip -c > $STGZFILE ) +( cd $TMPDIR/TAR ; zip -q -r -o -9 $ZIPFILE $TARDIR ) +cp $TMPDIR/TAR/$ZIPFILE . + +( cd $TMPDIR/TAR ; $TAR $TARFLAGS - $TARDIR | ${GZIP-gzip} $GZIPFLAGS -c > $STGZFILE ) cp $TMPDIR/TAR/$STGZFILE . +[ -f "$ZIPFILE" ] && touch -r "$ZIPFILE" "$STGZFILE" if [ "$BZIP" != ":" ] ; then - ( cd $TMPDIR/TAR ; $TAR $TARFLAGS - $TARDIR | $BZIP -c > $SBGZFILE ) + ( cd $TMPDIR/TAR ; $TAR $TARFLAGS - $TARDIR | $BZIP $BZIPFLAGS -c > $SBGZFILE ) cp $TMPDIR/TAR/$SBGZFILE . + [ -f "$ZIPFILE" ] && touch -r "$ZIPFILE" "$SBGZFILE" fi -( cd $TMPDIR/TAR ; zip -q -r -9 $ZIPFILE $TARDIR ) -cp $TMPDIR/TAR/$ZIPFILE . +if [ "$XZ" != ":" ] ; then + ( cd $TMPDIR/TAR ; $TAR $TARFLAGS - $TARDIR | $XZ $XZFLAGS -c > $SXGZFILE ) + cp $TMPDIR/TAR/$SXGZFILE . + [ -f "$ZIPFILE" ] && touch -r "$ZIPFILE" "$SXGZFILE" +fi -chmod 644 $STGZFILE $SBGZFILE $ZIPFILE 2>/dev/null +chmod 644 "$STGZFILE" "$SBGZFILE" "$SXGZFILE" "$ZIPFILE" 2>/dev/null rm -rf $TMPDIR/TAR -touch -r ncftp/version.c $STGZFILE $SBGZFILE $ZIPFILE -ls -l $STGZFILE $SBGZFILE $ZIPFILE 2>/dev/null +for tgz in "$STGZFILE" "$SBGZFILE" "$SXGZFILE" "$ZIPFILE" ; do + if [ -f "$tgz" ] && [ -s "$tgz" ] ; then + touch -r ncftp/version.c "$tgz" + fi +done +echo "* Finished archiving at `date`." +/bin/ls -l -d ncftp/version.c "$STGZFILE" "$SBGZFILE" "$SXGZFILE" "$ZIPFILE" 2>/dev/null exit 0 diff -Nru ncftp-3.2.5/sh/mksrczip.bat ncftp-3.2.6/sh/mksrczip.bat --- ncftp-3.2.5/sh/mksrczip.bat 2010-04-07 18:26:01.000000000 +0000 +++ ncftp-3.2.6/sh/mksrczip.bat 2016-11-11 18:13:37.000000000 +0000 @@ -6,7 +6,7 @@ cd .. erase \temp\ncftp.zip -pkzip25.exe -add -204 -dir=current -excl=*.exe -excl=*.o -excl=*.obj -excl=*.lib -excl=*.pch -excl=*.ilk -excl=*.ncb -excl=*.suo -excl=*.user -excl=*.opt -excl=*.pdb -excl=*.idb -excl=*.plg -excl=*.scc -excl=*.aps -excl=*.sbr -excl=*.bsc -excl=*.exp -excl=*.res -excl=*.zip \temp\ncftp.zip ncftp\*.* +pkzip25.exe -add -204 -dir=current -excl=*.exe -excl=*.o -excl=*.obj -excl=*.lib -excl=*.pch -excl=*.ilk -excl=*.ncb -excl=*.suo -excl=*.user -excl=*.opt -excl=*.pdb -excl=*.idb -excl=*.plg -excl=*.scc -excl=*.aps -excl=*.sbr -excl=*.bsc -excl=*.exp -excl=*.res -excl=.git -excl=*.gz -excl=*.xz -excl=*.zip \temp\ncftp.zip ncftp\*.* cd \src\win\ncftp dir \temp\ncftp.zip diff -Nru ncftp-3.2.5/sh/ncftpspooler_add_file_to_upload.pl ncftp-3.2.6/sh/ncftpspooler_add_file_to_upload.pl --- ncftp-3.2.5/sh/ncftpspooler_add_file_to_upload.pl 1970-01-01 00:00:00.000000000 +0000 +++ ncftp-3.2.6/sh/ncftpspooler_add_file_to_upload.pl 2016-09-15 21:45:32.000000000 +0000 @@ -0,0 +1,920 @@ +#!/usr/bin/perl -w +# +# $Id: ncftpspooler_add_file_to_upload.pl 1124 2016-09-15 21:42:06Z mgleason $ +# +use strict; +use Getopt::Long; +use File::Basename; +use Date::Parse; # http://search.cpan.org/~gbarr/TimeDate-2.30/lib/Date/Parse.pm +use POSIX; +use Cwd 'abs_path'; + +my ($gDebug) = 0; + +my ($gProgress) = -1; +my ($gStartTime) = time(); +my ($gLastProgressReportTime) = 0; +my (@gIncludePatterns) = (); +my (@gExcludePatterns) = (); +my ($gScreenColumns) = $ENV{"COLUMNS"} || 80; +my ($gMayExcludeDirectories) = -1; +my ($gMaxDepth) = -1; +my ($gOneDev) = 0; +my ($newer_t) = 0; +my ($older_t) = 0; +my ($gMinSize) = -1; +my ($gMaxSize) = -1; +my ($gSort) = ""; + +my ($dryrun) = 0; +my ($nprocessed) = 0; +my ($njobsqueued) = 0; +my ($tbytesqueued) = 0; +my ($jobname) = ""; +my ($jobpath) = ""; +my ($jobpathtmp) = ""; +my ($jobdata) = ""; +my ($jobdate) = ""; +my ($jobtime) = ""; +my ($njobfiles) = 0; +my ($njobsperjobfile) = 0; +my ($nbytesperjobfile) = 0; +my ($maxjobsperjobfile) = undef; +my ($maxbytesperjobfile) = undef; +my ($create_new_job_file) = 1; +my ($Mbps_Est) = 20; +my ($pid) = POSIX::getpid(); +my ($seqnum) = 0; +my ($lroot) = ""; +my ($rroot) = ""; +my ($job_scheduled_time) = time(); +my ($queue_directory) = "/var/spool/ncftp"; +my (%vars) = ( + "rhost" => "", + "ruser" => "", + "rpassword" => "", + "test" => 1 +); + + + + +sub AbbrevStr +{ + my ($s) = $_[0]; + my ($maxlen) = $_[1]; + my ($len, $p); + + if (($len = length($s)) > $maxlen) { + $p = int($maxlen * 1 / 3); + return ( + substr($s, 0, $p) . + "..." . + substr($s, $len - ($maxlen - $p) + 3) + ); + } + return ($s); +} # AbbrevStr + + + + +sub ByteUnits +{ + my ($bytes) = $_[0]; + my ($doprint) = 0; + $doprint = $_[1] if (scalar(@_) >= 2); + + my (@ulist) = ("k", "M", "G", "T", "P", "E", "Z", "Y"); + + if ($bytes =~ /^\s*(\d+(\.\d+)?)\s*$/i) { + $bytes = $1; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(ki)/i) { + $bytes = $1 * 1024; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(Mi)/i) { + $bytes = $1 * 1024 * 1024; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(Gi)/i) { + $bytes = $1 * 1024 * 1024 * 1024; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(Ti)/i) { + $bytes = $1 * 1024 * 1024 * 1024 * 1024; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(Pi)/i) { + $bytes = $1 * 1024 * 1024 * 1024 * 1024 * 1024; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(Ei)/i) { + $bytes = $1 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(Zi)/i) { + $bytes = $1 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(k)/i) { + $bytes = $1 * 1000; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(M)/i) { + $bytes = $1 * 1000 * 1000; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(G)/i) { + $bytes = $1 * 1000 * 1000 * 1000; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(T)/i) { + $bytes = $1 * 1000 * 1000 * 1000 * 1000; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(P)/i) { + $bytes = $1 * 1000 * 1000 * 1000 * 1000 * 1000; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(E)/i) { + $bytes = $1 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(Z)/i) { + $bytes = $1 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000; + } elsif ($bytes =~ /^\s*(\d+(\.\d+)?)\s*(\S+)/i) { + die "Unrecognized unit, $3\n"; + } + + my ($ni) = $bytes; + my ($n) = $bytes; + my ($u) = ""; + + my ($rni) = $ni; + my ($rn) = $n; + my ($ru) = $u; + + for (my $i = 0; $i < scalar(@ulist); $i++) { + last if ($n < 1000); + printf ("%.0f bytes = %.3f %sB = %.3f %siB\n", $bytes, $n, $u, $ni, $u) if ($doprint); + $n *= 0.001; + $ni /= 1024.0; + $u = $ulist[$i]; + $rni = $ni; + $rn = $n; + $ru = $u; + } + + return ($bytes, $rni, $rn, $ru); +} # ByteUnits + + + + +sub ProgressMessage +{ + my ($s) = $_[0]; + my ($lastmsg) = $_[1]; + my ($spec) = sprintf("%%-%us", $gScreenColumns); + + if ($lastmsg) { + printf STDERR ("\r%s\n", sprintf($spec, sprintf("%s", AbbrevStr($s, $gScreenColumns - 0)))); + } else { + printf STDERR ("\r%s", sprintf($spec, sprintf("%s... ", AbbrevStr($s, $gScreenColumns- 4)))); + } +} # ProgressMessage + + + + +sub CreateQueueDirectoryOrDie +{ + if ((! defined($queue_directory)) || ($queue_directory eq "") || ($queue_directory eq ".")) { + die "Invalid queue directory.\n"; + } + if ((-e $queue_directory) && (! -d $queue_directory)) { + die "$queue_directory is not a directory.\n"; + } + if (! -e $queue_directory) { + if (! mkdir($queue_directory, 00777)) { + die "Could not create queue directory, $queue_directory.\n"; + } + if (! -d $queue_directory) { + die "Missing queue directory, $queue_directory.\n"; + } + warn "Created $queue_directory.\n"; + } +} # CreateQueueDirectoryOrDie + + + + +sub CloseJobFile +{ + if ($jobpathtmp ne "") { + $create_new_job_file = 1; + if (! $dryrun) { + if (! rename($jobpathtmp, $jobpath)) { + die("Could not rename $jobpathtmp to $jobpath: $!\n"); + } + } + printf STDOUT ("# Closed %s (%d jobs).\n", $jobpathtmp, $njobsperjobfile) if (($njobsperjobfile > 1) && ($gDebug >= 2)); + $njobsperjobfile = 0; + $nbytesperjobfile = 0; + $njobfiles++; + } + $jobpathtmp = ""; +} # CloseJobFile + + + + +sub EnqueueItem +{ + my ($lpathname, $short_ftype, $lmtstr, $lsize) = @_; + + return if ((! defined($lpathname)) || ($lpathname eq "")); + + $nprocessed++; + if (! -f $lpathname) { + warn "Missing local file to send, $lpathname.\n"; + return; + } + + my ($op) = "put"; + my ($o) = substr($op, 0, 1); + + my ($sep) = ""; + my ($local_dir) = dirname($lpathname); + my ($lrelname) = $lpathname; + if ($lroot ne "") { + $lroot =~ s/\/+$//; + if ($lroot ne "") { + $lrelname =~ s/^$lroot\/*//; + } + } + + my ($subdir) = dirname($lrelname); + my ($lfilename) = basename($lrelname); + my ($rfilename) = $lfilename; + + return if ($lfilename eq ".DS_Store"); + + if ($rroot eq "") { + $rroot = $vars{"rroot"} || "."; + } + + my ($remote_dir) = $rroot; + if ($subdir ne "") { + $subdir =~ s/^\.\///; + if (($subdir ne ".") && ($subdir ne "")) { + $remote_dir .= "/" . $subdir; + } + } + $remote_dir =~ s/^\.\///; + + if ($jobdate eq "") { + $jobdate = POSIX::strftime("%Y%m%d", gmtime($job_scheduled_time)); + $jobtime = POSIX::strftime("%H%M%S", gmtime($job_scheduled_time)); + } + + CreateQueueDirectoryOrDie(); + + if ($create_new_job_file) { + do { + $seqnum++; + $jobname = sprintf("%s-%s-%s-%s-%09d", $o, $jobdate, $jobtime, $pid, $seqnum); + $jobpath = "$queue_directory/$jobname.txt"; + $jobpathtmp = sprintf("%s/%s-%s-%s-%s-%09d", $queue_directory, "x", $jobdate, $jobtime, $pid, $seqnum); + } while ((-e $jobpath) || (-e $jobpathtmp)); + $njobsperjobfile = 0; + $nbytesperjobfile = 0; + $create_new_job_file = 0; + } else { + $sep = "\n\n\n"; + $seqnum++; + $jobname = sprintf("%s-%s-%s-%s-%09d", $o, $jobdate, $jobtime, $pid, $seqnum); + } + + my ($rpassword_comment) = ""; + $rpassword_comment = "# " if ($vars{"rpassword"} eq ""); + + $jobdata = <> $jobpathtmp")) { + die("Could not open $jobpathtmp for writing: $!\n"); + } + + print JOBFILE $jobdata or die "Could not write jobdata to $jobpathtmp: $!\n"; + close(JOBFILE); + } + + $njobsperjobfile++; + $nbytesperjobfile += $lsize if ($lsize ne ""); + if ( + ((! defined($maxjobsperjobfile)) && (! defined($maxbytesperjobfile))) || + ((defined($maxjobsperjobfile)) && ($njobsperjobfile >= $maxjobsperjobfile)) || + ((defined($maxbytesperjobfile)) && ($maxbytesperjobfile >= 0) && ($nbytesperjobfile >= $maxbytesperjobfile)) + ) { + CloseJobFile(); + } + + $njobsqueued++; + if ($gDebug >= 2) { + printf STDOUT ("# Queued job #%d to %s = {\n%s}\n\n", $njobsqueued, $jobpath, $jobdata); + } elsif ($gDebug >= 1) { + printf STDOUT ("> %s %-12d $jobname: %s\n", $lmtstr, $lsize, $lrelname); + } else { + } +} # EnqueueItem + + + + +sub FtwProcessItem +{ + my ($pathname, $ftype, $dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = @_; + + if ($pathname =~ /^\.\/(.+)$/) { + # Strip leading ./ from relative paths + $pathname = $1; + } + + if ($gProgress) { + # Print a gProgress report every 2 seconds + my ($now) = time(); + if ($now > $gLastProgressReportTime + 1) { + ProgressMessage($pathname, 0); + $gLastProgressReportTime = $now; + } + } + + my ($tstr, $short_ftype); + if ($ftype eq "file") { + $short_ftype = "-"; + my ($qit) = 1; + if (($newer_t != 0) && ($mtime < $newer_t)) { $qit = 0; } + if (($older_t != 0) && ($mtime >= $older_t)) { $qit = 0; } + if (($gMaxSize > 0) && ($size > $gMaxSize)) { + printf STDERR ("Warning: skipping \"%s\", which is too large (%.0f > %.0f).\n", $pathname, $size, $gMaxSize); + $qit = 0; + } + if (($gMinSize > 0) && ($size < $gMinSize)) { + printf STDERR ("Warning: skipping \"%s\", which is too small (%.0f < %.0f).\n", $pathname, $size, $gMinSize); + $qit = 0; + } + if ($qit) { + $tstr = strftime("%Y-%m-%d %H:%M:%S", localtime($mtime)); + EnqueueItem($pathname, $short_ftype, $mtime, $size); + $tbytesqueued += $size; + } + } elsif ($ftype eq "symlink") { + $short_ftype = "l"; + } elsif ($ftype eq "directory") { + $short_ftype = "d"; + } else { + $short_ftype = "?"; + } + + if ($gDebug >= 3) { + $tstr = strftime("%Y-%m-%d %H:%M:%S", localtime($mtime)); + printf(">>> %s %s %-12d %s\n", $short_ftype, $tstr, $size, $pathname); + } + return (0); # no error +} # FtwProcessItem + + + + +sub FtwIsExcluded +{ + my ($pathname) = $_[0]; + my ($pattern); + my ($exclude) = 0; + + return 0 if ((scalar(@gExcludePatterns) == 0) && (scalar(@gIncludePatterns) == 0)); + + $exclude = 1 if (scalar(@gExcludePatterns) == 0); + for $pattern (@gExcludePatterns) { + if ($pathname =~ /$pattern/i) { + $exclude = 1; + last; + } + } + + if ($exclude) { + for $pattern (@gIncludePatterns) { + if ($pathname =~ /$pattern/i) { + $exclude = 0; + last; + } + } + } + + return ($exclude); +} # FtwIsExcluded + + + + +sub FtwProcessDirectory +{ + my ($directory, $curdepth, $maxdepth, $onedev, $rootdev) = @_; + my ($filename, $pathname, $subdir); + my ($ftype); + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks); + my ($d_dev,$d_ino,$d_mode,$d_nlink,$d_uid,$d_gid,$d_rdev,$d_size,$d_atime,$d_mtime,$d_ctime,$d_blksize,$d_blocks); + my ($nitems); + my ($rc); + my (@subdirs) = (); + my (@filenames) = (); + my (@mtimes) = (); + my (@mdata) = (); + + if (! opendir(DIR, $directory)) { + # Maybe it was removed/renamed before we could get to it. + return (0); + } + + ($d_dev,$d_ino,$d_mode,$d_nlink,$d_uid,$d_gid,$d_rdev,$d_size,$d_atime,$d_mtime,$d_ctime,$d_blksize,$d_blocks) = stat($directory); + if (! defined($d_dev)) { + # Race condition? + closedir(DIR); + return (0); + } + if (! defined($rootdev)) { + $rootdev = $d_dev; + } + + if (($rc = FtwProcessItem($directory, "directory", $d_dev,$d_ino,$d_mode,$d_nlink,$d_uid,$d_gid,$d_rdev,$d_size,$d_atime,$d_mtime,$d_ctime,$d_blksize,$d_blocks)) != 0) { + # Proc said to abort. + closedir(DIR); + return ($rc); + } + + if (($maxdepth >= 0) && ($curdepth > $maxdepth)) { + closedir(DIR); + return (0); + } + + $directory = "" if ($directory eq "/"); + $nitems = 0; + my ($f_i) = 0; + my (@f_is) = (); + while (defined($filename = readdir(DIR))) { + next if ($filename eq "."); + next if ($filename eq ".."); + $nitems++; + $pathname = $directory . "/" . $filename; + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = lstat($pathname); + if (! defined($dev)) { + # Maybe it was removed/renamed + next; + } + + if (-l _) { + $ftype = "symlink"; + } elsif (-f _) { + $ftype = "file"; + } elsif (-d _) { + $ftype = "directory"; + if ($onedev) { + $dev = (stat(_))[0]; + push(@subdirs, $filename) if ($dev == $rootdev); + } else { + push(@subdirs, $filename); + } + } else { + $ftype = "other"; + } + + if ($ftype ne "directory") { + if (! FtwIsExcluded($pathname)) { + $f_is[$f_i] = $f_i; $f_i++; + push(@filenames, $filename); + push(@mtimes, $mtime); + push(@mdata, join('|', $ftype, $dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)); + } + } + } + closedir(DIR); + + if (scalar(@f_is) > 0) { + my (@sorted_f_is) = (); + if (uc($gSort) =~ /M?(TIME|DATE)* ASC/) { + @sorted_f_is = sort { + $mtimes[$a] <=> $mtimes[$b] or + $filenames[$a] cmp $filenames[$b] + } @f_is; + } elsif (uc($gSort) =~ /M?(TIME|DATE)* DESC/) { + @sorted_f_is = sort { + $mtimes[$b] <=> $mtimes[$a] or + $filenames[$a] cmp $filenames[$b] + } @f_is; + } elsif (uc($gSort) eq "NAME ASC") { + @sorted_f_is = sort { + $filenames[$a] cmp $filenames[$b] or + $mtimes[$a] <=> $mtimes[$b] + } @f_is; + } elsif (uc($gSort) eq "NAME DESC") { + @sorted_f_is = sort { + $filenames[$b] cmp $filenames[$a] or + $mtimes[$a] <=> $mtimes[$b] + } @f_is; + } else { + @sorted_f_is = @f_is; + } + + my ($n) = scalar(@f_is); + for (my $i = 0; $i < scalar(@f_is); $i++) { + $f_i = $sorted_f_is[$i]; + + $filename = $filenames[$f_i]; + $pathname = $directory . "/" . $filename; + ($ftype, $dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = split(/\|/, $mdata[$f_i]); + # print STDERR " $i of $n: p=[$pathname] ", $filenames[$f_i], "\n"; + if (($rc = FtwProcessItem($pathname, $ftype, $dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)) != 0) { + # Proc said to abort. + return ($rc); + } + } + } + + # + # Now do the rest of the subdirectories. + # We have waited until we closed the parent directory + # to conserve file descriptors. + # + if (scalar(@subdirs) > 0) { + for $subdir (@subdirs) { + $subdir = "$directory/$subdir"; + if ((! $gMayExcludeDirectories) || (! FtwIsExcluded($subdir))) { + $rc = FtwProcessDirectory($subdir, $curdepth + 1, $maxdepth, $onedev, $rootdev); + return ($rc) if ($rc < 0); + } + } + } + + return (0); +} # FtwProcessDirectory + + + + +sub Ftw +{ + my ($directory, $maxdepth, $onedev) = @_; + if ($directory =~ /^(.+)\/+$/) { + # Strip trailing slashes + $directory = $1; + } + return (-1) if (! -d $directory); + return (FtwProcessDirectory($directory, 1, $maxdepth, $onedev, undef)); +} # Ftw + + + + +sub Usage +{ + printf STDERR ("Usage: find ... -print | %s [--options] [more files to add]\n", $0); + printf STDERR <)) { + next if ($line =~ /^\s*#/); + $line =~ s/[\r\n]+$//; + my ($var, $val) = split(/=/, $line, 2); + next unless (defined($var) && ($var ne "")); + $val = 1 unless defined($val); + $var =~ s/^\s*//; $var =~ s/\s*$//; + $val =~ s/^\s*//; $val =~ s/\s*$//; + $var = "rhost" if ($var =~ /host/i); + $var = "ruser" if ($var =~ /user/i); + $var = "rpassword" if ($var =~ /pass/i); + $vars{$var} = $val; + # printf ("VAR=[%s] VAL=[%s]\n", $var, $val); + } + close(LCFG); +} # ReadLoginConfigFile + + + +sub TimeFromStrOrFile +{ + my ($arg) = $_[0]; + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = lstat($arg); + if (defined($mtime)) { return $mtime; } + + return (str2time($arg)); +} # TimeFromStrOrFile + + + + +sub ProcessCommandLineArguments +{ + my ($sort_descending) = ""; + my ($sort_ascending) = ""; + my ($maxSize) = ""; + my ($minSize) = ""; + + Getopt::Long::Configure ("bundling"); + Usage() unless GetOptions( + "exclude=s" => sub { push(@gExcludePatterns, $_[1]); }, + "x=s" => sub { push(@gExcludePatterns, $_[1]); }, + "include=s" => sub { push(@gIncludePatterns, $_[1]); }, + "i=s" => sub { push(@gIncludePatterns, $_[1]); }, + "xdev!" => \$gOneDev, + "maxdepth|max-depth=i" => \$gMaxDepth, + "maxsize|max-size=s" => \$maxSize, + "minsize|min-size=s" => \$minSize, + "progress!" => \$gProgress, + + "d|debug=i" => sub { $gDebug = $_[1]; }, + "v|verbose" => sub { $gDebug++; }, + "n|dryrun|dry-run!" => \$dryrun, + "queue=s" => \$queue_directory, + "sort=s" => \$sort_ascending, + "sort-ascending=s" => \$sort_ascending, + "sort-descending=s" => \$sort_descending, + "j|max-jobs-per-spool-file=i" => \$maxjobsperjobfile, + "J|max-bytes-per-spool-file=s" => \$maxbytesperjobfile, + "passive=s" => \$vars{"passive"}, + "delete" => sub { $vars{"delete"} = "1"; }, + "recursive=s" => \$vars{"recursive"}, # Don't use this option... + "lroot=s" => \$lroot, + "rroot=s" => \$rroot, + "o=s" => \$vars{"manual-override-features"}, + "manual-override-features=s" => \$vars{"manual-override-features"}, + "source-address=s" => \$vars{"source-address"}, + "pre-ftp-command=s" => \$vars{"pre-ftp-command"}, + "per-file-ftp-command=s" => \$vars{"per-file-ftp-command"}, + "post-ftp-command=s" => \$vars{"post-ftp-command"}, + "pre-shell-command=s" => \$vars{"pre-shell-command"}, + "post-shell-command=s" => \$vars{"post-shell-command"}, + "remote-rename=s" => \$vars{"remote-rename"}, + "local-rename=s" => \$vars{"local-rename"}, + "username=s" => \$vars{"ruser"}, + "password=s" => \$vars{"rpassword"}, + "hostname=s" => \$vars{"rhost"}, + "mbps-est=i" => \$Mbps_Est, + "login-config=s", => sub { + if (! ReadLoginConfigFile($_[1])) { die("Invalid login config file.\n"); } + }, + "f=s", => sub { + if (! ReadLoginConfigFile($_[1])) { die("Invalid login config file.\n"); } + }, + "at=s", => sub { + $job_scheduled_time = str2time($_[1]) or die ("Invalid time specified with --at\n"); + }, + "newer=s" => sub { + $newer_t = TimeFromStrOrFile($_[1]) or die ("Invalid time specified with --newer\n"); + }, + "older=s" => sub { + $older_t = TimeFromStrOrFile($_[1]) or die ("Invalid time specified with --older\n"); + }, + ); + + if ($minSize ne "") { + $gMinSize = (ByteUnits($minSize))[0]; + if (! defined($gMinSize)) { Usage(); } + if ($gMinSize eq "") { Usage(); } + if ($gMinSize < 0) { Usage(); } + } + + if ($maxSize ne "") { + $gMaxSize = (ByteUnits($maxSize))[0]; + if (! defined($gMaxSize)) { Usage(); } + if ($gMaxSize eq "") { Usage(); } + if ($gMaxSize < 0) { Usage(); } + } + + if (defined($maxbytesperjobfile)) { + $maxbytesperjobfile = (ByteUnits($maxbytesperjobfile))[0]; + if (! defined($maxbytesperjobfile)) { Usage(); } + if ($maxbytesperjobfile eq "") { Usage(); } + if ($maxbytesperjobfile < 0) { Usage(); } + } + + if ($gMayExcludeDirectories < 0) { + if ((scalar(@gIncludePatterns) == 0) && (scalar(@gExcludePatterns) == 0)) { + $gMayExcludeDirectories = 0; + } elsif ((scalar(@gIncludePatterns) > 0) && (scalar(@gExcludePatterns) == 0)) { + $gMayExcludeDirectories = 0; + } elsif ((scalar(@gIncludePatterns) == 0) && (scalar(@gExcludePatterns) > 0)) { + $gMayExcludeDirectories = 1; + } + } + $gProgress = 0 if ($gProgress < 0); + CreateQueueDirectoryOrDie(); + + if ((! exists($vars{"rhost"})) || ($vars{"rhost"} eq "")) { + print STDERR "You must specify a remote host.\n"; + Usage(); + } + + if ((! exists($vars{"ruser"})) || ($vars{"ruser"} eq "")) { + print STDERR "You must specify a remote username.\n"; + Usage(); + } + + if ($sort_descending ne "") { + $gSort = "$sort_descending DESC"; + } + if ($sort_ascending ne "") { + $gSort = "$sort_ascending ASC"; + } +} # ProcessCommandLineArguments + + + + +sub Main +{ + ProcessCommandLineArguments(); + + my ($itempath); + my ($rc); + my ($nitems) = 0; + my @items = @ARGV; + + for $itempath (@items) { + $itempath = abs_path($itempath); + if (-d $itempath) { + $rc = Ftw($itempath, $gMaxDepth, $gOneDev); + if ($rc != 0) { + print STDERR "*** Result for $itempath was ($rc).\n"; + } + $nitems++; + } elsif (-f $itempath) { + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = lstat($itempath); + FtwProcessItem ($itempath, "file", $dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks); + $nitems++; + } else { + print STDERR "$itempath is not a valid directory (or file).\n"; + } + } + + if ($nprocessed < 1) { + my ($line) = ""; + while (defined($line = )) { + $itempath = $line; + $itempath =~ s/[\r\n]+//; + next if ($itempath eq ""); + $itempath = abs_path($itempath); + if (-d $itempath) { + $rc = Ftw($itempath, $gMaxDepth, $gOneDev); + if ($rc != 0) { + print STDERR "*** Result for $itempath was ($rc).\n"; + } + $nitems++; + } elsif (-f $itempath) { + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = lstat($itempath); + FtwProcessItem ($itempath, "file", $dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks); + $nitems++; + } else { + print STDERR "$itempath is not a valid directory (or file).\n"; + } + } + } + + CloseJobFile(); + + my ($sec) = ($tbytesqueued / (1000000 * $Mbps_Est)) * 8; + my ($days) = $sec / 86400; + my ($hours) = $sec / 3600; + my ($minutes) = $sec / 60; + + my ($tTiB) = $tbytesqueued / (1024 * 1024 * 1024 * 1024); + my ($tGiB) = $tbytesqueued / (1024 * 1024 * 1024); + my ($tMiB) = $tbytesqueued / (1024 * 1024); + + my ($txiB) = $tMiB; + my ($txu) = "MiB"; + if ($tGiB > 0.7) { $txiB = $tGiB; $txu = "GiB"; } + if ($tTiB > 0.7) { $txiB = $tTiB; $txu = "TiB"; } + + my ($tss) = $sec; + my ($tsu) = "seconds"; + if ($minutes >= 1) { $tss = $minutes; $tsu = "minutes"; } + if ($hours >= 1) { $tss = $hours; $tsu = "hours"; } + if ($days > 1.5) { $tss = $days; $tsu = "days"; } + + printf("* %d job%s %squeued to %d spool file%s for a total of %.1f $txu; %.1f $tsu to upload at $Mbps_Est Mbps.\n", + $njobsqueued, + ($njobsqueued == 1) ? "" : "s", + ($dryrun ? "(pretended to be) " : ""), + $njobfiles, + ($njobfiles == 1) ? "" : "s", + $txiB, + $tss + ); + + if ($gProgress) { + ProgressMessage(sprintf("Done. Elapsed Time = %d second%s.", time() - $gStartTime, (time() - $gStartTime) == 1 ? "" : "s"), 1); + } + + Usage() if ($nitems == 0); + exit(0); +} # Main + +Main(); diff -Nru ncftp-3.2.5/sh/winsetver.pl ncftp-3.2.6/sh/winsetver.pl --- ncftp-3.2.5/sh/winsetver.pl 2002-03-27 12:44:07.000000000 +0000 +++ ncftp-3.2.6/sh/winsetver.pl 2016-10-23 23:21:57.000000000 +0000 @@ -140,6 +140,8 @@ SetVersionInSetupFile($f, $ver) or die "Could not change $f to version $ver: $!\n"; print "Changed: $f\n"; + + printf "\nNOTE: you need to change 'ncftp/win/setup/Windows Installer Wizard/NcFTP/NcFTP.vdproj' from within VS2008 if you still use the .msi installer.\n"; exit(0); } # Main diff -Nru ncftp-3.2.5/sh_util/gpshare.c ncftp-3.2.6/sh_util/gpshare.c --- ncftp-3.2.5/sh_util/gpshare.c 2010-04-05 22:41:07.000000000 +0000 +++ ncftp-3.2.6/sh_util/gpshare.c 2016-11-12 23:53:39.000000000 +0000 @@ -402,7 +402,7 @@ } else if (strncmp(line, "account", 7) == 0) { (void) STRNCPY(cip->acct, line + 8); } else if (strncmp(line, "port", 4) == 0) { - cip->port = atoi(line + 5); + cip->port = (unsigned int) atoi(line + 5); } } if ((fp != NULL) && (fp != stdin)) @@ -469,13 +469,13 @@ for (parse = buf; (tok = strtok(parse, ", \n\t\r")) != NULL; parse = NULL) { nt++; if (nt == 1) { - cip->xferTimeout = atoi(tok); - cip->connTimeout = atoi(tok); - cip->ctrlTimeout = atoi(tok); + cip->xferTimeout = (unsigned int) atoi(tok); + cip->connTimeout = (unsigned int) atoi(tok); + cip->ctrlTimeout = (unsigned int) atoi(tok); } else if (nt == 2) { - cip->connTimeout = atoi(tok); + cip->connTimeout = (unsigned int) atoi(tok); } else if (nt == 3) { - cip->ctrlTimeout = atoi(tok); + cip->ctrlTimeout = (unsigned int) atoi(tok); } } } /* SetTimeouts */ diff -Nru ncftp-3.2.5/sh_util/ncftpbatch.c ncftp-3.2.6/sh_util/ncftpbatch.c --- ncftp-3.2.5/sh_util/ncftpbatch.c 2008-10-05 20:59:06.000000000 +0000 +++ ncftp-3.2.6/sh_util/ncftpbatch.c 2016-11-16 00:29:43.000000000 +0000 @@ -31,26 +31,33 @@ #ifdef HAVE_LONG_FILE_NAMES +#define kNcFTPBatchDefaultUseSendfile 1 + #define kSpoolDir "spool" #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) # define kSpoolLog "log.txt" #else # define kSpoolLog "log" -# define kGlobalSpoolDir "/var/spool/ncftp" #endif + +#define kMinimumReconnectDelaySameHost 30 + #define NEW_SLEEP_VAL(s) ((unsigned int) (((0.1 * (rand() % 15)) + 1.2) * (s))) int gQuitRequested = 0; +int gNeedOpen = 0; int gGlobalSpooler = 0; -long gMaxLogSize = 200000L; +off_t gMaxLogSize = 10 * 1024 * 1024; unsigned int gDelayBetweenPasses = 0; int gGotSig = 0; FTPLibraryInfo gLib; FTPConnectionInfo gConn; int gIsTTY; int gSpooled = 0; -char gSpoolDir[256]; -char gLogFileName[256]; +char gSpoolDir[512]; +char gLogFileName[512]; +char gXferLogFileName[512]; +const char *gJobID = "?123"; struct dirent *gDirentBuf = NULL; size_t gDirentBufSize = 0; extern int gFirewallType; @@ -60,15 +67,20 @@ extern char gFirewallExceptionList[256]; extern unsigned int gFirewallPort; extern int gFwDataPortMode; +FILE *savefp; +int gCurSpoolFileLinesRead; int gItemInUse = 0; -char gItemPath[256]; +char gItemPath[1024]; char *gItemContents = NULL; size_t gItemContentsAllocSize = 0; size_t gItemContentsSize = 0; -char gMyItemPath[256]; +char gMyItemPath[1024]; int gOperation; char gOperationStr[16]; unsigned int gDelaySinceLastFailure; +time_t gTimeOfFirstAttempt; +time_t gTimeOfLastFailure; +time_t gTimeOfLastFailureAny; char gHost[64]; char gLastHost[64]; char gHostIP[32]; @@ -88,12 +100,24 @@ int gRecursive; int gDelete; int gPassive; -char gRDir[256]; -char gLDir[256]; +char gRDir[1024]; +char gRNewDir[1024]; +char gLDir[1024]; +char gLNewDir[1024]; char gRFile[256]; +char gRNewFile[256]; +double gRFileSize; +time_t gRFileMtime; char gLFile[256]; -char gRStartDir[256]; +char gLNewFile[256]; +double gLFileSize; +time_t gLFileMtime; +char gRStartDir[1024]; +char gRPrevDir[1024]; char gSourceAddrStr[128]; +char gLockFile[256]; +int gLockFd = -1; +int gBatchMiscBuf[4096]; /* Writes logging data to a ~/.ncftp/spool/log file. * This is nice for me when I need to diagnose problems. @@ -119,6 +143,7 @@ extern const char gOS[], gVersion[]; +time_t AtoTime_t(const char *const tok, time_t *t); extern struct dirent *Readdir(DIR *const dir, struct dirent *const dp, const size_t sz); static void ErrBox(const char *const fmt, ...) #if (defined(__GNUC__)) && (__GNUC__ >= 2) @@ -126,6 +151,27 @@ #endif ; +time_t +AtoTime_t(const char *const tok, time_t *t) +{ + /* This function may later be extended to handle non-timestamp formats like YYYY-mm-dd HH:MM:SS */ + time_t r = 0; + unsigned long ul; + + if (tok != NULL) { + ul = 0; + if (sscanf(tok, "%lu", &ul) == 1) { + r = (time_t) ul; + } + } + if (t != NULL) + *t = r; + return (r); +} /* AtoTime_t */ + + + + static void Log( #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) @@ -145,9 +191,9 @@ #endif ; -static void LogEndItemResult(int uiShow, const char *const fmt, ...) +static void LogEndItemResult(int uiShow, int errorOccurred, const char *const fmt, ...) #if (defined(__GNUC__)) && (__GNUC__ >= 2) -__attribute__ ((format (printf, 2, 3))) +__attribute__ ((format (printf, 3, 4))) #endif ; @@ -233,7 +279,7 @@ char tstr[128]; if (gLogFile != NULL) { - strftime(tstr, sizeof(tstr), "%Y-%m-%d %H:%M:%S %Z", Gmtime(time(&gLogTime), <)); + strftime(tstr, sizeof(tstr), "%Y-%m-%d %H:%M:%S %Z", Localtime(time(&gLogTime), <)); (void) fprintf(gLogFile, #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) "%s [$%08x] | ", @@ -283,7 +329,7 @@ oerrno = errno; if (gLogFile != NULL) { - strftime(tstr, sizeof(tstr), "%Y-%m-%d %H:%M:%S %Z", Gmtime(time(&gLogTime), <)); + strftime(tstr, sizeof(tstr), "%Y-%m-%d %H:%M:%S %Z", Localtime(time(&gLogTime), <)); (void) fprintf(gLogFile, #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) "%s [$%08x] | ", @@ -376,7 +422,7 @@ return (0); openMode = gLogOpenMode; - if ((Stat(gLogFileName, &st) == 0) && (st.st_size > gMaxLogSize)) { + if ((gMaxLogSize > 0) && (Stat(gLogFileName, &st) == 0) && ((longest_int) st.st_size > gMaxLogSize)) { /* Prevent the log file from growing forever. */ openMode = FOPEN_WRITE_TEXT; } @@ -403,12 +449,161 @@ +static int +DeleteFileWithRetries(const char *const pn, const int logIfNoEnt) +{ + /* Mostly for oddities under Windows/Cygwin */ + errno = 0; + if (unlink(pn) == 0) { return 0; } +#ifdef ENOENT + if (errno == ENOENT) { + if (logIfNoEnt) + Log(0, "Hmmm, could not delete %s, because it already does not exist? (%s)\n", pn, strerror(errno)); + return 0; + } +#endif + Log(0, "Hmmm, could not delete %s, will try again: %s\n", pn, strerror(errno)); + sleep((rand() % 3) + 1); + if (unlink(pn) == 0) { return 0; } + Log(0, "Hmmm, still could not delete %s, will one more time: %s\n", pn, strerror(errno)); + sleep((rand() % 11) + 4); + if (unlink(pn) == 0) { return 0; } + return (-1); +} /* DeleteFileWithRetries */ + + + + +static void +Respool(const int logIfNoEnt) +{ + char tstr[64]; + time_t tnext; + struct tm tnext_tm; + char sname[64]; + char initialpath[256]; + char finalpath[256]; + FILE *fp = NULL; + size_t nread, nwrote; + + initialpath[0] = '\0'; + finalpath[0] = '\0'; + + if (gDelaySinceLastFailure == 0) + gDelaySinceLastFailure = 5; + else { + gDelaySinceLastFailure = NEW_SLEEP_VAL(gDelaySinceLastFailure); + if (gDelaySinceLastFailure > 900) { + /* If sleep duration got so large it got past 15 minutes, + * start over again. + */ + gDelaySinceLastFailure = 60; + } + } + tnext = time(NULL) + (time_t) gDelaySinceLastFailure; + strftime(tstr, sizeof(tstr), "%Y-%m-%d %H:%M:%S %Z", Localtime(tnext, &tnext_tm)); + + gMaySigExit = 0; + + fp = OpenSpoolFile(NULL, initialpath, sizeof(initialpath), finalpath, sizeof(finalpath), sname, sizeof(sname), gSpoolDir, gOperationStr, tnext); + if (fp == NULL) { + Log(0, "Could not open spool file for writing: %s\n", strerror(errno)); + return; + } + + if (WriteSpoolEntry( + fp, + gOperationStr, + sname, + gRFile, + gRDir, + gRFileSize, + gRFileMtime, + gLFile, + gLDir, + gLFileSize, + gLFileMtime, + gRNewFile, + gRNewDir, + gLNewFile, + gLNewDir, + gHost, + gHostIP, + gPort, + gRUser, + gRPass, + gRAcct, + gXtype, + gRecursive, + gDelete, + gPassive, + gPreFTPCommand, + gPerFileFTPCommand, + gPostFTPCommand, + gPreShellCommand, + gPostShellCommand, + gDelaySinceLastFailure, + gManualOverrideFeatures, + gSourceAddrStr, + gTimeOfFirstAttempt, + gTimeOfLastFailure + ) < 0) { + Log(0, "write to spoolfile (%s) failed: %s\n", initialpath, strerror(errno)); + goto err; + } + + if (savefp != NULL) { + /* If we hadn't finished reading all of the entries from the + * transaction file, then append the remaining entries to the + * newly created transaction file we just made. + */ + if (fprintf(fp, "\n\n\n%s\n", kSpoolEntryBeginLine) < 0) + goto err; + while ((nread = fread(gBatchMiscBuf, sizeof(char), sizeof(gBatchMiscBuf), savefp)) > 0) { + if ((nwrote = fwrite(gBatchMiscBuf, sizeof(char), nread, fp)) != nread) { + Log(0, "write to spoolfile (%s) failed: %s\n", initialpath, strerror(errno)); + goto err; + } + } + (void) fclose(savefp); + savefp = NULL; + } + + if (CloseSpoolFileAndRename(fp, (gLogFile != NULL) ? gLogFile : stderr, initialpath, finalpath) < 0) { + Log(0, "close/rename to spoolfile (%s) failed: %s\n", initialpath, strerror(errno)); + goto err; + } + + if (DeleteFileWithRetries(gMyItemPath, logIfNoEnt) != 0) { + /* quit now */ + Log(0, "Could not delete old copy of job %s!\n", gMyItemPath); + return; + } + Log(0, "Rescheduled %s for %s as %s.\n", gItemPath, tstr, finalpath); + + gMaySigExit = 1; + return; + +err: + if (savefp != NULL) + (void) fclose(savefp); + savefp = NULL; + if (fp != NULL) { + (void) fclose(fp); + } + if (finalpath[0] != '\0') + (void) unlink(finalpath); +} /* Respool */ + + + + static void ExitStuff(void) { if (gItemInUse > 0) { - gItemInUse = 0; (void) rename(gMyItemPath, gItemPath); + gItemInUse = 0; } } /* ExitStuff */ @@ -422,8 +617,8 @@ if (gMayCancelJmp != 0) { gUnused = sigNum; if (gItemInUse > 0) { - gItemInUse = 0; (void) rename(gMyItemPath, gItemPath); + gItemInUse = 0; } #ifdef HAVE_SIGSETJMP siglongjmp(gCancelJmp, 1); @@ -440,8 +635,25 @@ static void SigExit(int sigNum) { +#ifdef SIGUSR2 + if (sigNum == SIGUSR2) { + /* Only used to break out of sleep() */ + Log(0, "-----caught signal %d, continuing-----\n", sigNum); + return; + } +#endif gQuitRequested = sigNum; - if (gMaySigExit != 0) { + + /* If it was SIGUSR1, we will exit when it is convenient for us, + * otherwise for any other signal we will exit if we may. + */ + if ((sigNum != +#ifdef SIGUSR1 + SIGUSR1 +#else + -1 +#endif + ) && (gMaySigExit != 0)) { #ifdef SIGBUS if ((sigNum == SIGSEGV) || (sigNum == SIGBUS) || (sigNum == SIGILL)) { #else @@ -455,12 +667,15 @@ * in the root directory which we probably * can't write the core file to. */ - (void) chdir("/tmp"); - abort(); + if ((chdir("/tmp") == 0) || (chdir("/") == 0)) + abort(); } else { - - ExitStuff(); Log(0, "-----caught signal %d, exiting-----\n", sigNum); + if (gItemInUse) { + /* Regenerate an updated file rather than renaming the old one. */ + Respool(1); + gItemInUse = 0; + } DisposeWinsock(); exit(0); } @@ -470,7 +685,6 @@ - static void FTPInit(void) { @@ -495,6 +709,16 @@ +static void +InitHostVariables(void) +{ + memset(gRStartDir, 0, sizeof(gRStartDir)); + memset(gRPrevDir, 0, sizeof(gRPrevDir)); +} /* InitHostVariables(void) */ + + + + /* These things are done first, before we even parse the command-line * options. */ @@ -516,9 +740,33 @@ InitUserInfo(); FTPInit(); - LoadFirewallPrefs(0); srand((unsigned int) getpid()); - gLogFileName[0] = '\0'; + + memset(gItemPath, 0, sizeof(gItemPath)); + memset(gMyItemPath, 0, sizeof(gMyItemPath)); + memset(gSpoolDir, 0, sizeof(gSpoolDir)); + memset(gLogFileName, 0, sizeof(gLogFileName)); + memset(gXferLogFileName, 0, sizeof(gXferLogFileName)); + memset(gProgressLog, 0, sizeof(gProgressLog)); + memset(gRDir, 0, sizeof(gRDir)); + memset(gLDir, 0, sizeof(gLDir)); + memset(gLNewDir, 0, sizeof(gLNewDir)); + memset(gRNewDir, 0, sizeof(gRNewDir)); + memset(gRFile, 0, sizeof(gRFile)); + memset(gLFile, 0, sizeof(gLFile)); + memset(gLNewFile, 0, sizeof(gLNewFile)); + memset(gRNewFile, 0, sizeof(gRNewFile)); + memset(gManualOverrideFeatures, 0, sizeof(gManualOverrideFeatures)); + memset(gLockFile, 0, sizeof(gLockFile)); + memset(gBatchMiscBuf, 0, sizeof(gBatchMiscBuf)); + gTimeOfFirstAttempt = 0; + gTimeOfLastFailure = 0; + gTimeOfLastFailureAny = 0; + savefp = NULL; + gCurSpoolFileLinesRead = 0; + InitHostVariables(); + + LoadFirewallPrefs(0); cp = strrchr(prog, '/'); if (cp == NULL) @@ -536,6 +784,12 @@ (void) signal(SIGINT, SigExit); (void) signal(SIGTERM, SigExit); +#ifdef SIGUSR1 + (void) signal(SIGUSR1, SigExit); +#endif +#ifdef SIGUSR2 + (void) signal(SIGUSR2, SigExit); +#endif #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #else (void) signal(SIGSEGV, SigExit); @@ -570,15 +824,24 @@ /* These things are done after parsing the command-line options. */ if (gGlobalSpooler != 0) { +#if defined(__CYGWIN__) + if (gLockFile[0] == '\0') + STRNCPY(gLockFile, "/var/lock/ncftpspooler.lck"); +#endif #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #else if (gSpoolDir[0] == '\0') STRNCPY(gSpoolDir, "/var/spool/ncftp"); - if ((chdir(gSpoolDir) < 0) && (mkdir(gSpoolDir, 00775) < 0)) { + if (chdir(gSpoolDir) < 0) { + /* Print a warning if we can't access it yet, + * but allow for it to be created later by + * an external process. + */ perror(gSpoolDir); - exit(1); + /* continue */ } - (void) chdir("/"); + if (chdir("/") < 0) + exit(1); #endif if (gDelayBetweenPasses == 0) gDelayBetweenPasses = 120; @@ -587,13 +850,32 @@ (void) OurDirectoryPath(gSpoolDir, sizeof(gSpoolDir), kSpoolDir); } +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) +#else + if (gLockFile[0] != '\0') { + char pidbuf[32]; + + gLockFd = open(gLockFile, O_RDWR|O_CREAT|O_TRUNC, 00666); + if (gLockFd < 0) { + perror(gLockFile); + exit(1); + } + /* FYI only, not important, but write the most recent process' PID to the file. */ + sprintf(pidbuf, "%u\n", (unsigned int) getpid()); + if (write(gLockFd, pidbuf, strlen(pidbuf)) < 0) { + perror(gLockFile); + exit(1); + } + } +#endif + if (gLogFileName[0] == '\0') (void) Path(gLogFileName, sizeof(gLogFileName), gSpoolDir, kSpoolLog); debufsize = 512; #ifdef HAVE_PATHCONF nmx = pathconf(gLogFileName, _PC_NAME_MAX); if (nmx >= 512) - debufsize = nmx; + debufsize = (size_t) nmx; #endif debufsize += sizeof(struct dirent) + 8; direntbuf = (struct dirent *) calloc(debufsize, (size_t) 1); @@ -623,6 +905,7 @@ { FILE *fp; char line[256]; + size_t hlen; char *tok1, *tok2; char *cp, *lim; #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) @@ -630,22 +913,29 @@ struct stat st; #endif + fp = savefp; /* will be NULL if this is first entry. */ + if (fp == NULL) { #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) /* gItemContents is not used on Win32 */ - if ((fp = _fsopen(gMyItemPath, FOPEN_READ_BINARY, _SH_DENYNO)) == NULL) { + if ((fp = _fsopen(gMyItemPath, FOPEN_READ_TEXT, _SH_DENYNO)) == NULL) { /* Could have been renamed already. */ if (logErrors != 0) LogPerror("%s", gMyItemPath); return (-1); } #else - if ((stat(gMyItemPath, &st) < 0) || ((fp = fopen(gMyItemPath, FOPEN_READ_BINARY)) == NULL)) { + if ((stat(gMyItemPath, &st) < 0) || ((fp = fopen(gMyItemPath, FOPEN_READ_TEXT)) == NULL)) { /* Could have been renamed already. */ if (logErrors != 0) LogPerror("%s", gMyItemPath); return (-1); } +#endif + } +#if 0 +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) +#else /* Make sure our global buffer to contain the contents of * the current spool file is ready to use. */ @@ -684,6 +974,8 @@ } #endif /* UNIX */ +#endif + gOperation = '?'; STRNCPY(gOperationStr, "?"); gHost[0] = '\0'; @@ -700,8 +992,16 @@ gPassive = gFwDataPortMode; gRDir[0] = '\0'; gLDir[0] = '\0'; + gLNewDir[0] = '\0'; + gRNewDir[0] = '\0'; gRFile[0] = '\0'; gLFile[0] = '\0'; + gLFileSize = -1; + gRFileSize = -1; + gRFileMtime = 0; + gLFileMtime = 0; + gLNewFile[0] = '\0'; + gRNewFile[0] = '\0'; gManualOverrideFeatures[0] = '\0'; gSourceAddrStr[0] = '\0'; gPreFTPCommand[0] = '\0'; @@ -710,11 +1010,37 @@ gPreShellCommand[0] = '\0'; gPostShellCommand[0] = '\0'; gDelaySinceLastFailure = 0; + gTimeOfFirstAttempt = 0; + gTimeOfLastFailure = 0; + if (savefp == NULL) + gCurSpoolFileLinesRead = 0; line[sizeof(line) - 1] = '\0'; - while (fgets(line, sizeof(line) - 1, fp) != NULL) { - tok1 = strtok(line, " =\t\r\n"); - if ((tok1 == NULL) || (tok1[0] == '#')) + hlen = strlen(kSpoolEntryBegin); + for (;;) { + if (fgets(line, sizeof(line) - 1, fp) == NULL) { + /* Reached end of the transaction file. */ + savefp = NULL; + break; + } + gCurSpoolFileLinesRead++; + if (strncmp(line, kSpoolEntryBegin, hlen) == 0) { + if (gCurSpoolFileLinesRead <= 1) + continue; + /* Found start of the next entry. + * This is a multiple-entry transaction file. + */ + savefp = fp; + break; + } + if (strncmp(line, "# local-", 8) == 0) { /* Temporary hack, can be removed */ + tok1 = strtok(line + 2, " =\t\r\n"); + } else { + tok1 = strtok(line, " =\t\r\n"); + } + if (tok1 == NULL) + continue; + if (tok1[0] == '#') continue; tok2 = strtok(NULL, "\r\n"); if (tok2 == NULL) @@ -724,6 +1050,10 @@ STRNCPY(gOperationStr, tok2); } else if (strcmp(tok1, "delay-since-last-failure") == 0) { gDelaySinceLastFailure = (unsigned int) atoi(tok2); + } else if (strcmp(tok1, "time-of-first-attempt") == 0) { + AtoTime_t(tok2, &gTimeOfFirstAttempt); + } else if (strcmp(tok1, "time-of-last-failure") == 0) { + AtoTime_t(tok2, &gTimeOfLastFailure); } else if (strcmp(tok1, "hostname") == 0) { (void) STRNCPY(gHost, tok2); } else if (strcmp(tok1, "host-ip") == 0) { @@ -732,7 +1062,7 @@ */ (void) STRNCPY(gHostIP, tok2); } else if (strcmp(tok1, "port") == 0) { - gPort = atoi(tok2); + gPort = (unsigned int) atoi(tok2); } else if (strcmp(tok1, "passive") == 0) { if (isdigit((int) tok2[0])) gPassive = atoi(tok2); @@ -760,6 +1090,22 @@ (void) STRNCPY(gRFile, tok2); } else if (strcmp(tok1, "local-file") == 0) { (void) STRNCPY(gLFile, tok2); + } else if (strcmp(tok1, "local-rename-dir") == 0) { + (void) STRNCPY(gLNewDir, tok2); + } else if (strcmp(tok1, "local-rename-file") == 0) { + (void) STRNCPY(gLNewFile, tok2); + } else if (strcmp(tok1, "remote-rename-dir") == 0) { + (void) STRNCPY(gRNewDir, tok2); + } else if (strcmp(tok1, "remote-rename-file") == 0) { + (void) STRNCPY(gRNewFile, tok2); + } else if ((strcmp(tok1, "local-file-size") == 0) || (strcmp(tok1, "local-size") == 0)) { + gLFileSize = atof(tok2); + } else if ((strcmp(tok1, "local-file-mtime") == 0) || (strcmp(tok1, "local-mtime") == 0)) { + AtoTime_t(tok2, &gLFileMtime); + } else if (strcmp(tok1, "remote-file-size") == 0) { + gRFileSize = atof(tok2); + } else if (strcmp(tok1, "remote-file-mtime") == 0) { + AtoTime_t(tok2, &gRFileMtime); } else if (strcmp(tok1, "source-address") == 0) { (void) STRNCPY(gSourceAddrStr, tok2); } else if (strcmp(tok1, "manual-override-features") == 0) { @@ -792,10 +1138,15 @@ cp += strlen(cp) - 1; while ((*cp == '\\') && (cp < lim)) { *cp++ = '\n'; - (void) fgets(cp, (int) (lim - cp), fp); + if (fgets(cp, (int) (lim - cp), fp) == NULL) { + *cp = '\0'; + break; + } cp += strlen(cp) - 1; if (*cp == '\n') *cp-- = '\0'; + if (*cp == '\r') + *cp-- = '\0'; } } else if (strcmp(tok1, "job-name") == 0) { /* ignore */ @@ -806,7 +1157,10 @@ } } } - (void) fclose(fp); + if (savefp == NULL) { + (void) fclose(fp); + fp = NULL; + } if (islower(gOperation)) gOperation = toupper(gOperation); @@ -927,7 +1281,7 @@ * command, such as our FTP session descriptors. */ FTPCloseControlConnection(&gConn); - gMyPID = getpid(); + gMyPID = (unsigned int) getpid(); CloseLog(); (void) execv(cmd, argv); @@ -938,7 +1292,8 @@ exit(1); } (void) close(pfd[0]); /* Parent closes read end. */ - (void) PWrite(pfd[1], (const char *) gItemContents, gItemContentsSize); + if ((gItemContents != NULL) && (gItemContents[0] != '\0') && (gItemContentsSize > 0)) + (void) PWrite(pfd[1], (const char *) gItemContents, gItemContentsSize); if ((addstr != NULL) && (addstr[0] != '\0')) (void) PWrite(pfd[1], (const char *) addstr, strlen(addstr)); (void) close(pfd[1]); /* Parent closes write end. */ @@ -959,11 +1314,17 @@ /*VARARGS*/ static void -LogEndItemResult(int uiShow, const char *const fmt, ...) +LogEndItemResult(int uiShow, int errorOccurred, const char *const fmt, ...) { va_list ap; - char buf[512]; - + struct tm lt; + FILE *xferLogFp; + char *jobName, *cp; + char buf[2048-128], tstr[128]; + + time(&gLogTime); + memset(tstr, 0, sizeof(tstr)); + memset(buf, 0, sizeof(buf)); (void) strcpy(buf, "\nresult="); va_start(ap, fmt); @@ -976,6 +1337,47 @@ Log(uiShow, "%s", buf + 8); (void) RunShellCommandWithSpoolItemData(gPostShellCommand, buf); + + if (gXferLogFileName[0] != '\0') { + xferLogFp = fopen(gXferLogFileName, FOPEN_APPEND_TEXT); + if (xferLogFp != NULL) { + (void) strftime(tstr, sizeof(tstr) - 1, "%Y-%m-%d %H:%M:%S %Z", Localtime(gLogTime, <)); + jobName = StrRFindLocalPathDelim(gItemPath); + if (jobName == NULL) { + jobName = gItemPath; + } else { + jobName++; + } + cp = strrchr(jobName, '.'); + if (cp != NULL) { + /* Don't need .txt extension */ + *cp = '\0'; + } + fprintf(xferLogFp, "%s|%c|%s|%s|%s|%s|" PRINTF_LONG_LONG "|%.2f|%.3f|%s|%s|%s|%s|%c|%s|" PRINTF_LONG_LONG "|" PRINTF_LONG_LONG "|" PRINTF_LONG_LONG "|%s|%d|%d|%s", + tstr, + gOperation, + gLDir, gLFile, + gRDir, gRFile, + gConn.bytesTransferred, + gConn.sec, + (gConn.kBytesPerSec >= 0) ? (gConn.kBytesPerSec * 1024.0 * 8.0 / 1000000.0) /* Mbps */ : -1.0, + gConn.user, + "", /* Reserved for email or password */ + gConn.host, + "", /* Reserved for filter type */ + gConn.curTransferType, + (gConn.dataPortMode == kSendPortMode ? "Po" : "Ps"), + (longest_int) gConn.t0.tv_sec, + gConn.expectedSize, + gConn.startPoint, + jobName, + (errorOccurred) ? gConn.errNo : 0, + (errorOccurred) ? errno : 0, + (errorOccurred) ? buf + 8 /* includes \n */ : "OK\n" + ); + fclose(xferLogFp); + } + } } /* LogEndItemResult */ @@ -1084,9 +1486,87 @@ static int +RRename(void) +{ + char newPath[1024]; + int result; + + if ((gRNewDir[0] == '\0') && (gRNewFile[0] == '\0')) + return (kNoErr); /* Nothing to do. */ + + if (TVFSPathBuild(newPath, sizeof(newPath), NULL, gRNewDir, gRNewFile) < 0) + return (-1); + if (FTPRename(&gConn, gRFile, newPath) == kNoErr) { + Log(0, "Renamed remote file to %s.\n", newPath); + return (kNoErr); + } + + /* Rename failed, but we'll try to create the directory and try again. */ + if (gRNewDir[0] != '\0') { + if (strcmp(gRNewDir, gRDir) != 0) { + /* Specified a different directory. + * Make sure it exists. + * A relative path may be present. + */ + if (FTPMkdir2(&gConn, gRNewDir, kRecursiveYes, NULL) < 0) { + if (gConn.errNo == kErrCannotGoToPrevDir) + gNeedOpen = 1; + Log(0, "Could not rename remote file because its directory %s could not be created.\n", gRNewDir); + return (-1); + } + } + } + + if ((result = FTPRename(&gConn, gRFile, newPath)) == kNoErr) { + Log(0, "Renamed remote file to %s.\n", newPath); + return (kNoErr); + } + Log(0, "Could not rename remote file to %s: %s.\n", newPath, FTPStrError(result)); + return (-1); +} /* RRename */ + + + + +static int +LRename(void) +{ + char newPath[1024]; + + if ((gLNewDir[0] == '\0') && (gLNewFile[0] == '\0')) + return (kNoErr); /* Nothing to do. */ + + if (gLNewDir[0] != '\0') { + if (strcmp(gLNewDir, gLDir) != 0) { + /* Specified a different directory. + * Make sure it exists. + * A relative path may be present. + */ + if (MkDirs(gLNewDir, 00777) < 0) { + Log(0, "Could not rename local file because its directory %s could not be created: %s.\n", gLNewDir, strerror(errno)); + return (-1); + } + } + } + + if (LocalPathBuild(newPath, sizeof(newPath), NULL, gLNewDir, gLNewFile) < 0) + return (-1); + if (rename(gLFile, newPath) != 0) { + Log(0, "Could not rename local file to %s: %s.\n", newPath, strerror(errno)); + return (-1); + } + + Log(0, "Renamed local file to %s.\n", newPath); + return (kNoErr); +} /* LRename */ + + + + +static int DoItem(void) { - char line[256]; + char pwdec[256]; char resolvedIPstr[64]; int needOpen; int result; @@ -1108,27 +1588,27 @@ cdflags = kChdirFullPath|kChdirOneSubdirAtATime|kChdirAndMkdir; if (gLDir[0] != '\0') { - if (MkDirs(gLDir, 00755) < 0) { + if (MkDirs(gLDir, 00777) < 0) { #ifdef HAVE_STRERROR - LogEndItemResult(1, "Could not mkdir local-dir=%s: %s\n", gLDir, strerror(errno)); + LogEndItemResult(1, 1, "Could not mkdir local-dir=%s: %s\n", gLDir, strerror(errno)); #else - LogEndItemResult(1, "Could not mkdir local-dir=%s: errno %d\n", gLDir, (errno)); + LogEndItemResult(1, 1, "Could not mkdir local-dir=%s: errno %d\n", gLDir, (errno)); #endif return (0); /* remove spool file */ } else if (chdir(gLDir) < 0) { #ifdef HAVE_STRERROR - LogEndItemResult(1, "Could not cd to local-dir=%s: %s\n", gLDir, strerror(errno)); + LogEndItemResult(1, 1, "Could not cd to local-dir=%s: %s\n", gLDir, strerror(errno)); #else - LogEndItemResult(1, "Could not cd to local-dir=%s: errno %d\n", gLDir, (errno)); + LogEndItemResult(1, 1, "Could not cd to local-dir=%s: errno %d\n", gLDir, (errno)); #endif return (0); /* remove spool file */ #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #else } else if ((gOperation == 'G') && (access(gLDir, W_OK) < 0)) { #ifdef HAVE_STRERROR - LogEndItemResult(1, "Could not write to local-dir=%s: %s\n", gLDir, strerror(errno)); + LogEndItemResult(1, 1, "Could not write to local-dir=%s: %s\n", gLDir, strerror(errno)); #else - LogEndItemResult(1, "Could not write to local-dir=%s: errno %d\n", gLDir, (errno)); + LogEndItemResult(1, 1, "Could not write to local-dir=%s: errno %d\n", gLDir, (errno)); #endif return (0); /* remove spool file */ #endif @@ -1140,8 +1620,8 @@ /* Decode password, if it was base-64 encoded. */ if (strncmp(gRPass, kPasswordMagic, kPasswordMagicLen) == 0) { - FromBase64(line, gRPass + kPasswordMagicLen, strlen(gRPass + kPasswordMagicLen), 1); - (void) STRNCPY(gRPass, line); + FromBase64(pwdec, gRPass + kPasswordMagicLen, strlen(gRPass + kPasswordMagicLen), 1); + (void) STRNCPY(gRPass, pwdec); } /* Now see if we need to open a new host. We try to leave the @@ -1161,14 +1641,26 @@ /* Same host, but new user. */ needOpen = 1; Log(0, "New user (%s), old user was (%s).\n", gRUser, gConn.user); + } else if (gNeedOpen != 0) { + needOpen = gNeedOpen; + gNeedOpen = 0; + if ((gConn.startingWorkingDirectory == NULL) || (gConn.startingWorkingDirectory[0] == '\0')) { + if (FTPGetCWD(&gConn, gRStartDir, sizeof(gRStartDir)) < 0) { + (void) FTPCloseHost(&gConn); + needOpen = 1; + } + } else { + (void) STRNCPY(gRStartDir, gConn.startingWorkingDirectory); + } } if (needOpen != 0) { (void) AdditionalCmd(&gConn, gPostFTPCommand, NULL); (void) FTPCloseHost(&gConn); + InitHostVariables(); if (FTPInitConnectionInfo(&gLib, &gConn, kDefaultFTPBufSize) < 0) { /* Highly unlikely... */ - LogEndItemResult(1, "init connection info failed!\n"); + LogEndItemResult(1, 1, "init connection info failed!\n"); ExitStuff(); DisposeWinsock(); exit(1); @@ -1187,6 +1679,7 @@ (void) STRNCPY(gConn.acct, gRAcct); gConn.maxDials = 1; gConn.dataPortMode = gPassive; + gConn.useSendfile = kNcFTPBatchDefaultUseSendfile; gConn.manualOverrideFeatures = gManualOverrideFeatures; #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) gConn.progress = PrWinStatBar; @@ -1209,29 +1702,34 @@ gConn.ctrlTimeout = 135; gConn.xferTimeout = 300; if (ISTRCMP(gHost, gLastHost) == 0) { - /* Same host, but last "recent" attempt to connect failed. */ - Log(1, "Skipping same failed host as recent attempt (%s).\n", gLastHost); - return (-1); /* Try again next time. */ + if ((time(NULL) - gTimeOfLastFailureAny) < kMinimumReconnectDelaySameHost) { + /* Same host, but last "recent" attempt to connect failed. */ + Log(1, "Skipping same failed host as recent attempt (%s).\n", gLastHost); + return (-1); /* Try again next time. */ + } } if (AddrStrToIPStr(resolvedIPstr, sizeof(resolvedIPstr), gHost, (int) gPort) == NULL) { - LogEndItemResult(1, "Couldn't resolve IP for %s, will try again next time.\n", gHost); + LogEndItemResult(1, 1, "Couldn't resolve IP for %s, will try again next time.\n", gHost); (void) FTPCloseHost(&gConn); (void) STRNCPY(gLastHost, gHost); /* save failed connection to gHost. */ + InitHostVariables(); return (-1); /* Try again next time. */ } Log(1, "Opening %s:%u (%s) as user %s...\n", gHost, gPort, resolvedIPstr, gRUser); result = FTPOpenHost(&gConn); if (result < 0) { - LogEndItemResult(1, "Couldn't open %s, will try again next time.\n", gHost); + LogEndItemResult(1, 1, "Couldn't open %s, will try again next time.\n", gHost); (void) FTPCloseHost(&gConn); (void) STRNCPY(gLastHost, gHost); /* save failed connection to gHost. */ + InitHostVariables(); return (-1); /* Try again next time. */ } gLastHost[0] = '\0'; /* have connected - "clear" gLastHost. */ if (FTPGetCWD(&gConn, gRStartDir, sizeof(gRStartDir)) < 0) { - LogEndItemResult(1, "Couldn't get start directory on %s, will try again next time.\n", gHost); + LogEndItemResult(1, 1, "Couldn't get start directory on %s, will try again next time.\n", gHost); (void) AdditionalCmd(&gConn, gPostFTPCommand, NULL); (void) FTPCloseHost(&gConn); + InitHostVariables(); return (-1); /* Try again next time. */ } if (gConn.hasCLNT != kCommandNotAvailable) { @@ -1244,7 +1742,7 @@ (void) AdditionalCmd(&gConn, gPreFTPCommand, NULL); if (FTPChdir3(&gConn, gRDir, NULL, 0, cdflags) < 0) { - LogEndItemResult(1, "Could not remote cd to %s.\n", gRDir); + LogEndItemResult(1, 1, "Could not remote cd to %s.\n", gRDir); /* Leave open, but unspool. * @@ -1258,17 +1756,36 @@ * The remote directory path is relative * to root, so go back to it. */ - if (FTPChdir(&gConn, gRStartDir) < 0) { - LogEndItemResult(1, "Could not remote cd back to %s.\n", gRStartDir); - return (-1); /* Try again next time, in case conn dropped. */ - } + if ((gRDir[0] == '\0') || (gRPrevDir[0] == '\0') || (strcmp(gRPrevDir, gRDir) != 0)) { + /* This item's remote directory was different from the previous one. */ - if (FTPChdir3(&gConn, gRDir, NULL, 0, cdflags) < 0) { - LogEndItemResult(1, "Could not remote cd to %s.\n", gRDir); - return (-1); /* Try again next time, in case conn dropped. */ + if ((gRDir[0] == '\0') && (gRStartDir[0] != '\0')) { + (void) STRNCPY(gRDir, gRStartDir); + } + + if (gRDir[0] != '/') { + if (gRStartDir[0] == '\0') { + Log(1, "Hmmm, I forgot the original starting directory...\n"); + return (-1); /* Try again next time, in case conn dropped. */ + } else if (FTPChdir(&gConn, gRStartDir) < 0) { + LogEndItemResult(1, 1, "Could not remote cd back to %s.\n", gRStartDir); + return (-1); /* Try again next time, in case conn dropped. */ + } + } + + if (FTPChdir3(&gConn, gRDir, NULL, 0, cdflags) < 0) { + LogEndItemResult(1, 1, "Could not remote cd to %s.\n", gRDir); + return (-1); /* Try again next time, in case conn dropped. */ + } } } + /* We have now changed to the directory. Save this value to be checked by the next item. */ + STRNCPY(gRPrevDir, gRDir); + + if (gTimeOfFirstAttempt == 0) + (void) time(&gTimeOfFirstAttempt); + if (gOperation == 'G') { if (gRecursive != 0) { #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) @@ -1282,19 +1799,31 @@ result = FTPGetOneFile3(&gConn, gRFile, gLFile, gXtype, (-1), kResumeYes, kAppendNo, gDelete, kNoFTPConfirmResumeDownloadProc, 0); } if (result == kErrCouldNotStartDataTransfer) { - LogEndItemResult(1, "Remote item %s is no longer retrievable.\n", gRFile); + LogEndItemResult(1, 1, "Remote item %s is no longer retrievable.\n", gRFile); result = 0; /* file no longer on host */ } else if ((result == kErrRemoteSameAsLocal) || (result == kErrLocalSameAsRemote)) { - LogEndItemResult(1, "Remote item %s is already present locally.\n", gRFile); + LogEndItemResult(1, 1, "Remote item %s is already present locally.\n", gRFile); result = 0; } else if (result == kErrLocalFileNewer) { - LogEndItemResult(1, "Remote item %s is already present on remote host and is newer.\n", gRFile); + LogEndItemResult(1, 1, "Remote item %s is already present on remote host and is newer.\n", gRFile); result = 0; } else if (result == kNoErr) { - (void) AdditionalCmd(&gConn, gPerFileFTPCommand, gRFile); - LogEndItemResult(1, "Succeeded downloading %s.\n", gRFile); + if (LRename() < 0) { + LogEndItemResult(1, 1, "Succeeded downloading to %s, but a post-processing error occurred: %s\n", gLFile, strerror(errno)); + } else if (RRename() < 0) { + LogEndItemResult(1, 1, "Succeeded downloading %s, but a post-processing error occurred: %s\n", gRFile, strerror(errno)); + } else { + (void) AdditionalCmd(&gConn, gPerFileFTPCommand, gRFile); + if (gConn.kBytesPerSec >= 0) { + LogEndItemResult(1, 0, "Succeeded downloading %s (%.0f bytes, %.1f sec, %.2f Mbps).\n", gRFile, (double) gConn.bytesTransferred, gConn.sec, gConn.kBytesPerSec * 1024.0 * 8.0 / 1000000.0); + } else { + LogEndItemResult(1, 0, "Succeeded downloading %s.\n", gRFile); + } + } + } else if (gConn.bytesTransferred >= 1) { + LogEndItemResult(1, 1, "Error (%d) occurred on %s after %.0f bytes transferred: %s\n", result, gRFile, (double) gConn.bytesTransferred, FTPStrError(result)); } else { - LogEndItemResult(1, "Error (%d) occurred on %s: %s\n", result, gRFile, FTPStrError(result)); + LogEndItemResult(1, 1, "Error (%d) occurred on %s: %s\n", result, gRFile, FTPStrError(result)); } } else /* if (gOperation == 'P') */ { if (gRecursive != 0) { @@ -1306,25 +1835,41 @@ #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) sprintf(gStatusText, "[0%%] - Uploading %.200s", gLFile); #endif - result = FTPPutOneFile3(&gConn, gLFile, gRFile, gXtype, (-1), kAppendNo, NULL, NULL, kResumeYes, gDelete, kNoFTPConfirmResumeUploadProc, 0); + result = FTPPutOneFile4(&gConn, gLFile, gRFile, gXtype, (-1), kAppendNo, NULL, NULL, kResumeYes, gDelete, kNoFTPConfirmResumeUploadProc, gTimeOfFirstAttempt, gLFileMtime); } if (result == kErrCouldNotStartDataTransfer) { - LogEndItemResult(1, "Remote item %s is no longer sendable. Perhaps permission denied on destination?\n", gRFile); + LogEndItemResult(1, 1, "Remote item %s is no longer sendable. Perhaps permission denied on destination?\n", gRFile); result = 0; /* file no longer on host */ } else if ((result == kErrRemoteSameAsLocal) || (result == kErrLocalSameAsRemote)) { - LogEndItemResult(1, "Local item %s is already present on remote host.\n", gLFile); + LogEndItemResult(1, 1, "Local item %s is already present on remote host.\n", gLFile); result = 0; } else if (result == kErrRemoteFileNewer) { - LogEndItemResult(1, "Local item %s is already present on remote host and is newer.\n", gLFile); + LogEndItemResult(1, 1, "Local item %s is already present on remote host and is newer.\n", gLFile); result = 0; } else if (result == kNoErr) { - (void) AdditionalCmd(&gConn, gPerFileFTPCommand, gLFile); - LogEndItemResult(1, "Succeeded uploading %s.\n", gLFile); + if (LRename() < 0) { + LogEndItemResult(1, 1, "Succeeded uploading %s, but a post-processing error occurred: %s\n", gLFile, strerror(errno)); + } else if (RRename() < 0) { + LogEndItemResult(1, 1, "Succeeded uploading to %s, but a post-processing error occurred: %s\n", gRFile, strerror(errno)); + } else { + (void) AdditionalCmd(&gConn, gPerFileFTPCommand, gLFile); + if (gConn.kBytesPerSec >= 0) { + LogEndItemResult(1, 0, "Succeeded uploading %s (%.0f bytes, %.1f sec, %.2f Mbps).\n", gLFile, (double) gConn.bytesTransferred, gConn.sec, gConn.kBytesPerSec * 1024.0 * 8.0 / 1000000.0); + } else { + LogEndItemResult(1, 0, "Succeeded uploading %s.\n", gLFile); + } + } + } else if (gConn.bytesTransferred >= 1) { + LogEndItemResult(1, 1, "Error (%d) occurred on %s after %.0f bytes transferred: %s\n", result, gLFile, (double) gConn.bytesTransferred, FTPStrError(result)); } else { - LogEndItemResult(1, "Error (%d) occurred on %s: %s\n", result, gLFile, FTPStrError(result)); + LogEndItemResult(1, 1, "Error (%d) occurred on %s: %s\n", result, gLFile, FTPStrError(result)); } } + if (result != kNoErr) { + gTimeOfLastFailureAny = time(&gTimeOfLastFailure); + } + switch (result) { case kErrSYMLINKFailed: case kErrSYMLINKNotAvailable: @@ -1334,13 +1879,17 @@ case kErrCWDFailed: case kErrRMDFailed: case kErrRenameFailed: + case kErrOpenFailed: /* We logged the error, but do not attempt to * retry this spool entry. */ result = 0; break; } - + + /* Return (result < 0) if the item should be re-spooled, + * Return (result == 0) if the spool item is finished and should be deleted from the queue. + */ return (result); } /* DoItem */ @@ -1348,7 +1897,7 @@ static int -DecodeName(const char *const src, int *yyyymmdd, int *hhmmss) +DecodeName(const char *const src, int *yyyymmdd, int *hhmmss, int *jobType) { char itemName[64]; char *tok, *ps; @@ -1375,27 +1924,43 @@ switch (t) { case 1: /* Verify that entry is a G or P */ - if (strchr("GgPp", (int) tok[0]) == NULL) + if (strchr("GgPpXx", (int) tok[0]) == NULL) goto fail; + if (jobType != NULL) { + *jobType = ((int) tok[0]); + if (islower(*jobType)) + *jobType = toupper(*jobType); + } break; case 2: /* Quick sanity check */ if (isdigit((int) tok[0]) == 0) goto fail; - *yyyymmdd = atoi(tok); + if (yyyymmdd != NULL) { + *yyyymmdd = atoi(tok); + } break; case 3: if (isdigit((int) tok[0]) == 0) goto fail; - *hhmmss = atoi(tok); + if (hhmmss != NULL) { + *hhmmss = atoi(tok); + } valid = 0; break; } } if (valid < 0) { fail: - *yyyymmdd = 0; - *hhmmss = 0; + if (jobType != NULL) { + *jobType = 0; + } + if (yyyymmdd != NULL) { + *yyyymmdd = 0; + } + if (hhmmss != NULL) { + *hhmmss = 0; + } return (-1); } return (valid); @@ -1425,6 +1990,41 @@ +#ifdef F_SETLK +static int +LockFile(const int fd, const int lock) +{ +#ifdef F_SETLK + struct flock l; + int lk = F_SETLK; + + memset(&l, 0, sizeof(l)); + if (lock == 'r') { + l.l_type = F_RDLCK; + } else if (lock == 'R') { + l.l_type = F_RDLCK; + lk = F_SETLKW; + } else if (lock == 'w') { + l.l_type = F_WRLCK; + } else if (lock == 'W') { + l.l_type = F_WRLCK; + lk = F_SETLKW; + } else { + l.l_type = F_UNLCK; + } + /* l.l_start = (off_t) 0; */ + l.l_whence = SEEK_SET; + /* l.l_len = (off_t) 0; everything == 0 */ + + return (fcntl(fd, lk, &l)); +#else + return (0); +#endif +} /* LockFile */ +#endif + + + static void EventShell(volatile unsigned int sleepval) @@ -1435,9 +2035,7 @@ struct dirent *dent; struct Stat st; char *cp; - char tstr[32]; - time_t tnext; - struct tm tnext_tm; + int renamerc = 0; int iType; int iyyyymmdd, ihhmmss, nyyyymmdd, nhhmmss; DIR *volatile DIRp; @@ -1507,6 +2105,7 @@ } (void) FTPCloseHost(&gConn); + InitHostVariables(); Log(0, "Sleeping %u seconds before starting pass %d.\n", sleepval, passes); if ((sleepval == 0) || (sleepval > 30000)) { Log(0, "Panic: invalid sleep amount %u.\n", sleepval); @@ -1525,9 +2124,13 @@ } if ((DIRp = opendir(gSpoolDir)) == NULL) { - PerrorBox(gSpoolDir); - DisposeWinsock(); - exit(1); + /* Do not require the spool directory be present. + * Another process could create it later and + * then add jobs for us to process. + */ + Log(0, "Skipping pass %d; queue directory \"%s\" not accessible.\n", passes, gSpoolDir); + sleep(60); + continue; } gLastHost[0] = '\0'; /* clear [failed]LastHost before starting a pass */ @@ -1558,7 +2161,7 @@ continue; } - if (DecodeName(dent->d_name, &iyyyymmdd, &ihhmmss) < 0) { + if (DecodeName(dent->d_name, &iyyyymmdd, &ihhmmss, &iType) < 0) { /* Junk file in the spool directory. */ continue; } @@ -1570,11 +2173,8 @@ } cp++; - iType = (int) *cp; - if (isupper(iType)) - iType = islower(iType); - if ((iType != 'g') && (iType != 'p')) { - /* No more items waiting for processing. */ + if ((iType != 'G') && (iType != 'P')) { + /* We only handle available GET and PUT jobs (unavailable are 'X'). */ continue; } @@ -1592,89 +2192,77 @@ (void) STRNCPY(gMyItemPath, gItemPath); gMyItemPath[(int) (cp - gItemPath)] = 'x'; +#ifdef F_SETLK + errno = 0; + if ((gLockFd >= 0) && (LockFile(gLockFd, 'W') < 0)) { + Log(0, "Lock %s failed: %s\n", gLockFile, strerror(errno)); + /* quit now */ + return; + } +#endif + /* Race condition between other ncftpbatches, * but only one of them will rename it - * successfully. + * successfully if rename() is atomic like it + * is supposed to be (cough, cough, Cygwin). */ - if (rename(gItemPath, gMyItemPath) == 0) { + renamerc = rename(gItemPath, gMyItemPath); + +#ifdef F_SETLK + errno = 0; + if ((gLockFd >= 0) && (LockFile(gLockFd, 'u') < 0)) { + Log(0, "Unlock %s failed: %s\n", gLockFile, strerror(errno)); + /* quit now */ + return; + } +#endif + + if (renamerc == 0) { gItemInUse = 1; Log(0, "Processing path: %s\n", gItemPath); nProcessed++; - if (DoItem() < 0) { - if (gDelaySinceLastFailure == 0) - gDelaySinceLastFailure = 5; - else { - gDelaySinceLastFailure = NEW_SLEEP_VAL(gDelaySinceLastFailure); - if (gDelaySinceLastFailure > 900) { - /* If sleep duration got so large it got past 15 minutes, - * start over again. - */ - gDelaySinceLastFailure = 60; - } - } - tnext = time(NULL) + (time_t) gDelaySinceLastFailure; - strftime(tstr, sizeof(tstr), "%Y-%m-%d %H:%M:%S %Z", Gmtime(tnext, &tnext_tm)); - - gMaySigExit = 0; - if (SpoolX( - NULL, - gSpoolDir, - gOperationStr, - gRFile, - gRDir, - gLFile, - gLDir, - gHost, - gHostIP, - gPort, - gRUser, - gRPass, - gRAcct, - gXtype, - gRecursive, - gDelete, - gPassive, - gPreFTPCommand, - gPerFileFTPCommand, - gPostFTPCommand, - gPreShellCommand, - gPostShellCommand, - tnext, - gDelaySinceLastFailure, - gManualOverrideFeatures, - gSourceAddrStr, - 0 - ) < 0) { - /* quit now */ - Log(0, "Could not rename job %s!\n", gMyItemPath); - return; - } - if (unlink(gMyItemPath) != 0) { - /* quit now */ - Log(0, "Could not delete old copy of job %s!\n", gMyItemPath); - return; - } - Log(0, "Rescheduled %s for %s.\n", gItemPath, tstr); - - gMaySigExit = 1; - if ((minDSLF == 0) || (minDSLF > gDelaySinceLastFailure)) - minDSLF = gDelaySinceLastFailure; - } else { - nFinished++; - Log(0, "Done with %s.\n", gItemPath); - if (unlink(gMyItemPath) != 0) { - /* quit now */ - Log(0, "Could not delete finished job %s!\n", gMyItemPath); - return; + for (;;) { + if (DoItem() < 0) { + Respool(1); + gItemInUse = 0; + if ((minDSLF == 0) || (minDSLF > gDelaySinceLastFailure)) + minDSLF = gDelaySinceLastFailure; + if (gQuitRequested == 0) + sleep(2); + break; + } else if (savefp != NULL) { + /* More entries remain. */ + if (chdir(LOCAL_PATH_DELIM_STR) < 0) + exit(1); + if (gQuitRequested != 0) { + Respool(1); + gItemInUse = 0; + break; + } + continue; + } else { + /* Finished with transaction file. */ + gItemInUse = 0; + nFinished++; + Log(0, "Done with %s.\n", gItemPath); + if (DeleteFileWithRetries(gMyItemPath, 1) != 0) { + /* quit now */ + Log(0, "Could not delete finished job %s!\n", gMyItemPath); + return; + } + break; } } - (void) chdir(LOCAL_PATH_DELIM_STR); + + if (chdir(LOCAL_PATH_DELIM_STR) < 0) + exit(1); #if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) /* Allow time for message to be seen */ sleep(1); #endif - } + } /* rename */ + if (gQuitRequested != 0) { if (DIRp != NULL) { (void) closedir(DIRp); @@ -1690,6 +2278,7 @@ #endif (void) AdditionalCmd(&gConn, gPostFTPCommand, NULL); (void) FTPCloseHost(&gConn); + InitHostVariables(); gMayCancelJmp = 0; Log(0, "-----done-----\n"); return; @@ -1709,6 +2298,7 @@ } (void) AdditionalCmd(&gConn, gPostFTPCommand, NULL); (void) FTPCloseHost(&gConn); + InitHostVariables(); gMayCancelJmp = 0; Log(0, "-----done-----\n"); } /* EventShell */ @@ -1720,7 +2310,7 @@ #else static void -ListQueue(void) +ListQueue(int reportMode, int activeOnly) { int nItems; struct Stat st; @@ -1728,9 +2318,16 @@ DIR *DIRp; char *cp; int iyyyymmdd, ihhmmss; - char dstr[64]; + char dstr[64], zstr[64], jfstr[64]; char yyyy[8], mm[4], dd[4]; - char HH[4], MM[4]; + char HH[4], MM[4], SS[4]; + struct tm lt; + time_t t; + int iType = 0, nP = 0, nG = 0, nJobFiles = 0; + double tP = 0.0, tG = 0.0, tX; + const char *uStr; + int printedHeader = 0; + int nJobsInThisJobFile; if ((DIRp = opendir(gSpoolDir)) == NULL) { PerrorBox(gSpoolDir); @@ -1747,15 +2344,8 @@ (void) STRNCPY(gItemPath, gSpoolDir); (void) STRNCAT(gItemPath, LOCAL_PATH_DELIM_STR); (void) STRNCAT(gItemPath, dent->d_name); - if ((Stat(gItemPath, &st) < 0) || (S_ISREG(st.st_mode) == 0)) { - /* Item may have been - * deleted by another - * process. - */ - continue; - } - if (DecodeName(dent->d_name, &iyyyymmdd, &ihhmmss) < 0) { + if (DecodeName(dent->d_name, &iyyyymmdd, &ihhmmss, &iType) < 0) { /* Junk file in the spool directory. */ continue; } @@ -1767,41 +2357,130 @@ } cp++; + if (iType == 'P') { nP++; } else if (iType == 'G') { nG++; } + + nJobFiles++; + nItems++; + if (reportMode >= 4) { + continue; + } + + memset(dstr, 0, sizeof(dstr)); + (void) sprintf(dstr, "%08d%06d", iyyyymmdd, ihhmmss); + (void) memcpy(yyyy, dstr, 4); yyyy[4] = '\0'; + (void) memcpy(mm, dstr + 4, 2); mm[2] = '\0'; + (void) memcpy(dd, dstr + 6, 2); dd[2] = '\0'; + (void) memcpy(HH, dstr + 8, 2); HH[2] = '\0'; + (void) memcpy(MM, dstr + 10, 2); MM[2] = '\0'; + (void) memcpy(MM, dstr + 12, 2); SS[2] = '\0'; + t = UnMDTMDate(dstr); + + if ((t == 0) || (t == (time_t) -1) || (Localtime(t, <) == NULL)) { + memset(zstr, 0, sizeof(zstr)); + } else { + memset(dstr, 0, sizeof(dstr)); + memset(zstr, 0, sizeof(zstr)); + (void) strftime(zstr, sizeof(zstr) - 1, "%Z", <); + (void) strftime(dstr, sizeof(dstr) - 1, "%Y-%m-%d %H:%M:%S", <); + } + + if (reportMode == 3) { + /* Only report what can be found from the spool filename itself. */ + if (++printedHeader == 1) { + (void) printf("---Scheduled For------------Spool File-----------------------------------------\n"); + } + if ((activeOnly == 0) || (gItemPath[0] == 'x')) { + if ((t == 0) || (t == (time_t) -1) || (Localtime(t, <) == NULL)) { + (void) printf("%c %s-%s-%s %s:%s:%s UTC %s\n", + (gItemPath[0] == 'x') ? '*' : ' ', + yyyy, mm, dd, HH, MM, SS, + gItemPath + ); + } else { + (void) printf("%c %s %.3s %s\n", + (gItemPath[0] == 'x') ? '*' : ' ', + dstr, + zstr, + gItemPath + ); + } + } + continue; + } + + /* reportMode == 1 or 2 */ + + if ((Stat(gItemPath, &st) < 0) || (S_ISREG(st.st_mode) == 0)) { + /* Item may have been + * deleted by another + * process. + */ + continue; + } + + --nItems; /* We haven't actually loaded the first item from the spool file yet. */ + if (iType == 'P') { nP--; } else if (iType == 'G') { nG--; } + nJobsInThisJobFile = 0; + (void) STRNCPY(gMyItemPath, gItemPath); - if (LoadCurrentSpoolFileContents(0) == 0) { + do { + if (LoadCurrentSpoolFileContents(0) < 0) { + if (savefp != NULL) { + fclose(savefp); + savefp = NULL; + } + break; + } + + nJobsInThisJobFile++; nItems++; - if (nItems == 1) { - (void) printf("---Scheduled-For-----Host----------------------------Command--------------------\n"); + iType = gOperation; + if (iType == 'P') { nP++; } else if (iType == 'G') { nG++; } + + if ((iType != 'P') && (gRFileSize >= 0)) + tG += gRFileSize; + else if ((iType == 'P') && (gLFileSize > 0)) + tP += gLFileSize; + + if (reportMode == 2) + continue; + + if (++printedHeader == 1) { + (void) printf("---Scheduled For------------Host------------------------------Command------------------------------\n"); } - (void) sprintf(dstr, "%08d", iyyyymmdd); - (void) memcpy(yyyy, dstr, 4); yyyy[4] = '\0'; - (void) memcpy(mm, dstr + 4, 2); mm[2] = '\0'; - (void) memcpy(dd, dstr + 6, 2); dd[2] = '\0'; - (void) sprintf(dstr, "%06d", ihhmmss); - (void) memcpy(HH, dstr + 0, 2); HH[2] = '\0'; - (void) memcpy(MM, dstr + 2, 2); MM[2] = '\0'; - (void) printf("%c %s-%s-%s %s:%s %-30s ", - (gItemPath[0] == 'x') ? '*' : ' ', - yyyy, mm, dd, HH, MM, - gHost - ); - if (gOperation != 'P') { - (void) printf("GET"); - if (gRecursive != 0) { - (void) printf(" -R %s", gRFile); + if ((activeOnly == 0) || (gItemPath[0] == 'x')) { + if ((t == 0) || (t == (time_t) -1) || (Localtime(t, <) == NULL)) { + (void) printf("%c %s-%s-%s %s:%s:%s UTC %-32s ", + (gItemPath[0] == 'x') ? '*' : ' ', + yyyy, mm, dd, HH, MM, SS, + gHost + ); } else { - (void) printf(" %s", gRFile); + (void) printf("%c %s %.3s %-32s ", + (gItemPath[0] == 'x') ? '*' : ' ', + dstr, + zstr, + gHost + ); } - } else { - (void) printf("PUT"); - if (gRecursive != 0) { - (void) printf(" -R %s", gLFile); + if (iType != 'P') { + (void) printf("%s", (nJobsInThisJobFile < 2) ? "GET" : "+ G"); + if (gRecursive != 0) { + (void) printf(" -R \"%s\"", gRFile); + } else { + (void) printf(" \"%s\"", gRFile); + } } else { - (void) printf(" %s", gLFile); + (void) printf("%s", (nJobsInThisJobFile < 2) ? "PUT" : "+ P"); + if (gRecursive != 0) { + (void) printf(" -R \"%s\"", gLFile); + } else { + (void) printf(" \"%s\"", gLFile); + } } + (void) printf("\n"); } - (void) printf("\n"); - } + } while (savefp != NULL); } (void) closedir(DIRp); if (nItems == 0) { @@ -1809,6 +2488,48 @@ (void) printf("%s \"%s\" directory is empty.\n", (gGlobalSpooler != 0) ? "The" : "Your", gSpoolDir); + } else { + if ((reportMode == 1) || (reportMode == 3)) + printf("\n"); + + jfstr[0] = '\0'; + if ((nG > 0) && (nP > 0)) { + } else if (nItems > nJobFiles) { +#ifdef HAVE_SNPRINTF + (void) snprintf(jfstr, sizeof(jfstr), " in %d spool file%s", nJobFiles, (nJobFiles == 1) ? "" : "s"); +#else + (void) sprintf(jfstr, " in %d spool file%s", nJobFiles, (nJobFiles == 1) ? "" : "s"); +#endif + } + if (nG > 0) { + if (tG > 0.0) { + tX = FileSize(tG, &uStr, NULL); + printf("%d GET job%s queued%s for %.1f %s.\n", nG, ((nG == 1) ? "" : "s"), jfstr, tX, uStr); + } else { + printf("%d GET job%s queued%s.\n", nG, ((nG == 1) ? "" : "s"), jfstr); + } + } + if (nP > 0) { + if (tP > 0.0) { + tX = FileSize(tP, &uStr, NULL); + printf("%d PUT job%s queued%s for %.1f %s.\n", nP, ((nP == 1) ? "" : "s"), jfstr, tX, uStr); + } else { + printf("%d PUT job%s queued%s.\n", nP, ((nP == 1) ? "" : "s"), jfstr); + } + } + if ((nItems - (nG + nP)) > 0) { + printf("%d job%s in progress.\n", (nItems - (nG + nP)), (((nItems - (nG + nP)) == 1) ? "" : "s")); + } + if (nItems > nJobFiles) { +#ifdef HAVE_SNPRINTF + (void) snprintf(jfstr, sizeof(jfstr), " in %d spool file%s", nJobFiles, (nJobFiles == 1) ? "" : "s"); +#else + (void) sprintf(jfstr, " in %d spool file%s", nJobFiles, (nJobFiles == 1) ? "" : "s"); +#endif + } + if ((nG > 0) && (nP > 0)) { + printf("%d total job%s queued%s.\n", nItems, ((nItems == 1) ? "" : "s"), jfstr); + } } } /* ListQueue */ @@ -1840,7 +2561,7 @@ LOGFONT lf; char *cp; - strftime(str, sizeof(str), "%Y-%m-%d %H:%M:%S %Z", Gmtime(0, <)); + strftime(str, sizeof(str), "%Y-%m-%d %H:%M:%S %Z", Localtime(0, <)); sizeIsUnknown = (gConn.expectedSize == kSizeUnknown); inProgress = (gConn.bytesTransferred > 0); @@ -2237,7 +2958,8 @@ /* Change to root directory so filesystems * can be unmounted. */ - (void) chdir("/"); + if (chdir("/") < 0) + exit(1); #endif } /* Daemon */ @@ -2245,15 +2967,22 @@ static void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) + __attribute__ ((noreturn)) +#endif Usage(void) { (void) fprintf(stderr, "Usages:\n"); if (gGlobalSpooler == 0) { - (void) fprintf(stderr, "\tncftpbatch -d | -D\t\t\t(start NcFTP batch processing)\n"); - (void) fprintf(stderr, "\tncftpbatch -l\t\t\t\t(list spooled jobs)\n"); + (void) fprintf(stderr, "\tncftpbatch -d | -D [-x xfer-log-file] [-U umask] (start NcFTP batch processing)\n"); + (void) fprintf(stderr, "\tncftpbatch -l (list spooled jobs)\n"); } else { - (void) fprintf(stderr, "\tncftpspooler -d [-q spool-dir] [-o log-file] [-s delay]\n"); - (void) fprintf(stderr, "\tncftpspooler -l\t\t\t\t(list spooled jobs)\n"); +#ifdef F_SETLK + (void) fprintf(stderr, "\tncftpspooler -d [-q spool-dir] [-K lock-file] [-o log-file] [-O max-log-size] [-x xfer-log-file] [-s delay] [-U umask]\n"); +#else + (void) fprintf(stderr, "\tncftpspooler -d [-q spool-dir] [-o log-file] [-O max-log-size] [-x xfer-log-file] [-s delay] [-U umask]\n"); +#endif + (void) fprintf(stderr, "\tncftpspooler -l (list spooled jobs)\n"); } (void) fprintf(stderr, "\nLibrary version: %s.\n", gLibNcFTPVersion + 5); (void) fprintf(stderr, "This is a freeware program by Mike Gleason (http://www.NcFTP.com).\n"); @@ -2271,7 +3000,9 @@ int runAsDaemon = -1; unsigned int sleepval = 0; int listonly = -1; + int activeonly = 0; int readcore = -1; + longest_int o; GetoptInfo opt; PreInit(argv[0]); @@ -2282,18 +3013,29 @@ if (gGlobalSpooler != 0) { runAsDaemon = -1; GetoptReset(&opt); - while ((c = Getopt(&opt, argc, argv, "DdlL:s:q:o:")) > 0) switch(c) { + while ((c = Getopt(&opt, argc, argv, "a:DdlL:x:s:q:o:O:U:K:")) > 0) switch(c) { + case 'a': + activeonly++; + break; case 'd': runAsDaemon = 1; break; case 'D': runAsDaemon = 0; break; + case 'x': + STRNCPY(gXferLogFileName, opt.arg); + break; + case 'K': + STRNCPY(gLockFile, opt.arg); + break; case 'L': + /* Deprecated */ STRNCPY(gProgressLog, opt.arg); break; case 'l': - listonly = 1; + if (listonly < 0) listonly = 0; + listonly++; break; case 's': if (atoi(opt.arg) > 0) @@ -2305,6 +3047,23 @@ case 'o': STRNCPY(gLogFileName, opt.arg); break; + case 'O': + o = 0; + (void) sscanf(opt.arg, PRINTF_LONG_LONG, &o); + gMaxLogSize = (off_t) o; + break; + case 'U': +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) + { + unsigned int um = 0xFFFFFFFF; + if ((sscanf(opt.arg, "%o", &um) == 1) && (um != (0xFFFFFFFF))) { + (void) umask(um); + } + } + break; +#else + Usage(); +#endif default: Usage(); } @@ -2324,7 +3083,10 @@ } else { /* User Spooler */ GetoptReset(&opt); - while ((c = Getopt(&opt, argc, (char **) argv, "|:XDdlL:S:Z:s:w")) > 0) switch(c) { + while ((c = Getopt(&opt, argc, (char **) argv, "|:aXDdlLO::x:S:Z:s:wU:K:")) > 0) switch(c) { + case 'a': + activeonly++; + break; case 'd': runAsDaemon = 1; break; @@ -2332,11 +3094,23 @@ runAsDaemon = 0; break; case 'l': - listonly = 1; + if (listonly < 0) listonly = 0; + listonly++; + break; + case 'x': + STRNCPY(gXferLogFileName, opt.arg); + break; + case 'K': + STRNCPY(gLockFile, opt.arg); break; case 'L': STRNCPY(gProgressLog, opt.arg); break; + case 'O': + o = 0; + (void) sscanf(opt.arg, PRINTF_LONG_LONG, &o); + gMaxLogSize = (off_t) o; + break; case 'Z': if (atoi(opt.arg) > 0) sleep((unsigned int) atoi(opt.arg)); @@ -2357,10 +3131,21 @@ DisposeWinsock(); exit(0); /*NOTREACHED*/ - break; case '|': readcore = atoi(opt.arg); break; + case 'U': +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) + { + unsigned int um2 = 0xFFFFFFFF; + if ((sscanf(opt.arg, "%o", &um2) == 1) && (um2 != (0xFFFFFFFF))) { + (void) umask(um2); + } + } + break; +#else + Usage(); +#endif default: Usage(); } @@ -2373,7 +3158,7 @@ PostInit(); if (listonly > 0) { - ListQueue(); + ListQueue(listonly, activeonly); } else { if (gGlobalSpooler == 0) { if (readcore >= 0) { diff -Nru ncftp-3.2.5/sh_util/ncftpget.c ncftp-3.2.6/sh_util/ncftpget.c --- ncftp-3.2.5/sh_util/ncftpget.c 2010-05-17 00:51:29.000000000 +0000 +++ ncftp-3.2.6/sh_util/ncftpget.c 2016-11-12 23:46:57.000000000 +0000 @@ -43,6 +43,9 @@ extern Bookmark gBm; static void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) + __attribute__ ((noreturn)) +#endif Usage(void) { FILE *fp; @@ -251,7 +254,6 @@ case 'z': case 'Z': case 'C': (void) fprintf(stderr, "The \"-%c\" option is not valid when used with conjunction with \"-%c\".\n", c, 'b'); exit(kExitUsage); - break; } } @@ -403,20 +405,20 @@ exit(kExitNoMemory); } StrRemoveTrailingLocalPathDelim(dstdir); - flist = (const char **) argv + opt.ind + 2; + flist = ((const char **) (void *) argv) + opt.ind + 2; } else if (ftpcat == 2) { if (opt.ind > argc - 3) Usage(); (void) STRNCPY(fi.host, argv[opt.ind]); dstdir = NULL; - flist = (const char **) argv + opt.ind + 1; + flist = ((const char **) (void *) argv) + opt.ind + 1; dstlfile = argv[opt.ind + 2]; } else { if (opt.ind > argc - 2) Usage(); (void) STRNCPY(fi.host, argv[opt.ind]); dstdir = NULL; - flist = (const char **) argv + opt.ind + 1; + flist = ((const char **) (void *) argv) + opt.ind + 1; } if (strchr(fi.host, '.') == NULL) { /* Check if host argument corresponds to config file or entry from ~/.ncftp/bookmarks. */ @@ -458,7 +460,7 @@ exit(kExitNoMemory); } StrRemoveTrailingLocalPathDelim(dstdir); - flist = (const char **) argv + opt.ind + 1; + flist = ((const char **) (void *) argv) + opt.ind + 1; } else if (ftpcat == 2) { if (opt.ind > argc - 3) Usage(); @@ -468,13 +470,13 @@ exit(kExitNoMemory); } StrRemoveTrailingLocalPathDelim(dstdir); - flist = (const char **) argv + opt.ind + 1; + flist = ((const char **) (void *) argv) + opt.ind + 1; dstlfile = argv[opt.ind + 2]; } else { if (opt.ind > argc - 1) Usage(); dstdir = NULL; - flist = (const char **) argv + opt.ind + 0; + flist = ((const char **) (void *) argv) + opt.ind + 0; } } @@ -484,7 +486,7 @@ GetoptReset(&opt); while ((c = Getopt(&opt, argc, argv, kGetoptOptions)) > 0) switch(c) { case 'P': - fi.port = atoi(opt.arg); + fi.port = (unsigned int) atoi(opt.arg); break; case 'u': (void) STRNCPY(fi.user, opt.arg); @@ -544,12 +546,21 @@ rc = SpoolX( (batchmode < 3) ? NULL : stdout, + stderr, NULL, "get", urlfile, /* Remote file */ urldir, /* Remote CWD */ + -1, + 0, urlfile, /* Local file */ ".", /* Local CWD */ + -1, + 0, + NULL, + NULL, + NULL, + NULL, fi.host, fi.ip, fi.port, @@ -569,6 +580,8 @@ 0, fi.manualOverrideFeatures, preferredLocalAddrStr, + (time_t) 0, + (time_t) 0, 0 ); if ((rc == 0) && (batchmode < 3)) { @@ -590,12 +603,21 @@ rc = SpoolX( (batchmode < 3) ? NULL : stdout, + stderr, NULL, "get", urlfilep, /* Remote file */ urldirp, /* Remote CWD */ + -1, + 0, urlfilep, /* Local file */ dstdir, /* Local CWD */ + -1, + 0, + NULL, + NULL, + NULL, + NULL, fi.host, fi.ip, fi.port, @@ -615,6 +637,8 @@ 0, fi.manualOverrideFeatures, preferredLocalAddrStr, + (time_t) 0, + (time_t) 0, 0 ); if ((rc == 0) && (batchmode < 3)) { diff -Nru ncftp-3.2.5/sh_util/ncftpls.c ncftp-3.2.6/sh_util/ncftpls.c --- ncftp-3.2.5/sh_util/ncftpls.c 2010-10-31 18:21:09.000000000 +0000 +++ ncftp-3.2.6/sh_util/ncftpls.c 2016-11-12 23:47:03.000000000 +0000 @@ -207,6 +207,9 @@ static void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) + __attribute__ ((noreturn)) +#endif Usage(void) { FILE *fp; @@ -494,7 +497,7 @@ GetoptReset(&opt); while ((c = Getopt(&opt, argc, argv, kGetoptOptions)) > 0) switch(c) { case 'P': - fi.port = atoi(opt.arg); + fi.port = (unsigned int) atoi(opt.arg); break; case 'u': (void) STRNCPY(fi.user, opt.arg); diff -Nru ncftp-3.2.5/sh_util/ncftpput.c ncftp-3.2.6/sh_util/ncftpput.c --- ncftp-3.2.5/sh_util/ncftpput.c 2010-05-17 00:58:02.000000000 +0000 +++ ncftp-3.2.6/sh_util/ncftpput.c 2016-11-13 01:14:39.000000000 +0000 @@ -28,6 +28,8 @@ #include "gpshare.h" +#define kNcFTPPutDefaultUseSendfile 1 + FTPLibraryInfo gLib; FTPConnectionInfo fi; @@ -40,12 +42,20 @@ extern int gFwDataPortMode; extern const char gOS[], gVersion[]; extern Bookmark gBm; +extern int gSendfileInProgress; static void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) + __attribute__ ((noreturn)) +#endif Usage(void) { FILE *fp; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunreachable-code" +#endif fp = OpenPager(); (void) fprintf(fp, "NcFTPPut %.5s\n\n", gVersion + 11); (void) fprintf(fp, "Usages:\n"); @@ -84,7 +94,10 @@ -E Use regular (PORT) data connections.\n\ -F Use passive (PASV) data connections (default).\n\ -I XX Use IP address XX for local source address.\n\ - -y Try using \"SITE UTIME\" to preserve timestamps on remote host.\n"); + -s %s sendfile() function, if available.\n\ + -y Try using \"SITE UTIME\" to preserve timestamps on remote host.\n", + ((kNcFTPPutDefaultUseSendfile != 0) ? "Do not use" : "Use") + ); (void) fprintf(fp, "\ -B XX Try setting the SO_SNDBUF size to XX.\n\ -r XX Redial XX times until connected.\n\ @@ -105,6 +118,10 @@ ClosePager(fp); DisposeWinsock(); exit(kExitUsage); + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif } /* Usage */ @@ -120,6 +137,7 @@ * it starts a new block. */ fi.cancelXfer++; + gSendfileInProgress = -SIGINT; /* If the user appears to be getting impatient, * restore the default signal handler so the @@ -229,6 +247,7 @@ fi.xferTimeout = 60 * 60; fi.connTimeout = 30; fi.ctrlTimeout = 135; + fi.useSendfile = kNcFTPPutDefaultUseSendfile; fi.debugLog = NULL; fi.errLog = stderr; (void) STRNCPY(fi.user, "anonymous"); @@ -238,7 +257,7 @@ perfilecmd[0] = '\0'; GetoptReset(&opt); -#define kGetoptOptions "P:u:j:p:h:e:d:U:t:mar:RvVf:o:AT:S:EFcCyZzDbB:W:X:Y:I:" +#define kGetoptOptions "P:u:j:p:h:e:d:U:t:mar:RvVf:o:AT:S:EFcCyZzDbB:W:X:Y:I:s" while ((c = Getopt(&opt, argc, argv, kGetoptOptions)) > 0) { if (c == 'b') { batchmode++; @@ -254,7 +273,6 @@ case 'Z': case 'C': (void) fprintf(stderr, "The \"-%c\" option is not valid when used with conjunction with \"-%c\".\n", c, 'b'); exit(kExitUsage); - break; } } @@ -385,6 +403,9 @@ } preferredLocalAddrStr = opt.arg; break; + case 's': + fi.useSendfile = !fi.useSendfile; + break; default: Usage(); } @@ -462,7 +483,7 @@ GetoptReset(&opt); while ((c = Getopt(&opt, argc, argv, kGetoptOptions)) > 0) switch(c) { case 'P': - fi.port = atoi(opt.arg); + fi.port = (unsigned int) atoi(opt.arg); break; case 'u': (void) STRNCPY(fi.user, opt.arg); @@ -534,12 +555,21 @@ result = SpoolX( (batchmode < 3) ? NULL : stdout, + stderr, NULL, "put", ufilep, /* Remote file */ dstdir, /* Remote CWD */ + -1, + 0, ufilep, /* Local file */ udirp, /* Local CWD */ + -1, + 0, + NULL, + NULL, + NULL, + NULL, fi.host, fi.ip, fi.port, @@ -559,6 +589,8 @@ 0, fi.manualOverrideFeatures, preferredLocalAddrStr, + (time_t) 0, + (time_t) 0, 0 ); if ((result == 0) && (batchmode < 3)) { diff -Nru ncftp-3.2.5/sh_util/rc.rc ncftp-3.2.6/sh_util/rc.rc --- ncftp-3.2.5/sh_util/rc.rc 2010-10-30 21:21:22.000000000 +0000 +++ ncftp-3.2.6/sh_util/rc.rc 2013-01-08 04:34:01.000000000 +0000 @@ -63,8 +63,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,2,5,19 - PRODUCTVERSION 3,2,5,19 + FILEVERSION 3,2,6,20 + PRODUCTVERSION 3,2,6,20 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -82,14 +82,14 @@ VALUE "Comments", "\0" VALUE "CompanyName", "NcFTP Software\0" VALUE "FileDescription", "\0" - VALUE "FileVersion", "3.2.5\0" + VALUE "FileVersion", "3.2.6\0" VALUE "InternalName", "\0" - VALUE "LegalCopyright", "Copyright © 2010\0" + VALUE "LegalCopyright", "Copyright © 2013\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "NcFTP Software \0" - VALUE "ProductVersion", "3.2.5\0" + VALUE "ProductVersion", "3.2.6\0" VALUE "SpecialBuild", "\0" END END diff -Nru ncftp-3.2.5/sio/config.h.in ncftp-3.2.6/sio/config.h.in --- ncftp-3.2.5/sio/config.h.in 2005-03-25 01:15:00.000000000 +0000 +++ ncftp-3.2.6/sio/config.h.in 2016-11-13 02:19:27.000000000 +0000 @@ -44,6 +44,9 @@ #undef main_void_return_t +/* Define this because you definitely don't have it. Used only for testing configure. */ +#undef negative_control_t + #undef PRAGMA_HDRSTOP #undef read_return_t @@ -54,6 +57,8 @@ #undef recv_size_t +#undef sa_family_t + /* Define to the type of arg1 for select(). */ #undef SELECT_TYPE_ARG1 @@ -74,6 +79,10 @@ /* Define to `unsigned' if doesn't define. */ #undef size_t +#undef SNPRINTF_RETURNS_PTR + +#undef SNPRINTF_TERMINATES + #undef sockaddr_size_t /* If SOCKS library is being used, define the major version (i.e. 5) */ @@ -81,6 +90,9 @@ #undef sockopt_size_t +/* Define to `long' if doesn't define. */ +#undef ssize_t + /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. @@ -137,9 +149,15 @@ /* Define if you have the sigsetjmp function. */ #undef HAVE_SIGSETJMP +/* Define if you have the snprintf function. */ +#undef HAVE_SNPRINTF + /* Define if you have the strerror function. */ #undef HAVE_STRERROR +/* Define if you have the vsnprintf function. */ +#undef HAVE_VSNPRINTF + /* Define if you have the header file. */ #undef HAVE_ARPA_NAMESER_H @@ -152,6 +170,9 @@ /* Define if you have the header file. */ #undef HAVE_RESOLV_H +/* Define if you have the header file. */ +#undef HAVE_SNPRINTF_H + /* Define if you have the header file. */ #undef HAVE_SOCKS_H @@ -188,5 +209,8 @@ /* Define if you have the resolv library (-lresolv). */ #undef HAVE_LIBRESOLV +/* Define if you have the snprintf library (-lsnprintf). */ +#undef HAVE_LIBSNPRINTF + /* Define if you have the socket library (-lsocket). */ #undef HAVE_LIBSOCKET diff -Nru ncftp-3.2.5/sio/configure.in ncftp-3.2.6/sio/configure.in --- ncftp-3.2.5/sio/configure.in 2008-05-18 20:29:18.000000000 +0000 +++ ncftp-3.2.6/sio/configure.in 2016-11-14 23:11:22.000000000 +0000 @@ -69,6 +69,13 @@ wi__RES_DEFDNAME wi_STRUCT_TIMEVAL_FIELD_TYPES wi_VOID_MAIN_RETURN_TYPE +wi_CHECK_TYPE(negative_control_t, long, []) +wi_CHECK_TYPE(ssize_t, long, []) +wi_CHECK_TYPE(sa_family_t, unsigned short, [#include +#include +#include +#include +]) wi_UNISTD_FUNC_PARAM_TYPES wi_HEADER_SYS_SELECT_H wi_FUNC_SELECT_ARGTYPES @@ -84,6 +91,7 @@ dnl --------------------------------------------------------------------------- dnl AC_CHECK_FUNCS(gethostbyaddr_r gethostbyname_r gethostname getdomainname getservbyname_r getservbyport_r inet_ntop recvmsg sigaction sigsetjmp strerror) +wi_SNPRINTF AC_FUNC_ALLOCA dnl Only needed for Linux wi_FUNC_SIGSETJMP @@ -146,5 +154,6 @@ AC_SUBST(DEFS) AC_SUBST(SFLAG) AC_SUBST(SIO_VERSION) +AC_SUBST(DEBUGBUILD) AC_SUBST(MAKE) AC_OUTPUT([Makefile ucase_c/Makefile ucase_s/Makefile time_c/Makefile time_s/Makefile srltest/Makefile sendmessage/Makefile]) diff -Nru ncftp-3.2.5/sio/DNSUtil.c ncftp-3.2.6/sio/DNSUtil.c --- ncftp-3.2.5/sio/DNSUtil.c 2009-10-23 23:31:23.000000000 +0000 +++ ncftp-3.2.6/sio/DNSUtil.c 2016-11-13 03:03:45.000000000 +0000 @@ -3,19 +3,13 @@ # pragma hdrstop #endif +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif #ifndef STRNCPY # define STRNCPY(a,b) strncpy(a, b, sizeof(a)); a[sizeof(a) - 1] = '\0' # define Strncpy(a,b,s) strncpy(a, b, s); a[s - 1] = '\0' -# define Strncat(a,b,s)\ - { \ - size_t alen = strlen(a); \ - if (alen < s) { \ - strncpy(a + alen, b, s - alen); \ - } \ - a[s - 1] = '\0' \ - } #endif #if (((defined(MACOSX)) && (MACOSX < 10300)) || (defined(AIX) && (AIX < 430)) || (defined(DIGITAL_UNIX)) || (defined(SOLARIS)) || (defined(SCO)) || (defined(HPUX))) @@ -170,7 +164,7 @@ my_h_errno = 0; h = NULL; memset(usehpbuf, 0, hpbufsize); - rc = gethostbyaddr_r((gethost_addrptr_t) addr, asize, atype, hp, usehpbuf, hpbufsize, &h, &my_h_errno); + rc = gethostbyaddr_r((gethost_addrptr_t) addr, (sockaddr_size_t) asize, atype, hp, usehpbuf, hpbufsize, &h, &my_h_errno); if ((rc == 0) && (h != NULL)) return (0); if ((rc == ERANGE) || ((rc == -1) && (errno == ERANGE))) { @@ -195,7 +189,7 @@ #else /* Note: gethostbyaddr is already threadsafe on: HP-UX, Tru64 */ struct hostent *h; - h = gethostbyaddr((gethost_addrptr_t) addr, asize, atype); + h = gethostbyaddr((gethost_addrptr_t) addr, (sockaddr_size_t) asize, atype); if (h != NULL) { memcpy(hp, h, sizeof(struct hostent)); return (0); @@ -462,10 +456,10 @@ if ((GetHostByName(&hp, host, hpbuf, sizeof(hpbuf)) == 0) && (hp.h_name != NULL) && (hp.h_name[0] != '\0')) { /* Maybe the host entry has the full name. */ - cp = strchr((char *) hp.h_name, '.'); + cp = strchr((const char *) hp.h_name, '.'); if ((cp != NULL) && (cp[1] != '\0')) { /* The 'name' field for the host entry had full name. */ - (void) Strncpy(host, (char *) hp.h_name, siz); + (void) Strncpy(host, (const char *) hp.h_name, siz); rc = kGethostbynameFullyQualified; goto done; /* Success */ } @@ -487,10 +481,10 @@ if (ip.s_addr != INADDR_NONE) { if (GetHostByAddr(&hp, (char *) &ip, (int) sizeof(ip), AF_INET, hpbuf, sizeof(hpbuf)) == 0) { /* Maybe the host entry has the full name. */ - cp = strchr((char *) hp.h_name, '.'); + cp = strchr((const char *) hp.h_name, '.'); if ((cp != NULL) && (cp[1] != '\0')) { /* The 'name' field for the host entry had full name. */ - (void) Strncpy(host, (char *) hp.h_name, siz); + (void) Strncpy(host, (const char *) hp.h_name, siz); rc = kGethostbyaddrFullyQualified; goto done; /* Success */ } diff -Nru ncftp-3.2.5/sio/main.c ncftp-3.2.6/sio/main.c --- ncftp-3.2.5/sio/main.c 2010-10-30 21:33:25.000000000 +0000 +++ ncftp-3.2.6/sio/main.c 2016-10-30 02:40:27.000000000 +0000 @@ -24,11 +24,16 @@ volatile Sjmp_buf gNetTimeoutJmp; volatile Sjmp_buf gPipeJmp; #else +extern Sjmp_buf gNetTimeoutJmp; +extern Sjmp_buf gPipeJmp; Sjmp_buf gNetTimeoutJmp; Sjmp_buf gPipeJmp; #endif void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) +__attribute__ ((noreturn)) +#endif SIOHandler(int sigNum) { if (sigNum == SIGPIPE) diff -Nru ncftp-3.2.5/sio/Makefile.in ncftp-3.2.6/sio/Makefile.in --- ncftp-3.2.5/sio/Makefile.in 2009-11-30 19:33:30.000000000 +0000 +++ ncftp-3.2.6/sio/Makefile.in 2016-11-14 23:17:43.000000000 +0000 @@ -15,6 +15,7 @@ DEFS=@DEFS@@NDEFS@ PREFIX=@prefix@ LIB=libsio.a +LIB_d=libsio_d.a LIBSO=libsio.so.5 LIBSOS=libsio.so STRIP=@STRIP@ @@ -61,14 +62,15 @@ -@RANLIB@ $(LIB) -@echo $(VER) > sio.version -@chmod a+r $(LIB) sio.h usio.h - -@$(LIST) $(LIB) + -@if [ "x@DEBUGBUILD@" = xyes ] ; then $(COPY) "$(LIB)" "$(LIB_d)" ; fi + -@$(LIST) "$(LIB)" "$(LIB_d)" 2>/dev/null install: $(LIB) - $(COPY) $(LIB) $(PREFIX)/lib/$(LIB) - -@@RANLIB@ $(PREFIX)/lib/$(LIB) - $(COPY) sio.h usio.h $(PREFIX)/include - chmod a+r $(PREFIX)/lib/$(LIB) $(PREFIX)/include/sio.h $(PREFIX)/include/usio.h - -@$(LIST) $(PREFIX)/lib/$(LIB) $(PREFIX)/include/sio.h $(PREFIX)/include/usio.h + $(COPY) "$(LIB)" "$(PREFIX)/lib/$(LIB)" + -if [ "x@DEBUGBUILD@" = xyes ] ; then $(COPY) "$(LIB_d)" "$(PREFIX)/lib/$(LIB_d)" ; fi + $(COPY) sio.h usio.h "$(PREFIX)/include/" + -chmod a+r "$(PREFIX)/lib/$(LIB)" "$(PREFIX)/lib/$(LIB_d)" "$(PREFIX)/include/sio.h" "$(PREFIX)/include/usio.h" 2>/dev/null + -@$(LIST) "$(PREFIX)/lib/$(LIB)" "$(PREFIX)/lib/$(LIB_d)" "$(PREFIX)/include/sio.h" "$(PREFIX)/include/usio.h" 2>/dev/null dynamic: $(LIBSO) @@ -123,7 +125,7 @@ -$(DELETE) *.@OBJEXT@ *.so $(PCH) $(LIB) $(LIBSO) ucase_c/ucase_c ucase_s/ucase_s time_c/time_c time_s/time_s core *.pch */*.pch *.gch SunWS_cache distclean: clean - -$(DELETE) config.h Makefile config.status config.cache config.log sio.version + -$(DELETE) config.h Makefile config.status config.cache config.log sio.version autom4te.cache ### Archiving ################################################################# @@ -162,7 +164,7 @@ -@$(MKDIR) $(TMPDIR)/TAR -@$(MKDIR) $(TMPDIR)/TAR/$(TARDIR) -@chmod ga+r $(PACKAGE) - find . -follow -depth -type f -print | cut -c3- | egrep -i -v '(((\.(o|so|log|a|lib|ncb|obj|exe|idb|cache|opt|zip|gz|swp|tar|plg|pch|gch))|(config\.h))$$|(/\.)|(^\.))' | cpio -Lpdm $(TMPDIR)/TAR/$(TARDIR) + find . -follow -depth -type f -print | cut -c3- | egrep -i -v '(((\.(o|so|log|a|lib|ncb|obj|exe|idb|cache|opt|zip|gz|swp|tar|plg|pch|gch))|((^|/)(config\.h|config\.status|Makefile|autoheader|autoconf)))$$|(/\.)|(^\.)|(xcuserdata|dSYM))' | cpio -Lpdm $(TMPDIR)/TAR/$(TARDIR) ( cd $(TMPDIR)/TAR ; @TAR@ @TARFLAGS@ $(TARFILE) $(TARDIR) ) $(COPY) $(TMPDIR)/TAR/$(TARFILE) . -@chmod 644 $(TARFILE) diff -Nru ncftp-3.2.5/sio/SBind.c ncftp-3.2.6/sio/SBind.c --- ncftp-3.2.5/sio/SBind.c 2001-11-19 14:44:01.000000000 +0000 +++ ncftp-3.2.6/sio/SBind.c 2016-11-12 20:06:18.000000000 +0000 @@ -6,15 +6,30 @@ int SBind(int sockfd, const int port, const int nTries, const int reuseFlag) { - unsigned int i; - int on; - sockopt_size_t onsize; struct sockaddr_in localAddr; localAddr.sin_family = AF_INET; localAddr.sin_addr.s_addr = htonl(INADDR_ANY); localAddr.sin_port = htons((unsigned short) port); + return (SBindAddr(sockfd, &localAddr, nTries, reuseFlag)); +} /* SBind */ + + + + +int +SBindAddr(int sockfd, struct sockaddr_in *localAddr, const int nTries, const int reuseFlag) +{ + unsigned int i; + int on; + sockopt_size_t onsize; + + if ((sockfd < 0) || (localAddr == NULL) || (localAddr->sin_family != AF_INET)) { + errno = EINVAL; + return (kSioErrInvalidArg); + } + if (reuseFlag != kReUseAddrNo) { /* This is mostly so you can quit the server and re-run it * again right away. If you don't do this, the OS may complain @@ -41,11 +56,11 @@ /* Try binding a few times, in case we get Address in Use * errors. */ - if (bind(sockfd, (struct sockaddr *) &localAddr, (sockaddr_size_t) sizeof(struct sockaddr_in)) == 0) { + if (bind(sockfd, (struct sockaddr *) localAddr, (sockaddr_size_t) sizeof(struct sockaddr_in)) == 0) { break; } if ((int) i == nTries) { - return (-1); + return (kSBindFailed); } /* Give the OS time to clean up the old socket, * and then try again. @@ -54,7 +69,7 @@ } return (0); -} /* SBind */ +} /* SBindAddr */ @@ -62,5 +77,11 @@ int SListen(int sfd, int backlog) { - return (listen(sfd, (listen_backlog_t) backlog)); + if (sfd < 0) { + errno = EINVAL; + return (kSioErrInvalidArg); + } + if (listen(sfd, (listen_backlog_t) backlog) < 0) + return (kSListenFailed); + return (0); } /* SListen */ diff -Nru ncftp-3.2.5/sio/SConnect.c ncftp-3.2.6/sio/SConnect.c --- ncftp-3.2.5/sio/SConnect.c 2009-12-17 17:45:48.000000000 +0000 +++ ncftp-3.2.6/sio/SConnect.c 2016-11-15 17:30:22.000000000 +0000 @@ -87,6 +87,8 @@ SIOSETERRNO RESTORE_SIGPIPE } while ((result < 0) && (errno == EINTR)); + if ((result < 0) && (errno == ETIMEDOUT)) + return (kTimeoutErr); return (result); } @@ -120,11 +122,14 @@ #else && (errno != EWOULDBLOCK) && (errno != EINPROGRESS) #endif - ) { + ) + { cErrno = errno; SIOSETERRNO shutdown(sfd, 2); errno = cErrno; + if (errno == ETIMEDOUT) + return (kTimeoutErr); return (-1); } cErrno = errno; @@ -166,6 +171,8 @@ } else if (errno != EINTR) { /* Don't bother turning off FIONBIO */ SIOSETERRNO + if (errno == ETIMEDOUT) + return (kTimeoutErr); return (-1); } } diff -Nru ncftp-3.2.5/sio/sio.h ncftp-3.2.6/sio/sio.h --- ncftp-3.2.5/sio/sio.h 2010-10-30 21:32:22.000000000 +0000 +++ ncftp-3.2.6/sio/sio.h 2016-11-12 20:30:03.000000000 +0000 @@ -4,10 +4,10 @@ * */ -#ifndef _sio_h_ -#define _sio_h_ 1 +#ifndef sio_h +#define sio_h 1 -#define kSioVersion "@(#) libsio 6.2.1 (May 7, 2008)" +#define kSioVersion "@(#) libsio 6.3 (November 12, 2016)" #ifdef __cplusplus extern "C" @@ -22,8 +22,8 @@ } SelectSet, *SelectSetPtr; /* For SReadline */ -#ifndef _SReadlineInfo_ -#define _SReadlineInfo_ 1 +#ifndef defined_SReadlineInfo +#define defined_SReadlineInfo 1 typedef struct SReadlineInfo { char *buf; /* Pointer to beginning of buffer. */ char *bufPtr; /* Pointer to current position in buffer. */ @@ -52,6 +52,7 @@ #define kFullBufferNotRequired 00000 #define kFullBufferRequired 00001 #define kFullBufferRequiredExceptLast 00002 +#define kFullBufferOrEOF 00002 /* alias for kFullBufferRequiredExceptLast */ #define kNoFirstSelect 00010 /* Parameter to AddrToAddrStr */ @@ -67,6 +68,8 @@ #define kSNewFailed (-6) #define kSBindFailed (-7) #define kSListenFailed (-8) +#define kSioErrInvalidArg (-9) +#define kSioErrBadAddrStr (-10) #define kSrlBufSize 2048 @@ -200,8 +203,9 @@ int SAccept(int, struct sockaddr_in *const, int); /* SBind.c */ -int SBind(int, const int, const int, const int); -int SListen(int, int); +int SBind(int sockfd, const int port, const int nTries, const int reuseFlag); +int SBindAddr(int sockfd, struct sockaddr_in *localAddr, const int nTries, const int reuseFlag); +int SListen(int sfd, int backlog); /* SClose.c */ int SCloseSocket(int); @@ -216,8 +220,12 @@ /* SNew.c */ int SNewStreamClient(void); int SNewDatagramClient(void); -int SNewStreamServer(const int, const int, const int, int); -int SNewDatagramServer(const int, const int, const int); +int SNewStreamServerByAddr(struct sockaddr_in *const saddr, const int nTries, const int reuseFlag, const int listenQueueSize); +int SNewStreamServerByName(const char *const addrStr, const int nTries, const int reuseFlag, const int listenQueueSize); +int SNewStreamServer(const int port, const int nTries, const int reuseFlag, const int listenQueueSize); +int SNewDatagramServerByAddr(struct sockaddr_in *const saddr, const int nTries, const int reuseFlag); +int SNewDatagramServerByName(const char *const addrStr, const int nTries, const int reuseFlag); +int SNewDatagramServer(const int port, const int nTries, const int reuseFlag); /* SRead.c */ int SRead(int, char *const, size_t, int, int); @@ -279,7 +287,7 @@ /* StrAddr.c */ unsigned int ServiceNameToPortNumber(const char *const s, const int proto); int ServicePortNumberToName(unsigned short port, char *const dst, const size_t dsize, const int proto); -void InetNtoA(char *dst, struct in_addr *ia, size_t siz); +void InetNtoA(char *dst, struct in_addr *ia, unsigned int siz); int AddrStrToAddr(const char *const, struct sockaddr_in *const, const int); char *AddrToAddrStr(char *const dst, size_t dsize, struct sockaddr_in * const saddrp, int dns, const char *fmt); char *AddrStrToIPStr(char *const dst, size_t dsize, const char *const src, const int defaultport); @@ -289,7 +297,11 @@ /* main.c */ extern int sio_sigpipe_ignored_already; -void SIOHandler(int); +void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) + __attribute__ ((noreturn)) +#endif +SIOHandler(int); void (*SSignal(int signum, void (*handler)(int)))(int); void SIOPipeSignalIsBeingIgnoredGloballyByApplication(int value); @@ -297,4 +309,4 @@ } #endif -#endif /* _sio_h_ */ +#endif /* sio_h */ diff -Nru ncftp-3.2.5/sio/SNew.c ncftp-3.2.6/sio/SNew.c --- ncftp-3.2.5/sio/SNew.c 2001-11-19 14:44:10.000000000 +0000 +++ ncftp-3.2.6/sio/SNew.c 2016-11-12 20:32:13.000000000 +0000 @@ -34,7 +34,67 @@ int -SNewStreamServer(const int port, const int nTries, const int reuseFlag, int listenQueueSize) +SNewStreamServerByAddr(struct sockaddr_in *const saddr, const int nTries, const int reuseFlag, const int listenQueueSize) +{ + int oerrno; + int sfd; + + if (saddr == NULL) { + errno = EINVAL; + return (kSioErrInvalidArg); + } + + sfd = socket(AF_INET, SOCK_STREAM, 0); + if (sfd < 0) + return kSNewFailed; + + if (SBindAddr(sfd, saddr, nTries, reuseFlag) < 0) { + oerrno = errno; + (void) closesocket(sfd); + errno = oerrno; + return kSBindFailed; + } + + if (SListen(sfd, listenQueueSize) < 0) { + oerrno = errno; + (void) closesocket(sfd); + errno = oerrno; + return kSListenFailed; + } + + return (sfd); +} /* SNewStreamServerByAddr */ + + + + +int +SNewStreamServerByName(const char *const addrStr, const int nTries, const int reuseFlag, const int listenQueueSize) +{ + struct sockaddr_in saddr; + + if (addrStr == NULL) { + errno = EINVAL; + return (kSioErrInvalidArg); + } + + if ((strchr(addrStr, ':') == NULL) && (isdigit((int) addrStr[0]))) { + /* Just a port number specified */ + return (SNewStreamServer(atoi(addrStr), nTries, reuseFlag, listenQueueSize)); + } + + /* ip:port */ + if (AddrStrToAddr(addrStr, &saddr, -1) < 0) + return (kSioErrBadAddrStr); + + return (SNewStreamServerByAddr(&saddr, nTries, reuseFlag, listenQueueSize)); +} /* SNewStreamServerByName */ + + + + +int +SNewStreamServer(const int port, const int nTries, const int reuseFlag, const int listenQueueSize) { int oerrno; int sfd; @@ -62,6 +122,59 @@ + +int +SNewDatagramServerByAddr(struct sockaddr_in *const saddr, const int nTries, const int reuseFlag) +{ + int oerrno; + int sfd; + + if (saddr == NULL) { + errno = EINVAL; + return (kSioErrInvalidArg); + } + + sfd = socket(AF_INET, SOCK_DGRAM, 0); + if (sfd < 0) + return kSNewFailed; + + if (SBindAddr(sfd, saddr, nTries, reuseFlag) < 0) { + oerrno = errno; + (void) closesocket(sfd); + errno = oerrno; + return kSBindFailed; + } + + return (sfd); +} /* SNewDatagramServer */ + + + + +int +SNewDatagramServerByName(const char *const addrStr, const int nTries, const int reuseFlag) +{ + struct sockaddr_in saddr; + + if (addrStr == NULL) { + errno = EINVAL; + return (kSioErrInvalidArg); + } + + if ((strchr(addrStr, ':') == NULL) && (isdigit((int) addrStr[0]))) { + /* Just a port number specified */ + return (SNewDatagramServer(atoi(addrStr), nTries, reuseFlag)); + } + + /* ip:port */ + if (AddrStrToAddr(addrStr, &saddr, -1) < 0) + return (kSioErrBadAddrStr); + + return (SNewDatagramServerByAddr(&saddr, nTries, reuseFlag)); +} /* SNewDatagramServer */ + + + int SNewDatagramServer(const int port, const int nTries, const int reuseFlag) diff -Nru ncftp-3.2.5/sio/SRead.c ncftp-3.2.6/sio/SRead.c --- ncftp-3.2.5/sio/SRead.c 2010-10-30 21:25:35.000000000 +0000 +++ ncftp-3.2.6/sio/SRead.c 2016-11-14 21:33:02.000000000 +0000 @@ -3,8 +3,9 @@ # pragma hdrstop #endif -static const char UNUSED(gSioVersion[]) = kSioVersion; -static const char UNUSED(gCopyright[]) = "@(#) libsio Copyright 1992-2011, by Mike Gleason. All rights reserved."; +extern const char gSioVersion[]; +const char UNUSED(gSioVersion[]) = kSioVersion; +static const char UNUSED(gCopyright[]) = "@(#) libsio Copyright 1992-2016, by Mike Gleason. All rights reserved."; /* Read up to "size" bytes on sfd before "tlen" seconds. @@ -80,7 +81,7 @@ } else if (result == 0) { /* timeout */ nread = (read_return_t) size - (read_return_t) nleft; - if ((nread > 0) && ((retry & (kFullBufferRequired|kFullBufferRequiredExceptLast)) == 0)) { + if ((nread > 0) && ((retry & (kFullBufferRequired|kFullBufferRequiredExceptLast)) == 0)) { RESTORE_SIGPIPE return ((int) nread); } @@ -105,7 +106,7 @@ if (nread <= 0) { if (nread == 0) { /* EOF */ - if (retry == ((retry & (kFullBufferRequiredExceptLast)) != 0)) + if ((retry & (kFullBufferRequiredExceptLast)) != 0) nread = (read_return_t) size - (read_return_t) nleft; goto done; } else if (errno != EINTR) { diff -Nru ncftp-3.2.5/sio/StrAddr.c ncftp-3.2.6/sio/StrAddr.c --- ncftp-3.2.5/sio/StrAddr.c 2009-10-23 23:31:23.000000000 +0000 +++ ncftp-3.2.6/sio/StrAddr.c 2016-11-13 03:02:38.000000000 +0000 @@ -1,6 +1,8 @@ #include "syshdrs.h" +#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__) #define _CRT_SECURE_NO_WARNINGS 1 +#endif #ifdef PRAGMA_HDRSTOP # pragma hdrstop @@ -40,7 +42,7 @@ while (isdigit((int) *cp)) cp++; *cp = '\0'; - return (atoi(str)); + return ((unsigned int) atoi(str)); } for (;; cp++) { if ((*cp == '\0') @@ -167,11 +169,10 @@ } #ifdef HAVE_SNPRINTF - snprintf(dst, dsize, + snprintf(dst, dsize, "%u", (unsigned int) port); #else - sprintf(dst, + sprintf(dst, "%u", (unsigned int) port); #endif - "%u", (unsigned int) port); return (0); /* error */ } /* ServicePortNumberToName */ @@ -180,7 +181,7 @@ void -InetNtoA(char *dst, struct in_addr *ia, size_t siz) +InetNtoA(char *dst, struct in_addr *ia, unsigned int siz) { #if defined(HAVE_INET_NTOP) && !defined(MACOSX) /* Mostly to workaround bug in IRIX 6.5's inet_ntoa */ @@ -191,10 +192,10 @@ (void) inet_ntop(AF_INET, ia, dst, siz - 1); #else char *cp; - memset(dst, 0, siz); + memset(dst, 0, (size_t) siz); cp = inet_ntoa(*ia); if ((cp != (char *) 0) && (cp != (char *) -1) && (cp[0] != '\0')) { - (void) strncpy(dst, cp, siz - 1); + (void) strncpy(dst, cp, (size_t) siz - 1); } #endif } /* InetNtoA */ @@ -230,7 +231,7 @@ while (isdigit((int) *cp)) cp++; *cp = '\0'; - port = atoi(p2); + port = (unsigned int) atoi(p2); } *cp = '\0'; break; @@ -283,7 +284,7 @@ errno = ENOENT; return (kAddrStrToAddrBadHost); } - sa->sin_family = hp->h_addrtype; + sa->sin_family = (sa_family_t) hp->h_addrtype; memcpy(&sa->sin_addr.s_addr, hp->h_addr_list[0], (size_t) hp->h_length); } @@ -297,7 +298,7 @@ AddrToAddrStr(char *const dst, size_t dsize, struct sockaddr_in * const saddrp, int dns, const char *fmt) { char addrName[128]; - char *addrNamePtr; + const char *addrNamePtr; struct hostent *hp; char str[128]; char s_name[64]; diff -Nru ncftp-3.2.5/sio/UConnect.c ncftp-3.2.6/sio/UConnect.c --- ncftp-3.2.5/sio/UConnect.c 2009-11-30 19:11:32.000000000 +0000 +++ ncftp-3.2.6/sio/UConnect.c 2016-10-30 02:47:45.000000000 +0000 @@ -5,10 +5,10 @@ #ifdef HAVE_SYS_UN_H -extern int _SConnect(const int sfd, const struct sockaddr_in *const addr, const size_t saddrsiz, const int tlen); +extern int _SConnect(const int sfd, const void *const addr, const size_t saddrsiz, const int tlen); int -UConnect(int sfd, const struct sockaddr_un *const addr, int ualen, int tlen) +UConnect(int sfd, const struct sockaddr_un *const /* must be aligned to 4 byte boundary */ addr, int ualen, int tlen) { int result; @@ -17,7 +17,7 @@ return (-1); } - result = _SConnect(sfd, (const struct sockaddr_in *) addr, (size_t) ualen, tlen); + result = _SConnect(sfd, addr, (size_t) ualen, tlen); return (result); } /* UConnect */ diff -Nru ncftp-3.2.5/sio/wincfg.h ncftp-3.2.6/sio/wincfg.h --- ncftp-3.2.5/sio/wincfg.h 2001-11-17 11:02:20.000000000 +0000 +++ ncftp-3.2.6/sio/wincfg.h 2016-11-27 20:24:36.000000000 +0000 @@ -19,6 +19,7 @@ #define recv_size_t unsigned int #define send_return_t int #define send_size_t unsigned int +#define sa_family_t short /* #define CAN_USE_SYS_SELECT_H 1 */ diff -Nru ncftp-3.2.5/Strn/DStrInternal.h ncftp-3.2.6/Strn/DStrInternal.h --- ncftp-3.2.5/Strn/DStrInternal.h 2001-11-16 16:39:47.000000000 +0000 +++ ncftp-3.2.6/Strn/DStrInternal.h 2016-11-12 23:29:55.000000000 +0000 @@ -1,7 +1,7 @@ /* DStrInternal.h */ -#ifndef _DStrInternal_h_ -#define _DStrInternal_h_ 1 +#ifndef DStrInternal_h +#define DStrInternal_h 1 #ifdef __cplusplus extern "C" diff -Nru ncftp-3.2.5/Strn/Strn.h ncftp-3.2.6/Strn/Strn.h --- ncftp-3.2.5/Strn/Strn.h 2009-05-02 17:15:53.000000000 +0000 +++ ncftp-3.2.6/Strn/Strn.h 2016-11-12 23:32:55.000000000 +0000 @@ -1,7 +1,7 @@ /* Strn.h */ -#ifndef _Strn_h_ -#define _Strn_h_ 1 +#ifndef Strn_h +#define Strn_h 1 #ifdef __cplusplus extern "C" @@ -54,7 +54,7 @@ char *Strncat_NoZeroPad(char *const, const char *const, const size_t); char *Strncpy_NoZeroPad(char *const, const char *const, const size_t); -#ifndef _DStrInternal_h_ +#ifndef DStrInternal_h typedef struct DStr { /* All of these structure fields are read-only; do not modify * them directly. @@ -81,6 +81,6 @@ #define STRNCPY(d,s) Strncpy((d), (s), (size_t) sizeof(d)) #define STRNCAT(d,s) Strncat((d), (s), (size_t) sizeof(d)) -#endif /* _Strn_h_ */ +#endif /* Strn_h */ /* eof Strn.h */ diff -Nru ncftp-3.2.5/vis/bmed.c ncftp-3.2.6/vis/bmed.c --- ncftp-3.2.5/vis/bmed.c 2011-02-02 23:14:06.000000000 +0000 +++ ncftp-3.2.6/vis/bmed.c 2016-11-13 03:26:35.000000000 +0000 @@ -143,6 +143,10 @@ int begy, begx; char spec[32]; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif getmaxyx(gHostListWin, lmaxy, lmaxx); getbegyx(gHostListWin, begy, begx); getmaxyx(gHostWin, maxy, maxx); @@ -226,6 +230,10 @@ wprintw(gHostWin, spec, str); wmove(gHostWin, maxy - 1, 0); UpdateHostWindows(0); + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif } /* DrawHostList */ @@ -234,7 +242,7 @@ int HostWinGetKey(void) { int c; - int uc; + unsigned int uc; int escmode; int maxy; @@ -1084,6 +1092,9 @@ /*ARGSUSED*/ static void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) +__attribute__ ((noreturn)) +#endif SigIntHostWin(int UNUSED(sig)) { LIBNCFTP_USE_VAR(sig); diff -Nru ncftp-3.2.5/vis/wgets.c ncftp-3.2.6/vis/wgets.c --- ncftp-3.2.5/vis/wgets.c 2005-01-01 21:36:32.000000000 +0000 +++ ncftp-3.2.6/vis/wgets.c 2016-11-13 03:05:56.000000000 +0000 @@ -152,16 +152,16 @@ /* Just add a character to the end. No need to do * a memory move for this. */ - *gBufPtr = c; + *gBufPtr = (char) c; gBufLen++; wg_SetCursorPos(gBufPtr + 1); } else { /* Have to move characters after the cursor over one * position so we can insert a character. */ - n = limit - gBufPtr; + n = (size_t) (limit - gBufPtr); MEMMOVE(gBufPtr + 1, gBufPtr, n); - *gBufPtr = c; + *gBufPtr = (char) c; gBufLen++; wg_SetCursorPos(gBufPtr + 1); } @@ -189,10 +189,10 @@ /* Delete the characters before the character under the * cursor, and move everything after it back one. */ - n = limit - gBufPtr; + n = (size_t) (limit - gBufPtr); memcpy(gBufPtr - count, gBufPtr, n); } - gBufLen -= count; + gBufLen -= (size_t) count; wg_SetCursorPos(gBufPtr - count); /* Does a --gBufPtr. */ gNeedUpdate = 1; gChanged = 1; @@ -237,7 +237,7 @@ /* Nothing in front to delete. */ BEEP(1); } else { - n = limit - gBufPtr - 1; + n = (size_t) (limit - gBufPtr) - 1; memcpy(gBufPtr, gBufPtr + 1, n); --gBufLen; gNeedUpdate = 1; diff -Nru ncftp-3.2.5/vis/wgets.h ncftp-3.2.6/vis/wgets.h --- ncftp-3.2.5/vis/wgets.h 2002-03-27 08:27:15.000000000 +0000 +++ ncftp-3.2.6/vis/wgets.h 2016-11-13 03:24:40.000000000 +0000 @@ -23,15 +23,16 @@ typedef struct WGetsParams { WINDOW *w; /* in */ - int sy, sx; /* in */ + FTPLineListPtr history; /* in, out */ char *dst; /* in, out */ - int fieldLen; /* in */ size_t dstSize; /* in */ + int sy, sx; /* in */ + int fieldLen; /* in */ int useCurrentContents; /* in */ int echoMode; /* in */ int changed; /* out */ int dstLen; /* out */ - FTPLineListPtr history; /* in, out */ + int reserved; } WGetsParams, *WGetsParamPtr; int wg_Gets(WGetsParamPtr wgpp); diff -Nru ncftp-3.2.5/vis/wutil.c ncftp-3.2.6/vis/wutil.c --- ncftp-3.2.5/vis/wutil.c 2005-01-01 21:36:44.000000000 +0000 +++ ncftp-3.2.6/vis/wutil.c 2016-11-14 16:07:18.000000000 +0000 @@ -38,6 +38,9 @@ void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) +__attribute__ ((noreturn)) +#endif Exit(int exitStatus) { EndWin(); @@ -386,7 +389,8 @@ maxx, maxy ); - (void) write(1, buf, strlen(buf)); + if (write(1, buf, strlen(buf)) < 0) + return (-1); return (0); } return (-1); diff -Nru ncftp-3.2.5/vis/wutil.h ncftp-3.2.6/vis/wutil.h --- ncftp-3.2.5/vis/wutil.h 2001-11-19 09:23:49.000000000 +0000 +++ ncftp-3.2.6/vis/wutil.h 2016-11-13 03:26:02.000000000 +0000 @@ -9,7 +9,11 @@ #define kBold 00040 void EndWin(void); -void Exit(int exitStatus); +void +#if (defined(__GNUC__)) && (__GNUC__ >= 2) +__attribute__ ((noreturn)) +#endif +Exit(int exitStatus); void SaveScreen(void); void TTYWaitForReturn(void); void RestoreScreen(int pressKey); diff -Nru ncftp-3.2.5/win/bmed/bmed.rc ncftp-3.2.6/win/bmed/bmed.rc --- ncftp-3.2.5/win/bmed/bmed.rc 2010-10-30 21:21:22.000000000 +0000 +++ ncftp-3.2.6/win/bmed/bmed.rc 2013-01-08 04:34:01.000000000 +0000 @@ -161,8 +161,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,2,5,19 - PRODUCTVERSION 3,2,5,19 + FILEVERSION 3,2,6,20 + PRODUCTVERSION 3,2,6,20 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -180,14 +180,14 @@ VALUE "Comments", "\0" VALUE "CompanyName", "NcFTP Software\0" VALUE "FileDescription", "\0" - VALUE "FileVersion", "3.2.5\0" + VALUE "FileVersion", "3.2.6\0" VALUE "InternalName", "\0" - VALUE "LegalCopyright", "Copyright © 2010\0" + VALUE "LegalCopyright", "Copyright © 2013\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "NcFTP Software \0" - VALUE "ProductVersion", "3.2.5\0" + VALUE "ProductVersion", "3.2.6\0" VALUE "SpecialBuild", "\0" END END diff -Nru ncftp-3.2.5/win/bmed/bmed.vcproj ncftp-3.2.6/win/bmed/bmed.vcproj --- ncftp-3.2.5/win/bmed/bmed.vcproj 2010-04-13 01:21:52.000000000 +0000 +++ ncftp-3.2.6/win/bmed/bmed.vcproj 2016-11-27 21:13:17.000000000 +0000 @@ -119,7 +119,7 @@ IntermediateDirectory=".\Release" ConfigurationType="1" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" - UseOfMFC="2" + UseOfMFC="1" ATLMinimizesCRunTimeLibraryUsage="false" CharacterSet="2" > @@ -151,7 +151,7 @@ AdditionalIncludeDirectories="..\..\Strn" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" StringPooling="true" - RuntimeLibrary="2" + RuntimeLibrary="0" EnableFunctionLevelLinking="true" UsePrecompiledHeader="2" PrecompiledHeaderThrough="stdafx.h" diff -Nru ncftp-3.2.5/win/bmed/bookmark.c ncftp-3.2.6/win/bmed/bookmark.c --- ncftp-3.2.5/win/bmed/bookmark.c 2010-04-07 23:13:26.000000000 +0000 +++ ncftp-3.2.6/win/bmed/bookmark.c 2016-10-30 20:24:13.000000000 +0000 @@ -1,6 +1,6 @@ /* bookmark.c * - * Copyright (c) 1992-2005 by Mike Gleason. + * Copyright (c) 1992-2016 by Mike Gleason. * All rights reserved. * */ @@ -547,7 +547,7 @@ if ((nb != gNumBookmarks) && (gBookmarkTable != NULL)) { /* Re-loading the table from disk. */ gBookmarkTable = (Bookmark *) realloc(gBookmarkTable, (size_t) (nb + 1) * sizeof(Bookmark)); - memset(gBookmarkTable, 0, (nb + 1) * sizeof(Bookmark)); + memset(gBookmarkTable, 0, (size_t) (nb + 1) * sizeof(Bookmark)); } else { gBookmarkTable = calloc((size_t) (nb + 1), (size_t) sizeof(Bookmark)); } diff -Nru ncftp-3.2.5/win/setup/ncftp.wse ncftp-3.2.6/win/setup/ncftp.wse --- ncftp-3.2.5/win/setup/ncftp.wse 2010-10-30 21:21:22.000000000 +0000 +++ ncftp-3.2.6/win/setup/ncftp.wse 2013-01-08 04:34:01.000000000 +0000 @@ -1,7 +1,7 @@ Document Type: WSE item: Global Version=8.14 - Title=NcFTP 3.2.5 Installation + Title=NcFTP 3.2.6 Installation Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Copy Default=1 @@ -21,7 +21,7 @@ Patch Flags=0000000000000001 Patch Threshold=85 Patch Memory=4000 - EXE Filename=ncftp-3.2.5-win32.exe + EXE Filename=ncftp-3.2.6-win32.exe FTP Cluster Size=20 Per-User Version ID=1 Dialogs Version=7 @@ -115,7 +115,7 @@ end item: Set Variable Variable=APPTITLE - Value=NcFTP 3.2.5 + Value=NcFTP 3.2.6 Flags=10000000 end item: Remark diff -Nru ncftp-3.2.5/win/setup/setup.nsi ncftp-3.2.6/win/setup/setup.nsi --- ncftp-3.2.5/win/setup/setup.nsi 1970-01-01 00:00:00.000000000 +0000 +++ ncftp-3.2.6/win/setup/setup.nsi 2016-10-23 22:24:54.000000000 +0000 @@ -0,0 +1,119 @@ +;-------------------------------- +;Include Modern UI + + !include "MUI2.nsh" + +;-------------------------------- +;General + + ;Name and file + Name "NcFTP 3.2.6" + OutFile "Setup NcFTP 3.2.6.exe" + + ;Default installation folder + InstallDir "$LOCALAPPDATA\NcFTP" + ;InstallDir "$DESKTOP" + + ;Get installation folder from registry if available + InstallDirRegKey HKCU "Software\NcFTP" "" + + ;Request application privileges for Windows Vista + ;RequestExecutionLevel user + RequestExecutionLevel admin + +;-------------------------------- +;Interface Settings + + !define MUI_ABORTWARNING + +;-------------------------------- +;Pages + +!define MUI_WELCOMEPAGE_TEXT "Hello!$\n$\n\ +NcFTP is a free set of programs for your Command Prompt (or PowerShell) that implement the File Transfer Protocol. It's been around for UNIX for quite some time now (circa 1992) and many people still use the program and contribute suggestions and feedback.$\n$\n\ +The main program is simply called ncftp. There are also separate utility programs for one-shot FTP operations (i.e. for shell scripts and command-line junkies); these include ncftpget, ncftpput, and ncftpls. Run each command without any arguments to see the usage screen, or read the man page.\ +" + + !insertmacro MUI_PAGE_WELCOME + ; !insertmacro MUI_PAGE_LICENSE "..\..\doc\LICENSE.txt" + ; !insertmacro MUI_PAGE_COMPONENTS + !insertmacro MUI_PAGE_DIRECTORY + !insertmacro MUI_PAGE_INSTFILES + ; !insertmacro MUI_PAGE_FINISH + + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + +;-------------------------------- +;Languages + + !insertmacro MUI_LANGUAGE "English" + +;-------------------------------- +;Installer Sections + +Section "Main Section" SecMain + SetOutPath "$SYSDIR" + + File ..\..\ncftp\Release\ncftp.exe + File ..\..\sh_util\Release\ncftpget.exe + File ..\..\sh_util\Release\ncftpput.exe + File ..\..\sh_util\Release\ncftpls.exe + File ..\..\sh_util\Release\ncftpbatch.exe + + CreateDirectory "$SMPROGRAMS\NcFTP" + CreateShortCut "$SMPROGRAMS\NcFTP\NcFTP.lnk" "$SYSDIR\ncftp.exe" + + CreateDirectory "$INSTDIR\doc" + SetOutPath "$INSTDIR\doc" + File ..\..\doc\html\index.html + File ..\..\doc\html\ncftp.html + File ..\..\doc\html\ncftpput.html + File ..\..\doc\html\ncftpget.html + File ..\..\doc\html\ncftpls.html + File ..\..\doc\html\ncftpbatch.html + CreateShortCut "$SMPROGRAMS\NcFTP\Documentation.lnk" "$INSTDIR\doc\index.html" + + SetOutPath "$INSTDIR" + File ..\..\win\bmed\Release\ncftpbookmarks.exe + + ;Store installation folder + WriteRegStr HKCU "Software\NcFTP" "" $INSTDIR + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\ncftp.exe" "" "$INSTDIR\ncftp.exe" + + ;Create uninstaller + CreateShortCut "$SMPROGRAMS\NcFTP\Uninstall.lnk" "$INSTDIR\Uninstall.exe" + WriteUninstaller "$INSTDIR\Uninstall.exe" + +SectionEnd + +;-------------------------------- +;Descriptions + + ;Language strings + LangString DESC_SecMain ${LANG_ENGLISH} "Main" + + ;Assign language strings to sections + ; !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + ; !insertmacro MUI_DESCRIPTION_TEXT ${SecMain} $(DESC_SecMain) + ; !insertmacro MUI_FUNCTION_DESCRIPTION_END + +;-------------------------------- +;Uninstaller Section + +Section "Uninstall" + + Delete "$SYSDIR\ncftp.exe" + Delete "$SYSDIR\ncftpput.exe" + Delete "$SYSDIR\ncftpget.exe" + Delete "$SYSDIR\ncftpls.exe" + Delete "$SYSDIR\ncftpbatch.exe" + + Delete "$INSTDIR\Uninstall.exe" + Delete "$INSTDIR\ncftpbookmarks.exe" + + RMDir /r "$INSTDIR" + RMDir /r "$SMPROGRAMS\NcFTP" + DeleteRegKey /ifempty HKCU "Software\NcFTP" + DeleteRegKey /ifempty HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\ncftp.exe" +SectionEnd \ No newline at end of file diff -Nru "/tmp/tmpetwwev9h/tBpU8ENQ2R/ncftp-3.2.5/win/setup/Windows Installer Wizard/NcFTP/NcFTP.vdproj" "/tmp/tmpetwwev9h/Bzn51fD6_H/ncftp-3.2.6/win/setup/Windows Installer Wizard/NcFTP/NcFTP.vdproj" --- "/tmp/tmpetwwev9h/tBpU8ENQ2R/ncftp-3.2.5/win/setup/Windows Installer Wizard/NcFTP/NcFTP.vdproj" 2010-04-13 01:49:18.000000000 +0000 +++ "/tmp/tmpetwwev9h/Bzn51fD6_H/ncftp-3.2.6/win/setup/Windows Installer Wizard/NcFTP/NcFTP.vdproj" 2016-10-23 23:06:34.000000000 +0000 @@ -673,14 +673,14 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:NcFTP" - "ProductCode" = "8:{38795F08-1CAA-4674-85DF-A6CEE99F4BF8}" - "PackageCode" = "8:{FEC32D62-4775-4245-80FA-80E7D62E9601}" + "ProductCode" = "8:{97241218-5554-4EF3-8326-6C8E98951EB6}" + "PackageCode" = "8:{3D802A51-9478-4A39-B21E-D66B2BE10D08}" "UpgradeCode" = "8:{A21E5117-7E32-4F21-8BAB-AD53A293B20B}" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:FALSE" "DetectNewerInstalledVersion" = "11:FALSE" "InstallAllUsers" = "11:TRUE" - "ProductVersion" = "8:3.2.4" + "ProductVersion" = "8:3.2.6" "Manufacturer" = "8:NcFTP Software" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:"