nginx-0.0.7-2004-06-27-22:01:57 import
diff --git a/auto/endianess b/auto/endianess
new file mode 100644
index 0000000..fb9e255
--- /dev/null
+++ b/auto/endianess
@@ -0,0 +1,38 @@
+
+echo $ngx_n "checking for system endianess ..." $ngx_c
+echo >> $NGX_ERR
+echo "checking for system endianess" >> $NGX_ERR
+
+
+cat << END > $NGX_AUTOTEST.c
+
+int main() {
+    int i = 0x11223344;
+    char *p;
+
+    p = (char *) &i;
+    if (*p == 0x44) return 0;
+    return 1;
+}
+
+END
+
+eval "${CC} -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"
+
+if [ -x $NGX_AUTOTEST ]; then
+    if $NGX_AUTOTEST 2>&1 > /dev/null; then
+        echo " little endianess"
+        have=HAVE_LITTLE_ENDIAN . auto/have
+    else
+        echo " big endianess"
+    fi
+
+    rm $NGX_AUTOTEST*
+
+else
+    rm $NGX_AUTOTEST*
+
+    echo
+    echo "$0: error: can not detect system endianess"
+    exit 1
+fi
diff --git a/auto/fmt/fmt b/auto/fmt/fmt
index f1c9c59..daca069 100644
--- a/auto/fmt/fmt
+++ b/auto/fmt/fmt
@@ -11,15 +11,15 @@
 
     cat << END > $NGX_AUTOTEST.c
 
-#include <stdio.h>
 #include <sys/types.h>
 #include <sys/time.h>
+#include <stdio.h>
 #include <sys/resource.h>
 $NGX_INTTYPES_H
 $NGX_AUTO_CONFIG
 
 int main() {
-    printf("$fmt", ($ngx_type) $ngx_max_size);
+    printf("$fmt", ($ngx_type) $ngx_max_value);
     return 0;
 }
 
@@ -28,10 +28,10 @@
     eval "$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \
           >> $NGX_ERR 2>&1"
 
-    max_size=`echo $ngx_max_size | sed -e "s/L*\$//"`
+    max_value=`echo $ngx_max_value | sed -e "s/L*\$//"`
 
     if [ -x $NGX_AUTOTEST ]; then
-        if [ "`$NGX_AUTOTEST`" = $max_size ]; then
+        if [ "`$NGX_AUTOTEST`" = $max_value ]; then
             if [ $ngx_fmt_collect = yes ]; then
                 echo $ngx_n "$comma \"${fmt}\" is appropriate" $ngx_c
             else
@@ -45,7 +45,7 @@
 
     if [ $ngx_fmt != no ]; then
         if [ $ngx_fmt_collect = yes ]; then
-            eval "ngx_${ngx_bytes}_fmt=\"\${ngx_${ngx_bytes}_fmt} \$ngx_fmt\""
+            eval "ngx_${ngx_size}_fmt=\"\${ngx_${ngx_size}_fmt} \$ngx_fmt\""
             comma=","
             continue
         else
diff --git a/auto/fmt/ptrfmt b/auto/fmt/ptrfmt
index d698677..20f0d32 100644
--- a/auto/fmt/ptrfmt
+++ b/auto/fmt/ptrfmt
@@ -13,7 +13,7 @@
     cat << END > $NGX_AUTOTEST.c
 
 int main() {
-    printf("$fmt", ($ngx_type) $ngx_max_size);
+    printf("$fmt", ($ngx_type) $ngx_max_value);
     return 0;
 }
 
@@ -22,10 +22,10 @@
     eval "$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \
           >> $NGX_ERR 2>&1"
 
-    max_size=`echo $ngx_max_size | sed -e "s/L*\$//"`
+    max_value=`echo $ngx_max_value | sed -e "s/L*\$//"`
 
     if [ -x $NGX_AUTOTEST ]; then
-        if [ "`$NGX_AUTOTEST`" = $max_size ]; then
+        if [ "`$NGX_AUTOTEST`" = $max_value ]; then
             ngx_fmt=$fmt
         fi
     fi
@@ -49,8 +49,8 @@
 fi
 
 
-if [ $ngx_ptr_bytes = 4 ]; then
-    fmtX="%0`expr 2 \* $ngx_ptr_bytes`"
+if [ $ngx_ptr_size = 4 ]; then
+    fmtX="%0`expr 2 \* $ngx_ptr_size`"
 else
     fmtX="%"
 fi
diff --git a/auto/types/maxvalue b/auto/types/maxvalue
deleted file mode 100644
index 91752a2..0000000
--- a/auto/types/maxvalue
+++ /dev/null
@@ -1,6 +0,0 @@
-
-cat << END >> $NGX_AUTO_CONFIG_H
-
-#ifndef $ngx_type_max_value
-#define $ngx_type_max_value  $ngx_max_size
-#endif
diff --git a/auto/types/sizeof b/auto/types/sizeof
index ebb0fa9..102f343 100644
--- a/auto/types/sizeof
+++ b/auto/types/sizeof
@@ -3,14 +3,15 @@
 echo >> $NGX_ERR
 echo "checking for $ngx_type size" >> $NGX_ERR
 
-ngx_bytes=
+ngx_size=
 
 cat << END > $NGX_AUTOTEST.c
 
 #include <sys/types.h>
 #include <sys/time.h>
-#include <sys/resource.h>
 $NGX_UNISTD_H
+#include <signal.h>
+#include <sys/resource.h>
 $NGX_INTTYPES_H
 $NGX_AUTO_CONFIG
 
