Fix massive lossage: 0.15 based on an outdated repository!!!

This commit is contained in:
hpa 2001-03-30 01:08:12 +00:00
parent 0ba1a99f5d
commit 7a15e40374
8 changed files with 345 additions and 427 deletions

View file

@ -29,3 +29,9 @@ LDFLAGS = @LDFLAGS@
# Libraries # Libraries
LIBS = @LIBS@ LIBS = @LIBS@
# Additional library we need to build
LIBOBJS = @LIBOBJS@
# ar and ranlib (for making libraries)
AR = ar cq
RANLIB = @RANLIB@

View file

@ -1,7 +1,7 @@
# You can do "make SUB=blah" to make only a few, or edit here, or both # You can do "make SUB=blah" to make only a few, or edit here, or both
# You can also run make directly in the subdirs you want. # You can also run make directly in the subdirs you want.
SUB = tftp tftpd SUB = lib tftp tftpd
%.build: %.build:
$(MAKE) -C $(patsubst %.build, %, $@) $(MAKE) -C $(patsubst %.build, %, $@)

9
README
View file

@ -1,6 +1,13 @@
This is tftp-hpa-0.15; this version was put out by H. Peter Anvin This is tftp-hpa-0.16; this version was put out by H. Peter Anvin
<hpa@zytor.com>. <hpa@zytor.com>.
Changes in 0.16:
Correct massive lossage from 0.15: apparently 0.15 was based
on an out-of-date CVS repository, somehow.
Fix for ACKs in TFTP PUT; patch by Roger Venning.
Changes in 0.15: Changes in 0.15:
If the operating system allows, try to obtain the local If the operating system allows, try to obtain the local

61
aclocal.m4 vendored
View file

@ -14,54 +14,17 @@ AC_DEFUN(PA_ADD_CFLAGS,
CFLAGS="$pa_add_cflags__old_cflags")]) CFLAGS="$pa_add_cflags__old_cflags")])
dnl -------------------------------------------------------------------------- dnl --------------------------------------------------------------------------
dnl PA_BSD_SIGNAL() dnl PA_SIGSETJMP
dnl dnl
dnl Test for BSD signal semantics. Set shell variable BSD_SIGNAL=1 if OK. dnl Do we have sigsetjmp/siglongjmp?
dnl May modify CFLAGS and/or LIBS.
dnl -------------------------------------------------------------------------- dnl --------------------------------------------------------------------------
AC_DEFUN(PA_CHECK_BSD_SIGNAL, AC_DEFUN(PA_SIGSETJMP,
[AC_TRY_RUN([ [AC_MSG_CHECKING([for sigsetjmp])
#include <unistd.h> AC_TRY_LINK(
#include <signal.h> [#include <setjmp.h>],
int count=0; [sigjmp_buf buf;
handle() { count++; } sigsetjmp(buf,1);],
int main() { AC_MSG_RESULT([yes])
int pid=getpid(); $1,
signal(SIGINT, handle); AC_MSG_RESULT([no])
kill(pid,SIGINT); $2)])
kill(pid,SIGINT);
kill(pid,SIGINT);
if (count!=3) return 1;
return 0;
}
], BSD_SIGNAL=1)])
AC_DEFUN(PA_BSD_SIGNAL,
[AC_MSG_CHECKING([for BSD signal semantics])
PA_CHECK_BSD_SIGNAL()
if test -z "$BSD_SIGNAL"; then
AC_MSG_RESULT([no])
AC_MSG_CHECKING([if -D__USE_BSD_SIGNAL helps])
pa_bsd_signal__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -D__USE_BSD_SIGNAL"
PA_CHECK_BSD_SIGNAL()
if test -z "$BSD_SIGNAL"; then
AC_MSG_RESULT([no])
CFLAGS="$pa_bsd_signal__old_cflags"
AC_MSG_CHECKING([if -lbsd helps])
pa_bsd_signal__old_libs="$LIBS"
LIBS="$LIBS -lbsd"
PA_CHECK_BSD_SIGNAL()
if test -z "$BSD_SIGNAL"; then
AC_MSG_RESULT([no])
LIBS="$pa_bsd_signal__old_libs"
else
AC_MSG_RESULT([yes])
fi
else
AC_MSG_RESULT([yes])
fi
else
AC_MSG_RESULT([yes])
fi
])

