]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ssize_t support
authorwessels <>
Fri, 20 Jun 1997 06:03:24 +0000 (06:03 +0000)
committerwessels <>
Fri, 20 Jun 1997 06:03:24 +0000 (06:03 +0000)
snprintf source

configure
configure.in
include/autoconf.h.in
include/snprintf.h [new file with mode: 0644]
lib/snprintf.c [new file with mode: 0644]

index 339e87951b7595bbfa4f96f98043dbc64fd8714b..aaf0c78c2593df8f7e6127d16929ecf23916a7bf 100755 (executable)
--- a/configure
+++ b/configure
@@ -2167,18 +2167,51 @@ fi
 echo "$ac_t""$ac_cv_type_size_t" 1>&6
 if test $ac_cv_type_size_t = no; then
   cat >> confdefs.h <<\EOF
-#define size_t int
+#define size_t unsigned int
+EOF
+
+fi
+
+echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
+echo "configure:2177: checking for ssize_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2182 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_ssize_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_ssize_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_ssize_t" 1>&6
+if test $ac_cv_type_ssize_t = no; then
+  cat >> confdefs.h <<\EOF
+#define ssize_t int
 EOF
 
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2177: checking for off_t" >&5
+echo "configure:2210: checking for off_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2182 "configure"
+#line 2215 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2206,12 +2239,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:2210: checking for mode_t" >&5
+echo "configure:2243: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2215 "configure"
+#line 2248 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2240,7 +2273,7 @@ fi
 
 
 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:2244: checking for main in -lnsl" >&5
+echo "configure:2277: checking for main in -lnsl" >&5
 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2248,14 +2281,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2252 "configure"
+#line 2285 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2283,7 +2316,7 @@ else
 fi
 
 echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:2287: checking for main in -lsocket" >&5
+echo "configure:2320: checking for main in -lsocket" >&5
 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2291,14 +2324,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2295 "configure"
+#line 2328 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2326,7 +2359,7 @@ else
 fi
 
 echo $ac_n "checking for main in -lgnumalloc""... $ac_c" 1>&6
-echo "configure:2330: checking for main in -lgnumalloc" >&5
+echo "configure:2363: checking for main in -lgnumalloc" >&5
 ac_lib_var=`echo gnumalloc'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2334,14 +2367,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgnumalloc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2338 "configure"
+#line 2371 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2378,7 +2411,7 @@ if test "$ac_cv_lib_gnumalloc_main" = "no"; then
                        ;;
                *)
                        echo $ac_n "checking for main in -lmalloc""... $ac_c" 1>&6
-echo "configure:2382: checking for main in -lmalloc" >&5
+echo "configure:2415: checking for main in -lmalloc" >&5
 ac_lib_var=`echo malloc'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2386,14 +2419,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmalloc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2390 "configure"
+#line 2423 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2424,7 +2457,7 @@ fi
        esac
 fi
 echo $ac_n "checking for main in -lbsd""... $ac_c" 1>&6
-echo "configure:2428: checking for main in -lbsd" >&5
+echo "configure:2461: checking for main in -lbsd" >&5
 ac_lib_var=`echo bsd'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2432,14 +2465,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2436 "configure"
+#line 2469 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2467,7 +2500,7 @@ else
 fi
 
 echo $ac_n "checking for main in -lregex""... $ac_c" 1>&6
-echo "configure:2471: checking for main in -lregex" >&5
+echo "configure:2504: checking for main in -lregex" >&5
 ac_lib_var=`echo regex'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2475,14 +2508,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lregex  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2479 "configure"
+#line 2512 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2503,7 +2536,7 @@ else
 fi
 
 echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6
-echo "configure:2507: checking for inet_aton in -lresolv" >&5
+echo "configure:2540: checking for inet_aton in -lresolv" >&5
 ac_lib_var=`echo resolv'_'inet_aton | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2511,7 +2544,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2515 "configure"
+#line 2548 "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
@@ -2522,7 +2555,7 @@ int main() {
 inet_aton()
 ; return 0; }
 EOF
-if { (eval echo configure:2526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2559: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2538,7 +2571,7 @@ fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for inet_aton in -l44bsd""... $ac_c" 1>&6
-echo "configure:2542: checking for inet_aton in -l44bsd" >&5
+echo "configure:2575: checking for inet_aton in -l44bsd" >&5
 ac_lib_var=`echo 44bsd'_'inet_aton | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2546,7 +2579,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l44bsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2550 "configure"