@@ -24,27 +25,31 @@
 eval "$CC $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"
 
 if [ -x $NGX_AUTOTEST ]; then
-    ngx_bytes=`$NGX_AUTOTEST`
-    echo " $ngx_bytes bytes"
+    ngx_size=`$NGX_AUTOTEST`
+    echo " $ngx_size bytes"
 fi
 
 rm $NGX_AUTOTEST*
 
-case $ngx_bytes in
+case $ngx_size in
     4)
         if [ "$ngx_type"="long" ]; then
-            ngx_max_size=2147483647L
+            ngx_max_value=2147483647L
         else
-            ngx_max_size=2147483647
+            ngx_max_value=2147483647
         fi
+
+        ngx_max_len='sizeof("-2147483648") - 1'
     ;;
 
     8)
         if [ "$ngx_type"="long long" ]; then
-            ngx_max_size=9223372036854775807LL
+            ngx_max_value=9223372036854775807LL
         else
-            ngx_max_size=9223372036854775807L
+            ngx_max_value=9223372036854775807L
         fi
+
+        ngx_max_len='sizeof("-9223372036854775808") - 1'
     ;;
 
     *)
diff --git a/auto/types/typedef b/auto/types/typedef
index 531bb7e..2bf67cf 100644
--- a/auto/types/typedef
+++ b/auto/types/typedef
@@ -10,8 +10,8 @@
 
     cat << END > $NGX_AUTOTEST.c
 
-#include <signal.h>
 #include <sys/types.h>
+#include <signal.h>
 #include <sys/socket.h>
 #include <sys/time.h>
 #include <sys/resource.h>
diff --git a/auto/types/uintptr_t b/auto/types/uintptr_t
index f46ffb6..cd2df8d 100644
--- a/auto/types/uintptr_t
+++ b/auto/types/uintptr_t
@@ -30,7 +30,7 @@
 
 
 if [ $found = no ]; then
-    found="uint`expr 8 \* $ngx_ptr_bytes`_t"
+    found="uint`expr 8 \* $ngx_ptr_size`_t"
     echo ", $found used"
 
     echo "typedef $found  uintptr_t;"   >> $NGX_AUTO_CONFIG_H
diff --git a/auto/types/value b/auto/types/value
new file mode 100644
index 0000000..c08012c
--- /dev/null
+++ b/auto/types/value
@@ -0,0 +1,6 @@
+
+cat << END >> $NGX_AUTO_CONFIG_H
+
+#ifndef $ngx_param
+#define $ngx_param  $ngx_value
+#endif
diff --git a/auto/unix b/auto/unix
index f4bc83d..36b9744 100755
--- a/auto/unix
+++ b/auto/unix
@@ -13,32 +13,31 @@
 ngx_type="long long"; . auto/types/sizeof
 ngx_formats="%lld %qd"; . auto/fmt/fmt
 
-ngx_type="void *"; . auto/types/sizeof; ngx_ptr_bytes=$ngx_bytes
+ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
 ngx_fmt_name=PTR_FMT;
-eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/ptrfmt
+eval ngx_formats=\${ngx_${ngx_ptr_size}_fmt}; . auto/fmt/ptrfmt
 
 
 # POSIX types
 
 NGX_AUTO_CONFIG="#include \"../$NGX_AUTO_CONFIG_H\""
 
-ngx_type="uint64_t"
-ngx_types="u_int64_t"; . auto/types/typedef
+ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef
 
-ngx_type="sig_atomic_t"
-ngx_types="int"; . auto/types/typedef
+ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef
+. auto/types/sizeof
+ngx_param=SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value
 
-ngx_type="socklen_t"
-ngx_types="uint32_t"; . auto/types/typedef
+ngx_type="socklen_t"; ngx_types="uint32_t"; . auto/types/typedef
 
-ngx_type="in_addr_t"
-ngx_types="uint32_t"; . auto/types/typedef
+ngx_type="in_addr_t"; ngx_types="uint32_t"; . auto/types/typedef
 
-ngx_type="rlim_t"
-ngx_types="int"; . auto/types/typedef
+ngx_type="rlim_t"; ngx_types="int"; . auto/types/typedef
 
 . auto/types/uintptr_t
 
+. auto/endianess
+
 
 # printf() formats
 
@@ -46,22 +45,24 @@
 ngx_fmt_collect=no
 
 ngx_fmt_name=OFF_T_FMT; ngx_type="off_t"; . auto/types/sizeof
-ngx_type_max_value=OFF_T_MAX_VALUE; . auto/types/maxvalue
-eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt
+ngx_param=OFF_T_MAX_VALUE; ngx_value=$ngx_max_value; . auto/types/value
+eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt
 
 ngx_fmt_name=TIME_T_FMT; ngx_type="time_t"; . auto/types/sizeof
-eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt
+ngx_param=TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
+ngx_param=TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
+eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt
 
 ngx_fmt_name=SIZE_T_FMT; ngx_type="size_t"; . auto/types/sizeof
-eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt
+eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt
 
 ngx_fmt_name=SIZE_T_X_FMT; . auto/fmt/xfmt
 
 ngx_fmt_name=PID_T_FMT; ngx_type="pid_t"; . auto/types/sizeof
-eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt
+eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt
 
 ngx_fmt_name=RLIM_T_FMT; ngx_type="rlim_t"; . auto/types/sizeof
-eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt
+eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt
 
 
 # syscalls, libc calls and some features