597
configure vendored
View file

@ -860,110 +860,19 @@ EOF
esac esac
for ac_func in recvmsg
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:867: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 872 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
echo $ac_n "checking for msg_control in struct msghdr""... $ac_c" 1>&6
echo "configure:921: checking for msg_control in struct msghdr" >&5
cat > conftest.$ac_ext <<EOF
#line 923 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
int main() {
struct msghdr msg;
void *p = (void *) &msg.msg_control;
; return 0; }
EOF
if { (eval echo configure:936: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_MSGHDR_MSG_CONTROL 1
EOF
echo "$ac_t""yes" 1>&6
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
echo $ac_n "checking if $CC accepts -Wall""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -Wall""... $ac_c" 1>&6
echo "configure:956: checking if $CC accepts -Wall" >&5 echo "configure:865: checking if $CC accepts -Wall" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wall" CFLAGS="$CFLAGS -Wall"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 960 "configure" #line 869 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:876: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -975,18 +884,18 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking if $CC accepts -W""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -W""... $ac_c" 1>&6
echo "configure:979: checking if $CC accepts -W" >&5 echo "configure:888: checking if $CC accepts -W" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -W" CFLAGS="$CFLAGS -W"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 983 "configure" #line 892 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:990: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -998,18 +907,18 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking if $CC accepts -Wpointer-arith""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -Wpointer-arith""... $ac_c" 1>&6
echo "configure:1002: checking if $CC accepts -Wpointer-arith" >&5 echo "configure:911: checking if $CC accepts -Wpointer-arith" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wpointer-arith" CFLAGS="$CFLAGS -Wpointer-arith"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1006 "configure" #line 915 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:922: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -1021,18 +930,18 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking if $CC accepts -Wbad-function-cast""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -Wbad-function-cast""... $ac_c" 1>&6
echo "configure:1025: checking if $CC accepts -Wbad-function-cast" >&5 echo "configure:934: checking if $CC accepts -Wbad-function-cast" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wbad-function-cast" CFLAGS="$CFLAGS -Wbad-function-cast"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1029 "configure" #line 938 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1036: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:945: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -1044,18 +953,18 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking if $CC accepts -Wcast-equal""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -Wcast-equal""... $ac_c" 1>&6
echo "configure:1048: checking if $CC accepts -Wcast-equal" >&5 echo "configure:957: checking if $CC accepts -Wcast-equal" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wcast-equal" CFLAGS="$CFLAGS -Wcast-equal"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1052 "configure" #line 961 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1059: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -1067,18 +976,18 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking if $CC accepts -Wstrict-prototypes""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -Wstrict-prototypes""... $ac_c" 1>&6
echo "configure:1071: checking if $CC accepts -Wstrict-prototypes" >&5 echo "configure:980: checking if $CC accepts -Wstrict-prototypes" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wstrict-prototypes" CFLAGS="$CFLAGS -Wstrict-prototypes"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1075 "configure" #line 984 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1082: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:991: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -1090,18 +999,18 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking if $CC accepts -Wmissing-prototypes""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -Wmissing-prototypes""... $ac_c" 1>&6
echo "configure:1094: checking if $CC accepts -Wmissing-prototypes" >&5 echo "configure:1003: checking if $CC accepts -Wmissing-prototypes" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wmissing-prototypes" CFLAGS="$CFLAGS -Wmissing-prototypes"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1098 "configure" #line 1007 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1105: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -1113,18 +1022,18 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking if $CC accepts -Wmissing-declarations""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -Wmissing-declarations""... $ac_c" 1>&6
echo "configure:1117: checking if $CC accepts -Wmissing-declarations" >&5 echo "configure:1026: checking if $CC accepts -Wmissing-declarations" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wmissing-declarations" CFLAGS="$CFLAGS -Wmissing-declarations"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1121 "configure" #line 1030 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1128: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1037: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -1136,18 +1045,18 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking if $CC accepts -Wnested-externs""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -Wnested-externs""... $ac_c" 1>&6
echo "configure:1140: checking if $CC accepts -Wnested-externs" >&5 echo "configure:1049: checking if $CC accepts -Wnested-externs" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wnested-externs" CFLAGS="$CFLAGS -Wnested-externs"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1144 "configure" #line 1053 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -1159,18 +1068,18 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking if $CC accepts -Winline""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -Winline""... $ac_c" 1>&6
echo "configure:1163: checking if $CC accepts -Winline" >&5 echo "configure:1072: checking if $CC accepts -Winline" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Winline" CFLAGS="$CFLAGS -Winline"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1167 "configure" #line 1076 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1083: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -1182,18 +1091,18 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking if $CC accepts -Wcast-align""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -Wcast-align""... $ac_c" 1>&6
echo "configure:1186: checking if $CC accepts -Wcast-align" >&5 echo "configure:1095: checking if $CC accepts -Wcast-align" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wcast-align" CFLAGS="$CFLAGS -Wcast-align"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1190 "configure" #line 1099 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1197: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1106: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -1205,18 +1114,18 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking if $CC accepts -pipe""... $ac_c" 1>&6 echo $ac_n "checking if $CC accepts -pipe""... $ac_c" 1>&6
echo "configure:1209: checking if $CC accepts -pipe" >&5 echo "configure:1118: checking if $CC accepts -pipe" >&5
pa_add_cflags__old_cflags="$CFLAGS" pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -pipe" CFLAGS="$CFLAGS -pipe"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1213 "configure" #line 1122 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("Hello, World!\n"); printf("Hello, World!\n");
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1220: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1129: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
else else
@ -1228,130 +1137,254 @@ else
fi fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking for BSD signal semantics""... $ac_c" 1>&6 echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6
echo "configure:1233: checking for BSD signal semantics" >&5 echo "configure:1142: checking for sigsetjmp" >&5
if test "$cross_compiling" = yes; then cat > conftest.$ac_ext <<EOF
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } #line 1144 "configure"
#include "confdefs.h"
#include <setjmp.h>
int main() {
sigjmp_buf buf;
sigsetjmp(buf,1);
; return 0; }
EOF
if { (eval echo configure:1152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
CFLAGS="$CFLAGS -DHAVE_SIGSETJMP=1"
else else
cat > conftest.$ac_ext <<EOF echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
LIBXTRA=0
echo $ac_n "checking for library containing xmalloc""... $ac_c" 1>&6
echo "configure:1169: checking for library containing xmalloc" >&5
if eval "test \"`echo '$''{'ac_cv_search_xmalloc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_func_search_save_LIBS="$LIBS"
ac_cv_search_xmalloc="no"
cat > conftest.$ac_ext <<EOF
#line 1176 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char xmalloc();
int main() {
xmalloc()
; return 0; }
EOF
if { (eval echo configure:1187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_xmalloc="none required"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
test "$ac_cv_search_xmalloc" = "no" && for i in iberty; do
LIBS="-l$i $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <<EOF
#line 1198 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char xmalloc();
int main() {
xmalloc()
; return 0; }
EOF
if { (eval echo configure:1209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_xmalloc="-l$i"
break
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
done
LIBS="$ac_func_search_save_LIBS"
fi
echo "$ac_t""$ac_cv_search_xmalloc" 1>&6
if test "$ac_cv_search_xmalloc" != "no"; then
test "$ac_cv_search_xmalloc" = "none required" || LIBS="$ac_cv_search_xmalloc $LIBS"
else :
LIBXTRA=1 LIBOBJS="$LIBOBJS xmalloc.o"
fi
echo $ac_n "checking for library containing xstrdup""... $ac_c" 1>&6
echo "configure:1231: checking for library containing xstrdup" >&5
if eval "test \"`echo '$''{'ac_cv_search_xstrdup'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_func_search_save_LIBS="$LIBS"
ac_cv_search_xstrdup="no"
cat > conftest.$ac_ext <<EOF
#line 1238 "configure" #line 1238 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char xstrdup();
#include <unistd.h>
#include <signal.h>
int count=0;
handle() { count++; }
int main() { int main() {
int pid=getpid(); xstrdup()
signal(SIGINT, handle); ; return 0; }
kill(pid,SIGINT);
kill(pid,SIGINT);
kill(pid,SIGINT);
if (count!=3) return 1;
return 0;
}
EOF EOF
if { (eval echo configure:1256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:1249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
then rm -rf conftest*
BSD_SIGNAL=1 ac_cv_search_xstrdup="none required"
else else
echo "configure: failed program was:" >&5 echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5 cat conftest.$ac_ext >&5
fi fi
rm -fr conftest* rm -f conftest*
fi test "$ac_cv_search_xstrdup" = "no" && for i in iberty; do
LIBS="-l$i $ac_func_search_save_LIBS"
if test -z "$BSD_SIGNAL"; then cat > conftest.$ac_ext <<EOF
echo "$ac_t""no" 1>&6 #line 1260 "configure"
echo $ac_n "checking if -D__USE_BSD_SIGNAL helps""... $ac_c" 1>&6
echo "configure:1269: checking if -D__USE_BSD_SIGNAL helps" >&5
pa_bsd_signal__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -D__USE_BSD_SIGNAL"
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
#line 1276 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char xstrdup();
#include <unistd.h>
#include <signal.h>
int count=0;
handle() { count++; }
int main() { int main() {
int pid=getpid(); xstrdup()
signal(SIGINT, handle); ; return 0; }
kill(pid,SIGINT);
kill(pid,SIGINT);
kill(pid,SIGINT);
if (count!=3) return 1;
return 0;
}
EOF EOF
if { (eval echo configure:1294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:1271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
then rm -rf conftest*
BSD_SIGNAL=1 ac_cv_search_xstrdup="-l$i"
break
else else
echo "configure: failed program was:" >&5 echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5 cat conftest.$ac_ext >&5
fi fi
rm -fr conftest* rm -f conftest*
done
LIBS="$ac_func_search_save_LIBS"
fi fi
if test -z "$BSD_SIGNAL"; then echo "$ac_t""$ac_cv_search_xstrdup" 1>&6
echo "$ac_t""no" 1>&6 if test "$ac_cv_search_xstrdup" != "no"; then
CFLAGS="$pa_bsd_signal__old_cflags" test "$ac_cv_search_xstrdup" = "none required" || LIBS="$ac_cv_search_xstrdup $LIBS"
echo $ac_n "checking if -lbsd helps""... $ac_c" 1>&6
echo "configure:1308: checking if -lbsd helps" >&5 else :
pa_bsd_signal__old_libs="$LIBS" LIBXTRA=1 LIBOBJS="$LIBOBJS xstrdup.o"
LIBS="$LIBS -lbsd" fi
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } echo $ac_n "checking for library containing bsd_signal""... $ac_c" 1>&6
echo "configure:1293: checking for library containing bsd_signal" >&5
if eval "test \"`echo '$''{'ac_cv_search_bsd_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF ac_func_search_save_LIBS="$LIBS"
#line 1315 "configure" ac_cv_search_bsd_signal="no"
cat > conftest.$ac_ext <<EOF
#line 1300 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char bsd_signal();
#include <unistd.h>
#include <signal.h>
int count=0;
handle() { count++; }
int main() { int main() {
int pid=getpid(); bsd_signal()
signal(SIGINT, handle); ; return 0; }
kill(pid,SIGINT);
kill(pid,SIGINT);
kill(pid,SIGINT);
if (count!=3) return 1;
return 0;
}
EOF EOF
if { (eval echo configure:1333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:1311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
then rm -rf conftest*
BSD_SIGNAL=1 ac_cv_search_bsd_signal="none required"
else else
echo "configure: failed program was:" >&5 echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5 cat conftest.$ac_ext >&5
fi fi
rm -fr conftest* rm -f conftest*
test "$ac_cv_search_bsd_signal" = "no" && for i in bsd; do
LIBS="-l$i $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <<EOF
#line 1322 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char bsd_signal();
int main() {
bsd_signal()
; return 0; }
EOF
if { (eval echo configure:1333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_bsd_signal="-l$i"
break
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
done
LIBS="$ac_func_search_save_LIBS"
fi fi
if test -z "$BSD_SIGNAL"; then echo "$ac_t""$ac_cv_search_bsd_signal" 1>&6
echo "$ac_t""no" 1>&6 if test "$ac_cv_search_bsd_signal" != "no"; then
LIBS="$pa_bsd_signal__old_libs" test "$ac_cv_search_bsd_signal" = "none required" || LIBS="$ac_cv_search_bsd_signal $LIBS"
else
echo "$ac_t""yes" 1>&6 else :
LIBXTRA=1 LIBOBJS="$LIBOBJS bsdsignal.o"
fi
if test "$LIBXTRA" -eq 1; then
LIBS="../lib/libxtra.a $LIBS"
fi
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1363: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_dummy="$PATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_RANLIB="ranlib"
break
fi fi
else done
echo "$ac_t""yes" 1>&6 IFS="$ac_save_ifs"
fi test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
else fi
echo "$ac_t""yes" 1>&6 fi
RANLIB="$ac_cv_prog_RANLIB"
if test -n "$RANLIB"; then
echo "$ac_t""$RANLIB" 1>&6
else
echo "$ac_t""no" 1>&6
fi fi
ac_aux_dir= ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
@ -1384,7 +1417,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh. # ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:1388: checking for a BSD compatible install" >&5 echo "configure:1421: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -1437,7 +1470,6 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
trap '' 1 2 15 trap '' 1 2 15
cat > confcache <<\EOF cat > confcache <<\EOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
@ -1501,7 +1533,19 @@ fi
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
DEFS=-DHAVE_CONFIG_H # Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
cat > conftest.defs <<\EOF
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
s%\[%\\&%g
s%\]%\\&%g
s%\$%$$%g
EOF
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
rm -f conftest.defs
# Without the "./", some shells look in PATH for config.status. # Without the "./", some shells look in PATH for config.status.
: ${CONFIG_STATUS=./config.status} : ${CONFIG_STATUS=./config.status}
@ -1539,7 +1583,7 @@ done
ac_given_srcdir=$srcdir ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL" ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "MCONFIG config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 trap 'rm -fr `echo "MCONFIG" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF EOF
cat >> $CONFIG_STATUS <<EOF cat >> $CONFIG_STATUS <<EOF
@ -1572,6 +1616,8 @@ s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g s%@infodir@%$infodir%g
s%@mandir@%$mandir%g s%@mandir@%$mandir%g
s%@CC@%$CC%g s%@CC@%$CC%g
s%@LIBOBJS@%$LIBOBJS%g
s%@RANLIB@%$RANLIB%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g s%@INSTALL_DATA@%$INSTALL_DATA%g
@ -1675,113 +1721,6 @@ s%@INSTALL@%$INSTALL%g
fi; done fi; done
rm -f conftest.s* rm -f conftest.s*
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
ac_dC='\3'
ac_dD='%g'
# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_uB='\([ ]\)%\1#\2define\3'
ac_uC=' '
ac_uD='\4%g'
# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_eB='$%\1#\2define\3'
ac_eC=' '
ac_eD='%g'
if test "${CONFIG_HEADERS+set}" != set; then
EOF
cat >> $CONFIG_STATUS <<EOF
CONFIG_HEADERS="config.h"
EOF
cat >> $CONFIG_STATUS <<\EOF
fi
for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
echo creating $ac_file
rm -f conftest.frag conftest.in conftest.out
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
cat $ac_file_inputs > conftest.in
EOF
# Transform confdefs.h into a sed script conftest.vals that substitutes
# the proper values into config.h.in to produce config.h. And first:
# Protect against being on the right side of a sed subst in config.status.
# Protect against being in an unquoted here document in config.status.
rm -f conftest.vals
cat > conftest.hdr <<\EOF
s/[\\&%]/\\&/g
s%[\\$`]%\\&%g
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
s%ac_d%ac_u%gp
s%ac_u%ac_e%gp
EOF
sed -n -f conftest.hdr confdefs.h > conftest.vals
rm -f conftest.hdr
# This sed command replaces #undef with comments. This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
cat >> conftest.vals <<\EOF
s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
EOF
# Break up conftest.vals because some shells have a limit on
# the size of here documents, and old seds have small limits too.
rm -f conftest.tail
while :
do
ac_lines=`grep -c . conftest.vals`
# grep -c gives empty output for an empty file on some AIX systems.
if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
# Write a limited-size here document to conftest.frag.
echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
echo 'CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
' >> $CONFIG_STATUS
sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
rm -f conftest.vals
mv conftest.tail conftest.vals
done
rm -f conftest.vals
cat >> $CONFIG_STATUS <<\EOF
rm -f conftest.frag conftest.h
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
cat conftest.in >> conftest.h
rm -f conftest.in
if cmp -s $ac_file conftest.h 2>/dev/null; then
echo "$ac_file is unchanged"
rm -f conftest.h
else
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
fi
rm -f $ac_file
mv conftest.h $ac_file
fi
fi; done
EOF EOF
cat >> $CONFIG_STATUS <<EOF cat >> $CONFIG_STATUS <<EOF

View file

@ -8,26 +8,6 @@ AC_PROG_CC
AC_C_CONST AC_C_CONST
AC_C_INLINE AC_C_INLINE
AC_CHECK_FUNCS(recvmsg)
AC_MSG_CHECKING([for msg_control in struct msghdr])
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
],
[
struct msghdr msg;
void *p = (void *) &msg.msg_control;
],
[
AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL)
AC_MSG_RESULT([yes])
],
[
AC_MSG_RESULT([no])
])
PA_ADD_CFLAGS(-Wall) PA_ADD_CFLAGS(-Wall)
PA_ADD_CFLAGS(-W) PA_ADD_CFLAGS(-W)
PA_ADD_CFLAGS(-Wpointer-arith) PA_ADD_CFLAGS(-Wpointer-arith)
@ -41,9 +21,21 @@ PA_ADD_CFLAGS(-Winline)
PA_ADD_CFLAGS(-Wcast-align) PA_ADD_CFLAGS(-Wcast-align)
PA_ADD_CFLAGS(-pipe) PA_ADD_CFLAGS(-pipe)
PA_BSD_SIGNAL() PA_SIGSETJMP(CFLAGS="$CFLAGS -DHAVE_SIGSETJMP=1", )
LIBXTRA=0
AC_SEARCH_LIBS(xmalloc, iberty, , LIBXTRA=1 LIBOBJS="$LIBOBJS xmalloc.o")
AC_SEARCH_LIBS(xstrdup, iberty, , LIBXTRA=1 LIBOBJS="$LIBOBJS xstrdup.o")
AC_SEARCH_LIBS(bsd_signal, bsd, , LIBXTRA=1 LIBOBJS="$LIBOBJS bsdsignal.o")
if test "$LIBXTRA" -eq 1; then
LIBS="../lib/libxtra.a $LIBS"
fi
AC_SUBST(LIBOBJS)
AC_PROG_RANLIB
AC_PROG_INSTALL AC_PROG_INSTALL
AC_CONFIG_HEADER(config.h)
AC_OUTPUT(MCONFIG) AC_OUTPUT(MCONFIG)

View file

@ -43,10 +43,6 @@ static const char *copyright =
static const char *rcsid = "tftp-hpa $Id$"; static const char *rcsid = "tftp-hpa $Id$";
#endif /* not lint */ #endif /* not lint */
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
/* Many bug fixes are from Jim Guyton <guyton@rand-unix> */ /* Many bug fixes are from Jim Guyton <guyton@rand-unix> */
/* /*
@ -72,6 +68,14 @@ static const char *rcsid = "tftp-hpa $Id$";
#include "extern.h" #include "extern.h"
void bsd_signal(int, void (*)(int));
#ifndef HAVE_SIGSETJMP
#define sigsetjmp(x,y) setjmp(x)
#define siglongjmp(x,y) longjmp(x,y)
#define sigjmp_buf jmp_buf
#endif
#define TIMEOUT 5 /* secs between rexmt's */ #define TIMEOUT 5 /* secs between rexmt's */
#define LBUFLEN 200 /* size of input buffer */ #define LBUFLEN 200 /* size of input buffer */
@ -86,7 +90,7 @@ char line[LBUFLEN];
int margc; int margc;
char *margv[20]; char *margv[20];
char *prompt = "tftp"; char *prompt = "tftp";
jmp_buf toplevel; sigjmp_buf toplevel;
void intr(int); void intr(int);
struct servent *sp; struct servent *sp;
@ -153,6 +157,8 @@ struct cmd cmdtab[] = {
struct cmd *getcmd(char *); struct cmd *getcmd(char *);
char *tail(char *); char *tail(char *);
char *xstrdup(const char *);
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -175,13 +181,13 @@ main(int argc, char *argv[])
exit(1); exit(1);
} }
strcpy(mode, "netascii"); strcpy(mode, "netascii");
signal(SIGINT, intr); bsd_signal(SIGINT, intr);
if (argc > 1) { if (argc > 1) {
if (setjmp(toplevel) != 0) if (sigsetjmp(toplevel,1) != 0)
exit(0); exit(0);
setpeer(argc, argv); setpeer(argc, argv);
} }
if (setjmp(toplevel) != 0) if (sigsetjmp(toplevel,1) != 0)
(void)putchar('\n'); (void)putchar('\n');
command(); command();
@ -189,7 +195,7 @@ main(int argc, char *argv[])
return 0; /* Never reached */ return 0; /* Never reached */
} }
char hostname[MAXHOSTNAMELEN]; char *hostname;
void void
setpeer(int argc, char *argv[]) setpeer(int argc, char *argv[])
@ -210,8 +216,7 @@ setpeer(int argc, char *argv[])
} }
if (inet_aton(argv[1], &peeraddr.sin_addr) != 0) { if (inet_aton(argv[1], &peeraddr.sin_addr) != 0) {
peeraddr.sin_family = AF_INET; peeraddr.sin_family = AF_INET;
(void) strncpy(hostname, argv[1], sizeof hostname); hostname = xstrdup(argv[1]);
hostname[sizeof(hostname)-1] = '\0';
} else { } else {
host = gethostbyname(argv[1]); host = gethostbyname(argv[1]);
if (host == 0) { if (host == 0) {
@ -221,7 +226,7 @@ setpeer(int argc, char *argv[])
} }
peeraddr.sin_family = host->h_addrtype; peeraddr.sin_family = host->h_addrtype;
bcopy(host->h_addr, &peeraddr.sin_addr, host->h_length); bcopy(host->h_addr, &peeraddr.sin_addr, host->h_length);
(void) strcpy(hostname, host->h_name); hostname = xstrdup(host->h_name);
} }
port = sp->s_port; port = sp->s_port;
if (argc == 3) { if (argc == 3) {
@ -349,7 +354,7 @@ put(int argc, char *argv[])
bcopy(hp->h_addr, (caddr_t)&peeraddr.sin_addr, hp->h_length); bcopy(hp->h_addr, (caddr_t)&peeraddr.sin_addr, hp->h_length);
peeraddr.sin_family = hp->h_addrtype; peeraddr.sin_family = hp->h_addrtype;
connected = 1; connected = 1;
strcpy(hostname, hp->h_name); hostname = xstrdup(hp->h_name);
} }
if (!connected) { if (!connected) {
printf("No target machine specified.\n"); printf("No target machine specified.\n");
@ -443,7 +448,7 @@ get(int argc, char *argv[])
hp->h_length); hp->h_length);
peeraddr.sin_family = hp->h_addrtype; peeraddr.sin_family = hp->h_addrtype;
connected = 1; connected = 1;
strcpy(hostname, hp->h_name); hostname = xstrdup(hp->h_name);
} }
if (argc < 4) { if (argc < 4) {
cp = argc == 3 ? argv[2] : tail(src); cp = argc == 3 ? argv[2] : tail(src);
@ -549,9 +554,9 @@ void
intr(int sig) intr(int sig)
{ {
signal(SIGALRM, SIG_IGN); bsd_signal(SIGALRM, SIG_IGN);
alarm(0); alarm(0);
longjmp(toplevel, -1); siglongjmp(toplevel, -1);
} }
char * char *

View file

@ -65,7 +65,13 @@ static const char *rcsid = "tftp-hpa $Id$";
#include "extern.h" #include "extern.h"
#include "tftpsubs.h" #include "tftpsubs.h"
extern int errno; void bsd_signal(int, void (*)(int));
#ifndef HAVE_SIGSETJMP
#define sigsetjmp(x,y) setjmp(x)
#define siglongjmp(x,y) longjmp(x,y)
#define sigjmp_buf jmp_buf
#endif
extern struct sockaddr_in peeraddr; /* filled in by main */ extern struct sockaddr_in peeraddr; /* filled in by main */
extern int f; /* the opened socket */ extern int f; /* the opened socket */
@ -84,8 +90,8 @@ extern int maxtimeout;
#define PKTSIZE SEGSIZE+4 #define PKTSIZE SEGSIZE+4
char ackbuf[PKTSIZE]; char ackbuf[PKTSIZE];
int timeout; int timeout;
jmp_buf toplevel; sigjmp_buf toplevel;
jmp_buf timeoutbuf; sigjmp_buf timeoutbuf;
static void nak(int); static void nak(int);
static int makerequest(int, const char *, struct tftphdr *, const char *); static int makerequest(int, const char *, struct tftphdr *, const char *);
@ -118,7 +124,7 @@ sendfile(int fd, char *name, char *mode)
block = 0; block = 0;
amount = 0; amount = 0;
signal(SIGALRM, timer); bsd_signal(SIGALRM, timer);
do { do {
if (block == 0) if (block == 0)
size = makerequest(WRQ, name, dp, mode) - 4; size = makerequest(WRQ, name, dp, mode) - 4;
@ -133,7 +139,7 @@ sendfile(int fd, char *name, char *mode)
dp->th_block = htons((u_short)block); dp->th_block = htons((u_short)block);
} }
timeout = 0; timeout = 0;
(void) setjmp(timeoutbuf); (void) sigsetjmp(timeoutbuf,1);
send_data: send_data:
if (trace) if (trace)
tpacket("sent", dp, size + 4); tpacket("sent", dp, size + 4);
@ -222,7 +228,7 @@ recvfile(int fd, char *name, char *mode)
firsttrip = 1; firsttrip = 1;
amount = 0; amount = 0;
signal(SIGALRM, timer); bsd_signal(SIGALRM, timer);
do { do {
if (firsttrip) { if (firsttrip) {
size = makerequest(RRQ, name, ap, mode); size = makerequest(RRQ, name, ap, mode);
@ -234,7 +240,7 @@ recvfile(int fd, char *name, char *mode)
block++; block++;
} }
timeout = 0; timeout = 0;
(void) setjmp(timeoutbuf); (void) sigsetjmp(timeoutbuf,1);
send_ack: send_ack:
if (trace) if (trace)
tpacket("sent", ap, size); tpacket("sent", ap, size);
@ -446,8 +452,8 @@ timer(int sig)
if (timeout >= maxtimeout) { if (timeout >= maxtimeout) {
printf("Transfer timed out.\n"); printf("Transfer timed out.\n");
errno = save_errno; errno = save_errno;
longjmp(toplevel, -1); siglongjmp(toplevel, -1);
} }
errno = save_errno; errno = save_errno;
longjmp(timeoutbuf, 1); siglongjmp(timeoutbuf, 1);
} }