+#line 2583 "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
@@ -2557,7 +2590,7 @@ int main() {
 inet_aton()
 ; return 0; }
 EOF
-if { (eval echo configure:2561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2589,7 +2622,7 @@ else
 fi
 
 echo $ac_n "checking for main in -lresolv""... $ac_c" 1>&6
-echo "configure:2593: checking for main in -lresolv" >&5
+echo "configure:2626: checking for main in -lresolv" >&5
 ac_lib_var=`echo resolv'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2597,14 +2630,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2601 "configure"
+#line 2634 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2632,7 +2665,7 @@ else
 fi
 
 echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
-echo "configure:2636: checking for main in -lm" >&5
+echo "configure:2669: checking for main in -lm" >&5
 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2640,14 +2673,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2644 "configure"
+#line 2677 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2651: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2676,7 +2709,7 @@ fi
 
 
 echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:2680: checking for crypt in -lcrypt" >&5
+echo "configure:2713: checking for crypt in -lcrypt" >&5
 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2684,7 +2717,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcrypt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2688 "configure"
+#line 2721 "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
@@ -2695,7 +2728,7 @@ int main() {
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:2699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2796,12 +2829,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2800: checking for $ac_func" >&5
+echo "configure:2833: 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 2805 "configure"
+#line 2838 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2824,7 +2857,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2850,7 +2883,7 @@ done
 
 
 echo $ac_n "checking if GNUregex needs to be compiled""... $ac_c" 1>&6
-echo "configure:2854: checking if GNUregex needs to be compiled" >&5
+echo "configure:2887: checking if GNUregex needs to be compiled" >&5
 if test "$ac_cv_func_regcomp" = "no" ; then
        USE_GNUREGEX="yes"
 else
@@ -2879,15 +2912,16 @@ fi
 for ac_func in \
        tempnam \
        strerror \
+       snprintf \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2886: checking for $ac_func" >&5
+echo "configure:2920: 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 2891 "configure"
+#line 2925 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2910,7 +2944,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2938,12 +2972,12 @@ done
 
 
 echo $ac_n "checking Default FD_SETSIZE value""... $ac_c" 1>&6
-echo "configure:2942: checking Default FD_SETSIZE value" >&5
+echo "configure:2976: checking Default FD_SETSIZE value" >&5
 if test "$cross_compiling" = yes; then
   DEFAULT_FD_SETSIZE=256
 else
   cat > conftest.$ac_ext <<EOF
-#line 2947 "configure"
+#line 2981 "configure"
 #include "confdefs.h"
 
 #if HAVE_STDIO_H
@@ -2967,7 +3001,7 @@ main() {
 }
 
 EOF
-if { (eval echo configure:2971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   DEFAULT_FD_SETSIZE=`cat conftestval`
 else
@@ -2986,12 +3020,12 @@ EOF
 
 
 echo $ac_n "checking Maximum number of filedescriptors we can open""... $ac_c" 1>&6
-echo "configure:2990: checking Maximum number of filedescriptors we can open" >&5
+echo "configure:3024: checking Maximum number of filedescriptors we can open" >&5
 if test "$cross_compiling" = yes; then
   SQUID_MAXFD=256
 else
   cat > conftest.$ac_ext <<EOF
-#line 2995 "configure"
+#line 3029 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -3043,7 +3077,7 @@ main() {
 }
 
 EOF
-if { (eval echo configure:3047: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   SQUID_MAXFD=`cat conftestval`
 else
@@ -3062,12 +3096,12 @@ EOF
 
 
 echo $ac_n "checking Default UDP send buffer size""... $ac_c" 1>&6
-echo "configure:3066: checking Default UDP send buffer size" >&5
+echo "configure:3100: checking Default UDP send buffer size" >&5
 if test "$cross_compiling" = yes; then
   SQUID_UDP_SO_SNDBUF=16384
 else
   cat > conftest.$ac_ext <<EOF
-#line 3071 "configure"
+#line 3105 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -3086,7 +3120,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:3090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   SQUID_UDP_SO_SNDBUF=`cat conftestval`
 else
@@ -3105,12 +3139,12 @@ EOF
 
 
 echo $ac_n "checking Default UDP receive buffer size""... $ac_c" 1>&6
-echo "configure:3109: checking Default UDP receive buffer size" >&5
+echo "configure:3143: checking Default UDP receive buffer size" >&5
 if test "$cross_compiling" = yes; then
   SQUID_UDP_SO_RCVBUF=16384
 else
   cat > conftest.$ac_ext <<EOF
-#line 3114 "configure"
+#line 3148 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -3129,7 +3163,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:3133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   SQUID_UDP_SO_RCVBUF=`cat conftestval`
 else
@@ -3148,12 +3182,12 @@ EOF
 
 
 echo $ac_n "checking Default TCP send buffer size""... $ac_c" 1>&6
-echo "configure:3152: checking Default TCP send buffer size" >&5
+echo "configure:3186: checking Default TCP send buffer size" >&5
 if test "$cross_compiling" = yes; then
   SQUID_TCP_SO_SNDBUF=16384
 else
   cat > conftest.$ac_ext <<EOF
-#line 3157 "configure"
+#line 3191 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -3172,7 +3206,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:3176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   SQUID_TCP_SO_SNDBUF=`cat conftestval`
 else
@@ -3191,12 +3225,12 @@ EOF
 
 
 echo $ac_n "checking Default TCP receive buffer size""... $ac_c" 1>&6
-echo "configure:3195: checking Default TCP receive buffer size" >&5
+echo "configure:3229: checking Default TCP receive buffer size" >&5
 if test "$cross_compiling" = yes; then
   SQUID_TCP_SO_RCVBUF=16384
 else
   cat > conftest.$ac_ext <<EOF
-#line 3200 "configure"
+#line 3234 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -3215,7 +3249,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:3219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   SQUID_TCP_SO_RCVBUF=`cat conftestval`
 else
@@ -3234,16 +3268,16 @@ EOF
 
 
 echo $ac_n "checking if sys_errlist is already defined""... $ac_c" 1>&6
-echo "configure:3238: checking if sys_errlist is already defined" >&5
+echo "configure:3272: checking if sys_errlist is already defined" >&5
 cat > conftest.$ac_ext <<EOF
-#line 3240 "configure"
+#line 3274 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 char *s = sys_errlist[0];
 ; return 0; }
 EOF
-if { (eval echo configure:3247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3281: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -3259,16 +3293,16 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for libresolv _dns_ttl_ hack""... $ac_c" 1>&6
-echo "configure:3263: checking for libresolv _dns_ttl_ hack" >&5
+echo "configure:3297: checking for libresolv _dns_ttl_ hack" >&5
 cat > conftest.$ac_ext <<EOF
-#line 3265 "configure"
+#line 3299 "configure"
 #include "confdefs.h"
 extern int _dns_ttl_;
 int main() {
 return _dns_ttl_;
 ; return 0; }
 EOF
-if { (eval echo configure:3272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 cat >> confdefs.h <<\EOF
index 1f2280f042e9c065a2f7e0e792b2769770024a31..da5b6700611f7b74ed13b55000d162e6e08d9312 100644 (file)
@@ -3,13 +3,13 @@ dnl  Configuration input file for Squid
 dnl
 dnl  Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
 dnl
-dnl  $Id: configure.in,v 1.72 1997/05/15 06:10:18 wessels Exp $
+dnl  $Id: configure.in,v 1.73 1997/06/20 00:03:25 wessels Exp $
 dnl
 dnl
 dnl
 AC_INIT(src/main.c)
 AC_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.72 $)dnl
+AC_REVISION($Revision: 1.73 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AC_CONFIG_AUX_DIR(aux)
 
@@ -232,7 +232,8 @@ dnl Check for special functions
 AC_FUNC_ALLOCA
 
 AC_CHECK_TYPE(pid_t, int)
-AC_CHECK_TYPE(size_t, int)
+AC_CHECK_TYPE(size_t, unsigned int)
+AC_CHECK_TYPE(ssize_t, int)
 AC_CHECK_TYPE(off_t, int)
 AC_CHECK_TYPE(mode_t, u_short)
 
@@ -368,6 +369,7 @@ AC_SUBST(LIBREGEX)
 AC_REPLACE_FUNCS(\
        tempnam \
        strerror \
+       snprintf \
 )
 
 AC_MSG_CHECKING(Default FD_SETSIZE value)
index 12d2b96f52f7734db351b1dd4dde8d1f7cd214f6..c22ec3225c7fb33799aaaee45a7749da3daa042b 100644 (file)
@@ -85,6 +85,9 @@
 /* Define if we should use GNU regex */
 #undef USE_GNUREGEX
 
+/* signed size_t, grr */
+#undef ssize_t
+
 /* The number of bytes in a int.  */
 #undef SIZEOF_INT
 
 /* Define if you have the sigaction function.  */
 #undef HAVE_SIGACTION
 
+/* Define if you have the snprintf function.  */
+#undef HAVE_SNPRINTF
+
 /* Define if you have the srand48 function.  */
 #undef HAVE_SRAND48
 
diff --git a/include/snprintf.h b/include/snprintf.h
new file mode 100644 (file)
index 0000000..02d06ba
--- /dev/null
@@ -0,0 +1,36 @@
+/* if you have configure you can use this */
+#if defined(HAVE_CONFIG_H)
+#include config.h
+#endif
+
+/* varargs declarations: */
+/* you might have to hand force this by doing #define HAVE_STDARG_H */
+
+#if defined(HAVE_STDARG_H)
+#include <stdarg.h>
+#define HAVE_STDARGS           /* let's hope that works everywhere (mj) */
+#define VA_LOCAL_DECL va_list ap;
+#define VA_START(f) va_start(ap, f)
+#define VA_SHIFT(v,t) ;                /* no-op for ANSI */
+#define VA_END va_end(ap)
+#else
+#if defined(HAVE_VARARGS_H)
+#include <varargs.h>
+#undef HAVE_STDARGS
+#define VA_LOCAL_DECL va_list ap;
+#define VA_START(f) va_start(ap)       /* f is ignored! */
+#define VA_SHIFT(v,t) v = va_arg(ap,t)
+#define VA_END va_end(ap)
+#else
+XX **NO VARARGS ** XX
+#endif
+#endif
+
+/* you can have ANSI C definitions */
+#ifdef HAVE_STDARGS
+int snprintf(char *str, size_t count, const char *fmt,...);
+int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
+#else
+int snprintf();
+int vsnprintf();
+#endif
diff --git a/lib/snprintf.c b/lib/snprintf.c
new file mode 100644 (file)
index 0000000..34a0401
--- /dev/null
@@ -0,0 +1,348 @@
+/**************************************************************
+ * Original:
+ * Patrick Powell Tue Apr 11 09:48:21 PDT 1995
+ * A bombproof version of doprnt (dopr) included.
+ * Sigh. This sort of thing is always nasty do deal with. Note that
+ * the version here does not include floating point...
+ *
+ * snprintf() is used instead of sprintf() as it does limit checks
+ * for string length. This covers a nasty loophole.
+ *
+ * The other functions are there to prevent NULL pointers from
+ * causing nast effects.
+ **************************************************************/
+
+/* Original RCS tag:
+  Id: snprintf.c,v 1.1 1995/08/19 20:36:09 papowell Exp */
+
+static void dopr();
+static char *end;
+
+#include "config.h"
+
+#if HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+
+/* varargs declarations: */
+
+#if defined(HAVE_STDARG_H)
+#include <stdarg.h>
+#define HAVE_STDARGS           /* let's hope that works everywhere (mj) */
+#define VA_LOCAL_DECL va_list ap;
+#define VA_START(f) va_start(ap, f)
+#define VA_SHIFT(v,t) ;                /* no-op for ANSI */
+#define VA_END va_end(ap)
+#else
+#if defined(HAVE_VARARGS_H)
+#include <varargs.h>
+#undef HAVE_STDARGS
+#define VA_LOCAL_DECL va_list ap;
+#define VA_START(f) va_start(ap)       /* f is ignored! */
+#define VA_SHIFT(v,t) v = va_arg(ap,t)
+#define VA_END va_end(ap)
+#else
+XX **NO VARARGS ** XX
+#endif
+#endif
+
+#ifdef HAVE_STDARGS
+int snprintf(char *str, size_t count, const char *fmt,...);
+int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
+#else
+int snprintf();
+int vsnprintf();
+#endif
+
+int
+vsnprintf(str, count, fmt, args)
+     char *str;
+     size_t count;
+     const char *fmt;
+     va_list args;
+{
+    str[0] = 0;
+    end = str + count - 1;
+    dopr(str, fmt, args);
+    if (count > 0) {
+       end[0] = 0;
+    }
+    return (strlen(str));
+}
+
+/* VARARGS3 */
+#ifdef HAVE_STDARGS
+int
+snprintf(char *str, size_t count, const char *fmt,...)
+#else
+int
+snprintf(va_alist)
+     va_dcl
+#endif
+{
+#ifndef HAVE_STDARGS
+    char *str;
+    size_t count;
+    char *fmt;
+#endif
+    VA_LOCAL_DECL
+
+       VA_START(fmt);
+    VA_SHIFT(str, char *);
+    VA_SHIFT(count, size_t);
+    VA_SHIFT(fmt, char *);
+    (void) vsnprintf(str, count, fmt, ap);
+    VA_END;
+    return (strlen(str));
+}
+
+/*
+ * dopr(): poor man's version of doprintf
+ */
+
+static void fmtstr(char *value, int ljust, int len, int zpad);
+static void fmtnum(long value, int base, int dosign,
+    int ljust, int len, int zpad);
+static void dostr(char *);
+static char *output;
+static void dopr_outch(int c);
+
+static void
+dopr(buffer, format, args)
+     char *buffer;
+     char *format;
+     va_list args;
+{
+    int ch;
+    long value;
+    int longflag = 0;
+    char *strvalue;
+    int ljust;
+    int len;
+    int zpad;
+
+    output = buffer;
+    while ((ch = *format++)) {
+       switch (ch) {
+       case '%':
+           ljust = len = zpad = 0;
+         nextch:
+           ch = *format++;
+           switch (ch) {
+           case 0:
+               dostr("**end of format**");
+               return;
+           case '-':
+               ljust = 1;
+               goto nextch;
+           case '0':           /* set zero padding if len not set */
+               if (len == 0)
+                   zpad = '0';
+           case '1':
+           case '2':
+           case '3':
+           case '4':
+           case '5':
+           case '6':
+           case '7':
+           case '8':
+           case '9':
+               len = len * 10 + ch - '0';
+               goto nextch;
+           case 'l':
+               longflag = 1;
+               goto nextch;
+           case 'u':
+           case 'U':
+               /*fmtnum(value,base,dosign,ljust,len,zpad) */
+               if (longflag) {
+                   value = va_arg(args, long);
+               } else {
+                   value = va_arg(args, int);
+               }
+               fmtnum(value, 10, 0, ljust, len, zpad);
+               break;
+           case 'o':
+           case 'O':
+               /*fmtnum(value,base,dosign,ljust,len,zpad) */
+               if (longflag) {
+                   value = va_arg(args, long);
+               } else {
+                   value = va_arg(args, int);
+               }
+               fmtnum(value, 8, 0, ljust, len, zpad);
+               break;
+           case 'd':
+           case 'D':
+               if (longflag) {
+                   value = va_arg(args, long);
+               } else {
+                   value = va_arg(args, int);
+               }
+               fmtnum(value, 10, 1, ljust, len, zpad);
+               break;
+           case 'x':
+               if (longflag) {
+                   value = va_arg(args, long);
+               } else {
+                   value = va_arg(args, int);
+               }
+               fmtnum(value, 16, 0, ljust, len, zpad);
+               break;
+           case 'X':
+               if (longflag) {
+                   value = va_arg(args, long);
+               } else {
+                   value = va_arg(args, int);
+               }
+               fmtnum(value, -16, 0, ljust, len, zpad);
+               break;
+           case 's':
+               strvalue = va_arg(args, char *);
+               fmtstr(strvalue, ljust, len, zpad);
+               break;
+           case 'c':
+               ch = va_arg(args, int);
+               dopr_outch(ch);
+               break;
+           case '%':
+               dopr_outch(ch);
+               continue;
+           default:
+               dostr("???????");
+           }
+           longflag = 0;
+           break;
+       default:
+           dopr_outch(ch);
+           break;
+       }
+    }
+    *output = 0;
+}
+
+static void
+fmtstr(value, ljust, len, zpad)
+     char *value;
+     int ljust, len, zpad;
+{
+    int padlen, strlen;                /* amount to pad */
+
+    if (value == 0) {
+       value = "<NULL>";
+    }
+    for (strlen = 0; value[strlen]; ++strlen); /* strlen */
+    padlen = len - strlen;
+    if (padlen < 0)
+       padlen = 0;
+    if (ljust)
+       padlen = -padlen;
+    while (padlen > 0) {
+       dopr_outch(' ');
+       --padlen;
+    }
+    dostr(value);
+    while (padlen < 0) {
+       dopr_outch(' ');
+       ++padlen;
+    }
+}
+
+static void
+fmtnum(value, base, dosign, ljust, len, zpad)
+     long value;
+     int base, dosign, ljust, len, zpad;
+{
+    int signvalue = 0;
+    unsigned long uvalue;
+    char convert[20];
+    int place = 0;
+    int padlen = 0;            /* amount to pad */
+    int caps = 0;
+
+    /* DEBUGP(("value 0x%x, base %d, dosign %d, ljust %d, len %d, zpad %d\n",
+     * value, base, dosign, ljust, len, zpad )); */
+    uvalue = value;
+    if (dosign) {
+       if (value < 0) {
+           signvalue = '-';
+           uvalue = -value;
+       }
+    }
+    if (base < 0) {
+       caps = 1;
+       base = -base;
+    }
+    do {
+       convert[place++] =
+           (caps ? "0123456789ABCDEF" : "0123456789abcdef")
+           [uvalue % (unsigned) base];
+       uvalue = (uvalue / (unsigned) base);
+    } while (uvalue);
+    convert[place] = 0;
+    padlen = len - place;
+    if (padlen < 0)
+       padlen = 0;
+    if (ljust)
+       padlen = -padlen;
+    /* DEBUGP(( "str '%s', place %d, sign %c, padlen %d\n",
+     * convert,place,signvalue,padlen)); */
+    if (zpad && padlen > 0) {
+       if (signvalue) {
+           dopr_outch(signvalue);
+           --padlen;
+           signvalue = 0;
+       }
+       while (padlen > 0) {
+           dopr_outch(zpad);
+           --padlen;
+       }
+    }
+    while (padlen > 0) {
+       dopr_outch(' ');
+       --padlen;
+    }
+    if (signvalue)
+       dopr_outch(signvalue);
+    while (place > 0)
+       dopr_outch(convert[--place]);
+    while (padlen < 0) {
+       dopr_outch(' ');
+       ++padlen;
+    }
+}
+
+static void
+dostr(str)
+     char *str;
+{
+    while (*str)
+       dopr_outch(*str++);
+}
+
+static void
+dopr_outch(c)
+     int c;
+{
+    if (iscntrl(c) && c != '\n' && c != '\t') {
+       c = '@' + (c & 0x1F);
+       if (end == 0 || output < end) {
+           *output++ = '^';
+       }
+    }
+    if (end == 0 || output < end) {
+       *output++ = c;
+    }
+}