Updates for move of net apps to rosapps
authorSteven Edwards <winehacker@gmail.com>
Sun, 30 Dec 2001 04:12:47 +0000 (04:12 +0000)
committerSteven Edwards <winehacker@gmail.com>
Sun, 30 Dec 2001 04:12:47 +0000 (04:12 +0000)
svn path=/trunk/; revision=2445

reactos/apps/utils/net/ncftp/autoconf/acconfig.h [deleted file]
reactos/apps/utils/net/ncftp/autoconf/aclocal.m4 [deleted file]
rosapps/net/ping/makefile [new file with mode: 0644]
rosapps/net/ping/ping.c [new file with mode: 0644]
rosapps/net/ping/ping.rc [new file with mode: 0644]

diff --git a/reactos/apps/utils/net/ncftp/autoconf/acconfig.h b/reactos/apps/utils/net/ncftp/autoconf/acconfig.h
deleted file mode 100644 (file)
index aefe313..0000000
+++ /dev/null
@@ -1,389 +0,0 @@
-/* acconfig.h
-   This file is in the public domain.
-
-   Descriptive text for the C preprocessor macros that
-   the distributed Autoconf macros can define.
-   No software package will use all of them; autoheader copies the ones
-   your configure.in uses into your configuration header file templates.
-
-   The entries are in sort -df order: alphabetical, case insensitive,
-   ignoring punctuation (such as underscores).  Although this order
-   can split up related entries, it makes it easier to check whether
-   a given entry is in the file.
-
-   Leave the following blank line there!!  Autoheader needs it.  */
-\f
-
-/* Define if on AIX 3.
-   System headers sometimes define this.
-   We just want to avoid a redefinition error message.  */
-#ifndef _ALL_SOURCE
-#undef _ALL_SOURCE
-#endif
-
-#undef CAN_USE_SYS_SELECT_H
-
-/* Define if using alloca.c.  */
-#undef C_ALLOCA
-
-/* Define if type char is unsigned and you are not using gcc.  */
-#ifndef __CHAR_UNSIGNED__
-#undef __CHAR_UNSIGNED__
-#endif
-
-/* Define if the closedir function returns void instead of int.  */
-#undef CLOSEDIR_VOID
-
-/* Define to empty if the keyword does not work.  */
-#undef const
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
-   This function is required for alloca.c support on those systems.  */
-#undef CRAY_STACKSEG_END
-
-/* Define for DGUX with <sys/dg_sys_info.h>.  */
-#undef DGUX
-
-/* Define if you have <dirent.h>.  */
-#undef DIRENT
-
-/* Define to the type of elements in the array set by `getgroups'.
-   Usually this is either `int' or `gid_t'.  */
-#undef GETGROUPS_T
-
-/* Define if the `getloadavg' function needs to be run setuid or setgid.  */
-#undef GETLOADAVG_PRIVILEGED
-
-/* Define if the `getpgrp' function takes no argument.  */
-#undef GETPGRP_VOID
-
-/* Define to `int' if <sys/types.h> doesn't define.  */
-#undef gid_t
-
-/* Define if you have alloca, as a function or macro.  */
-#undef HAVE_ALLOCA
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
-#undef HAVE_ALLOCA_H
-
-/* Define if your curses library has this functionality. */
-#undef HAVE_BEEP
-
-#undef HAVE_CURSES_H
-
-/* Define if you don't have vprintf but do have _doprnt.  */
-#undef HAVE_DOPRNT
-
-/* Define if your system has a working fnmatch function.  */
-#undef HAVE_FNMATCH
-
-/* Define if your curses library has this functionality. */
-#undef HAVE_GETBEGX
-
-/* Define if your system has its own `getloadavg' function.  */
-#undef HAVE_GETLOADAVG
-
-/* Define if your curses library has this functionality. */
-#undef HAVE_GETMAXX
-
-/* Define if your curses library has this functionality. */
-#undef HAVE_GETMAXYX
-
-/* Define if you have the getmntent function.  */
-#undef HAVE_GETMNTENT
-
-/* Define if you have <hpsecurity.h>.  */
-#undef HAVE_HPSECURITY_H
-
-/* Define if you have the curses library. */
-#undef HAVE_LIBCURSES
-
-/* Define if you want to use the Hpwd library, and you also have it's corresponding database library (such as *dbm). */
-#undef HAVE_LIBHPWD
-
-/* Define if you have the ncurses library. */
-#undef HAVE_LIBNCURSES
-
-/* Define if you have the readline library, version 2.0 or higher. */
-#undef HAVE_LIBREADLINE
-
-/* Define if the `long double' type works.  */
-#undef HAVE_LONG_DOUBLE
-
-/* Define if you support file names longer than 14 characters.  */
-#undef HAVE_LONG_FILE_NAMES
-
-/* Define if your compiler supports the "long long" integral type. */
-#undef HAVE_LONG_LONG
-
-/* Most system's curses library uses a _maxx field instead of maxx. */
-#undef HAVE__MAXX
-
-/* Define if you have a working `mmap' system call.  */
-#undef HAVE_MMAP
-
-#undef HAVE_MSGHDR_ACCRIGHTS
-
-#undef HAVE_MSGHDR_CONTROL
-
-#undef HAVE_PR_PASSWD_FG_OLDCRYPT
-
-/* Define if you have a _res global variable used by resolve routines. */
-#undef HAVE__RES_DEFDNAME
-
-/* Define if system calls automatically restart after interruption
-   by a signal.  */
-#undef HAVE_RESTARTABLE_SYSCALLS
-
-/* Define if you have sigsetjmp and siglongjmp. */
-#undef HAVE_SIGSETJMP
-
-#undef HAVE_SOCKADDR_UN_SUN_LEN
-
-#undef HAVE_STATFS_F_BAVAIL
-
-/* Define if your struct stat has st_blksize.  */
-#undef HAVE_ST_BLKSIZE
-
-/* Define if your struct stat has st_blocks.  */
-#undef HAVE_ST_BLOCKS
-
-/* Define if you have the strcoll function and it is properly defined.  */
-#undef HAVE_STRCOLL
-
-/* Define if your struct stat has st_rdev.  */
-#undef HAVE_ST_RDEV
-
-/* Define if you have the strftime function.  */
-#undef HAVE_STRFTIME
-
-/* Define if you have the ANSI # stringizing operator in cpp. */
-#undef HAVE_STRINGIZE
-
-#undef HAVE_STRUCT_CMSGDHR
-
-#undef HAVE_STRUCT_STAT64
-
-/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
-#undef HAVE_SYS_WAIT_H
-
-/* Define if your curses library has this functionality. */
-#undef HAVE_TOUCHWIN
-
-/* Define if your struct tm has tm_zone.  */
-#undef HAVE_TM_ZONE
-
-/* Define if you don't have tm_zone but do have the external array
-   tzname.  */
-#undef HAVE_TZNAME
-
-/* Define if you have <unistd.h>.  */
-#undef HAVE_UNISTD_H
-
-/* Define if utime(file, NULL) sets file's timestamp to the present.  */
-#undef HAVE_UTIME_NULL
-
-/* Define if you have a ut_host field in your struct utmp. */
-#undef HAVE_UTMP_UT_HOST
-
-#undef HAVE_UTMP_UT_NAME
-
-#undef HAVE_UTMP_UT_USER
-
-#undef HAVE_UTMP_UT_PID
-
-#undef HAVE_UTMP_UT_TIME
-
-#undef HAVE_UTMPX_UT_SYSLEN
-
-/* Define if you have <vfork.h>.  */
-#undef HAVE_VFORK_H
-
-/* Define if you have the vprintf function.  */
-#undef HAVE_VPRINTF
-
-/* Define if you have the wait3 system call.  */
-#undef HAVE_WAIT3
-
-/* Define as __inline if that's what the C compiler calls it.  */
-#undef inline
-
-/* Define if chown is promiscuous (regular user can give away ownership) */
-#undef INSECURE_CHOWN
-
-/* Define if int is 16 bits instead of 32.  */
-#undef INT_16_BITS
-
-/* Define if long int is 64 bits.  */
-#undef LONG_64_BITS
-
-/* Define if major, minor, and makedev are declared in <mkdev.h>.  */
-#undef MAJOR_IN_MKDEV
-
-/* Define if major, minor, and makedev are declared in <sysmacros.h>.  */
-#undef MAJOR_IN_SYSMACROS
-
-/* Define if on MINIX.  */
-#undef _MINIX
-
-/* Define to `int' if <sys/types.h> doesn't define.  */
-#undef mode_t
-
-/* Define if you don't have <dirent.h>, but have <ndir.h>.  */
-#undef NDIR
-
-/* Define if you have <memory.h>, and <string.h> doesn't declare the
-   mem* functions.  */
-#undef NEED_MEMORY_H
-
-/* Define if your struct nlist has an n_un member.  */
-#undef NLIST_NAME_UNION
-
-/* Define if you have <nlist.h>.  */
-#undef NLIST_STRUCT
-
-/* Define if your C compiler doesn't accept -c and -o together.  */
-#undef NO_MINUS_C_MINUS_O
-
-/* Define if your Fortran 77 compiler doesn't accept -c and -o together. */
-#undef F77_NO_MINUS_C_MINUS_O
-
-/* Define to `long' if <sys/types.h> doesn't define.  */
-#undef off_t
-
-#undef OS
-
-/* Define to `int' if <sys/types.h> doesn't define.  */
-#undef pid_t
-
-/* Define if the system does not provide POSIX.1 features except
-   with this defined.  */
-#undef _POSIX_1_SOURCE
-
-/* Define if you need to in order for stat and other things to work.  */
-#undef _POSIX_SOURCE
-
-/* Format string for the printf() family for 64 bit integers. */
-#undef PRINTF_LONG_LONG
-
-/* Define if printing a "long long" with "%lld" works . */
-#undef PRINTF_LONG_LONG_LLD
-
-/* Define if printing a "long long" with "%qd" works . */
-#undef PRINTF_LONG_LONG_QD
-
-/* Define if your C compiler supports ANSI C function prototyping. */
-#undef PROTOTYPES
-
-/* Define as the return type of signal handlers (int or void).  */
-#undef RETSIGTYPE
-
-/* Format string for the scanf() family for 64 bit integers. */
-#undef SCANF_LONG_LONG
-
-/* Define if scanning a "long long" with "%lld" works. */
-#undef SCANF_LONG_LONG_LLD
-
-/* Define if scanning a "long long" with "%qd" works. */
-#undef SCANF_LONG_LONG_QD
-  
-/* Define to the type of arg1 for select(). */
-#undef SELECT_TYPE_ARG1
-
-/* Define to the type of args 2, 3 and 4 for select(). */
-#undef SELECT_TYPE_ARG234
-
-/* Define to the type of arg5 for select(). */
-#undef SELECT_TYPE_ARG5
-
-/* Define if the `setpgrp' function takes no argument.  */
-#undef SETPGRP_VOID
-
-/* Define if the setvbuf function takes the buffering type as its second
-   argument and the buffer pointer as the third, as on System V
-   before release 3.  */
-#undef SETVBUF_REVERSED
-
-/* Define to `int' if <sys/signal.h> doesn't define.  */
-#undef sig_atomic_t
-
-/* Define to `unsigned' if <sys/types.h> doesn't define.  */
-#undef size_t
-
-#undef SNPRINTF_TERMINATES
-
-#undef SPRINTF_RETURNS_PTR
-
-/* 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.
-       STACK_DIRECTION > 0 => grows toward higher addresses
-       STACK_DIRECTION < 0 => grows toward lower addresses
-       STACK_DIRECTION = 0 => direction of growth unknown
- */
-#undef STACK_DIRECTION
-
-/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly.  */
-#undef STAT_MACROS_BROKEN
-
-/* Define if you have the ANSI C header files.  */
-#undef STDC_HEADERS
-
-/* Define on System V Release 4.  */
-#undef SVR4
-
-/* Define if you don't have <dirent.h>, but have <sys/dir.h>.  */
-#undef SYSDIR
-
-/* Define if you don't have <dirent.h>, but have <sys/ndir.h>.  */
-#undef SYSNDIR
-
-/* Define if `sys_siglist' is declared by <signal.h>.  */
-#undef SYS_SIGLIST_DECLARED
-
-/* Define to the full path of the Tar program, if you have it. */
-#undef TAR
-
-/* Define if you can safely include both <sys/time.h> and <time.h>.  */
-#undef TIME_WITH_SYS_TIME
-
-/* Define if your <sys/time.h> declares struct tm.  */
-#undef TM_IN_SYS_TIME
-
-/* Define to `int' if <sys/types.h> doesn't define.  */
-#undef uid_t
-
-/* Define for Encore UMAX.  */
-#undef UMAX
-
-/* Result of "uname -a" */
-#undef UNAME
-
-/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
-   instead of <sys/cpustats.h>.  */
-#undef UMAX4_3
-
-/* Define if you do not have <strings.h>, index, bzero, etc..  */
-#undef USG
-
-/* Define vfork as fork if vfork does not work.  */
-#undef vfork
-
-/* Define if the closedir function returns void instead of int.  */
-#undef VOID_CLOSEDIR
-
-/* Define if your processor stores words with the most significant
-   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
-#undef WORDS_BIGENDIAN
-
-/* Define if the X Window System is missing or not being used.  */
-#undef X_DISPLAY_MISSING
-
-/* Define if lex declares yytext as a char * by default, not a char[].  */
-#undef YYTEXT_POINTER
-
-\f
-/* Leave that blank line there!!  Autoheader needs it.
-   If you're adding to this file, keep in mind:
-   The entries are in sort -df order: alphabetical, case insensitive,
-   ignoring punctuation (such as underscores).  */
diff --git a/reactos/apps/utils/net/ncftp/autoconf/aclocal.m4 b/reactos/apps/utils/net/ncftp/autoconf/aclocal.m4
deleted file mode 100644 (file)
index 1c5a95e..0000000
+++ /dev/null
@@ -1,2391 +0,0 @@
-AC_DEFUN(wi_ARG_ENABLE_DEBUG, [
-# if DEBUGBUILD is yes, other macros try to set up a compilation environment
-# with debugging symbols enabled.  Example macros which are affected are
-# wi_CFLAGS and wi_SFLAG.
-#
-DEBUGBUILD=no
-DEBUGCONFIGUREFLAG=""
-AC_ARG_ENABLE(debug,
-[  --enable-debug          enable debugging symbols],
-[
-       DEBUGBUILD=yes
-       DEBUGCONFIGUREFLAG="--enable-debug"
-],[
-       DEBUGBUILD=no
-       DEBUGCONFIGUREFLAG=""
-])
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_EXTRA_IDIR, [
-incdir="$1"
-if test -r $incdir ; then
-       case "$CPPFLAGS" in
-               *${incdir}*)
-                       # echo "   + already had $incdir" 1>&6
-                       ;;
-               *)
-                       if test "$CPPFLAGS" = "" ; then
-                               CPPFLAGS="-I$incdir"
-                       else
-                               CPPFLAGS="$CPPFLAGS -I$incdir"
-                       fi
-                       echo "   + found $incdir" 1>&6
-                       ;;
-       esac
-fi
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_PROG_TAR, [
-TAR=""
-AC_PATH_PROG(TAR, "tar")
-if test -x "$TAR" ; then
-       AC_DEFINE_UNQUOTED(TAR, "$TAR")
-fi
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_EXTRA_LDIR, [
-libdir="$1"
-if test -r $libdir ; then
-       case "$LDFLAGS" in
-               *${libdir}*)
-                       # echo "   + already had $libdir" 1>&6
-                       ;;
-               *)
-                       if test "$LDFLAGS" = "" ; then
-                               LDFLAGS="-L$libdir"
-                       else
-                               LDFLAGS="$LDFLAGS -L$libdir"
-                       fi
-                       echo "   + found $libdir" 1>&6
-                       ;;
-       esac
-fi
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_GNU_LD, [
-AC_MSG_CHECKING([for GNU ld])
-wi_cv_prog_ld="ld"
-result="no"
-x=`ld --version 2>/dev/null | fgrep GNU`
-if test "$x" != "" ; then
-       wi_cv_prog_ld="gld"
-       result="yes"
-fi
-AC_MSG_RESULT($result)
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_LD_READONLY_TEXT, [
-if test "$SYS$wi_cv_prog_ld" = "linuxgld" ; then
-       LDFLAGS="$LDFLAGS -Xlinker -n"
-fi
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_EXTRA_SYSV_SUNOS_DIRS, [
-AC_MSG_CHECKING([for System V compatibility directories])
-AC_MSG_RESULT([])
-wi_EXTRA_IDIR("/usr/5include")
-wi_EXTRA_LDIR("/usr/5lib")
-])
-dnl
-dnl
-dnl If you want to also look for include and lib subdirectories in the
-dnl $HOME tree, you supply "yes" as the first argument to this macro.
-dnl
-dnl If you want to look for subdirectories in include/lib directories,
-dnl you pass the names in argument 3, otherwise pass a dash.
-dnl
-AC_DEFUN(wi_EXTRA_DIRS, [
-AC_MSG_CHECKING([for extra include and lib directories])
-AC_MSG_RESULT([])
-ifelse([$1], yes, [dnl
-b1=`cd .. ; pwd`
-b2=`cd ../.. ; pwd`
-exdirs="$HOME $j $b1 $b2 $prefix $2"
-if test -x "$HOME/bin/OS" ; then
-       b3=`$HOME/bin/OS`
-       b3="$HOME/$b3"
-       if test -d "$b3" ; then
-               exdirs="$b3 $exdirs"
-       fi
-fi
-],[dnl
-exdirs="$prefix $2"
-])
-subexdirs="$3"
-if test "$subexdirs" = "" ; then
-       subexdirs="-"
-fi
-for subexdir in $subexdirs ; do
-if test "$subexdir" = "-" ; then
-       subexdir=""
-else
-       subexdir="/$subexdir"
-fi
-for exdir in $exdirs ; do
-       case "$exdir" in
-               "/usr"|"/"|"//")
-                       if test "$exdir" = "//" ; then exdir="/" ; fi
-                       if test "$subexdir" != ""; then
-                               incdir="${exdir}/include${subexdir}"
-                               wi_EXTRA_IDIR($incdir)
-
-                               libdir="${exdir}/lib${subexdir}"
-                               wi_EXTRA_LDIR($libdir)
-                       fi
-                       ;;
-               *)
-                       if test "$subexdir" = ""; then
-                               incdir="${exdir}/include${subexdir}"
-                               wi_EXTRA_IDIR($incdir)
-
-                               libdir="${exdir}/lib${subexdir}"
-                               wi_EXTRA_LDIR($libdir)
-                       fi
-                       ;;
-       esac
-done
-done
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_HPUX_CFLAGS,
-[AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed)
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([wi_OS_VAR])
-ac_cv_hpux_flags=no
-if test "$os" = hp-ux ; then
-       if test "$ac_cv_prog_gcc" = yes ; then
-               if test "$CFLAGS" != "" ; then
-                       # Shouldn't be in there.
-changequote(<<, >>)dnl
-                       CFLAGS=`echo "$CFLAGS" | sed 's/-A[ae]//g'`
-changequote([, ])dnl
-                       case "$CFLAGS" in
-                               *_HPUX_SOURCE*)
-                                       ;;
-                               *)
-                                       # This is required for the extended
-                                       # namespace.
-                                       #
-                                       CFLAGS="-D_HPUX_SOURCE $CFLAGS"
-                                       ;;
-                       esac
-               fi
-       else
-               # If you're not using gcc, then you better have a cc/c89
-               # that is usable.  If you have the barebones compiler, it
-               # won't work.  The good compiler uses -Aa for the ANSI
-               # compatible stuff.
-changequote(<<, >>)dnl
-               x=`echo "$CFLAGS" | grep 'A[ae]' 2>/dev/null`
-changequote([, ])dnl
-               if test "$x" = "" ; then
-                       CFLAGS="$CFLAGS -Ae"
-               fi
-       fi
-       ac_cv_hpux_flags=yes
-fi
-AC_MSG_RESULT($ac_cv_hpux_flags)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_SFLAG, [AC_REQUIRE([AC_PROG_CC])
-STRIP="strip"
-if test "$SFLAG" = "" ; then
-       SFLAG="-s"
-       case "$OS" in
-               macosx*)
-                       SFLAG='-Wl,-x'
-                       ;;
-       esac
-fi
-#
-# Was it ./configure --enable-debug ?
-#
-if test "$DEBUGBUILD" = yes ; then
-       SFLAG=""
-       STRIP=":"
-fi
-case "$CFLAGS" in
-       "-g"|"-g "*|*" -g"|*" -g "*|*"-g"[0-9]*)
-               # SFLAG="# $SFLAG"
-               SFLAG=""
-               STRIP=":"
-               ;;
-esac
-STRIPFLAG="$SFLAG"
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_REQUEST_NO_Y2K_WARNINGS, [
-       wi_cv_request_no_y2k=yes
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_CFLAGS_NO_Y2K_WARNINGS, [AC_REQUIRE([AC_PROG_CC])
-if test "$ac_cv_prog_gcc" = yes ; then
-       case "$CFLAGS" in
-               *-Wno-format-y2k*)
-                       ;;
-               *)
-                       oldCFLAGS="$CFLAGS"
-                       CFLAGS="$CFLAGS -Wno-format-y2k"
-                       #
-                       # Now check if this version of GCC
-                       # accepts this flag...
-                       #
-AC_TRY_COMPILE([],[int junk;],[],[CFLAGS="$oldCFLAGS"])
-                       unset oldCFLAGS
-                       ;;
-       esac
-fi
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_CFLAGS, [AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE_CPP()
-wi_HPUX_CFLAGS
-       if test "$CFLAGS" = "" ; then
-               AC_MSG_WARN([Your CFLAGS environment variable was not set.  A default of \"-g\" will be used.])
-               CFLAGS="-g"
-       fi
-       if test "x$wi_cv_request_no_y2k" = xyes ; then
-               wi_CFLAGS_NO_Y2K_WARNINGS
-       fi
-       if test "$NOOPTCFLAGS" = "" ; then
-changequote(<<, >>)dnl
-               NOOPTCFLAGS=`echo "$CFLAGS" | sed 's/[-+]O[0-9A-Za-z]*//g;s/-xO[0-9]//g;s/-Wc,-O3//g;s/-IPA//g;s/\ \ */ /g;s/^\ *//;s/\ *$//;'`
-changequote([, ])dnl
-       fi
-       if test "$DEBUGCFLAGS" = "" ; then
-               DEBUGCFLAGS="-g $NOOPTCFLAGS"
-       fi
-       #
-       # Was it ./configure --enable-debug ?
-       #
-       AC_MSG_CHECKING([if this is a debug build])
-       if test "$DEBUGBUILD" = yes ; then
-               AC_MSG_RESULT(yes)
-               CFLAGS="$DEBUGCFLAGS"
-               SFLAG=""
-               STRIPFLAG=""
-               STRIP=":"
-       else
-               AC_MSG_RESULT(no)
-       fi
-       AC_MSG_CHECKING([NOOPTCFLAGS])
-       AC_MSG_RESULT($NOOPTCFLAGS)
-       AC_MSG_CHECKING([DEBUGCFLAGS])
-       AC_MSG_RESULT($DEBUGCFLAGS)
-       AC_MSG_CHECKING([CFLAGS])
-       AC_MSG_RESULT($CFLAGS)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_CFLAGS_LFS64, [AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([wi_OS_VAR])
-wi_CFLAGS
-if test "os_${os}_gcc_${ac_cv_prog_gcc}" = os_hp-ux_gcc_yes ; then
-       case "$CFLAGS" in
-               *__STDC_EXT__*)
-                       ;;
-               *)
-                       # This is required for the extended
-                       # namespace symbols for Large Files.
-                       #
-                       CFLAGS="-D__STDC_EXT__ $CFLAGS"
-                       ;;
-       esac
-fi
-case "$CFLAGS" in
-       *-D_LARGEFILE64_SOURCE*)
-               ;;
-       *)
-               CFLAGS="-D_LARGEFILE64_SOURCE $CFLAGS"
-               ;;
-esac
-AC_MSG_CHECKING([additional CFLAGS for LFS64 support])
-AC_MSG_RESULT($CFLAGS)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_PROTOTYPES, [
-AC_MSG_CHECKING(if the compiler supports function prototypes)
-AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes
-AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no)
-AC_MSG_RESULT($wi_cv_prototypes)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_INSECURE_CHOWN, [
-AC_MSG_CHECKING(if chown can be used to subvert security)
-AC_TRY_RUN([
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-main()
-{
-       int result;
-       char fn[64];
-       FILE *fp;
-       struct stat st;
-
-       setuid(1);      /* if you're root, try set to someone else. */
-       sprintf(fn, "/tmp/fu%06ld", (long) getpid());
-       unlink(fn);
-       fp = fopen(fn, "w");
-       if (fp == NULL)
-               exit(1);        /* assume the worst */
-       fprintf(fp, "%s\n", "hello world");
-       fclose(fp);
-
-       result = chown(fn, 0, 0);
-       if (stat(fn, &st) < 0) {
-               unlink(fn);
-               exit((result == 0) ? 0 : 1);
-       }
-       unlink(fn);
-
-       /* exit(0) if the insecure chown to uid 0 succeeded. */
-       exit((st.st_uid == 0) ? 0 : 1);
-}],[
-       # action if true
-       wi_cv_insecure_chown=yes
-       AC_DEFINE(INSECURE_CHOWN)
-],[
-       # action if false
-       wi_cv_insecure_chown=no
-],[
-       # action if cross-compiling, guess
-       wi_cv_insecure_chown=no
-])
-
-AC_MSG_RESULT($wi_cv_insecure_chown)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_LIB_SNPRINTF, [
-if test "$ac_cv_func_snprintf" = "no" ; then
-       AC_CHECK_LIB(snprintf,snprintf)
-       if test "$ac_cv_lib_snprintf_snprintf" = yes ; then
-               unset ac_cv_func_snprintf
-               AC_CHECK_FUNCS(snprintf)
-       fi
-fi
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_SNPRINTF_TERMINATES, [
-if test "$ac_cv_func_snprintf" != "no" ; then
-AC_MSG_CHECKING(if snprintf always NUL terminates)
-       if test "$ac_cv_func_snprintf" = "no" ; then
-               AC_CHECK_LIB(snprintf,snprintf)
-       fi
-AC_TRY_RUN([
-       /* program */
-#include <stdio.h>
-#include <string.h>
-main()
-{
-       char s[10];
-       int i, result;
-
-       for (i=0; i<(int)(sizeof(s)/sizeof(char)); i++)
-               s[i] = 'x';
-       result = (int) snprintf(s, sizeof(s), "%s %s!", "hello", "world");
-       if (s[sizeof(s) - 1] == '\0')
-               exit(0);
-       exit(1);
-
-}
-],[
-       # action if true
-       wi_cv_snprintf_terminates=no
-       AC_DEFINE(SNPRINTF_TERMINATES)
-       x="yes";
-],[
-       # action if false
-       wi_cv_snprintf_terminates=yes
-       x="no";
-],[
-       # action if cross compiling
-       wi_cv_snprintf_terminates=no
-       x="unknown";
-])
-AC_MSG_RESULT($x)
-fi
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_SNPRINTF, [
-wi_SPRINTF_RETVAL
-dnl Uncache these -- config.cache doesn't cache it right for this case.
-unset ac_cv_func_snprintf
-unset ac_cv_func_vsnprintf
-
-AC_CHECK_FUNCS(snprintf vsnprintf)
-wi_SNPRINTF_TERMINATES
-
-AC_CHECK_HEADERS(snprintf.h)
-wi_LIB_SNPRINTF
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_HEADER_HPSECURITY_H, [
-AC_MSG_CHECKING(for hpsecurity.h)
-wi_cv_header_hpsecurity_h=no
-if test -f /usr/include/hpsecurity.h ; then
-       wi_cv_header_hpsecurity_h=yes
-       AC_DEFINE(HAVE_HPSECURITY_H)
-fi
-AC_MSG_RESULT($wi_cv_header_hpsecurity_h)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_HEADER_SYS_SELECT_H, [
-# See if <sys/select.h> is includable after <sys/time.h>
-if test "$ac_cv_header_sys_time_h" = no ; then
-AC_CHECK_HEADERS(sys/time.h sys/select.h)
-else
-AC_CHECK_HEADERS(sys/select.h)
-fi
-if test "$ac_cv_header_sys_select_h" = yes ; then
-       AC_MSG_CHECKING([if <sys/select.h> is compatible with <sys/time.h>])
-       selecth=yes
-       if test "$ac_cv_header_sys_time_h" = yes ; then
-               AC_TRY_COMPILE([
-#if defined(_AIX) || defined(__aix) || defined(__AIX)
-#      define _ALL_SOURCE 1
-#endif
-#ifdef HAVE_UNISTD_H
-#      include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/select.h>],[
-               fd_set a;
-               struct timeval tmval;
-
-               tmval.tv_sec = 0;],selecth=yes,selecth=no)
-       fi
-       if test "$selecth" = yes ; then
-               AC_DEFINE(CAN_USE_SYS_SELECT_H)
-       fi
-       AC_MSG_RESULT($selecth)
-fi
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_LIB_44BSD, [
-AC_CHECK_FUNC(strerror,[a=yes],[a=no])
-if test "$a" = no ; then
-       # Not in libc, try lib44bsd.
-       AC_CHECK_LIB(44bsd,strerror)
-fi
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_LIB_NSL, [
-dnl Note: Check for socket lib first, then nsl.
-
-case "$OS" in
-       hpux1[123456789]*)
-               # HP-UX 11 uses NSL for YP services
-               AC_CHECK_LIB(nsl,getpwent)
-               ;;
-
-       *)
-               AC_CHECK_FUNC(gethostbyname,[a=yes],[a=no])
-               if test "$a" = no ; then
-                       # Not in libc, try libnsl.
-                       AC_CHECK_LIB(nsl,gethostbyname)
-               fi
-               ;;
-esac
-
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_LIB_SOCKET, [
-AC_CHECK_FUNC(socket,[a=yes],[a=no])
-if test "$a" = no ; then
-       # Not in libc, try libsocket.
-       AC_CHECK_LIB(socket,socket)
-fi
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_LIB_RESOLV, [
-# See if we could access two well-known sites without help of any special
-# libraries, like resolv.
-dnl
-AC_MSG_WARN([the following check may take several minutes if networking is not up.  You may want to bring it up now and restart configure, otherwise please be patient.])
-dnl
-AC_MSG_CHECKING([if we need to look for -lresolv])
-AC_TRY_RUN([
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-main()
-{
-       struct hostent *hp1, *hp2;
-       int result;
-
-       hp1 = gethostbyname("gatekeeper.dec.com");
-       hp2 = gethostbyname("ftp.ncsa.uiuc.edu");
-       result = ((hp1 != (struct hostent *) 0) && (hp2 != (struct hostent *) 0));
-       exit(! result);
-}],look_for_resolv=no,look_for_resolv=yes,look_for_resolv=yes)
-
-AC_MSG_RESULT($look_for_resolv)
-if test "$look_for_resolv" = yes ; then
-AC_CHECK_LIB(resolv,main)
-else
-       ac_cv_lib_resolv=no
-fi
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_LIB_TCP_WRAPPERS, [
-AC_MSG_CHECKING([for tcp wrappers library (libwrap)])
-
-AC_TRY_LINK([
-       /* includes */
-#ifdef HAVE_UNISTD_H
-#      include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-
-/* These are needed if libwrap.a was compiled with
- * PROCESS_OPTIONS defined.
- */
-int allow_severity = 1;        /* arbitrary for this test */
-int deny_severity = 2; /* arbitrary for this test */
-
-],[
-       /* function-body */
-       exit((allow_severity == deny_severity) ? 1 : 0);
-],[
-dnl    ...Don't bother defining this symbol...
-dnl    ...Check for tcpd.h instead...
-dnl    AC_DEFINE(HAVE_LIBWRAP)
-dnl
-dnl    ...Don't modify LIBS, instead set WRAPLIB...
-dnl    LIBS="-lwrap  $LIBS"
-dnl
-       WRAPLIB="-lwrap"
-       wi_cv_lib_wrap_hosts_access=yes
-],[
-       WRAPLIB=""
-       wi_cv_lib_wrap_hosts_access=no
-])
-AC_MSG_RESULT($wi_cv_lib_wrap_hosts_access)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_NET_LIBS, [
-# Mostly for SunOS 4 -- needs to come first because other libs depend on it
-wi_LIB_44BSD
-
-wi_LIB_SOCKET
-
-if test "$SYS" = unixware ; then
-       # So far, only UnixWare needs this.
-       AC_CHECK_LIB(gen,syslog)
-
-       case "$OS" in
-               unixware2*)
-                       if test -f /usr/ucblib/libucb.a ; then
-                               LDFLAGS="$LDFLAGS -L/usr/ucblib"
-                               LIBS="$LIBS -lucb"
-                       fi
-                       if test -f /usr/include/unistd.h ; then
-                               ac_cv_header_unistd_h=yes
-                       fi
-
-                       # UnixWare 2 needs both lsocket and lnsl, and configure
-                       # script won't detect this condition properly because 
-                       # the libraries are interdependent.
-                       #
-                       LIBS="$LIBS -lsocket -lnsl"
-
-                       # Now look for socket()
-                       #
-                       # AC_CHECK_FUNC(socket,[a=yes],[a=no])
-                       #
-                       AC_CHECK_FUNC(socket,[a=yes],[a=no])
-                       ;;
-               *)
-                       ;;
-       esac
-fi
-
-dnl AC_CHECK_LIB(inet,main)
-
-wi_LIB_NSL
-wi_LIB_RESOLV
-
-if test "$SYS" = dynixptx ; then
-       LIBS="$LIBS -lsocket -lnsl"
-fi
-
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_DEFINE_UNAME, [
-# Get first 127 chars of all uname information.  Some folks have
-# way too much stuff there, so grab only the first 127.
-unam=`uname -a 2>/dev/null | cut -c1-127`
-if test "$unam" != "" ; then
-       AC_DEFINE_UNQUOTED(UNAME, "$unam")
-fi
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_FUNC_SIGSETJMP, [
-AC_MSG_CHECKING([for sigsetjmp and siglongjmp])
-
-AC_TRY_LINK([
-       /* includes */
-#ifdef HAVE_UNISTD_H
-#      include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-#include <signal.h>
-#include <setjmp.h>
-],[
-       /* function-body */
-       sigjmp_buf sjb;
-
-       if (sigsetjmp(sjb, 1) != 0)
-               siglongjmp(sjb, 1);     /* bogus code, of course. */
-       exit(0);
-],[
-       AC_DEFINE(HAVE_SIGSETJMP)
-       wi_cv_func_sigsetjmp=yes
-],[
-       wi_cv_func_sigsetjmp=no
-])
-AC_MSG_RESULT($wi_cv_func_sigsetjmp)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_UTMP_UT_NAME, [
-AC_MSG_CHECKING([for ut_name field in struct utmp])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <utmp.h>
-],[
-struct utmp u;
-
-u.ut_name[0] = '\0';
-exit(((int) &u.ut_name) & 0xff);       /* bogus code, of course. */
-],[
-       wi_cv_utmp_ut_name=yes
-       AC_DEFINE(HAVE_UTMP_UT_NAME)
-],[
-       wi_cv_utmp_ut_name=no
-])
-AC_MSG_RESULT($wi_cv_utmp_ut_name)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_UTMPX_UT_SYSLEN, [
-AC_MSG_CHECKING([for ut_syslen field in struct utmpx])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <utmpx.h>
-],[
-struct utmpx u;
-
-u.ut_syslen = 0;
-exit(((int) &u.ut_syslen) & 0xff);     /* bogus code, of course. */
-],[
-       wi_cv_utmpx_ut_syslen=yes
-       AC_DEFINE(HAVE_UTMPX_UT_SYSLEN)
-],[
-       wi_cv_utmpx_ut_syslen=no
-])
-AC_MSG_RESULT($wi_cv_utmpx_ut_syslen)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_UTMP_UT_USER, [
-AC_MSG_CHECKING([for ut_user field in struct utmp])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <utmp.h>
-],[
-struct utmp u;
-
-u.ut_user[0] = '\0';
-exit(((int) &u.ut_user) & 0xff);       /* bogus code, of course. */
-],[
-       wi_cv_utmp_ut_user=yes
-       AC_DEFINE(HAVE_UTMP_UT_USER)
-],[
-       wi_cv_utmp_ut_user=no
-])
-AC_MSG_RESULT($wi_cv_utmp_ut_user)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_UTMP_UT_PID, [
-AC_MSG_CHECKING([for ut_pid field in struct utmp])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <utmp.h>
-],[
-struct utmp u;
-
-u.ut_pid = 1;
-exit(((int) &u.ut_pid) & 0xff);        /* bogus code, of course. */
-],[
-       wi_cv_utmp_ut_pid=yes
-       AC_DEFINE(HAVE_UTMP_UT_PID)
-],[
-       wi_cv_utmp_ut_pid=no
-])
-AC_MSG_RESULT($wi_cv_utmp_ut_pid)
-])
-
-dnl
-dnl
-dnl
-AC_DEFUN(wi_UTMP_UT_TIME, [
-AC_MSG_CHECKING([for ut_time field in struct utmp])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <utmp.h>
-],[
-struct utmp u;
-
-u.ut_time = 1;
-exit(((int) &u.ut_time) & 0xff);       /* bogus code, of course. */
-],[
-       wi_cv_utmp_ut_time=yes
-       AC_DEFINE(HAVE_UTMP_UT_TIME)
-],[
-       wi_cv_utmp_ut_time=no
-])
-AC_MSG_RESULT($wi_cv_utmp_ut_time)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_UTMP_UT_HOST, [
-AC_MSG_CHECKING([for ut_host field in struct utmp])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <utmp.h>
-],[
-struct utmp u;
-
-u.ut_host[0] = '\0';
-exit(((int) &u.ut_host) & 0xff);       /* bogus code, of course. */
-],[
-       wi_cv_utmp_ut_host=yes
-       AC_DEFINE(HAVE_UTMP_UT_HOST)
-],[
-       wi_cv_utmp_ut_host=no
-])
-AC_MSG_RESULT($wi_cv_utmp_ut_host)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_STRUCT_STAT64, [
-AC_MSG_CHECKING([for struct stat64])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-],[
-struct stat64 st;
-
-st.st_size = 0;
-exit(((int) &st.st_size) & 0xff);      /* bogus code, of course. */
-],[
-       wi_cv_struct_stat64=yes
-       AC_DEFINE(HAVE_STRUCT_STAT64)
-],[
-       wi_cv_struct_stat64=no
-])
-AC_MSG_RESULT($wi_cv_struct_stat64)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_STRUCT_CMSGHDR, [
-AC_MSG_CHECKING([for struct cmsghdr])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-],[
-struct cmsghdr cm;
-
-cm.cmsg_len = 0;
-cm.cmsg_level = 0;
-cm.cmsg_type = 0;
-exit(((int) &cm.cmsg_type) & 0xff);    /* bogus code, of course. */
-],[
-       wi_cv_struct_cmsghdr=yes
-       AC_DEFINE(HAVE_STRUCT_CMSGDHR)
-],[
-       wi_cv_struct_cmsghdr=no
-])
-AC_MSG_RESULT($wi_cv_struct_cmsghdr)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_MSGHDR_CONTROL, [
-AC_MSG_CHECKING([for msg_control field in struct msghdr])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-],[
-struct msghdr m;
-
-m.msg_control = &m;
-m.msg_controllen = sizeof(m);
-exit(((int) &m.msg_control) & 0xff);   /* bogus code, of course. */
-],[
-       wi_cv_msghdr_control=yes
-       AC_DEFINE(HAVE_MSGHDR_CONTROL)
-],[
-       wi_cv_msghdr_control=no
-])
-AC_MSG_RESULT($wi_cv_msghdr_control)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_MSGHDR_ACCRIGHTS, [
-AC_MSG_CHECKING([for msg_accrights field in struct msghdr])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-],[
-struct msghdr m;
-
-m.msg_accrights = &m;
-m.msg_accrightslen = sizeof(m);
-exit(((int) &m.msg_accrights) & 0xff); /* bogus code, of course. */
-],[
-       wi_cv_msghdr_accrights=yes
-       AC_DEFINE(HAVE_MSGHDR_ACCRIGHTS)
-],[
-       wi_cv_msghdr_accrights=no
-])
-AC_MSG_RESULT($wi_cv_msghdr_accrights)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_PR_PASSWD_FG_OLDCRYPT, [
-AC_MSG_CHECKING([for fg_oldcrypt field in struct pr_passwd])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <pwd.h>
-#include <grp.h>
-#include <errno.h>
-
-#if defined(HAVE_USERPW_H) && defined(HAVE_GETUSERPW)  /* AIX */
-#      include <userpw.h>
-#elif defined(HAVE_PWDADJ_H) && defined(HAVE_GETPWANAM)        /* SunOS */
-#      include <sys/label.h>
-#      ifdef HAVE_SYS_AUDIT_H
-#              include <sys/audit.h>
-#      endif
-#      include <pwdadj.h>
-#elif defined(HAVE_GETESPWNAM) /* Digital UNIX 4 */
-#      ifdef HAVE_SYS_SECDEFINES_H
-#              include <sys/secdefines.h>
-#      endif
-#      ifdef HAVE_SYS_SECURITY_H
-#              include <sys/security.h>
-#      endif
-#      ifdef HAVE_SYS_AUDIT_H
-#              include <sys/audit.h>
-#      endif
-#      ifdef HAVE_KRB_H
-#              include <krb.h>
-#      endif
-#      ifdef HAVE_PROT_H
-#              include <prot.h>
-#      endif
-#elif defined(HAVE_GETPRPWNAM) /* SCO Open Server V, Digital UNIX 3, HP-UX 10 */
-#      ifdef HAVE_SYS_SECDEFINES_H
-#              include <sys/secdefines.h>
-#      endif
-#      ifdef HAVE_SYS_SECURITY_H
-#              include <sys/security.h>
-#      endif
-#      ifdef HAVE_SYS_AUDIT_H
-#              include <sys/audit.h>
-#      endif
-#      ifdef HAVE_HPSECURITY_H
-#              include <hpsecurity.h>
-#      endif
-#      ifdef HAVE_KRB_H
-#              include <krb.h>
-#      endif
-#      ifdef HAVE_PROT_H
-#              include <prot.h>
-#      endif
-#endif
-],[
-       struct pr_passwd xu;
-       memset(&xu, 0, sizeof(xu));
-       if (xu.uflg.fg_oldcrypt != 0)
-               xu.uflg.fg_oldcrypt++;  /* bogus code, of course */
-       exit(0);
-],[
-       wi_cv_pr_passwd_fg_oldcrypt=yes
-       AC_DEFINE(HAVE_PR_PASSWD_FG_OLDCRYPT)
-],[
-       wi_cv_pr_passwd_fg_oldcrypt=no
-])
-AC_MSG_RESULT($wi_cv_pr_passwd_fg_oldcrypt)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_SOCKADDR_UN_SUN_LEN, [
-AC_MSG_CHECKING([for sun_len field in struct sockaddr_un])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-],[
-struct sockaddr_un uaddr;
-
-uaddr.sun_len = strlen("/tmp/test.sock");
-exit(((int) uaddr.sun_len);    /* bogus code, of course. */
-],[
-       wi_cv_sockaddr_un_sun_len=yes
-       AC_DEFINE(HAVE_SOCKADDR_UN_SUN_LEN)
-],[
-       wi_cv_sockaddr_un_sun_len=no
-])
-AC_MSG_RESULT($wi_cv_sockaddr_un_sun_len)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_STATFS_F_BAVAIL, [
-AC_MSG_CHECKING([for f_bavail field in struct statfs])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#ifdef HAVE_SYS_STATFS_H
-#      include <sys/statfs.h>
-#elif defined(HAVE_SYS_VFS_H)
-#      include <sys/vfs.h>
-#endif
-],[
-struct statfs st;
-
-st.f_bavail = 1;
-exit((int) st.f_bavail);       /* bogus code, of course. */
-],[
-       wi_cv_statfs_f_bavail=yes
-       AC_DEFINE(HAVE_STATFS_F_BAVAIL)
-],[
-       wi_cv_statfs_f_bavail=no
-])
-AC_MSG_RESULT($wi_cv_statfs_f_bavail)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_SPRINTF_RETVAL, [
-AC_MSG_CHECKING([what sprintf() returns])
-AC_TRY_RUN([
-       /* program */
-#include <stdio.h>
-#include <string.h>
-main()
-{
-       int result;
-       char s[8];
-
-       result = (int) sprintf(s, "%d", 22);
-       if (result == 2)
-               exit(0);
-       exit(1);
-
-}
-],[
-       # action if true
-       wi_cv_sprintf_returns_ptr=no
-       x="length of data written";
-],[
-       # action if false
-       wi_cv_sprintf_returns_ptr=yes
-       AC_DEFINE(SPRINTF_RETURNS_PTR)
-       x="pointer to data";
-],[
-       # action if cross compiling
-       wi_cv_sprintf_returns_ptr=no
-       x="unknown";
-])
-AC_MSG_RESULT($x)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_LIB_CRYPT, [
-AC_MSG_CHECKING([which library has usable crypt() function])
-ac_save_LIBS="$LIBS"
-crypt_lib=NONE
-
-for lib in "c" "crypt" "descrypt" "des"
-do
-
-if test "$lib" = "c" ; then
-       LIBS="$ac_save_LIBS"
-else
-       LIBS="$ac_save_LIBS -l${lib}"
-fi
-
-AC_TRY_RUN([
-       /* program */
-#include <stdio.h>
-#include <string.h>
-
-extern char *crypt(const char *key, const char *salt);
-
-main()
-{
-       char cleartext[256];
-       char *cp;
-
-       memset(cleartext, 0, sizeof(cleartext));
-       strcpy(cleartext, "password");
-
-       cp = crypt(cleartext, "xx");
-       if ((cp != NULL) && (strcmp(cp, "xxj31ZMTZzkVA") == 0)) {
-               /* printf("PASS\n"); */
-               exit(0);
-       }
-       /* printf("FAIL\n"); */
-       exit(1);
-}
-],[
-       # action if true
-       crypt_lib="$lib"
-],[
-       # action if false
-       :
-],[
-       # action if cross compiling
-       :
-])
-
-
-if test "$crypt_lib" != NONE ; then
-       break
-fi
-
-done
-
-
-LIBS="$ac_save_LIBS"
-
-if test "$crypt_lib" = NONE ; then
-       crypt_lib=c
-       AC_MSG_RESULT([none?])
-else
-       AC_MSG_RESULT([lib${crypt_lib}])
-fi
-if test "$crypt_lib" != c ; then
-       AC_CHECK_LIB(${lib},crypt)
-fi
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_TEST, [
-changequote(<^, ^>)dnl
-changequote([, ])dnl
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi__RES_DEFDNAME, [
-AC_MSG_CHECKING([for useable _res global variable])
-AC_TRY_LINK([
-       /* includes */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#ifdef HAVE_ARPA_NAMESER_H
-#      include <arpa/nameser.h>
-#endif
-#ifdef HAVE_RESOLV_H
-#      include <resolv.h>
-#endif
-],[
-       /* function-body */
-       int len;
-
-       res_init();
-       len = (int) strlen(_res.defdname);
-],[
-       wi_cv__res_defdname=yes
-       AC_DEFINE(HAVE__RES_DEFDNAME)
-],[
-       wi_cv__res_defdname=no
-])
-AC_MSG_RESULT($wi_cv__res_defdname)
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_TYPE_SIG_ATOMIC_T, [
-AC_MSG_CHECKING([for sig_atomic_t])
-AC_TRY_LINK([
-       /* includes */
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <sys/signal.h>
-#include <signal.h>    /* MG: for IRIX */
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-],[
-       /* function-body */
-       sig_atomic_t sample;
-
-       sample = (sig_atomic_t) getpid();       /* bogus code, of course */
-       exit((sample > 0) ? 0 : 1);
-],[
-       ac_cv_type_sig_atomic_t=yes
-],[
-       ac_cv_type_sig_atomic_t=no
-])
-AC_MSG_RESULT($ac_cv_type_sig_atomic_t)
-if test $ac_cv_type_sig_atomic_t = no ; then
-       AC_DEFINE(sig_atomic_t, int)
-fi
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_LIB_READLINE, [
-AC_MSG_CHECKING([for GNU Readline library, version 2.0 or newer])
-
-wi_cv_lib_readline=no
-wi_cv_lib_readline_result=no
-ac_save_LIBS="$LIBS"
-# Note: $LIBCURSES is permitted to be empty.
-for LIBREADLINE in "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses"
-do
-       LIBS="$ac_save_LIBS $LIBREADLINE"
-       AC_TRY_RUN([
-       /* program */
-#include <stdio.h>
-#include <stdlib.h>
-main(int argc, char **argv)
-{
-       /* Note:  don't actually call readline, since it may block;
-        * We just want to see if it (dynamic) linked in okay.
-        */
-       if (argc == 0)  /* never true */
-               readline(0);
-       exit(0);
-}
-],[
-       # action if true
-       wi_cv_lib_readline=yes
-],[
-       # action if false
-       wi_cv_lib_readline=no
-],[
-       # action if cross compiling
-       wi_cv_lib_readline=no
-])
-
-       if test "$wi_cv_lib_readline" = yes ; then break ; fi
-done
-
-# Now try it again, to be sure it is recent enough.
-# rl_function_of_keyseq appeared in version 2.0
-#
-dnl AC_CHECK_FUNC(rl_function_of_keyseq, [wi_cv_lib_readline=yes],[
-dnl    wi_cv_lib_readline=no;wi_cv_lib_readline_result="no (it is present but too old to use)"
-dnl ])
-       AC_TRY_LINK([
-               /* includes */
-       ],[
-               /* function-body */
-               readline(0);
-               rl_function_of_keyseq(0);
-       ],[
-               wi_cv_lib_readline=yes
-       ],[
-               wi_cv_lib_readline=no
-               wi_cv_lib_readline_result="no (it is present but too old to use)"
-       ])
-
-if test "$wi_cv_lib_readline" = no ; then
-       LIBREADLINE=""
-       # restore LIBS
-       LIBS="$ac_save_LIBS"
-else
-       /bin/rm -f readline.ver
-       touch readline.ver
-
-       AC_TRY_RUN([
-       /* program */
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdio.h>
-
-extern char *rl_library_version;
-
-main()
-{
-       FILE *fp;
-       double d;
-
-       sscanf(rl_library_version, "%lf", &d);
-       fp = fopen("readline.ver", "w");
-       if (fp == NULL) exit(1);
-       if (fprintf(fp, "%s\n", rl_library_version) < 0) exit(1);
-       if (fprintf(fp, "%03d\n", (int) (d * 100.0)) < 0) exit(1);
-       if (fclose(fp) < 0) exit(1);
-       exit(0);
-}
-       ],[
-               # action if true
-               rl_library_version=`sed -n 1,1p readline.ver 2>/dev/null`
-               rlver=`sed -n 2,2p readline.ver 2>/dev/null`
-               /bin/rm -f readline.ver
-       ],[
-               # action if false
-               rl_library_version=''
-               rlver=''
-               /bin/rm -f readline.ver
-       ],[
-               # action if cross compiling
-               rl_library_version=''
-               rlver=''
-               /bin/rm -f readline.ver
-       ])
-
-       case "$rlver" in
-               ???)
-                       wi_cv_lib_readline_result="yes, installed version is $rl_library_version"
-                       ;;
-               *)
-                       # Test using current LIBS.
-                       AC_TRY_LINK([
-                               /* includes */
-                               extern int rl_completion_append_character;
-                       ],[
-                               /* function-body */
-                               readline(0);
-                               rl_completion_append_character = 0;
-                       ],[
-                               rlver="210"
-                       ],[
-                               rlver="200"
-                       ])
-
-                       if test "$rlver" = "210" ; then
-                               wi_cv_lib_readline_result="yes, version 2.1 or higher"
-                       else
-                               wi_cv_lib_readline_result="yes, version 2.0"
-                       fi
-                       ;;
-       esac
-
-       wi_cv_lib_readline=yes
-       # restore LIBS
-       LIBS="$ac_save_LIBS"
-fi
-AC_MSG_RESULT($wi_cv_lib_readline_result)
-AC_SUBST(LIBREADLINE)
-
-if test "$wi_cv_lib_readline" = yes ; then
-       # Now verify that all the headers are installed.
-       #
-       AC_REQUIRE_CPP()
-       unset ac_cv_header_readline_chardefs_h
-       unset ac_cv_header_readline_history_h
-       unset ac_cv_header_readline_keymaps_h
-       unset ac_cv_header_readline_readline_h
-       unset ac_cv_header_readline_tilde_h
-       AC_CHECK_HEADERS([readline/chardefs.h readline/history.h readline/keymaps.h readline/readline.h readline/tilde.h])
-
-       for xxwi in \
-               "$ac_cv_header_readline_chardefs_h" \
-               "$ac_cv_header_readline_history_h" \
-               "$ac_cv_header_readline_keymaps_h" \
-               "$ac_cv_header_readline_readline_h" \
-               "$ac_cv_header_readline_tilde_h" 
-       do
-               if test "$xxwi" = no ; then
-                       break
-               fi
-       done
-
-       if test "$xxwi" = no ; then
-               AC_MSG_WARN([GNU Readline headers are not installed or could not be found -- GNU Readline will not be used.])
-               wi_cv_lib_readline=no
-               wi_cv_lib_readline_result="no (headers not installed)"
-       else
-               AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, $rlver)
-       fi
-fi
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_USE_LONG_LONG, [
-AC_MSG_CHECKING([for 64-bit integral type: long long])
-LONGEST_INT="long"
-AC_TRY_RUN([
-       /* program */
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdio.h>
-
-long long hugeNumvar = 1;
-
-main()
-{
-       long long hugeNumtoo = 2;
-
-       if (hugeNumtoo > hugeNumvar)
-               hugeNumvar++;
-       if (sizeof(hugeNumvar) < 8)
-               exit(1);
-       exit(0);
-}
-
-],[
-       # action if true
-       wi_cv_type_long_long=yes
-       LONGEST_INT="long long"
-],[
-       # action if false
-       wi_cv_type_long_long=no
-],[
-       # action if cross compiling
-       wi_cv_type_long_long=no
-])
-AC_MSG_RESULT($wi_cv_type_long_long)
-
-if test "$wi_cv_type_long_long" = yes ; then
-       
-AC_MSG_CHECKING([how to print a 64-bit integral type])
-wi_cv_printf_long_long=fail
-
-AC_TRY_RUN([
-       /* program */
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-main()
-{
-       char s[80];
-       long long hugeNum;
-
-       hugeNum = (long long) 1000000000;
-       hugeNum = hugeNum * (long long) 99;
-       hugeNum = hugeNum + (long long) 1;
-
-       (void) sprintf(s, "%lld", hugeNum);
-       exit((strcmp(s, "99000000001") == 0) ? 0 : 1);
-}
-],[
-       # action if true
-       wi_cv_printf_long_long="%lld"
-],[
-       # action if false
-       :
-],[
-       # action if cross compiling
-       :
-])
-
-
-if test "$wi_cv_printf_long_long" = fail ; then
-
-AC_TRY_RUN([
-       /* program */
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-main()
-{
-       char s[80];
-       long long hugeNum;
-
-       hugeNum = (long long) 1000000000;
-       hugeNum = hugeNum * (long long) 99;
-       hugeNum = hugeNum + (long long) 1;
-
-       (void) sprintf(s, "%qd", hugeNum);
-       exit((strcmp(s, "99000000001") == 0) ? 0 : 1);
-}
-],[
-       # action if true
-       wi_cv_printf_long_long="%qd"
-],[
-       # action if false
-       :
-],[
-       # action if cross compiling
-       :
-])
-fi
-
-if test "$wi_cv_printf_long_long" = fail ; then
-       wi_cv_printf_long_long_msg_result='cannot print'
-else
-       wi_cv_printf_long_long_msg_result="$wi_cv_printf_long_long"
-fi
-
-AC_MSG_RESULT($wi_cv_printf_long_long_msg_result)
-
-       
-AC_MSG_CHECKING([how to scan a 64-bit integral type])
-wi_cv_scanf_long_long=fail
-
-AC_TRY_RUN([
-       /* program */
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-main()
-{
-       long long hugeNum, justAsHugeNum;
-
-       hugeNum = (long long) 1000000000;
-       hugeNum = hugeNum * (long long) 99;
-       hugeNum = hugeNum + (long long) 1;
-
-       justAsHugeNum = (long long) 0;
-       --justAsHugeNum;
-       sscanf("99000000001", "%lld", &justAsHugeNum);
-       if (memcmp(&hugeNum, &justAsHugeNum, sizeof(hugeNum)) == 0)
-               exit(0);
-       exit(1);
-}
-],[
-       # action if true
-       wi_cv_scanf_long_long="%lld"
-],[
-       # action if false
-       :
-],[
-       # action if cross compiling
-       :
-])
-
-
-if test "$wi_cv_scanf_long_long" = fail ; then
-
-AC_TRY_RUN([
-       /* program */
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-main()
-{
-       long long hugeNum, justAsHugeNum;
-
-       hugeNum = (long long) 1000000000;
-       hugeNum = hugeNum * (long long) 99;
-       hugeNum = hugeNum + (long long) 1;
-
-       justAsHugeNum = (long long) 0;
-       --justAsHugeNum;
-       sscanf("99000000001", "%qd", &justAsHugeNum);
-       if (memcmp(&hugeNum, &justAsHugeNum, sizeof(hugeNum)) == 0)
-               exit(0);
-       exit(1);
-}
-],[
-       # action if true
-       wi_cv_scanf_long_long="%qd"
-],[
-       # action if false
-       :
-],[
-       # action if cross compiling
-       :
-])
-fi
-
-if test "$wi_cv_scanf_long_long" = fail ; then
-       wi_cv_scanf_long_long_msg_result='cannot scan'
-else
-       wi_cv_scanf_long_long_msg_result="$wi_cv_scanf_long_long"
-fi
-
-AC_MSG_RESULT($wi_cv_scanf_long_long_msg_result)
-
-fi
-
-AC_MSG_CHECKING([if everything was available to use the 64-bit integral type])
-
-if test "$wi_cv_type_long_long" = no ; then
-       wi_cv_use_long_long_msg_result="no (long long type not available)"
-       wi_cv_use_long_long="no"
-       wi_cv_scanf_long_long="fail"
-       wi_cv_prihtf_long_long="fail"
-       LONGEST_INT="long"
-elif test "$wi_cv_printf_long_long" = fail ; then
-       wi_cv_use_long_long_msg_result="no (libc printf() does not support them)"
-       wi_cv_use_long_long="no"
-       wi_cv_scanf_long_long="fail"
-       wi_cv_prihtf_long_long="fail"
-       LONGEST_INT="long"
-elif test "$wi_cv_scanf_long_long" = fail ; then
-       wi_cv_use_long_long_msg_result="no (libc scanf() does not support them)"
-       wi_cv_use_long_long="no"
-       wi_cv_scanf_long_long="fail"
-       wi_cv_prihtf_long_long="fail"
-       LONGEST_INT="long"
-else
-       AC_DEFINE(HAVE_LONG_LONG)
-       if test "$wi_cv_printf_long_long$wi_cv_scanf_long_long" = "%lld%qd" ; then
-               # FreeBSD 3.2 has %lld and %qd, but we want to
-               # run on 3.1 and 3.0.
-               #
-               wi_cv_printf_long_long="%qd"
-       fi
-       AC_DEFINE_UNQUOTED(PRINTF_LONG_LONG, "$wi_cv_printf_long_long")
-       AC_DEFINE_UNQUOTED(SCANF_LONG_LONG , "$wi_cv_scanf_long_long")
-       if test "$wi_cv_printf_long_long" = "%qd" ; then
-               AC_DEFINE(PRINTF_LONG_LONG_QD)
-       else
-               AC_DEFINE(PRINTF_LONG_LONG_LLD)
-       fi
-       if test "$wi_cv_scanf_long_long" = "%qd" ; then
-               AC_DEFINE(SCANF_LONG_LONG_QD)
-       else
-               AC_DEFINE(SCANF_LONG_LONG_LLD)
-       fi
-       wi_cv_use_long_long="yes"
-       wi_cv_use_long_long_msg_result="yes"
-fi
-AC_MSG_RESULT($wi_cv_use_long_long_msg_result)
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_CREATE_TAR_FILES, [
-AC_MSG_CHECKING([how to create TAR files])
-changequote(<<, >>)dnl
-TAR=/usr/bin/tar
-if [ ! -f /usr/bin/tar ] && [ -f /bin/tar ] ; then
-       TAR=/bin/tar
-fi
-x=""
-if [ -x /usr/bin/what ] ; then
-       x=`/usr/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'`
-elif [ -x /bin/what ] ; then
-       x=`/bin/what "$TAR" 2>&1 | sed -n 's/.*pax.*/pax/g;/pax/p'`
-fi
-if [ "x$x" != "xpax" ] ; then
-       # The junk above is because Mac OS X Server's tar freaks out
-       # and does not exit if you do "tar --help".
-       #
-       x=`$TAR --help 2>&1 | sed -n 's/.*owner=NAME.*/owner=NAME/g;/owner=NAME/p'`
-fi
-case "$x" in
-       *owner=NAME*)
-               TARFLAGS="-c --owner=root --group=bin --verbose -f"
-               ;;
-       *)
-               TARFLAGS="cvf"
-               x2=`gtar --help 2>&1 | sed -n 's/.*owner=NAME.*/owner=NAME/g;/owner=NAME/p'`
-               case "$x2" in
-                       *owner=NAME*)
-                               TARFLAGS="-c --owner=root --group=bin --verbose -f"
-                               TAR=gtar
-                               ;;
-               esac
-               ;;
-esac
-changequote([, ])dnl
-AC_SUBST(TARFLAGS)
-AC_SUBST(TAR)
-AC_MSG_RESULT([$TAR $TARFLAGS])
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_HEADER_CURSES, [
-AC_MSG_CHECKING([for curses library headers])
-if test "$nc_cv_ncurses" != "no" ; then
-       AC_CHECK_HEADERS(ncurses.h curses.h)
-else
-       AC_CHECK_HEADERS(curses.h)
-fi
-dnl needed for Solaris 7
-if test "$ac_cv_header_curses_h" = no ; then
-       if test -f /usr/include/curses.h ; then
-               AC_DEFINE(HAVE_CURSES_H)
-               ac_cv_header_curses_h=yes
-       fi
-fi
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_LIB_CURSES, [
-wi_HEADER_CURSES
-AC_MSG_CHECKING([for curses library])
-
-wi_cv_lib_curses=no
-wi_cv_lib_curses_result=no
-ac_save_LIBS="$LIBS"
-for LIBCURSES in "-lncurses" "-lcurses" "-lcurses -ltermcap" "-ltermcap -lcurses"
-do
-       if test "x$LIBCURSES-$nc_cv_ncurses" = "x-lncurses-no" ; then
-               # This should never work
-               LIBCURSES="-lkdfjkdjfs"
-       fi
-       LIBS="$ac_save_LIBS $LIBCURSES"
-       AC_TRY_RUN([
-       /* program */
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef HAVE_NCURSES_H
-#      include <ncurses.h>
-#else
-#      include <curses.h>
-#endif
-
-main(int argc, char **argv)
-{
-       /* Note:  don't actually call curses, since it may block;
-        * We just want to see if it (dynamic) linked in okay.
-        */
-       if (argc == 4)
-               initscr();
-       exit(0);
-}
-],[
-       # action if true
-       wi_cv_lib_curses=yes
-       wi_cv_lib_curses_result="yes"
-],[
-       # action if false
-       wi_cv_lib_curses=no
-],[
-       # action if cross compiling
-       wi_cv_lib_curses=no
-])
-
-       if test "$wi_cv_lib_curses" = yes ; then break ; fi
-done
-
-# restore LIBS
-LIBS="$ac_save_LIBS"
-
-if test "$wi_cv_lib_curses_result" != "no" ; then
-       case "$LIBCURSES" in
-               "-lncurses")
-                       AC_DEFINE(HAVE_LIBNCURSES)
-                       ;;
-               "-lcurses")
-                       AC_DEFINE(HAVE_LIBCURSES)
-                       ;;
-               "-lcurses -ltermcap")
-                       AC_DEFINE(HAVE_LIBCURSES)
-                       ;;
-               "-ltermcap -lcurses")
-                       AC_DEFINE(HAVE_LIBCURSES)
-                       ;;
-       esac
-else
-       LIBCURSES=''
-fi
-
-AC_SUBST(LIBCURSES)
-AC_MSG_RESULT([$wi_cv_lib_curses_result])
-])
-dnl
-dnl
-dnl
-dnl
-AC_DEFUN(wi_CURSES_FEATURES, [
-if test "$wi_cv_lib_curses" = "yes" ; then
-       # Then $LIBCURSES is a list of curses and support libraries.
-       ac_save_LIBS="$LIBS";
-       LIBS="$LIBS $LIBCURSES";
-
-
-       # maxx or _maxx
-       AC_MSG_CHECKING([whether curses structure has maxx or _maxx field])
-       AC_TRY_COMPILE([
-       /* includes */
-#ifdef HAVE_UNISTD_H
-#      include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef HAVE_NCURSES_H
-#      include <ncurses.h>
-#else
-#      include <curses.h>
-#endif
-],[
-               WINDOW *w;
-       
-               w = newwin(10, 10, 1, 1);
-               w->maxx = 0;
-],[
-AC_MSG_RESULT([maxx])
-],[
-AC_DEFINE(HAVE__MAXX)
-AC_MSG_RESULT([_maxx])
-])
-
-       AC_CHECK_FUNCS(__getmaxx __getmaxy __getbegx __getbegy)
-
-       # getbegx
-       AC_MSG_CHECKING([for getbegx() functionality in curses library])
-       AC_TRY_LINK([
-       /* includes */
-#ifdef HAVE_UNISTD_H
-#      include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef HAVE_NCURSES_H
-#      include <ncurses.h>
-#else
-#      include <curses.h>
-#endif
-
-],[
-       /* function-body */
-       WINDOW *junk = 0;
-       int mx = 0;
-
-       mx = getbegx(junk);
-       exit(0);
-],[
-       AC_DEFINE(HAVE_GETBEGX)
-       AC_MSG_RESULT([yes])
-],[
-       AC_MSG_RESULT([no])
-])
-
-
-       # getmaxx
-       AC_MSG_CHECKING([for getmaxx() functionality in curses library])
-       AC_TRY_LINK([
-       /* includes */
-#ifdef HAVE_UNISTD_H
-#      include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef HAVE_NCURSES_H
-#      include <ncurses.h>
-#else
-#      include <curses.h>
-#endif
-],[
-       /* function-body */
-       WINDOW *junk = 0;
-       int mx = 0;
-
-       mx = getmaxx(junk);
-       exit(0);
-],[
-       AC_DEFINE(HAVE_GETMAXX)
-       AC_MSG_RESULT([yes])
-],[
-       AC_MSG_RESULT([no])
-])
-
-       # getmaxyx
-       AC_MSG_CHECKING([for getmaxyx() functionality in curses library])
-       AC_TRY_LINK([
-       /* includes */
-#ifdef HAVE_UNISTD_H
-#      include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef HAVE_NCURSES_H
-#      include <ncurses.h>
-#else
-#      include <curses.h>
-#endif
-],[
-       /* function-body */
-       WINDOW *junk = 0;
-       int mx = 0, my = 0;
-
-       getmaxyx(junk, my, mx);
-       exit(my < 0 ? my : 0);
-],[
-       AC_DEFINE(HAVE_GETMAXYX)
-       AC_MSG_RESULT([yes])
-],[
-       AC_MSG_RESULT([no])
-])
-
-       # touchwin
-       AC_MSG_CHECKING([for touchwin() functionality in curses library])
-       AC_TRY_LINK([
-       /* includes */
-#ifdef HAVE_UNISTD_H
-#      include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef HAVE_NCURSES_H
-#      include <ncurses.h>
-#else
-#      include <curses.h>
-#endif
-],[
-       /* function-body */
-       WINDOW *junk = 0;
-       touchwin(junk);
-       exit(0);
-],[
-       AC_DEFINE(HAVE_TOUCHWIN)
-       AC_MSG_RESULT([yes])
-],[
-       AC_MSG_RESULT([no])
-])
-
-       # beep
-       AC_MSG_CHECKING([for beep() functionality in curses library])
-       AC_TRY_LINK([
-       /* includes */
-#ifdef HAVE_UNISTD_H
-#      include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef HAVE_NCURSES_H
-#      include <ncurses.h>
-#else
-#      include <curses.h>
-#endif
-],[
-       /* function-body */
-       beep();
-       exit(getpid() & 1);
-],[
-       AC_DEFINE(HAVE_BEEP)
-       AC_MSG_RESULT([yes])
-],[
-       AC_MSG_RESULT([no])
-])
-
-       AC_CHECK_FUNCS(keypad nodelay curs_set doupdate wnoutrefresh)
-
-       LIBS="$ac_save_LIBS";
-fi
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_SHADOW_FUNCS, [
-AC_CHECK_FUNCS(md5_crypt md5crypt bcrypt getspnam)
-
-# UnixWare 7
-if test "$ac_cv_func_getspnam" = no ; then
-       unset ac_cv_func_getspnam
-       AC_CHECK_LIB(gen,getspnam)
-       if test "$ac_cv_lib_gen_getspnam" = yes ; then
-               AC_CHECK_FUNCS(getspnam)
-       fi
-fi
-
-# AIX
-#
-case "$SYS" in
-       "aix"|"")
-               AC_CHECK_FUNCS(getuserpw)
-               ;;
-       *)
-               ;;
-esac
-
-# C2: SCO Open Server 5; Digital UNIX
-AC_CHECK_FUNCS(set_auth_parameters bigcrypt)
-
-# C2: Digital UNIX 3.2, 4.0; SCO Open Server 5; HP-UX 11
-AC_CHECK_FUNCS(getprpwnam)
-
-# Digital UNIX 4.0
-AC_CHECK_FUNCS(getespwnam get_num_crypts get_crypt_name)
-
-# Digital Unix 4.0
-AC_CHECK_FUNCS(dispcrypt)
-
-# SunOS
-AC_CHECK_FUNCS(getpwanam)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_SHADOW_HEADERS, [
-AC_CHECK_HEADERS(shadow.h crypt.h)
-
-# AIX
-AC_CHECK_HEADERS(userpw.h)
-
-# SunOS
-AC_CHECK_HEADERS(pwdadj.h)
-
-# HP-UX
-#
-# Bug in header on these version 10 which cause is it not
-# to get detected.
-#
-wi_HEADER_HPSECURITY_H
-
-# SCO Open Server, Digital UNIX
-AC_CHECK_HEADERS(sys/security.h sys/audit.h krb.h prot.h)
-
-# Digital UNIX
-AC_CHECK_HEADERS(sys/secdefines.h)
-
-# Digital UNIX
-wi_PR_PASSWD_FG_OLDCRYPT
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_SHADOW_LIBS, [
-check_for_libcrypt=yes
-
-# AIX security library is libs.a
-AC_CHECK_LIB(s,getuserpw)
-if test "$ac_cv_lib_s" = yes ; then
-       check_for_libcrypt=no
-elif test "$ac_cv_lib_s_getuserpw" = yes ; then
-       check_for_libcrypt=no
-fi
-
-# SCO OpenServer 5 stuff for shadow password
-AC_CHECK_LIB(x,nap)
-AC_CHECK_LIB(prot,getprpwnam)
-
-# Digital UNIX
-AC_CHECK_LIB(security,endprpwent)
-
-# HP-UX
-AC_CHECK_LIB(sec,getprpwnam)
-
-if test "$ac_cv_lib_sec_getprpwnam" = no ; then
-       # DYNIX/ptx
-       AC_CHECK_LIB(sec,getspnam)
-fi
-
-if test "$check_for_libcrypt" = yes ; then
-       wi_LIB_CRYPT
-fi
-AC_CHECK_FUNCS(crypt)
-])
-dnl
-dnl
-dnl
-AC_DEFUN(wi_OS_VAR, [
-changequote(!@, @!)dnl
-if [ -x "$HOME/bin/OS" ] ; then
-       HOME_OS=`$HOME/bin/OS`
-       HOME_OS="$HOME/$HOME_OS"
-fi
-host=`uname -n 2>/dev/null | tr '[A-Z]' '[a-z]'`
-os=`uname -s 2>/dev/null | tr '[A-Z]' '[a-z]'`
-dnl work around inability to use $1
-os_v=`uname -v 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.]*$//;s/pre.*//;s/test.*//' | awk '-F[-/: ]' '{n = 1; print $n; }'`
-os_r=`uname -r 2>/dev/null | sed 's/^[^0-9.]*//;s/[^0-9.]*$//;s/pre.*//;s/test.*//' | awk '-F[-/: ]' '{n = 1; print $n; }'`
-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]'`
-OS=''
-SYS=''
-NDEFS=''
-
-# Special case a few systems where if your CFLAGS appear
-# to want to generate for 32 bit, use that mode rather
-# than 64 bit.
-#
-case "$os,$CFLAGS" in
-       irix64,*-n32*)
-               os=irix
-               # then go to regular "irix" instead of "irix64" below.
-               ;;
-esac
-
-case "$os" in
-       osf1)
-               case "$os_r" in
-                       3*|4*)
-                               OS="digitalunix${os_r}-$arch"
-                               SYS=digitalunix
-                               ;;
-                       *)
-                               OS="tru64unix${os_r}-$arch"
-                               SYS=tru64unix
-                               ;;
-               esac
-               NDEFS="$NDEFS -DDIGITAL_UNIX=$os_r1"
-               ;;
-       aix)
-               OS="aix${os_v}.${os_r}"
-               SYS=aix
-               NDEFS="$NDEFS -DAIX=${os_v}"
-               ;;
-       irix)
-               OS="irix${os_r}"
-               SYS=irix
-               NDEFS="$NDEFS -DIRIX=$os_r1"
-               ;;
-       irix64)
-               OS="irix64_${os_r}"
-               SYS=irix64
-               NDEFS="$NDEFS -DIRIX=$os_r1 -DIRIX64=$os_r1"
-               ;;
-       hp-ux)
-               os_r=`echo "${os_r}" | cut -d. -f2-`
-               os_r1=`echo "$os_r" | cut -d. -f1`
-               os_r2=`echo "${os_r}" | cut -d. -f2`
-               os_int=`expr "$os_r1" '*' 100 + "$os_r2"`
-               OS="hpux${os_r}"
-               SYS=hpux
-               NDEFS="$NDEFS -DHPUX=$os_int"
-               ;;
-       freebsd)
-               OS="freebsd${os_r}-$arch"
-               os_r1=`echo "$os_r" | cut -d. -f1`
-               os_r2=`echo "$os_r" | cut -d. -f2`
-               os_r3=`echo "$os_r" | cut -d. -f3`
-               if [ "$os_r3" = "" ] ; then os_r3=0 ; fi
-               os_int=`expr "$os_r1" '*' 100 + "$os_r2" '*' 10 + "$os_r3"`
-               SYS=freebsd
-               NDEFS="$NDEFS -DFREEBSD=$os_int"
-               ;;
-       netbsd)
-               OS="netbsd${os_r}-$arch"
-               NDEFS="$NDEFS -DNETBSD=$os_r1"
-               SYS=netbsd
-               ;;
-       openbsd)
-               OS="openbsd${os_r}-$arch"
-               SYS=openbsd
-               NDEFS="$NDEFS -DOPENBSD=$os_r1"
-               ;;
-       sco*)
-               OS=scosv
-               SYS=sco
-               NDEFS="$NDEFS -DSCO=$os_r1"
-               ;;
-       dynix*)
-               OS="dynixptx${os_v}"
-               SYS=dynixptx
-               os_v1=`echo "$os_v" | cut -d. -f1`
-               os_v2=`echo "$os_v" | cut -d. -f2`
-               os_v3=`echo "$os_v" | cut -d. -f3`
-               if [ "$os_v3" = "" ] ; then os_v3=0 ; fi
-               os_int=`expr "$os_v1" '*' 100 + "$os_v2" '*' 10 + "$os_v3"`
-               NDEFS="$NDEFS -DDYNIX=$os_int"
-               ;;
-       linux)
-               case "$arch" in
-                       *86)
-                               arch=x86
-                               ;;
-               esac
-
-               libc=""
-               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`
-               os_int=`expr "$os_r1" '*' 10000 + "$os_r2" '*' 1000 + "$os_r3"`
-               NDEFS="$NDEFS -DLINUX=$os_int"
-
-               vertest="./vertest.$$"
-               /bin/rm -f "$vertest" "$vertest.c"
-               cat <<EOF > "$vertest.c"
-#include <stdio.h>
-#include <gnu/libc-version.h>
-
-main()
-{
-       const char *ver = gnu_get_libc_version();
-       const char *rel = gnu_get_libc_release();
-
-       fprintf(stdout, "glibc%s\n", ver);
-       exit(0);
-}
-EOF
-               echo $ac_n "checking version of C library""... $ac_c" 1>&6
-               echo "configure:: checking version of C library" >&5
-               ${CC-cc} $DEFS $CPPFLAGS $CFLAGS "$vertest.c" -o "$vertest" >/dev/null 2>&1
-               if [ -x "$vertest" ] ; then libc=`$vertest` ; fi
-               /bin/rm -f "$vertest" "$vertest.c"
-
-               case "$libc" in
-                       glibc*)
-                               echo "$libc" 1>&6
-                               glibc_r=`echo "$libc" | sed 's/glibc//'`
-                               glibc_r1=`echo "$glibc_r" | cut -d. -f1`
-                               glibc_r2=`echo "$glibc_r" | cut -d. -f2`
-                               glibc_r3=`echo "$glibc_r" | cut -d- -f1 | cut -d. -f3`
-                               glibc_int=`expr "$glibc_r1" '*' 10000 + "$glibc_r2" '*' 1000 + "$glibc_r3"`
-                               NDEFS="$NDEFS -DLINUX_GLIBC=$glibc_int"
-                               libc="glibc${glibc_r1}.${glibc_r2}"
-                               OS="linux-$arch"
-                               ;;
-                       *)
-                               if test -f /lib/libc-2.2.2.so ; then
-                                       NDEFS="$NDEFS -DLINUX_GLIBC=22002"
-                                       libc="glibc2.2"
-                                       OS="linux-$arch"
-                               elif test -f /lib/libc-2.2.1.so ; then
-                                       NDEFS="$NDEFS -DLINUX_GLIBC=22001"
-                                       libc="glibc2.2"
-                                       OS="linux-$arch"
-                               elif test -f /lib/libc-2.2.0.so ; then
-                                       NDEFS="$NDEFS -DLINUX_GLIBC=22000"
-                                       libc="glibc2.1"
-                                       OS="linux-$arch"
-                               elif test -f /lib/libc-2.1.3.so ; then
-                                       NDEFS="$NDEFS -DLINUX_GLIBC=21003"
-                                       libc="glibc2.1"
-                                       OS="linux-$arch"
-                               elif test -f /lib/libc-2.1.2.so ; then
-                                       NDEFS="$NDEFS -DLINUX_GLIBC=21002"
-                                       libc="glibc2.1"
-                                       OS="linux-$arch"
-                               elif test -f /lib/libc-2.1.1.so ; then
-                                       NDEFS="$NDEFS -DLINUX_GLIBC=21001"
-                                       libc="glibc2.1"
-                                       OS="linux-$arch"
-                               elif test -f /lib/libc.so.6 ; then
-                                       NDEFS="$NDEFS -DLINUX_GLIBC=20000"
-                                       libc="glibc2.0"
-                                       OS="linux-$arch"
-                               elif test -f /lib/libc.so.6.1 ; then
-                                       NDEFS="$NDEFS -DLINUX_GLIBC=20001"
-                                       libc="glibc2.0"
-                                       OS="linux-$arch"
-                               else
-                                       NDEFS="$NDEFS -DLINUX_LIBC=5"
-                                       libc="libc5"
-                                       OS="linux-$arch"
-                               fi
-                               echo "$libc" 1>&6
-                               ;;
-               esac
-               SYS=linux
-               ;;
-       bsd/os)
-               OS="bsdos${os_r}"
-               SYS=bsdos
-               NDEFS="$NDEFS -DBSDOS=$os_r1"
-               ;;
-       ultrix)
-               OS="ultrix-$arch"
-               SYS=ultrix
-               ;;
-       unixware|eeyore)
-               OS="unixware${os_v}"
-               SYS=unixware
-               ;;
-       macos*|darwin|rhapsody)
-               OS="macosx"
-               SYS="macosx"
-               ;;
-       sunos)
-               if [ "$arch" = "" ] ; then arch="sparc" ; fi
-               if [ "$archp" = "" ] ; then archp="$arch" ; fi
-               case "$os_r" in
-                       5.[789]*)
-                               os_r=`echo "$os_r" | cut -c3-`
-                               OS="solaris${os_r}-$archp"
-                               NDEFS="$NDEFS -DSOLARIS=\\\"$os_r\\\""
-                               SYS=solaris
-                               ;;
-                       5.[0123456]*)
-                               maj=`echo "$os_r" | cut -c1-1`
-                               maj=`expr "$maj" - 3`
-                               os_r=`echo "$os_r" | cut -c2-`
-                               os_r="${maj}${os_r}"
-                               OS="solaris${os_r}-$archp"
-                               NDEFS="$NDEFS -DSOLARIS=\\\"$os_r\\\""
-                               SYS=solaris
-                               ;;
-                       4.*)
-                               OS="sunos${os_r}-sparc"
-                               NDEFS="$NDEFS -DSUNOS=\\\"$os_r\\\""
-                               SYS=sunos
-                               ;;
-                       *)
-                               OS="solaris${os_r}-$archp"
-                               NDEFS="$NDEFS -DSOLARIS=\\\"$os_r\\\""
-                               SYS=solaris
-                               ;;
-               esac
-               ;;
-       *)
-               OS="$os"
-               SYS="$os"
-
-               if grep Novell /usr/include/sys/types.h ; then
-                       OS="unixware${os_v}"
-                       SYS="unixware"
-               fi
-               ;;
-esac
-
-changequote([, ])
-
-AC_SUBST(NDEFS)
-AC_SUBST(OS)
-AC_SUBST(host)
-AC_SUBST(SYS)
-AC_SUBST(HOME_OS)
-])
diff --git a/rosapps/net/ping/makefile b/rosapps/net/ping/makefile
new file mode 100644 (file)
index 0000000..a39efa3
--- /dev/null
@@ -0,0 +1,21 @@
+# $Id: makefile,v 1.1 2001/12/30 04:09:38 sedwards Exp $
+
+PATH_TO_TOP=../../../reactos
+
+ROS_DIR=../../../reactos
+
+TARGET_TYPE = program
+
+TARGET_APPTYPE = console
+
+TARGET_NAME = ping
+
+TARGET_SDKLIBS = ntdll.a ws2_32.a
+
+TARGET_OBJECTS = $(TARGET_NAME).o
+
+include $(PATH_TO_TOP)/rules.mak
+
+include $(TOOLS_PATH)/helper.mk
+
+# EOF
diff --git a/rosapps/net/ping/ping.c b/rosapps/net/ping/ping.c
new file mode 100644 (file)
index 0000000..9d46320
--- /dev/null
@@ -0,0 +1,629 @@
+/* $Id: ping.c,v 1.1 2001/12/30 04:09:38 sedwards Exp $
+ *
+ * COPYRIGHT:   See COPYING in the top level directory
+ * PROJECT:     ReactOS ping utility
+ * FILE:        apps/net/ping/ping.c
+ * PURPOSE:     Network test utility
+ * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
+ * REVISIONS:
+ *   CSH  01/09/2000 Created
+ */
+#include <winsock2.h>
+#include <tchar.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdio.h>
+#ifndef _MSC_VER
+
+//#define DBG
+
+/* FIXME: Where should this be? */
+#define CopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length);
+
+/* Should be in the header files somewhere (exported by ntdll.dll) */
+long atol(const char *str);
+
+#ifndef __int64
+typedef long long __int64;
+#endif
+
+char * _i64toa(__int64 value, char *string, int radix);
+
+#endif
+
+
+/* General ICMP constants */
+#define ICMP_MINSIZE           8               /* Minimum ICMP packet size */
+#define ICMP_MAXSIZE           65535   /* Maximum ICMP packet size */
+
+/* ICMP message types */
+#define ICMPMSG_ECHOREQUEST    8               /* ICMP ECHO request message */
+#define ICMPMSG_ECHOREPLY      0               /* ICMP ECHO reply message */
+
+#pragma pack(4)
+
+/* IPv4 header structure */
+typedef struct _IPv4_HEADER {
+       unsigned char   IHL:4;
+       unsigned char   Version:4;
+       unsigned char   TOS;
+       unsigned short  Length;
+       unsigned short  Id;
+       unsigned short  FragFlags;
+       unsigned char   TTL;
+       unsigned char   Protocol;
+       unsigned short  Checksum;
+       unsigned int    SrcAddress;
+       unsigned int    DstAddress;
+} IPv4_HEADER, *PIPv4_HEADER;
+
+/* ICMP echo request/reply header structure */
+typedef struct _ICMP_HEADER {
+       unsigned char   Type;
+       unsigned char   Code;
+       unsigned short  Checksum;
+       unsigned short  Id;
+       unsigned short  SeqNum;
+} ICMP_HEADER, *PICMP_HEADER;
+
+typedef struct _ICMP_ECHO_PACKET {
+       ICMP_HEADER   Icmp;
+       LARGE_INTEGER Timestamp;
+} ICMP_ECHO_PACKET, *PICMP_ECHO_PACKET;
+
+#pragma pack(1)
+
+BOOL                InvalidOption;
+BOOL                NeverStop;
+BOOL                ResolveAddresses;
+UINT                PingCount;
+UINT                DataSize;   /* ICMP echo request data size */
+BOOL                DontFragment;
+ULONG               TTLValue;
+ULONG               TOSValue;
+ULONG               Timeout;
+CHAR                TargetName[256];
+SOCKET              IcmpSock;
+SOCKADDR_IN         Target;
+LPSTR               TargetIP;
+FD_SET              Fds;
+TIMEVAL             Timeval;
+UINT                CurrentSeqNum;
+UINT                SentCount;
+UINT                LostCount;
+BOOL                MinRTTSet;
+LARGE_INTEGER       MinRTT;     /* Minimum round trip time in microseconds */
+LARGE_INTEGER       MaxRTT;
+LARGE_INTEGER       SumRTT;
+LARGE_INTEGER       AvgRTT;
+LARGE_INTEGER       TicksPerMs; /* Ticks per millisecond */
+LARGE_INTEGER       TicksPerUs; /* Ticks per microsecond */
+BOOL                UsePerformanceCounter;
+
+
+/* Display the contents of a buffer */
+VOID DisplayBuffer(
+    PVOID Buffer,
+    DWORD Size)
+{
+    UINT i;
+    PCHAR p;
+
+    printf("Buffer (0x%X)  Size (0x%X).\n", Buffer, Size);
+
+    p = (PCHAR)Buffer;
+    for (i = 0; i < Size; i++) {
+      if (i % 16 == 0) {
+        printf("\n");
+      }
+      printf("%02X ", (p[i]) & 0xFF);
+    }
+}
+
+/* Display usage information on screen */
+VOID Usage(VOID)
+{
+       printf("\nUsage: ping [-t] [-n count] [-l size] [-w timeout] destination-host\n\n");
+       printf("Options:\n");
+       printf("    -t             Ping the specified host until stopped.\n");
+       printf("                   To stop - type Control-C.\n");
+       printf("    -n count       Number of echo requests to send.\n");
+       printf("    -l size        Send buffer size.\n");
+       printf("    -w timeout     Timeout in milliseconds to wait for each reply.\n\n");
+}
+
+/* Reset configuration to default values */
+VOID Reset(VOID)
+{
+    LARGE_INTEGER PerformanceCounterFrequency;
+
+    NeverStop             = FALSE;
+    ResolveAddresses      = FALSE;
+    PingCount             = 4;
+    DataSize              = 32;
+    DontFragment          = FALSE;
+    TTLValue              = 128;
+    TOSValue              = 0;
+    Timeout               = 1000;
+    UsePerformanceCounter = QueryPerformanceFrequency(&PerformanceCounterFrequency);
+
+    if (UsePerformanceCounter) {
+        /* Performance counters may return incorrect results on some multiprocessor
+           platforms so we restrict execution on the first processor. This may fail
+           on Windows NT so we fall back to GetCurrentTick() for timing */
+        if (SetThreadAffinityMask (GetCurrentThread(), 1) == 0) {
+            UsePerformanceCounter = FALSE;
+        }
+
+        /* Convert frequency to ticks per millisecond */
+        TicksPerMs.QuadPart = PerformanceCounterFrequency.QuadPart / 1000;
+        /* And to ticks per microsecond */
+        TicksPerUs.QuadPart = PerformanceCounterFrequency.QuadPart / 1000000;
+    }
+    if (!UsePerformanceCounter) {
+        /* 1 tick per millisecond for GetCurrentTick() */
+        TicksPerMs.QuadPart = 1;
+        /* GetCurrentTick() cannot handle microseconds */
+        TicksPerUs.QuadPart = 1;
+    }
+}
+
+/* Return ULONG in a string */
+ULONG GetULONG(LPSTR String)
+{
+    UINT i, Length;
+    ULONG Value;
+
+    i = 0;
+    Length = strlen(String);
+    while ((i < Length) && ((String[i] < '0') || (String[i] > '9'))) i++;
+    if ((i >= Length) || ((String[i] < '0') || (String[i] > '9'))) {
+        InvalidOption = TRUE;
+        return 0;
+    }
+    Value = (ULONG)atol(&String[i]);
+
+    return Value;
+}
+
+/* Return ULONG in a string. Try next paramter if not successful */
+ULONG GetULONG2(LPSTR String1, LPSTR String2, PINT i)
+{
+    ULONG Value;
+
+    Value = GetULONG(String1);
+    if (InvalidOption) {
+        InvalidOption = FALSE;
+        if (String2[0] != '-') {
+            Value = GetULONG(String2);
+            if (!InvalidOption)
+                *i += 1;
+        }
+    }
+
+    return Value;
+}
+
+/* Parse command line parameters */
+BOOL ParseCmdline(int argc, char* argv[])
+{
+    INT i;
+    BOOL ShowUsage;
+    BOOL FoundTarget;
+#if 1
+    lstrcpy(TargetName, "127.0.0.1");
+    PingCount = 1;
+    return TRUE;
+#endif
+    if (argc < 2) {
+        ShowUsage = TRUE;
+    } else {
+        ShowUsage = FALSE;
+    }
+    FoundTarget = FALSE;
+    InvalidOption = FALSE;
+
+    for (i = 1; i < argc; i++) {
+        if (argv[i][0] == '-') {
+            switch (argv[i][1]) {
+            case 't': NeverStop = TRUE; break;
+            case 'a': ResolveAddresses = TRUE; break;
+            case 'n': PingCount = GetULONG2(&argv[i][2], argv[i + 1], &i); break;
+            case 'l':
+                DataSize = GetULONG2(&argv[i][2], argv[i + 1], &i);
+                if ((DataSize < 0) || (DataSize > ICMP_MAXSIZE - sizeof(ICMP_ECHO_PACKET))) {
+                    printf("Bad value for option -l, valid range is from 0 to %d.\n",
+                        ICMP_MAXSIZE - sizeof(ICMP_ECHO_PACKET));
+                    return FALSE;
+                }
+                break;
+            case 'f': DontFragment = TRUE; break;
+            case 'i': TTLValue = GetULONG2(&argv[i][2], argv[i + 1], &i); break;
+            case 'v': TOSValue = GetULONG2(&argv[i][2], argv[i + 1], &i); break;
+            case 'w': Timeout  = GetULONG2(&argv[i][2], argv[i + 1], &i); break;
+            default:
+                printf("Bad option %s.\n", argv[i]);
+                Usage();
+                return FALSE;
+            }
+            if (InvalidOption) {
+                printf("Bad option format %s.\n", argv[i]);
+                return FALSE;
+            }
+        } else {
+            if (FoundTarget) {
+                printf("Bad parameter %s.\n", argv[i]);
+                return FALSE;
+            } else {
+                               lstrcpy(TargetName, argv[i]);
+                FoundTarget = TRUE;
+            }
+        }
+    }
+
+    if ((!ShowUsage) && (!FoundTarget)) {
+        printf("Name or IP address of destination host must be specified.\n");
+        return FALSE;
+    }
+
+    if (ShowUsage) {
+        Usage();
+        return FALSE;
+    }
+    return TRUE;
+}
+
+/* Calculate checksum of data */
+WORD Checksum(PUSHORT data, UINT size)
+{
+    ULONG sum = 0;
+
+    while (size > 1) {
+        sum  += *data++;
+        size -= sizeof(USHORT);
+    }
+
+    if (size)
+        sum += *(UCHAR*)data;
+
+    sum = (sum >> 16) + (sum & 0xFFFF);
+    sum += (sum >> 16);
+
+    return (USHORT)(~sum);
+}
+
+/* Prepare to ping target */
+BOOL Setup(VOID)
+{
+    WORD     wVersionRequested;
+    WSADATA  WsaData;
+    INT             Status;
+    ULONG    Addr;
+    PHOSTENT phe;
+
+    wVersionRequested = MAKEWORD(2, 2);
+    Status = WSAStartup(wVersionRequested, &WsaData);
+    if (Status != 0) {
+        printf("Could not initialize winsock dll.\n"); 
+        return FALSE;
+    }
+
+    IcmpSock = WSASocket(AF_INET, SOCK_RAW, IPPROTO_ICMP, NULL, 0, 0);
+    if (IcmpSock == INVALID_SOCKET) {
+        printf("Could not create socket (#%d).\n", WSAGetLastError());
+        return FALSE;
+    }
+
+    ZeroMemory(&Target, sizeof(Target));
+    phe = NULL;
+    Addr = inet_addr(TargetName);
+    if (Addr == INADDR_NONE) {
+        phe = gethostbyname(TargetName);
+        if (phe == NULL) {
+            printf("Unknown host %s.\n", TargetName);
+            return FALSE;
+        } 
+    }
+       
+    if (phe != NULL) {
+        CopyMemory(&Target.sin_addr, phe->h_addr_list, phe->h_length);
+    } else {
+        Target.sin_addr.s_addr = Addr;
+    }
+
+    if (phe != NULL) {
+               Target.sin_family = phe->h_addrtype;
+    } else {
+        Target.sin_family = AF_INET;
+    }
+       
+    TargetIP           = inet_ntoa(Target.sin_addr);
+    CurrentSeqNum      = 0;
+    SentCount          = 0;
+       LostCount               = 0;
+    MinRTT.QuadPart = 0;
+    MaxRTT.QuadPart = 0;
+    SumRTT.QuadPart = 0;
+    MinRTTSet       = FALSE;
+    return TRUE;
+}
+
+/* Close socket */
+VOID Cleanup(VOID)
+{
+    if (IcmpSock != INVALID_SOCKET)
+        closesocket(IcmpSock);
+
+    WSACleanup();
+}
+
+VOID QueryTime(PLARGE_INTEGER Time)
+{
+    if (UsePerformanceCounter) {
+        if (QueryPerformanceCounter(Time) == 0) {
+            /* This should not happen, but we fall
+               back to GetCurrentTick() if it does */
+            Time->u.LowPart  = (ULONG)GetTickCount();
+            Time->u.HighPart = 0;
+
+            /* 1 tick per millisecond for GetCurrentTick() */
+            TicksPerMs.QuadPart = 1;
+            /* GetCurrentTick() cannot handle microseconds */
+            TicksPerUs.QuadPart = 1;
+
+            UsePerformanceCounter = FALSE;
+        }
+    } else {
+        Time->u.LowPart  = (ULONG)GetTickCount();
+        Time->u.HighPart = 0;
+    }
+}
+
+VOID TimeToMsString(LPSTR String, LARGE_INTEGER Time)
+{
+    UINT          i, Length;
+    CHAR          Convstr[40];
+    LARGE_INTEGER LargeTime;
+
+    LargeTime.QuadPart = Time.QuadPart / TicksPerMs.QuadPart;
+    _i64toa(LargeTime.QuadPart, Convstr, 10);
+       strcpy(String, Convstr);
+    strcat(String, ",");
+
+    LargeTime.QuadPart = (Time.QuadPart % TicksPerMs.QuadPart) / TicksPerUs.QuadPart;
+    _i64toa(LargeTime.QuadPart, Convstr, 10);
+    Length = strlen(Convstr);
+    if (Length < 4) {
+        for (i = 0; i < 4 - Length; i++)
+            strcat(String, "0");
+    }
+
+    strcat(String, Convstr);
+    strcat(String, "ms");
+}
+
+/* Locate the ICMP data and print it. Returns TRUE if the packet was good,
+   FALSE if not */
+BOOL DecodeResponse(PCHAR buffer, UINT size, PSOCKADDR_IN from)
+{
+    PIPv4_HEADER      IpHeader;
+    PICMP_ECHO_PACKET Icmp;
+       UINT              IphLength;
+    CHAR              Time[100];
+    LARGE_INTEGER     RelativeTime;
+    LARGE_INTEGER     LargeTime;
+
+    IpHeader = (PIPv4_HEADER)buffer;
+
+    IphLength = IpHeader->IHL * 4;
+
+    if (size  < IphLength + ICMP_MINSIZE) {
+#ifdef DBG
+        printf("Bad size (0x%X < 0x%X)\n", size, IphLength + ICMP_MINSIZE);
+#endif DBG
+        return FALSE;
+    }
+
+    Icmp = (PICMP_ECHO_PACKET)(buffer + IphLength);
+
+    if (Icmp->Icmp.Type != ICMPMSG_ECHOREPLY) {
+#ifdef DBG
+        printf("Bad ICMP type (0x%X should be 0x%X)\n", Icmp->Icmp.Type, ICMPMSG_ECHOREPLY);
+#endif DBG
+        return FALSE;
+    }
+
+    if (Icmp->Icmp.Id != (USHORT)GetCurrentProcessId()) {
+#ifdef DBG
+        printf("Bad ICMP id (0x%X should be 0x%X)\n", Icmp->Icmp.Id, (USHORT)GetCurrentProcessId());
+#endif DBG
+        return FALSE;
+    }
+
+    QueryTime(&LargeTime);
+
+    RelativeTime.QuadPart = (LargeTime.QuadPart - Icmp->Timestamp.QuadPart);
+
+    TimeToMsString(Time, RelativeTime);
+
+    printf("Reply from %s: bytes=%d time=%s TTL=%d\n", inet_ntoa(from->sin_addr), 
+      size - IphLength - sizeof(ICMP_ECHO_PACKET), Time, IpHeader->TTL);
+    if (RelativeTime.QuadPart < MinRTT.QuadPart) {
+                 MinRTT.QuadPart = RelativeTime.QuadPart;
+      MinRTTSet = TRUE;
+    }
+         if (RelativeTime.QuadPart > MaxRTT.QuadPart)
+             MaxRTT.QuadPart = RelativeTime.QuadPart;
+    SumRTT.QuadPart += RelativeTime.QuadPart;
+
+       return TRUE;
+}
+
+/* Send and receive one ping */
+BOOL Ping(VOID)
+{
+    INT                 Status;
+    SOCKADDR            From;
+    UINT                Length;
+    PVOID               Buffer;
+    UINT                Size;
+    PICMP_ECHO_PACKET   Packet;
+
+    /* Account for extra space for IP header when packet is received */
+    Size   = DataSize + 128;
+    Buffer = GlobalAlloc(0, Size);
+    if (!Buffer) {
+        printf("Not enough free resources available.\n");
+        return FALSE;
+    }
+
+    ZeroMemory(Buffer, Size);
+    Packet = (PICMP_ECHO_PACKET)Buffer;
+
+    /* Assemble ICMP echo request packet */
+    Packet->Icmp.Type     = ICMPMSG_ECHOREQUEST;
+    Packet->Icmp.Code     = 0;
+    Packet->Icmp.Id          = (USHORT)GetCurrentProcessId();
+    Packet->Icmp.SeqNum   = (USHORT)CurrentSeqNum;
+    Packet->Icmp.Checksum = 0;
+
+    /* Timestamp is part of data area */
+    QueryTime(&Packet->Timestamp);
+
+    CopyMemory(Buffer, &Packet->Icmp, sizeof(ICMP_ECHO_PACKET) + DataSize);
+    /* Calculate checksum for ICMP header and data area */
+    Packet->Icmp.Checksum = Checksum((PUSHORT)&Packet->Icmp, sizeof(ICMP_ECHO_PACKET) + DataSize);
+
+    CurrentSeqNum++;
+
+       /* Send ICMP echo request */
+
+    FD_ZERO(&Fds);
+    FD_SET(IcmpSock, &Fds);
+    Timeval.tv_sec  = Timeout / 1000;
+    Timeval.tv_usec = Timeout % 1000;
+    Status = select(0, NULL, &Fds, NULL, &Timeval);
+    if ((Status != SOCKET_ERROR) && (Status != 0)) {
+
+#ifdef DBG
+        printf("Sending packet\n");
+        DisplayBuffer(Buffer, sizeof(ICMP_ECHO_PACKET) + DataSize);
+        printf("\n");
+#endif DBG
+
+        Status = sendto(IcmpSock, Buffer, sizeof(ICMP_ECHO_PACKET) + DataSize,
+            0, (SOCKADDR*)&Target, sizeof(Target));
+        SentCount++;
+    }
+    if (Status == SOCKET_ERROR) {
+        if (WSAGetLastError() == WSAEHOSTUNREACH) {
+            printf("Destination host unreachable.\n");
+        } else {
+            printf("Could not transmit data (%d).\n", WSAGetLastError());
+        }
+        GlobalFree(Buffer);
+        return FALSE;
+    }
+
+    /* Expect to receive ICMP echo reply */
+    FD_ZERO(&Fds);
+    FD_SET(IcmpSock, &Fds);
+    Timeval.tv_sec  = Timeout / 1000;
+    Timeval.tv_usec = Timeout % 1000;
+
+    Status = select(0, &Fds, NULL, NULL, &Timeval);
+    if ((Status != SOCKET_ERROR) && (Status != 0)) {
+        Length = sizeof(From);
+        Status = recvfrom(IcmpSock, Buffer, Size, 0, &From, &Length);
+
+#ifdef DBG
+        printf("Received packet\n");
+        DisplayBuffer(Buffer, Status);
+        printf("\n");
+#endif DBG
+    }
+    if (Status == SOCKET_ERROR) {
+        if (WSAGetLastError() != WSAETIMEDOUT) {
+            printf("Could not receive data (%d).\n", WSAGetLastError());
+            GlobalFree(Buffer);
+            return FALSE;
+        }
+        Status = 0;
+    }
+
+    if (Status == 0) {
+        printf("Request timed out.\n");
+        LostCount++;
+        GlobalFree(Buffer);
+        return TRUE;
+    }
+
+    if (!DecodeResponse(Buffer, Status, (PSOCKADDR_IN)&From)) {
+        /* FIXME: Wait again as it could be another ICMP message type */
+        printf("Request timed out (incomplete datagram received).\n");
+        LostCount++;
+    }
+
+    GlobalFree(Buffer);
+    return TRUE;
+}
+
+
+/* Program entry point */
+int main(int argc, char* argv[])
+{
+    UINT Count;
+    CHAR MinTime[20];
+    CHAR MaxTime[20];
+    CHAR AvgTime[20];
+
+    Reset();
+
+    if ((ParseCmdline(argc, argv)) && (Setup())) {
+
+        printf("\nPinging %s [%s] with %d bytes of data:\n\n",
+            TargetName, TargetIP, DataSize);
+               
+               Count = 0;
+               while ((NeverStop) || (Count < PingCount)) {
+                       Ping();
+                       Sleep(Timeout);
+                       Count++;
+               };
+
+        Cleanup();
+
+               /* Calculate avarage round trip time */
+        if ((SentCount - LostCount) > 0) {
+            AvgRTT.QuadPart = SumRTT.QuadPart / (SentCount - LostCount);
+        } else {
+            AvgRTT.QuadPart = 0;
+        }
+
+        /* Calculate loss percent */
+        if (LostCount > 0) {
+            Count = (SentCount * 100) / LostCount;
+        } else {
+            Count = 0;
+        }
+
+        if (!MinRTTSet)
+            MinRTT = MaxRTT;
+
+        TimeToMsString(MinTime, MinRTT);
+        TimeToMsString(MaxTime, MaxRTT);
+        TimeToMsString(AvgTime, AvgRTT);
+
+        /* Print statistics */
+        printf("\nPing statistics for %s:\n", TargetIP);
+        printf("    Packets: Sent = %d, Received = %d, Lost = %d (%d%% loss),\n",
+            SentCount, SentCount - LostCount, LostCount, Count);
+        printf("Approximate round trip times in milli-seconds:\n");
+        printf("    Minimum = %s, Maximum = %s, Average = %s\n",
+            MinTime, MaxTime, AvgTime);
+    }
+       return 0;
+}
+
+/* EOF */
diff --git a/rosapps/net/ping/ping.rc b/rosapps/net/ping/ping.rc
new file mode 100644 (file)
index 0000000..0a4e588
--- /dev/null
@@ -0,0 +1,39 @@
+#include <defines.h>
+#include <reactos/resource.h>
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+VS_VERSION_INFO VERSIONINFO
+       FILEVERSION     RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
+       PRODUCTVERSION  RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD      
+       FILEFLAGSMASK   0x3fL
+#ifdef _DEBUG
+       FILEFLAGS       0x1L
+#else
+       FILEFLAGS       0x0L
+#endif
+       FILEOS          0x40004L
+       FILETYPE        0x2L
+       FILESUBTYPE     0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "CompanyName",       RES_STR_COMPANY_NAME
+            VALUE "FileDescription",   "ReactOS TCP/IPv4 Win32 Ping\0"
+            VALUE "FileVersion",       RES_STR_FILE_VERSION
+            VALUE "InternalName",      "ping\0"
+            VALUE "LegalCopyright",    RES_STR_LEGAL_COPYRIGHT
+            VALUE "OriginalCopyright", "Casper S. Hornstrup (chorns@users.sourceforge.net)\0"
+            VALUE "OriginalFilename",  "ping.exe\0"
+            VALUE "ProductName",       RES_STR_PRODUCT_NAME
+            VALUE "ProductVersion",    RES_STR_PRODUCT_VERSION
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+