diff --git a/Makefile b/Makefile index a20ec68..856a360 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,20 @@ CC = gcc VERSION = 1.2.1 CFLAGS = -g -O2 -LIBS = -lz +LIBS = -lcrypto -lssl -lz INSTALL=/bin/install -c prefix=/usr/local bindir=$(prefix)${exec_prefix}/bin DESTDIR= -FLAGS=$(CFLAGS) -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1 -OBJ=containerfiles.o outputfiles.o common.o cbsnews.o dailymotion.o ehow.o youtube.o servicetypes.o extract_text.o download.o display.o +FLAGS=$(CFLAGS) -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1 +OBJ=containerfiles.o outputfiles.o common.o ehow.o youtube.o servicetypes.o extract_text.o download.o display.o all: $(OBJ) - @cd libUseful-2.0; $(MAKE) - $(CC) $(FLAGS) -o movgrab main.c $(LIBS) $(OBJ) libUseful-2.0/libUseful-2.0.a + @cd libUseful-2.4; $(MAKE) + $(CC) $(FLAGS) -o movgrab main.c $(LIBS) $(OBJ) libUseful-2.4/libUseful-2.4.a clean: - @rm -f movgrab *.o libUseful-2.0/*.o libUseful-2.0/*.a libUseful-2.0/*.so + @rm -f movgrab *.o libUseful-2.4/*.o libUseful-2.4/*.a libUseful-2.4/*.so containerfiles.o: containerfiles.c containerfiles.h $(CC) $(FLAGS) -c containerfiles.c @@ -25,12 +25,6 @@ outputfiles.o: outputfiles.c outputfiles.h common.o: common.c common.h $(CC) $(FLAGS) -c common.c -cbsnews.o: cbsnews.c cbsnews.h - $(CC) $(FLAGS) -c cbsnews.c - -dailymotion.o: dailymotion.c dailymotion.h - $(CC) $(FLAGS) -c dailymotion.c - ehow.o: ehow.c ehow.h $(CC) $(FLAGS) -c ehow.c diff --git a/Makefile.in b/Makefile.in index ba3cbe8..a8e1f19 100644 --- a/Makefile.in +++ b/Makefile.in @@ -7,14 +7,14 @@ prefix=@prefix@ bindir=$(prefix)@bindir@ DESTDIR= FLAGS=$(CFLAGS) @DEFS@ -OBJ=containerfiles.o outputfiles.o common.o cbsnews.o dailymotion.o ehow.o youtube.o servicetypes.o extract_text.o download.o display.o +OBJ=containerfiles.o outputfiles.o common.o ehow.o youtube.o servicetypes.o extract_text.o download.o display.o all: $(OBJ) - @cd libUseful-2.0; $(MAKE) - $(CC) $(FLAGS) -o movgrab main.c $(LIBS) $(OBJ) libUseful-2.0/libUseful-2.0.a + @cd libUseful-2.4; $(MAKE) + $(CC) $(FLAGS) -o movgrab main.c $(LIBS) $(OBJ) libUseful-2.4/libUseful-2.4.a clean: - @rm -f movgrab *.o libUseful-2.0/*.o libUseful-2.0/*.a libUseful-2.0/*.so + @rm -f movgrab *.o libUseful-2.4/*.o libUseful-2.4/*.a libUseful-2.4/*.so containerfiles.o: containerfiles.c containerfiles.h $(CC) $(FLAGS) -c containerfiles.c @@ -25,12 +25,6 @@ outputfiles.o: outputfiles.c outputfiles.h common.o: common.c common.h $(CC) $(FLAGS) -c common.c -cbsnews.o: cbsnews.c cbsnews.h - $(CC) $(FLAGS) -c cbsnews.c - -dailymotion.o: dailymotion.c dailymotion.h - $(CC) $(FLAGS) -c dailymotion.c - ehow.o: ehow.c ehow.h $(CC) $(FLAGS) -c ehow.c diff --git a/autom4te.cache/output.0 b/autom4te.cache/output.0 index 3483cb4..418c7ac 100644 --- a/autom4te.cache/output.0 +++ b/autom4te.cache/output.0 @@ -1,56 +1,81 @@ @%:@! /bin/sh @%:@ Guess values for system-dependent variables and create Makefiles. -@%:@ Generated by GNU Autoconf 2.60. +@%:@ Generated by GNU Autoconf 2.69. +@%:@ +@%:@ +@%:@ Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +@%:@ @%:@ -@%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -@%:@ 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @%:@ This configure script is free software; the Free Software Foundation @%:@ gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in @%:@( + *posix*) : + set -o posix ;; @%:@( + *) : + ;; +esac fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - PATH_SEPARATOR=: + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in @%:@( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi - rm -f conf$$.sh + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi @@ -59,20 +84,19 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -as_nl=' -' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +as_myself= +case $0 in @%:@(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -83,352 +107,366 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE # CDPATH. -$as_unset CDPATH - - +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in @%:@ (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST else - as_have_required=no + case \`(set -o) 2>/dev/null\` in @%:@( + *posix*) : + set -o posix ;; @%:@( + *) : + ;; +esac fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes else - exitcode=1 - echo positional parameters were not saved. + as_have_required=no fi - -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - case $as_dir in + as_found=: + case $as_dir in @%:@( /*) for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi done;; esac + as_found=false done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } IFS=$as_save_IFS - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in @%:@ (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break fi - fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS - done +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +@%:@ as_fn_unset VAR +@%:@ --------------- +@%:@ Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi +@%:@ as_fn_set_status STATUS +@%:@ ----------------------- +@%:@ Set @S|@? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} @%:@ as_fn_set_status +@%:@ as_fn_exit STATUS +@%:@ ----------------- +@%:@ Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} @%:@ as_fn_exit + +@%:@ as_fn_mkdir_p +@%:@ ------------- +@%:@ Create "@S|@as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - -fi -fi +} @%:@ as_fn_mkdir_p +@%:@ as_fn_executable_p FILE +@%:@ ----------------------- +@%:@ Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} @%:@ as_fn_executable_p +@%:@ as_fn_append VAR VALUE +@%:@ ---------------------- +@%:@ Append the text in VALUE to the end of the definition contained in VAR. Take +@%:@ advantage of any shell optimizations that allow amortized linear growth over +@%:@ repeated appends, instead of the typical quadratic growth present in naive +@%:@ implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +@%:@ as_fn_arith ARG... +@%:@ ------------------ +@%:@ Perform arithmetic evaluation on the ARGs, and store the result in the +@%:@ global @S|@as_val. Take advantage of shells that can avoid forks. The arguments +@%:@ must be portable across @S|@(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} +@%:@ as_fn_error STATUS ERROR [LINENO LOG_FD] +@%:@ ---------------------------------------- +@%:@ Output "`basename @S|@0`: error: ERROR" to stderr. If LINENO and LOG_FD are +@%:@ provided, also output the error to LOG_FD, referencing LINENO. Then exit the +@%:@ script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} @%:@ as_fn_error -exitcode=0 -if as_func_success; then - : +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. + as_expr=false fi -if as_func_ret_success; then - : +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. + as_basename=false fi -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname else - exitcode=1 - echo positional parameters were not saved. + as_dirname=false fi -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} - +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= @@ -445,9 +483,12 @@ test \$exitcode = 0") || { s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -456,75 +497,55 @@ test \$exitcode = 0") || { exit } - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in +case `echo -n x` in @%:@((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" -else - as_executable_p=: -fi -rm -f conf$$.file +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -533,11 +554,11 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - -exec 7<&0 &1 +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -552,7 +573,6 @@ cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= @@ -560,77 +580,88 @@ PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= +PACKAGE_URL= ac_unique_file="main.c" -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -VERSION -subdirs -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT -SET_MAKE -INSTALL_PROGRAM -INSTALL_SCRIPT -INSTALL_DATA -CPP -GREP -EGREP +enable_option_checking=no +ac_subst_vars='LTLIBOBJS LIB@&t@OBJS -LTLIBOBJS' +EGREP +GREP +CPP +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +SET_MAKE +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +subdirs +VERSION +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_largefiles +enable_ssl +' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS +LIBS CPPFLAGS CPP' -ac_subdirs_all='libUseful-2.0' +ac_subdirs_all='libUseful-2.4' # Initialize some variables set by options. ac_init_help= ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -686,8 +717,9 @@ do fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -729,13 +761,20 @@ do datarootdir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval enable_$ac_feature=no ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; @@ -748,13 +787,20 @@ do dvidir=$ac_optarg ;; -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval enable_$ac_feature=\$ac_optarg ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -945,22 +991,36 @@ do ac_init_version=: ;; -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval with_$ac_package=\$ac_optarg ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval with_$ac_package=no ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. @@ -980,26 +1040,26 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1007,23 +1067,36 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac fi -# Be sure to have absolute directory names. +# Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1037,8 +1110,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1053,23 +1124,21 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { echo "$as_me: error: Working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$0" || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X"$0" | + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1096,13 +1165,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1142,7 +1209,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1150,9 +1217,9 @@ Configuration: Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + @<:@@S|@ac_default_prefix@:>@ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + @<:@PREFIX@:>@ By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -1162,25 +1229,25 @@ for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root @<:@DATAROOTDIR/doc/PACKAGE@:>@ - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root @<:@DATAROOTDIR/doc/PACKAGE@:>@ + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -1192,6 +1259,7 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-largefiles enable largefile support @@ -1202,13 +1270,15 @@ Some influential environment variables: CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. +Report bugs to the package provider. _ACEOF ac_status=$? fi @@ -1216,15 +1286,17 @@ fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1249,42 +1321,208 @@ case $srcdir in ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +@%:@ ac_fn_c_try_compile LINENO +@%:@ -------------------------- +@%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} @%:@ ac_fn_c_try_compile + +@%:@ ac_fn_c_try_cpp LINENO +@%:@ ---------------------- +@%:@ Try to preprocess conftest.@S|@ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} @%:@ ac_fn_c_try_cpp + +@%:@ ac_fn_c_try_run LINENO +@%:@ ---------------------- +@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. Assumes +@%:@ that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done + ac_retval=$ac_status fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.60 +} @%:@ ac_fn_c_try_run -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit +@%:@ ac_fn_c_try_link LINENO +@%:@ ----------------------- +@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} @%:@ ac_fn_c_try_link cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.60. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -1292,9 +1530,9 @@ _ACEOF exec 5>>config.log { cat <<_ASUNAME -@%:@@%:@ --------- @%:@@%:@ -@%:@@%:@ Platform. @%:@@%:@ -@%:@@%:@ --------- @%:@@%:@ +## --------- ## +## Platform. ## +## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` @@ -1320,8 +1558,8 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done + $as_echo "PATH: $as_dir" + done IFS=$as_save_IFS } >&5 @@ -1329,9 +1567,9 @@ IFS=$as_save_IFS cat >&5 <<_ACEOF -@%:@@%:@ ----------- @%:@@%:@ -@%:@@%:@ Core tests. @%:@@%:@ -@%:@@%:@ ----------- @%:@@%:@ +## ----------- ## +## Core tests. ## +## ----------- ## _ACEOF @@ -1355,12 +1593,12 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" + as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else @@ -1376,13 +1614,13 @@ do -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args '$ac_arg'" + as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -1394,11 +1632,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -@%:@@%:@ ---------------- @%:@@%:@ -@%:@@%:@ Cache variables. @%:@@%:@ -@%:@@%:@ ---------------- @%:@@%:@ -_ASBOX + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -1407,12 +1643,13 @@ _ASBOX case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -1431,128 +1668,136 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; ) echo - cat <<\_ASBOX -@%:@@%:@ ----------------- @%:@@%:@ -@%:@@%:@ Output variables. @%:@@%:@ -@%:@@%:@ ----------------- @%:@@%:@ -_ASBOX + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - echo "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -@%:@@%:@ ------------------- @%:@@%:@ -@%:@@%:@ File substitutions. @%:@@%:@ -@%:@@%:@ ------------------- @%:@@%:@ -_ASBOX + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - echo "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - cat <<\_ASBOX -@%:@@%:@ ----------- @%:@@%:@ -@%:@@%:@ confdefs.h. @%:@@%:@ -@%:@@%:@ ----------- @%:@@%:@ -_ASBOX + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h +$as_echo "/* confdefs.h */" > confdefs.h + # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF - cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF - cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF - cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF - cat >>confdefs.h <<_ACEOF @%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + # Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - set x "$CONFIG_SITE" + # We do not want a PATH search for config.site. + case $CONFIG_SITE in @%:@(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then - set x "$prefix/share/config.site" "$prefix/etc/config.site" + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site else - set x "$ac_default_prefix/share/config.site" \ - "$ac_default_prefix/etc/config.site" + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site fi -shift -for ac_site_file +for ac_site_file in "$ac_site_file1" "$ac_site_file2" do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -1566,60 +1811,56 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi - - - - - - - - - - - - - - - - +## -------------------- ## +## Main body of script. ## +## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -1629,7 +1870,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -VERSION="1.1.14" +VERSION="1.2.1" ac_aux_dir= @@ -1649,9 +1890,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -1663,7 +1902,9 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -subdirs="$subdirs libUseful-2.0" + + +subdirs="$subdirs libUseful-2.4" ac_ext=c @@ -1674,10 +1915,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1687,25 +1928,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1714,10 +1955,10 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1727,25 +1968,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -1753,12 +1994,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -1771,10 +2008,10 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1784,25 +2021,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1811,10 +2048,10 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1825,18 +2062,18 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then @@ -1855,11 +2092,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1870,10 +2107,10 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1883,25 +2120,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1914,10 +2151,10 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1927,25 +2164,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1957,12 +2194,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -1972,51 +2205,37 @@ fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2028,59 +2247,55 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + ac_rmfiles= for ac_file in $ac_files do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles -if { (ac_try="$ac_link_default" +if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. -for ac_file in $ac_files +for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -2097,76 +2312,43 @@ done test "$ac_cv_exeext" = no && ac_cv_exeext= else - echo "$as_me: failed program was:" >&5 + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -rm -f a.out a.exe conftest$ac_cv_exeext b.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -2174,37 +2356,90 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +@%:@include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2216,51 +2451,46 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" +if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi - rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2274,71 +2504,34 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no + ac_compiler_gnu=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2349,107 +2542,11 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2460,59 +2557,34 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes +if ac_fn_c_try_compile "$LINENO"; then : + else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - -fi +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -2528,23 +2600,18 @@ else CFLAGS= fi fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -2596,49 +2663,10 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext @@ -2648,17 +2676,19 @@ fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac - +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -2672,18 +2702,19 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } -set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -2693,12 +2724,12 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } SET_MAKE= else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -2715,22 +2746,23 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in @%:@(( + ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -2738,7 +2770,7 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2748,17 +2780,29 @@ case $as_dir/ in # program-specific install script used by HP pwplus--don't use. : else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi fi fi done done ;; esac -done + + done IFS=$as_save_IFS +rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then @@ -2771,8 +2815,8 @@ fi INSTALL=$ac_install_sh fi fi -{ echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -2788,15 +2832,15 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" @@ -2810,11 +2854,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@ifdef __STDC__ @%:@ include @@ -2823,90 +2863,34 @@ cat >>conftest.$ac_ext <<_ACEOF @%:@endif Syntax error _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : +if ac_fn_c_try_cpp "$LINENO"; then : + else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Broken: fails on valid input. continue fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : break fi @@ -2918,8 +2902,8 @@ fi else ac_cv_prog_CPP=$CPP fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -2929,11 +2913,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@ifdef __STDC__ @%:@ include @@ -2942,97 +2922,40 @@ cat >>conftest.$ac_ext <<_ACEOF @%:@endif Syntax error _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : +if ac_fn_c_try_cpp "$LINENO"; then : + else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Broken: fails on valid input. continue fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @%:@include _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -3042,45 +2965,40 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 else + if test -z "$GREP"; then ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` + as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" @@ -3092,77 +3010,61 @@ case `"$ac_path_GREP" --version 2>&1` in rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac - - $ac_path_GREP_found && break 3 + $ac_path_GREP_found && break 3 + done + done done -done - -done IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else ac_cv_path_GREP=$GREP fi - fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + if test -z "$EGREP"; then ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` + as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" @@ -3174,46 +3076,31 @@ case `"$ac_path_EGREP" --version 2>&1` in rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac - - $ac_path_EGREP_found && break 3 + $ac_path_EGREP_found && break 3 + done + done done -done - -done IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else ac_cv_path_EGREP=$EGREP fi - fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3228,64 +3115,23 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no + ac_cv_header_stdc=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : + $EGREP "memchr" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -3295,18 +3141,14 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : + $EGREP "free" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -3316,14 +3158,10 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : : else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3350,65 +3188,34 @@ main () return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : +if ac_fn_c_try_run "$LINENO"; then : + else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no + ac_cv_header_stdc=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then -cat >>confdefs.h <<\_ACEOF -@%:@define STDC_HEADERS 1 -_ACEOF +$as_echo "@%:@define STDC_HEADERS 1" >>confdefs.h fi - -{ echo "$as_me:$LINENO: checking for deflate in -lz" >&5 -echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6; } -if test "${ac_cv_lib_z_deflate+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5 +$as_echo_n "checking for deflate in -lz... " >&6; } +if ${ac_cv_lib_z_deflate+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -3426,55 +3233,18 @@ return deflate (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_deflate=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_z_deflate=no + ac_cv_lib_z_deflate=no fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_deflate" >&5 -echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6; } -if test $ac_cv_lib_z_deflate = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflate" >&5 +$as_echo "$ac_cv_lib_z_deflate" >&6; } +if test "x$ac_cv_lib_z_deflate" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_LIBZ 1 _ACEOF @@ -3485,44 +3255,35 @@ fi cf_have_libz=$ac_cv_lib_z_deflate -# Check whether --enable-largefiles was given. -if test "${enable_largefiles+set}" = set; then +@%:@ Check whether --enable-largefiles was given. +if test "${enable_largefiles+set}" = set; then : enableval=$enable_largefiles; cf_use_largefiles=$enableval fi -# Check whether --enable-ssl was given. -if test "${enable_ssl+set}" = set; then +@%:@ Check whether --enable-ssl was given. +if test "${enable_ssl+set}" = set; then : enableval=$enable_ssl; cf_use_ssl=$enableval fi -if test "$cf_use_largefiles" = "yes" +if test "$cf_use_largefiles" != "no" then -cat >>confdefs.h <<\_ACEOF -@%:@define _LARGEFILE64_SOURCE 1 -_ACEOF +$as_echo "@%:@define _LARGEFILE64_SOURCE 1" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -@%:@define _FILE_OFFSET_BITS 64 -_ACEOF +$as_echo "@%:@define _FILE_OFFSET_BITS 64" >>confdefs.h fi if test "$cf_use_ssl" = "yes" then - -{ echo "$as_me:$LINENO: checking for SSL_library_init in -lssl" >&5 -echo $ECHO_N "checking for SSL_library_init in -lssl... $ECHO_C" >&6; } -if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5 +$as_echo_n "checking for SSL_library_init in -lssl... " >&6; } +if ${ac_cv_lib_ssl_SSL_library_init+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lssl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -3540,55 +3301,18 @@ return SSL_library_init (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ssl_SSL_library_init=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_ssl_SSL_library_init=no + ac_cv_lib_ssl_SSL_library_init=no fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_library_init" >&5 -echo "${ECHO_T}$ac_cv_lib_ssl_SSL_library_init" >&6; } -if test $ac_cv_lib_ssl_SSL_library_init = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5 +$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; } +if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_LIBSSL 1 _ACEOF @@ -3599,19 +3323,14 @@ fi cf_have_libssl=$ac_cv_lib_ssl_SSL_library_init - -{ echo "$as_me:$LINENO: checking for EVP_CIPHER_CTX_init in -lcrypto" >&5 -echo $ECHO_N "checking for EVP_CIPHER_CTX_init in -lcrypto... $ECHO_C" >&6; } -if test "${ac_cv_lib_crypto_EVP_CIPHER_CTX_init+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_CIPHER_CTX_init in -lcrypto" >&5 +$as_echo_n "checking for EVP_CIPHER_CTX_init in -lcrypto... " >&6; } +if ${ac_cv_lib_crypto_EVP_CIPHER_CTX_init+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -3629,55 +3348,18 @@ return EVP_CIPHER_CTX_init (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_crypto_EVP_CIPHER_CTX_init=no + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=no fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&5 -echo "${ECHO_T}$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&6; } -if test $ac_cv_lib_crypto_EVP_CIPHER_CTX_init = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&5 +$as_echo "$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&6; } +if test "x$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" = xyes; then : cat >>confdefs.h <<_ACEOF @%:@define HAVE_LIBCRYPTO 1 _ACEOF @@ -3719,12 +3401,13 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -3732,8 +3415,8 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" @@ -3755,13 +3438,24 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { echo "$as_me:$LINENO: updating cache $cache_file" >&5 -echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else - { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -3778,6 +3472,12 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g @@ -3804,14 +3504,15 @@ DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`echo "$ac_i" | sed "$ac_script"` + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIB@&t@OBJS=$ac_libobjs @@ -3819,12 +3520,14 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -3834,55 +3537,79 @@ cat >$CONFIG_STATUS <<_ACEOF debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in @%:@( + *posix*) : + set -o posix ;; @%:@( + *) : + ;; +esac fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - PATH_SEPARATOR=: + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in @%:@( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi - rm -f conf$$.sh + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi @@ -3891,20 +3618,19 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -as_nl=' -' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +as_myself= +case $0 in @%:@(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -3915,32 +3641,111 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +@%:@ as_fn_error STATUS ERROR [LINENO LOG_FD] +@%:@ ---------------------------------------- +@%:@ Output "`basename @S|@0`: error: ERROR" to stderr. If LINENO and LOG_FD are +@%:@ provided, also output the error to LOG_FD, referencing LINENO. Then exit the +@%:@ script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi -done + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} @%:@ as_fn_error + + +@%:@ as_fn_set_status STATUS +@%:@ ----------------------- +@%:@ Set @S|@? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} @%:@ as_fn_set_status + +@%:@ as_fn_exit STATUS +@%:@ ----------------- +@%:@ Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} @%:@ as_fn_exit + +@%:@ as_fn_unset VAR +@%:@ --------------- +@%:@ Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +@%:@ as_fn_append VAR VALUE +@%:@ ---------------------- +@%:@ Append the text in VALUE to the end of the definition contained in VAR. Take +@%:@ advantage of any shell optimizations that allow amortized linear growth over +@%:@ repeated appends, instead of the typical quadratic growth present in naive +@%:@ implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +@%:@ as_fn_arith ARG... +@%:@ ------------------ +@%:@ Perform arithmetic evaluation on the ARGs, and store the result in the +@%:@ global @S|@as_val. Take advantage of shells that can avoid forks. The arguments +@%:@ must be portable across @S|@(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + -# Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -3954,13 +3759,17 @@ else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -3975,122 +3784,118 @@ echo X/"$0" | } s/.*/./; q'` -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in +case `echo -n x` in @%:@((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null + +@%:@ as_fn_mkdir_p +@%:@ ------------- +@%:@ Create "@S|@as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} @%:@ as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" -else - as_executable_p=: -fi -rm -f conf$$.file + +@%:@ as_fn_executable_p FILE +@%:@ ----------------------- +@%:@ Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} @%:@ as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -4100,13 +3905,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 -# Save the log message, to keep $[0] and so on meaningful, and to +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.60. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4119,60 +3930,75 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE Configuration files: $config_files -Report bugs to ." +Report bugs to the package provider." _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.60, - with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" -Copyright (C) 2006 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) + --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -4185,25 +4011,30 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" + *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac @@ -4218,30 +4049,32 @@ if $ac_cs_silent; then fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=$SHELL + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' export CONFIG_SHELL - exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + exec "\$@" fi _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX @%:@@%:@ Running $as_me. @%:@@%:@ _ASBOX - echo "$ac_log" + $as_echo "$ac_log" } >&5 _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets @@ -4249,9 +4082,7 @@ do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -4272,166 +4103,194 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# -# Set up the sed scripts for CONFIG_FILES section. -# +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then -_ACEOF +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -SHELL!$SHELL$ac_delim -PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim -PACKAGE_NAME!$PACKAGE_NAME$ac_delim -PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim -PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim -PACKAGE_STRING!$PACKAGE_STRING$ac_delim -PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim -exec_prefix!$exec_prefix$ac_delim -prefix!$prefix$ac_delim -program_transform_name!$program_transform_name$ac_delim -bindir!$bindir$ac_delim -sbindir!$sbindir$ac_delim -libexecdir!$libexecdir$ac_delim -datarootdir!$datarootdir$ac_delim -datadir!$datadir$ac_delim -sysconfdir!$sysconfdir$ac_delim -sharedstatedir!$sharedstatedir$ac_delim -localstatedir!$localstatedir$ac_delim -includedir!$includedir$ac_delim -oldincludedir!$oldincludedir$ac_delim -docdir!$docdir$ac_delim -infodir!$infodir$ac_delim -htmldir!$htmldir$ac_delim -dvidir!$dvidir$ac_delim -pdfdir!$pdfdir$ac_delim -psdir!$psdir$ac_delim -libdir!$libdir$ac_delim -localedir!$localedir$ac_delim -mandir!$mandir$ac_delim -DEFS!$DEFS$ac_delim -ECHO_C!$ECHO_C$ac_delim -ECHO_N!$ECHO_N$ac_delim -ECHO_T!$ECHO_T$ac_delim -LIBS!$LIBS$ac_delim -build_alias!$build_alias$ac_delim -host_alias!$host_alias$ac_delim -target_alias!$target_alias$ac_delim -VERSION!$VERSION$ac_delim -subdirs!$subdirs$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -SET_MAKE!$SET_MAKE$ac_delim -INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim -INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim -INSTALL_DATA!$INSTALL_DATA$ac_delim -CPP!$CPP$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim -LIB@&t@OBJS!$LIB@&t@OBJS$ac_delim -LTLIBOBJS!$LTLIBOBJS$ac_delim -_ACEOF + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 55; then + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done +rm -f conf$$subs.sh -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACAWK _ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g -CEOF$ac_eof +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" -for ac_tag in :F $CONFIG_FILES +eval set X " :F $CONFIG_FILES " +shift +for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} - { (exit 1); exit 1; }; };; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -4450,7 +4309,7 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;} for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -4459,26 +4318,34 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;} [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - ac_file_inputs="$ac_file_inputs $ac_f" + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -4488,42 +4355,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | +$as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -4541,20 +4373,15 @@ echo X"$as_dir" | q } s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -4594,12 +4421,12 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix esac _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= - -case `sed -n '/datarootdir/ { +ac_sed_dataroot=' +/datarootdir/ { p q } @@ -4607,36 +4434,37 @@ case `sed -n '/datarootdir/ { /@docdir@/p /@infodir@/p /@localedir@/p -/@mandir@/p -' $ac_file_inputs` in +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; + s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub $extrasub _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t +s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t @@ -4646,21 +4474,25 @@ s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -4670,11 +4502,13 @@ which seems to be undefined. Please make sure it is defined." >&2;} done # for ac_tag -{ (exit 0); exit 0; } +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -4694,7 +4528,7 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } + $ac_cs_success || as_fn_exit 1 fi # @@ -4702,7 +4536,8 @@ fi # if test "$no_recursion" != yes; then - # Remove --cache-file and --srcdir arguments so they do not pile up. + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" @@ -4731,11 +4566,13 @@ if test "$no_recursion" != yes; then ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; + --disable-option-checking) + ;; *) case $ac_arg in - *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;; + as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac done @@ -4743,9 +4580,18 @@ if test "$no_recursion" != yes; then # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in - *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - ac_sub_configure_args="$ac_arg $ac_sub_configure_args" + ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" + + # Pass --silent + if test "$silent" = yes; then + ac_sub_configure_args="--silent $ac_sub_configure_args" + fi + + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue @@ -4755,57 +4601,17 @@ if test "$no_recursion" != yes; then test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" - echo "$as_me:$LINENO: $ac_msg" >&5 - echo "$ac_msg" >&6 - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 + $as_echo "$ac_msg" >&6 + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -4844,8 +4650,8 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix # This should be Cygnus configure. ac_sub_configure=$ac_aux_dir/configure else - { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 -echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 +$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi @@ -4858,19 +4664,21 @@ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac - { echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 -echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || - { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 -echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 fi cd "$ac_popdir" done fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi echo @@ -4882,7 +4690,7 @@ else echo "SSL and https enabled" fi -if test "$cf_use_largefiles" != "yes" +if test "$cf_use_largefiles" = "no" then echo "Largefiles NOT enabled" else diff --git a/autom4te.cache/requests b/autom4te.cache/requests index 5d439b1..0ff5f0e 100644 --- a/autom4te.cache/requests +++ b/autom4te.cache/requests @@ -14,115 +14,63 @@ 'configure.in' ], { - '_LT_AC_TAGCONFIG' => 1, 'AM_PROG_F77_C_O' => 1, + '_LT_AC_TAGCONFIG' => 1, 'm4_pattern_forbid' => 1, + 'AC_INIT' => 1, 'AC_CANONICAL_TARGET' => 1, + '_AM_COND_IF' => 1, 'AC_CONFIG_LIBOBJ_DIR' => 1, - 'AC_TYPE_OFF_T' => 1, - 'AC_C_VOLATILE' => 1, - 'AC_FUNC_CLOSEDIR_VOID' => 1, - 'AC_REPLACE_FNMATCH' => 1, - 'AC_PROG_LIBTOOL' => 1, - 'AC_FUNC_STAT' => 1, - 'AC_HEADER_TIME' => 1, - 'AC_FUNC_WAIT3' => 1, - 'AM_AUTOMAKE_VERSION' => 1, - 'AC_STRUCT_TM' => 1, - 'AC_FUNC_LSTAT' => 1, - 'AC_TYPE_MODE_T' => 1, - 'AC_FUNC_GETMNTENT' => 1, - 'AC_FUNC_STRTOD' => 1, - 'AC_CHECK_HEADERS' => 1, - 'LT_CONFIG_LTDL_DIR' => 1, - 'AC_FUNC_STRNLEN' => 1, - 'm4_sinclude' => 1, - 'AC_PROG_CXX' => 1, - 'AC_PATH_X' => 1, - 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, - 'AC_PROG_AWK' => 1, - '_m4_warn' => 1, - 'AC_HEADER_STDC' => 1, - 'AC_HEADER_MAJOR' => 1, - 'AM_PROG_CXX_C_O' => 1, - 'LT_INIT' => 1, - 'AC_FUNC_ERROR_AT_LINE' => 1, - 'AC_PROG_GCC_TRADITIONAL' => 1, - 'AC_LIBSOURCE' => 1, - 'AC_FUNC_MBRTOWC' => 1, - 'AC_STRUCT_ST_BLOCKS' => 1, - 'AM_PROG_FC_C_O' => 1, - 'AC_CANONICAL_BUILD' => 1, - 'AC_TYPE_SIGNAL' => 1, - 'AC_TYPE_UID_T' => 1, - '_AM_SUBST_NOTMAKE' => 1, - 'AC_CONFIG_AUX_DIR' => 1, - 'AC_PROG_MAKE_SET' => 1, - 'sinclude' => 1, - 'm4_pattern_allow' => 1, - 'AC_DEFINE_TRACE_LITERAL' => 1, - 'AC_FUNC_STRERROR_R' => 1, - 'AC_PROG_CC' => 1, - 'AC_FUNC_FORK' => 1, - 'AC_DECL_SYS_SIGLIST' => 1, - 'AC_FUNC_VPRINTF' => 1, - 'AC_FUNC_STRCOLL' => 1, - 'AC_PROG_YACC' => 1, - 'AC_SUBST_TRACE' => 1, - 'AC_INIT' => 1, - 'AC_STRUCT_TIMEZONE' => 1, - 'AC_FUNC_CHOWN' => 1, 'AC_SUBST' => 1, - 'AC_FUNC_ALLOCA' => 1, - 'AC_FC_SRCEXT' => 1, 'AC_CANONICAL_HOST' => 1, - 'AC_FUNC_GETPGRP' => 1, - 'AC_PROG_RANLIB' => 1, + 'AC_FC_SRCEXT' => 1, + 'AC_PROG_LIBTOOL' => 1, 'AM_INIT_AUTOMAKE' => 1, - 'AC_FUNC_SETPGRP' => 1, 'AC_CONFIG_SUBDIRS' => 1, - 'AC_FUNC_MMAP' => 1, - 'AC_FUNC_REALLOC' => 1, - 'AC_TYPE_SIZE_T' => 1, - 'AC_REQUIRE_AUX_FILE' => 1, + 'AM_PATH_GUILE' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'LT_CONFIG_LTDL_DIR' => 1, 'AC_CONFIG_LINKS' => 1, - 'AC_CHECK_TYPES' => 1, + 'AC_REQUIRE_AUX_FILE' => 1, 'LT_SUPPORTED_TAG' => 1, - 'AC_CHECK_MEMBERS' => 1, + 'm4_sinclude' => 1, 'AM_MAINTAINER_MODE' => 1, - 'AC_FUNC_UTIME_NULL' => 1, - 'AC_FUNC_SELECT_ARGTYPES' => 1, - 'AC_FUNC_STRFTIME' => 1, - 'AC_HEADER_STAT' => 1, - 'AC_C_INLINE' => 1, - 'AC_PROG_CPP' => 1, - 'AC_TYPE_PID_T' => 1, - 'AC_C_CONST' => 1, - 'AC_PROG_LEX' => 1, + 'AM_NLS' => 1, + 'AC_FC_PP_DEFINE' => 1, + 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, + '_m4_warn' => 1, + 'AM_MAKEFILE_INCLUDE' => 1, + 'AM_PROG_CXX_C_O' => 1, + '_AM_MAKEFILE_INCLUDE' => 1, + '_AM_COND_ENDIF' => 1, + 'AM_ENABLE_MULTILIB' => 1, + 'AM_SILENT_RULES' => 1, + 'AM_PROG_MOC' => 1, 'AC_CONFIG_FILES' => 1, + 'LT_INIT' => 1, 'include' => 1, - 'AC_FUNC_SETVBUF_REVERSED' => 1, - 'AC_PROG_INSTALL' => 1, 'AM_GNU_GETTEXT' => 1, - 'AC_FUNC_OBSTACK' => 1, - 'AC_CHECK_LIB' => 1, - 'AC_FUNC_MALLOC' => 1, - 'AC_FUNC_GETGROUPS' => 1, + 'AM_PROG_AR' => 1, + 'AC_LIBSOURCE' => 1, + 'AC_CANONICAL_BUILD' => 1, + 'AM_PROG_FC_C_O' => 1, 'AC_FC_FREEFORM' => 1, - 'AC_FUNC_GETLOADAVG' => 1, + 'AC_FC_PP_SRCEXT' => 1, 'AH_OUTPUT' => 1, - 'AC_FUNC_FSEEKO' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + '_AM_SUBST_NOTMAKE' => 1, + 'm4_pattern_allow' => 1, 'AM_PROG_CC_C_O' => 1, + 'sinclude' => 1, 'AM_CONDITIONAL' => 1, 'AC_CANONICAL_SYSTEM' => 1, - 'AC_FUNC_MKTIME' => 1, + 'AM_XGETTEXT_OPTION' => 1, 'AC_CONFIG_HEADERS' => 1, - 'AC_HEADER_SYS_WAIT' => 1, - 'AC_FUNC_MEMCMP' => 1, - 'AC_PROG_LN_S' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AM_POT_TOOLS' => 1, 'm4_include' => 1, - 'AC_HEADER_DIRENT' => 1, - 'AC_CHECK_FUNCS' => 1 + '_AM_COND_ELSE' => 1, + 'AC_SUBST_TRACE' => 1 } ], 'Autom4te::Request' ) ); diff --git a/autom4te.cache/traces.0 b/autom4te.cache/traces.0 index b1117a4..78107c7 100644 --- a/autom4te.cache/traces.0 +++ b/autom4te.cache/traces.0 @@ -6,7 +6,7 @@ m4trace:configure.in:3: -1- m4_pattern_allow([^AS_FLAGS$]) m4trace:configure.in:3: -1- m4_pattern_forbid([^_?m4_]) m4trace:configure.in:3: -1- m4_pattern_forbid([^dnl$]) m4trace:configure.in:3: -1- m4_pattern_forbid([^_?AS_]) -m4trace:configure.in:3: -1- AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}]) +m4trace:configure.in:3: -1- AC_SUBST([SHELL]) m4trace:configure.in:3: -1- AC_SUBST_TRACE([SHELL]) m4trace:configure.in:3: -1- m4_pattern_allow([^SHELL$]) m4trace:configure.in:3: -1- AC_SUBST([PATH_SEPARATOR]) @@ -27,6 +27,9 @@ m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_STRING$]) m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) m4trace:configure.in:3: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT]) m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_URL], [m4_ifdef([AC_PACKAGE_URL], ['AC_PACKAGE_URL'])]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([PACKAGE_URL]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_URL$]) m4trace:configure.in:3: -1- AC_SUBST([exec_prefix], [NONE]) m4trace:configure.in:3: -1- AC_SUBST_TRACE([exec_prefix]) m4trace:configure.in:3: -1- m4_pattern_allow([^exec_prefix$]) @@ -98,23 +101,27 @@ m4trace:configure.in:3: -1- m4_pattern_allow([^mandir$]) m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_NAME$]) m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ -#undef PACKAGE_NAME]) +@%:@undef PACKAGE_NAME]) m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME]) +@%:@undef PACKAGE_TARNAME]) m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_VERSION$]) m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ -#undef PACKAGE_VERSION]) +@%:@undef PACKAGE_VERSION]) m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_STRING$]) m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING]) +@%:@undef PACKAGE_STRING]) m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT]) +@%:@undef PACKAGE_BUGREPORT]) +m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_URL]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_URL$]) +m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_URL], [/* Define to the home page for this package. */ +@%:@undef PACKAGE_URL]) m4trace:configure.in:3: -1- AC_SUBST([DEFS]) m4trace:configure.in:3: -1- AC_SUBST_TRACE([DEFS]) m4trace:configure.in:3: -1- m4_pattern_allow([^DEFS$]) @@ -142,11 +149,10 @@ m4trace:configure.in:3: -1- m4_pattern_allow([^target_alias$]) m4trace:configure.in:6: -1- AC_SUBST([VERSION]) m4trace:configure.in:6: -1- AC_SUBST_TRACE([VERSION]) m4trace:configure.in:6: -1- m4_pattern_allow([^VERSION$]) -m4trace:configure.in:8: -1- AC_CONFIG_SUBDIRS([libUseful-2.0]) -m4trace:configure.in:8: -1- AC_SUBST([subdirs], ["$subdirs m4_normalize([libUseful-2.0])"]) +m4trace:configure.in:8: -1- AC_CONFIG_SUBDIRS([libUseful-2.4]) +m4trace:configure.in:8: -1- AC_SUBST([subdirs], ["$subdirs m4_normalize([libUseful-2.4])"]) m4trace:configure.in:8: -1- AC_SUBST_TRACE([subdirs]) m4trace:configure.in:8: -1- m4_pattern_allow([^subdirs$]) -m4trace:configure.in:10: -1- AC_PROG_CC m4trace:configure.in:10: -1- AC_SUBST([CC]) m4trace:configure.in:10: -1- AC_SUBST_TRACE([CC]) m4trace:configure.in:10: -1- m4_pattern_allow([^CC$]) @@ -156,6 +162,9 @@ m4trace:configure.in:10: -1- m4_pattern_allow([^CFLAGS$]) m4trace:configure.in:10: -1- AC_SUBST([LDFLAGS]) m4trace:configure.in:10: -1- AC_SUBST_TRACE([LDFLAGS]) m4trace:configure.in:10: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.in:10: -1- AC_SUBST([LIBS]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.in:10: -1- m4_pattern_allow([^LIBS$]) m4trace:configure.in:10: -1- AC_SUBST([CPPFLAGS]) m4trace:configure.in:10: -1- AC_SUBST_TRACE([CPPFLAGS]) m4trace:configure.in:10: -1- m4_pattern_allow([^CPPFLAGS$]) @@ -181,13 +190,11 @@ m4trace:configure.in:10: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) m4trace:configure.in:10: -1- AC_SUBST_TRACE([OBJEXT]) m4trace:configure.in:10: -1- m4_pattern_allow([^OBJEXT$]) m4trace:configure.in:11: -1- _m4_warn([obsolete], [The macro `AC_LANG_C' is obsolete. -You should run autoupdate.], [../../lib/autoconf/c.m4:73: AC_LANG_C is expanded from... +You should run autoupdate.], [../../lib/autoconf/c.m4:72: AC_LANG_C is expanded from... configure.in:11: the top level]) -m4trace:configure.in:12: -1- AC_PROG_MAKE_SET m4trace:configure.in:12: -1- AC_SUBST([SET_MAKE]) m4trace:configure.in:12: -1- AC_SUBST_TRACE([SET_MAKE]) m4trace:configure.in:12: -1- m4_pattern_allow([^SET_MAKE$]) -m4trace:configure.in:13: -1- AC_PROG_INSTALL m4trace:configure.in:13: -1- AC_REQUIRE_AUX_FILE([install-sh]) m4trace:configure.in:13: -1- AC_SUBST([INSTALL_PROGRAM]) m4trace:configure.in:13: -1- AC_SUBST_TRACE([INSTALL_PROGRAM]) @@ -198,8 +205,6 @@ m4trace:configure.in:13: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) m4trace:configure.in:13: -1- AC_SUBST([INSTALL_DATA]) m4trace:configure.in:13: -1- AC_SUBST_TRACE([INSTALL_DATA]) m4trace:configure.in:13: -1- m4_pattern_allow([^INSTALL_DATA$]) -m4trace:configure.in:14: -1- AC_HEADER_STDC -m4trace:configure.in:14: -1- AC_PROG_CPP m4trace:configure.in:14: -1- AC_SUBST([CPP]) m4trace:configure.in:14: -1- AC_SUBST_TRACE([CPP]) m4trace:configure.in:14: -1- m4_pattern_allow([^CPP$]) @@ -212,36 +217,27 @@ m4trace:configure.in:14: -1- m4_pattern_allow([^CPP$]) m4trace:configure.in:14: -1- AC_SUBST([GREP]) m4trace:configure.in:14: -1- AC_SUBST_TRACE([GREP]) m4trace:configure.in:14: -1- m4_pattern_allow([^GREP$]) -m4trace:configure.in:14: -1- AC_SUBST([GREP]) -m4trace:configure.in:14: -1- AC_SUBST_TRACE([GREP]) -m4trace:configure.in:14: -1- m4_pattern_allow([^GREP$]) -m4trace:configure.in:14: -1- AC_SUBST([EGREP]) -m4trace:configure.in:14: -1- AC_SUBST_TRACE([EGREP]) -m4trace:configure.in:14: -1- m4_pattern_allow([^EGREP$]) m4trace:configure.in:14: -1- AC_SUBST([EGREP]) m4trace:configure.in:14: -1- AC_SUBST_TRACE([EGREP]) m4trace:configure.in:14: -1- m4_pattern_allow([^EGREP$]) m4trace:configure.in:14: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) m4trace:configure.in:14: -1- m4_pattern_allow([^STDC_HEADERS$]) m4trace:configure.in:14: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS]) -m4trace:configure.in:16: -1- AC_CHECK_LIB([z], [deflate], [], []) +@%:@undef STDC_HEADERS]) m4trace:configure.in:16: -1- AH_OUTPUT([HAVE_LIBZ], [/* Define to 1 if you have the `z\' library (-lz). */ -#undef HAVE_LIBZ]) +@%:@undef HAVE_LIBZ]) m4trace:configure.in:16: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBZ]) m4trace:configure.in:16: -1- m4_pattern_allow([^HAVE_LIBZ$]) m4trace:configure.in:24: -1- AC_DEFINE_TRACE_LITERAL([_LARGEFILE64_SOURCE]) m4trace:configure.in:24: -1- m4_pattern_allow([^_LARGEFILE64_SOURCE$]) m4trace:configure.in:25: -1- AC_DEFINE_TRACE_LITERAL([_FILE_OFFSET_BITS]) m4trace:configure.in:25: -1- m4_pattern_allow([^_FILE_OFFSET_BITS$]) -m4trace:configure.in:30: -1- AC_CHECK_LIB([ssl], [SSL_library_init], [], []) m4trace:configure.in:30: -1- AH_OUTPUT([HAVE_LIBSSL], [/* Define to 1 if you have the `ssl\' library (-lssl). */ -#undef HAVE_LIBSSL]) +@%:@undef HAVE_LIBSSL]) m4trace:configure.in:30: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBSSL]) m4trace:configure.in:30: -1- m4_pattern_allow([^HAVE_LIBSSL$]) -m4trace:configure.in:33: -1- AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_init], [], []) m4trace:configure.in:33: -1- AH_OUTPUT([HAVE_LIBCRYPTO], [/* Define to 1 if you have the `crypto\' library (-lcrypto). */ -#undef HAVE_LIBCRYPTO]) +@%:@undef HAVE_LIBCRYPTO]) m4trace:configure.in:33: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBCRYPTO]) m4trace:configure.in:33: -1- m4_pattern_allow([^HAVE_LIBCRYPTO$]) m4trace:configure.in:39: -1- AC_CONFIG_FILES([Makefile]) @@ -254,6 +250,7 @@ m4trace:configure.in:39: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) m4trace:configure.in:39: -1- AC_SUBST_TRACE([LTLIBOBJS]) m4trace:configure.in:39: -1- m4_pattern_allow([^LTLIBOBJS$]) m4trace:configure.in:39: -1- AC_SUBST_TRACE([top_builddir]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([top_build_prefix]) m4trace:configure.in:39: -1- AC_SUBST_TRACE([srcdir]) m4trace:configure.in:39: -1- AC_SUBST_TRACE([abs_srcdir]) m4trace:configure.in:39: -1- AC_SUBST_TRACE([top_srcdir]) diff --git a/cbsnews.c b/cbsnews.c deleted file mode 100644 index 71035d3..0000000 --- a/cbsnews.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "cbsnews.h" - -void ExtractCBSNews(ListNode *Vars, char *Line) -{ -char *ptr, *Tempstr=NULL, *Token=NULL; - -#define CBSNEWS_ITEM_START "var sourc = '" -#define CBSNEWS_ITEM_END "'" - -if (strstr(Line,CBSNEWS_ITEM_START)) -{ - - GenericExtractFromLine(Line, "tmpitem",CBSNEWS_ITEM_START,CBSNEWS_ITEM_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); - - Token=CopyStr(Token,GetVar(Vars,"tmpitem")); - if (StrLen(Token) > 7) - { - ptr=strstr(Token+7,"http://"); - - if (ptr) Tempstr=CopyStrLen(Tempstr,Token,ptr-Token); - else Tempstr=CopyStr(Tempstr,Token); - SetVar(Vars,"item:mp4",Tempstr); - - if (StrLen(ptr)) SetVar(Vars,"item:m4v",ptr); - } - -} - -DestroyString(Tempstr); -DestroyString(Token); -} - diff --git a/cbsnews.h b/cbsnews.h deleted file mode 100644 index 2be43f4..0000000 --- a/cbsnews.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef MOVGRAB_CBSNEWS -#define MOVGRAB_CBSNEWS - -#include "common.h" - -void ExtractCBSNews(ListNode *Vars, char *Line); - -#endif - diff --git a/common.c b/common.c index 8cf63da..ea00639 100644 --- a/common.c +++ b/common.c @@ -15,3 +15,43 @@ ptr=strrchr(Tempstr,'.'); if (ptr) ptr++; return(ptr); } + + +char *ItemCodeFromFileExtension(char *RetBuf, const char *Default, const char *URL) +{ +char *Tempstr=NULL, *Path=NULL, *RetStr=NULL, *start, *ptr; + + +Path=CopyStr(Path, URL); +ptr=strrchr(Path, '?'); +if (ptr) *ptr='\0'; + +//we don't want to wind up treating part of a server name or an ip address +//as a file extension, so here we sure that we're beyond any '/' or ':' +start=Path; +ptr=strchr(start, ':'); +while (ptr) +{ +start=ptr+1; +ptr=strchr(start, ':'); +} + +ptr=strchr(start, '/'); +while (ptr) +{ +start=ptr+1; +ptr=strchr(start, '/'); +} + +ptr=strrchr(start,'.'); +if (ptr) +{ +ptr++; +RetStr=MCopyStr(RetBuf,"item:",ptr,NULL); +} +else RetStr=CopyStr(RetBuf,Default); + +DestroyString(Tempstr); +return(RetStr); +} + diff --git a/common.h b/common.h index c04fa8d..58c061d 100644 --- a/common.h +++ b/common.h @@ -2,9 +2,9 @@ #ifndef MOVGRAB_COMMON #define MOVGRAB_COMMON //This is doable through autoconf, but I'm sick of fighting with it -#define Version "1.2.1" +#define Version "2.0.0" -#include "libUseful-2.0/libUseful.h" +#include "libUseful-2.4/libUseful.h" #include #include #include "extract_text.h" @@ -36,5 +36,7 @@ extern char *FileTypes[]; extern char *ItemSelectionArg; char *FileTypeFromURL(char *URL); +char *ItemCodeFromFileExtension(char *RetBuf, const char *Default, const char *URL); + #endif diff --git a/config.log b/config.log index 2e19f6d..5d68da4 100644 --- a/config.log +++ b/config.log @@ -2,9 +2,9 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by configure, which was -generated by GNU Autoconf 2.60. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was - $ ./configure + $ ./configure --enable-ssl ## --------- ## ## Platform. ## @@ -14,7 +14,7 @@ hostname = lifebook uname -m = i686 uname -r = 3.13.1-p4-smp uname -s = Linux -uname -v = #1 SMP PREEMPT Wed Feb 5 00:08:02 UTC 2014 +uname -v = #1 SMP PREEMPT Wed Feb 12 20:32:00 UTC 2014 /usr/bin/uname -p = unknown /bin/uname -X = unknown @@ -34,24 +34,25 @@ PATH: /usr/X11R7/bin PATH: /bin PATH: /usr/games/bin PATH: /opt/git-1.9.rc0/bin +PATH: /opt/wine-1.9.5/bin ## ----------- ## ## Core tests. ## ## ----------- ## -configure:1717: checking for gcc -configure:1733: found /usr/bin/gcc -configure:1744: result: gcc -configure:1982: checking for C compiler version -configure:1989: gcc --version >&5 +configure:1958: checking for gcc +configure:1974: found /usr/bin/gcc +configure:1985: result: gcc +configure:2214: checking for C compiler version +configure:2223: gcc --version >&5 gcc (GCC) 4.7.3 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -configure:1992: $? = 0 -configure:1999: gcc -v >&5 +configure:2234: $? = 0 +configure:2223: gcc -v >&5 Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-pc-linux-gnu/4.7.3/lto-wrapper @@ -59,122 +60,119 @@ Target: i486-pc-linux-gnu Configured with: ../gcc-4.7.3-src/configure --prefix=/usr --sysconfdir=/etc --includedir=/usr/include --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,c++ --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i486-pc-linux-gnu --enable-bootstrap Thread model: posix gcc version 4.7.3 (GCC) -configure:2002: $? = 0 -configure:2009: gcc -V >&5 +configure:2234: $? = 0 +configure:2223: gcc -V >&5 gcc: error: unrecognized command line option '-V' gcc: fatal error: no input files compilation terminated. -configure:2012: $? = 1 -configure:2035: checking for C compiler default output file name -configure:2062: gcc conftest.c >&5 -configure:2065: $? = 0 -configure:2111: result: a.out -configure:2116: checking whether the C compiler works -configure:2126: ./a.out -configure:2129: $? = 0 -configure:2146: result: yes -configure:2153: checking whether we are cross compiling -configure:2155: result: no -configure:2158: checking for suffix of executables -configure:2165: gcc -o conftest conftest.c >&5 -configure:2168: $? = 0 -configure:2192: result: -configure:2198: checking for suffix of object files -configure:2224: gcc -c conftest.c >&5 -configure:2227: $? = 0 -configure:2250: result: o -configure:2254: checking whether we are using the GNU C compiler -configure:2283: gcc -c conftest.c >&5 -configure:2289: $? = 0 -configure:2296: test -z "$ac_c_werror_flag" || test ! -s conftest.err -configure:2299: $? = 0 -configure:2306: test -s conftest.o -configure:2309: $? = 0 -configure:2323: result: yes -configure:2328: checking whether gcc accepts -g -configure:2358: gcc -c -g conftest.c >&5 -configure:2364: $? = 0 -configure:2371: test -z "$ac_c_werror_flag" || test ! -s conftest.err -configure:2374: $? = 0 -configure:2381: test -s conftest.o -configure:2384: $? = 0 -configure:2514: result: yes -configure:2531: checking for gcc option to accept ISO C89 -configure:2605: gcc -c -g -O2 conftest.c >&5 -configure:2611: $? = 0 -configure:2618: test -z "$ac_c_werror_flag" || test ! -s conftest.err -configure:2621: $? = 0 -configure:2628: test -s conftest.o -configure:2631: $? = 0 -configure:2651: result: none needed -configure:2675: checking whether make sets $(MAKE) -configure:2696: result: yes -configure:2718: checking for a BSD-compatible install -configure:2774: result: /bin/install -c -configure:2791: checking how to run the C preprocessor -configure:2831: gcc -E conftest.c -configure:2837: $? = 0 -configure:2875: gcc -E conftest.c -conftest.c:8:28: fatal error: ac_nonexistent.h: No such file or directory +configure:2234: $? = 1 +configure:2223: gcc -qversion >&5 +gcc: error: unrecognized command line option '-qversion' +gcc: fatal error: no input files +compilation terminated. +configure:2234: $? = 1 +configure:2254: checking whether the C compiler works +configure:2276: gcc conftest.c >&5 +configure:2280: $? = 0 +configure:2328: result: yes +configure:2331: checking for C compiler default output file name +configure:2333: result: a.out +configure:2339: checking for suffix of executables +configure:2346: gcc -o conftest conftest.c >&5 +configure:2350: $? = 0 +configure:2372: result: +configure:2394: checking whether we are cross compiling +configure:2402: gcc -o conftest conftest.c >&5 +configure:2406: $? = 0 +configure:2413: ./conftest +configure:2417: $? = 0 +configure:2432: result: no +configure:2437: checking for suffix of object files +configure:2459: gcc -c conftest.c >&5 +configure:2463: $? = 0 +configure:2484: result: o +configure:2488: checking whether we are using the GNU C compiler +configure:2507: gcc -c conftest.c >&5 +configure:2507: $? = 0 +configure:2516: result: yes +configure:2525: checking whether gcc accepts -g +configure:2545: gcc -c -g conftest.c >&5 +configure:2545: $? = 0 +configure:2586: result: yes +configure:2603: checking for gcc option to accept ISO C89 +configure:2666: gcc -c -g -O2 conftest.c >&5 +configure:2666: $? = 0 +configure:2679: result: none needed +configure:2705: checking whether make sets $(MAKE) +configure:2727: result: yes +configure:2750: checking for a BSD-compatible install +configure:2818: result: /bin/install -c +configure:2835: checking how to run the C preprocessor +configure:2866: gcc -E conftest.c +configure:2866: $? = 0 +configure:2880: gcc -E conftest.c +conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory compilation terminated. -configure:2881: $? = 1 +configure:2880: $? = 1 configure: failed program was: -| /* confdefs.h. */ +| /* confdefs.h */ | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" +| #define PACKAGE_URL "" | /* end confdefs.h. */ | #include -configure:2921: result: gcc -E -configure:2950: gcc -E conftest.c -configure:2956: $? = 0 -configure:2994: gcc -E conftest.c -conftest.c:8:28: fatal error: ac_nonexistent.h: No such file or directory +configure:2905: result: gcc -E +configure:2925: gcc -E conftest.c +configure:2925: $? = 0 +configure:2939: gcc -E conftest.c +conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory compilation terminated. -configure:3000: $? = 1 +configure:2939: $? = 1 configure: failed program was: -| /* confdefs.h. */ +| /* confdefs.h */ | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" +| #define PACKAGE_URL "" | /* end confdefs.h. */ | #include -configure:3045: checking for grep that handles long lines and -e -configure:3119: result: /bin/grep -configure:3124: checking for egrep -configure:3202: result: /bin/grep -E -configure:3207: checking for ANSI C header files -configure:3237: gcc -c -g -O2 conftest.c >&5 -configure:3243: $? = 0 -configure:3250: test -z "$ac_c_werror_flag" || test ! -s conftest.err -configure:3253: $? = 0 -configure:3260: test -s conftest.o -configure:3263: $? = 0 -configure:3359: gcc -o conftest -g -O2 conftest.c >&5 -configure:3362: $? = 0 -configure:3368: ./conftest -configure:3371: $? = 0 -configure:3388: result: yes -configure:3400: checking for deflate in -lz -configure:3435: gcc -o conftest -g -O2 conftest.c -lz >&5 -configure:3441: $? = 0 -configure:3448: test -z "$ac_c_werror_flag" || test ! -s conftest.err -configure:3451: $? = 0 -configure:3458: test -s conftest -configure:3461: $? = 0 -configure:3475: result: yes -configure:3825: creating ./config.status +configure:2968: checking for grep that handles long lines and -e +configure:3026: result: /bin/grep +configure:3031: checking for egrep +configure:3093: result: /bin/grep -E +configure:3098: checking for ANSI C header files +configure:3118: gcc -c -g -O2 conftest.c >&5 +configure:3118: $? = 0 +configure:3191: gcc -o conftest -g -O2 conftest.c >&5 +configure:3191: $? = 0 +configure:3191: ./conftest +configure:3191: $? = 0 +configure:3202: result: yes +configure:3211: checking for deflate in -lz +configure:3236: gcc -o conftest -g -O2 conftest.c -lz >&5 +configure:3236: $? = 0 +configure:3245: result: yes +configure:3279: checking for SSL_library_init in -lssl +configure:3304: gcc -o conftest -g -O2 conftest.c -lssl -lz >&5 +configure:3304: $? = 0 +configure:3313: result: yes +configure:3326: checking for EVP_CIPHER_CTX_init in -lcrypto +configure:3351: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lz >&5 +configure:3351: $? = 0 +configure:3360: result: yes +configure:3527: creating ./config.status ## ---------------------- ## ## Running config.status. ## ## ---------------------- ## This file was extended by config.status, which was -generated by GNU Autoconf 2.60. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = CONFIG_HEADERS = @@ -184,9 +182,9 @@ generated by GNU Autoconf 2.60. Invocation command line was on lifebook -config.status:568: creating Makefile -configure:4758: === configuring in libUseful-2.0 (/home/meta/movgrab-1.2.1/libUseful-2.0) -configure:4861: running /bin/sh ./configure --prefix=/usr/local --cache-file=/dev/null --srcdir=. +config.status:729: creating Makefile +configure:4604: === configuring in libUseful-2.4 (/home/meta/movgrab-2.0/libUseful-2.4) +configure:4667: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/local' '--enable-ssl' --cache-file=/dev/null --srcdir=. ## ---------------- ## ## Cache variables. ## @@ -203,6 +201,8 @@ ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= +ac_cv_env_LIBS_set= +ac_cv_env_LIBS_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= @@ -210,6 +210,8 @@ ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_header_stdc=yes +ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes +ac_cv_lib_ssl_SSL_library_init=yes ac_cv_lib_z_deflate=yes ac_cv_objext=o ac_cv_path_EGREP='/bin/grep -E' @@ -229,7 +231,7 @@ CC='gcc' CFLAGS='-g -O2' CPP='gcc -E' CPPFLAGS='' -DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1' +DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1' ECHO_C='' ECHO_N='-n' ECHO_T='' @@ -241,13 +243,14 @@ INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' LDFLAGS='' LIBOBJS='' -LIBS='-lz ' +LIBS='-lcrypto -lssl -lz ' LTLIBOBJS='' OBJEXT='o' PACKAGE_BUGREPORT='' PACKAGE_NAME='' PACKAGE_STRING='' PACKAGE_TARNAME='' +PACKAGE_URL='' PACKAGE_VERSION='' PATH_SEPARATOR=':' SET_MAKE='' @@ -277,7 +280,7 @@ program_transform_name='s,x,x,' psdir='${docdir}' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' -subdirs=' libUseful-2.0' +subdirs=' libUseful-2.4' sysconfdir='${prefix}/etc' target_alias='' @@ -285,12 +288,18 @@ target_alias='' ## confdefs.h. ## ## ----------- ## +/* confdefs.h */ #define PACKAGE_NAME "" #define PACKAGE_TARNAME "" #define PACKAGE_VERSION "" #define PACKAGE_STRING "" #define PACKAGE_BUGREPORT "" +#define PACKAGE_URL "" #define STDC_HEADERS 1 #define HAVE_LIBZ 1 +#define _LARGEFILE64_SOURCE 1 +#define _FILE_OFFSET_BITS 64 +#define HAVE_LIBSSL 1 +#define HAVE_LIBCRYPTO 1 configure: exit 0 diff --git a/config.status b/config.status index 8e10cc5..e29a99c 100755 --- a/config.status +++ b/config.status @@ -7,52 +7,77 @@ debug=false ac_cs_recheck=false ac_cs_silent=false + SHELL=${CONFIG_SHELL-/bin/sh} -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +export SHELL +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - PATH_SEPARATOR=: + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi - rm -f conf$$.sh + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi @@ -61,20 +86,19 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -as_nl=' -' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +as_myself= +case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -85,32 +109,111 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi -done + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + -# Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -124,13 +227,17 @@ else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -145,122 +252,118 @@ echo X/"$0" | } s/.*/./; q'` -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in +case `echo -n x` in #((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir + mkdir conf$$.dir 2>/dev/null fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" -else - as_executable_p=: -fi -rm -f conf$$.file + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -270,13 +373,15 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 - -# Save the log message, to keep $[0] and so on meaningful, and to +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +# Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.60. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -291,47 +396,56 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q` config_files=" Makefile" ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE Configuration files: $config_files -Report bugs to ." +Report bugs to the package provider." +ac_cs_config="'--enable-ssl'" ac_cs_version="\ config.status -configured by ./configure, generated by GNU Autoconf 2.60, - with options \"\" +configured by ./configure, generated by GNU Autoconf 2.69, + with options \"$ac_cs_config\" -Copyright (C) 2006 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." -ac_pwd='/home/meta/movgrab-1.2.1' +ac_pwd='/home/meta/movgrab-2.0' srcdir='.' INSTALL='/bin/install -c' -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. +test -n "$AWK" || AWK=awk +# The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) + --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -344,25 +458,30 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" + *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac @@ -377,10 +496,12 @@ if $ac_cs_silent; then fi if $ac_cs_recheck; then - echo "running CONFIG_SHELL=/bin/sh /bin/sh ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=/bin/sh + set X /bin/sh './configure' '--enable-ssl' $ac_configure_extra_args --no-create --no-recursion + shift + $as_echo "running CONFIG_SHELL=/bin/sh $*" >&6 + CONFIG_SHELL='/bin/sh' export CONFIG_SHELL - exec /bin/sh "./configure" $ac_configure_extra_args --no-create --no-recursion + exec "$@" fi exec 5>>config.log @@ -389,7 +510,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - echo "$ac_log" + $as_echo "$ac_log" } >&5 @@ -399,9 +520,7 @@ do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -422,108 +541,150 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp -# -# Set up the sed scripts for CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then -cat >"$tmp/subs-1.sed" <<\CEOF -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end -s,@SHELL@,|#_!!_#|/bin/sh,g -s,@PATH_SEPARATOR@,|#_!!_#|:,g -s,@PACKAGE_NAME@,|#_!!_#|,g -s,@PACKAGE_TARNAME@,|#_!!_#|,g -s,@PACKAGE_VERSION@,|#_!!_#|,g -s,@PACKAGE_STRING@,|#_!!_#|,g -s,@PACKAGE_BUGREPORT@,|#_!!_#|,g -s,@exec_prefix@,|#_!!_#|${prefix},g -s,@prefix@,|#_!!_#|/usr/local,g -s,@program_transform_name@,|#_!!_#|s\,x\,x\,,g -s,@bindir@,|#_!!_#|${exec_prefix}/bin,g -s,@sbindir@,|#_!!_#|${exec_prefix}/sbin,g -s,@libexecdir@,|#_!!_#|${exec_prefix}/libexec,g -s,@datarootdir@,|#_!!_#|${prefix}/share,g -s,@datadir@,|#_!!_#|${datarootdir},g -s,@sysconfdir@,|#_!!_#|${prefix}/etc,g -s,@sharedstatedir@,|#_!!_#|${prefix}/com,g -s,@localstatedir@,|#_!!_#|${prefix}/var,g -s,@includedir@,|#_!!_#|${prefix}/include,g -s,@oldincludedir@,|#_!!_#|/usr/include,g -s,@docdir@,|#_!!_#|${datarootdir}/doc/${PACKAGE},g -s,@infodir@,|#_!!_#|${datarootdir}/info,g -s,@htmldir@,|#_!!_#|${docdir},g -s,@dvidir@,|#_!!_#|${docdir},g -s,@pdfdir@,|#_!!_#|${docdir},g -s,@psdir@,|#_!!_#|${docdir},g -s,@libdir@,|#_!!_#|${exec_prefix}/lib,g -s,@localedir@,|#_!!_#|${datarootdir}/locale,g -s,@mandir@,|#_!!_#|${datarootdir}/man,g -s,@DEFS@,|#_!!_#|-DPACKAGE_NAME=\\"\\" -DPACKAGE_TARNAME=\\"\\" -DPACKAGE_VERSION=\\"\\" -DPACKAGE_STRING=\\"\\" -DPACKAGE_BUGREPORT=\\"\\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1,g -s,@ECHO_C@,|#_!!_#|,g -s,@ECHO_N@,|#_!!_#|-n,g -s,@ECHO_T@,|#_!!_#|,g -s,@LIBS@,|#_!!_#|-lz ,g -s,@build_alias@,|#_!!_#|,g -s,@host_alias@,|#_!!_#|,g -s,@target_alias@,|#_!!_#|,g -s,@VERSION@,|#_!!_#|1.2.1,g -s,@subdirs@,|#_!!_#| libUseful-2.0,g -s,@CC@,|#_!!_#|gcc,g -s,@CFLAGS@,|#_!!_#|-g -O2,g -s,@LDFLAGS@,|#_!!_#|,g -s,@CPPFLAGS@,|#_!!_#|,g -s,@ac_ct_CC@,|#_!!_#|gcc,g -s,@EXEEXT@,|#_!!_#|,g -s,@OBJEXT@,|#_!!_#|o,g -s,@SET_MAKE@,|#_!!_#|,g -s,@INSTALL_PROGRAM@,|#_!!_#|${INSTALL},g -s,@INSTALL_SCRIPT@,|#_!!_#|${INSTALL},g -s,@INSTALL_DATA@,|#_!!_#|${INSTALL} -m 644,g -s,@CPP@,|#_!!_#|gcc -E,g -s,@GREP@,|#_!!_#|/bin/grep,g -s,@EGREP@,|#_!!_#|/bin/grep -E,g -s,@LIBOBJS@,|#_!!_#|,g -s,@LTLIBOBJS@,|#_!!_#|,g -:end -s/|#_!!_#|//g -CEOF + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +cat >>"$ac_tmp/subs1.awk" <<\_ACAWK && +S["LTLIBOBJS"]="" +S["LIBOBJS"]="" +S["EGREP"]="/bin/grep -E" +S["GREP"]="/bin/grep" +S["CPP"]="gcc -E" +S["INSTALL_DATA"]="${INSTALL} -m 644" +S["INSTALL_SCRIPT"]="${INSTALL}" +S["INSTALL_PROGRAM"]="${INSTALL}" +S["SET_MAKE"]="" +S["OBJEXT"]="o" +S["EXEEXT"]="" +S["ac_ct_CC"]="gcc" +S["CPPFLAGS"]="" +S["LDFLAGS"]="" +S["CFLAGS"]="-g -O2" +S["CC"]="gcc" +S["subdirs"]=" libUseful-2.4" +S["VERSION"]="1.2.1" +S["target_alias"]="" +S["host_alias"]="" +S["build_alias"]="" +S["LIBS"]="-lcrypto -lssl -lz " +S["ECHO_T"]="" +S["ECHO_N"]="-n" +S["ECHO_C"]="" +S["DEFS"]="-DPACKAGE_NAME=\\\"\\\" -DPACKAGE_TARNAME=\\\"\\\" -DPACKAGE_VERSION=\\\"\\\" -DPACKAGE_STRING=\\\"\\\" -DPACKAGE_BUGREPORT=\\\"\\\" -DPACKAGE_URL=\\\"\\\" -DSTDC_HEADERS=1"\ +" -DHAVE_LIBZ=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1" +S["mandir"]="${datarootdir}/man" +S["localedir"]="${datarootdir}/locale" +S["libdir"]="${exec_prefix}/lib" +S["psdir"]="${docdir}" +S["pdfdir"]="${docdir}" +S["dvidir"]="${docdir}" +S["htmldir"]="${docdir}" +S["infodir"]="${datarootdir}/info" +S["docdir"]="${datarootdir}/doc/${PACKAGE}" +S["oldincludedir"]="/usr/include" +S["includedir"]="${prefix}/include" +S["localstatedir"]="${prefix}/var" +S["sharedstatedir"]="${prefix}/com" +S["sysconfdir"]="${prefix}/etc" +S["datadir"]="${datarootdir}" +S["datarootdir"]="${prefix}/share" +S["libexecdir"]="${exec_prefix}/libexec" +S["sbindir"]="${exec_prefix}/sbin" +S["bindir"]="${exec_prefix}/bin" +S["program_transform_name"]="s,x,x," +S["prefix"]="/usr/local" +S["exec_prefix"]="${prefix}" +S["PACKAGE_URL"]="" +S["PACKAGE_BUGREPORT"]="" +S["PACKAGE_STRING"]="" +S["PACKAGE_VERSION"]="" +S["PACKAGE_TARNAME"]="" +S["PACKAGE_NAME"]="" +S["PATH_SEPARATOR"]=":" +S["SHELL"]="/bin/sh" +_ACAWK +cat >>"$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 fi # test -n "$CONFIG_FILES" -for ac_tag in :F $CONFIG_FILES +eval set X " :F $CONFIG_FILES " +shift +for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} - { (exit 1); exit 1; }; };; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -542,7 +703,7 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;} for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -551,26 +712,34 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;} [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - ac_file_inputs="$ac_file_inputs $ac_f" + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -580,7 +749,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | +$as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -598,55 +767,15 @@ echo X"$ac_file" | q } s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -687,8 +816,8 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= - -case `sed -n '/datarootdir/ { +ac_sed_dataroot=' +/datarootdir/ { p q } @@ -696,33 +825,42 @@ case `sed -n '/datarootdir/ { /@docdir@/p /@infodir@/p /@localedir@/p -/@mandir@/p -' $ac_file_inputs` in +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} ac_datarootdir_hack=' s&@datadir@&${datarootdir}&g s&@docdir@&${datarootdir}/doc/${PACKAGE}&g s&@infodir@&${datarootdir}/info&g s&@localedir@&${datarootdir}/locale&g s&@mandir@&${datarootdir}/man&g - s&\${datarootdir}&${prefix}/share&g' ;; + s&\${datarootdir}&${prefix}/share&g' ;; esac - sed "/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ +ac_sed_extra="/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// } :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t +s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t @@ -732,21 +870,25 @@ s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -756,4 +898,4 @@ which seems to be undefined. Please make sure it is defined." >&2;} done # for ac_tag -{ (exit 0); exit 0; } +as_fn_exit 0 diff --git a/configure b/configure index 7763bfb..4e39e66 100755 --- a/configure +++ b/configure @@ -1,56 +1,81 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60. +# Generated by GNU Autoconf 2.69. +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - PATH_SEPARATOR=: + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi - rm -f conf$$.sh + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi @@ -59,20 +84,19 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -as_nl=' -' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +as_myself= +case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -83,352 +107,366 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE # CDPATH. -$as_unset CDPATH - - +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST else - as_have_required=no + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : -if as_func_ret_success; then - : else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes else - exitcode=1 - echo positional parameters were not saved. + as_have_required=no fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - case $as_dir in + as_found=: + case $as_dir in #( /*) for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi done;; esac + as_found=false done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } IFS=$as_save_IFS - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break fi - fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" -fi -fi +} # as_fn_mkdir_p +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error -exitcode=0 -if as_func_success; then - : +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. + as_expr=false fi -if as_func_ret_success; then - : +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. + as_basename=false fi -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname else - exitcode=1 - echo positional parameters were not saved. + as_dirname=false fi -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} - +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= @@ -445,9 +483,12 @@ test \$exitcode = 0") || { s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -456,75 +497,55 @@ test \$exitcode = 0") || { exit } - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in +case `echo -n x` in #((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" -else - as_executable_p=: -fi -rm -f conf$$.file +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -533,11 +554,11 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - -exec 7<&0 &1 +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -552,7 +573,6 @@ cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= @@ -560,77 +580,88 @@ PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= +PACKAGE_URL= ac_unique_file="main.c" -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -VERSION -subdirs -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT -SET_MAKE -INSTALL_PROGRAM -INSTALL_SCRIPT -INSTALL_DATA -CPP -GREP -EGREP +enable_option_checking=no +ac_subst_vars='LTLIBOBJS LIBOBJS -LTLIBOBJS' +EGREP +GREP +CPP +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +SET_MAKE +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +subdirs +VERSION +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_largefiles +enable_ssl +' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS +LIBS CPPFLAGS CPP' -ac_subdirs_all='libUseful-2.0' +ac_subdirs_all='libUseful-2.4' # Initialize some variables set by options. ac_init_help= ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -686,8 +717,9 @@ do fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -729,13 +761,20 @@ do datarootdir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval enable_$ac_feature=no ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; @@ -748,13 +787,20 @@ do dvidir=$ac_optarg ;; -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval enable_$ac_feature=\$ac_optarg ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -945,22 +991,36 @@ do ac_init_version=: ;; -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval with_$ac_package=\$ac_optarg ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval with_$ac_package=no ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. @@ -980,26 +1040,26 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1007,23 +1067,36 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "missing argument to $ac_option" fi -# Be sure to have absolute directory names. +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1037,8 +1110,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1053,23 +1124,21 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { echo "$as_me: error: Working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$0" || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X"$0" | + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1096,13 +1165,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1142,7 +1209,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1150,9 +1217,9 @@ Configuration: Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -1162,25 +1229,25 @@ for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -1192,6 +1259,7 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-largefiles enable largefile support @@ -1202,13 +1270,15 @@ Some influential environment variables: CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. +Report bugs to the package provider. _ACEOF ac_status=$? fi @@ -1216,15 +1286,17 @@ fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1249,42 +1321,208 @@ case $srcdir in ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done + ac_retval=$ac_status fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.60 +} # ac_fn_c_try_run -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.60. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -1320,8 +1558,8 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done + $as_echo "PATH: $as_dir" + done IFS=$as_save_IFS } >&5 @@ -1355,12 +1593,12 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" + as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else @@ -1376,13 +1614,13 @@ do -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args '$ac_arg'" + as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -1394,11 +1632,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -1407,12 +1643,13 @@ _ASBOX case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -1431,128 +1668,136 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - echo "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - echo "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h +$as_echo "/* confdefs.h */" > confdefs.h + # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + # Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - set x "$CONFIG_SITE" + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then - set x "$prefix/share/config.site" "$prefix/etc/config.site" + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site else - set x "$ac_default_prefix/share/config.site" \ - "$ac_default_prefix/etc/config.site" + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site fi -shift -for ac_site_file +for ac_site_file in "$ac_site_file1" "$ac_site_file2" do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -1566,60 +1811,56 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi - - - - - - - - - - - - - - - - +## -------------------- ## +## Main body of script. ## +## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -1649,9 +1890,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -1663,7 +1902,9 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -subdirs="$subdirs libUseful-2.0" + + +subdirs="$subdirs libUseful-2.4" ac_ext=c @@ -1674,10 +1915,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1687,25 +1928,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1714,10 +1955,10 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1727,25 +1968,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -1753,12 +1994,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -1771,10 +2008,10 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1784,25 +2021,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1811,10 +2048,10 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1825,18 +2062,18 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then @@ -1855,11 +2092,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1870,10 +2107,10 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1883,25 +2120,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1914,10 +2151,10 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1927,25 +2164,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1957,12 +2194,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -1972,51 +2205,37 @@ fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2028,59 +2247,55 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + ac_rmfiles= for ac_file in $ac_files do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles -if { (ac_try="$ac_link_default" +if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. -for ac_file in $ac_files +for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -2097,76 +2312,43 @@ done test "$ac_cv_exeext" = no && ac_cv_exeext= else - echo "$as_me: failed program was:" >&5 + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -rm -f a.out a.exe conftest$ac_cv_exeext b.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -2174,37 +2356,90 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2216,51 +2451,46 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" +if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi - rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2274,71 +2504,34 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no + ac_compiler_gnu=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2349,107 +2542,11 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2460,59 +2557,34 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes +if ac_fn_c_try_compile "$LINENO"; then : + else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -2528,23 +2600,18 @@ else CFLAGS= fi fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -2596,48 +2663,9 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done @@ -2648,17 +2676,19 @@ fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac +if test "x$ac_cv_prog_cc_c89" != xno; then : +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -2672,18 +2702,19 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } -set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -2693,12 +2724,12 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } SET_MAKE= else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -2715,22 +2746,23 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -2738,7 +2770,7 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2748,17 +2780,29 @@ case $as_dir/ in # program-specific install script used by HP pwplus--don't use. : else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi fi fi done done ;; esac -done + + done IFS=$as_save_IFS +rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then @@ -2771,8 +2815,8 @@ fi INSTALL=$ac_install_sh fi fi -{ echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -2788,15 +2832,15 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" @@ -2810,11 +2854,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -2823,90 +2863,34 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : break fi @@ -2918,8 +2902,8 @@ fi else ac_cv_prog_CPP=$CPP fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -2929,11 +2913,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -2942,97 +2922,40 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -3042,45 +2965,40 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 else + if test -z "$GREP"; then ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` + as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" @@ -3092,77 +3010,61 @@ case `"$ac_path_GREP" --version 2>&1` in rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac - - $ac_path_GREP_found && break 3 + $ac_path_GREP_found && break 3 + done + done done -done - -done IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else ac_cv_path_GREP=$GREP fi - fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + if test -z "$EGREP"; then ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` + as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" @@ -3174,46 +3076,31 @@ case `"$ac_path_EGREP" --version 2>&1` in rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac - - $ac_path_EGREP_found && break 3 + $ac_path_EGREP_found && break 3 + done + done done -done - -done IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else ac_cv_path_EGREP=$EGREP fi - fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3228,64 +3115,23 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no + ac_cv_header_stdc=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : + $EGREP "memchr" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -3295,18 +3141,14 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : + $EGREP "free" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -3316,14 +3158,10 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : : else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3350,65 +3188,34 @@ main () return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_run "$LINENO"; then : -( exit $ac_status ) -ac_cv_header_stdc=no +else + ac_cv_header_stdc=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF +$as_echo "#define STDC_HEADERS 1" >>confdefs.h fi - -{ echo "$as_me:$LINENO: checking for deflate in -lz" >&5 -echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6; } -if test "${ac_cv_lib_z_deflate+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5 +$as_echo_n "checking for deflate in -lz... " >&6; } +if ${ac_cv_lib_z_deflate+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -3426,55 +3233,18 @@ return deflate (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_deflate=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_z_deflate=no + ac_cv_lib_z_deflate=no fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_deflate" >&5 -echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6; } -if test $ac_cv_lib_z_deflate = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflate" >&5 +$as_echo "$ac_cv_lib_z_deflate" >&6; } +if test "x$ac_cv_lib_z_deflate" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF @@ -3486,43 +3256,34 @@ fi cf_have_libz=$ac_cv_lib_z_deflate # Check whether --enable-largefiles was given. -if test "${enable_largefiles+set}" = set; then +if test "${enable_largefiles+set}" = set; then : enableval=$enable_largefiles; cf_use_largefiles=$enableval fi # Check whether --enable-ssl was given. -if test "${enable_ssl+set}" = set; then +if test "${enable_ssl+set}" = set; then : enableval=$enable_ssl; cf_use_ssl=$enableval fi -if test "$cf_use_largefiles" = "yes" +if test "$cf_use_largefiles" != "no" then -cat >>confdefs.h <<\_ACEOF -#define _LARGEFILE64_SOURCE 1 -_ACEOF +$as_echo "#define _LARGEFILE64_SOURCE 1" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -#define _FILE_OFFSET_BITS 64 -_ACEOF +$as_echo "#define _FILE_OFFSET_BITS 64" >>confdefs.h fi if test "$cf_use_ssl" = "yes" then - -{ echo "$as_me:$LINENO: checking for SSL_library_init in -lssl" >&5 -echo $ECHO_N "checking for SSL_library_init in -lssl... $ECHO_C" >&6; } -if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5 +$as_echo_n "checking for SSL_library_init in -lssl... " >&6; } +if ${ac_cv_lib_ssl_SSL_library_init+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lssl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -3540,55 +3301,18 @@ return SSL_library_init (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ssl_SSL_library_init=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_ssl_SSL_library_init=no + ac_cv_lib_ssl_SSL_library_init=no fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_library_init" >&5 -echo "${ECHO_T}$ac_cv_lib_ssl_SSL_library_init" >&6; } -if test $ac_cv_lib_ssl_SSL_library_init = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5 +$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; } +if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSSL 1 _ACEOF @@ -3599,19 +3323,14 @@ fi cf_have_libssl=$ac_cv_lib_ssl_SSL_library_init - -{ echo "$as_me:$LINENO: checking for EVP_CIPHER_CTX_init in -lcrypto" >&5 -echo $ECHO_N "checking for EVP_CIPHER_CTX_init in -lcrypto... $ECHO_C" >&6; } -if test "${ac_cv_lib_crypto_EVP_CIPHER_CTX_init+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_CIPHER_CTX_init in -lcrypto" >&5 +$as_echo_n "checking for EVP_CIPHER_CTX_init in -lcrypto... " >&6; } +if ${ac_cv_lib_crypto_EVP_CIPHER_CTX_init+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -3629,55 +3348,18 @@ return EVP_CIPHER_CTX_init (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_crypto_EVP_CIPHER_CTX_init=no + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=no fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&5 -echo "${ECHO_T}$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&6; } -if test $ac_cv_lib_crypto_EVP_CIPHER_CTX_init = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&5 +$as_echo "$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&6; } +if test "x$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBCRYPTO 1 _ACEOF @@ -3719,12 +3401,13 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -3732,8 +3415,8 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" @@ -3755,13 +3438,24 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { echo "$as_me:$LINENO: updating cache $cache_file" >&5 -echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else - { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -3778,6 +3472,12 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g @@ -3804,14 +3504,15 @@ DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`echo "$ac_i" | sed "$ac_script"` + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -3819,12 +3520,14 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -3834,55 +3537,79 @@ cat >$CONFIG_STATUS <<_ACEOF debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - PATH_SEPARATOR=: + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi - rm -f conf$$.sh + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi @@ -3891,20 +3618,19 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -as_nl=' -' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +as_myself= +case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -3915,32 +3641,111 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi -done + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + -# Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -3954,13 +3759,17 @@ else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -3975,122 +3784,118 @@ echo X/"$0" | } s/.*/./; q'` -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in +case `echo -n x` in #((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" -else - as_executable_p=: -fi -rm -f conf$$.file + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -4100,13 +3905,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 -# Save the log message, to keep $[0] and so on meaningful, and to +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.60. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4119,60 +3930,75 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE Configuration files: $config_files -Report bugs to ." +Report bugs to the package provider." _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.60, - with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" -Copyright (C) 2006 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) + --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -4185,25 +4011,30 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" + *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac @@ -4218,30 +4049,32 @@ if $ac_cs_silent; then fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=$SHELL + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' export CONFIG_SHELL - exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + exec "\$@" fi _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - echo "$ac_log" + $as_echo "$ac_log" } >&5 _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets @@ -4249,9 +4082,7 @@ do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -4272,166 +4103,194 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# -# Set up the sed scripts for CONFIG_FILES section. -# +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then -_ACEOF +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -SHELL!$SHELL$ac_delim -PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim -PACKAGE_NAME!$PACKAGE_NAME$ac_delim -PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim -PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim -PACKAGE_STRING!$PACKAGE_STRING$ac_delim -PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim -exec_prefix!$exec_prefix$ac_delim -prefix!$prefix$ac_delim -program_transform_name!$program_transform_name$ac_delim -bindir!$bindir$ac_delim -sbindir!$sbindir$ac_delim -libexecdir!$libexecdir$ac_delim -datarootdir!$datarootdir$ac_delim -datadir!$datadir$ac_delim -sysconfdir!$sysconfdir$ac_delim -sharedstatedir!$sharedstatedir$ac_delim -localstatedir!$localstatedir$ac_delim -includedir!$includedir$ac_delim -oldincludedir!$oldincludedir$ac_delim -docdir!$docdir$ac_delim -infodir!$infodir$ac_delim -htmldir!$htmldir$ac_delim -dvidir!$dvidir$ac_delim -pdfdir!$pdfdir$ac_delim -psdir!$psdir$ac_delim -libdir!$libdir$ac_delim -localedir!$localedir$ac_delim -mandir!$mandir$ac_delim -DEFS!$DEFS$ac_delim -ECHO_C!$ECHO_C$ac_delim -ECHO_N!$ECHO_N$ac_delim -ECHO_T!$ECHO_T$ac_delim -LIBS!$LIBS$ac_delim -build_alias!$build_alias$ac_delim -host_alias!$host_alias$ac_delim -target_alias!$target_alias$ac_delim -VERSION!$VERSION$ac_delim -subdirs!$subdirs$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -SET_MAKE!$SET_MAKE$ac_delim -INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim -INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim -INSTALL_DATA!$INSTALL_DATA$ac_delim -CPP!$CPP$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim -LIBOBJS!$LIBOBJS$ac_delim -LTLIBOBJS!$LTLIBOBJS$ac_delim -_ACEOF + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 55; then + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done +rm -f conf$$subs.sh -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACAWK _ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g -CEOF$ac_eof +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" -for ac_tag in :F $CONFIG_FILES +eval set X " :F $CONFIG_FILES " +shift +for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} - { (exit 1); exit 1; }; };; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -4450,7 +4309,7 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;} for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -4459,26 +4318,34 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;} [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - ac_file_inputs="$ac_file_inputs $ac_f" + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -4488,42 +4355,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | +$as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -4541,20 +4373,15 @@ echo X"$as_dir" | q } s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -4594,12 +4421,12 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix esac _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= - -case `sed -n '/datarootdir/ { +ac_sed_dataroot=' +/datarootdir/ { p q } @@ -4607,36 +4434,37 @@ case `sed -n '/datarootdir/ { /@docdir@/p /@infodir@/p /@localedir@/p -/@mandir@/p -' $ac_file_inputs` in +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; + s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub $extrasub _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t +s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t @@ -4646,21 +4474,25 @@ s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -4670,11 +4502,13 @@ which seems to be undefined. Please make sure it is defined." >&2;} done # for ac_tag -{ (exit 0); exit 0; } +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -4694,7 +4528,7 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } + $ac_cs_success || as_fn_exit 1 fi # @@ -4702,7 +4536,8 @@ fi # if test "$no_recursion" != yes; then - # Remove --cache-file and --srcdir arguments so they do not pile up. + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" @@ -4731,11 +4566,13 @@ if test "$no_recursion" != yes; then ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; + --disable-option-checking) + ;; *) case $ac_arg in - *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;; + as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac done @@ -4743,9 +4580,18 @@ if test "$no_recursion" != yes; then # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in - *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - ac_sub_configure_args="$ac_arg $ac_sub_configure_args" + ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" + + # Pass --silent + if test "$silent" = yes; then + ac_sub_configure_args="--silent $ac_sub_configure_args" + fi + + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue @@ -4755,57 +4601,17 @@ if test "$no_recursion" != yes; then test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" - echo "$as_me:$LINENO: $ac_msg" >&5 - echo "$ac_msg" >&6 - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 + $as_echo "$ac_msg" >&6 + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -4844,8 +4650,8 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix # This should be Cygnus configure. ac_sub_configure=$ac_aux_dir/configure else - { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 -echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 +$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi @@ -4858,19 +4664,21 @@ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac - { echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 -echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || - { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 -echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 fi cd "$ac_popdir" done fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi echo @@ -4882,7 +4690,7 @@ else echo "SSL and https enabled" fi -if test "$cf_use_largefiles" != "yes" +if test "$cf_use_largefiles" = "no" then echo "Largefiles NOT enabled" else diff --git a/configure.in b/configure.in index 26896aa..a405d85 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_INIT([main.c]) VERSION="1.2.1" AC_SUBST(VERSION) -AC_CONFIG_SUBDIRS([libUseful-2.0]) +AC_CONFIG_SUBDIRS([libUseful-2.4]) AC_PROG_CC AC_LANG_C @@ -19,7 +19,7 @@ cf_have_libz=$ac_cv_lib_z_deflate AC_ARG_ENABLE(largefiles, [ --enable-largefiles enable largefile support], cf_use_largefiles=$enableval ) AC_ARG_ENABLE(ssl, [ --enable-ssl use Secure Sockets Layer], cf_use_ssl=$enableval ) -if test "$cf_use_largefiles" = "yes" +if test "$cf_use_largefiles" != "no" then AC_DEFINE([_LARGEFILE64_SOURCE]) AC_DEFINE([_FILE_OFFSET_BITS],[64]) @@ -47,7 +47,7 @@ else echo "SSL and https enabled" fi -if test "$cf_use_largefiles" != "yes" +if test "$cf_use_largefiles" = "no" then echo "Largefiles NOT enabled" else diff --git a/containerfiles.c b/containerfiles.c index 94cec24..a6aff99 100644 --- a/containerfiles.c +++ b/containerfiles.c @@ -1,14 +1,16 @@ #include "containerfiles.h" #include "outputfiles.h" #include "servicetypes.h" +#include "download.h" #define M3U_STREAMINFO 1 #define M3U_PLAYLIST 2 -char *ContainerTypes[]={".m3u",".m3u8",".pls",".asx",NULL}; +const char *ContainerTypes[]={".m3u",".m3u8",".pls",".asx",NULL}; +int ContainerIDs[]={TYPE_CONTAINERFILE_M3U8, TYPE_CONTAINERFILE_M3U8, TYPE_CONTAINERFILE_PLS, TYPE_CONTAINERFILE_ASX}; -int GetContainerFileType(char *URL) +int GetContainerFileType(const char *URL) { char *Tempstr=NULL, *ptr; int val; @@ -25,12 +27,14 @@ ptr=strrchr(Tempstr,'.'); val=MatchTokenFromList(ptr,ContainerTypes,0); DestroyString(Tempstr); +if (val==-1) return(TYPE_NONE); -return(val); +if (Flags & FLAG_DEBUG2) fprintf(stderr,"CONTAINERTYPE: %s\n",ContainerTypes[val]); +return(ContainerIDs[val]); } -int DownloadStream(char *URL, char *Title, ListNode *Items, int Flags) +int DownloadStream(const char *URL, const char *Title, ListNode *Items, int Flags) { STREAM *Con=NULL, *S=NULL; ListNode *Curr; @@ -80,262 +84,87 @@ return(TRUE); } -void M3UParseStreamInfo(char *Line, char **Resolution, char **Bandwidth) +void M3UStreamVarName(const char *Config, char **VarName) { -char *Name=NULL, *Value=NULL, *ptr; +char *Name=NULL, *Value=NULL; +char *Resolution=NULL, *Codec=NULL, *Bandwidth=NULL; +const char *ptr; -ptr=GetToken(Line,":",&Name,0); -ptr=GetNameValuePair(ptr,",","=",&Name,&Value); +ptr=GetNameValuePair(Config, ",", "=", &Name, &Value); while (ptr) { - StripLeadingWhitespace(Name); StripTrailingWhitespace(Name); - StripLeadingWhitespace(Value); StripTrailingWhitespace(Value); - if (strcasecmp(Name,"RESOLUTION")==0) *Resolution=CopyStr(*Resolution,Value); - if (strcasecmp(Name,"BANDWIDTH")==0) *Bandwidth=CopyStr(*Bandwidth,Value); -ptr=GetNameValuePair(ptr,",","=",&Name,&Value); + if (strcasecmp(Name,"resolution")==0) Resolution=CopyStr(Resolution, Value); + if (strcasecmp(Name,"codec")==0) Codec=CopyStr(Codec, Value); + if (strcasecmp(Name,"bandwidth")==0) Bandwidth=CopyStr(Bandwidth, Value); + while (isspace(*ptr)) ptr++; + ptr=GetNameValuePair(ptr, ",", "=", &Name, &Value); } +if (StrValid(Resolution)) *VarName=MCopyStr(*VarName, "item:m3u8-stream:", Resolution, NULL); +else *VarName=MCopyStr(*VarName, "item:m3u8-stream:", Bandwidth, NULL); + DestroyString(Name); DestroyString(Value); +DestroyString(Codec); +DestroyString(Resolution); +DestroyString(Bandwidth); } -int M3UStreamInfo(STREAM *S, char *Title, char *URL, char *FirstLine, int Flags) -{ - char *Tempstr=NULL, *Doc=NULL, *Resolution=NULL, *Bandwidth=NULL, *ptr; - ListNode *Vars=NULL; - int RetVal=FALSE; - - Vars=ListCreate(); - Tempstr=CopyStr(Tempstr,FirstLine); - while (Tempstr) - { - StripTrailingWhitespace(Tempstr); - if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"%s\n",Tempstr); - if (strncmp("#EXT-X-STREAM-INF",Tempstr,StrLen("#EXT-X-STREAM-INF"))==0) M3UParseStreamInfo(Tempstr, &Resolution, &Bandwidth); - else if (*Tempstr != '#') +int M3UStreamDownload(STREAM *ManifestCon, const char *URL, const char *Title) +{ +STREAM *Con=NULL; +char *Tempstr=NULL, *BasePath=NULL, *Line=NULL; +const char *ptr; +ListNode *Segments, *Curr; +int result; +double BytesRead=0; + +Segments=ListCreate(); +ptr=strrchr(URL, '/'); +if (ptr) +{ +BasePath=CopyStrLen(BasePath, URL, ptr - URL); + Line=STREAMReadLine(Line,ManifestCon); + while (Line) { - if (strncasecmp(Tempstr,"http",4) !=0) + StripLeadingWhitespace(Line); + StripTrailingWhitespace(Line); + + if (*Line != '#') { - Doc=CopyStr(Doc,URL); - ptr=strrchr(Doc,'/'); - if (ptr) *ptr='\0'; - Doc=MCatStr(Doc,"/",Tempstr,NULL); + Tempstr=MCopyStr(Tempstr, BasePath, "/", Line, NULL); + ListAddItem(Segments, CopyStr(NULL, Tempstr)); } - else Doc=CopyStr(Doc,Tempstr); - - ptr=FileTypeFromURL(Doc); - if (strcmp(ptr,"m3u8")==0) ptr="stream"; - if (StrLen(Resolution)) - { - if (StrLen(ptr)) Tempstr=MCopyStr(Tempstr,"item:",ptr,":",Resolution,NULL); - else Tempstr=MCopyStr(Tempstr,"item:stream:",Resolution,NULL); - } - else if (StrLen(Bandwidth)) - { - if (StrLen(ptr)) Tempstr=MCopyStr(Tempstr,"item:",ptr,":",Bandwidth,NULL); - else Tempstr=MCopyStr(Tempstr,"item:stream:",Bandwidth,NULL); - } - else Tempstr=CopyStr(Tempstr,"ID"); - SetVar(Vars,Tempstr,Doc); - } - Tempstr=STREAMReadLine(Tempstr,S); + Line=STREAMReadLine(Line,ManifestCon); } - ptr=GetVar(Vars,"ID"); - if (! StrLen(ptr)) Type=SelectDownloadFormat(Vars, TYPE_REFERENCE, FALSE); - ptr=GetVar(Vars,"ID"); - if (StrLen(ptr)) RetVal=DownloadM3U(ptr, Title, Flags); - - ListDestroy(Vars,DestroyString); - DestroyString(Tempstr); - DestroyString(Resolution); - DestroyString(Bandwidth); - DestroyString(Doc); - - return(RetVal); -} - - -int DownloadM3U(char *URL, char *Title, int Flags) -{ -char *Tempstr=NULL, *ID=NULL, *Doc=NULL, *ptr; -int Port=0, BytesRead=0, len=0, count=0; -int RetVal=FALSE; -ListNode *Items, *Curr; -int M3UType=M3U_PLAYLIST; -STREAM *Con; - -if (Flags & FLAG_DEBUG) fprintf(stderr,"M3U STREAM: %s\n",URL); - - -Items=ListCreate(); -Con=ConnectAndRetryUntilDownload(URL, 0, 0); -if (Con) -{ -Tempstr=STREAMReadLine(Tempstr,Con); -while (Tempstr) -{ -StripTrailingWhitespace(Tempstr); -StripLeadingWhitespace(Tempstr); - -if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"%s\n",Tempstr); -if (StrLen(Tempstr)) -{ - if (strncmp("#EXT-X-STREAM-INF",Tempstr,StrLen("#EXT-X-STREAM-INF"))==0) - { - RetVal=M3UStreamInfo(Con,Title,URL,Tempstr,Flags); - M3UType=M3U_STREAMINFO; - } - else if (strncmp("#EXT-X-MEDIA-SEQUENCE",Tempstr,StrLen("#EXT-X-MEDIA-SEQUENCE"))==0) M3UType=M3U_PLAYLIST; - else if (*Tempstr != '#') + OpenOutputFiles(Title, URL, &BytesRead); + Tempstr=SetStrLen(Tempstr,BUFSIZ); + Curr=ListGetNext(Segments); + while (Curr) { - if (strncasecmp(Tempstr,"http",4) !=0) + Con=ConnectAndRetryUntilDownload(Curr->Item, 0, 0); + if (Con) { - Doc=CopyStr(Doc,URL); - ptr=strrchr(Doc,'/'); - if (ptr) *ptr='\0'; - Doc=MCatStr(Doc,"/",Tempstr,NULL); + TransferItem(Con, Title, URL, "m3u8-stream", 0, 0, &BytesRead, FALSE); + STREAMClose(Con); } - else Doc=CopyStr(Doc,Tempstr); - ListAddItem(Items,CopyStr(NULL,Doc)); - } -} - -Tempstr=STREAMReadLine(Tempstr,Con); -} - -STREAMClose(Con); -if (M3UType == M3U_PLAYLIST) RetVal=DownloadStream(URL, Title, Items, Flags); -} - -ListDestroy(Items,DestroyString); -DestroyString(Tempstr); -DestroyString(Doc); -DestroyString(ID); - - -return(RetVal); -} - -int DownloadPLS(char *URL, char *Title, int Flags) -{ -char *Tempstr=NULL, *Token=NULL, *ptr; -int Port=0, len=0; -STREAM *Con=NULL; -int RetVal=FALSE; -ListNode *Items; - -if (Flags & FLAG_DEBUG) fprintf(stderr,"PLS STREAM: %s\n",URL); - -Items=ListCreate(); -Con=ConnectAndRetryUntilDownload(URL, 0, 0); -if (Con) -{ -Tempstr=STREAMReadLine(Tempstr,Con); -while (Tempstr) -{ -StripTrailingWhitespace(Tempstr); -StripLeadingWhitespace(Tempstr); - - if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"%s\n",Tempstr); -if (StrLen(Tempstr)) -{ - ptr=GetToken(Tempstr,"=",&Token,0); - if (strncmp(Token,"File",4)==0) ListAddItem(Items,CopyStr(NULL,ptr)); -} - -Tempstr=STREAMReadLine(Tempstr,Con); -} - -//Close the Connection and Download the next stage -STREAMClose(Con); - -RetVal=DownloadStream(URL, Title, Items, Flags); -} - -ListDestroy(Items,DestroyString); -DestroyString(Tempstr); - -return(RetVal); -} - - -int DownloadASX(char *URL, char *Title, int Flags) -{ -char *Tempstr=NULL, *Token=NULL, *ptr; -int Port=0, len=0; -int RetVal=FALSE; -STREAM *Con=NULL; -ListNode *Items; - -if (Flags & FLAG_DEBUG) fprintf(stderr,"ASX STREAM: %s\n",URL); - -Items=ListCreate(); -Con=ConnectAndRetryUntilDownload(URL, 0, 0); -if (Con) -{ -Tempstr=STREAMReadLine(Tempstr,Con); -while (Tempstr) -{ -StripTrailingWhitespace(Tempstr); -StripLeadingWhitespace(Tempstr); - - if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"%s\n",Tempstr); - if (StrLen(Tempstr) && (strncasecmp(Tempstr," 0) && (StrLen(FullTitle) > DisplayTitleWidth)) +{ +Title=CopyStrLen(Title, FullTitle, DisplayTitleWidth); Title=CatStr(Title,"..."); +} +else Title=CopyStr(Title, FullTitle); + if (! (Flags & FLAG_QUIET)) { if (PrintName) fprintf(stderr,"\nGetting: %s Size: %s Format: %s\n",Title,GetHumanReadableDataQty(DocSize,0), Format); diff --git a/display.h b/display.h index 1c3df21..0c15527 100644 --- a/display.h +++ b/display.h @@ -4,9 +4,10 @@ #include "common.h" extern char *Player; +extern int DisplayTitleWidth; int DisplayAvailableFormats(ListNode *Vars, char *Formats, int ShowSize); -void DisplayProgress(char *FullTitle, char *Format, double bytes_read, double DocSize, int PrintName); +void DisplayProgress(const char *FullTitle, const char *Format, double bytes_read, double DocSize, int PrintName); #endif diff --git a/download.c b/download.c index 8f13134..7288f2c 100644 --- a/download.c +++ b/download.c @@ -8,26 +8,22 @@ All the HTTP stuff is in here */ -char *Proxy=NULL; extern int STREAMTimeout; -STREAM *ConnectAndSendHeaders(char *URL, int Flags, double BytesRange) +STREAM *ConnectAndSendHeaders(const char *URL, int Flags, double BytesRange) { STREAM *Con; -char *Tempstr=NULL, *Method=NULL; +char *Tempstr=NULL, *Method=NULL, *ptr; HTTPInfoStruct *Info; static char *LastPage=NULL; -if (StrLen(Proxy)) HTTPSetProxy(Proxy); - if (Flags & FLAG_POST) Method=CopyStr(Method,"POST"); else Method=CopyStr(Method,"GET"); Info=HTTPInfoFromURL(Method, URL); //if (DLFlags & DL_NOREDIRECT) Info->Flags |=HTTP_NOREDIRECT; -if (Flags & FLAG_HTTPS) Info->Flags |= HTTP_SSL|HTTP_SSL_REWRITE; if (Flags & FLAG_DEBUG3) Info->Flags |= HTTP_DEBUG; - +//Info->Flags |= HTTP_DEBUG; if (StrLen(LastPage)) SetVar(Info->CustomSendHeaders,"Referer",LastPage); @@ -38,12 +34,15 @@ if (BytesRange > 0) SetVar(Info->CustomSendHeaders,"Range",Tempstr); } +SetVar(Info->CustomSendHeaders,"Icy-MetaData","1"); + Con=HTTPTransact(Info); if ((! Con) && (! (Flags & FLAG_QUIET))) { if (StrLen(Info->ResponseCode)) fprintf(stderr,"ERROR: Server %s item '%s' not retrieved\nResponseCode: %s\n",Info->Host, Info->Doc,Info->ResponseCode); else fprintf(stderr,"ERROR: Connection failed to %s can't get file=%s \n",Info->Host, Info->Doc); } + DestroyString(Tempstr); DestroyString(Method); @@ -52,7 +51,7 @@ return(Con); -STREAM *ConnectAndRetryUntilDownload(char *URL, int Flags, double BytesRead) +STREAM *ConnectAndRetryUntilDownload(const char *URL, int Flags, double BytesRead) { STREAM *Con; int i; @@ -95,40 +94,98 @@ return(Con); } +void ICYReadString(STREAM *Con, char **Title) +{ +int len, remaining, result; +uint8_t icysize; +char *Tempstr=NULL, *Name=NULL, *Value=NULL, *ptr; + result=STREAMReadBytes(Con,&icysize,1); + if (icysize > 0) + { + len=icysize * 16; + remaining=len; + Tempstr=SetStrLen(Tempstr, len); + len=0; + while (remaining > 0) + { + result=STREAMReadBytes(Con,Tempstr + len, remaining); + if (result==EOF) break; + remaining-=result; + len+=result; + } + + Name=CopyStr(Name,""); + ptr=GetNameValuePair(Tempstr, ";", "=", &Name, &Value); + while (ptr) + { + if (strcasecmp(Name,"StreamTitle")==0) *Title=CopyStr(*Title, Value); + ptr=GetNameValuePair(ptr, ";", "=", &Name, &Value); + } + } + +DestroyString(Tempstr); +DestroyString(Name); +DestroyString(Value); +} -int TransferItem(STREAM *Con, char *Title, char *URL, char *Format, double SegmentSize, double DocSize, double *BytesRead, int PrintName) + +int TransferItem(STREAM *Con, const char *InitialTitle, const char *URL, const char *Format, double SegmentSize, double DocSize, double *BytesRead, int PrintName) { -char *Tempstr=NULL; -int result, RetVal=FALSE, PrintDownloadName; +char *Buffer=NULL, *Title=NULL, *Tempstr=NULL, *ptr; +int result, RetVal=FALSE, val; double ReadThisTime=0; +unsigned long IcyInterval=0, BlockRemaining=0; + +Title=CopyStr(Title, InitialTitle); +ptr=STREAMGetValue(Con,"HTTP:icy-metaint"); +if (StrLen(ptr)) IcyInterval=strtoul(ptr,NULL,10); DisplayProgress(Title, Format, *BytesRead, DocSize, PrintName); -Tempstr=SetStrLen(Tempstr,BUFSIZ); -result=STREAMReadBytes(Con,Tempstr,BUFSIZ); -while (result != EOF) + +while (1) { + if (BlockRemaining==0) + { + if (IcyInterval) BlockRemaining=IcyInterval; + else BlockRemaining=BUFSIZ; + Buffer=SetStrLen(Buffer,BlockRemaining); + } + + result=STREAMReadBytes(Con,Buffer,BlockRemaining); + if (result==EOF) break; + ReadThisTime +=result; (*BytesRead) +=result; + BlockRemaining-=result; - DisplayProgress(Title, Format, *BytesRead,DocSize,FALSE); + if (IcyInterval && (BlockRemaining==0)) + { + Tempstr=CopyStr(Tempstr,Title); + ICYReadString(Con, &Tempstr); + if (strcmp(Tempstr, Title) !=0) + { + Title=CopyStr(Title, Tempstr); + DisplayProgress(Title, Format, *BytesRead,DocSize,TRUE); + } + else DisplayProgress(Title, Format, *BytesRead,DocSize,FALSE); + } + else DisplayProgress(Title, Format, *BytesRead,DocSize,FALSE); - WriteOutputFiles(Tempstr,result); + WriteOutputFiles(Buffer,result); if ((SegmentSize > 0) && (ReadThisTime >= SegmentSize)) { break; } - result=STREAMReadBytes(Con,Tempstr,BUFSIZ); } RetVal=TRUE; -//give a bit of time for 'player' program to finish -sleep(3); - DisplayProgress(Title, Format, *BytesRead,DocSize,FALSE); DestroyString(Tempstr); +DestroyString(Buffer); +DestroyString(Title); return(RetVal); } @@ -136,7 +193,7 @@ return(RetVal); //----- Download an actual Video ---------------------- -int DownloadItem(char *URL, char *Title, char *Format, int Flags) +int DownloadItem(const char *URL, const char *Title, const char *Format, int Flags) { STREAM *Con=NULL, *S=NULL; char *Tempstr=NULL, *Token=NULL, *ptr; @@ -156,13 +213,17 @@ if (Flags & FLAG_DEBUG) fprintf(stderr,"Next URL: %s\n",URL); if (! (Flags & FLAG_TEST_SITES)) OpenOutputFiles(Title,URL,&BytesRead); + + if (! Con) Con=ConnectAndRetryUntilDownload(URL, Flags, BytesRead); if (Con) { //Some sites throttle excessively STREAMSetTimeout(Con,STREAMTimeout); - + if (strncmp(Format,"m3u8-stream:",12)==0) RetVal=M3UStreamDownload(Con, URL, Title); + else + { Token=CopyStr(Token,STREAMGetValue(Con,"HTTP:Content-Range")); if (StrLen(Token)) { @@ -188,6 +249,8 @@ if (Con) Extn=CopyStr(Extn,GuessExtn(GetVar(Con->Values,"HTTP:Content-Type"), Format, Tempstr)); CloseOutputFiles(Extn); } + } + STREAMClose(Con); } @@ -202,7 +265,7 @@ return(RetVal); -int DownloadPage(char *URL, int Type, char *Title, int DLFlags) +int DownloadPage(const char *URL, int Type, const char *Title, int DLFlags) { char *ptr, *Args=NULL; char *Tempstr=NULL, *Token=NULL; diff --git a/download.h b/download.h index 9650a8c..f16ffef 100644 --- a/download.h +++ b/download.h @@ -3,8 +3,12 @@ #include "common.h" -int DownloadItem(char *URL, char *Format, char *Path, int Flags); -int DownloadPage(char *Path, int Type, char *Title, int Flags); +int DownloadItem(const char *URL, const char *Format, const char *Path, int Flags); +int DownloadPage(const char *Path, int Type, const char *Title, int Flags); + +int TransferItem(STREAM *Con, const char *Title, const char *URL, const char *Format, double SegmentSize, double DocSize, double *BytesRead, int PrintName); + +STREAM *ConnectAndRetryUntilDownload(const char *URL, int Flags, double BytesRead); extern char *Proxy; extern int PlayerLaunchPercent; diff --git a/extract_text.c b/extract_text.c index 0639365..f4da147 100644 --- a/extract_text.c +++ b/extract_text.c @@ -1,66 +1,51 @@ #include "extract_text.h" -char *ItemCodeFromFileExtension(char *RetBuf, char *Default, char *Path) -{ -char *Tempstr=NULL, *RetStr=NULL, *ptr; - -Tempstr=CopyStr(Tempstr,Path); -ptr=strrchr(Tempstr,'?'); -if (ptr) *ptr='\0'; -ptr=strrchr(Tempstr,'.'); -if (ptr) -{ -ptr++; -RetStr=MCopyStr(RetBuf,"item:",ptr,NULL); -} -else RetStr=MCopyStr(RetBuf,Default); - -DestroyString(Tempstr); -return(RetStr); -} //This function Extracts Text from a line that's found between two specified //chunks of text 'ItemStart' and 'ItemEnd' -char *GenericExtractFromLine(char *Line, char *ItemName, char *ItemStart, char *ItemEnd, ListNode *Vars, int Flags) +char *GenericExtractFromLine(char *Line, const char *ItemName, const char *ItemStart, const char *ItemEnd, ListNode *Vars, int ExtractFlags) { char *ptr, *ptr2, *Token=NULL, *Item=NULL; +int ilen; int GTF=0; - if (Flags & EXTRACT_WITHIN_QUOTES) GTF=GETTOKEN_QUOTES; + ilen=StrLen(ItemStart); + if (ExtractFlags & EXTRACT_WITHIN_QUOTES) GTF=GETTOKEN_QUOTES; - if (StrLen(ItemStart)) ptr=GetToken(Line,ItemStart,&Token,0); + if (ilen) ptr=GetToken(Line,ItemStart,&Token,0); else ptr=Line; - ptr=GetToken(ptr,ItemEnd,&Token,GTF); + if (! StrValid(ItemEnd)) Token=CopyStr(Token,ptr); + else ptr=GetToken(ptr,ItemEnd,&Token,GTF); //check if the start string occurs more than once in the Token that we've grabbed - if (StrLen(ItemStart)) ptr2=strstr(Token,ItemStart); + if (ilen) ptr2=strstr(Token,ItemStart); else ptr2=NULL; while (ptr2) { - ptr2+=StrLen(ItemStart); + ptr2+=ilen; memmove(Token,ptr2,Token+StrLen(Token)-ptr2+1); //because of memmove we can strstr in Token again ptr2=strstr(Token,ItemStart); } - if (Flags & EXTRACT_INCLUDE_START) + if (ExtractFlags & EXTRACT_INCLUDE_START) { Item=MCopyStr(Item,ItemStart,Token,NULL); Token=CopyStr(Token,Item); } - if (Flags & EXTRACT_DEQUOTE) Item=HTTPUnQuote(Item,Token); - else if (Flags & EXTRACT_DEHTMLQUOTE) Item=HtmlDeQuote(Item,Token); - else if (Flags & EXTRACT_DESLASHQUOTE) Item=DeQuoteStr(Item,Token); + if (ExtractFlags & EXTRACT_DEQUOTE) Item=HTTPUnQuote(Item,Token); + else if (ExtractFlags & EXTRACT_DEHTMLQUOTE) Item=HtmlDeQuote(Item,Token); + else if (ExtractFlags & EXTRACT_DESLASHQUOTE) Item=DeQuoteStr(Item,Token); else Item=CopyStr(Item,Token); StripLeadingWhitespace(Item); StripTrailingWhitespace(Item); StripQuotes(Item); - if (Flags & EXTRACT_NOSPACES) + if (ExtractFlags & EXTRACT_NOSPACES) { ptr2=strchr(Item,' '); while (ptr2) @@ -72,12 +57,14 @@ int GTF=0; //Do this without disturbing ptr, as we must return ptr ptr2=ItemName; - if (Flags & EXTRACT_GUESSTYPE) + if (ExtractFlags & EXTRACT_GUESSTYPE) { Token=ItemCodeFromFileExtension(Token, ItemName, Item); + if (StrValid(Token)) ptr2=Token; } SetVar(Vars,ptr2,Item); + if (Flags & FLAG_DEBUG2) fprintf(stderr,"Extracted Item: [%s] [%s]\n",ptr2,Item); DestroyString(Token); DestroyString(Item); diff --git a/extract_text.h b/extract_text.h index 5695891..caa1a94 100644 --- a/extract_text.h +++ b/extract_text.h @@ -16,7 +16,7 @@ //This function Extracts Text from a line that's found between two specified //chunks of text 'ItemStart' and 'ItemEnd' -char *GenericExtractFromLine(char *Line, char *ItemName, char *ItemStart, char *ItemEnd, ListNode *Vars, int Flags); +char *GenericExtractFromLine(char *Line, const char *ItemName, const char *ItemStart, const char *ItemEnd, ListNode *Vars, int Flags); #endif diff --git a/libUseful-2.0/ConnectionChain.c b/libUseful-2.0/ConnectionChain.c deleted file mode 100644 index 8255511..0000000 --- a/libUseful-2.0/ConnectionChain.c +++ /dev/null @@ -1,299 +0,0 @@ -#include "ConnectionChain.h" -#include "ParseURL.h" -#include "SpawnPrograms.h" - -char *HopTypes[]={"none","direct","http_proxy","ssh","sshtunnel","shell","telnet",NULL}; -typedef enum {CONNECT_HOP_NONE, CONNECT_HOP_TCP, CONNECT_HOP_HTTP_PROXY, CONNECT_HOP_SSH, CONNECT_HOP_SSHTUNNEL, CONNECT_HOP_SHELL_CMD, CONNECT_HOP_TELNET} THopTypes; - - -int DoHTTPProxyTunnel(STREAM *S, char *Host, int Port, int Flags) -{ -char *Tempstr=NULL, *Token=NULL, *ptr=NULL; -int result=FALSE; - - if (Flags & CONNECT_SSL) Tempstr=FormatStr(Tempstr,"CONNECT https://%s:%d HTTP/1.1\r\n\r\n",Host,Port); - else Tempstr=FormatStr(Tempstr,"CONNECT http://%s:%d HTTP/1.1\r\n\r\n",Host,Port); - STREAMWriteLine(Tempstr,S); - STREAMFlush(S); - - Tempstr=STREAMReadLine(Tempstr,S); - StripTrailingWhitespace(Tempstr); - - ptr=GetToken(Tempstr," ",&Token,0); - ptr=GetToken(ptr," ",&Token,0); - - if (*Token==2) result=TRUE; - while (StrLen(Tempstr)) - { - Tempstr=STREAMReadLine(Tempstr,S); - StripTrailingWhitespace(Tempstr); - } - -DestroyString(Tempstr); -DestroyString(Token); - -return(result); -} - - -int SendPublicKeyToRemote(STREAM *S, char *KeyFile, char *LocalPath) -{ -char *Tempstr=NULL, *RetStr=NULL, *Line=NULL; -STREAM *LocalFile; - - -Tempstr=FormatStr(Tempstr,"rm -f %s ; touch %s; chmod 0600 %s\n",KeyFile,KeyFile,KeyFile); -STREAMWriteLine(Tempstr,S); -LocalFile=STREAMOpenFile(LocalPath,O_RDONLY); -if (LocalFile) -{ -Line=STREAMReadLine(Line,LocalFile); -while (Line) -{ -StripTrailingWhitespace(Line); -Tempstr=FormatStr(Tempstr,"echo '%s' >> %s\n",Line,KeyFile); -STREAMWriteLine(Tempstr,S); -Line=STREAMReadLine(Line,LocalFile); -} -STREAMClose(LocalFile); -} - -return(TRUE); -} - - - -int ConnectHopSSH(STREAM *S,int Type, char *Host, int Port, char *User, char *Pass, char *NextHop) -{ -char *Tempstr=NULL, *KeyFile=NULL, *Token=NULL, *Token2=NULL, *ptr; -STREAM *AuthS; -int result=FALSE, val; -unsigned int TunnelPort=0; - -if (Type==CONNECT_HOP_SSHTUNNEL) -{ - TunnelPort=(rand() % (0xFFFF - 9000)) +9000; - //Host will be Token, and port Token2 - ParseConnectDetails(NextHop, NULL, &Token, &Token2, NULL, NULL, NULL); - Tempstr=FormatStr(Tempstr,"ssh -2 -N %s@%s -L %d:%s:%s ",User,Host,TunnelPort,Token,Token2); - -} -else Tempstr=MCopyStr(Tempstr,"ssh -2 -T ",User,"@",Host, " ", NULL ); - -if (strncmp(Pass,"keyfile:",8)==0) -{ - - if (S->in_fd != -1) - { - Token=FormatStr(Token,".%d-%d",getpid(),time(NULL)); - SendPublicKeyToRemote(S,Token,Pass+8); - KeyFile=CopyStr(KeyFile,Token); - } - Tempstr=MCatStr(Tempstr,"-i ",KeyFile," ",NULL); - } - - if (Port > 0) - { - Token=FormatStr(Token," -p %d ",Port); - Tempstr=CatStr(Tempstr,Token); - } - - if (Type==CONNECT_HOP_SSHTUNNEL) - { - Tempstr=CatStr(Tempstr, " 2> /dev/null"); - AuthS=STREAMSpawnCommand(Tempstr,COMMS_BY_PTY); - STREAMSetValue(S,"HelperPID:SSH",STREAMGetValue(AuthS,"PeerPID")); - } - else if (S->in_fd==-1) - { - Tempstr=CatStr(Tempstr, " 2> /dev/null"); - PseudoTTYSpawn(&S->in_fd,Tempstr,0); - S->out_fd=S->in_fd; - if (S->in_fd > -1) - { - result=TRUE; - STREAMSetFlushType(S,FLUSH_LINE,0); - } - AuthS=S; - } - else - { - if (StrLen(KeyFile)) Tempstr=MCatStr(Tempstr," ; rm -f ",KeyFile,NULL); - Tempstr=CatStr(Tempstr,"; exit\n"); - STREAMWriteLine(Tempstr,S); - result=TRUE; - AuthS=S; - } - - if ((StrLen(KeyFile)==0) && (StrLen(Pass) > 0)) - { - Token=MCopyStr(Token,Pass,"\n",NULL); - for (val=0; val < 3; val++) - { - if (STREAMExpectAndReply(AuthS,"assword:",Token)) break; - } - } - STREAMSetTimeout(AuthS,1); - //STREAMExpectSilence(AuthS); - sleep(3); - - if (Type==CONNECT_HOP_SSHTUNNEL) - { - S->in_fd=ConnectToHost("127.0.0.1",TunnelPort,0); - S->out_fd=S->in_fd; - if (S->in_fd > -1) result=TRUE; - } - - -DestroyString(Tempstr); -DestroyString(KeyFile); -DestroyString(Token2); -DestroyString(Token); - -return(result); -} - - -int STREAMProcessConnectHop(STREAM *S, char *HopURL, int LastHop) -{ -int val, result=FALSE; -char *Token=NULL, *Token2=NULL, *ptr; -char *Tempstr=NULL; -char *User=NULL, *Host=NULL,*Pass=NULL, *KeyFile=NULL; -int Port=0; - -ParseConnectDetails(HopURL, &Token, &Host, &Token2, &User, &Pass, NULL); -Port=atoi(Token2); - -val=MatchTokenFromList(Token,HopTypes,0); -switch (val) -{ - case CONNECT_HOP_TCP: - if (S->in_fd==-1) - { - S->in_fd=ConnectToHost(Host,Port,0); - S->out_fd=S->in_fd; - if (S->in_fd > -1) result=TRUE; - } - break; - - case CONNECT_HOP_HTTP_PROXY: - result=DoHTTPProxyTunnel(S, Host, Port, 0); - break; - - case CONNECT_HOP_SSH: - case CONNECT_HOP_SSHTUNNEL: - result=ConnectHopSSH(S, val, Host, Port, User, Pass, S->Path); - break; - - case CONNECT_HOP_SHELL_CMD: - break; - - case CONNECT_HOP_TELNET: - if (Port > 0) - { - Tempstr=FormatStr(Tempstr,"telnet -8 %s %d ",Host, Port); - } - else Tempstr=FormatStr(Tempstr,"telnet -8 %s ",Host); - - if (S->in_fd==-1) - { - PseudoTTYSpawn(& S->in_fd,Tempstr,0); - S->out_fd=S->in_fd; - if (S->in_fd > -1) - { - result=TRUE; - STREAMSetFlushType(S,FLUSH_LINE,0); - } - - } - else - { - Tempstr=CatStr(Tempstr,";exit\n"); - STREAMWriteLine(Tempstr,S); - result=TRUE; - } - if (StrLen(User) > 0) - { - Tempstr=MCopyStr(Tempstr,User,"\n",NULL); - STREAMExpectAndReply(S,"ogin:",Tempstr); - } - if (StrLen(Pass) > 0) - { - Tempstr=MCopyStr(Tempstr,Pass,"\n",NULL); - STREAMExpectAndReply(S,"assword:",Tempstr); - } - STREAMSetTimeout(S,2); - STREAMExpectSilence(S); - break; - - -} - -DestroyString(Tempstr); -DestroyString(Token); -DestroyString(KeyFile); -DestroyString(Host); -DestroyString(User); -DestroyString(Pass); - -STREAMSetTimeout(S,30); -STREAMFlush(S); -return(result); -} - - -/* -int STREAMInternalLastHop(STREAM *S,char *DesiredHost,int DesiredPort, char *LastHop) -{ -int result, Type,Port; -char *Host=NULL, *User=NULL, *Pass=NULL, *KeyFile=NULL; - -ParseConnectHop(LastHop, &Type, &Host, &User, &Pass, &KeyFile, &Port); -switch (Type) -{ - -} -result=STREAMProcessConnectHop(S, Tempstr, TRUE); - -DestroyString(Tempstr); -DestroyString(Host); -DestroyString(User); -DestroyString(Pass); -DestroyString(KeyFile); -return(result); -} -*/ - - - -int STREAMAddConnectionHop(STREAM *S, char *Value) -{ -char *Tempstr=NULL; -char *ConnectType=NULL; -int i; - -StripTrailingWhitespace(Value); -StripLeadingWhitespace(Value); - -if (! S->Values) S->Values=ListCreate(); -Tempstr=FormatStr(Tempstr,"ConnectHop:%d",ListSize(S->Values)); -STREAMSetValue(S,Tempstr,Value); - -DestroyString(Tempstr); -return(TRUE); -} - -void STREAMAddConnectionHopList(STREAM *S, char *HopList) -{ -char *Hop=NULL, *ptr; - -ptr=GetToken(HopList,",",&Hop,0); -while (ptr) -{ -STREAMAddConnectionHop(S,Hop); -ptr=GetToken(ptr,",",&Hop,0); -} - -DestroyString(Hop); -} diff --git a/libUseful-2.0/Copy.sh b/libUseful-2.0/Copy.sh deleted file mode 100644 index 1f33ae3..0000000 --- a/libUseful-2.0/Copy.sh +++ /dev/null @@ -1,6 +0,0 @@ -for FILE in ../*.c -do -NAME=`basename $FILE` -cat $FILE | sed "s/AddItemToList/ListAddItem/g" | sed "s/AddNamedItemToList/ListAddNamedItem/g" | sed "s/GetListHead/ListGetHead/g" | sed "s/GetNextListItem/ListGetNext/g" | sed "s/GetPrevListItem/ListGetPrev/g" | sed "s/DeleteNodeFromList/ListDeleteNode/g" | sed "s/ClearList/ListClear/g" | sed "s/DestroyList/ListDestroy/g" | sed "s/CloneList/ListClone/g" | sed "s/GetNthListItem/ListGetNth/g" | sed "s/GetLastListitem/ListGetLast/g" | sed "s/CreateEmptyList/ListCreate/g" | sed "s/CountItemsInList/ListSize/g" | sed "s/InsertItemIntoList/ListInsertItem/g" > $NAME - -done diff --git a/libUseful-2.0/FileSystem.h b/libUseful-2.0/FileSystem.h deleted file mode 100644 index 6f3deda..0000000 --- a/libUseful-2.0/FileSystem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef LIBUSEFUL_FILEPATH_H -#define LIBUSEFUL_FILEPATH_H - -#include "includes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -char *GetBasename(char *Path); -char *SlashTerminateDirectoryPath(char *DirPath); -char *StripDirectorySlash(char *DirPath); -int FileExists(char *); -int MakeDirPath(char *Path, int DirMask); -int FindFilesInPath(char *File, char *Path, ListNode *Files); -char *FindFileInPath(char *InBuff, char *File, char *Path); -int ChangeFileExtension(char *FilePath, char *NewExt); -int FindFilesInPath(char *File, char *Path, ListNode *Files); - -#ifdef __cplusplus -} -#endif - - - -#endif diff --git a/libUseful-2.0/GeneralFunctions.c b/libUseful-2.0/GeneralFunctions.c deleted file mode 100644 index 22f75b5..0000000 --- a/libUseful-2.0/GeneralFunctions.c +++ /dev/null @@ -1,339 +0,0 @@ -#include "includes.h" -#include "base64.h" - -int WritePidFile(char *ProgName) -{ -char *Tempstr=NULL; -STREAM *S; -int result=FALSE; - - -if (*ProgName=='/') Tempstr=CopyStr(Tempstr,ProgName); -else Tempstr=FormatStr(Tempstr,"/var/run/%s.pid",ProgName); - -S=STREAMOpenFile(Tempstr,O_CREAT | O_WRONLY); -if (S) -{ - fchmod(S->in_fd,0644); - if (flock(S->in_fd,LOCK_EX|LOCK_NB) !=0) - { - STREAMClose(S); - exit(1); - } - result=TRUE; - Tempstr=FormatStr(Tempstr,"%d\n",getpid()); - STREAMWriteLine(Tempstr,S); - STREAMFlush(S); -} - -//Don't close 'S'! - -DestroyString(Tempstr); - -return(result); -} - - -void CloseOpenFiles() -{ - int i; - - for (i=3; i < 1024; i++) close(i); -} - - -char *BytesToHexStr(char *Buffer, char *Bytes, int len) -{ -int i; -char *Str=NULL, *ptr; - - -Str=SetStrLen(Buffer,(len *2) +1); -ptr=Str; -for (i=0; i < len; i++) -{ - snprintf(ptr,2,"%02x",Bytes[i]); - ptr+=2; -} -*ptr='\0'; - -return(Str); -} - - -int HexStrToBytes(char **Buffer, char *HexStr) -{ -int i, len; -char *Str=NULL, *ptr; - -len=StrLen(HexStr); -*Buffer=SetStrLen(*Buffer,len / 2); -ptr=*Buffer; -for (i=0; i < len; i+=2) -{ - Str=CopyStrLen(Str,HexStr+i,2); - *ptr=strtol(Str,NULL,16); - ptr++; -} - -DestroyString(Str); -return(len / 2); -} - - -void SwitchProgram(char *CommandLine) -{ -char **argv, *ptr; -char *Token=NULL; -int i; - -argv=(char **) calloc(101,sizeof(char *)); -ptr=CommandLine; -for (i=0; i < 100; i++) -{ -ptr=GetToken(ptr,"\\S",&Token,GETTOKEN_QUOTES); -if (! ptr) break; -argv[i]=CopyStr(argv[i],Token); -} - -/* we are the child so we continue */ -execv(argv[0],argv); -//no point trying to free stuff here, we will no longer -//be the main program -} - - -#include -#include - -int SwitchUser(char *NewUser) -{ -struct passwd *pwent; - - pwent=getpwnam(NewUser); - if (! pwent) return(FALSE); - if (setreuid(pwent->pw_uid,pwent->pw_uid) !=0) return(FALSE); - return(TRUE); -} - - -int SwitchGroup(char *NewGroup) -{ -struct group *grent; - - grent=getgrnam(NewGroup); - if (! grent) return(FALSE); - if (setgid(grent->gr_gid) !=0) return(FALSE); - return(TRUE); -} - -char *GetCurrUserHomeDir() -{ -struct passwd *pwent; - - pwent=getpwuid(getuid()); - if (! pwent) return(NULL); - return(pwent->pw_dir); -} - - - -void ColLibDefaultSignalHandler(int sig) -{ - -} - - -int CreateLockFile(char *FilePath, int Timeout) -{ -int fd, result; - -SetTimeout(Timeout); -fd=open(FilePath, O_CREAT | O_RDWR, 0600); -if (fd <0) return(-1); -result=flock(fd,LOCK_EX); -alarm(0); - -if (result==-1) -{ - close(fd); - return(-1); -} -return(fd); -} - - - - -char *GetNameValuePair(const char *Input, const char *PairDelim, const char *NameValueDelim, char **Name, char **Value) -{ -char *ptr, *ptr2; -char *Token=NULL; - -ptr=GetToken(Input,PairDelim,&Token,GETTOKEN_QUOTES); -if (StrLen(Token) && strstr(Token,NameValueDelim)) -{ -ptr2=GetToken(Token,NameValueDelim,Name,GETTOKEN_QUOTES); -ptr2=GetToken(ptr2,PairDelim,Value,GETTOKEN_QUOTES); -} - -DestroyString(Token); -return(ptr); -} - - - - - -char *GetRandomData(char *RetBuff, int len, char *AllowedChars) -{ -int fd; -char *Tempstr=NULL, *RetStr=NULL; -int i; -uint8_t val, max_val; - -srand(time(NULL)); -max_val=StrLen(AllowedChars); - -RetStr=CopyStr(RetBuff,""); -fd=open("/dev/urandom",O_RDONLY); -for (i=0; i < len ; i++) -{ - if (fd > -1) read(fd,&val,1); - else val=rand(); - - RetStr=AddCharToStr(RetStr,AllowedChars[val % max_val]); -} - -if (fd) close(fd); - -DestroyString(Tempstr); -return(RetStr); -} - - -char *GetRandomHexStr(char *RetBuff, int len) -{ -return(GetRandomData(RetBuff,len,HEX_CHARS)); -} - - -char *GetRandomAlphabetStr(char *RetBuff, int len) -{ -return(GetRandomData(RetBuff,len,ALPHA_CHARS)); -} - - - - - -#define KILOBYTE 1000 -#define MEGABYTE 1000000 -#define GIGABYTE 1000000000 -#define TERABYTE 1000000000000 - -#define KIBIBYTE 1024 -#define MEGIBYTE 1024 * 1024 -#define GIGIBYTE 1024 * 1024 * 1024 -#define TERIBYTE 1024 * 1024 * 1024 *1024 - -double ParseHumanReadableDataQty(char *Data, int Type) -{ -double val; -char *ptr=NULL; -double KAY,MEG,GIG,TERA; - -if (Type) -{ -KAY=KILOBYTE; -MEG=MEGABYTE; -GIG=GIGABYTE; -//TERA=TERABYTE; -} -else -{ -KAY=KIBIBYTE; -MEG=MEGIBYTE; -GIG=GIGIBYTE; -//TERA=TERIBYTE; -} - - val=strtod(Data,&ptr); - while (isspace(*ptr)) ptr++; - if (*ptr=='k') val=val * KAY; - if (*ptr=='M') val=val * MEG; - if (*ptr=='G') val=val * GIG; -// if (*ptr=='T') val=val * TERA; - - -return(val); -} - - - -char *GetHumanReadableDataQty(double Size, int Type) -{ -static char *Str=NULL; -double val=0; -char kMGT=' '; -//Set to 0 to keep valgrind happy -double KAY=0,MEG=0,GIG=0,TERA=0; - -if (Type) -{ -KAY=KILOBYTE; -MEG=MEGABYTE; -GIG=GIGABYTE; -//TERA=TERABYTE; -} -else -{ -KAY=KIBIBYTE; -MEG=MEGIBYTE; -GIG=GIGIBYTE; -//TERA=TERIBYTE; -} - val=Size; - kMGT=' '; -/* if (val > (TERA)) - { - val=val / TERA; - kMGT='T'; - } - else*/ - if (val > (GIG)) - { - val=val / GIG; - kMGT='G'; - } - else if (val > (MEG)) - { - val=val / MEG; - kMGT='M'; - - } - else if (val > (KAY)) - { - val=val / KAY; - kMGT='k'; - } - -Str=FormatStr(Str,"%0.1f%c",(float) val,kMGT); -return(Str); -} - - -void EraseString(char *Buff, char *Target) -{ -char *ptr; -int len; - -len=StrLen(Target); -ptr=strstr(Buff,Target); -while (ptr) -{ -memset(ptr,' ',len); -ptr=strstr(ptr,Target); -} - -} diff --git a/libUseful-2.0/Hash.c b/libUseful-2.0/Hash.c deleted file mode 100644 index 74f1f28..0000000 --- a/libUseful-2.0/Hash.c +++ /dev/null @@ -1,395 +0,0 @@ -#include "Hash.h" -#include "string.h" - -char *EncodeBase64(char *Return, char *Text, int len) -{ -char *RetStr; - -RetStr=SetStrLen(Return,len *2); -to64frombits(RetStr,Text,len); - -return(RetStr); -} - -char *DecodeBase64(char *Return, int *len, char *Text) -{ -char *RetStr; - -RetStr=SetStrLen(Return,StrLen(Text) *2); -*len=from64tobits(RetStr,Text); - -return(RetStr); -} - -int HMAC(char **Return, char *Algo, char *iKey, int iKeyLen, char *iText, int iTextLen) -{ -int blocksize=64, len, i; -char *Key=NULL, *Text=NULL; -int KeyLen, TextLen; -char *Tempstr=NULL, *Digest=NULL, *OpadKey=NULL, *IpadKey=NULL; - -len=StrLen(iKey); - -if (len > blocksize) KeyLen=HashBytes(&Key,Algo,iKey,iKeyLen,0); -else -{ -KeyLen=len; -Key=SetStrLen(Key,len); -memcpy(Key,iKey,len); -} - -Key=SetStrLen(Key,blocksize); -IpadKey=SetStrLen(IpadKey,blocksize); -OpadKey=SetStrLen(OpadKey,blocksize); - -for (i=0; i < blocksize; i++) -{ -IpadKey[i]=Key[i] ^ 0x5c; -OpadKey[i]=Key[i] ^ 0x36; -} - -len=StrLen(Text); -Tempstr=SetStrLen(Tempstr,blocksize+len); -memcpy(Tempstr,IpadKey,blocksize); -memcpy(Tempstr+blocksize,Text,len); -len=HashBytes(&Digest,Algo,Tempstr,blocksize+len,0); - -Tempstr=SetStrLen(Tempstr,blocksize+len); -memcpy(Tempstr,OpadKey,blocksize); -memcpy(Tempstr+blocksize,Digest,len); -len=HashBytes(Return,Algo,Tempstr,blocksize+len,0); - -DestroyString(Digest); -DestroyString(Tempstr); -DestroyString(IpadKey); -DestroyString(OpadKey); - -return(len); -} - - -char *EncodeHash(char *Buffer, char *Digest, int len, int Encoding) -{ -char *Tempstr=NULL, *RetStr=NULL; -int i; - -RetStr=SetStrLen(Buffer,128); -if (Encoding==ENCODE_BASE64) to64frombits(RetStr,Digest,len); -else -{ - for (i=0; i < len; i++) - { - Tempstr=FormatStr(Tempstr,"%02x",Digest[i] & 255); - RetStr=CatStr(RetStr,Tempstr); - } -} - -DestroyString(Tempstr); -return(RetStr); -} - - - - -#include "crc32.h" - -void HashUpdateCRC(THash *Hash, char *Data, int Len) -{ -crc32Update((unsigned long *) &Hash->Ctx, Data, Len); -} - - -int HashFinishCRC(THash *Hash, int Encoding, char **HashStr) -{ -unsigned long crc; -int len; - -len=sizeof(unsigned long); -crc32Finish((unsigned long *) Hash->Ctx); -//crc=htonl((unsigned long *) Hash->Ctx); - -free(Hash->Ctx); - -if (Encoding > 0) -{ -*HashStr=EncodeHash(*HashStr, (char *) &crc, len, Encoding); -return(StrLen(*HashStr)); -} -else -{ -*HashStr=SetStrLen(*HashStr,len); -memcpy(*HashStr,&crc,len); -return(len); -} -} - - -void HashInitCRC(THash *Hash) -{ -Hash->Ctx=(void *) calloc(1,sizeof(unsigned long)); -crc32Init((unsigned long *) Hash->Ctx); -Hash->Update=HashUpdateCRC; -Hash->Finish=HashFinishCRC; -} - - -#include "md5.h" -#define MD5LEN 16 - -void HashUpdateMD5(THash *Hash, char *Data, int Len) -{ -MD5Update((MD5_CTX *) Hash->Ctx, Data, Len); -} - - -int HashFinishMD5(THash *Hash, int Encoding, char **HashStr) -{ -int count, len; -char *Tempstr=NULL, *DigestBuff=NULL; - -DigestBuff=(char *) calloc(1,MD5LEN+1); -MD5Final(DigestBuff, (MD5_CTX *) Hash->Ctx); - -free(Hash->Ctx); - -if (Encoding > 0) -{ -*HashStr=EncodeHash(*HashStr, DigestBuff, MD5LEN, Encoding); -len=StrLen(*HashStr); -} -else -{ -len=MD5LEN; -*HashStr=SetStrLen(*HashStr,len); -memcpy(*HashStr,DigestBuff,len); -} - -DestroyString(DigestBuff); -DestroyString(Tempstr); - -return(len); -} - - -void HashInitMD5(THash *Hash) -{ -Hash->Ctx=(void *) calloc(1,sizeof(MD5_CTX)); -MD5Init((MD5_CTX *) Hash->Ctx); -Hash->Update=HashUpdateMD5; -Hash->Finish=HashFinishMD5; -} - -#include "sha1.h" -#define SHA1LEN 20 - -void HashUpdateSHA1(THash *Hash, char *Data, int Len) -{ -sha1_process_bytes(Data,Len,(struct sha1_ctx *) Hash->Ctx); -} - - -int HashFinishSHA1(THash *Hash, int Encoding, char **HashStr) -{ -int count, len; -char *Tempstr=NULL, *DigestBuff=NULL; - -DigestBuff=(char *) calloc(1,SHA1LEN+1); -sha1_finish_ctx((struct sha1_ctx *) Hash->Ctx, DigestBuff); -free(Hash->Ctx); - -if (Encoding > 0) -{ - *HashStr=EncodeHash(*HashStr, DigestBuff, SHA1LEN, Encoding); - len=StrLen(*HashStr); -} -else -{ -len=SHA1LEN; -*HashStr=SetStrLen(*HashStr,len); -memcpy(*HashStr,DigestBuff,len); -} - -DestroyString(DigestBuff); -DestroyString(Tempstr); - -return(len); -} - - -void HashInitSHA1(THash *Hash) -{ -Hash->Ctx=(void *) calloc(1,sizeof(struct sha1_ctx)); -sha1_init_ctx((struct sha1_ctx *) Hash->Ctx); -Hash->Update=HashUpdateSHA1; -Hash->Finish=HashFinishSHA1; -} - - -#include "sha2.h" - -int HashFinishSHA256(THash *Hash, int Encoding, char **HashStr) -{ -int count, len; -char *Tempstr=NULL; -uint8_t *DigestBuff=NULL; - -DigestBuff=(uint8_t *) calloc(1,SHA256_DIGEST_LENGTH+1); -SHA256_Final(DigestBuff, (SHA256_CTX *) Hash->Ctx); -free(Hash->Ctx); - -if (Encoding > 0) -{ - *HashStr=EncodeHash(*HashStr, DigestBuff, SHA256_DIGEST_LENGTH, Encoding); - len=StrLen(*HashStr); -} -else -{ -len=SHA256_DIGEST_LENGTH; -*HashStr=SetStrLen(*HashStr,len); -memcpy(*HashStr,DigestBuff,len); -} - -DestroyString(DigestBuff); -DestroyString(Tempstr); - -return(len); -} - - -void HashUpdateSHA256(THash *Hash, char *Data, int Len) -{ -SHA256_Update((SHA256_CTX *) Hash->Ctx, Data, Len); -} - -void HashInitSHA256(THash *Hash) -{ -Hash->Ctx=(void *) calloc(1,sizeof(SHA256_CTX)); -SHA256_Init((SHA256_CTX *) Hash->Ctx); -Hash->Update=HashUpdateSHA256; -Hash->Finish=HashFinishSHA256; -} - - -int HashFinishSHA512(THash *Hash, int Encoding, char **HashStr) -{ -int count, len; -char *Tempstr=NULL, *DigestBuff=NULL; - -DigestBuff=(char *) calloc(1,SHA512_DIGEST_LENGTH+1); -SHA512_Final(DigestBuff, (SHA512_CTX *) Hash->Ctx); -free(Hash->Ctx); - -if (Encoding > 0) -{ - *HashStr=EncodeHash(*HashStr, DigestBuff, SHA512_DIGEST_LENGTH, Encoding); - len=StrLen(*HashStr); -} -else -{ -len=SHA512_DIGEST_LENGTH; -*HashStr=SetStrLen(*HashStr,len); -memcpy(*HashStr,DigestBuff,len); -} - -DestroyString(DigestBuff); -DestroyString(Tempstr); - -return(len); -} - - -void HashUpdateSHA512(THash *Hash, char *Data, int Len) -{ -SHA512_Update((SHA512_CTX *) Hash->Ctx, Data, Len); -} - -void HashInitSHA512(THash *Hash) -{ -Hash->Ctx=(void *) calloc(1,sizeof(SHA512_CTX)); -SHA512_Init((SHA512_CTX *) Hash->Ctx); -Hash->Update=HashUpdateSHA512; -Hash->Finish=HashFinishSHA512; -} - - - - -THash *HashInit(char *Type) -{ -THash *Hash=NULL; - -Hash=(THash *) calloc(1,sizeof(THash)); -if (strcasecmp(Type,"md5")==0) HashInitMD5(Hash); -else if (strcasecmp(Type,"sha")==0) HashInitSHA1(Hash); -else if (strcasecmp(Type,"sha1")==0) HashInitSHA1(Hash); -else if (strcasecmp(Type,"sha256")==0) HashInitSHA256(Hash); -else if (strcasecmp(Type,"sha512")==0) HashInitSHA512(Hash); -else if (strcasecmp(Type,"crc32")==0) HashInitCRC(Hash); -else -{ - free(Hash); - Hash=NULL; -} - -return(Hash); -} - - -void HashDestroy(THash *Hash) -{ -//Hash->Ctx is destroyed in 'HashFinish' -DestroyString(Hash->Type); -free(Hash); -} - - -int HashBytes(char **Return, char *Type, char *text, int len, int Encoding) -{ -THash *Hash; -int result; - -Hash=HashInit(Type); -if (! Hash) return(0); -Hash->Update(Hash, text, len); -result=Hash->Finish(Hash, Encoding, Return); -HashDestroy(Hash); - -return(result); -} - - -int HashFile(char **Return, char *Type, char *Path, int Encoding) -{ -THash *Hash; -STREAM *S; -char *Tempstr=NULL; -int result; - -S=STREAMOpenFile(Path,O_RDONLY); -if (! S) return(FALSE); - -Hash=HashInit(Type); -if (! Hash) -{ - STREAMClose(S); - return(FALSE); -} - - -Tempstr=SetStrLen(Tempstr,4096); -result=STREAMReadBytes(S,Tempstr,4096); -while (result !=EOF) -{ - Hash->Update(Hash, Tempstr, result); -result=STREAMReadBytes(S,Tempstr,4096); -} - -DestroyString(Tempstr); -STREAMClose(S); - -result=Hash->Finish(Hash, Encoding, Return); -HashDestroy(Hash); - -return(result); -} - diff --git a/libUseful-2.0/Log.h b/libUseful-2.0/Log.h deleted file mode 100644 index f6a8d0e..0000000 --- a/libUseful-2.0/Log.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef LIBUSEFUL_LOG_H -#define LIBUSEFUL_LOG_H - -#include "includes.h" -#include "defines.h" -#include "file.h" - -#define LOGFILE_FLUSH 1 -#define LOGFILE_SYSLOG 2 -#define LOGFILE_LOGPID 4 -#define LOGFILE_LOGUSER 8 -#define LOGFILE_LOCK 16 -#define LOGFILE_MILLISECS 32 - -extern char *G_LogFilePath; - -#ifdef __cplusplus -extern "C" { -#endif - -int LogFileSetValues(char *FileName, int Flags, int MaxSize, int FlushInterval); -int LogToSTREAM(STREAM *S, int Flags, char *Str); -void LogFileFlushAll(int Force); -int LogToFile(char *FileName,char *fmt, ...); -void LogFileClose(char *Path); -int LogFileAppendTempLog(char *LogPath, char *TmpLogPath); -void LogFileCheckRotate(char *FileName); - - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/libUseful-2.0/ParseURL.h b/libUseful-2.0/ParseURL.h deleted file mode 100644 index 4c390d7..0000000 --- a/libUseful-2.0/ParseURL.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LIBUSEFUL_PARSEURL -#define LIBUSEFUL_PARSEURL - -#include "includes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void ParseURL(char *URL, char **Proto, char **Host, char **Port, char **User, char **Password, char **Path, char **Args); -void ParseConnectDetails(char *Str, char **Type, char **Host, char **Port, char **User, char **Pass, char **InitDir); -void ParseConnectHop(char *Line, int *Type, char **Host, char **User, char **Password, char **KeyFile, int *Port); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/libUseful-2.0/Time.h b/libUseful-2.0/Time.h deleted file mode 100644 index 5635789..0000000 --- a/libUseful-2.0/Time.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef LIBUSEFUL_TIME_H -#define LIBUSEFUL_TIME_H - -#include "includes.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -char *GetDateStrFromSecs(char *DateFormat, time_t Secs, char *TimeZone); -char *GetDateStr(char *DateFormat, char *TimeZone); -time_t DateStrToSecs(char *DateFormat, char *Str, char *TimeZone); -void SetTimeout(int timeout); - - -#ifdef __cplusplus -} -#endif - - - -#endif diff --git a/libUseful-2.0/autom4te.cache/directory b/libUseful-2.0/autom4te.cache/directory deleted file mode 100644 index a446e19..0000000 --- a/libUseful-2.0/autom4te.cache/directory +++ /dev/null @@ -1 +0,0 @@ -cat: /home/metacosm89/fileferry-1.0/libUseful-2.0/autom4te.cache/directory: No such file or directory diff --git a/libUseful-2.0/autom4te.cache/output.0 b/libUseful-2.0/autom4te.cache/output.0 deleted file mode 100644 index 69c1164..0000000 --- a/libUseful-2.0/autom4te.cache/output.0 +++ /dev/null @@ -1,4779 +0,0 @@ -@%:@! /bin/sh -@%:@ Guess values for system-dependent variables and create Makefiles. -@%:@ Generated by GNU Autoconf 2.69. -@%:@ -@%:@ -@%:@ Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -@%:@ -@%:@ -@%:@ This configure script is free software; the Free Software Foundation -@%:@ gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in @%:@( - *posix*) : - set -o posix ;; @%:@( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in @%:@( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in @%:@(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in @%:@ (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in @%:@( - *posix*) : - set -o posix ;; @%:@( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in @%:@( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in @%:@ (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -@%:@ as_fn_unset VAR -@%:@ --------------- -@%:@ Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -@%:@ as_fn_set_status STATUS -@%:@ ----------------------- -@%:@ Set @S|@? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} @%:@ as_fn_set_status - -@%:@ as_fn_exit STATUS -@%:@ ----------------- -@%:@ Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} @%:@ as_fn_exit - -@%:@ as_fn_mkdir_p -@%:@ ------------- -@%:@ Create "@S|@as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} @%:@ as_fn_mkdir_p - -@%:@ as_fn_executable_p FILE -@%:@ ----------------------- -@%:@ Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} @%:@ as_fn_executable_p -@%:@ as_fn_append VAR VALUE -@%:@ ---------------------- -@%:@ Append the text in VALUE to the end of the definition contained in VAR. Take -@%:@ advantage of any shell optimizations that allow amortized linear growth over -@%:@ repeated appends, instead of the typical quadratic growth present in naive -@%:@ implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -@%:@ as_fn_arith ARG... -@%:@ ------------------ -@%:@ Perform arithmetic evaluation on the ARGs, and store the result in the -@%:@ global @S|@as_val. Take advantage of shells that can avoid forks. The arguments -@%:@ must be portable across @S|@(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -@%:@ as_fn_error STATUS ERROR [LINENO LOG_FD] -@%:@ ---------------------------------------- -@%:@ Output "`basename @S|@0`: error: ERROR" to stderr. If LINENO and LOG_FD are -@%:@ provided, also output the error to LOG_FD, referencing LINENO. Then exit the -@%:@ script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} @%:@ as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in @%:@((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIB@&t@OBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="defines.h" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='LTLIBOBJS -LIB@&t@OBJS -EGREP -GREP -CPP -SET_MAKE -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -VERSION -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_largefiles -enable_ssl -enable_z -enable_oss -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - @<:@@S|@ac_default_prefix@:>@ - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - @<:@PREFIX@:>@ - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root @<:@DATAROOTDIR/doc/PACKAGE@:>@ - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-largefiles enable largefile support - --enable-ssl use Secure Sockets Layer - --enable-zlib use ZLib Compression - --enable-oss use Open Sound System - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -@%:@ ac_fn_c_try_compile LINENO -@%:@ -------------------------- -@%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_c_try_compile - -@%:@ ac_fn_c_try_cpp LINENO -@%:@ ---------------------- -@%:@ Try to preprocess conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_c_try_cpp - -@%:@ ac_fn_c_try_run LINENO -@%:@ ---------------------- -@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. Assumes -@%:@ that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_c_try_run - -@%:@ ac_fn_c_try_link LINENO -@%:@ ----------------------- -@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} @%:@ ac_fn_c_try_link - -@%:@ ac_fn_c_check_func LINENO FUNC VAR -@%:@ ---------------------------------- -@%:@ Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* 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_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} @%:@ ac_fn_c_check_func - -@%:@ ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -@%:@ ------------------------------------------------------- -@%:@ Tests whether HEADER exists, giving a warning if it cannot be compiled using -@%:@ the include files in INCLUDES and setting the cache variable VAR -@%:@ accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -@%:@include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} @%:@ ac_fn_c_check_header_mongrel - -@%:@ ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -@%:@ ------------------------------------------------------- -@%:@ Tests whether HEADER exists and can be compiled using the include files in -@%:@ INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -@%:@include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} @%:@ ac_fn_c_check_header_compile -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -@%:@define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in @%:@(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -VERSION="0.0.1" - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $@%:@ != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@ifdef __STDC__ -@%:@ include -@%:@else -@%:@ include -@%:@endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@ifdef __STDC__ -@%:@ include -@%:@else -@%:@ include -@%:@endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -@%:@include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "@%:@define STDC_HEADERS 1" >>confdefs.h - -fi - - -cf_have_libssl=no -cf_have_libcrypto=no -cf_have_libz=no -cf_have_oss=no -cf_have_libesd=no - - -@%:@ Check whether --enable-largefiles was given. -if test "${enable_largefiles+set}" = set; then : - enableval=$enable_largefiles; cf_use_largefiles=$enableval -fi - - -if test "$cf_use_largefiles" = "yes" -then -$as_echo "@%:@define _LARGEFILE64_SOURCE 1" >>confdefs.h - -$as_echo "@%:@define _FILE_OFFSET_BITS 64" >>confdefs.h - -fi - -@%:@ Check whether --enable-ssl was given. -if test "${enable_ssl+set}" = set; then : - enableval=$enable_ssl; cf_use_ssl=$enableval -fi - - -if test "$cf_use_ssl" = "yes" -then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5 -$as_echo_n "checking for SSL_library_init in -lssl... " >&6; } -if ${ac_cv_lib_ssl_SSL_library_init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lssl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char SSL_library_init (); -int -main () -{ -return SSL_library_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ssl_SSL_library_init=yes -else - ac_cv_lib_ssl_SSL_library_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5 -$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; } -if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then : - cat >>confdefs.h <<_ACEOF -@%:@define HAVE_LIBSSL 1 -_ACEOF - - LIBS="-lssl $LIBS" - -fi - -cf_have_libssl=$ac_cv_lib_ssl_SSL_library_init - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_CIPHER_CTX_init in -lcrypto" >&5 -$as_echo_n "checking for EVP_CIPHER_CTX_init in -lcrypto... " >&6; } -if ${ac_cv_lib_crypto_EVP_CIPHER_CTX_init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcrypto $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char EVP_CIPHER_CTX_init (); -int -main () -{ -return EVP_CIPHER_CTX_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes -else - ac_cv_lib_crypto_EVP_CIPHER_CTX_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&5 -$as_echo "$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&6; } -if test "x$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" = xyes; then : - cat >>confdefs.h <<_ACEOF -@%:@define HAVE_LIBCRYPTO 1 -_ACEOF - - LIBS="-lcrypto $LIBS" - -fi - -cf_have_libcrypto=$ac_cv_lib_crypto_EVP_CIPHER_CTX_init - -for ac_func in OpenSSL_add_all_algorithms EVP_bf_cbc EVP_rc2_cbc EVP_rc4 EVP_rc5_32_12_16_cbc EVP_des_cbc EVP_desx_cbc EVP_cast5_cbc EVP_idea_cbc EVP_aes_128_cbc EVP_aes_256_cbc -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -@%:@define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking that OpenSSL Library is at least version 0.9.7" >&5 -$as_echo_n "checking that OpenSSL Library is at least version 0.9.7... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #if SSLEAY_VERSION_NUMBER >= 0x00907000L - yes - #endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "@%:@define USE_OPENSSL_ADD_ALL_ALGORITHMS 1" >>confdefs.h - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f conftest* - -fi - -if test "cf_have_libssl" = "yes" -then -cf_use_zlib=yes -fi - - -@%:@ Check whether --enable-z was given. -if test "${enable_z+set}" = set; then : - enableval=$enable_z; cf_use_zlib=$enableval -fi - - -if test "$cf_use_zlib" = "yes" -then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5 -$as_echo_n "checking for deflate in -lz... " >&6; } -if ${ac_cv_lib_z_deflate+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char deflate (); -int -main () -{ -return deflate (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_z_deflate=yes -else - ac_cv_lib_z_deflate=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflate" >&5 -$as_echo "$ac_cv_lib_z_deflate" >&6; } -if test "x$ac_cv_lib_z_deflate" = xyes; then : - cat >>confdefs.h <<_ACEOF -@%:@define HAVE_LIBZ 1 -_ACEOF - - LIBS="-lz $LIBS" - -fi - -cf_have_libz=$ac_cv_lib_z_deflate -fi - - -@%:@ Check whether --enable-oss was given. -if test "${enable_oss+set}" = set; then : - enableval=$enable_oss; cf_use_oss=$enableval -fi - - -cf_use_oss=yes - -if test "$cf_use_oss" = "yes" -then -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -@%:@define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_soundcard_h" = xyes; then : - $as_echo "@%:@define HAVE_OSS 1" >>confdefs.h - -else - cf_have_oss=no -fi - - -fi - - -#AC_ARG_ENABLE(esd, [ --enable-esd use ESound], cf_use_esd=$enableval ) - -if test "$cf_use_esd" = "yes" -then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for esd_open_sound in -lesd" >&5 -$as_echo_n "checking for esd_open_sound in -lesd... " >&6; } -if ${ac_cv_lib_esd_esd_open_sound+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lesd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char esd_open_sound (); -int -main () -{ -return esd_open_sound (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_esd_esd_open_sound=yes -else - ac_cv_lib_esd_esd_open_sound=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_esd_esd_open_sound" >&5 -$as_echo "$ac_cv_lib_esd_esd_open_sound" >&6; } -if test "x$ac_cv_lib_esd_esd_open_sound" = xyes; then : - cat >>confdefs.h <<_ACEOF -@%:@define HAVE_LIBESD 1 -_ACEOF - - LIBS="-lesd $LIBS" - -fi - -cf_have_libesd=$ac_cv_lib_esd_esd_open_sound -fi - - -ac_config_files="$ac_config_files Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIB@&t@OBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in @%:@( - *posix*) : - set -o posix ;; @%:@( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in @%:@( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in @%:@(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -@%:@ as_fn_error STATUS ERROR [LINENO LOG_FD] -@%:@ ---------------------------------------- -@%:@ Output "`basename @S|@0`: error: ERROR" to stderr. If LINENO and LOG_FD are -@%:@ provided, also output the error to LOG_FD, referencing LINENO. Then exit the -@%:@ script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} @%:@ as_fn_error - - -@%:@ as_fn_set_status STATUS -@%:@ ----------------------- -@%:@ Set @S|@? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} @%:@ as_fn_set_status - -@%:@ as_fn_exit STATUS -@%:@ ----------------- -@%:@ Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} @%:@ as_fn_exit - -@%:@ as_fn_unset VAR -@%:@ --------------- -@%:@ Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -@%:@ as_fn_append VAR VALUE -@%:@ ---------------------- -@%:@ Append the text in VALUE to the end of the definition contained in VAR. Take -@%:@ advantage of any shell optimizations that allow amortized linear growth over -@%:@ repeated appends, instead of the typical quadratic growth present in naive -@%:@ implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -@%:@ as_fn_arith ARG... -@%:@ ------------------ -@%:@ Perform arithmetic evaluation on the ARGs, and store the result in the -@%:@ global @S|@as_val. Take advantage of shells that can avoid forks. The arguments -@%:@ must be portable across @S|@(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in @%:@((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -@%:@ as_fn_mkdir_p -@%:@ ------------- -@%:@ Create "@S|@as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} @%:@ as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -@%:@ as_fn_executable_p FILE -@%:@ ----------------------- -@%:@ Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} @%:@ as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX -@%:@@%:@ Running $as_me. @%:@@%:@ -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - - - - esac - -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/libUseful-2.0/autom4te.cache/requests b/libUseful-2.0/autom4te.cache/requests deleted file mode 100644 index 3fc6822..0000000 --- a/libUseful-2.0/autom4te.cache/requests +++ /dev/null @@ -1,145 +0,0 @@ -# This file was generated. -# It contains the lists of macros which have been traced. -# It can be safely removed. - -@request = ( - bless( [ - '0', - 1, - [ - '/usr/share/autoconf' - ], - [ - '/usr/share/autoconf/autoconf/autoconf.m4f', - 'configure.in' - ], - { - '_LT_AC_TAGCONFIG' => 1, - 'AM_PROG_F77_C_O' => 1, - 'm4_pattern_forbid' => 1, - 'AC_CANONICAL_TARGET' => 1, - 'AC_CONFIG_LIBOBJ_DIR' => 1, - 'AC_TYPE_OFF_T' => 1, - 'AC_C_VOLATILE' => 1, - 'AC_FUNC_CLOSEDIR_VOID' => 1, - 'AC_REPLACE_FNMATCH' => 1, - 'AC_PROG_LIBTOOL' => 1, - 'AC_FUNC_STAT' => 1, - 'AC_HEADER_TIME' => 1, - 'AC_FUNC_WAIT3' => 1, - 'AM_AUTOMAKE_VERSION' => 1, - 'AC_STRUCT_TM' => 1, - 'AC_FUNC_LSTAT' => 1, - 'AC_TYPE_MODE_T' => 1, - 'AC_FUNC_GETMNTENT' => 1, - 'AC_FUNC_STRTOD' => 1, - 'AC_CHECK_HEADERS' => 1, - 'LT_CONFIG_LTDL_DIR' => 1, - 'AC_FUNC_STRNLEN' => 1, - 'm4_sinclude' => 1, - 'AC_PROG_CXX' => 1, - 'AC_PATH_X' => 1, - 'AM_NLS' => 1, - 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, - 'AC_PROG_AWK' => 1, - '_m4_warn' => 1, - 'AC_HEADER_STDC' => 1, - 'AC_HEADER_MAJOR' => 1, - 'AM_PROG_CXX_C_O' => 1, - '_AM_MAKEFILE_INCLUDE' => 1, - 'AM_PROG_MOC' => 1, - 'LT_INIT' => 1, - 'AC_FUNC_ERROR_AT_LINE' => 1, - 'AC_PROG_GCC_TRADITIONAL' => 1, - 'AC_LIBSOURCE' => 1, - 'AC_FUNC_MBRTOWC' => 1, - 'AC_STRUCT_ST_BLOCKS' => 1, - 'AM_PROG_FC_C_O' => 1, - 'AC_CANONICAL_BUILD' => 1, - 'AC_TYPE_SIGNAL' => 1, - 'AC_TYPE_UID_T' => 1, - '_AM_SUBST_NOTMAKE' => 1, - 'AC_CONFIG_AUX_DIR' => 1, - 'AC_PROG_MAKE_SET' => 1, - 'sinclude' => 1, - 'm4_pattern_allow' => 1, - 'AC_DEFINE_TRACE_LITERAL' => 1, - 'AC_FUNC_STRERROR_R' => 1, - 'AC_PROG_CC' => 1, - 'AC_FUNC_FORK' => 1, - 'AC_DECL_SYS_SIGLIST' => 1, - '_AM_COND_ELSE' => 1, - 'AC_FUNC_VPRINTF' => 1, - 'AC_FUNC_STRCOLL' => 1, - 'AC_PROG_YACC' => 1, - 'AC_SUBST_TRACE' => 1, - 'AC_INIT' => 1, - 'AC_STRUCT_TIMEZONE' => 1, - '_AM_COND_IF' => 1, - 'AC_FUNC_CHOWN' => 1, - 'AC_FUNC_ALLOCA' => 1, - 'AC_SUBST' => 1, - 'AC_FUNC_GETPGRP' => 1, - 'AC_CANONICAL_HOST' => 1, - 'AC_FC_SRCEXT' => 1, - 'AC_PROG_RANLIB' => 1, - 'AM_INIT_AUTOMAKE' => 1, - 'AC_FUNC_SETPGRP' => 1, - 'AC_CONFIG_SUBDIRS' => 1, - 'AM_PATH_GUILE' => 1, - 'AC_FUNC_MMAP' => 1, - 'AC_FUNC_REALLOC' => 1, - 'AC_TYPE_SIZE_T' => 1, - 'AC_REQUIRE_AUX_FILE' => 1, - 'AC_CONFIG_LINKS' => 1, - 'AC_CHECK_TYPES' => 1, - 'LT_SUPPORTED_TAG' => 1, - 'AC_CHECK_MEMBERS' => 1, - 'AM_MAINTAINER_MODE' => 1, - 'AC_FUNC_UTIME_NULL' => 1, - 'AC_FUNC_SELECT_ARGTYPES' => 1, - 'AC_FC_PP_DEFINE' => 1, - 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, - 'AM_MAKEFILE_INCLUDE' => 1, - 'AC_FUNC_STRFTIME' => 1, - 'AC_HEADER_STAT' => 1, - 'AC_C_INLINE' => 1, - 'AC_PROG_CPP' => 1, - '_AM_COND_ENDIF' => 1, - 'AC_TYPE_PID_T' => 1, - 'AC_C_CONST' => 1, - 'AC_PROG_LEX' => 1, - 'AM_ENABLE_MULTILIB' => 1, - 'AM_SILENT_RULES' => 1, - 'AC_CONFIG_FILES' => 1, - 'include' => 1, - 'AC_FUNC_SETVBUF_REVERSED' => 1, - 'AC_PROG_INSTALL' => 1, - 'AM_GNU_GETTEXT' => 1, - 'AM_PROG_AR' => 1, - 'AC_FUNC_OBSTACK' => 1, - 'AC_CHECK_LIB' => 1, - 'AC_FUNC_MALLOC' => 1, - 'AC_FUNC_GETGROUPS' => 1, - 'AC_FC_FREEFORM' => 1, - 'AC_FUNC_GETLOADAVG' => 1, - 'AH_OUTPUT' => 1, - 'AC_FC_PP_SRCEXT' => 1, - 'AC_FUNC_FSEEKO' => 1, - 'AM_PROG_CC_C_O' => 1, - 'AM_CONDITIONAL' => 1, - 'AC_CANONICAL_SYSTEM' => 1, - 'AC_FUNC_MKTIME' => 1, - 'AM_XGETTEXT_OPTION' => 1, - 'AC_CONFIG_HEADERS' => 1, - 'AC_HEADER_SYS_WAIT' => 1, - 'AM_POT_TOOLS' => 1, - 'AC_FUNC_MEMCMP' => 1, - 'AC_PROG_LN_S' => 1, - 'm4_include' => 1, - 'AC_HEADER_DIRENT' => 1, - 'AC_CHECK_FUNCS' => 1 - } - ], 'Autom4te::Request' ) - ); - diff --git a/libUseful-2.0/autom4te.cache/traces.0 b/libUseful-2.0/autom4te.cache/traces.0 deleted file mode 100644 index 91edc18..0000000 --- a/libUseful-2.0/autom4te.cache/traces.0 +++ /dev/null @@ -1,307 +0,0 @@ -m4trace:configure.in:2: -1- AC_INIT([defines.h]) -m4trace:configure.in:2: -1- m4_pattern_forbid([^_?A[CHUM]_]) -m4trace:configure.in:2: -1- m4_pattern_forbid([_AC_]) -m4trace:configure.in:2: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) -m4trace:configure.in:2: -1- m4_pattern_allow([^AS_FLAGS$]) -m4trace:configure.in:2: -1- m4_pattern_forbid([^_?m4_]) -m4trace:configure.in:2: -1- m4_pattern_forbid([^dnl$]) -m4trace:configure.in:2: -1- m4_pattern_forbid([^_?AS_]) -m4trace:configure.in:2: -1- AC_SUBST([SHELL]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([SHELL]) -m4trace:configure.in:2: -1- m4_pattern_allow([^SHELL$]) -m4trace:configure.in:2: -1- AC_SUBST([PATH_SEPARATOR]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([PATH_SEPARATOR]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PATH_SEPARATOR$]) -m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_NAME]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_NAME$]) -m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_TARNAME]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) -m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_VERSION]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_VERSION$]) -m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_STRING]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_STRING$]) -m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) -m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_URL], [m4_ifdef([AC_PACKAGE_URL], ['AC_PACKAGE_URL'])]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_URL]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_URL$]) -m4trace:configure.in:2: -1- AC_SUBST([exec_prefix], [NONE]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([exec_prefix]) -m4trace:configure.in:2: -1- m4_pattern_allow([^exec_prefix$]) -m4trace:configure.in:2: -1- AC_SUBST([prefix], [NONE]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([prefix]) -m4trace:configure.in:2: -1- m4_pattern_allow([^prefix$]) -m4trace:configure.in:2: -1- AC_SUBST([program_transform_name], [s,x,x,]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([program_transform_name]) -m4trace:configure.in:2: -1- m4_pattern_allow([^program_transform_name$]) -m4trace:configure.in:2: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([bindir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^bindir$]) -m4trace:configure.in:2: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([sbindir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^sbindir$]) -m4trace:configure.in:2: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([libexecdir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^libexecdir$]) -m4trace:configure.in:2: -1- AC_SUBST([datarootdir], ['${prefix}/share']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([datarootdir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^datarootdir$]) -m4trace:configure.in:2: -1- AC_SUBST([datadir], ['${datarootdir}']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([datadir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^datadir$]) -m4trace:configure.in:2: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([sysconfdir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^sysconfdir$]) -m4trace:configure.in:2: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([sharedstatedir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^sharedstatedir$]) -m4trace:configure.in:2: -1- AC_SUBST([localstatedir], ['${prefix}/var']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([localstatedir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^localstatedir$]) -m4trace:configure.in:2: -1- AC_SUBST([includedir], ['${prefix}/include']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([includedir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^includedir$]) -m4trace:configure.in:2: -1- AC_SUBST([oldincludedir], ['/usr/include']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([oldincludedir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^oldincludedir$]) -m4trace:configure.in:2: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], - ['${datarootdir}/doc/${PACKAGE_TARNAME}'], - ['${datarootdir}/doc/${PACKAGE}'])]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([docdir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^docdir$]) -m4trace:configure.in:2: -1- AC_SUBST([infodir], ['${datarootdir}/info']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([infodir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^infodir$]) -m4trace:configure.in:2: -1- AC_SUBST([htmldir], ['${docdir}']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([htmldir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^htmldir$]) -m4trace:configure.in:2: -1- AC_SUBST([dvidir], ['${docdir}']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([dvidir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^dvidir$]) -m4trace:configure.in:2: -1- AC_SUBST([pdfdir], ['${docdir}']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([pdfdir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^pdfdir$]) -m4trace:configure.in:2: -1- AC_SUBST([psdir], ['${docdir}']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([psdir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^psdir$]) -m4trace:configure.in:2: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([libdir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^libdir$]) -m4trace:configure.in:2: -1- AC_SUBST([localedir], ['${datarootdir}/locale']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([localedir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^localedir$]) -m4trace:configure.in:2: -1- AC_SUBST([mandir], ['${datarootdir}/man']) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([mandir]) -m4trace:configure.in:2: -1- m4_pattern_allow([^mandir$]) -m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_NAME$]) -m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ -@%:@undef PACKAGE_NAME]) -m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) -m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ -@%:@undef PACKAGE_TARNAME]) -m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_VERSION$]) -m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ -@%:@undef PACKAGE_VERSION]) -m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_STRING$]) -m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ -@%:@undef PACKAGE_STRING]) -m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) -m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ -@%:@undef PACKAGE_BUGREPORT]) -m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_URL]) -m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_URL$]) -m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_URL], [/* Define to the home page for this package. */ -@%:@undef PACKAGE_URL]) -m4trace:configure.in:2: -1- AC_SUBST([DEFS]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([DEFS]) -m4trace:configure.in:2: -1- m4_pattern_allow([^DEFS$]) -m4trace:configure.in:2: -1- AC_SUBST([ECHO_C]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([ECHO_C]) -m4trace:configure.in:2: -1- m4_pattern_allow([^ECHO_C$]) -m4trace:configure.in:2: -1- AC_SUBST([ECHO_N]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([ECHO_N]) -m4trace:configure.in:2: -1- m4_pattern_allow([^ECHO_N$]) -m4trace:configure.in:2: -1- AC_SUBST([ECHO_T]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([ECHO_T]) -m4trace:configure.in:2: -1- m4_pattern_allow([^ECHO_T$]) -m4trace:configure.in:2: -1- AC_SUBST([LIBS]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([LIBS]) -m4trace:configure.in:2: -1- m4_pattern_allow([^LIBS$]) -m4trace:configure.in:2: -1- AC_SUBST([build_alias]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([build_alias]) -m4trace:configure.in:2: -1- m4_pattern_allow([^build_alias$]) -m4trace:configure.in:2: -1- AC_SUBST([host_alias]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([host_alias]) -m4trace:configure.in:2: -1- m4_pattern_allow([^host_alias$]) -m4trace:configure.in:2: -1- AC_SUBST([target_alias]) -m4trace:configure.in:2: -1- AC_SUBST_TRACE([target_alias]) -m4trace:configure.in:2: -1- m4_pattern_allow([^target_alias$]) -m4trace:configure.in:5: -1- AC_SUBST([VERSION]) -m4trace:configure.in:5: -1- AC_SUBST_TRACE([VERSION]) -m4trace:configure.in:5: -1- m4_pattern_allow([^VERSION$]) -m4trace:configure.in:7: -1- AC_PROG_CC -m4trace:configure.in:7: -1- AC_SUBST([CC]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.in:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.in:7: -1- AC_SUBST([CFLAGS]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([CFLAGS]) -m4trace:configure.in:7: -1- m4_pattern_allow([^CFLAGS$]) -m4trace:configure.in:7: -1- AC_SUBST([LDFLAGS]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([LDFLAGS]) -m4trace:configure.in:7: -1- m4_pattern_allow([^LDFLAGS$]) -m4trace:configure.in:7: -1- AC_SUBST([LIBS]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([LIBS]) -m4trace:configure.in:7: -1- m4_pattern_allow([^LIBS$]) -m4trace:configure.in:7: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([CPPFLAGS]) -m4trace:configure.in:7: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.in:7: -1- AC_SUBST([CC]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.in:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.in:7: -1- AC_SUBST([CC]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.in:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.in:7: -1- AC_SUBST([CC]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.in:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.in:7: -1- AC_SUBST([CC]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([CC]) -m4trace:configure.in:7: -1- m4_pattern_allow([^CC$]) -m4trace:configure.in:7: -1- AC_SUBST([ac_ct_CC]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([ac_ct_CC]) -m4trace:configure.in:7: -1- m4_pattern_allow([^ac_ct_CC$]) -m4trace:configure.in:7: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([EXEEXT]) -m4trace:configure.in:7: -1- m4_pattern_allow([^EXEEXT$]) -m4trace:configure.in:7: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) -m4trace:configure.in:7: -1- AC_SUBST_TRACE([OBJEXT]) -m4trace:configure.in:7: -1- m4_pattern_allow([^OBJEXT$]) -m4trace:configure.in:8: -1- _m4_warn([obsolete], [The macro `AC_LANG_C' is obsolete. -You should run autoupdate.], [../../lib/autoconf/c.m4:72: AC_LANG_C is expanded from... -configure.in:8: the top level]) -m4trace:configure.in:9: -1- AC_PROG_MAKE_SET -m4trace:configure.in:9: -1- AC_SUBST([SET_MAKE]) -m4trace:configure.in:9: -1- AC_SUBST_TRACE([SET_MAKE]) -m4trace:configure.in:9: -1- m4_pattern_allow([^SET_MAKE$]) -m4trace:configure.in:10: -1- AC_HEADER_STDC -m4trace:configure.in:10: -1- AC_PROG_CPP -m4trace:configure.in:10: -1- AC_SUBST([CPP]) -m4trace:configure.in:10: -1- AC_SUBST_TRACE([CPP]) -m4trace:configure.in:10: -1- m4_pattern_allow([^CPP$]) -m4trace:configure.in:10: -1- AC_SUBST([CPPFLAGS]) -m4trace:configure.in:10: -1- AC_SUBST_TRACE([CPPFLAGS]) -m4trace:configure.in:10: -1- m4_pattern_allow([^CPPFLAGS$]) -m4trace:configure.in:10: -1- AC_SUBST([CPP]) -m4trace:configure.in:10: -1- AC_SUBST_TRACE([CPP]) -m4trace:configure.in:10: -1- m4_pattern_allow([^CPP$]) -m4trace:configure.in:10: -1- AC_SUBST([GREP]) -m4trace:configure.in:10: -1- AC_SUBST_TRACE([GREP]) -m4trace:configure.in:10: -1- m4_pattern_allow([^GREP$]) -m4trace:configure.in:10: -1- AC_SUBST([EGREP]) -m4trace:configure.in:10: -1- AC_SUBST_TRACE([EGREP]) -m4trace:configure.in:10: -1- m4_pattern_allow([^EGREP$]) -m4trace:configure.in:10: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) -m4trace:configure.in:10: -1- m4_pattern_allow([^STDC_HEADERS$]) -m4trace:configure.in:10: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ -@%:@undef STDC_HEADERS]) -m4trace:configure.in:23: -1- AC_DEFINE_TRACE_LITERAL([_LARGEFILE64_SOURCE]) -m4trace:configure.in:23: -1- m4_pattern_allow([^_LARGEFILE64_SOURCE$]) -m4trace:configure.in:24: -1- AC_DEFINE_TRACE_LITERAL([_FILE_OFFSET_BITS]) -m4trace:configure.in:24: -1- m4_pattern_allow([^_FILE_OFFSET_BITS$]) -m4trace:configure.in:31: -1- AC_CHECK_LIB([ssl], [SSL_library_init], [], []) -m4trace:configure.in:31: -1- AH_OUTPUT([HAVE_LIBSSL], [/* Define to 1 if you have the `ssl\' library (-lssl). */ -@%:@undef HAVE_LIBSSL]) -m4trace:configure.in:31: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBSSL]) -m4trace:configure.in:31: -1- m4_pattern_allow([^HAVE_LIBSSL$]) -m4trace:configure.in:34: -1- AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_init], [], []) -m4trace:configure.in:34: -1- AH_OUTPUT([HAVE_LIBCRYPTO], [/* Define to 1 if you have the `crypto\' library (-lcrypto). */ -@%:@undef HAVE_LIBCRYPTO]) -m4trace:configure.in:34: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBCRYPTO]) -m4trace:configure.in:34: -1- m4_pattern_allow([^HAVE_LIBCRYPTO$]) -m4trace:configure.in:37: -1- AC_CHECK_FUNCS([OpenSSL_add_all_algorithms EVP_bf_cbc EVP_rc2_cbc EVP_rc4 EVP_rc5_32_12_16_cbc EVP_des_cbc EVP_desx_cbc EVP_cast5_cbc EVP_idea_cbc EVP_aes_128_cbc EVP_aes_256_cbc]) -m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_OPENSSL_ADD_ALL_ALGORITHMS], [/* Define to 1 if you have the `OpenSSL_add_all_algorithms\' function. */ -@%:@undef HAVE_OPENSSL_ADD_ALL_ALGORITHMS]) -m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_BF_CBC], [/* Define to 1 if you have the `EVP_bf_cbc\' function. */ -@%:@undef HAVE_EVP_BF_CBC]) -m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_RC2_CBC], [/* Define to 1 if you have the `EVP_rc2_cbc\' function. */ -@%:@undef HAVE_EVP_RC2_CBC]) -m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_RC4], [/* Define to 1 if you have the `EVP_rc4\' function. */ -@%:@undef HAVE_EVP_RC4]) -m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_RC5_32_12_16_CBC], [/* Define to 1 if you have the `EVP_rc5_32_12_16_cbc\' function. */ -@%:@undef HAVE_EVP_RC5_32_12_16_CBC]) -m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_DES_CBC], [/* Define to 1 if you have the `EVP_des_cbc\' function. */ -@%:@undef HAVE_EVP_DES_CBC]) -m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_DESX_CBC], [/* Define to 1 if you have the `EVP_desx_cbc\' function. */ -@%:@undef HAVE_EVP_DESX_CBC]) -m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_CAST5_CBC], [/* Define to 1 if you have the `EVP_cast5_cbc\' function. */ -@%:@undef HAVE_EVP_CAST5_CBC]) -m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_IDEA_CBC], [/* Define to 1 if you have the `EVP_idea_cbc\' function. */ -@%:@undef HAVE_EVP_IDEA_CBC]) -m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_AES_128_CBC], [/* Define to 1 if you have the `EVP_aes_128_cbc\' function. */ -@%:@undef HAVE_EVP_AES_128_CBC]) -m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_AES_256_CBC], [/* Define to 1 if you have the `EVP_aes_256_cbc\' function. */ -@%:@undef HAVE_EVP_AES_256_CBC]) -m4trace:configure.in:40: -1- AC_DEFINE_TRACE_LITERAL([USE_OPENSSL_ADD_ALL_ALGORITHMS]) -m4trace:configure.in:40: -1- m4_pattern_allow([^USE_OPENSSL_ADD_ALL_ALGORITHMS$]) -m4trace:configure.in:40: -1- AH_OUTPUT([USE_OPENSSL_ADD_ALL_ALGORITHMS], [/* Use OpenSSL_add_all_algorithms */ -@%:@undef USE_OPENSSL_ADD_ALL_ALGORITHMS]) -m4trace:configure.in:62: -1- AC_CHECK_LIB([z], [deflate], [], []) -m4trace:configure.in:62: -1- AH_OUTPUT([HAVE_LIBZ], [/* Define to 1 if you have the `z\' library (-lz). */ -@%:@undef HAVE_LIBZ]) -m4trace:configure.in:62: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBZ]) -m4trace:configure.in:62: -1- m4_pattern_allow([^HAVE_LIBZ$]) -m4trace:configure.in:74: -2- AC_DEFINE_TRACE_LITERAL([HAVE_OSS]) -m4trace:configure.in:74: -2- m4_pattern_allow([^HAVE_OSS$]) -m4trace:configure.in:74: -1- AC_CHECK_HEADERS([sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h], [], [], [$ac_includes_default]) -m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the header file. */ -@%:@undef HAVE_SYS_TYPES_H]) -m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the header file. */ -@%:@undef HAVE_SYS_STAT_H]) -m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ -@%:@undef HAVE_STDLIB_H]) -m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ -@%:@undef HAVE_STRING_H]) -m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the header file. */ -@%:@undef HAVE_MEMORY_H]) -m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the header file. */ -@%:@undef HAVE_STRINGS_H]) -m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the header file. */ -@%:@undef HAVE_INTTYPES_H]) -m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the header file. */ -@%:@undef HAVE_STDINT_H]) -m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ -@%:@undef HAVE_UNISTD_H]) -m4trace:configure.in:82: -1- AC_CHECK_LIB([esd], [esd_open_sound], [], []) -m4trace:configure.in:82: -1- AH_OUTPUT([HAVE_LIBESD], [/* Define to 1 if you have the `esd\' library (-lesd). */ -@%:@undef HAVE_LIBESD]) -m4trace:configure.in:82: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBESD]) -m4trace:configure.in:82: -1- m4_pattern_allow([^HAVE_LIBESD$]) -m4trace:configure.in:88: -1- AC_CONFIG_FILES([Makefile]) -m4trace:configure.in:88: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments. -You should run autoupdate.], []) -m4trace:configure.in:88: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) -m4trace:configure.in:88: -1- m4_pattern_allow([^LIB@&t@OBJS$]) -m4trace:configure.in:88: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([LTLIBOBJS]) -m4trace:configure.in:88: -1- m4_pattern_allow([^LTLIBOBJS$]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([top_builddir]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([top_build_prefix]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([srcdir]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([abs_srcdir]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([top_srcdir]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([abs_top_srcdir]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([builddir]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([abs_builddir]) -m4trace:configure.in:88: -1- AC_SUBST_TRACE([abs_top_builddir]) diff --git a/libUseful-2.0/config.cache b/libUseful-2.0/config.cache deleted file mode 100644 index e53afc7..0000000 --- a/libUseful-2.0/config.cache +++ /dev/null @@ -1,38 +0,0 @@ -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -ac_cv_func_EVP_aes_128_cbc=${ac_cv_func_EVP_aes_128_cbc=yes} -ac_cv_func_EVP_aes_256_cbc=${ac_cv_func_EVP_aes_256_cbc=yes} -ac_cv_func_EVP_bf_cbc=${ac_cv_func_EVP_bf_cbc=yes} -ac_cv_func_EVP_cast5_cbc=${ac_cv_func_EVP_cast5_cbc=yes} -ac_cv_func_EVP_des_cbc=${ac_cv_func_EVP_des_cbc=yes} -ac_cv_func_EVP_desx_cbc=${ac_cv_func_EVP_desx_cbc=yes} -ac_cv_func_EVP_idea_cbc=${ac_cv_func_EVP_idea_cbc=yes} -ac_cv_func_EVP_rc2_cbc=${ac_cv_func_EVP_rc2_cbc=yes} -ac_cv_func_EVP_rc4=${ac_cv_func_EVP_rc4=yes} -ac_cv_func_EVP_rc5_32_12_16_cbc=${ac_cv_func_EVP_rc5_32_12_16_cbc=no} -ac_cv_func_OpenSSL_add_all_algorithms=${ac_cv_func_OpenSSL_add_all_algorithms=no} -ac_cv_func_SSL_library_init=${ac_cv_func_SSL_library_init=yes} -ac_cv_header_stdc=${ac_cv_header_stdc=yes} -ac_cv_header_sys_soundcard_h=${ac_cv_header_sys_soundcard_h=yes} -ac_cv_lib_crypto_EVP_CIPHER_CTX_init=${ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes} -ac_cv_lib_ssl_SSL_library_init=${ac_cv_lib_ssl_SSL_library_init=yes} -ac_cv_lib_z_deflate=${ac_cv_lib_z_deflate=yes} -ac_cv_prog_CC=${ac_cv_prog_CC=gcc} -ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'} -ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no} -ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes} -ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes} -ac_cv_prog_gcc=${ac_cv_prog_gcc=yes} -ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes} diff --git a/libUseful-2.0/config.log b/libUseful-2.0/config.log deleted file mode 100644 index 7816945..0000000 --- a/libUseful-2.0/config.log +++ /dev/null @@ -1,341 +0,0 @@ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by configure, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ ./configure --prefix=/usr/local --cache-file=/dev/null --srcdir=. - -## --------- ## -## Platform. ## -## --------- ## - -hostname = lifebook -uname -m = i686 -uname -r = 3.13.1-p4-smp -uname -s = Linux -uname -v = #1 SMP PREEMPT Wed Feb 5 00:08:02 UTC 2014 - -/usr/bin/uname -p = unknown -/bin/uname -X = unknown - -/bin/arch = unknown -/usr/bin/arch -k = unknown -/usr/convex/getsysinfo = unknown -/usr/bin/hostinfo = unknown -/bin/machine = unknown -/usr/bin/oslevel = unknown -/bin/universe = unknown - -PATH: /usr/prebin -PATH: /usr/local/bin -PATH: /usr/bin -PATH: /usr/X11R7/bin -PATH: /bin -PATH: /usr/games/bin -PATH: /opt/git-1.9.rc0/bin - - -## ----------- ## -## Core tests. ## -## ----------- ## - -configure:2144: checking for gcc -configure:2160: found /usr/bin/gcc -configure:2171: result: gcc -configure:2400: checking for C compiler version -configure:2409: gcc --version >&5 -gcc (GCC) 4.7.3 -Copyright (C) 2012 Free Software Foundation, Inc. -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -configure:2420: $? = 0 -configure:2409: gcc -v >&5 -Using built-in specs. -COLLECT_GCC=gcc -COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-pc-linux-gnu/4.7.3/lto-wrapper -Target: i486-pc-linux-gnu -Configured with: ../gcc-4.7.3-src/configure --prefix=/usr --sysconfdir=/etc --includedir=/usr/include --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,c++ --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i486-pc-linux-gnu --enable-bootstrap -Thread model: posix -gcc version 4.7.3 (GCC) -configure:2420: $? = 0 -configure:2409: gcc -V >&5 -gcc: error: unrecognized command line option '-V' -gcc: fatal error: no input files -compilation terminated. -configure:2420: $? = 1 -configure:2409: gcc -qversion >&5 -gcc: error: unrecognized command line option '-qversion' -gcc: fatal error: no input files -compilation terminated. -configure:2420: $? = 1 -configure:2440: checking whether the C compiler works -configure:2462: gcc conftest.c >&5 -configure:2466: $? = 0 -configure:2514: result: yes -configure:2517: checking for C compiler default output file name -configure:2519: result: a.out -configure:2525: checking for suffix of executables -configure:2532: gcc -o conftest conftest.c >&5 -configure:2536: $? = 0 -configure:2558: result: -configure:2580: checking whether we are cross compiling -configure:2588: gcc -o conftest conftest.c >&5 -configure:2592: $? = 0 -configure:2599: ./conftest -configure:2603: $? = 0 -configure:2618: result: no -configure:2623: checking for suffix of object files -configure:2645: gcc -c conftest.c >&5 -configure:2649: $? = 0 -configure:2670: result: o -configure:2674: checking whether we are using the GNU C compiler -configure:2693: gcc -c conftest.c >&5 -configure:2693: $? = 0 -configure:2702: result: yes -configure:2711: checking whether gcc accepts -g -configure:2731: gcc -c -g conftest.c >&5 -configure:2731: $? = 0 -configure:2772: result: yes -configure:2789: checking for gcc option to accept ISO C89 -configure:2852: gcc -c -g -O2 conftest.c >&5 -configure:2852: $? = 0 -configure:2865: result: none needed -configure:2891: checking whether make sets $(MAKE) -configure:2913: result: yes -configure:2928: checking how to run the C preprocessor -configure:2959: gcc -E conftest.c -configure:2959: $? = 0 -configure:2973: gcc -E conftest.c -conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory -compilation terminated. -configure:2973: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "" -| #define PACKAGE_TARNAME "" -| #define PACKAGE_VERSION "" -| #define PACKAGE_STRING "" -| #define PACKAGE_BUGREPORT "" -| #define PACKAGE_URL "" -| /* end confdefs.h. */ -| #include -configure:2998: result: gcc -E -configure:3018: gcc -E conftest.c -configure:3018: $? = 0 -configure:3032: gcc -E conftest.c -conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory -compilation terminated. -configure:3032: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "" -| #define PACKAGE_TARNAME "" -| #define PACKAGE_VERSION "" -| #define PACKAGE_STRING "" -| #define PACKAGE_BUGREPORT "" -| #define PACKAGE_URL "" -| /* end confdefs.h. */ -| #include -configure:3061: checking for grep that handles long lines and -e -configure:3119: result: /bin/grep -configure:3124: checking for egrep -configure:3186: result: /bin/grep -E -configure:3191: checking for ANSI C header files -configure:3211: gcc -c -g -O2 conftest.c >&5 -configure:3211: $? = 0 -configure:3284: gcc -o conftest -g -O2 conftest.c >&5 -configure:3284: $? = 0 -configure:3284: ./conftest -configure:3284: $? = 0 -configure:3295: result: yes -configure:3546: checking for sys/types.h -configure:3546: gcc -c -g -O2 conftest.c >&5 -configure:3546: $? = 0 -configure:3546: result: yes -configure:3546: checking for sys/stat.h -configure:3546: gcc -c -g -O2 conftest.c >&5 -configure:3546: $? = 0 -configure:3546: result: yes -configure:3546: checking for stdlib.h -configure:3546: gcc -c -g -O2 conftest.c >&5 -configure:3546: $? = 0 -configure:3546: result: yes -configure:3546: checking for string.h -configure:3546: gcc -c -g -O2 conftest.c >&5 -configure:3546: $? = 0 -configure:3546: result: yes -configure:3546: checking for memory.h -configure:3546: gcc -c -g -O2 conftest.c >&5 -configure:3546: $? = 0 -configure:3546: result: yes -configure:3546: checking for strings.h -configure:3546: gcc -c -g -O2 conftest.c >&5 -configure:3546: $? = 0 -configure:3546: result: yes -configure:3546: checking for inttypes.h -configure:3546: gcc -c -g -O2 conftest.c >&5 -configure:3546: $? = 0 -configure:3546: result: yes -configure:3546: checking for stdint.h -configure:3546: gcc -c -g -O2 conftest.c >&5 -configure:3546: $? = 0 -configure:3546: result: yes -configure:3546: checking for unistd.h -configure:3546: gcc -c -g -O2 conftest.c >&5 -configure:3546: $? = 0 -configure:3546: result: yes -configure:3558: checking sys/soundcard.h usability -configure:3558: gcc -c -g -O2 conftest.c >&5 -configure:3558: $? = 0 -configure:3558: result: yes -configure:3558: checking sys/soundcard.h presence -configure:3558: gcc -E conftest.c -configure:3558: $? = 0 -configure:3558: result: yes -configure:3558: checking for sys/soundcard.h -configure:3558: result: yes -configure:3775: creating ./config.status - -## ---------------------- ## -## Running config.status. ## -## ---------------------- ## - -This file was extended by config.status, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = - CONFIG_HEADERS = - CONFIG_LINKS = - CONFIG_COMMANDS = - $ ./config.status - -on lifebook - -config.status:725: creating Makefile - -## ---------------- ## -## Cache variables. ## -## ---------------- ## - -ac_cv_c_compiler_gnu=yes -ac_cv_env_CC_set= -ac_cv_env_CC_value= -ac_cv_env_CFLAGS_set= -ac_cv_env_CFLAGS_value= -ac_cv_env_CPPFLAGS_set= -ac_cv_env_CPPFLAGS_value= -ac_cv_env_CPP_set= -ac_cv_env_CPP_value= -ac_cv_env_LDFLAGS_set= -ac_cv_env_LDFLAGS_value= -ac_cv_env_LIBS_set= -ac_cv_env_LIBS_value= -ac_cv_env_build_alias_set= -ac_cv_env_build_alias_value= -ac_cv_env_host_alias_set= -ac_cv_env_host_alias_value= -ac_cv_env_target_alias_set= -ac_cv_env_target_alias_value= -ac_cv_header_inttypes_h=yes -ac_cv_header_memory_h=yes -ac_cv_header_stdc=yes -ac_cv_header_stdint_h=yes -ac_cv_header_stdlib_h=yes -ac_cv_header_string_h=yes -ac_cv_header_strings_h=yes -ac_cv_header_sys_soundcard_h=yes -ac_cv_header_sys_stat_h=yes -ac_cv_header_sys_types_h=yes -ac_cv_header_unistd_h=yes -ac_cv_objext=o -ac_cv_path_EGREP='/bin/grep -E' -ac_cv_path_GREP=/bin/grep -ac_cv_prog_CPP='gcc -E' -ac_cv_prog_ac_ct_CC=gcc -ac_cv_prog_cc_c89= -ac_cv_prog_cc_g=yes -ac_cv_prog_make_make_set=yes - -## ----------------- ## -## Output variables. ## -## ----------------- ## - -CC='gcc' -CFLAGS='-g -O2' -CPP='gcc -E' -CPPFLAGS='' -DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_OSS=1' -ECHO_C='' -ECHO_N='-n' -ECHO_T='' -EGREP='/bin/grep -E' -EXEEXT='' -GREP='/bin/grep' -LDFLAGS='' -LIBOBJS='' -LIBS='' -LTLIBOBJS='' -OBJEXT='o' -PACKAGE_BUGREPORT='' -PACKAGE_NAME='' -PACKAGE_STRING='' -PACKAGE_TARNAME='' -PACKAGE_URL='' -PACKAGE_VERSION='' -PATH_SEPARATOR=':' -SET_MAKE='' -SHELL='/bin/sh' -VERSION='0.0.1' -ac_ct_CC='gcc' -bindir='${exec_prefix}/bin' -build_alias='' -datadir='${datarootdir}' -datarootdir='${prefix}/share' -docdir='${datarootdir}/doc/${PACKAGE}' -dvidir='${docdir}' -exec_prefix='${prefix}' -host_alias='' -htmldir='${docdir}' -includedir='${prefix}/include' -infodir='${datarootdir}/info' -libdir='${exec_prefix}/lib' -libexecdir='${exec_prefix}/libexec' -localedir='${datarootdir}/locale' -localstatedir='${prefix}/var' -mandir='${datarootdir}/man' -oldincludedir='/usr/include' -pdfdir='${docdir}' -prefix='/usr/local' -program_transform_name='s,x,x,' -psdir='${docdir}' -sbindir='${exec_prefix}/sbin' -sharedstatedir='${prefix}/com' -sysconfdir='${prefix}/etc' -target_alias='' - -## ----------- ## -## confdefs.h. ## -## ----------- ## - -/* confdefs.h */ -#define PACKAGE_NAME "" -#define PACKAGE_TARNAME "" -#define PACKAGE_VERSION "" -#define PACKAGE_STRING "" -#define PACKAGE_BUGREPORT "" -#define PACKAGE_URL "" -#define STDC_HEADERS 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_UNISTD_H 1 -#define HAVE_OSS 1 - -configure: exit 0 diff --git a/libUseful-2.0/config.status b/libUseful-2.0/config.status deleted file mode 100755 index 64a1b96..0000000 --- a/libUseful-2.0/config.status +++ /dev/null @@ -1,892 +0,0 @@ -#! /bin/sh -# Generated by configure. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -# Files that config.status was made for. -config_files=" Makefile" - -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to the package provider." - -ac_cs_config="'--prefix=/usr/local' '--cache-file=/dev/null' '--srcdir=.'" -ac_cs_version="\ -config.status -configured by ./configure, generated by GNU Autoconf 2.69, - with options \"$ac_cs_config\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='/home/meta/movgrab-1.2.1/libUseful-2.0' -srcdir='.' -test -n "$AWK" || AWK=awk -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -if $ac_cs_recheck; then - set X /bin/sh './configure' '--prefix=/usr/local' '--cache-file=/dev/null' '--srcdir=.' $ac_configure_extra_args --no-create --no-recursion - shift - $as_echo "running CONFIG_SHELL=/bin/sh $*" >&6 - CONFIG_SHELL='/bin/sh' - export CONFIG_SHELL - exec "$@" -fi - -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -cat >>"$ac_tmp/subs1.awk" <<\_ACAWK && -S["LTLIBOBJS"]="" -S["LIBOBJS"]="" -S["EGREP"]="/bin/grep -E" -S["GREP"]="/bin/grep" -S["CPP"]="gcc -E" -S["SET_MAKE"]="" -S["OBJEXT"]="o" -S["EXEEXT"]="" -S["ac_ct_CC"]="gcc" -S["CPPFLAGS"]="" -S["LDFLAGS"]="" -S["CFLAGS"]="-g -O2" -S["CC"]="gcc" -S["VERSION"]="0.0.1" -S["target_alias"]="" -S["host_alias"]="" -S["build_alias"]="" -S["LIBS"]="" -S["ECHO_T"]="" -S["ECHO_N"]="-n" -S["ECHO_C"]="" -S["DEFS"]="-DPACKAGE_NAME=\\\"\\\" -DPACKAGE_TARNAME=\\\"\\\" -DPACKAGE_VERSION=\\\"\\\" -DPACKAGE_STRING=\\\"\\\" -DPACKAGE_BUGREPORT=\\\"\\\" -DPACKAGE_URL=\\\"\\\" -DSTDC_HEADERS=1"\ -" -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT"\ -"_H=1 -DHAVE_UNISTD_H=1 -DHAVE_OSS=1" -S["mandir"]="${datarootdir}/man" -S["localedir"]="${datarootdir}/locale" -S["libdir"]="${exec_prefix}/lib" -S["psdir"]="${docdir}" -S["pdfdir"]="${docdir}" -S["dvidir"]="${docdir}" -S["htmldir"]="${docdir}" -S["infodir"]="${datarootdir}/info" -S["docdir"]="${datarootdir}/doc/${PACKAGE}" -S["oldincludedir"]="/usr/include" -S["includedir"]="${prefix}/include" -S["localstatedir"]="${prefix}/var" -S["sharedstatedir"]="${prefix}/com" -S["sysconfdir"]="${prefix}/etc" -S["datadir"]="${datarootdir}" -S["datarootdir"]="${prefix}/share" -S["libexecdir"]="${exec_prefix}/libexec" -S["sbindir"]="${exec_prefix}/sbin" -S["bindir"]="${exec_prefix}/bin" -S["program_transform_name"]="s,x,x," -S["prefix"]="/usr/local" -S["exec_prefix"]="${prefix}" -S["PACKAGE_URL"]="" -S["PACKAGE_BUGREPORT"]="" -S["PACKAGE_STRING"]="" -S["PACKAGE_VERSION"]="" -S["PACKAGE_TARNAME"]="" -S["PACKAGE_NAME"]="" -S["PATH_SEPARATOR"]=":" -S["SHELL"]="/bin/sh" -_ACAWK -cat >>"$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} - ac_datarootdir_hack=' - s&@datadir@&${datarootdir}&g - s&@docdir@&${datarootdir}/doc/${PACKAGE}&g - s&@infodir@&${datarootdir}/info&g - s&@localedir@&${datarootdir}/locale&g - s&@mandir@&${datarootdir}/man&g - s&\${datarootdir}&${prefix}/share&g' ;; -esac -ac_sed_extra="/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -} - -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - - - - esac - -done # for ac_tag - - -as_fn_exit 0 diff --git a/libUseful-2.0/defines.h b/libUseful-2.0/defines.h deleted file mode 100644 index 88de467..0000000 --- a/libUseful-2.0/defines.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef LIBUSEFUL_DEFINES_H -#define LIBUSEFUL_DEFINES_H - -#define FALSE 0 -#define TRUE 1 - -#define FTIMEOUT -2 - - -#define SUBS_QUOTE_VARS 1 -#define SUBS_CASE_VARNAMES 2 -#define SUBS_STRIP_VARS_WHITESPACE 4 - -#define HEX_CHARS "0123456789ABCDEF" -#define ALPHA_CHARS "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef int (*BASIC_FUNC)(void *Data); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/libUseful-2.0/file.c b/libUseful-2.0/file.c deleted file mode 100644 index ee981b6..0000000 --- a/libUseful-2.0/file.c +++ /dev/null @@ -1,1112 +0,0 @@ -#include "includes.h" -#include "DataProcessing.h" -#include "pty.h" -#include "expect.h" - -#ifdef HAVE_LIBSSL -#include -#include -#include -#include -#include -#endif - - -int FDSelect(int fd, int Flags, struct timeval *tv) -{ -fd_set *readset=NULL, *writeset=NULL; -int result, RetVal=0; - - -if (Flags & SELECT_READ) -{ - readset=(fd_set *) calloc(1,sizeof(fd_set)); - FD_ZERO(readset); - FD_SET(fd, readset); -} - -if (Flags & SELECT_WRITE) -{ - writeset=(fd_set *) calloc(1,sizeof(fd_set)); - FD_ZERO(writeset); - FD_SET(fd, writeset); -} - - -result=select(fd+1,readset,writeset,NULL,tv); -if ((result==-1) && (errno==EBADF)) RetVal=0; -else if (result > 0) -{ - if (readset && FD_ISSET(fd, readset)) RetVal |= SELECT_READ; - if (writeset && FD_ISSET(fd, writeset)) RetVal |= SELECT_WRITE; -} - -if (readset) free(readset); -if (writeset) free(writeset); - -return(RetVal); -} - - -int FDIsWritable(int fd) -{ -struct timeval tv; - -tv.tv_sec=0; -tv.tv_usec=0; -if (FDSelect(fd, SELECT_WRITE, &tv) & SELECT_WRITE) return(TRUE); -return(FALSE); -} - - - -int FDCheckForBytes(int fd) -{ -struct timeval tv; - -tv.tv_sec=0; -tv.tv_usec=0; -if (FDSelect(fd, SELECT_READ, &tv) & SELECT_READ) return(TRUE); -return(FALSE); -} - - - -/*STREAM Functions */ - -/*Set non blocking IO on a stream*/ -void STREAMSetNonBlock(STREAM *S, int val) -{ -int flags=0; - - if (val) S->Flags |= SF_NONBLOCK; - else S->Flags &= (~SF_NONBLOCK); - - - fcntl(S->in_fd,F_GETFL,&flags); - if (val) flags |= O_NONBLOCK; - else flags &= (~O_NONBLOCK); - - fcntl(S->in_fd, F_SETFL, flags); -} - - -/*Set timeout for select calls within STREAM*/ -void STREAMSetTimeout(STREAM *S, int val) -{ -S->Timeout=val; -} - - -/*Set flush type for STREAM*/ -void STREAMSetFlushType(STREAM *S, int Type, int val) -{ -S->Flags &= ~(FLUSH_ALWAYS | FLUSH_LINE | FLUSH_BLOCK); -S->Flags |= Type; -S->BlockSize=val; -} - -/* This reads chunks from a file and when if finds a newline it resets */ -/* the file pointer to that position */ -void STREAMResizeBuffer(STREAM *Stream, int size) -{ - Stream->InputBuff=(char *) realloc(Stream->InputBuff,size); - Stream->OutputBuff=(char *) realloc(Stream->OutputBuff,size); - Stream->BuffSize=size; - if (Stream->InStart > Stream->BuffSize) Stream->InStart=0; - if (Stream->InEnd > Stream->BuffSize) Stream->InEnd=0; - if (Stream->OutEnd > Stream->BuffSize) Stream->OutEnd=0; -} - - - - -int STREAMCheckForBytes(STREAM *S) -{ - if (! S) return(0); - if (S->State & SS_EMBARGOED) return(0); - if (S->InEnd > S->InStart) return(1); - if (S->in_fd==-1) return(0); - return(FDCheckForBytes(S->in_fd)); -} - - - -int STREAMCountWaitingBytes(STREAM *S) -{ -int read_result=0, result; - - if (! S) return(0); - if (S->State & SS_EMBARGOED) return(0); - - result=FDCheckForBytes(S->in_fd); - if (result > 0) read_result=STREAMReadCharsToBuffer(S); - else if (result < 0) read_result=STREAM_CLOSED; - result=S->InEnd - S->InStart; - - if (result > 0) return(result); - if (read_result==STREAM_CLOSED) return(EOF); - if (read_result==STREAM_DATA_ERROR) return(EOF); - return(0); -} - -STREAM *STREAMSelect(ListNode *Streams, struct timeval *tv) -{ - fd_set SelectSet; - STREAM *S; - ListNode *Curr; - int highfd=0, result; - - FD_ZERO(&SelectSet); - - Curr=ListGetNext(Streams); - while (Curr) - { - S=(STREAM *) Curr->Item; - if (! (S->State & SS_EMBARGOED)) - { - //Pump any data in the stream - STREAMFlush(S); - if (S->InEnd > S->InStart) return(S); - FD_SET(S->in_fd,&SelectSet); - if (S->in_fd > highfd) highfd=S->in_fd; - } - - Curr=ListGetNext(Curr); - } - - result=select(highfd+1,&SelectSet,NULL,NULL,tv); - - if (result > 0) - { - Curr=ListGetNext(Streams); - while (Curr) - { - S=(STREAM *) Curr->Item; - if (FD_ISSET(S->in_fd,&SelectSet)) return(S); - Curr=ListGetNext(Curr); - } - } - - return(NULL); -} - - -int STREAMCheckForWaitingChar(STREAM *S,unsigned char check_char) -{ -int read_result=0, result, trash; -char *found_char; - -if (! S) return(0); -if (S->State & SS_EMBARGOED) return(0); - -result=FDCheckForBytes(S->in_fd); -if (result > 0) read_result=STREAMReadCharsToBuffer(S); -else if (result < 0) read_result=STREAM_CLOSED; - -if (S->InStart < S->InEnd) -{ - found_char=memchr(S->InputBuff + S->InStart,check_char,S->InEnd - S->InStart); - if (found_char > 0) return(TRUE); -} - -if (read_result==STREAM_CLOSED) return(EOF); -if (read_result==STREAM_DATA_ERROR) return(EOF); -return(FALSE); -} - - - -int STREAMInternalFinalWriteBytes(STREAM *S, const char *Data, int DataLen) -{ -fd_set selectset; -int result, count=0; -struct timeval tv; - -if (! S) return(STREAM_CLOSED); -if (S->out_fd==-1) return(STREAM_CLOSED); - - -while (count < DataLen) -{ -if (S->Flags & SF_SSL) -{ -#ifdef HAVE_LIBSSL - -result=SSL_write((SSL *) STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"), Data + count, DataLen - count); -#endif -} -else -{ - if (S->Timeout > 0) - { - FD_ZERO(&selectset); - FD_SET(S->out_fd, &selectset); - tv.tv_sec=S->Timeout; - tv.tv_usec=0; - result=select(S->out_fd+1,NULL,&selectset,NULL,&tv); - - if (result==-1) return(STREAM_CLOSED); - if ((result == 0) || (! FD_ISSET(S->out_fd, &selectset))) return(STREAM_TIMEOUT); - } - - if (S->Flags & SF_WRLOCK) flock(S->out_fd,LOCK_EX); - result=write(S->out_fd, Data + count, DataLen - count); - if (S->Flags & SF_WRLOCK) flock(S->out_fd,LOCK_UN); -} - - if (result < 1 && ((errno !=EINTR) && (errno !=EAGAIN)) ) break; - if (result < 0) result=0; - count+=result; - S->BytesWritten+=result; -} - - -//memmove any remaining data so that we add onto the end of it -S->OutEnd -= count; -if (S->OutEnd > 0) memmove(S->OutputBuff,S->OutputBuff+count, S->OutEnd); - - -return(count); -} - - - - -int STREAMFlush(STREAM *S) -{ - STREAMWriteBytes(S,NULL,0); -} - -void STREAMClear(STREAM *S) -{ - STREAMFlush(S); - S->InStart=0; -} - - -/*A stream can have a series of 'processor modules' associated with it' */ -/*which do things to the data before it is read/written. This function */ -/*pumps the data through the processor list, and eventually writes it out */ -int STREAMReadThroughProcessors(STREAM *S, char *Bytes, int InLen) -{ -TProcessingModule *Mod; -ListNode *Curr; -char *InBuff=NULL, *OutputBuff=NULL; -int len=0, olen=0, state=STREAM_CLOSED; - - -len=InLen; - -if (InLen > 0) -{ -InBuff=SetStrLen(InBuff,len+1); -memcpy(InBuff,Bytes ,len); -} - -Curr=ListGetNext(S->ProcessingModules); -while (Curr) -{ - Mod=(TProcessingModule *) Curr->Item; - if (len < BUFSIZ) olen=BUFSIZ; - else olen=len * 8; - - OutputBuff=SetStrLen(OutputBuff,olen); - - if (Mod->Read) - { - len=Mod->Read(Mod,InBuff,len,&OutputBuff,&olen,FALSE); - if (len != EOF) state=0; - - if (len > 0) - { - InBuff=SetStrLen(InBuff,len); - memcpy(InBuff,OutputBuff,len); - } - } - - Curr=ListGetNext(Curr); -} - -if ( - (! (S->State & SS_DATA_ERROR)) && - (len > 0) - ) -{ -//Whatever happened above, InBuff should now contain the data to be written! -//note that we resize buff to S->InEnd + len, where len is length of the new -//data. Even if S->InStart > 0 (meaning there are 'sent' bytes in the buffer) -//we consider S->InStart to be 0 as regards sizeing the buffer, because those -//sent bytes are still there. -S->InputBuff=SetStrLen(S->InputBuff,len + S->InEnd ); -memcpy(S->InputBuff + S->InEnd, InBuff, len); -S->InEnd+=len; -} - -DestroyString(OutputBuff); -DestroyString(InBuff); - -len=S->InEnd - S->InStart; - -if (len==0) -{ - if (state ==STREAM_CLOSED) return(STREAM_CLOSED); - if (S->State & SS_DATA_ERROR) return(STREAM_DATA_ERROR); -} -return(len); -} - - - - -int STREAMLock(STREAM *S, int val) -{ -int result; - -result=flock(S->in_fd,val); - -if (result==0) return(TRUE); -return(FALSE); -} - - -STREAM *STREAMCreate() -{ -STREAM *S; - -S=(STREAM *) calloc(1,sizeof(STREAM)); -STREAMResizeBuffer(S,4096); -S->in_fd=-1; -S->out_fd=-1; -S->Timeout=30; -S->Flags |= FLUSH_ALWAYS; - -return(S); -} - -STREAM *STREAMFromFD(int fd) -{ -STREAM *Stream; - -if (fd==-1) return(NULL); - -Stream=STREAMCreate(); -Stream->in_fd=fd; -Stream->out_fd=fd; -return(Stream); -} - -STREAM *STREAMFromDualFD(int in_fd, int out_fd) -{ -STREAM *Stream; - -if (in_fd==-1) return(NULL); -if (out_fd==-1) return(NULL); - -Stream=STREAMCreate(); -Stream->in_fd=in_fd; -Stream->out_fd=out_fd; -return(Stream); -} - - -STREAM *STREAMOpenFile(const char *FilePath, int Flags) -{ -int fd, Mode=FALSE; -STREAM *Stream; -struct stat myStat; - -Mode = Flags & ~(O_LOCK|O_TRUNC); - -if (strcmp(FilePath,"-")==0) -{ -Stream=STREAMFromDualFD(0,1); -Stream->Path=CopyStr(Stream->Path,FilePath); -return(Stream); -} - -fd=open(FilePath, Mode, 0600); -if (fd==-1) return(NULL); - -if (Flags & O_LOCK) -{ - if (flock(fd,LOCK_EX | LOCK_NB)==-1) - { - close(fd); - return(NULL); - } - -} - -// check for symlink naughtyness. Basically a malicious user can -// try to guess the name of the file we are going to open in order -// to get us to write somewhere other than intended. - - -if (lstat(FilePath, &myStat) !=0) -{ - close(fd); - return(NULL); -} - -if (S_ISLNK(myStat.st_mode)) -{ - syslog(LOG_USER | LOG_WARNING, "STREAMOpenFile Opened symlink when trying to open %s. Possible DOS attack?",FilePath); - close(fd); - return(NULL); -} - -if (Flags & O_TRUNC) ftruncate(fd,0); - -Stream=STREAMFromFD(fd); -Stream->Path=CopyStr(Stream->Path,FilePath); -STREAMSetTimeout(Stream,0); -STREAMSetFlushType(Stream,FLUSH_FULL,0); - -return(Stream); -} - - -STREAM *STREAMClose(STREAM *S) -{ -ListNode *Curr; -int len; - -if (! S) return(NULL); -len=S->OutEnd; - -STREAMReadThroughProcessors(S, NULL, 0); -STREAMFlush(S); - -if ( - (StrLen(S->Path)==0) || - (strcmp(S->Path,"-") !=0) - ) -{ -if ((S->out_fd != -1) && (S->out_fd != S->in_fd)) close(S->out_fd); -if (S->in_fd != -1) close(S->in_fd); -} - -Curr=ListGetNext(S->Values); -while (Curr) -{ -if (strncmp(Curr->Tag,"HelperPID",9)==0) kill(atoi(Curr->Item),SIGKILL); -Curr=ListGetNext(Curr); -} - - -ListDestroy(S->Values,(LIST_ITEM_DESTROY_FUNC)DestroyString); -ListDestroy(S->ProcessingModules,DataProcessorDestroy); -DestroyString(S->InputBuff); -DestroyString(S->OutputBuff); -DestroyString(S->Path); -free(S); - -return(NULL); -} - - -int STREAMDisassociateFromFD(STREAM *Stream) -{ -int fd; - -if (! Stream) return(-1); -fd=Stream->in_fd; -STREAMFlush(Stream); -DestroyString(Stream->InputBuff); -DestroyString(Stream->OutputBuff); -DestroyString(Stream->Path); -free(Stream); -return(fd); -} - - - - -int STREAMReadCharsToBuffer(STREAM *S) -{ -fd_set selectset; -int result=0, diff, read_result=0, WaitForBytes=TRUE; -struct timeval tv; -char *tmpBuff=NULL; -int v1, v2,v3; -void *SSL_CTX=NULL; - -if (! S) return(0); - -if (S->State & SS_EMBARGOED) return(0); - -SSL_CTX=STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"); - -if (S->InStart >= S->InEnd) -{ -S->InEnd=0; -S->InStart=0; -} -diff=S->InEnd-S->InStart; - -if (S->InStart > (S->BuffSize / 2)) -{ - memmove(S->InputBuff,S->InputBuff + S->InStart,diff); - S->InStart=0; - S->InEnd=diff; -} - -v1=S->InStart; v2=S->InEnd; v3=S->BuffSize; - -//if no room in buffer, we can't read in more bytes -if (S->InEnd >= S->BuffSize) return(1); - - -//if there are bytes available in the internal OpenSSL buffers, when we don't have to -//wait on a select, we can just go straight through to SSL_read -#ifdef HAVE_LIBSSL -if (S->Flags & SF_SSL) -{ -if (SSL_pending((SSL *) SSL_CTX) > 0) WaitForBytes=FALSE; -} -//else -#endif - - -//if ((S->Timeout > 0) && (! (S->Flags & SF_NONBLOCK)) && WaitForBytes) -if ((S->Timeout > 0) && WaitForBytes) -{ - FD_ZERO(&selectset); - FD_SET(S->in_fd, &selectset); - tv.tv_sec=S->Timeout; - tv.tv_usec=0; - result=select(S->in_fd+1,&selectset,NULL,NULL,&tv); - - - switch (result) - { - //we are only checking one FD, so should be 1 - case 1: - read_result=0; - break; - - case 0: - errno=ETIMEDOUT; - read_result=STREAM_TIMEOUT; - break; - - default: - if (errno==EINTR) read_result=STREAM_TIMEOUT; - else read_result=STREAM_CLOSED; - break; - - } - -} - -//must do this, as we need it to be 0 if we don't do the reads -result=0; - -if (read_result==0) -{ - tmpBuff=SetStrLen(tmpBuff,S->BuffSize-S->InEnd); - - #ifdef HAVE_LIBSSL - if (S->Flags & SF_SSL) - { - read_result=SSL_read((SSL *) SSL_CTX, tmpBuff, S->BuffSize-S->InEnd); - } - else - #endif - { - if (S->Flags & SF_RDLOCK) flock(S->in_fd,LOCK_SH); - read_result=read(S->in_fd, tmpBuff, S->BuffSize-S->InEnd); - if (S->Flags & SF_RDLOCK) flock(S->in_fd,LOCK_UN); - } - - if (read_result > 0) - { - result=read_result; - S->BytesRead+=read_result; - } - else - { - if ((read_result == -1) && (errno==EAGAIN)) read_result=STREAM_NODATA; - else read_result=STREAM_CLOSED; - result=0; - } -} - -if (result !=0) read_result=result; -if (result < 0) result=0; -read_result=STREAMReadThroughProcessors(S, tmpBuff, result); -//if (result==STREAM_DATA_ERROR) read_result=STREAM_DATA_ERROR; - -//We are not returning number of bytes read. We only return something if -//there is a condition (like socket close) where the thing we are waiting for -//may not appear - -DestroyString(tmpBuff); -return(read_result); -} - - - - - - -int STREAMReadBytes(STREAM *S, char *Buffer, int Buffsize) -{ -char *ptr=NULL; -int bytes=0, result=0, total=0; - -ptr=Buffer; - -if (S->InStart >= S->InEnd) -{ - result=STREAMReadCharsToBuffer(S); - if (S->InStart >= S->InEnd) - { - if (result==STREAM_CLOSED) return(EOF); - if (result==STREAM_TIMEOUT) return(STREAM_TIMEOUT); - if (result==STREAM_DATA_ERROR) return(STREAM_DATA_ERROR); - } -} - -while (total < Buffsize) -{ - - bytes=S->InEnd - S->InStart; - - - if (bytes > (Buffsize-total)) bytes=(Buffsize-total); - - memcpy(ptr+total,S->InputBuff+S->InStart,bytes); - S->InStart+=bytes; - total+=bytes; - - bytes=S->InEnd - S->InStart; - - - if (bytes < 1) - { - //in testing, the best way to prevent doing constant checking for new bytes, - //and so filling up the buffer, was to only check for new bytes if - //we didn't have enough to satisfy another read like the one we just had - - //We must check for '< 1' rather than '-1' because - result=FDCheckForBytes(S->in_fd); - - if (result ==-1) - { - if (total==0) total=EOF; - break; - } - if (result < 1) break; - - result=STREAMReadCharsToBuffer(S); - if (result < 1) - { - if (total > 0) return(total); - else return(result); - } - } - - -} -return(total); -} - - - -double STREAMTell(STREAM *S) -{ -double pos; - -if (S->OutEnd > 0) STREAMFlush(S); - -#ifdef _LARGEFILE64_SOURCE -pos=(double) lseek64(S->in_fd,0,SEEK_CUR); -#else -pos=(double) lseek(S->in_fd,0,SEEK_CUR); -#endif -pos-=(S->InEnd-S->InStart); - -return(pos); -} - - -double STREAMSeek(STREAM *S, double offset, int whence) -{ -double pos; -int wherefrom; - -if (S->OutEnd > 0) STREAMFlush(S); - -if (whence==SEEK_CUR) -{ - pos=STREAMTell(S); - pos+=offset; - wherefrom=SEEK_SET; -} -else -{ - pos=offset; - wherefrom=whence; -} -S->InStart=0; -S->InEnd=0; - -#ifdef _LARGEFILE64_SOURCE -pos=(double) lseek64(S->in_fd,(off64_t) pos, wherefrom); -#else -pos=(double) lseek(S->in_fd,(off_t) pos, wherefrom); -#endif - - -return(pos); -} - -/*A stream can have a series of 'processor modules' associated with it' */ -/*which do things to the data before it is read/written. This function */ -/*pumps the data through the processor list, and eventually writes it out */ -int STREAMWriteBytes(STREAM *S,const char *Data, int DataLen) -{ -TProcessingModule *Mod; -ListNode *Curr; -const char *i_data; -char *TempBuff=NULL, *ptr; -int TempLen=BUFSIZ; -int len, i_len, o_len, written=0, result=0; -int AllDataWritten=FALSE, Flush=FALSE; - - -if (! S) return(STREAM_CLOSED); -if (S->out_fd==-1) return(STREAM_CLOSED); -if (S->State & SS_WRITE_ERROR) return(STREAM_CLOSED); - -if (DataLen==0) Flush=TRUE; - -i_data=Data; -i_len=DataLen; - -//if there are no processing modules, then this will be untouched, and will be our output -if (DataLen > TempLen) TempLen=DataLen; -TempBuff=SetStrLen(TempBuff,TempLen); -if (DataLen > 0) memcpy(TempBuff,Data,DataLen); -o_len=DataLen; - - -while (! AllDataWritten) -{ - AllDataWritten=TRUE; - - //Go through processing modules feeding the data from the previous one into them - Curr=ListGetNext(S->ProcessingModules); - while (Curr) - { - Mod=(TProcessingModule *) Curr->Item; - - - if (Mod->Write && ((i_len > 0) || Flush)) - { - o_len=Mod->Write(Mod,i_data,i_len,&TempBuff,&TempLen,Flush); - if (Flush && (o_len !=EOF)) AllDataWritten=FALSE; - } - i_data=TempBuff; - i_len=o_len; - - Curr=ListGetNext(Curr); - } - - - //Whatever happened above, o_data/o_len should hold data to be written - ptr=TempBuff; - - while (o_len > 0) - { - len=S->BuffSize - S->OutEnd; - if (len > o_len) len =o_len; - - memcpy(S->OutputBuff+S->OutEnd,ptr,len); - ptr+=len; - o_len-=len; - S->OutEnd+=len; - - //Buffer Full, Write some bytes!!! - if ((S->OutEnd >= S->BuffSize) || (S->BlockSize && (S->OutEnd > S->BlockSize))) - { - if (S->BlockSize) len=(S->OutEnd / S->BlockSize) * S->BlockSize; - else len=S->OutEnd; - - if (len > 0) result=STREAMInternalFinalWriteBytes(S, S->OutputBuff, len); - if (result==0) written=STREAM_TIMEOUT; - if (result < 1) - { - S->State |= SS_WRITE_ERROR; - written=STREAM_CLOSED; - break; - } - - written+=result; - } - } - - //Must do this to avoid sending data into the queue multiple times! - i_len=0; - -} - - -//We always claim to have written the data that we've accepted -//Though this can be overridden below -written=DataLen; - - - -//if we are told to write zero bytes, that's a flush -if ((S->OutEnd > 0) && ((DataLen==0) || (S->Flags & FLUSH_ALWAYS))) -{ - //if we are flushing blocks, then pad out to the blocksize - if (S->Flags & FLUSH_BLOCK) - { - len=(S->OutEnd / S->BlockSize) * S->BlockSize; - if (S->OutEnd > len) len+=S->BlockSize; - memset(S->OutputBuff+S->OutEnd,0,len - S->OutEnd); - S->OutEnd=len; - } - - result=STREAMInternalFinalWriteBytes(S, S->OutputBuff, S->OutEnd); - if (result < 0) written=result; -} - - -DestroyString(TempBuff); - - -return(written); -} - - - - -int STREAMWriteString(const char *Buffer, STREAM *S) -{ -int result; - -if (StrLen(Buffer) < 1) return(FALSE); -result=STREAMWriteBytes(S,Buffer,strlen(Buffer)); -return(result); -} - -int STREAMWriteLine(const char *Buffer, STREAM *S) -{ -int result; - -if (StrLen(Buffer) < 1) return(FALSE); -result=STREAMWriteBytes(S,Buffer,strlen(Buffer)); -if (result < 0) return(result); -if (S->Flags & FLUSH_LINE) result=STREAMFlush(S); -return(result); -} - - -int STREAMReadChar(STREAM *S) -{ -unsigned char inchar; -int result; - -result=STREAMReadBytes(S, &inchar,1); -if (result < 0) return(result); -if (result==0) return(STREAM_NODATA); -return((int) inchar); -} - - - -int STREAMPeekChar(STREAM *S) -{ -int result; - -if (S->InStart >= S->InEnd) -{ - result=STREAMReadCharsToBuffer(S); - if (result < 1) return(result); -} - -return(* (S->InputBuff + S->InStart)); -} - - -int STREAMWriteChar(STREAM *S,unsigned char inchar) -{ -char tmpchar; - -tmpchar=inchar; -return(STREAMWriteBytes(S,&tmpchar,1)); -} - - - -int STREAMReadBytesToTerm(STREAM *S, char *Buffer, int BuffSize,unsigned char Term) -{ -int inchar, pos=0; - -inchar=STREAMReadChar(S); -while (inchar != EOF) -{ -if (inchar > -1) -{ -Buffer[pos]=inchar; -pos++; -if (inchar==Term) break; -if (pos==BuffSize) break; -} -inchar=STREAMReadChar(S); -} - -if ((pos==0) && (inchar==EOF)) return(EOF); -return(pos); -} - - -char *STREAMReadToTerminator(char *Buffer, STREAM *S,unsigned char Term) -{ -int inchar, len=0; -char *Tempptr; - -Tempptr=CopyStr(Buffer,""); - -inchar=STREAMReadChar(S); -while (inchar != EOF) -{ - //if ((len % 100)== 0) Tempptr=realloc(Tempptr,(len/100 +1) *100 +2); - //*(Tempptr+len)=inchar; - - if (inchar >= 0) - { - Tempptr=AddCharToBuffer(Tempptr,len,(char) inchar); - len++; - } - else if (inchar !=STREAM_NODATA) break; - if (inchar==Term) break; - inchar=STREAMReadChar(S); -} - - -*(Tempptr+len)='\0'; -//if ((inchar==EOF) && (errno==ECONNREFUSED)) return(Tempptr); -if ( - ((inchar==EOF) || (inchar==STREAM_DATA_ERROR)) - && - (StrLen(Tempptr)==0) - ) -{ - free(Tempptr); - return(NULL); -} - -return(Tempptr); -} - - - -char *STREAMReadToMultiTerminator(char *Buffer, STREAM *S, char *Terms) -{ -int inchar, len=0; -char *Tempptr; - -Tempptr=CopyStr(Buffer,""); - -inchar=STREAMReadChar(S); - - -//All error conditions are negative, but '0' can just mean -//no more data to read -while (inchar > -1) -{ - //if ((len % 100)== 0) Tempptr=realloc(Tempptr,(len/100 +1) *100 +2); - //*(Tempptr+len)=inchar; - - if (inchar > 0) - { - Tempptr=AddCharToBuffer(Tempptr,len,(char) inchar); - len++; - - if (strchr(Terms,inchar)) break; - } - inchar=STREAMReadChar(S); -} - - -*(Tempptr+len)='\0'; - -//if ((inchar==EOF) && (errno==ECONNREFUSED)) return(Tempptr); -if ( - ((inchar==EOF) || (inchar==STREAM_DATA_ERROR)) - && - (StrLen(Tempptr)==0) - ) -{ - free(Tempptr); - return(NULL); -} - -return(Tempptr); -} - - - - -char *STREAMReadLine(char *Buffer, STREAM *S) -{ -return(STREAMReadToTerminator(Buffer,S,'\n')); -} - - -void STREAMResetInputBuffers(STREAM *S) -{ -double pos; - -pos=STREAMTell(S); -S->InStart=0; -S->InEnd=0; -STREAMSeek(S,pos,SEEK_SET); -} - - - -char *STREAMGetValue(STREAM *S, const char *Name) -{ -ListNode *Curr; - -if (! S->Values) return(NULL); -Curr=ListFindNamedItem(S->Values,Name); -if (Curr) return(Curr->Item); -return(NULL); -} - - -void STREAMSetValue(STREAM *S, const char *Name, const char *Value) -{ - -if (! S->Values) S->Values=ListCreate(); -SetVar(S->Values,Name,Value); -} - -void *STREAMGetItem(STREAM *S, const char *Name) -{ -ListNode *Curr; - -if (! S->Items) return(NULL); -Curr=ListFindNamedItem(S->Items,Name); -if (Curr) return(Curr->Item); -return(NULL); -} - - -void STREAMSetItem(STREAM *S, const char *Name, void *Value) -{ -ListNode *Curr; - -if (! S->Items) S->Items=ListCreate(); -Curr=ListFindNamedItem(S->Items,Name); -if (Curr) Curr->Item=Value; -else ListAddNamedItem(S->Items,Name,Value); -} diff --git a/libUseful-2.0/formattest.c b/libUseful-2.0/formattest.c deleted file mode 100644 index 0315c0a..0000000 --- a/libUseful-2.0/formattest.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "libUseful.h" - -main() -{ -char *Tempstr=NULL; - -Tempstr=FormatStr(Tempstr,"%s %n","test",100); -printf("%s\n",Tempstr); - -} diff --git a/libUseful-2.0/httptest.c b/libUseful-2.0/httptest.c deleted file mode 100644 index 580cee9..0000000 --- a/libUseful-2.0/httptest.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "libUseful.h" - -main() -{ -STREAM *S; - -/* -S=STREAMCreate(); -if (STREAMConnectToHost(S,"icanhazip.com",80,0)) -{ -printf("Connected!\n"); -} -else printf("No connection\n"); -*/ - -HTTPSetFlags(HTTP_DEBUG); -printf("IP: %s\n",GetExternalIP(NULL)); -} diff --git a/libUseful-2.0/libsettings.c b/libUseful-2.0/libsettings.c deleted file mode 100644 index c1f1abd..0000000 --- a/libUseful-2.0/libsettings.c +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef LIBUSEFUL_SETTINGS - -#include "defines.h" -#include "includes.h" -#include "Vars.h" - -/* These functions provide an interface for setting variables that */ -/* are used by libUseful itself */ - -ListNode *LibUsefulSettings=NULL; - -ListNode *LibUsefulValuesGetHead() -{ -return(LibUsefulSettings); -} - -void LibUsefulSetValue(char *Name, char *Value) -{ - if (! LibUsefulSettings) LibUsefulSettings=ListCreate(); - SetVar(LibUsefulSettings,Name,Value); -} - -char *LibUsefulGetValue(char *Name) -{ -return(GetVar(LibUsefulSettings,Name)); -} - -#endif diff --git a/libUseful-2.0/md5.h b/libUseful-2.0/md5.h deleted file mode 100644 index a94c698..0000000 --- a/libUseful-2.0/md5.h +++ /dev/null @@ -1,49 +0,0 @@ -/* MD5.H - header file for MD5C.C - */ - -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -rights reserved. - -License to copy and use this software is granted provided that it -is identified as the "RSA Data Security, Inc. MD5 Message-Digest -Algorithm" in all material mentioning or referencing this software -or this function. - -License is also granted to make and use derivative works provided -that such works are identified as "derived from the RSA Data -Security, Inc. MD5 Message-Digest Algorithm" in all material -mentioning or referencing the derived work. - -RSA Data Security, Inc. makes no representations concerning either -the merchantability of this software or the suitability of this -software for any particular purpose. It is provided "as is" -without express or implied warranty of any kind. - -These notices must be retained in any copies of any part of this -documentation and/or software. - */ - -#include "md5-global.h" - -/* MD5 context. */ -typedef struct { - UINT4 state[4]; /* state (ABCD) */ - UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ - unsigned char buffer[64]; /* input buffer */ -} MD5_CTX; - - -#ifdef __cplusplus -extern "C" { -#endif - -void MD5Init PROTO_LIST ((MD5_CTX *)); -void MD5Update PROTO_LIST - ((MD5_CTX *, unsigned char *, unsigned int)); -void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); - -#ifdef __cplusplus -} -#endif - - diff --git a/libUseful-2.0/md5c.c b/libUseful-2.0/md5c.c deleted file mode 100644 index b01289e..0000000 --- a/libUseful-2.0/md5c.c +++ /dev/null @@ -1,339 +0,0 @@ - -/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm - */ - -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -rights reserved. - -License to copy and use this software is granted provided that it -is identified as the "RSA Data Security, Inc. MD5 Message-Digest -Algorithm" in all material mentioning or referencing this software -or this function. - -License is also granted to make and use derivative works provided -that such works are identified as "derived from the RSA Data -Security, Inc. MD5 Message-Digest Algorithm" in all material -mentioning or referencing the derived work. - -RSA Data Security, Inc. makes no representations concerning either -the merchantability of this software or the suitability of this -software for any particular purpose. It is provided "as is" -without express or implied warranty of any kind. - -These notices must be retained in any copies of any part of this -documentation and/or software. - */ - -#include "md5.h" - -/* Constants for MD5Transform routine. - */ - -#define S11 7 -#define S12 12 -#define S13 17 -#define S14 22 -#define S21 5 -#define S22 9 -#define S23 14 -#define S24 20 -#define S31 4 -#define S32 11 -#define S33 16 -#define S34 23 -#define S41 6 -#define S42 10 -#define S43 15 -#define S44 21 - -static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64])); -static void Encode PROTO_LIST - ((unsigned char *, UINT4 *, unsigned int)); -static void Decode PROTO_LIST - ((UINT4 *, unsigned char *, unsigned int)); -static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int)); -static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int)); - -static unsigned char PADDING[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* F, G, H and I are basic MD5 functions. - */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -/* ROTATE_LEFT rotates x left n bits. - */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) - -/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. -Rotation is separate from addition to prevent recomputation. - */ -#define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } - -/* MD5 initialization. Begins an MD5 operation, writing a new context. - */ -void MD5Init (MD5_CTX *context) -{ - context->count[0] = context->count[1] = 0; - /* Load magic initialization constants. -*/ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; -} - -/* MD5 block update operation. Continues an MD5 message-digest - operation, processing another message block, and updating the - context. - */ -void MD5Update (context, input, inputLen) -MD5_CTX *context; /* context */ -unsigned char *input; /* input block */ -unsigned int inputLen; /* length of input block */ -{ - unsigned int i, index, partLen; - - /* Compute number of bytes mod 64 */ - index = (unsigned int)((context->count[0] >> 3) & 0x3F); - - /* Update number of bits */ - if ((context->count[0] += ((UINT4)inputLen << 3)) - - < ((UINT4)inputLen << 3)) - context->count[1]++; - context->count[1] += ((UINT4)inputLen >> 29); - - partLen = 64 - index; - - /* Transform as many times as possible. -*/ - if (inputLen >= partLen) { - MD5_memcpy - ((POINTER)&context->buffer[index], (POINTER)input, partLen); - MD5Transform (context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) - MD5Transform (context->state, &input[i]); - - index = 0; - } - else - i = 0; - - /* Buffer remaining input */ - MD5_memcpy - ((POINTER)&context->buffer[index], (POINTER)&input[i], - inputLen-i); -} - -/* MD5 finalization. Ends an MD5 message-digest operation, writing the - the message digest and zeroizing the context. - */ -void MD5Final (digest, context) -unsigned char digest[16]; /* message digest */ -MD5_CTX *context; /* context */ -{ - unsigned char bits[8]; - unsigned int index, padLen; - - /* Save number of bits */ - Encode (bits, context->count, 8); - - /* Pad out to 56 mod 64. -*/ - index = (unsigned int)((context->count[0] >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - MD5Update (context, PADDING, padLen); - - /* Append length (before padding) */ - MD5Update (context, bits, 8); - - /* Store state in digest */ - Encode (digest, context->state, 16); - - /* Zeroize sensitive information. -*/ - MD5_memset ((POINTER)context, 0, sizeof (*context)); -} - -/* MD5 basic transformation. Transforms state based on block. - */ -static void MD5Transform (state, block) -UINT4 state[4]; -unsigned char block[64]; -{ - UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - Decode (x, block, 64); - - /* Round 1 */ - FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ - FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ - FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ - FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ - FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ - FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ - FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ - FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ - FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ - FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ - FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ - FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ - FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ - FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ - FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ - FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ - - /* Round 2 */ - GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ - GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ - GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ - GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ - GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ - GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ - GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ - GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ - GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ - GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ - GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ - - GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ - GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ - GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ - GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ - GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ - - /* Round 3 */ - HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ - HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ - HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ - HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ - HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ - HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ - HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ - HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ - HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ - HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ - HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ - HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ - HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ - HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ - HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ - HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ - - /* Round 4 */ - II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ - II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ - II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ - II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ - II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ - II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ - II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ - II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ - II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ - II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ - II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ - II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ - II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ - II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ - II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ - II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - /* Zeroize sensitive information. - -*/ - MD5_memset ((POINTER)x, 0, sizeof (x)); -} - -/* Encodes input (UINT4) into output (unsigned char). Assumes len is - a multiple of 4. - */ -static void Encode (output, input, len) -unsigned char *output; -UINT4 *input; -unsigned int len; -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (unsigned char)(input[i] & 0xff); - output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); - output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); - output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); - } -} - -/* Decodes input (unsigned char) into output (UINT4). Assumes len is - a multiple of 4. - */ -static void Decode (output, input, len) -UINT4 *output; -unsigned char *input; -unsigned int len; -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | - (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); -} - -/* Note: Replace "for loop" with standard memcpy if possible. - */ - -static void MD5_memcpy (output, input, len) -POINTER output; -POINTER input; -unsigned int len; -{ - unsigned int i; - - for (i = 0; i < len; i++) - - output[i] = input[i]; -} - -/* Note: Replace "for loop" with standard memset if possible. - */ -static void MD5_memset (output, value, len) -POINTER output; -int value; -unsigned int len; -{ - unsigned int i; - - for (i = 0; i < len; i++) - ((char *)output)[i] = (char)value; -} - diff --git a/libUseful-2.0/socket.c b/libUseful-2.0/socket.c deleted file mode 100644 index f2c6090..0000000 --- a/libUseful-2.0/socket.c +++ /dev/null @@ -1,867 +0,0 @@ -#include "includes.h" - -#include - -#ifdef HAVE_LIBSSL -#include -#include -#include -#include -#include - -#endif - -#include "ConnectionChain.h" - - -int IsSockConnected(int sock) -{ -struct sockaddr_in sa; -int salen, result; - -if (sock==-1) return(FALSE); -salen=sizeof(sa); -result=getpeername(sock,(struct sockaddr *) &sa, &salen); -if (result==0) return(TRUE); -if (errno==ENOTCONN) return(SOCK_CONNECTING); -return(FALSE); -} - - -int InitServerSock(char *Address, int Port) -{ -int sock; -struct sockaddr_in sa; -int salen; -int result; - -sock=socket(AF_INET,SOCK_STREAM,0); -if (sock <0) return(-1); - -result=1; -salen=sizeof(result); -setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&result,salen); - -sa.sin_port=htons(Port); -sa.sin_family=AF_INET; -if (StrLen(Address) > 0) sa.sin_addr.s_addr=StrtoIP(Address); -else sa.sin_addr.s_addr=INADDR_ANY; - -salen=sizeof(struct sockaddr_in); -result=bind(sock,(struct sockaddr *) &sa, salen); - -if (result==0) -{ - result=listen(sock,10); -} - -if (result==0) return(sock); -else -{ -close(sock); -return(-1); -} -} - - - -int InitUnixServerSock(char *Path) -{ -int sock; -struct sockaddr_un sa; -int salen; -int result; - -sock=socket(AF_UNIX,SOCK_STREAM,0); -if (sock <0) return(-1); -result=1; -salen=sizeof(result); -strcpy(sa.sun_path,Path); -sa.sun_family=AF_UNIX; -salen=sizeof(struct sockaddr_un); -result=bind(sock,(struct sockaddr *) &sa, salen); - -if (result==0) -{ - result=listen(sock,10); -} - -if (result==0) return(sock); -else -{ -close(sock); -return(-1); -} -} - - -int TCPServerSockAccept(int ServerSock, int *Addr) -{ -struct sockaddr_in sa; -int salen; -int sock; - -salen=sizeof(sa); -sock=accept(ServerSock,(struct sockaddr *) &sa,&salen); -if (Addr) *Addr=sa.sin_addr.s_addr; -return(sock); -} - -int UnixServerSockAccept(int ServerSock) -{ -struct sockaddr_un sa; -int salen; -int sock; - -salen=sizeof(sa); -sock=accept(ServerSock,(struct sockaddr *) &sa,&salen); -return(sock); -} - - - - - -int IsAddress(char *Str) -{ -int len,count; -len=StrLen(Str); -if (len <1) return(FALSE); -for (count=0; count < len; count++) -{ - if ((! isdigit(Str[count])) && (Str[count] !='.')) - { - return(FALSE); - } -} - -return(TRUE); -} - - -int GetSockDetails(int sock, char **LocalAddress, int *LocalPort, char **RemoteAddress, int *RemotePort) -{ -int salen, result; -struct sockaddr_in sa; - -*LocalPort=0; -*RemotePort=0; -*LocalAddress=CopyStr(*LocalAddress,""); -*RemoteAddress=CopyStr(*RemoteAddress,""); - -salen=sizeof(struct sockaddr_in); -result=getsockname(sock, (struct sockaddr *) &sa, &salen); - -if (result==0) -{ - *LocalAddress=CopyStr(*LocalAddress,IPtoStr(sa.sin_addr.s_addr)); - *LocalPort=ntohs(sa.sin_port); - - //Set Address to be the same as control sock, as it might not be INADDR_ANY - result=getpeername(sock, (struct sockaddr *) &sa, &salen); - - if (result==0) - { - *RemoteAddress=CopyStr(*RemoteAddress,IPtoStr(sa.sin_addr.s_addr)); - *RemotePort=sa.sin_port; - } - - //We've got the local sock, so lets still call it a success - result=0; -} - -if (result==0) return(TRUE); -return(FALSE); -} - - - - - - -/* Users will probably only use this function if they want to reconnect */ -/* a broken connection, or reuse a socket for multiple connections, hence */ -/* the name... */ -int ReconnectSock(int sock, char *Host, int Port, int Flags) -{ -int salen, result; -struct sockaddr_in sa; -struct hostent *hostdata; - -sa.sin_family=AF_INET; -sa.sin_port=htons(Port); - -if (IsAddress(Host)) -{ -inet_aton(Host, (struct in_addr *) &sa.sin_addr); -} -else -{ - hostdata=gethostbyname(Host); - if (!hostdata) - { - return(-1); - } -sa.sin_addr=*(struct in_addr *) *hostdata->h_addr_list; -} - -salen=sizeof(sa); -if (Flags & CONNECT_NONBLOCK) -{ -fcntl(sock,F_SETFL,O_NONBLOCK); -} - -result=connect(sock,(struct sockaddr *)&sa, salen); -if (result==0) result=TRUE; - -if ((result==-1) && (Flags & CONNECT_NONBLOCK) && (errno == EINPROGRESS)) result=FALSE; -return(result); -} - - -int ConnectToHost(char *Host, int Port,int Flags) -{ -int sock, result; - -sock=socket(AF_INET,SOCK_STREAM,0); -if (sock <0) return(-1); -result=ReconnectSock(sock,Host,Port,Flags); -if (result==-1) -{ -close(sock); -return(-1); -} - -return(sock); - -} - - - - -int CheckForTerm(DownloadContext *CTX, char inchar) -{ - - if (inchar == CTX->TermStr[CTX->TermPos]) - { - CTX->TermPos++; - if (CTX->TermPos >=strlen(CTX->TermStr)) - { - CTX->TermPos=0; - return(TRUE); - } - } - else - { - if (CTX->TermPos >0) - { - STREAMWriteBytes(CTX->Output, CTX->TermStr,CTX->TermPos); - CTX->TermPos=0; - return(CheckForTerm(CTX,inchar)); - } - } -return(FALSE); -} - - - -int ProcessIncommingBytes(DownloadContext *CTX) -{ -int inchar, FoundTerm=FALSE, err; - - inchar=STREAMReadChar(CTX->Input); - - if (inchar==EOF) return(TRUE); - - FoundTerm=CheckForTerm(CTX,(char) inchar); - while ((inchar !=EOF) && (! FoundTerm)) - { - if (CTX->TermPos==0) STREAMWriteChar(CTX->Output, (char) inchar); - inchar=STREAMReadChar(CTX->Input); - err=errno; - FoundTerm=CheckForTerm(CTX, (char) inchar); - } -if (inchar==EOF) return(TRUE); -if (FoundTerm) return(TRUE); -return(FALSE); -} - - -int DownloadToTermStr2(STREAM *Connection, STREAM *SaveFile, char *TermStr) -{ -DownloadContext CTX; - -CTX.TermStr=CopyStr(NULL,TermStr); -CTX.Input=Connection; -CTX.Output=SaveFile; -CTX.TermPos=0; - -while(ProcessIncommingBytes(&CTX) !=TRUE); - -DestroyString(CTX.TermStr); -return(TRUE); -} - -int DownloadToDot(STREAM *Connection, STREAM *SaveFile) -{ -DownloadToTermStr2(Connection,SaveFile,"\r\n.\r\n"); -} - - -int DownloadToTermStr(STREAM *Connection, STREAM *SaveFile, char *TermStr) -{ -char *Tempstr=NULL; - -Tempstr=STREAMReadLine(Tempstr,Connection); -while (Tempstr) -{ - if (strcmp(Tempstr,TermStr)==0) -{ - break; -} - STREAMWriteLine(Tempstr,SaveFile); - Tempstr=STREAMReadLine(Tempstr,Connection); -} -return(TRUE); -} - -char *LookupHostIP(char *Host) -{ -struct hostent *hostdata; - - hostdata=gethostbyname(Host); - if (!hostdata) - { - return(NULL); - } - -//inet_ntoa shouldn't need this cast to 'char *', but it emitts a warning -//without it -return((char *) inet_ntoa(*(struct in_addr *) *hostdata->h_addr_list)); -} - - -char *GetRemoteIP(int sock) -{ -struct sockaddr_in sa; -int salen, result; - -salen=sizeof(struct sockaddr_in); -result=getpeername(sock,(struct sockaddr *) &sa, &salen); -if (result==-1) -{ -if (errno==ENOTSOCK) return("127.0.0.1"); -else return("0.0.0.0"); -} - -return((char *) inet_ntoa(sa.sin_addr)); -} - - -char *IPStrToHostName(char *IPAddr) -{ -struct sockaddr_in sa; -struct hostent *hostdata=NULL; - -inet_aton(IPAddr,& sa.sin_addr); -hostdata=gethostbyaddr(&sa.sin_addr.s_addr,sizeof((sa.sin_addr.s_addr)),AF_INET); -if (hostdata) return(hostdata->h_name); -else return(""); -} - - - - -char *IPtoStr(unsigned long Address) -{ -struct sockaddr_in sa; -sa.sin_addr.s_addr=Address; -return((char *) inet_ntoa(sa.sin_addr)); - -} - -unsigned long StrtoIP(char *Str) -{ -struct sockaddr_in sa; -if (inet_aton(Str,&sa.sin_addr)) return(sa.sin_addr.s_addr); -return(0); -} - - -int STREAMIsConnected(STREAM *S) -{ -int result=FALSE; - -if (! S) return(FALSE); -result=IsSockConnected(S->in_fd); -if (result==TRUE) -{ - if (S->State & SS_CONNECTING) - { - S->State |= SS_CONNECTED; - S->State &= (~SS_CONNECTING); - } -} -if ((result==SOCK_CONNECTING) && (! (S->State & SS_CONNECTING))) result=FALSE; -return(result); -} - - - -int STREAMDoPostConnect(STREAM *S, int Flags) -{ -int result=FALSE; -char *ptr; -struct timeval tv; - -if (! S) return(FALSE); -if ((S->in_fd > -1) && (S->Timeout > 0) ) -{ - tv.tv_sec=S->Timeout; - tv.tv_usec=0; - if (FDSelect(S->in_fd, SELECT_WRITE, &tv) != SELECT_WRITE) - { - close(S->in_fd); - S->in_fd=-1; - S->out_fd=-1; - } - else if (! (Flags & CONNECT_NONBLOCK)) STREAMSetNonBlock(S, FALSE); -} - -if (S->in_fd > -1) -{ -S->Type=STREAM_TYPE_TCP; -result=TRUE; -STREAMSetFlushType(S,FLUSH_LINE,0); -//if (Flags & CONNECT_SOCKS_PROXY) result=DoSocksProxyTunnel(S); -if (Flags & CONNECT_SSL) DoSSLClientNegotiation(S, Flags); - -ptr=GetRemoteIP(S->in_fd); -if (ptr) STREAMSetValue(S,"PeerIP",ptr); -} - -return(result); -} - - - -int STREAMConnectToHost(STREAM *S, char *DesiredHost, int DesiredPort,int Flags) -{ -ListNode *Curr; -char *Token=NULL, *ptr; -int result=FALSE; -int HopNo=0, val=0; -ListNode *LastHop=NULL; - -S->Path=FormatStr(S->Path,"tcp:%s:%d",DesiredHost,DesiredPort); -//Find the last hop, used to decide what ssh command to use -Curr=ListGetNext(S->Values); -while (Curr) -{ -ptr=GetToken(Curr->Tag,":",&Token,0); -if (strcasecmp(Token,"ConnectHop")==0) LastHop=Curr; -Curr=ListGetNext(Curr); -} - -STREAMSetFlushType(S,FLUSH_LINE,0); -Curr=ListGetNext(S->Values); -while (Curr) -{ -ptr=GetToken(Curr->Tag,":",&Token,0); - -if (strcasecmp(Token,"ConnectHop")==0) result=STREAMProcessConnectHop(S, (char *) Curr->Item,Curr==LastHop); - -HopNo++; -if (! result) break; -Curr=ListGetNext(Curr); -} - -//If we're not handling the connection through 'Connect hops' then -//just connect to host -if ((HopNo==0) && StrLen(DesiredHost)) -{ - if (Flags & CONNECT_NONBLOCK) S->Flags |= SF_NONBLOCK; - val=Flags; - - //STREAMDoPostConnect handles this - if (S->Timeout > 0) val |= CONNECT_NONBLOCK; - - S->in_fd=ConnectToHost(DesiredHost,DesiredPort,val); - - S->out_fd=S->in_fd; - if (S->in_fd > -1) result=TRUE; -} - -if (result==TRUE) -{ - if (Flags & CONNECT_NONBLOCK) - { - S->State |=SS_CONNECTING; - S->Flags |=SF_NONBLOCK; - } - else - { - S->State |=SS_CONNECTED; - result=STREAMDoPostConnect(S, Flags); - } -} - - -return(result); -} - - - - -#ifdef HAVE_LIBSSL -void STREAM_INTERNAL_SSL_ADD_SECURE_KEYS(STREAM *S, SSL_CTX *ctx) -{ -ListNode *Curr; -char *VerifyFile=NULL, *VerifyPath=NULL; - -Curr=ListGetNext(LibUsefulValuesGetHead()); -while (Curr) -{ - if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_CERT_FILE:",14)==0)) - { - SSL_CTX_use_certificate_chain_file(ctx,(char *) Curr->Item); - } - - if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_KEY_FILE:",13)==0)) - { - SSL_CTX_use_PrivateKey_file(ctx,(char *) Curr->Item,SSL_FILETYPE_PEM); - } - - if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTDIR",18)==0)) - { - VerifyPath=CopyStr(VerifyPath,(char *) Curr->Item); - } - - if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTFILE",19)==0)) - { - VerifyFile=CopyStr(VerifyFile,(char *) Curr->Item); - } - - Curr=ListGetNext(Curr); -} - - - -Curr=ListGetNext(S->Values); -while (Curr) -{ - if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_CERT_FILE:",14)==0)) - { - SSL_CTX_use_certificate_chain_file(ctx,(char *) Curr->Item); - } - - if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_KEY_FILE:",13)==0)) - { - SSL_CTX_use_PrivateKey_file(ctx,(char *) Curr->Item,SSL_FILETYPE_PEM); - } - - if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTDIR",18)==0)) - { - VerifyPath=CopyStr(VerifyPath,(char *) Curr->Item); - } - - if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTFILE",19)==0)) - { - VerifyFile=CopyStr(VerifyFile,(char *) Curr->Item); - } - - - Curr=ListGetNext(Curr); -} - - -SSL_CTX_load_verify_locations(ctx,VerifyFile,VerifyPath); - -DestroyString(VerifyFile); -DestroyString(VerifyPath); - -} -#endif - - -void HandleSSLError() -{ -int val; - -#ifdef HAVE_LIBSSL - val=ERR_get_error(); - fprintf(stderr,"Failed to create SSL_CTX: %s\n",ERR_error_string(val,NULL)); - fflush(NULL); -#endif -} - - -int INTERNAL_SSL_INIT() -{ -static int InitDone=FALSE; - -#ifdef HAVE_LIBSSL -if (InitDone) return(TRUE); - SSL_library_init(); -#ifdef USE_OPENSSL_ADD_ALL_ALGORITHMS - OpenSSL_add_all_algorithms(); -#endif - SSL_load_error_strings(); - - InitDone=TRUE; - return(TRUE); -#endif - -return(FALSE); -} - - -int SSLAvailable() -{ - return(INTERNAL_SSL_INIT()); -} - - - -int DoSSLClientNegotiation(STREAM *S, int Flags) -{ -int result=FALSE, val; -#ifdef HAVE_LIBSSL -SSL_METHOD *Method; -SSL_CTX *ctx; -SSL *ssl; -//struct x509 *cert=NULL; -X509 *cert=NULL; - -if (S) -{ -INTERNAL_SSL_INIT(); -// SSL_load_ciphers(); - Method=SSLv23_client_method(); - if (! Method) Method=SSLv2_client_method(); - ctx=SSL_CTX_new(Method); - if (! ctx) HandleSSLError(); - else - { - STREAM_INTERNAL_SSL_ADD_SECURE_KEYS(S,ctx); - ssl=SSL_new(ctx); - SSL_set_fd(ssl,S->in_fd); - STREAMSetItem(S,"LIBUSEFUL-SSL-CTX",ssl); - result=SSL_connect(ssl); - S->Flags|=SF_SSL; - - val=SSL_get_verify_result(ssl); - - switch(val) - { - case X509_V_OK: STREAMSetValue(S,"SSL-Certificate-Verify","OK"); break; - case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: STREAMSetValue(S,"SSL-Certificate-Verify","unable to get issuer"); break; - case X509_V_ERR_UNABLE_TO_GET_CRL: STREAMSetValue(S,"SSL-Certificate-Verify","unable to get certificate CRL"); break; - case X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: STREAMSetValue(S,"SSL-Certificate-Verify","unable to decrypt certificate's signature"); break; - case X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: STREAMSetValue(S,"SSL-Certificate-Verify","unable to decrypt CRL's signature"); break; - case X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: STREAMSetValue(S,"SSL-Certificate-Verify","unable to decode issuer public key"); break; - case X509_V_ERR_CERT_SIGNATURE_FAILURE: STREAMSetValue(S,"SSL-Certificate-Verify","certificate signature invalid"); break; - case X509_V_ERR_CRL_SIGNATURE_FAILURE: STREAMSetValue(S,"SSL-Certificate-Verify","CRL signature invalid"); break; - case X509_V_ERR_CERT_NOT_YET_VALID: STREAMSetValue(S,"SSL-Certificate-Verify","certificate is not yet valid"); break; - case X509_V_ERR_CERT_HAS_EXPIRED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate has expired"); break; - case X509_V_ERR_CRL_NOT_YET_VALID: STREAMSetValue(S,"SSL-Certificate-Verify","CRL is not yet valid the CRL is not yet valid."); break; - case X509_V_ERR_CRL_HAS_EXPIRED: STREAMSetValue(S,"SSL-Certificate-Verify","CRL has expired the CRL has expired."); break; - case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid notBefore value"); break; - case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid notAfter value"); break; - case X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid CRL lastUpdate value"); break; - case X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid CRL nextUpdate value"); break; - case X509_V_ERR_OUT_OF_MEM: STREAMSetValue(S,"SSL-Certificate-Verify","out of memory"); break; - case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: STREAMSetValue(S,"SSL-Certificate-Verify","self signed certificate"); break; - case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: STREAMSetValue(S,"SSL-Certificate-Verify","self signed certificate in certificate chain"); break; - case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: STREAMSetValue(S,"SSL-Certificate-Verify","cant find root certificate in local database"); break; - case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: STREAMSetValue(S,"SSL-Certificate-Verify","ERROR: unable to verify the first certificate"); break; - case X509_V_ERR_CERT_CHAIN_TOO_LONG: STREAMSetValue(S,"SSL-Certificate-Verify","certificate chain too long"); break; - case X509_V_ERR_CERT_REVOKED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate revoked"); break; - case X509_V_ERR_INVALID_CA: STREAMSetValue(S,"SSL-Certificate-Verify","invalid CA certificate"); break; - case X509_V_ERR_PATH_LENGTH_EXCEEDED: STREAMSetValue(S,"SSL-Certificate-Verify","path length constraint exceeded"); break; - case X509_V_ERR_INVALID_PURPOSE: STREAMSetValue(S,"SSL-Certificate-Verify","unsupported certificate purpose"); break; - case X509_V_ERR_CERT_UNTRUSTED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate not trusted"); break; - case X509_V_ERR_CERT_REJECTED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate rejected"); break; - case X509_V_ERR_SUBJECT_ISSUER_MISMATCH: STREAMSetValue(S,"SSL-Certificate-Verify","subject issuer mismatch"); break; - case X509_V_ERR_AKID_SKID_MISMATCH: STREAMSetValue(S,"SSL-Certificate-Verify","authority and subject key identifier mismatch"); break; - case X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: STREAMSetValue(S,"SSL-Certificate-Verify","authority and issuer serial number mismatch"); break; - case X509_V_ERR_KEYUSAGE_NO_CERTSIGN: STREAMSetValue(S,"SSL-Certificate-Verify","key usage does not include certificate signing"); break; - case X509_V_ERR_APPLICATION_VERIFICATION: STREAMSetValue(S,"SSL-Certificate-Verify","application verification failure"); break; - } - } - -cert=SSL_get_peer_certificate(ssl); -if (cert) -{ - STREAMSetValue(S,"SSL-Certificate-Issuer",X509_NAME_oneline( X509_get_issuer_name(cert),NULL, 0)); -} -} - -STREAMSetValue(S,"SSL-Cipher",STREAMQuerySSLCipher(S)); - -#endif -return(result); -} - - -int DoSSLServerNegotiation(STREAM *S, int Flags) -{ -int result=FALSE; -#ifdef HAVE_LIBSSL -SSL_METHOD *Method; -SSL_CTX *ctx; -SSL *ssl; - - -if (S) -{ -INTERNAL_SSL_INIT(); - Method=SSLv23_server_method(); - if (! Method) Method=SSLv2_server_method(); - if (Method) - { - ctx=SSL_CTX_new(Method); - - if (ctx) - { - STREAM_INTERNAL_SSL_ADD_SECURE_KEYS(S,ctx); - ssl=SSL_new(ctx); - SSL_set_fd(ssl,S->in_fd); - STREAMSetItem(S,"LIBUSEFUL-SSL-CTX",ssl); - SSL_set_verify(ssl,SSL_VERIFY_NONE,NULL); - SSL_set_accept_state(ssl); - result=SSL_accept(ssl); - if (result != TRUE) - { - result=SSL_get_error(ssl,result); - result=ERR_get_error(); - fprintf(stderr,"error: %s\n",ERR_error_string(result,NULL)); - result=FALSE; - } - S->Flags|=SF_SSL; - } - } -} - -#endif -return(result); -} - - -const char *STREAMQuerySSLCipher(STREAM *S) -{ -void *ptr; - -if (! S) return(NULL); -ptr=STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"); -if (! ptr) return(NULL); - -#ifdef HAVE_LIBSSL - -return(SSL_get_cipher((SSL *) ptr)); -#else -return(NULL); -#endif -} - - -int STREAMIsPeerAuth(STREAM *S) -{ -void *ptr; - -#ifdef HAVE_LIBSSL -ptr=STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"); -if (! ptr) return(FALSE); - -if (SSL_get_verify_result((SSL *) ptr)==X509_V_OK) -{ - if (SSL_get_peer_certificate((SSL *) ptr) !=NULL) return(TRUE); -} -#endif -return(FALSE); -} - - - -int OpenUDPSock(int Port) -{ - int result; - struct sockaddr_in addr; - int fd; - - addr.sin_family=AF_INET; -// addr.sin_addr.s_addr=Interface; - addr.sin_addr.s_addr=INADDR_ANY; - addr.sin_port=htons(Port); - - fd=socket(AF_INET, SOCK_DGRAM,0); - result=bind(fd,(struct sockaddr *) &addr, sizeof(addr)); - if (result !=0) - { - close(fd); - return(-1); - } - return(fd); -} - - -int STREAMSendDgram(STREAM *S, char *Host, int Port, char *Bytes, int len) -{ -struct sockaddr_in sa; -int salen; -struct hostent *hostdata; - -sa.sin_port=htons(Port); -sa.sin_family=AF_INET; -inet_aton(Host,& sa.sin_addr); -salen=sizeof(sa); - -if (IsAddress(Host)) -{ - inet_aton(Host, (struct in_addr *) &sa.sin_addr); -} -else -{ - hostdata=gethostbyname(Host); - if (!hostdata) - { - return(-1); - } -sa.sin_addr=*(struct in_addr *) *hostdata->h_addr_list; -} - - -return(sendto(S->out_fd,Bytes,len,0,(struct sockaddr *) &sa,salen)); -} - - - -STREAM *STREAMOpenUDP(int Port,int NonBlock) -{ -int fd; -STREAM *Stream; - -fd=OpenUDPSock(Port); -if (fd <0) return(NULL); -Stream=STREAMFromFD(fd); -Stream->Path=FormatStr(Stream->Path,"udp::%d",Port); -Stream->Type=STREAM_TYPE_UDP; -return(Stream); -} - - - -/* This is a simple function to decide if a string is an IP address as */ -/* opposed to a host/domain name. */ - -int IsIPAddress(char *Str) -{ -int len,count; -len=strlen(Str); -if (len <1) return(FALSE); -for (count=0; count < len; count++) - if ((! isdigit(Str[count])) && (Str[count] !='.')) return(FALSE); - return(TRUE); -} - - diff --git a/libUseful-2.0/string.c b/libUseful-2.0/string.c deleted file mode 100644 index 89c59be..0000000 --- a/libUseful-2.0/string.c +++ /dev/null @@ -1,773 +0,0 @@ -#include "includes.h" - -#ifndef va_copy -#define va_copy(dest, src) (dest) = (src) -#endif - -/* -int StrLen(char *Str) -{ -if (! Str) return(0); -return(strlen(Str)); -} -*/ - - -char *DestroyString(char *string) -{ -if (string) free(string); -// we return a null to be put into the string ptr -return(0); -} - - - -int CompareStr(const char *S1, const char *S2) -{ -int len1, len2; -len1=StrLen(S1); -len2=StrLen(S2); -if ((len1==0) && (len2==0)) return(0); - -if (len1==0) return(-1); -if (len2==0) return(1); - -return(strcmp(S1,S2)); -} - - - -char *CopyStrLen(char *Dest, const char *Src,int len) -{ -char *ptr; -ptr=CopyStr(Dest,Src); -if (StrLen(ptr) >len) ptr[len]=0; -return(ptr); -} - -char *CatStrLen(char *Dest, const char *Src,int len) -{ -char *ptr; -int catlen=0; - -catlen=StrLen(Dest); -ptr=CatStr(Dest,Src); -catlen+=len; -if (StrLen(ptr) > catlen) ptr[catlen]=0; -return(ptr); -} - - -char *CopyStr(char *Dest, const char *Src) -{ -int len; -char *ptr; - -if (Dest) *Dest=0; -return(CatStr(Dest,Src)); -} - - - -char *VCatStr(char *Dest, const char *Str1, va_list args) -{ -//initialize these to keep valgrind happy -int len=0; -char *ptr=NULL; -const char *sptr=NULL; - -if (Dest !=NULL) -{ -len=StrLen(Dest); -ptr=Dest; -} -else -{ - len=10; - ptr=(char *) calloc(10,1); -} - -if (! Str1) return(ptr); -for (sptr=Str1; sptr !=NULL; sptr=va_arg(args,const char *)) -{ -len+=StrLen(sptr)+1; -len=len*2; - - -ptr=(char *) realloc(ptr,len); -if (ptr && sptr) strcat(ptr,sptr); -} - -return(ptr); -} - -char *MCatStr(char *Dest, const char *Str1, ...) -{ -char *ptr=NULL; -va_list args; - -va_start(args,Str1); -ptr=VCatStr(Dest,Str1,args); -va_end(args); - -return(ptr); -} - - -char *MCopyStr(char *Dest, const char *Str1, ...) -{ -char *ptr=NULL; -va_list args; - -ptr=Dest; -if (ptr) *ptr='\0'; -va_start(args,Str1); -ptr=VCatStr(ptr,Str1,args); -va_end(args); - -return(ptr); -} - -char *CatStr(char *Dest, const char *Src) -{ -int len; -char *ptr; - -if (Dest !=NULL) -{ -len=StrLen(Dest); -ptr=Dest; -} -else -{ - len=10; - ptr=(char *) calloc(10,1); -} - -if (StrLen(Src)==0) return(ptr); -len+=StrLen(Src); -len++; - -ptr=(char *)realloc(ptr,len); -if (ptr && Src) strcat(ptr,Src); -return(ptr); -} - - - -//Clone string is really intended to be passed into the 'ListClone' function -//in the manner of a copy constructor, for most uses it's best to stick to -//CopyStr - -char *CloneStr(const char *Str) -{ -return(CopyStr(NULL,Str)); -} - - -char *VFormatStr(char *InBuff, const char *InputFmtStr, va_list args) -{ -int inc=100, count=1, result=0; -char *Tempstr=NULL, *FmtStr=NULL; -va_list argscopy; - -Tempstr=InBuff; - -//Take a copy of the supplied Format string and change it. -//Do not allow '%n', it's useable for exploits -FmtStr=CopyStr(FmtStr,InputFmtStr); -EraseString(FmtStr, "%n"); - - -inc=4 * StrLen(FmtStr); //this should be a good average -for (count=1; count < 100; count++) -{ - result=inc * count +1; - Tempstr=SetStrLen(Tempstr, result); - - //the vsnprintf function DESTROYS the arg list that is passed to it. - //This is just plain WRONG, it's a long-standing bug. The solution is to - //us va_copy to make a new one every time and pass that in. - va_copy(argscopy,args); - result=vsnprintf(Tempstr,result,FmtStr,argscopy); - va_end(argscopy); - - /* old style returns -1 to say couldn't fit data into buffer.. so we */ - /* have to guess again */ - if (result==-1) continue; - - /* new style returns how long buffer should have been.. so we resize it */ - if (result > (inc * count)) - { - Tempstr=SetStrLen(Tempstr, result+10); - result=vsnprintf(Tempstr,result+10,FmtStr,args); - } - - break; -} - -DestroyString(FmtStr); - - -return(Tempstr); -} - - - -char *FormatStr(char *InBuff, const char *FmtStr, ...) -{ -int inc=100, count=1, result; -char *tempstr=NULL; -va_list args; - -va_start(args,FmtStr); -tempstr=VFormatStr(InBuff,FmtStr,args); -va_end(args); -return(tempstr); -} - - -char *AddCharToStr(char *Dest,char Src) -{ -char temp[2]; -char *ptr=NULL; - -temp[0]=Src; -temp[1]=0; -ptr=CatStr(Dest,temp); -return(ptr); -} - - -inline char *AddCharToBuffer(char *Dest, int DestLen, char Char) -{ -char *actb_ptr; - -//if (Dest==NULL || ((DestLen % 100)==0)) -actb_ptr=(char *) realloc((void *) Dest,DestLen +110); -//else actb_ptr=Dest; - -actb_ptr[DestLen]=Char; -actb_ptr[DestLen+1]='\0'; - -return(actb_ptr); -} - - -inline char *AddBytesToBuffer(char *Dest, int DestLen, char *Bytes, int NoOfBytes) -{ -char *actb_ptr=NULL; - -//if (Dest==NULL || ((DestLen % 100)==0)) -actb_ptr=(char *) realloc((void *) Dest,DestLen + NoOfBytes +10); -//else actb_ptr=Dest; - -memcpy(actb_ptr+DestLen,Bytes,NoOfBytes); - -return(actb_ptr); -} - - - -char *SetStrLen(char *Str,int len) -{ -/* Note len+1 to allow for terminating NULL */ -if (Str==NULL) return((char *) calloc(1,len+1)); -else return( (char *) realloc(Str,len+1)); -} - - -char *strlwr(char *str) -{ -int count, len; -len=StrLen(str); -for (count=0; count < len; count++) str[count]=tolower(str[count]); -return(str); -} - -char *strupr(char *str) -{ -int count, len; -len=StrLen(str); -for (count=0; count < len; count++) str[count]=toupper(str[count]); -return(str); -} - -char *strrep(char *str, char oldchar, char newchar) -{ -int count, len; -len=StrLen(str); -for (count=0; count < len; count++) -{ -if (str[count]==oldchar) str[count]=newchar; -} -return(str); -} - -char *strmrep(char *str, char *oldchars, char newchar) -{ -int count, len; -len=StrLen(str); -for (count=0; count < len; count++) -{ -if (strchr(oldchars,str[count])) str[count]=newchar; -} -return(str); -} - -void StripTrailingWhitespace(char *String) -{ -int count,len; - -len=StrLen(String); -if (len==0) return; -for(count = len-1; (count >-1) && isspace(String[count]); count--) String[count]=0; -} - - -void StripLeadingWhitespace(char *String) -{ -int count,len; - -len=StrLen(String); -if (len==0) return; -for(count = 0; (count -1); count--) -{ - if ((Line[count]=='\r') || (Line[count]=='\n')) Line[count]=0; - else break; -} - -} - - -void StripQuotes(char *Str) -{ -int len; -char *ptr, StartQuote='\0'; - -ptr=Str; -while (isspace(*ptr)) ptr++; -len=StrLen(ptr); - -if ((*ptr=='"') || (*ptr=='\'')) StartQuote=*ptr; - -if ((len > 0) && (StartQuote != '\0')) -{ -if (ptr[len-1]==StartQuote) ptr[len-1]='\0'; -memmove(Str,ptr+1,len); -} - -} - - -char *EnquoteStr(char *Out, const char *In) -{ -const char *ptr; -char *ReturnStr=NULL; -int len=0; - -ptr=In; -ReturnStr=CopyStr(Out,""); - -while (ptr && (*ptr != '\0')) -{ - switch (*ptr) - { - case '\\': - case '"': - case '\'': - ReturnStr=AddCharToBuffer(ReturnStr,len,'\\'); - len++; - ReturnStr=AddCharToBuffer(ReturnStr,len, *ptr); - len++; - break; - - - case '\r': - ReturnStr=AddCharToBuffer(ReturnStr,len,'\\'); - len++; - ReturnStr=AddCharToBuffer(ReturnStr,len, 'r'); - len++; - break; - - - case '\n': - ReturnStr=AddCharToBuffer(ReturnStr,len,'\\'); - len++; - ReturnStr=AddCharToBuffer(ReturnStr,len, 'n'); - len++; - break; - - default: - ReturnStr=AddCharToBuffer(ReturnStr,len, *ptr); - len++; - break; - } - ptr++; - -} -return(ReturnStr); -} - - - -int MatchTokenFromList(const char *Token,char **List, int Flags) -{ -int count, len; - -for (count=0; List[count] !=NULL; count++) -{ - len=StrLen(List[count]); - if (len==0) continue; - if (StrLen(Token) < len) continue; - - if (Flags & MATCH_TOKEN_PART) - { - if (Flags & MATCH_TOKEN_CASE) - { - if (strncmp(Token,List[count],len)==0) return(count); - } - else if (strncasecmp(Token,List[count],len)==0) return(count); - } - else - { - if (StrLen(Token) != len) continue; - if (Flags & MATCH_TOKEN_CASE) - { - if(strcmp(Token,List[count])==0) return(count); - } - else if (strcasecmp(Token,List[count])==0) return(count); - } -} -return(-1); -} - - - -int MatchLineStartFromList(const char *Token,char **List) -{ -int count, len; - -for (count=0; List[count] !=NULL; count++) -{ - len=StrLen(List[count]); - - if ( - (len >0) && - (strncasecmp(Token,List[count],len)==0) - ) return(count); -} -return(-1); -} - -#define SEP_CHAR_SPACE -1 - -//Handle Quotes. If we start with a quote, sweep through to find the end of the quotes -char *HandleQuotes(char *String) -{ -char *ptr; -char StartQuote='\0'; - -ptr=String; -if ((*ptr)=='\"') StartQuote=*ptr; -if ((*ptr)=='\'') StartQuote=*ptr; -if (StartQuote) -{ - ptr++; - while ((*ptr) != StartQuote) - { - if ((*ptr)=='\0') return(ptr); - if ((*ptr)=='\\') ptr++; - ptr++; - } - ptr++; -} -return(ptr); -} - - -//This function searches for the separator -int GetTokenSepMatch(char *Pattern, char **start, char **end, int Flags) -{ -char *pptr, *eptr; -int MatchChar, InQuotes=FALSE; - - -pptr=Pattern; - - -if (Flags & GETTOKEN_QUOTES) *start=HandleQuotes(*start); -if (*start==*end) return(FALSE); - -eptr=*start; -while (1) -{ -//if we run out of pattern, then we got a match -if (*pptr=='\0') -{ - *end=eptr; - return(TRUE); -} - -//if ((*eptr=='"') && (Flags & GETTOKEN_QUOTES)) *eptr=HandleQuotes(*eptr); - -//if we run out of string, then we got a part match, but its not -//a match, so we return fail -if ((*eptr)=='\0') -{ - return(FALSE); -} - -if (*eptr=='\\' ) -{ - //if we got a quoted character we can't have found - //the separator, so return false - eptr++; - return(FALSE); -} - - -if (*pptr=='\\') -{ - pptr++; - if (*pptr=='S') MatchChar=SEP_CHAR_SPACE; - else MatchChar=*pptr; -} -else MatchChar=*pptr; - - -if (MatchChar==SEP_CHAR_SPACE) -{ - if (! isspace(*eptr)) return(FALSE); - while (isspace(*(eptr+1))) eptr++; -} -else if (*eptr != *pptr) return(FALSE); - -pptr++; -eptr++; -} -return(FALSE); -} - - - -char *GetNextSeparator(char *Pattern, char **Sep, int Flags) -{ -char *ptr; -int len=0; - -ptr=Pattern; -if (*ptr=='\0') return(NULL); -*Sep=CopyStr(*Sep,""); - -ptr=Pattern; -while ((*ptr != '\0') && (*ptr !='|')) -{ - *Sep=AddCharToBuffer(*Sep,len,*ptr); - len++; - ptr++; -} - -if (*ptr == '|') ptr++; - -return(ptr); -} - - -int GetTokenFindSeparator(char *Pattern, char *String, const char **SepStart, const char **SepEnd, int Flags) -{ -char *start_ptr=NULL, *end_ptr=NULL; -char *Sep=NULL, *SepPtr, *ptr; - -start_ptr=String; - -while (*start_ptr != '\0') -{ -if (*start_ptr=='\\') -{ - start_ptr++; - start_ptr++; -} - -if (Flags & GETTOKEN_MULTI_SEPARATORS) -{ -ptr=GetNextSeparator(Pattern,&Sep,Flags); -SepPtr=Sep; -} -else -{ - SepPtr=Pattern; - ptr=Pattern+StrLen(Pattern); -} - -while (ptr) -{ -if (GetTokenSepMatch(SepPtr,&start_ptr, &end_ptr, Flags)) -{ - *SepStart=start_ptr; - *SepEnd=end_ptr; - DestroyString(Sep); - return(TRUE); -} - -if (Flags & GETTOKEN_MULTI_SEPARATORS) -{ -ptr=GetNextSeparator(ptr,&Sep,Flags); -SepPtr=Sep; -} -else ptr=NULL; - -} - -if ((*start_ptr) !='\0') start_ptr++; -} - -DestroyString(Sep); -return(FALSE); -} - - -char *GetToken(const char *SearchStr, const char *Separator, char **Token, int Flags) -{ -char *Tempstr=NULL; -const char *SepStart=NULL, *SepEnd=NULL; -const char *ptr, *ssptr; -int len=0; - - -/* this is a safety measure so that there is always something in Token*/ -*Token=CopyStr(*Token,""); - -len=StrLen(SearchStr); -if (len < 1) return(NULL); - -if (! GetTokenFindSeparator((char *) Separator,(char *) SearchStr,&SepStart,&SepEnd, Flags)) -{ - SepStart=SearchStr+len; -} - - -//strip any leading quotes -ptr=SearchStr; -*Token=CopyStrLen(*Token,ptr,SepStart-ptr); - -if (Flags & GETTOKEN_QUOTES) -{ - StripQuotes(*Token); -} - - -//return empty string, but not null -if (StrLen(SepEnd) < 1) -{ - SepEnd=SearchStr+StrLen((char *) SearchStr); -} - -return((char *) SepEnd); -} - - -#define ESC 0x1B - -char *DeQuoteStr(char *Buffer, const char *Line) -{ -char *out, *in; -int olen=0; - -if (Line==NULL) return(NULL); -out=CopyStr(Buffer,""); -in=(char *) Line; - -while(in && (*in != '\0') ) -{ - if (*in=='\\') - { - in++; - switch (*in) - { - case 'e': - out=AddCharToBuffer(out,olen,ESC); - olen++; - break; - - - case 'n': - out=AddCharToBuffer(out,olen,'\n'); - olen++; - break; - - case 'r': - out=AddCharToBuffer(out,olen,'\r'); - olen++; - break; - - case 't': - out=AddCharToBuffer(out,olen,'\t'); - olen++; - break; - - - case '\\': - default: - out=AddCharToBuffer(out,olen,*in); - olen++; - break; - - } - } - else - { - out=AddCharToBuffer(out,olen,*in); - olen++; - } - in++; -} - -return(out); -} - - - -char *QuoteCharsInStr(char *Buffer, const char *String, const char *QuoteChars) -{ -char *Tempstr=NULL; -int si, ci, slen, clen, olen=0; - -slen=StrLen(String); -clen=StrLen(QuoteChars); - -Tempstr=CopyStr(Buffer,""); - -for (si=0; si < slen; si++) -{ - for (ci=0; ci < clen; ci++) - { - if (String[si]==QuoteChars[ci]) - { - Tempstr=AddCharToBuffer(Tempstr,olen, '\\'); - olen++; - break; - } - } - Tempstr=AddCharToBuffer(Tempstr,olen,String[si]); - olen++; -} - -return(Tempstr); -} - - diff --git a/libUseful-2.0/tartest.c b/libUseful-2.0/tartest.c deleted file mode 100644 index 4118b6d..0000000 --- a/libUseful-2.0/tartest.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "libUseful.h" - - -main(int argc, char *argv[]) -{ -STREAM *S, *Out; -ListNode *Vars; -char *Path=NULL, *Tempstr=NULL, *ptr; -int bytes_read, bytes_total, val, result; - - -S=STREAMOpenFile(argv[1],O_RDONLY); - -Out=STREAMFromFD(1); -Vars=ListCreate(); -while (TarReadHeader(S, Vars)) -{ - Path=CopyStr(Path,GetVar(Vars,"Path")); -printf("PATH: %s %s %s\n",Path,GetVar(Vars,"Size"),GetVar(Vars,"Type")); - if (StrLen(Path)) - { - ptr=GetVar(Vars,"Type"); - if (ptr && (strcmp(ptr,"file")==0)) - { - bytes_read=0; - bytes_total=atoi(GetVar(Vars,"Size")); - Tempstr=SetStrLen(Tempstr,BUFSIZ); - while (bytes_read < bytes_total) - { - val=bytes_total - bytes_read; - if (val > BUFSIZ) val=BUFSIZ; - if ((val % 512)==0) result=val; - else result=((val / 512) + 1) * 512; - result=STREAMReadBytes(S,Tempstr,result); - if (result > val) result=val; - printf("READ: %d\n",val); fflush(NULL); - if (Out) STREAMWriteBytes(Out,Tempstr,result); - bytes_read+=result; - } - } - } - ListClear(Vars,DestroyString); -} - -ListDestroy(Vars,DestroyString); -DestroyString(Tempstr); -DestroyString(Path); -} diff --git a/libUseful-2.0/unix_socket.c b/libUseful-2.0/unix_socket.c deleted file mode 100644 index b333c03..0000000 --- a/libUseful-2.0/unix_socket.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "unix_socket.h" -#include -#include -#include - -int InitUnixServerSocket(const char *Path, int ConType) -{ - int result; - struct sockaddr_un addr; - int sockfd=-1, SockType; - - result=1; - if (ConType==STREAM_TYPE_UNIX) SockType=SOCK_STREAM; - else SockType=SOCK_DGRAM; - - memset(&addr,0,sizeof(struct sockaddr_un)); - addr.sun_family=AF_UNIX; - strcpy(addr.sun_path,Path); - - sockfd=socket(AF_UNIX, SockType, 0); - - if (sockfd > -1) - { - unlink(Path); - result=bind(sockfd,(struct sockaddr *) &addr, SUN_LEN(&addr)); - chmod(Path,0666); - if (result != 0) - { - close(sockfd); - return(-1); - } - else - { - if (SockType==SOCK_STREAM) listen(sockfd,5); - } - } - -return(sockfd); -} - - - -int OpenUnixSocket(const char *Path, int Type) -{ -int sock; -struct sockaddr_un sa; -int val; - -if (Type==STREAM_TYPE_UNIX) val=SOCK_STREAM; -else val=SOCK_DGRAM; - -sock=socket(AF_UNIX, val, FALSE); -if (sock==-1) return(-1); - -memset(&sa,0,sizeof(struct sockaddr_un)); -sa.sun_family=AF_UNIX; -strcpy(sa.sun_path,Path); -val=sizeof(sa); -if (connect(sock,(struct sockaddr *) &sa,val)==0) return(sock); - -close(sock); -return(-1); -} - - - -int STREAMConnectUnixSocket(STREAM *S, const char *Path, int ConType) -{ - - S->in_fd=OpenUnixSocket(Path, ConType); - if (S->in_fd==-1) return(FALSE); - S->out_fd=S->in_fd; - S->Type=ConType; - - return(TRUE); -} diff --git a/libUseful-2.0/ziptest.c b/libUseful-2.0/ziptest.c deleted file mode 100644 index 1d59da4..0000000 --- a/libUseful-2.0/ziptest.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "libUseful.h" - -void CompressTermcap() -{ -STREAM *In, *Out; -char *Buffer=NULL; -int result; - -Out=STREAMOpenFile("/tmp/termcap.gz",O_CREAT | O_TRUNC | O_WRONLY); -STREAMAddStandardDataProcessor(Out, "compression", "gzip", ""); - -Buffer=SetStrLen(Buffer,4096); -In=STREAMOpenFile("/etc/termcap",O_RDONLY); -result=STREAMReadBytes(In,Buffer,4096); -while (result > 0) -{ - STREAMWriteBytes(Out,Buffer,result); - result=STREAMReadBytes(In,Buffer,4096); -} -STREAMClose(Out); -STREAMClose(In); -} - -void ReadTermcap() -{ -STREAM *In, *Out; -char *Buffer=NULL; -int result; - -In=STREAMOpenFile("/tmp/termcap.gz",O_RDONLY); -STREAMAddStandardDataProcessor(In, "compression", "gzip", ""); - -Buffer=SetStrLen(Buffer,4096); -Out=STREAMOpenFile("/tmp/termcap.out",O_CREAT|O_TRUNC|O_WRONLY); -result=STREAMReadBytes(In,Buffer,4096); -while (result > 0) -{ - STREAMWriteBytes(Out,Buffer,result); - result=STREAMReadBytes(In,Buffer,4096); -} -STREAMClose(In); -STREAMClose(Out); -} - -main() -{ - printf("WRITE\n"); - CompressTermcap(); - printf("READ\n"); - ReadTermcap(); -} - -//TarFiles(Out,"*.c"); diff --git a/libUseful-2.0/Compression.c b/libUseful-2.4/Compression.c similarity index 100% rename from libUseful-2.0/Compression.c rename to libUseful-2.4/Compression.c diff --git a/libUseful-2.0/Compression.h b/libUseful-2.4/Compression.h similarity index 100% rename from libUseful-2.0/Compression.h rename to libUseful-2.4/Compression.h diff --git a/libUseful-2.4/Compression.o b/libUseful-2.4/Compression.o new file mode 100644 index 0000000..7dab816 Binary files /dev/null and b/libUseful-2.4/Compression.o differ diff --git a/libUseful-2.0/ConnectManager.c b/libUseful-2.4/ConnectManager.c similarity index 92% rename from libUseful-2.0/ConnectManager.c rename to libUseful-2.4/ConnectManager.c index 0aa543e..af2974e 100644 --- a/libUseful-2.0/ConnectManager.c +++ b/libUseful-2.4/ConnectManager.c @@ -31,14 +31,18 @@ return(TRUE); STREAM *ConnectManagerAddClient(char *Host, int Port, int Flags, char *Name, CONNECT_FUNC OnConnect, ONDATA_FUNC OnData) { STREAM *S; +char *Tempstr=NULL; TConnectManagerItem *Item; if (! ConnectManClients) ConnectManClients=ListCreate(); S=STREAMCreate(); -if (! STREAMConnectToHost(S,Host,Port,Flags)) + +Tempstr=FormatStr(Tempstr,"%s:%d",Host,Port); +if (! STREAMConnect(S,Tempstr,Flags)) { STREAMClose(S); +DestroyString(Tempstr); return(NULL); } @@ -53,6 +57,8 @@ Item->Port=Port; if (Item->OnConnect && STREAMIsConnected(S)) Item->OnConnect(Item); ListAddItem(ConnectManClients,Item); + +DestroyString(Tempstr); return(S); } @@ -117,7 +123,6 @@ STREAM *ConnectManagerGetStreamByName(char *Name) { TConnectManagerItem *Item; ListNode *Curr; -int count=0; Curr=ListGetNext(ConnectManClients); while (Curr) @@ -142,8 +147,8 @@ TConnectManagerItem *Item, *NewItem; ListNode *Curr, *Prev; int highfd=0; fd_set ReadSet, WriteSet; -int ipaddr, sock, result, SelectResult, NextTimerFire; -STREAM *S; +int sock, result, SelectResult, NextTimerFire; +STREAM *S, *NewS; time_t Now; struct timeval tv; int MoreData=FALSE; @@ -236,12 +241,11 @@ while (1) if (FD_ISSET(S->in_fd,&ReadSet)) { - sock=TCPServerSockAccept(S->in_fd,&ipaddr); + sock=TCPServerSockAccept(S->in_fd,&S->Path); if (sock > -1) { S=STREAMFromFD(sock); - STREAMSetFlushType(S,FLUSH_LINE,0); - S->Path=CopyStr(S->Path,IPtoStr(ipaddr)); + STREAMSetFlushType(S,FLUSH_LINE,0,0); NewItem=ConnectManagerAddIncoming(S,Item->Name, Item->OnData); if (Item->OnConnect) Item->OnConnect(NewItem); } @@ -269,7 +273,7 @@ while (1) { if (STREAMIsConnected(S)) { - STREAMSetNonBlock(S,FALSE); + STREAMSetFlags(S, 0, SF_NONBLOCK); if (Item->OnConnect) Item->OnConnect(Item); } @@ -296,10 +300,10 @@ while (1) } else if (result==RECONNECT) { + NewS=STREAMCreate(); + STREAMConnect(NewS, S->Path, CONNECT_NONBLOCK); + Item->Data=(void *) NewS; STREAMClose(S); - S=STREAMCreate(); - STREAMConnectToHost(S,Item->Host,Item->Port,CONNECT_NONBLOCK); - Item->Data=(void *) S; } } diff --git a/libUseful-2.0/ConnectManager.h b/libUseful-2.4/ConnectManager.h similarity index 100% rename from libUseful-2.0/ConnectManager.h rename to libUseful-2.4/ConnectManager.h diff --git a/libUseful-2.4/ConnectManager.o b/libUseful-2.4/ConnectManager.o new file mode 100644 index 0000000..69ecdf0 Binary files /dev/null and b/libUseful-2.4/ConnectManager.o differ diff --git a/libUseful-2.4/ConnectionChain.c b/libUseful-2.4/ConnectionChain.c new file mode 100644 index 0000000..b11eb4f --- /dev/null +++ b/libUseful-2.4/ConnectionChain.c @@ -0,0 +1,545 @@ +#include "ConnectionChain.h" +#include "ParseURL.h" +#include "SpawnPrograms.h" +#include "expect.h" + +const char *HopTypes[]={"none","direct","httptunnel","ssh","sshtunnel","socks4","socks5","shell","telnet",NULL}; +typedef enum {CONNECT_HOP_NONE, CONNECT_HOP_TCP, CONNECT_HOP_HTTPTUNNEL, CONNECT_HOP_SSH, CONNECT_HOP_SSHTUNNEL, CONNECT_HOP_SOCKS4, CONNECT_HOP_SOCKS5, CONNECT_HOP_SHELL_CMD, CONNECT_HOP_TELNET} THopTypes; + +char *GlobalConnectionChain=NULL; + +int SetGlobalConnectionChain(const char *Chain) +{ +char *Token=NULL, *Type=NULL, *ptr; +int result=TRUE; + +ptr=GetToken(Chain, ",", &Token, 0); +while (ptr) +{ + GetToken(Token,":",&Type,0); + if (MatchTokenFromList(Type, HopTypes, 0)==-1) result=FALSE; + ptr=GetToken(ptr, ",", &Token, 0); +} + +GlobalConnectionChain=CopyStr(GlobalConnectionChain, Chain); + +DestroyString(Token); +DestroyString(Type); +return(result); +} + + + +int DoHTTPProxyTunnel(STREAM *S, const char *Host, int Port, const char *Destination, int Flags) +{ +char *Tempstr=NULL, *Token=NULL; +const char *ptr=NULL; +int result=FALSE; + + S->in_fd=TCPConnect(Host,Port,0); + S->out_fd=S->in_fd; + if (S->in_fd == -1) return(FALSE); + + ptr=Destination; + if (strncmp(ptr,"tcp:",4)==0) ptr+=4; + Tempstr=FormatStr(Tempstr,"CONNECT %s HTTP/1.1\r\n\r\n",ptr); + + STREAMWriteLine(Tempstr,S); + STREAMFlush(S); + + Tempstr=STREAMReadLine(Tempstr,S); + StripTrailingWhitespace(Tempstr); + + ptr=GetToken(Tempstr," ",&Token,0); + ptr=GetToken(ptr," ",&Token,0); + + if (*Token=='2') result=TRUE; + while (StrLen(Tempstr)) + { + Tempstr=STREAMReadLine(Tempstr,S); + StripTrailingWhitespace(Tempstr); + } + +DestroyString(Tempstr); +DestroyString(Token); + +return(result); +} + + +#define HT_IP4 1 +#define HT_DOMAIN 3 +#define HT_IP6 4 + + +int ConnectHopSocks5Auth(STREAM *S, const char *User, const char *Pass) +{ +char *Tempstr=NULL, *ptr; +int result, RetVal=FALSE; +uint8_t len; + +Tempstr=SetStrLen(Tempstr, 10); + +//socks5 version +Tempstr[0]=5; +//Number of Auth Methods (just 1, username/password) +Tempstr[1]=1; +//Auth method 2, username/password +Tempstr[2]=2; + +STREAMWriteBytes(S,Tempstr,3); +STREAMFlush(S); + +result=STREAMReadBytes(S,Tempstr,10); +if ((result > 1) && (Tempstr[0]==5)) +{ + // Second Byte is authentication type selected by the server + switch (Tempstr[1]) + { + //no authentication required + case 0: + RetVal=TRUE; + break; + + //gssapi + case 1: + break; + + //username/password + case 2: + Tempstr=SetStrLen(Tempstr, StrLen(User) + StrLen(Pass) + 10); + ptr=Tempstr; + //version 1 of username/password authentication + *ptr=1; + ptr++; + + //username + len=StrLen(User) & 0xFF; + *ptr=len; + ptr++; + memcpy(ptr, User, len); + ptr+=len; + + //password + len=StrLen(Pass) & 0xFF; + *ptr=len; + ptr++; + memcpy(ptr, Pass, len); + ptr+=len; + + STREAMWriteBytes(S,Tempstr,ptr-Tempstr); + STREAMFlush(S); + + result=STREAMReadBytes(S,Tempstr,10); + + //two bytes reply. Byte1 is Version Byte2 is 0 for success + if ((result > 1) && (Tempstr[0]==1) && (Tempstr[1]==0)) RetVal=TRUE; + break; + } +} + +DestroyString(Tempstr); + +return(RetVal); +} + + + +int ConnectHopSocks(STREAM *S, int Type, const char *Host, int Port, const char *User, const char *Pass, const char *Path) +{ +char *Tempstr=NULL; +uint8_t *ptr; +uint32_t IP; +char *Token=NULL; +const char *tptr; +int result, RetVal=FALSE, val; +uint8_t HostType=HT_IP4; + +S->in_fd=TCPConnect(Host,Port,0); +S->out_fd=S->in_fd; +if (S->in_fd == -1) return(FALSE); + + +if (Type==CONNECT_HOP_SOCKS5) +{ +if (! ConnectHopSocks5Auth(S, User, Pass)) return(FALSE); +} + +//Horrid binary protocol. +Tempstr=SetStrLen(Tempstr, StrLen(User) + 20 + StrLen(Path)); +ptr=Tempstr; + +//version +if (Type==CONNECT_HOP_SOCKS5) *ptr=5; +else *ptr=4; //version number +ptr++; + +//connection type +*ptr=1; //outward connection (2 binds a port for incoming) +ptr++; + +//Sort out path now +tptr=Path; +if (strncmp(tptr,"tcp:",4)==0) tptr+=4; +tptr=GetToken(tptr,":",&Token,0); +if (IsIP4Address(Token)) HostType=HT_IP4; +else if (IsIP6Address(Token)) HostType=HT_IP6; +else HostType=HT_DOMAIN; + + +if (Type==CONNECT_HOP_SOCKS5) +{ +//Socks 5 has a 'reserved' byte after the connection type + *ptr=0; + ptr++; + + *ptr=HostType; + ptr++; + switch (HostType) + { + case HT_IP4: + *((uint32_t *) ptr) =StrtoIP(Token); + ptr+=4; + break; + + case HT_IP6: + break; + + default: + val=StrLen(Token); + *ptr=val; + ptr++; + memcpy(ptr, Token, val); + ptr+=val; + break; + } +} + + +//destination port. By a weird coincidence this is in the right place +//for either socks4 or 5, despite the fact that it comes after the +//host in socks5, and before the host in socks4 +*((uint16_t *) ptr) =htons(atoi(tptr)); +ptr+=2; + +if (Type==CONNECT_HOP_SOCKS4) +{ + //destination host + switch (HostType) + { + case HT_IP4: + *((uint32_t *) ptr) =StrtoIP(Token); + ptr+=4; + val=StrLen(User)+1; + memcpy(ptr,User,val); + ptr+=val; + break; + + default: + *((uint32_t *) ptr) =StrtoIP("0.0.0.1"); + ptr+=4; + break; + } + + val=StrLen(User)+1; + memcpy(ptr, User, val); + ptr+=val; + + //+1 to include terminating \0 + val=StrLen(Token) +1; + memcpy(ptr, Token, val); + ptr+=val; +} + +STREAMWriteBytes(S,Tempstr,(char *)ptr-Tempstr); STREAMFlush(S); +Tempstr=SetStrLen(Tempstr, 32); +result=STREAMReadBytes(S,Tempstr,32); + + +if (Type==CONNECT_HOP_SOCKS5) +{ + if ((result > 8) && (Tempstr[0]==5) && (Tempstr[1]==0)) + { + RetVal=TRUE; + } +} +else +{ + //Positive response will be 0x00 0x5a 0x00 0x00 0x00 0x00 0x00 0x00 + //although only the leading two bytes (0x00 0x5a, or \0Z) matters + if ((result==8) && (Tempstr[0]=='\0') && (Tempstr[1]=='Z')) + { + RetVal=TRUE; + + IP=*(uint32_t *) (Tempstr + 4); + if (IP != 0) STREAMSetValue(S, "IPAddress", IPtoStr(IP)); + } +} + + +DestroyString(Tempstr); +DestroyString(Token); + +return(RetVal); +} + + + + +int SendPublicKeyToRemote(STREAM *S, char *KeyFile, char *LocalPath) +{ +char *Tempstr=NULL, *Line=NULL; +STREAM *LocalFile; + + +Tempstr=FormatStr(Tempstr,"rm -f %s ; touch %s; chmod 0600 %s\n",KeyFile,KeyFile,KeyFile); +STREAMWriteLine(Tempstr,S); +LocalFile=STREAMOpenFile(LocalPath,SF_RDONLY); +if (LocalFile) +{ +Line=STREAMReadLine(Line,LocalFile); +while (Line) +{ +StripTrailingWhitespace(Line); +Tempstr=FormatStr(Tempstr,"echo '%s' >> %s\n",Line,KeyFile); +STREAMWriteLine(Tempstr,S); +Line=STREAMReadLine(Line,LocalFile); +} +STREAMClose(LocalFile); +} + +return(TRUE); +} + + + +int ConnectHopSSH(STREAM *S,int Type, char *Host, int Port, char *User, char *Pass, char *NextHop) +{ +char *Tempstr=NULL, *KeyFile=NULL, *Token=NULL, *Token2=NULL; +STREAM *AuthS; +int result=FALSE, val; +unsigned int TunnelPort=0; + +if (Type==CONNECT_HOP_SSHTUNNEL) +{ + TunnelPort=(rand() % (0xFFFF - 9000)) +9000; + //Host will be Token, and port Token2 + ParseConnectDetails(NextHop, NULL, &Token, &Token2, NULL, NULL, NULL); + Tempstr=FormatStr(Tempstr,"ssh -2 -N %s@%s -L %d:%s:%s ",User,Host,TunnelPort,Token,Token2); + +} +else Tempstr=MCopyStr(Tempstr,"ssh -2 -T ",User,"@",Host, " ", NULL ); + +if (strncmp(Pass,"keyfile:",8)==0) +{ + + if (S->in_fd != -1) + { + Token=FormatStr(Token,".%d-%d",getpid(),time(NULL)); + SendPublicKeyToRemote(S,Token,Pass+8); + KeyFile=CopyStr(KeyFile,Token); + } + Tempstr=MCatStr(Tempstr,"-i ",KeyFile," ",NULL); + } + + if (Port > 0) + { + Token=FormatStr(Token," -p %d ",Port); + Tempstr=CatStr(Tempstr,Token); + } + + if (Type==CONNECT_HOP_SSHTUNNEL) + { + Tempstr=CatStr(Tempstr, " 2> /dev/null"); + AuthS=STREAMSpawnCommand(Tempstr,"", "", COMMS_BY_PTY); + STREAMSetValue(S,"HelperPID:SSH",STREAMGetValue(AuthS,"PeerPID")); + } + else if (S->in_fd==-1) + { + Tempstr=CatStr(Tempstr, " 2> /dev/null"); + PseudoTTYSpawn(&S->in_fd,Tempstr,"","",0); + S->out_fd=S->in_fd; + if (S->in_fd > -1) + { + result=TRUE; + STREAMSetFlushType(S,FLUSH_LINE,0,0); + } + AuthS=S; + } + else + { + if (StrLen(KeyFile)) Tempstr=MCatStr(Tempstr," ; rm -f ",KeyFile,NULL); + Tempstr=CatStr(Tempstr,"; exit\n"); + STREAMWriteLine(Tempstr,S); + result=TRUE; + AuthS=S; + } + + if ((StrLen(KeyFile)==0) && (StrLen(Pass) > 0)) + { + Token=MCopyStr(Token,Pass,"\n",NULL); + for (val=0; val < 3; val++) + { + if (STREAMExpectAndReply(AuthS,"assword:",Token)) break; + } + } + STREAMSetTimeout(AuthS,100); + //STREAMExpectSilence(AuthS); + sleep(3); + + if (Type==CONNECT_HOP_SSHTUNNEL) + { + S->in_fd=TCPConnect("127.0.0.1",TunnelPort,0); + S->out_fd=S->in_fd; + if (S->in_fd > -1) result=TRUE; + } + + +DestroyString(Tempstr); +DestroyString(KeyFile); +DestroyString(Token2); +DestroyString(Token); + +return(result); +} + + +int STREAMProcessConnectHop(STREAM *S, char *HopURL, int LastHop) +{ +int val, result=FALSE; +char *Token=NULL, *Token2=NULL; +char *Tempstr=NULL; +char *User=NULL, *Host=NULL,*Pass=NULL, *KeyFile=NULL; +int Port=0; + +ParseConnectDetails(HopURL, &Token, &Host, &Token2, &User, &Pass, NULL); + +Port=atoi(Token2); + +val=MatchTokenFromList(Token,HopTypes,0); +switch (val) +{ + case CONNECT_HOP_TCP: + if (S->in_fd==-1) + { + S->in_fd=TCPConnect(Host,Port,0); + S->out_fd=S->in_fd; + if (S->in_fd > -1) result=TRUE; + } + break; + + case CONNECT_HOP_HTTPTUNNEL: + result=DoHTTPProxyTunnel(S, Host, Port, S->Path, 0); + break; + + case CONNECT_HOP_SSH: + case CONNECT_HOP_SSHTUNNEL: + result=ConnectHopSSH(S, val, Host, Port, User, Pass, S->Path); + break; + + case CONNECT_HOP_SOCKS4: + case CONNECT_HOP_SOCKS5: + result=ConnectHopSocks(S, val, Host, Port, User, Pass, S->Path); + break; + + case CONNECT_HOP_SHELL_CMD: + break; + + case CONNECT_HOP_TELNET: + if (Port > 0) + { + Tempstr=FormatStr(Tempstr,"telnet -8 %s %d ",Host, Port); + } + else Tempstr=FormatStr(Tempstr,"telnet -8 %s ",Host); + + if (S->in_fd==-1) + { + PseudoTTYSpawn(& S->in_fd,Tempstr,"","",0); + S->out_fd=S->in_fd; + if (S->in_fd > -1) + { + result=TRUE; + STREAMSetFlushType(S,FLUSH_LINE,0,0); + } + + } + else + { + Tempstr=CatStr(Tempstr,";exit\n"); + STREAMWriteLine(Tempstr,S); + result=TRUE; + } + if (StrLen(User) > 0) + { + Tempstr=MCopyStr(Tempstr,User,"\n",NULL); + STREAMExpectAndReply(S,"ogin:",Tempstr); + } + if (StrLen(Pass) > 0) + { + Tempstr=MCopyStr(Tempstr,Pass,"\n",NULL); + STREAMExpectAndReply(S,"assword:",Tempstr); + } + STREAMExpectSilence(S,2); + break; + + +} + +DestroyString(Tempstr); +DestroyString(Token); +DestroyString(KeyFile); +DestroyString(Host); +DestroyString(User); +DestroyString(Pass); + +STREAMFlush(S); +return(result); +} + + +/* +int STREAMInternalLastHop(STREAM *S,char *DesiredHost,int DesiredPort, char *LastHop) +{ +int result, Type,Port; +char *Host=NULL, *User=NULL, *Pass=NULL, *KeyFile=NULL; + +ParseConnectHop(LastHop, &Type, &Host, &User, &Pass, &KeyFile, &Port); +switch (Type) +{ + +} +result=STREAMProcessConnectHop(S, Tempstr, TRUE); + +DestroyString(Tempstr); +DestroyString(Host); +DestroyString(User); +DestroyString(Pass); +DestroyString(KeyFile); +return(result); +} +*/ + + + +int STREAMAddConnectionHop(STREAM *S, char *HopsString) +{ +char *Tempstr=NULL, *Value=NULL, *ptr; + +if (! S->Values) S->Values=ListCreate(); + +ptr=GetToken(HopsString, ",", &Value,0); +while (ptr) +{ +StripTrailingWhitespace(Value); +StripLeadingWhitespace(Value); + +Tempstr=FormatStr(Tempstr,"ConnectHop:%d",ListSize(S->Values)); +STREAMSetValue(S,Tempstr,Value); +ptr=GetToken(ptr, ",", &Value,0); +} + +DestroyString(Tempstr); +DestroyString(Value); +return(TRUE); +} + diff --git a/libUseful-2.0/ConnectionChain.h b/libUseful-2.4/ConnectionChain.h similarity index 100% rename from libUseful-2.0/ConnectionChain.h rename to libUseful-2.4/ConnectionChain.h diff --git a/libUseful-2.4/ConnectionChain.o b/libUseful-2.4/ConnectionChain.o new file mode 100644 index 0000000..5f933d1 Binary files /dev/null and b/libUseful-2.4/ConnectionChain.o differ diff --git a/libUseful-2.0/DataProcessing.c b/libUseful-2.4/DataProcessing.c similarity index 94% rename from libUseful-2.0/DataProcessing.c rename to libUseful-2.4/DataProcessing.c index a0b39c8..b40fad1 100644 --- a/libUseful-2.0/DataProcessing.c +++ b/libUseful-2.4/DataProcessing.c @@ -1,5 +1,8 @@ #include "DataProcessing.h" #include "SpawnPrograms.h" +#include "FileSystem.h" +#include "Hash.h" +#include "file.h" #ifdef HAVE_LIBSSL @@ -43,7 +46,6 @@ free(Mod); char *DataProcessorGetValue(TProcessingModule *M, const char *Name) { -char *ptr; ListNode *Curr; if (! M->Values) return(NULL); @@ -55,7 +57,6 @@ return(NULL); void DataProcessorSetValue(TProcessingModule *M, const char *Name, const char *Value) { -char *ptr; ListNode *Curr; if (! M->Values) M->Values=ListCreate(); @@ -126,7 +127,7 @@ if (! StrLen(Value) ) } -S=STREAMSpawnCommand(Value, COMMS_BY_PIPE); +S=STREAMSpawnCommand(Value, "", "", COMMS_BY_PIPE); ProcMod->Data=(void *) S; result=TRUE; @@ -331,7 +332,7 @@ int result=FALSE; #ifdef HAVE_LIBSSL libCryptoProcessorData *Data; EVP_CIPHER_CTX *ctx; -char *CipherList[]={"blowfish","rc2","rc4","rc5","des","desx","cast","idea","aes","aes-256",NULL}; +const char *CipherList[]={"blowfish","rc2","rc4","rc5","des","desx","cast","idea","aes","aes-256",NULL}; int val; char *Tempstr=NULL; @@ -474,12 +475,12 @@ int libCryptoProcessorWrite(TProcessingModule *ProcMod, const char *InData, int int wrote=0; #ifdef HAVE_LIBSSL -int len, result, val; +/* +int len, result=0, val; libCryptoProcessorData *Data; EVP_CIPHER_CTX *ctx; char *ptr, *Tempstr=NULL; -/* if (ProcMod->Flags & DPM_WRITE_FINAL) return(0); ptr=OutData; @@ -487,9 +488,7 @@ Data=(libCryptoProcessorData *) ProcMod->Data; ctx=Data->enc_ctx; ProcMod->Flags = ProcMod->Flags & ~DPM_WRITE_FINAL; -*/ -/* if (ProcMod->Flags & DPM_NOPAD_DATA) { val=InLen % Data->BlockSize; @@ -505,9 +504,8 @@ if (ProcMod->Flags & DPM_NOPAD_DATA) result=EVP_EncryptUpdate(ctx, ptr, &len, Tempstr, val); } else -*/ { -//result=EVP_EncryptUpdate(ctx, ptr, &len, InData, InLen); + result=EVP_EncryptUpdate(ctx, ptr, &len, InData, InLen); } @@ -515,6 +513,7 @@ if (! result) wrote=0; else wrote=len; DestroyString(Tempstr); +*/ #endif return(wrote); } @@ -523,10 +522,12 @@ return(wrote); int libCryptoProcessorFlush(TProcessingModule *ProcMod, const char *InData, int InLen, char *OutData, int OutLen) { -int result=0, wrote=0, len; -libCryptoProcessorData *Data; +int wrote=0; /* +int result=0, len; +libCryptoProcessorData *Data; + if (ProcMod->Flags & DPM_WRITE_FINAL) return(0); Data=(libCryptoProcessorData *) ProcMod->Data; @@ -555,28 +556,24 @@ int libCryptoProcessorRead(TProcessingModule *ProcMod, const char *InData, int I { int bytes_read=0; #ifdef HAVE_LIBSSL +/* int len, ivlen, result, val; libCryptoProcessorData *Data; EVP_CIPHER_CTX *ctx; char *ptr; -/* ptr=OutData; Data=(libCryptoProcessorData *) ProcMod->Data; if (!Data) return(0); -*/ -/* if (ProcMod->Flags & DPM_READ_FINAL) { if (InLen==0) return(0); EVP_DecryptInit_ex(Data->dec_ctx,Data->Cipher,NULL,Data->Key,Data->InputVector); } -*/ -/* ctx=Data->dec_ctx; if (InLen==0) @@ -717,16 +714,17 @@ return(result); int zlibProcessorWrite(TProcessingModule *ProcMod, const char *InData, int InLen, char **OutData, int *OutLen, int Flush) { -int wrote=0, val=0; +int wrote=0; #ifdef HAVE_LIBZ +int val=0; zlibData *ZData; -if (ProcMod->Flags & DPM_WRITE_FINAL) return(EOF); +if (ProcMod->Flags & DPM_WRITE_FINAL) return(STREAM_CLOSED); ZData=(zlibData *) ProcMod->Data; ZData->z_out.avail_in=InLen; - ZData->z_out.next_in=InData; + ZData->z_out.next_in=(char *) InData; ZData->z_out.avail_out=*OutLen; ZData->z_out.next_out=*OutData; @@ -744,7 +742,6 @@ ZData=(zlibData *) ProcMod->Data; if ((ZData->z_out.avail_in > 0) || Flush) { - printf("Grow output buff!\n"); *OutLen+=BUFSIZ; *OutData=(char *) realloc(*OutData,*OutLen); ZData->z_out.avail_out+=BUFSIZ; @@ -761,16 +758,17 @@ return(wrote); int zlibProcessorRead(TProcessingModule *ProcMod, const char *InData, int InLen, char **OutData, int *OutLen, int Flush) { -int wrote=0, result=0; +int wrote=0; #ifdef HAVE_LIBZ +int result=0; zlibData *ZData; -if (ProcMod->Flags & DPM_READ_FINAL) return(EOF); +if (ProcMod->Flags & DPM_READ_FINAL) return(STREAM_CLOSED); ZData=(zlibData *) ProcMod->Data; ZData->z_in.avail_in=InLen; - ZData->z_in.next_in=InData; + ZData->z_in.next_in=(char *) InData; ZData->z_in.avail_out=*OutLen; ZData->z_in.next_out=*OutData; @@ -781,14 +779,17 @@ ZData=(zlibData *) ProcMod->Data; wrote=(*OutLen)-ZData->z_in.avail_out; + fprintf(stderr,"result=%d %d %d\n",result,InLen,Flush); - if (result==Z_DATA_ERROR) inflateSync(&ZData->z_in); - if (result==Z_STREAM_END) + switch (result) { - ProcMod->Flags |= DPM_READ_FINAL; - break; + case Z_DATA_ERROR: inflateSync(&ZData->z_in); break; + case Z_ERRNO: if (Flush) ProcMod->Flags |= DPM_READ_FINAL; break; + case Z_STREAM_ERROR: + case Z_STREAM_END: ProcMod->Flags |= DPM_READ_FINAL; break; } + if (ProcMod->Flags & DPM_READ_FINAL) break; if ((ZData->z_in.avail_in > 0) || Flush) { (*OutLen)+=BUFSIZ; @@ -800,7 +801,6 @@ ZData=(zlibData *) ProcMod->Data; } - #endif return(wrote); } @@ -863,27 +863,23 @@ return(TRUE); TProcessingModule *StandardDataProcessorCreate(const char *Class, const char *Name, const char *iArgs) { -TProcessingModule *Mod=NULL; char *Args=NULL; - +TProcessingModule *Mod=NULL; Args=CopyStr(Args,iArgs); - #ifdef HAVE_LIBSSL -#ifdef HAVE_LIBCRYPTO -if (strcasecmp(Class,"crypto")==0) -{ - Mod=(TProcessingModule *) calloc(1,sizeof(TProcessingModule)); - Mod->Args=CopyStr(Mod->Args,Args); - Mod->Name=CopyStr(Mod->Name,Name); - Mod->Init=libCryptoProcessorInit; - Mod->Write=libCryptoProcessorWrite; - Mod->Read=libCryptoProcessorRead; - Mod->Close=libCryptoProcessorClose; - - -} -#endif + #ifdef HAVE_LIBCRYPTO + if (strcasecmp(Class,"crypto")==0) + { + Mod=(TProcessingModule *) calloc(1,sizeof(TProcessingModule)); + Mod->Args=CopyStr(Mod->Args,Args); + Mod->Name=CopyStr(Mod->Name,Name); + Mod->Init=libCryptoProcessorInit; + Mod->Write=libCryptoProcessorWrite; + Mod->Read=libCryptoProcessorRead; + Mod->Close=libCryptoProcessorClose; + } + #endif #endif @@ -1016,7 +1012,6 @@ int STREAMDeleteDataProcessor(STREAM *S, char *Class, char *Name) { ListNode *Curr; char *Tempstr=NULL; -int len; STREAMFlush(S); @@ -1060,8 +1055,6 @@ return(FALSE); void STREAMClearDataProcessors(STREAM *S) { -TProcessingModule *Mod; - STREAMFlush(S); STREAMResetInputBuffers(S); ListDestroy(S->ProcessingModules, DataProcessorDestroy); diff --git a/libUseful-2.0/DataProcessing.h b/libUseful-2.4/DataProcessing.h similarity index 100% rename from libUseful-2.0/DataProcessing.h rename to libUseful-2.4/DataProcessing.h diff --git a/libUseful-2.4/DataProcessing.o b/libUseful-2.4/DataProcessing.o new file mode 100644 index 0000000..6bdbb05 Binary files /dev/null and b/libUseful-2.4/DataProcessing.o differ diff --git a/libUseful-2.0/Docs/ConnectManager.txt b/libUseful-2.4/Docs/ConnectManager.txt similarity index 100% rename from libUseful-2.0/Docs/ConnectManager.txt rename to libUseful-2.4/Docs/ConnectManager.txt diff --git a/libUseful-2.0/Docs/DataProcessing.txt b/libUseful-2.4/Docs/DataProcessing.txt similarity index 100% rename from libUseful-2.0/Docs/DataProcessing.txt rename to libUseful-2.4/Docs/DataProcessing.txt diff --git a/libUseful-2.0/Docs/EncryptedFiles.txt b/libUseful-2.4/Docs/EncryptedFiles.txt similarity index 100% rename from libUseful-2.0/Docs/EncryptedFiles.txt rename to libUseful-2.4/Docs/EncryptedFiles.txt diff --git a/libUseful-2.0/Docs/GeneralFunctions.txt b/libUseful-2.4/Docs/GeneralFunctions.txt similarity index 100% rename from libUseful-2.0/Docs/GeneralFunctions.txt rename to libUseful-2.4/Docs/GeneralFunctions.txt diff --git a/libUseful-2.0/Docs/Hash.txt b/libUseful-2.4/Docs/Hash.txt similarity index 100% rename from libUseful-2.0/Docs/Hash.txt rename to libUseful-2.4/Docs/Hash.txt diff --git a/libUseful-2.0/Docs/Log.txt b/libUseful-2.4/Docs/Log.txt similarity index 100% rename from libUseful-2.0/Docs/Log.txt rename to libUseful-2.4/Docs/Log.txt diff --git a/libUseful-2.0/Docs/directory b/libUseful-2.4/Docs/directory similarity index 100% rename from libUseful-2.0/Docs/directory rename to libUseful-2.4/Docs/directory diff --git a/libUseful-2.0/Docs/expect.txt b/libUseful-2.4/Docs/expect.txt similarity index 100% rename from libUseful-2.0/Docs/expect.txt rename to libUseful-2.4/Docs/expect.txt diff --git a/libUseful-2.0/Docs/file.txt b/libUseful-2.4/Docs/file.txt similarity index 100% rename from libUseful-2.0/Docs/file.txt rename to libUseful-2.4/Docs/file.txt diff --git a/libUseful-2.0/Docs/http.txt b/libUseful-2.4/Docs/http.txt similarity index 100% rename from libUseful-2.0/Docs/http.txt rename to libUseful-2.4/Docs/http.txt diff --git a/libUseful-2.0/Docs/includes.txt b/libUseful-2.4/Docs/includes.txt similarity index 100% rename from libUseful-2.0/Docs/includes.txt rename to libUseful-2.4/Docs/includes.txt diff --git a/libUseful-2.0/Docs/inet.txt b/libUseful-2.4/Docs/inet.txt similarity index 100% rename from libUseful-2.0/Docs/inet.txt rename to libUseful-2.4/Docs/inet.txt diff --git a/libUseful-2.0/Docs/list.txt b/libUseful-2.4/Docs/list.txt similarity index 100% rename from libUseful-2.0/Docs/list.txt rename to libUseful-2.4/Docs/list.txt diff --git a/libUseful-2.0/Docs/pty.txt b/libUseful-2.4/Docs/pty.txt similarity index 100% rename from libUseful-2.0/Docs/pty.txt rename to libUseful-2.4/Docs/pty.txt diff --git a/libUseful-2.0/Docs/socket.txt b/libUseful-2.4/Docs/socket.txt similarity index 100% rename from libUseful-2.0/Docs/socket.txt rename to libUseful-2.4/Docs/socket.txt diff --git a/libUseful-2.0/Docs/sound.txt b/libUseful-2.4/Docs/sound.txt similarity index 100% rename from libUseful-2.0/Docs/sound.txt rename to libUseful-2.4/Docs/sound.txt diff --git a/libUseful-2.0/Docs/string.txt b/libUseful-2.4/Docs/string.txt similarity index 100% rename from libUseful-2.0/Docs/string.txt rename to libUseful-2.4/Docs/string.txt diff --git a/libUseful-2.0/Docs/unix_socket.txt b/libUseful-2.4/Docs/unix_socket.txt similarity index 100% rename from libUseful-2.0/Docs/unix_socket.txt rename to libUseful-2.4/Docs/unix_socket.txt diff --git a/libUseful-2.0/EncryptedFiles.c b/libUseful-2.4/EncryptedFiles.c similarity index 85% rename from libUseful-2.0/EncryptedFiles.c rename to libUseful-2.4/EncryptedFiles.c index b83db13..18d38e5 100644 --- a/libUseful-2.0/EncryptedFiles.c +++ b/libUseful-2.4/EncryptedFiles.c @@ -43,18 +43,22 @@ int AddEncryptionHeader(STREAM *S, int Flags, const char *Cipher, const char *Ke { char *EncryptArgs=NULL; char *Tempstr=NULL; +int result=FALSE; - -EncryptArgs=FormatEncryptArgs(EncryptArgs,Flags, Cipher, "", InitVector,Salt); -Tempstr=FormatStr(Tempstr,"ENCR %s\n",EncryptArgs); -STREAMWriteLine(Tempstr,S); - EncryptArgs=FormatEncryptArgs(EncryptArgs,Flags, Cipher, Key, InitVector,Salt); -if (! STREAMAddStandardDataProcessor(S,"Crypto",Cipher,EncryptArgs)) printf("Failed to initialise encryption!\n"); +if (STREAMAddStandardDataProcessor(S,"Crypto",Cipher,EncryptArgs)) +{ + EncryptArgs=FormatEncryptArgs(EncryptArgs,Flags, Cipher, "", InitVector,Salt); + Tempstr=FormatStr(Tempstr,"ENCR %s\n",EncryptArgs); + STREAMWriteLine(Tempstr,S); + result=TRUE; +} DestroyString(Tempstr); DestroyString(EncryptArgs); + +return(result); } diff --git a/libUseful-2.0/EncryptedFiles.h b/libUseful-2.4/EncryptedFiles.h similarity index 96% rename from libUseful-2.0/EncryptedFiles.h rename to libUseful-2.4/EncryptedFiles.h index 2a2b360..bbeb0ff 100644 --- a/libUseful-2.0/EncryptedFiles.h +++ b/libUseful-2.4/EncryptedFiles.h @@ -9,7 +9,6 @@ #define FLAG_HEXKEY 4 #define FLAG_HEXIV 8 #define FLAG_HEXSALT 16 -#define FLAG_VERBOSE 32 #define FLAG_SPEED 64 #define FLAG_NOPAD_DATA 128 diff --git a/libUseful-2.4/EncryptedFiles.o b/libUseful-2.4/EncryptedFiles.o new file mode 100644 index 0000000..c5b1375 Binary files /dev/null and b/libUseful-2.4/EncryptedFiles.o differ diff --git a/libUseful-2.0/FileSystem.c b/libUseful-2.4/FileSystem.c similarity index 60% rename from libUseful-2.0/FileSystem.c rename to libUseful-2.4/FileSystem.c index 7e563f7..9809d49 100644 --- a/libUseful-2.0/FileSystem.c +++ b/libUseful-2.4/FileSystem.c @@ -50,11 +50,11 @@ return(DirPath); } -int MakeDirPath(char *Path, int DirMask) +int MakeDirPath(const char *Path, int DirMask) { - char *ptr; + const char *ptr; char *Tempstr=NULL; - int result; + int result=-1; ptr=Path; if (*ptr=='/') ptr++; @@ -73,7 +73,7 @@ int MakeDirPath(char *Path, int DirMask) -int ChangeFileExtension(char *FilePath, char *NewExt) +int ChangeFileExtension(const char *FilePath, const char *NewExt) { char *ptr; char *Tempstr=NULL; @@ -96,9 +96,9 @@ else return(FALSE); } -int FindFilesInPath(char *File, char *Path, ListNode *Files) +int FindFilesInPath(const char *File, const char *Path, ListNode *Files) { -char *Tempstr=NULL, *CurrPath=NULL, *RetStr=NULL, *ptr; +char *Tempstr=NULL, *CurrPath=NULL, *ptr; int i; glob_t Glob; @@ -128,7 +128,7 @@ return(ListSize(Files)); -char *FindFileInPath(char *InBuff, char *File, char *Path) +char *FindFileInPath(char *InBuff, const char *File, const char *Path) { char *Tempstr=NULL, *CurrPath=NULL, *RetStr=NULL, *ptr; @@ -163,7 +163,7 @@ return(RetStr); /* This checks if a certain file exists (not if we can open it etc, just if */ /* we can stat it, this is useful for checking pid files etc). */ -int FileExists(char *FileName) +int FileExists(const char *FileName) { struct stat StatData; @@ -171,3 +171,83 @@ if (stat(FileName,&StatData) == 0) return(1); else return(0); } + +#ifdef HAVE_FANOTIFY + +#include +#include +#include + + +/* ++ fd = fanotify_init (0, 0); ++ if (fd < 0 && 0) ++ { ++ if (errno == ENOSYS) ++ { ++ puts ("SKIP: missing support for fanotify (check CONFIG_FANOTIFY=y)"); ++ return 0; ++ } ++ ++ perror ("fanotify_init (0, 0) failed"); ++ return 1; ++ } ++ ++ ret = fanotify_mark (fd, FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_ACCESS ++ | FAN_MODIFY | FAN_OPEN | FAN_CLOSE | FAN_ONDIR ++ | FAN_EVENT_ON_CHILD, AT_FDCWD, "."); ++ if (ret) ++ { ++ perror ("fanotify_mark (...) failed"); ++ return 1; ++ } ++ ++ puts ("All OK"); ++ return 0; ++} +*/ + + +int FileNotifyInit(const char *Path, int Flags) +{ +char *Token=NULL, *ptr; +int fd; + +fd=fanotify_init(Flags, O_RDWR); +if (fd==-1) return(fd); + +ptr=GetToken(Path,":",&Token,0); +while (ptr) +{ + fanotify_mark(fd, FAN_MARK_ADD, FAN_CLOSE_WRITE, -1, NULL); + + ptr=GetToken(ptr,":",&Token,0); +} + +DestroyString(Token); + +return(fd); +} + + +int FileNotifyGetNext(int fd, char **Path) +{ +struct fanotify_event_metadata metadata; +char *Tempstr=NULL; +int result; + +result=read(fd, &metadata, sizeof(struct fanotify_event_metadata)); +if (result < sizeof(struct fanotify_event_metadata)) return(-1); + +if (Path) +{ + Tempstr=FormatStr(Tempstr, "/proc/self/fd/%d", metadata.fd); + *Path=SetStrLen(*Path,PATH_MAX +1); + readlink(Tempstr,*Path,PATH_MAX +1); +} + +DestroyString(Tempstr); +return(metadata.fd); +} + +#endif diff --git a/libUseful-2.4/FileSystem.h b/libUseful-2.4/FileSystem.h new file mode 100644 index 0000000..291a960 --- /dev/null +++ b/libUseful-2.4/FileSystem.h @@ -0,0 +1,31 @@ +#ifndef LIBUSEFUL_FILEPATH_H +#define LIBUSEFUL_FILEPATH_H + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char *GetBasename(char *Path); +char *SlashTerminateDirectoryPath(char *DirPath); +char *StripDirectorySlash(char *DirPath); +int FileExists(const char *); +int MakeDirPath(const char *Path, int DirMask); +int FindFilesInPath(const char *File, const char *Path, ListNode *Files); +char *FindFileInPath(char *InBuff, const char *File, const char *Path); +int ChangeFileExtension(const char *FilePath, const char *NewExt); +int FindFilesInPath(const char *File, const char *Path, ListNode *Files); + + +int FileNotifyInit(const char *Path, int Flags); +int FileNotifyGetNext(int fd, char **Path); + + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.4/FileSystem.o b/libUseful-2.4/FileSystem.o new file mode 100644 index 0000000..f7d8605 Binary files /dev/null and b/libUseful-2.4/FileSystem.o differ diff --git a/libUseful-2.4/GeneralFunctions.c b/libUseful-2.4/GeneralFunctions.c new file mode 100644 index 0000000..2680c77 --- /dev/null +++ b/libUseful-2.4/GeneralFunctions.c @@ -0,0 +1,527 @@ +#include "includes.h" +#include "base64.h" +#include "Hash.h" +#include "Time.h" +#include +#include +#include "base64.h" + +//xmemset uses a 'volatile' pointer so that it won't be optimized out +void xmemset(char *Str, char fill, off_t size) +{ +volatile char *p; + +for (p=Str; p < (Str+size); p++) *p=fill; +} + + +int WritePidFile(char *ProgName) +{ +char *Tempstr=NULL; +int fd; + + +if (*ProgName=='/') Tempstr=CopyStr(Tempstr,ProgName); +else Tempstr=FormatStr(Tempstr,"/var/run/%s.pid",ProgName); + +fd=open(Tempstr,O_CREAT | O_TRUNC | O_WRONLY,0600); +if (fd > -1) +{ + fchmod(fd,0644); + if (flock(fd,LOCK_EX|LOCK_NB) !=0) + { + close(fd); + exit(1); + } + Tempstr=FormatStr(Tempstr,"%d\n",getpid()); + write(fd,Tempstr,StrLen(Tempstr)); +} + +//Don't close 'fd'! + +DestroyString(Tempstr); + +return(fd); +} + + +void CloseOpenFiles() +{ + int i; + + for (i=3; i < 1024; i++) close(i); +} + + +char *BytesToHexStr(char *Buffer, char *Bytes, int len) +{ +int i; +char *Str=NULL, *ptr; + + +Str=SetStrLen(Buffer,(len *2) +1); +ptr=Str; +for (i=0; i < len; i++) +{ + snprintf(ptr,2,"%02x",Bytes[i]); + ptr+=2; +} +*ptr='\0'; + +return(Str); +} + + +int HexStrToBytes(char **Buffer, char *HexStr) +{ +int i, len; +char *Str=NULL, *ptr; + +len=StrLen(HexStr); +*Buffer=SetStrLen(*Buffer,len / 2); +ptr=*Buffer; +for (i=0; i < len; i+=2) +{ + Str=CopyStrLen(Str,HexStr+i,2); + *ptr=strtol(Str,NULL,16); + ptr++; +} + +DestroyString(Str); +return(len / 2); +} + + +char *Ascii85(char *RetStr, const char *Bytes, int ilen, const char *CharMap) +{ +const char *ptr, *block, *end; +uint32_t val, mod; +int olen=0, i; +char Buff[6]; + +end=Bytes+ilen; +for (ptr=Bytes; ptr < end; ) +{ + block=ptr; + val = ((*ptr & 0xFF) << 24); ptr++; + if (ptr < end) + { + val |= ((*ptr & 0xFF) << 16); ptr++; + } + + if (ptr < end) + { + val |= ((*ptr & 0xFF) << 8); ptr++; + } + + if (ptr < end) + { + val |= (*ptr & 0xFF); ptr++; + } + + if (val==0) strcpy(Buff,"z"); + else for (i=4; i >-1; i--) + { + mod=val % 85; + val /= 85; + Buff[i]=CharMap[mod & 0xFF]; + } + + //we only add as many characters as we encoded + //so for the last chracter + RetStr=CatStrLen(RetStr,Buff,ptr-block); +} +printf("\n"); + +return(RetStr); +} + + +char *EncodeBytes(char *Buffer, const char *Bytes, int len, int Encoding) +{ +char *Tempstr=NULL, *RetStr=NULL; +int i; + +RetStr=CopyStr(Buffer,""); +switch (Encoding) +{ + case ENCODE_BASE64: + RetStr=SetStrLen(RetStr,len * 4); + to64frombits((unsigned char *) RetStr,(unsigned char *) Bytes,len); break; + break; + + case ENCODE_IBASE64: + RetStr=SetStrLen(RetStr,len * 4); + Radix64frombits((unsigned char *) RetStr,(unsigned char *) Bytes,len,IBASE64_CHARS,'\0'); break; + break; + + case ENCODE_PBASE64: + RetStr=SetStrLen(RetStr,len * 4); + Radix64frombits((unsigned char *) RetStr,(unsigned char *) Bytes,len,SBASE64_CHARS,'\0'); break; + break; + + + case ENCODE_CRYPT: + RetStr=SetStrLen(RetStr,len * 4); + Radix64frombits((unsigned char *) RetStr,(unsigned char *) Bytes,len,CRYPT_CHARS,'\0'); break; + break; + + case ENCODE_XXENC: + RetStr=SetStrLen(RetStr,len * 4); + Radix64frombits((unsigned char *) RetStr,(unsigned char *) Bytes,len,XXENC_CHARS,'+'); break; + break; + + case ENCODE_UUENC: + RetStr=SetStrLen(RetStr,len * 4); + Radix64frombits((unsigned char *) RetStr,(unsigned char *) Bytes,len,UUENC_CHARS,'\''); break; + break; + + case ENCODE_ASCII85: + RetStr=Ascii85(RetStr,Bytes,len,ASCII85_CHARS); break; + break; + + case ENCODE_Z85: + RetStr=Ascii85(RetStr,Bytes,len,Z85_CHARS); break; + break; + + case ENCODE_OCTAL: + for (i=0; i < len; i++) + { + Tempstr=FormatStr(Tempstr,"%03o",Bytes[i] & 255); + RetStr=CatStr(RetStr,Tempstr); + } + break; + + case ENCODE_DECIMAL: + for (i=0; i < len; i++) + { + Tempstr=FormatStr(Tempstr,"%03d",Bytes[i] & 255); + RetStr=CatStr(RetStr,Tempstr); + } + break; + + case ENCODE_HEX: + for (i=0; i < len; i++) + { + Tempstr=FormatStr(Tempstr,"%02x",Bytes[i] & 255); + RetStr=CatStr(RetStr,Tempstr); + } + break; + + case ENCODE_HEXUPPER: + for (i=0; i < len; i++) + { + Tempstr=FormatStr(Tempstr,"%02X",Bytes[i] & 255); + RetStr=CatStr(RetStr,Tempstr); + } + break; + + + default: + RetStr=SetStrLen(RetStr,len ); + memcpy(RetStr,Bytes,len); + RetStr[len]='\0'; + break; +} + +DestroyString(Tempstr); +return(RetStr); +} + + + +#include +#include + +int SwitchUser(const char *NewUser) +{ +struct passwd *pwent; +char *ptr; + + pwent=getpwnam(NewUser); + if (! pwent) + { + syslog(LOG_ERR,"ERROR: Cannot switch to user '%s'. No such user",NewUser); + ptr=LibUsefulGetValue("SwitchUserAllowFail"); + if (ptr && (strcasecmp(ptr,"yes")==0)) return(FALSE); + exit(1); + } + + + if (setreuid(pwent->pw_uid,pwent->pw_uid) !=0) + { + syslog(LOG_ERR,"ERROR: Switch to user '%s' failed. Error was: %s",NewUser,strerror(errno)); + ptr=LibUsefulGetValue("SwitchUserAllowFail"); + if (ptr && (strcasecmp(ptr,"yes")==0)) return(FALSE); + exit(1); + } + + return(TRUE); +} + + +int SwitchGroup(const char *NewGroup) +{ +struct group *grent; +char *ptr; + + grent=getgrnam(NewGroup); + if (! grent) + { + syslog(LOG_ERR,"ERROR: Cannot switch to group '%s'. No such group",NewGroup); + ptr=LibUsefulGetValue("SwitchGroupAllowFail"); + if (ptr && (strcasecmp(ptr,"yes")==0)) return(FALSE); + exit(1); + } + + + if (setgid(grent->gr_gid) !=0) + { + syslog(LOG_ERR,"ERROR: Switch to group '%s' failed. Error was: %s",NewGroup,strerror(errno)); + ptr=LibUsefulGetValue("SwitchGroupAllowFail"); + if (ptr && (strcasecmp(ptr,"yes")==0)) return(FALSE); + exit(1); + } + + return(TRUE); +} + + + +char *GetCurrUserHomeDir() +{ +struct passwd *pwent; + + pwent=getpwuid(getuid()); + if (! pwent) return(NULL); + return(pwent->pw_dir); +} + + + +void ColLibDefaultSignalHandler(int sig) +{ + +} + + +int CreateLockFile(char *FilePath, int Timeout) +{ +int fd, result; + +SetTimeout(Timeout); +fd=open(FilePath, O_CREAT | O_RDWR, 0600); +if (fd <0) return(-1); +result=flock(fd,LOCK_EX); +alarm(0); + +if (result==-1) +{ + close(fd); + return(-1); +} +return(fd); +} + + + +int GenerateRandomBytes(char **RetBuff, int ReqLen, int Encoding) +{ +struct utsname uts; +int i, len; +clock_t ClocksStart, ClocksEnd; +char *Tempstr=NULL, *RandomBytes=NULL; +int fd; + + +fd=open("/dev/urandom",O_RDONLY); +if (fd > -1) +{ + RandomBytes=SetStrLen(RandomBytes,ReqLen); + len=read(fd,RandomBytes,ReqLen); + close(fd); +} +else +{ + ClocksStart=clock(); + //how many clock cycles used here will depend on overall + //machine activity/performance/number of running processes + for (i=0; i < 100; i++) sleep(0); + uname(&uts); + ClocksEnd=clock(); + + + Tempstr=FormatStr(Tempstr,"%lu:%lu:%lu:%lu:%llu\n",getpid(),getuid(),ClocksStart,ClocksEnd,GetTime(TIME_MILLISECS)); + //This stuff should be unique to a machine + Tempstr=CatStr(Tempstr, uts.sysname); + Tempstr=CatStr(Tempstr, uts.nodename); + Tempstr=CatStr(Tempstr, uts.machine); + Tempstr=CatStr(Tempstr, uts.release); + Tempstr=CatStr(Tempstr, uts.version); + + + len=HashBytes(&RandomBytes, "sha256", Tempstr, StrLen(Tempstr), 0); + if (len > ReqLen) len=ReqLen; +} + + +*RetBuff=EncodeBytes(*RetBuff, RandomBytes, len, Encoding); + +DestroyString(Tempstr); +DestroyString(RandomBytes); + +return(len); +} + + + + +char *GetRandomData(char *RetBuff, int len, char *AllowedChars) +{ +int fd; +char *Tempstr=NULL, *RetStr=NULL; +int i; +uint8_t val, max_val; + +srand(time(NULL)); +max_val=StrLen(AllowedChars); + +RetStr=CopyStr(RetBuff,""); +fd=open("/dev/urandom",O_RDONLY); +for (i=0; i < len ; i++) +{ + if (fd > -1) read(fd,&val,1); + else val=rand(); + + RetStr=AddCharToStr(RetStr,AllowedChars[val % max_val]); +} + +if (fd) close(fd); + +DestroyString(Tempstr); +return(RetStr); +} + + +char *GetRandomHexStr(char *RetBuff, int len) +{ +return(GetRandomData(RetBuff,len,HEX_CHARS)); +} + + +char *GetRandomAlphabetStr(char *RetBuff, int len) +{ +return(GetRandomData(RetBuff,len,ALPHA_CHARS)); +} + + + + + +#define KILOBYTE 1000 +#define MEGABYTE 1000000 +#define GIGABYTE 1000000000 +#define TERABYTE 1000000000000 + +#define KIBIBYTE 1024 +#define MEGIBYTE 1024 * 1024 +#define GIGIBYTE 1024 * 1024 * 1024 +#define TERIBYTE 1024 * 1024 * 1024 *1024 + +double ParseHumanReadableDataQty(char *Data, int Type) +{ +double val; +char *ptr=NULL; +double KAY,MEG,GIG,TERA; + +if (Type) +{ +KAY=KILOBYTE; +MEG=MEGABYTE; +GIG=GIGABYTE; +TERA=TERABYTE; +} +else +{ +KAY=KIBIBYTE; +MEG=MEGIBYTE; +GIG=GIGIBYTE; +TERA=TERIBYTE; +} + + val=strtod(Data,&ptr); + while (isspace(*ptr)) ptr++; + if (*ptr=='k') val=val * KAY; + if (*ptr=='M') val=val * MEG; + if (*ptr=='G') val=val * GIG; + if (*ptr=='T') val=val * TERA; + + +return(val); +} + + + +char *GetHumanReadableDataQty(double Size, int Type) +{ +static char *Str=NULL; +double val=0; +char kMGT=' '; +//Set to 0 to keep valgrind happy +double KAY=0,MEG=0,GIG=0,TERA=0; + +if (Type) +{ +KAY=KILOBYTE; +MEG=MEGABYTE; +GIG=GIGABYTE; +//TERA=TERABYTE; +} +else +{ +KAY=KIBIBYTE; +MEG=MEGIBYTE; +GIG=GIGIBYTE; +//TERA=TERIBYTE; +} + val=Size; + kMGT=' '; +/* if (val > (TERA)) + { + val=val / TERA; + kMGT='T'; + } + else*/ + if (val >= (GIG)) + { + val=val / GIG; + kMGT='G'; + } + else if (val >= (MEG)) + { + val=val / MEG; + kMGT='M'; + + } + else if (val >= (KAY)) + { + val=val / KAY; + kMGT='k'; + } + +Str=FormatStr(Str,"%0.1f%c",(float) val,kMGT); +return(Str); +} + + + +char *DecodeBase64(char *Return, int *len, char *Text) +{ +char *RetStr; + +RetStr=SetStrLen(Return,StrLen(Text) *2); +*len=from64tobits(RetStr,Text); + +return(RetStr); +} + diff --git a/libUseful-2.0/GeneralFunctions.h b/libUseful-2.4/GeneralFunctions.h similarity index 74% rename from libUseful-2.0/GeneralFunctions.h rename to libUseful-2.4/GeneralFunctions.h index 839ab13..f5fa8bf 100644 --- a/libUseful-2.0/GeneralFunctions.h +++ b/libUseful-2.4/GeneralFunctions.h @@ -10,13 +10,15 @@ extern "C" { #endif +void xmemset(char *Str, char fill, off_t size); int WritePidFile(char *ProgName); int HexStrToBytes(char **Buffer, char *HexStr); char *BytesToHexStr(char *Buffer, char *Bytes, int len); +char *EncodeBytes(char *Buffer, const char *Bytes, int len, int Encoding); -void SwitchProgram(char *CommandLine); -int SwitchUser(char *User); -int SwitchGroup(char *Group); + +int SwitchUser(const char *User); +int SwitchGroup(const char *Group); char *GetCurrUserHomeDir(); @@ -31,12 +33,11 @@ void CloseOpenFiles(); int BASIC_FUNC_EXEC_COMMAND(void *Data); - -char *GetNameValuePair(const char *Input, const char *PairDelim, const char *NameValueDelim, char **Name, char **Value); double ParseHumanReadableDataQty(char *Data, int Type); char *GetHumanReadableDataQty(double Size, int Type); -void EraseString(char *Buff, char *Target); + +int GenerateRandomBytes(char **RetBuff, int ReqLen, int Encoding); #ifdef __cplusplus diff --git a/libUseful-2.4/GeneralFunctions.o b/libUseful-2.4/GeneralFunctions.o new file mode 100644 index 0000000..b882f7e Binary files /dev/null and b/libUseful-2.4/GeneralFunctions.o differ diff --git a/libUseful-2.4/Hash.c b/libUseful-2.4/Hash.c new file mode 100644 index 0000000..9f62945 --- /dev/null +++ b/libUseful-2.4/Hash.c @@ -0,0 +1,648 @@ +#include "Hash.h" +#include "string.h" + +#define HMAC_BLOCKSIZE 64 + + +typedef void (*HASH_INIT_FUNC)(THash *Hash, int Len); + + +char *HashTypes[]={"md5","sha1","sha256","sha512","whirlpool","jh-224","jh-256","jh-384","jh-512",NULL}; + + +void HMACUpdate(THash *HMAC, char *Data, int Len) +{ +THash *Hash; + +Hash=(THash *) HMAC->Ctx; +Hash->Update(Hash,Data,Len); +} + + + +int HMACFinish(THash *HMAC, int Encoding, char **HashStr) +{ +THash *Hash; +int len, result; + + +Hash=(THash *) HMAC->Ctx; + +//We've done with this now, blank it and reuse for the inner result +HMAC->Key1=CopyStr(HMAC->Key1,""); +len=Hash->Finish(Hash,0,&HMAC->Key1); + +HMAC->Key2=SetStrLen(HMAC->Key2,HMAC_BLOCKSIZE+len); +memcpy(HMAC->Key2+HMAC_BLOCKSIZE,HMAC->Key1,len); + +//Hash->Type +result=HashBytes(HashStr,Hash->Type,HMAC->Key2,HMAC_BLOCKSIZE+len,Encoding); + +return(result); +} + + +void HMACPrepare(THash *HMAC, char *Data, int Len) +{ +int i; +char *Key=NULL, *Tempstr=NULL; + +//Whatever we've been given as a key, we have to turn it into a +//key of 'HMAC_BLOCKSIZE', either by hashing it to make it shorter +//or by padding with NULLS +Key=SetStrLen(Key,HMAC_BLOCKSIZE); +memset(Key,0,HMAC_BLOCKSIZE); + +if (Len > HMAC_BLOCKSIZE) +{ + HMAC->Key1Len=HashBytes(&Tempstr,HMAC->Type,HMAC->Key1,HMAC->Key1Len,0); + memcpy(Key,Tempstr,HMAC->Key1Len); +} +else +{ + memcpy(Key,HMAC->Key1,HMAC->Key1Len); +} + +HMAC->Key1=SetStrLen(HMAC->Key1,HMAC_BLOCKSIZE); +HMAC->Key2=SetStrLen(HMAC->Key2,HMAC_BLOCKSIZE); +HMAC->Key1Len=HMAC_BLOCKSIZE; +HMAC->Key2Len=HMAC_BLOCKSIZE; + +for (i=0; i < HMAC_BLOCKSIZE; i++) +{ +//inner key +HMAC->Key1[i]=Key[i] ^ 0x36; +//outer key +HMAC->Key2[i]=Key[i] ^ 0x5c; +} + + +//first thing to be hashed is the inner key, then data is 'concatted' onto it +HMACUpdate(HMAC, HMAC->Key1, HMAC->Key1Len); +HMACUpdate(HMAC, Data, Len); +HMAC->Update=HMACUpdate; + +DestroyString(Tempstr); +DestroyString(Key); +} + + +void HMACInit(THash *Hash) +{ +Hash->Ctx=(void *) HashInit(Hash->Type+5); + +Hash->Update=HMACPrepare; +Hash->Finish=HMACFinish; +} + + +void HMACSetKey(THash *HMAC, char *Key, int Len) +{ +HMAC->Key1=SetStrLen(HMAC->Key1,Len); +memcpy(HMAC->Key1,Key,Len); +HMAC->Key1Len=Len; +} + + + + + +#include "crc32.h" + +void HashUpdateCRC(THash *Hash, char *Data, int Len) +{ +crc32Update((unsigned long *) &Hash->Ctx, (unsigned char *) Data, Len); +} + + +THash *HashCloneCRC(THash *Hash) +{ +THash *NewHash; + +NewHash=(THash *) calloc(1,sizeof(THash)); +NewHash->Type=CopyStr(NewHash->Type,Hash->Type); +NewHash->Ctx=(void *) calloc(1,sizeof(unsigned long)); +memcpy(NewHash->Ctx, Hash->Ctx, sizeof(unsigned long)); + +return(NewHash); +} + + +int HashFinishCRC(THash *Hash, int Encoding, char **HashStr) +{ +unsigned long crc; +int len; + +len=sizeof(unsigned long); +crc32Finish((unsigned long *) Hash->Ctx); +crc=htonl(* (unsigned long *) Hash->Ctx); + +if (Encoding > 0) +{ + *HashStr=EncodeBytes(*HashStr, (char *) &crc, len, Encoding); + return(StrLen(*HashStr)); +} +else +{ + *HashStr=SetStrLen(*HashStr,len); + memcpy(*HashStr,&crc,len); + return(len); +} +} + + +void HashInitCRC(THash *Hash, int Len) +{ +Hash->Ctx=(void *) calloc(1,sizeof(unsigned long)); +crc32Init((unsigned long *) Hash->Ctx); +Hash->Update=HashUpdateCRC; +Hash->Finish=HashFinishCRC; +Hash->Clone=HashCloneCRC; +} + + +#include "md5.h" +#define MD5LEN 16 + +void HashUpdateMD5(THash *Hash, char *Data, int Len) +{ +MD5Update((MD5_CTX *) Hash->Ctx, Data, Len); +} + + +THash *HashCloneMD5(THash *Hash) +{ +THash *NewHash; + +NewHash=(THash *) calloc(1,sizeof(THash)); +NewHash->Type=CopyStr(NewHash->Type,Hash->Type); +NewHash->Ctx=(void *) calloc(1,sizeof(MD5_CTX)); +memcpy(NewHash->Ctx, Hash->Ctx, sizeof(MD5_CTX)); +NewHash->Update=Hash->Update; +NewHash->Finish=Hash->Finish; +NewHash->Clone=Hash->Clone; + +return(NewHash); +} + + +int HashFinishMD5(THash *Hash, int Encoding, char **HashStr) +{ +int len; +char *Tempstr=NULL, *DigestBuff=NULL; + +DigestBuff=(char *) calloc(1,MD5LEN+1); +MD5Final((unsigned char *) DigestBuff, (MD5_CTX *) Hash->Ctx); + +if (Encoding > 0) +{ + *HashStr=EncodeBytes(*HashStr, DigestBuff, MD5LEN, Encoding); + len=StrLen(*HashStr); +} +else +{ + len=MD5LEN; + *HashStr=SetStrLen(*HashStr,len); + memcpy(*HashStr,DigestBuff,len); +} + +DestroyString(DigestBuff); +DestroyString(Tempstr); + +return(len); +} + + +void HashInitMD5(THash *Hash, int Len) +{ +Hash->Ctx=(void *) calloc(1,sizeof(MD5_CTX)); +MD5Init((MD5_CTX *) Hash->Ctx); +Hash->Update=HashUpdateMD5; +Hash->Finish=HashFinishMD5; +Hash->Clone=HashCloneMD5; +} + +#include "sha1.h" +#define SHA1LEN 20 + +void HashUpdateSHA1(THash *Hash, char *Data, int Len) +{ +sha1_process_bytes(Data,Len,(struct sha1_ctx *) Hash->Ctx); +} + + +THash *HashCloneSHA1(THash *Hash) +{ +THash *NewHash; + +NewHash=(THash *) calloc(1,sizeof(THash)); +NewHash->Type=CopyStr(NewHash->Type,Hash->Type); +NewHash->Ctx=(void *) calloc(1,sizeof(struct sha1_ctx)); +memcpy(NewHash->Ctx, Hash->Ctx, sizeof(struct sha1_ctx)); + +return(NewHash); +} + + +int HashFinishSHA1(THash *Hash, int Encoding, char **HashStr) +{ +int len; +char *Tempstr=NULL, *DigestBuff=NULL; + +DigestBuff=(char *) calloc(1,SHA1LEN+1); +sha1_finish_ctx((struct sha1_ctx *) Hash->Ctx, DigestBuff); + +if (Encoding > 0) +{ + *HashStr=EncodeBytes(*HashStr, DigestBuff, SHA1LEN, Encoding); + len=StrLen(*HashStr); +} +else +{ +len=SHA1LEN; +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,DigestBuff,len); +} + +DestroyString(DigestBuff); +DestroyString(Tempstr); + +return(len); +} + + + +#include "sha2.h" + +int HashFinishSHA256(THash *Hash, int Encoding, char **HashStr) +{ +int len; +char *Tempstr=NULL; +char *DigestBuff=NULL; + +DigestBuff=(char *) calloc(1,SHA2_SHA256_DIGEST_LENGTH+1); +SHA2_SHA256_Final((unsigned char *) DigestBuff, (SHA2_SHA256_CTX *) Hash->Ctx); + +if (Encoding > 0) +{ + *HashStr=EncodeBytes(*HashStr, DigestBuff, SHA2_SHA256_DIGEST_LENGTH, Encoding); + len=StrLen(*HashStr); +} +else +{ + len=SHA2_SHA256_DIGEST_LENGTH; + *HashStr=SetStrLen(*HashStr,len); + memcpy(*HashStr,DigestBuff,len); +} + +DestroyString(DigestBuff); +DestroyString(Tempstr); + +return(len); +} + + +THash *HashCloneSHA256(THash *Hash) +{ +THash *NewHash; + +NewHash=(THash *) calloc(1,sizeof(THash)); +NewHash->Type=CopyStr(NewHash->Type,Hash->Type); +NewHash->Ctx=(void *) calloc(1,sizeof(SHA2_SHA256_CTX)); +memcpy(NewHash->Ctx, Hash->Ctx, sizeof(SHA2_SHA256_CTX)); + +return(NewHash); +} + + +void HashUpdateSHA256(THash *Hash, char *Data, int Len) +{ +SHA2_SHA256_Update((SHA2_SHA256_CTX *) Hash->Ctx, (unsigned char *) Data, Len); +} + + +int HashFinishSHA512(THash *Hash, int Encoding, char **HashStr) +{ +int len; +char *Tempstr=NULL, *DigestBuff=NULL; + +DigestBuff=(char *) calloc(1,SHA2_SHA512_DIGEST_LENGTH+1); +SHA2_SHA512_Final((unsigned char *) DigestBuff, (SHA2_SHA512_CTX *) Hash->Ctx); + +if (Encoding > 0) +{ + *HashStr=EncodeBytes(*HashStr, DigestBuff, SHA2_SHA512_DIGEST_LENGTH, Encoding); + len=StrLen(*HashStr); +} +else +{ +len=SHA2_SHA512_DIGEST_LENGTH; +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,DigestBuff,len); +} + +DestroyString(DigestBuff); +DestroyString(Tempstr); + +return(len); +} + + +void HashUpdateSHA512(THash *Hash, char *Data, int Len) +{ +SHA2_SHA512_Update((SHA2_SHA512_CTX *) Hash->Ctx, (unsigned char *) Data, Len); +} + + +THash *HashCloneSHA512(THash *Hash) +{ +THash *NewHash; + +NewHash=(THash *) calloc(1,sizeof(THash)); +NewHash->Type=CopyStr(NewHash->Type,Hash->Type); +NewHash->Ctx=(void *) calloc(1,sizeof(SHA2_SHA512_CTX)); +memcpy(NewHash->Ctx, Hash->Ctx, sizeof(SHA2_SHA512_CTX)); + +return(NewHash); +} + + + + +void HashInitSHA(THash *Hash, int Len) +{ + +switch (Len) +{ +case 512: +Hash->Ctx=(void *) calloc(1,sizeof(SHA2_SHA512_CTX)); +SHA2_SHA512_Init((SHA2_SHA512_CTX *) Hash->Ctx); +Hash->Update=HashUpdateSHA512; +Hash->Finish=HashFinishSHA512; +Hash->Clone=HashCloneSHA512; +break; + +case 256: +Hash->Ctx=(void *) calloc(1,sizeof(SHA2_SHA256_CTX)); +SHA2_SHA256_Init((SHA2_SHA256_CTX *) Hash->Ctx); +Hash->Update=HashUpdateSHA256; +Hash->Finish=HashFinishSHA256; +Hash->Clone=HashCloneSHA256; +break; + +default: +Hash->Ctx=(void *) calloc(1,sizeof(struct sha1_ctx)); +sha1_init_ctx((struct sha1_ctx *) Hash->Ctx); +Hash->Update=HashUpdateSHA1; +Hash->Finish=HashFinishSHA1; +Hash->Clone=HashCloneSHA1; +break; +} + +} + + + +#include "whirlpool.h" + +int HashFinishWhirlpool(THash *Hash, int Encoding, char **HashStr) +{ +int len; +char *Tempstr=NULL, *DigestBuff=NULL; + +DigestBuff=(char *) calloc(1,WHIRLPOOL_DIGESTBYTES+1); +WHIRLPOOLfinalize((WHIRLPOOLstruct *) Hash->Ctx, (unsigned char *) DigestBuff); + +if (Encoding > 0) +{ + *HashStr=EncodeBytes(*HashStr, DigestBuff, WHIRLPOOL_DIGESTBYTES, Encoding); + len=StrLen(*HashStr); +} +else +{ +len=WHIRLPOOL_DIGESTBYTES; +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,DigestBuff,len); +} + +DestroyString(DigestBuff); +DestroyString(Tempstr); + +return(len); +} + + +void HashUpdateWhirlpool(THash *Hash, char *Data, int Len) +{ +WHIRLPOOLadd((unsigned char *) Data, Len * 8, (WHIRLPOOLstruct *) Hash->Ctx); +} + + +THash *HashCloneWhirlpool(THash *Hash) +{ +THash *NewHash; + +NewHash=(THash *) calloc(1,sizeof(THash)); +NewHash->Type=CopyStr(NewHash->Type,Hash->Type); +NewHash->Ctx=(void *) calloc(1,sizeof(WHIRLPOOLstruct *)); +memcpy(NewHash->Ctx, Hash->Ctx, sizeof(WHIRLPOOLstruct *)); + +return(NewHash); +} + + + +void HashInitWhirlpool(THash *Hash, int Len) +{ +Hash->Ctx=(void *) calloc(1,sizeof(WHIRLPOOLstruct)); +WHIRLPOOLinit((WHIRLPOOLstruct *) Hash->Ctx); +Hash->Update=HashUpdateWhirlpool; +Hash->Finish=HashFinishWhirlpool; +Hash->Clone=HashCloneWhirlpool; +} + + +#include "jh_ref.h" + +int HashFinishJH(THash *Hash, int Encoding, char **HashStr) +{ +int len; +char *Tempstr=NULL, *DigestBuff=NULL; + +DigestBuff=(char *) calloc(1,1024); + +len=JHFinal((hashState *) Hash->Ctx, (unsigned char *) DigestBuff); + +if (Encoding > 0) +{ + *HashStr=EncodeBytes(*HashStr, DigestBuff, len, Encoding); + len=StrLen(*HashStr); +} +else +{ + *HashStr=SetStrLen(*HashStr,len); + memcpy(*HashStr,DigestBuff,len); +} + +DestroyString(DigestBuff); +DestroyString(Tempstr); + +return(len); +} + + + +void HashUpdateJH(THash *Hash, char *Data, int Len) +{ + JHUpdate( (hashState *) Hash->Ctx, (unsigned char *) Data, Len); +} + + +THash *HashCloneJH(THash *Hash) +{ +THash *NewHash; + +NewHash=(THash *) calloc(1,sizeof(THash)); +NewHash->Type=CopyStr(NewHash->Type,Hash->Type); +NewHash->Ctx=(void *) calloc(1,sizeof(hashState *)); +memcpy(NewHash->Ctx, Hash->Ctx, sizeof(hashState *)); + +return(NewHash); +} + + + +int HashInitJH(THash *Hash, int Length) +{ + +switch (Length) +{ + case 224: + case 256: + case 384: + case 512: + Hash->Ctx=(void *) calloc(1,sizeof(hashState)); + JHInit((hashState *) Hash->Ctx, Length); + Hash->Update=HashUpdateJH; + Hash->Finish=HashFinishJH; + Hash->Clone=HashCloneJH; + break; + + default: + return(FALSE); + break; +} + +return(TRUE); +} + + + + + + + +void HashDestroy(THash *Hash) +{ +//Hash->Ctx is destroyed in 'HashFinish' +DestroyString(Hash->Key1); +DestroyString(Hash->Key2); +DestroyString(Hash->Type); +if (Hash->Ctx) free(Hash->Ctx); +free(Hash); +} + + +void HashAvailableTypes(ListNode *Vars) +{ +int i; + +for (i=0; HashTypes[i] !=NULL; i++) SetVar(Vars,HashTypes[i], HashTypes[i]); + +} + + +THash *HashInit(char *Type) +{ +THash *Hash=NULL; + +Hash=(THash *) calloc(1,sizeof(THash)); +Hash->Type=CopyStr(Hash->Type,Type); +if (strcasecmp(Type,"md5")==0) HashInitMD5(Hash, 0); +else if (strcasecmp(Type,"sha")==0) HashInitSHA(Hash, 0); +else if (strcasecmp(Type,"sha1")==0) HashInitSHA(Hash, 0); +else if (strcasecmp(Type,"sha256")==0) HashInitSHA(Hash, 256); +else if (strcasecmp(Type,"sha512")==0) HashInitSHA(Hash, 512); +else if (strcasecmp(Type,"whirl")==0) HashInitWhirlpool(Hash, 0); +else if (strcasecmp(Type,"whirlpool")==0) HashInitWhirlpool(Hash, 0); +else if (strcasecmp(Type,"jh-224")==0) HashInitJH(Hash,224); +else if (strcasecmp(Type,"jh-256")==0) HashInitJH(Hash,256); +else if (strcasecmp(Type,"jh-384")==0) HashInitJH(Hash,384); +else if (strcasecmp(Type,"jh-512")==0) HashInitJH(Hash,512); +//else if (strcasecmp(Type,"crc32")==0) HashInitCRC(Hash, 0); +else if (strncasecmp(Type,"hmac-",5)==0) HMACInit(Hash); +else +{ + HashDestroy(Hash); + Hash=NULL; +} + +return(Hash); +} + + + + +int HashBytes(char **Return, char *Type, char *text, int len, int Encoding) +{ +THash *Hash; +int result; + +Hash=HashInit(Type); +if (! Hash) return(0); +Hash->Update(Hash, text, len); +result=Hash->Finish(Hash, Encoding, Return); +HashDestroy(Hash); + +return(result); +} + + +int HashFile(char **Return, char *Type, char *Path, int Encoding) +{ +THash *Hash; +STREAM *S; +char *Tempstr=NULL; +int result; + +S=STREAMOpenFile(Path,SF_RDONLY); +if (! S) return(FALSE); + +Hash=HashInit(Type); +if (! Hash) +{ + STREAMClose(S); + return(FALSE); +} + + +Tempstr=SetStrLen(Tempstr,4096); +result=STREAMReadBytes(S,Tempstr,4096); +while (result !=EOF) +{ + Hash->Update(Hash, Tempstr, result); + result=STREAMReadBytes(S,Tempstr,4096); +} + +DestroyString(Tempstr); +STREAMClose(S); + +result=Hash->Finish(Hash, Encoding, Return); +HashDestroy(Hash); + +return(result); +} + + + + diff --git a/libUseful-2.0/Hash.h b/libUseful-2.4/Hash.h similarity index 71% rename from libUseful-2.0/Hash.h rename to libUseful-2.4/Hash.h index 910e607..5039951 100644 --- a/libUseful-2.0/Hash.h +++ b/libUseful-2.4/Hash.h @@ -5,9 +5,6 @@ #include "includes.h" -#define ENCODE_HEX 1 -#define ENCODE_BASE64 2 - #ifdef __cplusplus extern "C" { #endif @@ -15,23 +12,28 @@ extern "C" { typedef struct t_hash THash; typedef void (*HASH_UPDATE)(THash *Hash, char *Data, int DataLen); +typedef THash *(*HASH_CLONE)(THash *Hash); typedef int (*HASH_FINISH)(THash *Hash, int Encoding, char **RetStr); struct t_hash { char *Type; +char *Key1; +unsigned int Key1Len; +char *Key2; +unsigned int Key2Len; void *Ctx; HASH_UPDATE Update; HASH_FINISH Finish; +HASH_CLONE Clone; }; +void HashAvailableTypes(ListNode *Vars); THash *HashInit(char *Type); +void HMACSetKey(THash *HMAC, char *Key, int Len); void HashDestroy(THash *Hash); -char *EncodeBase64(char *Return, char *Text, int len); -char *DecodeBase64(char *Return, int *len, char *Text); int HashBytes(char **Return, char *Type, char *text, int len, int Encoding); int HashFile(char **Return, char *Type, char *Path, int Encoding); -int HMAC(char **Return, char *Algo, char *iKey, int iKeyLen, char *iText, int iTextLen); #ifdef __cplusplus } diff --git a/libUseful-2.4/Hash.o b/libUseful-2.4/Hash.o new file mode 100644 index 0000000..dff84a1 Binary files /dev/null and b/libUseful-2.4/Hash.o differ diff --git a/libUseful-2.0/LICENCE b/libUseful-2.4/LICENCE similarity index 100% rename from libUseful-2.0/LICENCE rename to libUseful-2.4/LICENCE diff --git a/libUseful-2.0/Log.c b/libUseful-2.4/Log.c similarity index 50% rename from libUseful-2.0/Log.c rename to libUseful-2.4/Log.c index 18b10eb..8ec8a9b 100644 --- a/libUseful-2.0/Log.c +++ b/libUseful-2.4/Log.c @@ -1,9 +1,8 @@ #include "Log.h" +#include "Time.h" #include -char *G_LogFilePath; - //When logs are used by 'child processes', it's only the 'parent' process that should be //able to delete/reopen the log. Otherwise the child can delete a log that the parent @@ -11,32 +10,26 @@ char *G_LogFilePath; pid_t ParentPID=0; -typedef struct -{ - char *Path; - int Flags; - int MaxSize; - STREAM *S; - int LogFacility; - int LastFlushTime; - int FlushInterval; -} TLogFile; - ListNode *LogFiles=NULL; TLogFile *LogFileDefaults=NULL; -void LogFileSetupDefaults() +STREAM *LogFileInternalDoRotate(TLogFile *LogFile); + + +int LogFileSetDefaults(int Flags, int MaxSize, int MaxRotate, int FlushInterval) { LogFileDefaults=(TLogFile *) calloc(1,sizeof(TLogFile)); - LogFileDefaults->MaxSize=100000000; - LogFileDefaults->Flags |= LOGFILE_FLUSH | LOGFILE_LOGPID | LOGFILE_LOGUSER; + LogFileDefaults->Flags=Flags; + LogFileDefaults->MaxSize=MaxSize; + LogFileDefaults->MaxRotate=MaxRotate; + LogFileDefaults->FlushInterval=FlushInterval; LogFileDefaults->LogFacility=LOG_USER; if (ParentPID==0) ParentPID=getpid(); } -TLogFile *LogFileGetEntry(char *FileName) +TLogFile *LogFileGetEntry(const char *FileName) { ListNode *Node; TLogFile *LogFile=NULL; @@ -44,7 +37,7 @@ TLogFile *LogFileGetEntry(char *FileName) if (! StrLen(FileName)) return(NULL); if (! LogFiles) LogFiles=ListCreate(); - if (! LogFileDefaults) LogFileSetupDefaults(); + if (! LogFileDefaults) LogFileSetDefaults(LOGFILE_TIMESTAMP | LOGFILE_FLUSH | LOGFILE_LOGPID | LOGFILE_LOGUSER, 100000000, 0, 1); Node=ListFindNamedItem(LogFiles,FileName); if (Node) LogFile=(TLogFile *) Node->Item; @@ -55,8 +48,7 @@ TLogFile *LogFileGetEntry(char *FileName) else if (strcmp(FileName,"SYSLOG")==0) S=STREAMCreate(); else { - S=STREAMOpenFile(FileName,O_CREAT | O_APPEND | O_WRONLY); - S->Flags &= ~FLUSH_ALWAYS; + S=STREAMOpenFile(FileName,SF_CREAT | SF_APPEND | SF_WRONLY | SF_NOCACHE); } if (S) @@ -66,17 +58,26 @@ TLogFile *LogFileGetEntry(char *FileName) LogFile->LogFacility=LogFileDefaults->LogFacility; LogFile->Flags=LogFileDefaults->Flags; LogFile->MaxSize=LogFileDefaults->MaxSize; + LogFile->MaxRotate=LogFileDefaults->MaxRotate; + LogFile->FlushInterval=LogFileDefaults->FlushInterval; LogFile->S=S; + if (strcmp(FileName,"SYSLOG")==0) LogFile->Flags |= LOGFILE_SYSLOG; ListAddNamedItem(LogFiles,FileName,LogFile); STREAMSetItem(S,"TLogFile",LogFile); + STREAMSetFlushType(S, FLUSH_FULL, 0, 0); + + //it might already be too big! + LogFile->S=LogFileInternalDoRotate(LogFile); } } return(LogFile); } -void LogFileClose(char *Path) + + +void LogFileClose(const char *Path) { ListNode *Node; TLogFile *LogFile; @@ -92,75 +93,128 @@ free(LogFile); } } -void LogFileInternalDoRotate(TLogFile *LogFile) + +char *LogFileInternalGetRotateDestinationPath(char *RetStr, TLogFile *LogFile) +{ +char *Tempstr=NULL; + + Tempstr=CopyStr(Tempstr, STREAMGetValue(LogFile->S,"RotatePath")); + if (StrLen(Tempstr) && strchr(Tempstr,'$')) + { + STREAMSetValue(LogFile->S, "Date",GetDateStr("%Y_%m_%d",NULL)); + STREAMSetValue(LogFile->S, "Time",GetDateStr("%H:%M:%S",NULL)); + RetStr=SubstituteVarsInString(RetStr,Tempstr,LogFile->S->Values,0); + } + else RetStr=CopyStr(RetStr,LogFile->Path); + + DestroyString(Tempstr); + +return(RetStr); +} + + +STREAM *LogFileInternalDoRotate(TLogFile *LogFile) { struct stat FStat; - char *Tempstr=NULL; + char *Tempstr=NULL, *Path=NULL, *PrevPath=NULL; + int i; - if (! LogFile) return; - if (strcmp(LogFile->Path,"SYSLOG")==0) return; - if (strcmp(LogFile->Path,"STDOUT")==0) return; - if (strcmp(LogFile->Path,"STDERR")==0) return; - if (getpid() != ParentPID) return; + if (! LogFile) return(NULL); + if (! LogFile->S) return(NULL); + if (strcmp(LogFile->Path,"SYSLOG")==0) return(LogFile->S); + if (strcmp(LogFile->Path,"STDOUT")==0) return(LogFile->S); + if (strcmp(LogFile->Path,"STDERR")==0) return(LogFile->S); + if (getpid() != ParentPID) return(LogFile->S); if (LogFile->MaxSize > 0) { - fstat(LogFile->S->out_fd,&FStat); + if (LogFile->S) fstat(LogFile->S->out_fd,&FStat); + else stat(LogFile->Path,&FStat); if (FStat.st_size > LogFile->MaxSize) { - Tempstr=MCopyStr(Tempstr,LogFile->Path,"-",NULL); - rename(LogFile->Path,Tempstr); - STREAMClose(LogFile->S); - LogFile->S=STREAMOpenFile(LogFile->Path,O_CREAT | O_APPEND | O_WRONLY); + Tempstr=LogFileInternalGetRotateDestinationPath(Tempstr, LogFile); + for (i=LogFile->MaxRotate; i > 0; i--) + { + Path=FormatStr(Path,"%s.%d",Tempstr,i); + if (i==LogFile->MaxRotate) unlink(Path); + else rename(Path,PrevPath); + PrevPath=CopyStr(PrevPath,Path); + } + + if (LogFile->S) STREAMClose(LogFile->S); + if (PrevPath) rename(LogFile->Path,PrevPath); + LogFile->S=STREAMOpenFile(LogFile->Path,SF_CREAT | SF_APPEND | SF_WRONLY | SF_NOCACHE); + if (LogFile->S) STREAMSetFlushType(LogFile->S, FLUSH_FULL, 0, 0); } } + DestroyString(PrevPath); DestroyString(Tempstr); + DestroyString(Path); + return(LogFile->S); } -int LogFileSetValues(char *FileName, int Flags, int MaxSize, int FlushInterval) +void LogFileSetValues(TLogFile *LogFile, int Flags, int MaxSize, int MaxRotate, int FlushInterval) { - TLogFile *LogFile; - - if (! LogFileDefaults) LogFileSetupDefaults(); + if (! LogFileDefaults) LogFileSetDefaults(LOGFILE_TIMESTAMP | LOGFILE_FLUSH | LOGFILE_LOGPID | LOGFILE_LOGUSER, 100000000, 0, 1); if (ParentPID==0) ParentPID=getpid(); - if (StrLen(FileName)==0) LogFile=LogFileDefaults; - else LogFile=LogFileGetEntry(FileName); if (LogFile) { LogFile->MaxSize=MaxSize; + LogFile->MaxRotate=MaxRotate; LogFile->FlushInterval=FlushInterval; LogFile->Flags=Flags; + } +} + + +int LogFileFindSetValues(const char *FileName, int Flags, int MaxSize, int MaxRotate, int FlushInterval) +{ + TLogFile *LogFile; + + if (StrLen(FileName)==0) LogFile=LogFileDefaults; + else LogFile=LogFileGetEntry(FileName); + + if (LogFile) + { + LogFileSetValues(LogFile, Flags, MaxSize, MaxRotate, FlushInterval); if (strcmp(FileName,"SYSLOG")==0) LogFile->Flags |= LOGFILE_SYSLOG; } + else return(FALSE); + return(TRUE); } -int LogFileInternalWrite(STREAM *S,int LogLevel, int Flags, char *Str) +int LogFileInternalWrite(TLogFile *LF, STREAM *S, int Flags, const char *Str) { char *Tempstr=NULL, *LogStr=NULL; struct timeval Now; struct tm *TimeStruct; int result=FALSE; - TLogFile *Log; if (ParentPID==0) ParentPID=getpid(); - gettimeofday(&Now,NULL); - TimeStruct=localtime(&Now.tv_sec); - LogStr=SetStrLen(LogStr,40); - strftime(LogStr,20,"%Y/%m/%d %H:%M:%S",TimeStruct); + if (LF) S=LogFileInternalDoRotate(LF); + if (! S) return; - if (Flags & LOGFILE_MILLISECS) + gettimeofday(&Now,NULL); + if (Flags & LOGFILE_TIMESTAMP) { - Tempstr=FormatStr(Tempstr,".%03d ",Now.tv_usec / 1000); - LogStr=CatStr(LogStr,Tempstr); + TimeStruct=localtime(&Now.tv_sec); + LogStr=SetStrLen(LogStr,40); + strftime(LogStr,20,"%Y/%m/%d %H:%M:%S",TimeStruct); + + if (Flags & LOGFILE_MILLISECS) + { + Tempstr=FormatStr(Tempstr,".%03d ",Now.tv_usec / 1000); + LogStr=CatStr(LogStr,Tempstr); + } + else LogStr=CatStr(LogStr," "); } - else LogStr=CatStr(LogStr," "); if (Flags & LOGFILE_LOGPID) { @@ -177,23 +231,15 @@ int LogFileInternalWrite(STREAM *S,int LogLevel, int Flags, char *Str) if (S) { - - Log=STREAMGetItem(S,"TLogFile"); - if (Log) - { - if (Log->Flags & LOGFILE_LOCK) S->Flags |= SF_WRLOCK; + if (Flags & LOGFILE_LOCK) S->Flags |= SF_WRLOCK; else S->Flags &= ~SF_WRLOCK; - } + if (LF && ((Now.tv_sec-LF->LastFlushTime) > LF->FlushInterval)) Flags |= LOGFILE_FLUSH; STREAMWriteLine(LogStr,S); - if ( - (! Log) || - ((Flags & LOGFILE_FLUSH) || ((Now.tv_sec-Log->LastFlushTime) > Log->FlushInterval)) - ) + if (Flags & LOGFILE_FLUSH) { STREAMFlush(S); - if (Log) Log->LastFlushTime=Now.tv_sec; } result=TRUE; @@ -204,6 +250,7 @@ int LogFileInternalWrite(STREAM *S,int LogLevel, int Flags, char *Str) syslog(LOG_INFO,"%s",LogStr); result=TRUE; } + if (LF) LF->LastFlushTime=Now.tv_sec; DestroyString(Tempstr); DestroyString(LogStr); @@ -216,14 +263,18 @@ int LogFileInternalWrite(STREAM *S,int LogLevel, int Flags, char *Str) -int LogToSTREAM(STREAM *S, int Flags, char *Str) +int LogToSTREAM(STREAM *S, int Flags, const char *Str) { if (! S) return(FALSE); -return(LogFileInternalWrite(S, 0, LOGFILE_FLUSH, Str)); +return(LogFileInternalWrite(NULL, S, LOGFILE_FLUSH, Str)); } +int LogWrite(TLogFile *Log, const char *Str) +{ +return(LogFileInternalWrite(Log, Log->S, Log->Flags, Str)); +} void LogFileFlushAll(int Force) @@ -232,19 +283,18 @@ void LogFileFlushAll(int Force) ListNode *Curr; TLogFile *Log; - time(&Now); - + Now=GetTime(FALSE); Curr=ListGetNext(LogFiles); while (Curr) { Log=(TLogFile *) Curr->Item; - if (Force) + if (Force && Log->S) { STREAMFlush(Log->S); Log->LastFlushTime=Now; } - else if ((Now - Log->LastFlushTime) > Log->FlushInterval) + else if (Log->S && ((Now - Log->LastFlushTime) > Log->FlushInterval) ) { STREAMFlush(Log->S); Log->LastFlushTime=Now; @@ -254,38 +304,40 @@ void LogFileFlushAll(int Force) } -int LogToFile(char *FileName,char *fmt, ...) + +int LogToFile(const char *FileName, const char *fmt, ...) { char *Tempstr=NULL; va_list args; - int result=FALSE; + int result=FALSE, val; TLogFile *LogFile; LogFile=LogFileGetEntry(FileName); if (LogFile) { - LogFileInternalDoRotate(LogFile); - va_start(args,fmt); Tempstr=VFormatStr(Tempstr,fmt,args); va_end(args); StripTrailingWhitespace(Tempstr); - result=LogFileInternalWrite(LogFile->S,LOG_INFO, LogFile->Flags, Tempstr); + result=LogFileInternalWrite(LogFile,LogFile->S,LogFile->Flags, Tempstr); } DestroyString(Tempstr); return(result); } -int LogFileAppendTempLog(char *LogPath, char *TmpLogPath) + + +int LogFileAppendTempLog(const char *LogPath, const char *TmpLogPath) { TLogFile *LogFile; char *Tempstr=NULL; STREAM *S; +int result=FALSE; LogFile=LogFileGetEntry(LogPath); LogFileClose(TmpLogPath); - S=STREAMOpenFile(TmpLogPath,O_RDONLY); + S=STREAMOpenFile(TmpLogPath,SF_RDONLY); if (LogFile && S) { @@ -299,14 +351,17 @@ STREAM *S; if (LogFile->Flags & LOGFILE_FLUSH) STREAMFlush(LogFile->S); STREAMLock(LogFile->S,LOCK_UN); unlink(TmpLogPath); + result=TRUE; } if (S) STREAMClose(S); DestroyString(Tempstr); + +return(result); } -void LogFileCheckRotate(char *FileName) +void LogFileCheckRotate(const char *FileName) { TLogFile *LogFile; diff --git a/libUseful-2.4/Log.h b/libUseful-2.4/Log.h new file mode 100644 index 0000000..83a8a1c --- /dev/null +++ b/libUseful-2.4/Log.h @@ -0,0 +1,55 @@ +#ifndef LIBUSEFUL_LOG_H +#define LIBUSEFUL_LOG_H + +#include "includes.h" +#include "defines.h" +#include "file.h" + +#define LOGFILE_FLUSH 1 +#define LOGFILE_SYSLOG 2 +#define LOGFILE_LOGPID 4 +#define LOGFILE_LOGUSER 8 +#define LOGFILE_LOCK 16 +#define LOGFILE_TIMESTAMP 32 +#define LOGFILE_MILLISECS 64 +#define LOGFILE_ROTATE_NUMBERS 128 +#define LOGFILE_ROTATE_MINUS 256 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + char *Path; + int Flags; + int MaxSize; + int MaxRotate; + int LogFacility; + int LastFlushTime; + int FlushInterval; + char *LastMessage; + int RepeatMessage; + STREAM *S; +} TLogFile; + +TLogFile *LogFileGetEntry(const char *FileName); +int LogFileSetDefaults(int Flags, int MaxSize, int MaxRotate, int FlushInterval); +void LogFileSetValues(TLogFile *LogFile, int Flags, int MaxSize, int MaxRotate, int FlushInterval); +int LogFileFindSetValues(const char *FileName, int Flags, int MaxSize, int MaxRotate, int FlushInterval); +void LogFileFlushAll(int Force); +void LogFileClose(const char *Path); +int LogFileAppendTempLog(const char *LogPath, const char *TmpLogPath); +void LogFileCheckRotate(const char *FileName); + + +int LogToSTREAM(STREAM *S, int Flags, const char *Str); +int LogWrite(TLogFile *Log, const char *Str); +int LogToFile(const char *FileName, const char *fmt, ...); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.4/Log.o b/libUseful-2.4/Log.o new file mode 100644 index 0000000..56367a5 Binary files /dev/null and b/libUseful-2.4/Log.o differ diff --git a/libUseful-2.0/Makefile b/libUseful-2.4/Makefile similarity index 52% rename from libUseful-2.0/Makefile rename to libUseful-2.4/Makefile index cb4e0ba..6773994 100644 --- a/libUseful-2.0/Makefile +++ b/libUseful-2.4/Makefile @@ -1,16 +1,17 @@ CC = gcc VERSION = 0.0.1 CFLAGS = -g -O2 -LIBS = -FLAGS=$(CFLAGS) -fPIC -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_OSS=1 +LIBS = -lcrypto -lssl -lc +FLAGS=$(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -fPIC -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBC=1 -DHAVE_PTSNAME_R=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_SENDFILE=1 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1 -DHAVE_EVP_BF_CBC=1 -DHAVE_EVP_RC2_CBC=1 -DHAVE_EVP_RC4=1 -DHAVE_EVP_DES_CBC=1 -DHAVE_EVP_DESX_CBC=1 -DHAVE_EVP_CAST5_CBC=1 -DHAVE_EVP_IDEA_CBC=1 -DHAVE_EVP_AES_128_CBC=1 -DHAVE_EVP_AES_256_CBC=1 -DUSE_OPENSSL_ADD_ALL_ALGORITHMS=1 -DHAVE_OSS=1 -DHAVE_MADVISE -DHAVE_MADVISE_NOFORK -DHAVE_MADVISE_DONTDUMP -DHAVE_MLOCK prefix=/usr/local -OBJ=string.o list.o socket.o unix_socket.o file.o tar.o FileSystem.o GeneralFunctions.o DataProcessing.o EncryptedFiles.o ConnectManager.o sound.o pty.o Log.o http.o inet.o expect.o base64.o crc32.o md5c.o sha1.o sha2.o Hash.o Compression.o oauth.o libsettings.o Vars.o MathExpr.o Time.o Markup.o SpawnPrograms.o PatternMatch.o ParseURL.o ConnectionChain.o +OBJ=string.o list.o socket.o unix_socket.o file.o tar.o ansi.o FileSystem.o GeneralFunctions.o DataProcessing.o EncryptedFiles.o ConnectManager.o sound.o pty.o Log.o http.o inet.o expect.o base64.o crc32.o md5c.o sha1.o sha2.o whirlpool.o jh_ref.o Hash.o Compression.o oauth.o libsettings.o Vars.o MathExpr.o Time.o Markup.o SpawnPrograms.o Tokenizer.o PatternMatch.o ParseURL.o ConnectionChain.o openssl.o proctitle.o securemem.o all: $(OBJ) - $(CC) $(FLAGS) $(LIBS) -shared -o libUseful-2.0.so $(OBJ) - #ld -i -o libUseful-2.0.a $(OBJ) - ar rcs libUseful-2.0.a $(OBJ) + $(CC) $(FLAGS) -shared -o libUseful-2.4.so $(OBJ) $(LIBS) + #ld -i -o libUseful-2.4.a $(OBJ) + ar rcs libUseful-2.4.a $(OBJ) + string.o: string.h string.c $(CC) $(FLAGS) -c string.c @@ -36,6 +37,9 @@ file.o: file.h file.c tar.o: tar.h tar.c $(CC) $(FLAGS) -c tar.c +ansi.o: ansi.h ansi.c + $(CC) $(FLAGS) -c ansi.c + Log.o: Log.h Log.c $(CC) $(FLAGS) -c Log.c @@ -54,6 +58,9 @@ MathExpr.o: MathExpr.h MathExpr.c Time.o: Time.h Time.c $(CC) $(FLAGS) -c Time.c +Tokenizer.o: Tokenizer.h Tokenizer.c + $(CC) $(FLAGS) -c Tokenizer.c + Markup.o: Markup.h Markup.c $(CC) $(FLAGS) -c Markup.c @@ -66,6 +73,9 @@ inet.o: inet.h inet.c expect.o: expect.h expect.c $(CC) $(FLAGS) -c expect.c +securemem.o: securemem.h securemem.c + $(CC) $(FLAGS) -c securemem.c + GeneralFunctions.o: GeneralFunctions.h GeneralFunctions.c $(CC) $(FLAGS) -c GeneralFunctions.c @@ -102,23 +112,37 @@ sha1.o: sha1.c sha1.h sha2.o: sha2.c sha2.h $(CC) $(FLAGS) -c sha2.c +whirlpool.o: whirlpool.c whirlpool.h + $(CC) $(FLAGS) -c whirlpool.c + +jh_ref.o: jh_ref.c jh_ref.h + $(CC) $(FLAGS) -c jh_ref.c + oauth.o: oauth.c oauth.h $(CC) $(FLAGS) -c oauth.c +openssl.o: openssl.c openssl.h + $(CC) $(FLAGS) -c openssl.c + +proctitle.o: proctitle.c proctitle.h + $(CC) $(FLAGS) -c proctitle.c + Vars.o: Vars.c Vars.h $(CC) $(FLAGS) -c Vars.c -libsettings.o: libsettings.c libsettings.h - $(CC) $(FLAGS) -c libsettings.c - SpawnPrograms.o: SpawnPrograms.c SpawnPrograms.h $(CC) $(FLAGS) -c SpawnPrograms.c +#No dependancies, must always be compiled +libsettings.o: libsettings.h libsettings.c + $(CC) $(FLAGS) -c libsettings.c clean: - @rm -f *.o *.so *.a + -rm -f *.o *.so *.a + -rm config.log config.status + -rm -r autom4te.cache config.cache install: - @ln -s libUseful-2.0.so libUseful.so - @ln -s libUseful-2.0.a libUseful.a + @ln -s libUseful-2.4.so libUseful.so + @ln -s libUseful-2.4.a libUseful.a @cp *.so *.a $(prefix)/lib ; mkdir $(prefix)/include/libUseful-$(VERSION) ; cp *.h $(prefix)/include/libUseful-$(VERSION) diff --git a/libUseful-2.0/Makefile.in b/libUseful-2.4/Makefile.in similarity index 62% rename from libUseful-2.0/Makefile.in rename to libUseful-2.4/Makefile.in index 912cbfd..950db41 100644 --- a/libUseful-2.0/Makefile.in +++ b/libUseful-2.4/Makefile.in @@ -2,15 +2,16 @@ CC = @CC@ VERSION = @VERSION@ CFLAGS = @CFLAGS@ LIBS = @LIBS@ -FLAGS=$(CFLAGS) -fPIC @DEFS@ +FLAGS=$(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -fPIC @DEFS@ -DHAVE_MADVISE -DHAVE_MADVISE_NOFORK -DHAVE_MADVISE_DONTDUMP -DHAVE_MLOCK prefix=@prefix@ -OBJ=string.o list.o socket.o unix_socket.o file.o tar.o FileSystem.o GeneralFunctions.o DataProcessing.o EncryptedFiles.o ConnectManager.o sound.o pty.o Log.o http.o inet.o expect.o base64.o crc32.o md5c.o sha1.o sha2.o Hash.o Compression.o oauth.o libsettings.o Vars.o MathExpr.o Time.o Markup.o SpawnPrograms.o PatternMatch.o ParseURL.o ConnectionChain.o +OBJ=string.o list.o socket.o unix_socket.o file.o tar.o ansi.o FileSystem.o GeneralFunctions.o DataProcessing.o EncryptedFiles.o ConnectManager.o sound.o pty.o Log.o http.o inet.o expect.o base64.o crc32.o md5c.o sha1.o sha2.o whirlpool.o jh_ref.o Hash.o Compression.o oauth.o libsettings.o Vars.o MathExpr.o Time.o Markup.o SpawnPrograms.o Tokenizer.o PatternMatch.o ParseURL.o ConnectionChain.o openssl.o proctitle.o securemem.o all: $(OBJ) - $(CC) $(FLAGS) $(LIBS) -shared -o libUseful-2.0.so $(OBJ) - #ld -i -o libUseful-2.0.a $(OBJ) - ar rcs libUseful-2.0.a $(OBJ) + $(CC) $(FLAGS) -shared -o libUseful-2.4.so $(OBJ) $(LIBS) + #ld -i -o libUseful-2.4.a $(OBJ) + ar rcs libUseful-2.4.a $(OBJ) + string.o: string.h string.c $(CC) $(FLAGS) -c string.c @@ -36,6 +37,9 @@ file.o: file.h file.c tar.o: tar.h tar.c $(CC) $(FLAGS) -c tar.c +ansi.o: ansi.h ansi.c + $(CC) $(FLAGS) -c ansi.c + Log.o: Log.h Log.c $(CC) $(FLAGS) -c Log.c @@ -54,6 +58,9 @@ MathExpr.o: MathExpr.h MathExpr.c Time.o: Time.h Time.c $(CC) $(FLAGS) -c Time.c +Tokenizer.o: Tokenizer.h Tokenizer.c + $(CC) $(FLAGS) -c Tokenizer.c + Markup.o: Markup.h Markup.c $(CC) $(FLAGS) -c Markup.c @@ -66,6 +73,9 @@ inet.o: inet.h inet.c expect.o: expect.h expect.c $(CC) $(FLAGS) -c expect.c +securemem.o: securemem.h securemem.c + $(CC) $(FLAGS) -c securemem.c + GeneralFunctions.o: GeneralFunctions.h GeneralFunctions.c $(CC) $(FLAGS) -c GeneralFunctions.c @@ -102,23 +112,37 @@ sha1.o: sha1.c sha1.h sha2.o: sha2.c sha2.h $(CC) $(FLAGS) -c sha2.c +whirlpool.o: whirlpool.c whirlpool.h + $(CC) $(FLAGS) -c whirlpool.c + +jh_ref.o: jh_ref.c jh_ref.h + $(CC) $(FLAGS) -c jh_ref.c + oauth.o: oauth.c oauth.h $(CC) $(FLAGS) -c oauth.c +openssl.o: openssl.c openssl.h + $(CC) $(FLAGS) -c openssl.c + +proctitle.o: proctitle.c proctitle.h + $(CC) $(FLAGS) -c proctitle.c + Vars.o: Vars.c Vars.h $(CC) $(FLAGS) -c Vars.c -libsettings.o: libsettings.c libsettings.h - $(CC) $(FLAGS) -c libsettings.c - SpawnPrograms.o: SpawnPrograms.c SpawnPrograms.h $(CC) $(FLAGS) -c SpawnPrograms.c +#No dependancies, must always be compiled +libsettings.o: libsettings.h libsettings.c + $(CC) $(FLAGS) -c libsettings.c clean: - @rm -f *.o *.so *.a + -rm -f *.o *.so *.a + -rm config.log config.status + -rm -r autom4te.cache config.cache install: - @ln -s libUseful-2.0.so libUseful.so - @ln -s libUseful-2.0.a libUseful.a + @ln -s libUseful-2.4.so libUseful.so + @ln -s libUseful-2.4.a libUseful.a @cp *.so *.a $(prefix)/lib ; mkdir $(prefix)/include/libUseful-$(VERSION) ; cp *.h $(prefix)/include/libUseful-$(VERSION) diff --git a/libUseful-2.0/Markup.c b/libUseful-2.4/Markup.c similarity index 89% rename from libUseful-2.0/Markup.c rename to libUseful-2.4/Markup.c index dbf4e8d..9825347 100644 --- a/libUseful-2.0/Markup.c +++ b/libUseful-2.4/Markup.c @@ -155,9 +155,6 @@ return(ptr); char *HtmlGetTag(char *Input, char **TagType, char **TagData) { -char *ptr; -int len=0; - if (! Input) return(NULL); if (*Input=='\0') return(NULL); @@ -166,6 +163,37 @@ return(XMLGetTag(Input, NULL, TagType, TagData)); +char *HTMLQuote(char *RetBuff, char *Str) +{ +char *RetStr=NULL, *Token=NULL, *ptr; +int len; + +RetStr=CopyStr(RetStr,""); +len=StrLen(Str); + +for (ptr=Str; ptr < (Str+len); ptr++) +{ + +switch (*ptr) +{ +case '&': RetStr=CatStr(RetStr,"&"); break; +case '<': RetStr=CatStr(RetStr,"<"); break; +case '>': RetStr=CatStr(RetStr,">"); break; + +default: + RetStr=AddCharToStr(RetStr,*ptr); +break; +} + +} + +DestroyString(Token); +return(RetStr); +} + + + + char *HtmlDeQuote(char *RetStr, char *Data) { char *Output=NULL, *Token=NULL, *ptr; diff --git a/libUseful-2.0/Markup.h b/libUseful-2.4/Markup.h similarity index 89% rename from libUseful-2.0/Markup.h rename to libUseful-2.4/Markup.h index 76a1e53..79487b5 100644 --- a/libUseful-2.0/Markup.h +++ b/libUseful-2.4/Markup.h @@ -10,6 +10,7 @@ extern "C" { char *XMLGetTag(char *Input, char **Namespace, char **TagType, char **TagData); char *HtmlGetTag(char *Input, char **TagType, char **TagData); +char *HTMLQuote(char *RetBuff, char *Str); char *HtmlDeQuote(char *RetStr, char *Data); diff --git a/libUseful-2.4/Markup.o b/libUseful-2.4/Markup.o new file mode 100644 index 0000000..c086ef8 Binary files /dev/null and b/libUseful-2.4/Markup.o differ diff --git a/libUseful-2.0/MathExpr.c b/libUseful-2.4/MathExpr.c similarity index 97% rename from libUseful-2.0/MathExpr.c rename to libUseful-2.4/MathExpr.c index 1d8f5e2..045b47b 100644 --- a/libUseful-2.0/MathExpr.c +++ b/libUseful-2.4/MathExpr.c @@ -6,7 +6,7 @@ int operator; double value; } ExprToken; -char *OpStrings[]={"0","+","-","*","/","(",")","%","^",NULL}; +const char *OpStrings[]={"0","+","-","*","/","(",")","%","^",NULL}; typedef enum Ops {OP_VAL,OP_PLUS,OP_MINUS,OP_TIMES,OP_DIVIDE,OP_OPEN,OP_CLOSE,OP_MOD,OP_POW} LIBUSEFUL_TMATHOPS; char *GetMathExprToken(char *String, char **Token) @@ -96,7 +96,6 @@ double ProcessMultDiv(ListNode *Tokens) ListNode *Curr; ExprToken *Tok, *PrevTok, *NextTok; double val=0; -int count; Curr=ListGetNext(Tokens); while (Curr) @@ -228,7 +227,7 @@ double EvaluateMathStr(char *String) double val; char *ptr, *Token=NULL; int operator; -ListNode *Tokens, *Curr; +ListNode *Tokens; ExprToken *Tok; Tokens=ListCreate(); diff --git a/libUseful-2.0/MathExpr.h b/libUseful-2.4/MathExpr.h similarity index 100% rename from libUseful-2.0/MathExpr.h rename to libUseful-2.4/MathExpr.h diff --git a/libUseful-2.4/MathExpr.o b/libUseful-2.4/MathExpr.o new file mode 100644 index 0000000..20755a2 Binary files /dev/null and b/libUseful-2.4/MathExpr.o differ diff --git a/libUseful-2.0/ParseURL.c b/libUseful-2.4/ParseURL.c similarity index 82% rename from libUseful-2.0/ParseURL.c rename to libUseful-2.4/ParseURL.c index 2b5ac71..5216583 100644 --- a/libUseful-2.0/ParseURL.c +++ b/libUseful-2.4/ParseURL.c @@ -1,9 +1,10 @@ #include "ParseURL.h" -void ParseHostDetails(char *Data,char **Host,char **Port,char **User, char **Password) +void ParseHostDetails(const char *Data,char **Host,char **Port,char **User, char **Password) { -char *Token=NULL, *ptr, *tptr; +char *Token=NULL; +const char *ptr, *tptr; if (Port) *Port=CopyStr(*Port,""); if (Host) *Host=CopyStr(*Host,""); @@ -13,12 +14,13 @@ if (Password) *Password=CopyStr(*Password,""); ptr=strrchr(Data,'@'); if (ptr) { - ptr=GetToken(Data,"@",&Token,0); + Token=CopyStrLen(Token,Data,ptr-Data); if (User) { tptr=GetToken(Token,":",User,0); if (StrLen(tptr)) *Password=CopyStr(*Password,tptr); } + ptr++; } else ptr=Data; @@ -32,10 +34,10 @@ DestroyString(Token); -void ParseURL(char *URL, char **Proto, char **Host, char **Port, char **User, char **Password, char **Path, char **Args) +void ParseURL(const char *URL, char **Proto, char **Host, char **Port, char **User, char **Password, char **Path, char **Args) { -char *ptr, *aptr; -char *Token=NULL, *tProto=NULL; +const char *ptr; +char *Token=NULL, *tProto=NULL, *aptr; //Even if they pass NULL for protocol, we need to take a copy for use in @@ -104,7 +106,7 @@ DestroyString(tProto); -void ParseConnectDetails(char *Str, char **Type, char **Host, char **Port, char **User, char **Pass, char **Path) +void ParseConnectDetails(const char *Str, char **Type, char **Host, char **Port, char **User, char **Pass, char **Path) { char *ptr, *Token=NULL, *Args=NULL; diff --git a/libUseful-2.4/ParseURL.h b/libUseful-2.4/ParseURL.h new file mode 100644 index 0000000..69e7a1a --- /dev/null +++ b/libUseful-2.4/ParseURL.h @@ -0,0 +1,18 @@ +#ifndef LIBUSEFUL_PARSEURL +#define LIBUSEFUL_PARSEURL + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void ParseURL(const char *URL, char **Proto, char **Host, char **Port, char **User, char **Password, char **Path, char **Args); +void ParseConnectDetails(const char *Str, char **Type, char **Host, char **Port, char **User, char **Pass, char **InitDir); +void ParseConnectHop(const char *Line, int *Type, char **Host, char **User, char **Password, char **KeyFile, int *Port); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libUseful-2.4/ParseURL.o b/libUseful-2.4/ParseURL.o new file mode 100644 index 0000000..7c9bfe9 Binary files /dev/null and b/libUseful-2.4/ParseURL.o differ diff --git a/libUseful-2.0/PatternMatch.c b/libUseful-2.4/PatternMatch.c similarity index 98% rename from libUseful-2.0/PatternMatch.c rename to libUseful-2.4/PatternMatch.c index 0ad6699..cf05988 100644 --- a/libUseful-2.0/PatternMatch.c +++ b/libUseful-2.4/PatternMatch.c @@ -156,7 +156,7 @@ return(MATCH_ONE); int pmatch_charlist(char **P_PtrPtr,char S_Char, int Flags) { -char P_Char, Prev_Char; +char P_Char, Prev_Char=0; int result=MATCH_CONT; int mode=0; @@ -448,7 +448,7 @@ int pmatch_process(char **Compiled, char *String, int len, ListNode *Matches, in //p_ptr points to the pattern from 'Compiled' that's currently being //tested. s_ptr holds our progress through the string char **p_ptr; -char *s_ptr, *s_end, *tp_ptr, *ts_ptr; +char *s_ptr, *s_end; char *Start=NULL, *End=NULL; int result, Flags; TPMatch *Match; @@ -457,9 +457,9 @@ int NoOfItems=0; Flags=iFlags &= ~PMATCH_SUBSTR; s_end=String+len; //We handle PMATCH substr in this function -for (s_ptr=String; s_ptr < s_end; s_ptr++) +for (p_ptr=Compiled; *p_ptr != NULL; p_ptr++) { - for (p_ptr=Compiled; *p_ptr != NULL; p_ptr++) + for (s_ptr=String; s_ptr < s_end; s_ptr++) { result=pmatch_process_one(*p_ptr, s_ptr, s_end-s_ptr, &Start, &End, Flags); if (result==MATCH_ONE) @@ -473,6 +473,7 @@ for (s_ptr=String; s_ptr < s_end; s_ptr++) ListAddItem(Matches,Match); } } + else if (result==MATCH_FAIL) break; } Flags |= PMATCH_NOTSTART; } @@ -484,7 +485,7 @@ return(NoOfItems); void pmatch_compile(char *Pattern, char ***Compiled) { -int NoOfRecords=0, NoOfItems=0;; +int NoOfRecords=0, NoOfItems=0; char *ptr; ptr=Pattern; @@ -512,14 +513,13 @@ while (ptr && (*ptr != '\0')) int pmatch(char *Pattern, char *String, int Len, ListNode *Matches, int Flags) { -char *ptr, *end, **Compiled=NULL; +char *ptr, **Compiled=NULL; int result, len; pmatch_compile(Pattern,&Compiled); ptr=String; len=Len; - end=String+len; result=pmatch_process(Compiled, ptr, len, Matches, Flags); diff --git a/libUseful-2.0/PatternMatch.h b/libUseful-2.4/PatternMatch.h similarity index 100% rename from libUseful-2.0/PatternMatch.h rename to libUseful-2.4/PatternMatch.h diff --git a/libUseful-2.4/PatternMatch.o b/libUseful-2.4/PatternMatch.o new file mode 100644 index 0000000..a8acdf6 Binary files /dev/null and b/libUseful-2.4/PatternMatch.o differ diff --git a/libUseful-2.4/README b/libUseful-2.4/README new file mode 100644 index 0000000..b4b35ab --- /dev/null +++ b/libUseful-2.4/README @@ -0,0 +1,2 @@ +libUseful is a 'C' library of useful functions. Documentation not yet prepared, but coming soonish. + diff --git a/libUseful-2.0/SpawnPrograms.c b/libUseful-2.4/SpawnPrograms.c similarity index 56% rename from libUseful-2.0/SpawnPrograms.c rename to libUseful-2.4/SpawnPrograms.c index a33c247..2538d0e 100644 --- a/libUseful-2.0/SpawnPrograms.c +++ b/libUseful-2.4/SpawnPrograms.c @@ -1,5 +1,5 @@ #include "SpawnPrograms.h" -#include "libsettings.h" +#include "Log.h" #include "pty.h" #include "file.h" #include "string.h" @@ -8,7 +8,7 @@ char *MakeShellSafeString(char *RetStr, const char *String, int SafeLevel) { char *Tempstr=NULL; -char *BadChars=";|$`"; +char *BadChars=";|&`"; if (SafeLevel==SHELLSAFE_BLANK) { @@ -25,21 +25,47 @@ return(Tempstr); } -pid_t ForkWithContext() +void SwitchProgram(const char *CommandLine, const char *User,const char *Group, const char *Dir) +{ +char **argv, *ptr; +char *Token=NULL, *SafeStr=NULL; +int i; + +SafeStr=MakeShellSafeString(SafeStr,CommandLine,0); +argv=(char **) calloc(101,sizeof(char *)); +ptr=SafeStr; +for (i=0; i < 100; i++) +{ + ptr=GetToken(ptr,"\\S",&Token,GETTOKEN_QUOTES); + if (! ptr) break; + argv[i]=CopyStr(argv[i],Token); +} + +if (StrLen(Dir)) chdir(Dir); +if (StrLen(Group)) SwitchGroup(Group); +if (StrLen(User)) SwitchUser(User); + +DestroyString(Token); +DestroyString(SafeStr); + +/* we are the child so we continue */ +execv(argv[0],argv); +//no point trying to free stuff here, we will no longer +//be the main program +} + + +pid_t ForkWithContext(const char *User, const char *Dir, const char *Group) { -char *ptr; pid_t pid; LogFileFlushAll(TRUE); pid=fork(); if (pid==0) { - ptr=LibUsefulGetValue("FORK:Dir"); - if (StrLen(ptr)) chdir(ptr); - ptr=LibUsefulGetValue("FORK:User"); - if (StrLen(ptr)) SwitchUser(ptr); - ptr=LibUsefulGetValue("FORK:Group"); - if (StrLen(ptr)) SwitchGroup(ptr); + if (StrLen(Dir)) chdir(Dir); + if (StrLen(Group)) SwitchGroup(Group); + if (StrLen(User)) SwitchUser(User); } return(pid); } @@ -59,7 +85,7 @@ if (result != 0) exit(0); /*we can only get to here if result= 0 i.e. we are the child process*/ setsid(); -result=ForkWithContext(); +result=ForkWithContext(NULL, NULL, NULL); if (result !=0) exit(0); umask(0); @@ -91,7 +117,7 @@ int ForkWithIO(int StdIn, int StdOut, int StdErr) pid_t pid; int fd; -pid=ForkWithContext(); +pid=ForkWithContext(NULL, NULL, NULL); if (pid==0) { if (StdIn > -1) @@ -133,27 +159,30 @@ if (pid==0) } } } + + +/* WTF?! Why do this in the parent? else { fd=open("/dev/null",O_WRONLY); dup(fd); close(fd); } +*/ return(pid); } -pid_t SpawnWithIO(char *CommandLine, int StdIn, int StdOut, int StdErr) +pid_t SpawnWithIO(const char *CommandLine, int StdIn, int StdOut, int StdErr) { pid_t pid; -int fd, i; pid=ForkWithIO(StdIn,StdOut,StdErr); if (pid==0) { -SwitchProgram(CommandLine); +SwitchProgram(CommandLine,NULL,NULL,NULL); _exit(pid); } @@ -161,24 +190,31 @@ return(pid); } -int Spawn(char *ProgName) +int Spawn(const char *ProgName, const char *User, const char *Group, const char *Dir) { -return(SpawnWithIO(ProgName, 0,1,2)); +int pid; + +pid=ForkWithIO(0,1,2); +if (pid==0) +{ + SwitchProgram(ProgName, User, Group, Dir); + _exit(pid); +} +return(pid); } /* This creates a child process that we can talk to using a couple of pipes*/ -pid_t PipeSpawnFunction(int *infd,int *outfd,int *errfd, BASIC_FUNC Func, void *Data ) +pid_t PipeSpawnFunction(int *infd,int *outfd,int *errfd, BASIC_FUNC Func, void *Data, const char *User, const char *Group) { pid_t pid; int channel1[2], channel2[2], channel3[2], DevNull=-1; -int count; if (infd) pipe(channel1); if (outfd) pipe(channel2); if (errfd) pipe(channel3); -pid=ForkWithContext(); +pid=ForkWithContext(NULL,NULL,NULL); if (pid==0) { /* we are the child */ @@ -202,11 +238,17 @@ else dup(DevNull); /* channel 3 is stderr */ if (errfd) { - if (errfd==COMMS_COMBINE_STDERR) dup(channel2[1]); + //Yes, we can pass an integer value as errfd, even though it's an int *. + //This is probably a bad idea, and will likely be changed in future releases + if (errfd==(int) COMMS_COMBINE_STDERR) dup(channel2[1]); else dup(channel3[1]); } else dup(DevNull); +if (StrLen(Group)) SwitchGroup(Group); +if (StrLen(User)) SwitchUser(User); + + Func(Data); exit(0); } @@ -225,8 +267,10 @@ if (outfd) } if (errfd) { - close(channel3[1]); - *errfd=channel3[0]; + close(channel3[1]); + //Yes, we can pass an integer value as errfd, even though it's an int *. + //This is probably a bad idea, and will likely be changed in future releases + if (errfd != (int) COMMS_COMBINE_STDERR) *errfd=channel3[0]; } } @@ -235,40 +279,54 @@ return(pid); } -int BASIC_FUNC_EXEC_COMMAND(void *Data) +int BASIC_FUNC_EXEC_COMMAND(void *Command) { -return(execl("/bin/sh","/bin/sh","-c",(char *) Data,NULL)); +char *SafeStr=NULL; +int result; + +SafeStr=MakeShellSafeString(SafeStr,Command,0); +result=execl("/bin/sh","/bin/sh","-c",(char *) SafeStr,NULL); + +DestroyString(SafeStr); +return(result); } -pid_t PipeSpawn(int *infd,int *outfd,int *errfd, const char *Command) +pid_t PipeSpawn(int *infd,int *outfd,int *errfd, const char *Command, const char *User, const char *Group) { -return(PipeSpawnFunction(infd,outfd,errfd, BASIC_FUNC_EXEC_COMMAND, (void *) Command)); +return(PipeSpawnFunction(infd,outfd,errfd, BASIC_FUNC_EXEC_COMMAND, (void *) Command, User, Group)); } -pid_t PseudoTTYSpawnFunction(int *ret_pty, BASIC_FUNC Func, void *Data, int TTYFlags) +pid_t PseudoTTYSpawnFunction(int *ret_pty, BASIC_FUNC Func, void *Data, const char *User, const char *Group, int TTYFlags) { -pid_t pid; +pid_t pid=-1; int tty, pty, i; -STREAM *S; -char *Tempstr=NULL; if (GrabPseudoTTY(&pty, &tty, TTYFlags)) { -pid=ForkWithContext(); +pid=ForkWithContext(NULL,NULL,NULL); if (pid==0) { for (i=0; i < 4; i++) close(i); close(pty); setsid(); +ioctl(tty,TIOCSCTTY,0); + dup(tty); dup(tty); dup(tty); -ioctl(tty,TIOCSCTTY,0); + +///now that we've dupped it, we don't need to keep it open +//as it will be open on stdin/stdout +close(tty); + +if (StrLen(Group)) SwitchGroup(Group); +if (StrLen(User)) SwitchUser(User); + Func((char *) Data); _exit(0); } @@ -281,13 +339,13 @@ return(pid); } -pid_t PseudoTTYSpawn(int *pty, const char *Command, int TTYFlags) +pid_t PseudoTTYSpawn(int *pty, const char *Command, const char *User, const char *Group, int TTYFlags) { -return(PseudoTTYSpawnFunction(pty, BASIC_FUNC_EXEC_COMMAND, (void *) Command,TTYFlags)); +return(PseudoTTYSpawnFunction(pty, BASIC_FUNC_EXEC_COMMAND, (void *) Command, User, Group, TTYFlags)); } -STREAM *STREAMSpawnCommand(const char *Command, int Flags) +STREAM *STREAMSpawnCommand(const char *Command, const char *User, const char *Group, int Flags) { int to_fd, from_fd; pid_t pid; @@ -300,22 +358,43 @@ else Tempstr=MakeShellSafeString(Tempstr, Command, 0); if (Flags & COMMS_BY_PTY) { - pid=PseudoTTYSpawn(&to_fd,Tempstr,Flags); + pid=PseudoTTYSpawn(&to_fd,Tempstr,User,Group,Flags); if (pid > 0) S=STREAMFromFD(to_fd); } else { if (Flags & COMMS_COMBINE_STDERR) { - pid=PipeSpawn(&to_fd, &from_fd, COMMS_COMBINE_STDERR, Tempstr); + pid=PipeSpawn(&to_fd, &from_fd, COMMS_COMBINE_STDERR, Tempstr,User,Group); } - else pid=PipeSpawn(&to_fd, &from_fd, NULL, Tempstr); + else pid=PipeSpawn(&to_fd, &from_fd, NULL, Tempstr,User,Group); if (pid > 0) S=STREAMFromDualFD(from_fd, to_fd); } if (S) { - STREAMSetFlushType(S,FLUSH_LINE,0); + STREAMSetFlushType(S,FLUSH_LINE,0,0); + Tempstr=FormatStr(Tempstr,"%d",pid); + STREAMSetValue(S,"PeerPID",Tempstr); +} + +DestroyString(Tempstr); +return(S); +} + + +STREAM *STREAMSpawnFunction(BASIC_FUNC Func, void *Data) +{ +int to_fd, from_fd; +pid_t pid; +STREAM *S=NULL; +char *Tempstr=NULL; + +pid=PipeSpawnFunction(&to_fd, &from_fd, COMMS_COMBINE_STDERR, Func, Data, "", "" ); +if (pid > 0) S=STREAMFromDualFD(from_fd, to_fd); +if (S) +{ + STREAMSetFlushType(S,FLUSH_LINE,0,0); Tempstr=FormatStr(Tempstr,"%d",pid); STREAMSetValue(S,"PeerPID",Tempstr); } diff --git a/libUseful-2.0/SpawnPrograms.h b/libUseful-2.4/SpawnPrograms.h similarity index 54% rename from libUseful-2.0/SpawnPrograms.h rename to libUseful-2.4/SpawnPrograms.h index cf5fb4c..ce88cad 100644 --- a/libUseful-2.0/SpawnPrograms.h +++ b/libUseful-2.4/SpawnPrograms.h @@ -17,17 +17,19 @@ extern "C" { #define SHELLSAFE_BLANK 1 char *MakeShellSafeString(char *RetStr, const char *String, int SafeLevel); +void SwitchProgram(const char *CommandLine, const char *User, const char *Group, const char *Dir); int ForkWithContext(); /* This function turns our process into a demon */ int demonize(); int ForkWithIO(int StdIn, int StdOut, int StdErr); -int SpawnWithIO(char *CommandLine, int StdIn, int StdOut, int StdErr); -int Spawn(char *ProgName); +int SpawnWithIO(const char *CommandLine, int StdIn, int StdOut, int StdErr); +int Spawn(const char *ProgName, const char *User, const char *Group, const char *Dir); /* This creates a child process that we can talk to using a couple of pipes*/ -int PipeSpawnFunction(int *infd,int *outfd,int *errfd, BASIC_FUNC Func, void *Data ); -int PipeSpawn(int *infd,int *outfd,int *errfd, const char *Command); -int PseudoTTYSpawn(int *pty, const char *Command, int Flags); -STREAM *STREAMSpawnCommand(const char *Command, int Type); +int PipeSpawnFunction(int *infd,int *outfd,int *errfd, BASIC_FUNC Func, void *Data, const char *User, const char *Group); +int PipeSpawn(int *infd,int *outfd,int *errfd, const char *Command, const char *User, const char *Group); +int PseudoTTYSpawn(int *pty, const char *Command, const char *User, const char *Group, int Flags); +STREAM *STREAMSpawnCommand(const char *Command, const char *User, const char *Group, int Type); +STREAM *STREAMSpawnFunction(BASIC_FUNC Func, void *Data); #ifdef __cplusplus } diff --git a/libUseful-2.4/SpawnPrograms.o b/libUseful-2.4/SpawnPrograms.o new file mode 100644 index 0000000..ab9a311 Binary files /dev/null and b/libUseful-2.4/SpawnPrograms.o differ diff --git a/libUseful-2.0/Time.c b/libUseful-2.4/Time.c similarity index 53% rename from libUseful-2.0/Time.c rename to libUseful-2.4/Time.c index 0633d96..f62573d 100644 --- a/libUseful-2.0/Time.c +++ b/libUseful-2.4/Time.c @@ -1,6 +1,32 @@ #include "Time.h" -char *GetDateStrFromSecs(char *DateFormat, time_t Secs, char *TimeZone) +//we cache seconds because we expect most questions about +//time to be in seconds, and this avoids multiplying millisecs up +time_t LU_CachedTime=0; +//This is cached millisecs since 1970 +uint64_t LU_CachedMillisecs=0; +struct tm LU_CachedTM; + + +uint64_t GetTime(int Flags) +{ +struct timeval tv; + +if ((! (Flags & TIME_CACHED)) || (LU_CachedTime==0)) +{ + gettimeofday(&tv, NULL); + LU_CachedTime=tv.tv_sec; + LU_CachedMillisecs=(tv.tv_sec * 1000) + (tv.tv_usec / 1000); +} + +if (Flags & TIME_MILLISECS) return(LU_CachedMillisecs); +else if (Flags & TIME_CENTISECS) return(LU_CachedMillisecs * 10); + +return((uint64_t) LU_CachedTime); +} + + +char *GetDateStrFromSecs(const char *DateFormat, time_t Secs, const char *TimeZone) { time_t val; struct tm *TMS; @@ -8,7 +34,6 @@ static char *Buffer=NULL; char *Tempstr=NULL; #define DATE_BUFF_LEN 255 -val=Secs; if (StrLen(TimeZone)) { @@ -16,7 +41,19 @@ if (getenv("TZ")) Tempstr=CopyStr(Tempstr,getenv("TZ")); setenv("TZ",TimeZone,TRUE); tzset(); } -TMS=localtime(&val); + +/* +if (Secs==LU_CachedTime) TMS=&LU_CachedTM; +else +{ + val=Secs; + TMS=localtime(&val); + memcpy(&LU_CachedTM, TMS, sizeof(struct tm)); +} +*/ + + val=Secs; + TMS=localtime(&val); if (StrLen(TimeZone)) { if (! Tempstr) unsetenv("TZ"); @@ -34,21 +71,17 @@ return(Buffer); -char *GetDateStr(char *DateFormat, char *TimeZone) +char *GetDateStr(const char *DateFormat, const char *TimeZone) { -time_t Now; - -time(&Now); -return(GetDateStrFromSecs(DateFormat, Now, TimeZone)); +return(GetDateStrFromSecs(DateFormat, (time_t) GetTime(0), TimeZone)); } -time_t DateStrToSecs(char *DateFormat, char *Str, char *TimeZone) +time_t DateStrToSecs(const char *DateFormat, const char *Str, const char *TimeZone) { time_t Secs=0; struct tm TMS; char *Tempstr=NULL; -int val; if (StrLen(DateFormat)==0) return(0); if (StrLen(Str)==0) return(0); @@ -72,9 +105,11 @@ if (StrLen(TimeZone)) } return(Secs); } + + + /* A general 'Set Timer' function, Useful for timing out */ /* socket connections etc */ - void SetTimeout(int timeout) { struct sigaction SigAct; diff --git a/libUseful-2.4/Time.h b/libUseful-2.4/Time.h new file mode 100644 index 0000000..fa53d2b --- /dev/null +++ b/libUseful-2.4/Time.h @@ -0,0 +1,27 @@ +#ifndef LIBUSEFUL_TIME_H +#define LIBUSEFUL_TIME_H + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define TIME_MILLISECS 1 +#define TIME_CENTISECS 2 +#define TIME_CACHED 1024 + +uint64_t GetTime(int Flags); +char *GetDateStrFromSecs(const char *DateFormat, time_t Secs, const char *TimeZone); +char *GetDateStr(const char *DateFormat, const char *TimeZone); +time_t DateStrToSecs(const char *DateFormat, const char *Str, const char *TimeZone); +void SetTimeout(int timeout); + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.4/Time.o b/libUseful-2.4/Time.o new file mode 100644 index 0000000..78d33c9 Binary files /dev/null and b/libUseful-2.4/Time.o differ diff --git a/libUseful-2.4/Tokenizer.c b/libUseful-2.4/Tokenizer.c new file mode 100644 index 0000000..d420eab --- /dev/null +++ b/libUseful-2.4/Tokenizer.c @@ -0,0 +1,361 @@ +#include "includes.h" +#include "Tokenizer.h" +#include "string.h" + +#define TOK_SPACE 1 + +#ifdef __MMX__ +#include +#endif + +int GetTokenSepMatch(const char *Pattern,const char **start, const char **end, int Flags) +{ +const char *pptr, *eptr; +char Quote='\0'; +int MatchType=0; + +//if start and end pointers are same, then we've no string +if (*start==*end) return(FALSE); + +pptr=Pattern; +eptr=*start; + + +while (1) +{ +//check the current 'pattern' char +switch (*pptr) +{ + //if we run out of pattern, then we got a match + case '\0': + *end=eptr; + return(TRUE); + break; + + //in multiseparator mode a '|' is the same as '\0' + case '|': + if (Flags & GETTOKEN_MULTI_SEPARATORS) + { + *end=eptr; + return(TRUE); + } + break; + + + //Quoted char + case '\\': + pptr++; + if (*pptr=='S') MatchType=TOK_SPACE; + break; + +} + +switch (*eptr) +{ + //if we run out of string, then we got a part match, but its not + //a full match, so we return fail + case '\0': return(FALSE); break; + + case '\\': + //if we got a quoted character we can't have found + //the separator, so return false + if (Flags & GETTOKEN_BACKSLASH) + { + if (*eptr != *pptr) return(FALSE); + } + else + { + eptr++; + *start=eptr; + return(FALSE); + } + break; + + case '"': + case '\'': + if (Flags & GETTOKEN_HONOR_QUOTES) + { + Quote=*eptr; + eptr++; + while ((*eptr != Quote) && (*eptr != '\0')) + { + //handle quoted chars + if ((*eptr=='\\') && (*(eptr+1) != '\0'))eptr++; + eptr++; + } + if (*eptr == '\0') eptr--; //because there's a ++ below + *start=eptr; + return(FALSE); + } + else if (*eptr != *pptr) return(FALSE); + break; + + case ' ': + case ' ': + case '\n': + case '\r': + if (MatchType==TOK_SPACE) + { + while (isspace(*eptr)) eptr++; + eptr--; + MatchType=0; + } + else if (*eptr != *pptr) return(FALSE); + break; + + default: + if (MatchType != 0) return(FALSE); + if (*eptr != *pptr) return(FALSE); + break; +} + +pptr++; +eptr++; +} + +return(FALSE); +} + + + + + +/* +int GetTokenFindSeparator(const char *Pattern, const char *String, const char **SepStart, const char **SepEnd, int Flags) +{ +const char *start_ptr=NULL, *end_ptr=NULL, *ptr; +#ifdef __MMX__ +__m64 src, cmp1, cmp2; +#endif + + +start_ptr=String; + +while (*start_ptr != '\0') +{ + + if ((*start_ptr=='\\') && (! Flags & GETTOKEN_BACKSLASH)) + { + start_ptr++; + start_ptr++; + } + + ptr=Pattern; + while (ptr) + { + #ifdef __MMX__ + if (*ptr != '\\') + { + cmp1=_mm_set1_pi8(*ptr); + src=*(__m64 *) start_ptr; + cmp2=_mm_cmpeq_pi8(src,cmp1); + if ((uint64_t) cmp2==0) + { + cmp1=_mm_cmpeq_pi8(src,cmp2); + if ((uint64_t) cmp1 != 0) + { + while (*start_ptr !='\0') start_ptr++; + *SepStart=start_ptr; + return(FALSE); + } + start_ptr+=8; + continue; + } + } + #endif + + if (GetTokenSepMatch(ptr,&start_ptr, &end_ptr, Flags)) + { + *SepStart=start_ptr; + *SepEnd=end_ptr; + return(TRUE); + } + + if (Flags & GETTOKEN_MULTI_SEPARATORS) + { + ptr=strchr(ptr,'|'); + if (ptr) ptr++; + } + else ptr=NULL; + } + +if ((*start_ptr) !='\0') start_ptr++; +} + +//We found nothing, set sep start to equal end of string +*SepStart=start_ptr; + +return(FALSE); +} +*/ + +int GetTokenFindSeparator(const char *Pattern, const char *String, const char **SepStart, const char **SepEnd, int Flags) +{ +const char *start_ptr=NULL, *end_ptr=NULL, *ptr; +#ifdef __MMX__ +__m64 src, cmp1, cmp2; +#endif + + +ptr=Pattern; +while (ptr) +{ + start_ptr=String; + while (*start_ptr != '\0') + { + if ((*start_ptr=='\\') && (! (Flags & GETTOKEN_BACKSLASH))) + { + start_ptr++; + start_ptr++; + continue; + } + + #ifdef __MMX__ + if (*ptr != '\\') + { + cmp1=_mm_set1_pi8(*ptr); + src=*(__m64 *) start_ptr; + cmp2=_mm_cmpeq_pi8(src,cmp1); + if ((uint64_t) cmp2==0) + { + cmp1=_mm_cmpeq_pi8(src,cmp2); + if ((uint64_t) cmp1 != 0) + { + while (*start_ptr !='\0') start_ptr++; + *SepStart=start_ptr; + return(FALSE); + } + start_ptr+=8; + continue; + } + +/* + if (((uint64_t) cmp2 & 0xFFFFFFFF)==0) + { + cmp1=_mm_cmpeq_pi8(src,cmp2); + if (((uint64_t) cmp1 & 0xFFFFFFFF)==0) + { + while (*start_ptr !='\0') start_ptr++; + *SepStart=start_ptr; + return(FALSE); + } + start_ptr+=4; + continue; + } +*/ + + } + #endif + + if (GetTokenSepMatch(ptr,&start_ptr, &end_ptr, Flags)) + { + *SepStart=start_ptr; + *SepEnd=end_ptr; + return(TRUE); + } + if ((*start_ptr) !='\0') start_ptr++; + } + + if (Flags & GETTOKEN_MULTI_SEPARATORS) + { + ptr=strchr(ptr,'|'); + if (ptr) ptr++; + } + else ptr=NULL; +} + +//We found nothing, set sep start to equal end of string +*SepStart=start_ptr; + +return(FALSE); +} + + +char *GetToken(const char *SearchStr, const char *Separator, char **Token, int Flags) +{ +const char *SepStart=NULL, *SepEnd=NULL; +const char *sptr, *eptr; + + +/* this is a safety measure so that there is always something in Token*/ +if (Token) *Token=CopyStr(*Token,""); + +if ((! Token) || StrEnd(SearchStr)) +{ + #ifdef __MMX__ + if (! (Flags & GETTOKEN_NOEMMS)) _mm_empty(); + #endif + return(NULL); +} + +GetTokenFindSeparator(Separator, SearchStr, &SepStart, &SepEnd, Flags); + +sptr=SearchStr; + +if (Flags & GETTOKEN_INCLUDE_SEP) +{ + if (SepStart==SearchStr) eptr=SepEnd; + else + { + eptr=SepStart; + SepEnd=SepStart; + } +} +else if (Flags & GETTOKEN_APPEND_SEP) eptr=SepEnd; +else eptr=SepStart; + +if (Flags & GETTOKEN_STRIP_QUOTES) +{ + if ((*sptr=='"') || (*sptr=='\'')) + { + //is character before the sep a quote? If so, we copy one less char, and also start one character later + //else we copy the characters as well + eptr--; + if (*sptr==*eptr) sptr++; + else eptr++; + } +} + +*Token=CopyStrLen(*Token,sptr,eptr-sptr); + +if (Flags & GETTOKEN_STRIP_SPACE) +{ +StripTrailingWhitespace(*Token); +StripLeadingWhitespace(*Token); +} + +//return empty string, but not null +if ((! SepEnd) || (*SepEnd=='\0')) +{ + SepEnd=SearchStr+StrLen((char *) SearchStr); +} + +#ifdef __MMX__ +if (! (Flags & GETTOKEN_NOEMMS)) _mm_empty(); +#endif +return((char *) SepEnd); +} + + + + +char *GetNameValuePair(const char *Input, const char *PairDelim, const char *NameValueDelim, char **Name, char **Value) +{ +char *ptr, *ptr2; +char *Token=NULL; + +*Name=CopyStr(*Name,""); +*Value=CopyStr(*Value,""); +ptr=GetToken(Input,PairDelim,&Token,GETTOKEN_HONOR_QUOTES); +if (StrValid(Token)) +{ +ptr2=GetToken(Token,NameValueDelim,Name,GETTOKEN_HONOR_QUOTES); +ptr2=GetToken(ptr2,PairDelim,Value,GETTOKEN_HONOR_QUOTES); +StripQuotes(*Name); +StripQuotes(*Value); +} + +DestroyString(Token); +return(ptr); +} + diff --git a/libUseful-2.4/Tokenizer.h b/libUseful-2.4/Tokenizer.h new file mode 100644 index 0000000..32f13e5 --- /dev/null +++ b/libUseful-2.4/Tokenizer.h @@ -0,0 +1,35 @@ +#ifndef LIBUSEFUL_TOKEN_H +#define LIBUSEFUL_TOKEN_H + +#include +#include + +#define GETTOKEN_MULTI_SEPARATORS 1 +#define GETTOKEN_MULTI_SEP 1 +#define GETTOKEN_HONOR_QUOTES 2 +#define GETTOKEN_STRIP_QUOTES 4 +#define GETTOKEN_QUOTES 6 +#define GETTOKEN_INCLUDE_SEPARATORS 8 +#define GETTOKEN_INCLUDE_SEP 8 +#define GETTOKEN_APPEND_SEPARATORS 16 +#define GETTOKEN_APPEND_SEP 16 +#define GETTOKEN_BACKSLASH 32 +#define GETTOKEN_STRIP_SPACE 64 +#define GETTOKEN_NOEMMS 4096 + +#ifdef __cplusplus +extern "C" { +#endif + +char *GetToken(const char *SearchStr, const char *Delim, char **Token, int Flags); +char *GetNameValuePair(const char *Input, const char *PairDelim, const char *NameValueDelim, char **Name, char **Value); + +#ifdef __cplusplus +} +#endif + + + + +#endif + diff --git a/libUseful-2.4/Tokenizer.o b/libUseful-2.4/Tokenizer.o new file mode 100644 index 0000000..40a4048 Binary files /dev/null and b/libUseful-2.4/Tokenizer.o differ diff --git a/libUseful-2.0/Vars.c b/libUseful-2.4/Vars.c similarity index 68% rename from libUseful-2.0/Vars.c rename to libUseful-2.4/Vars.c index d070463..3a569a1 100644 --- a/libUseful-2.0/Vars.c +++ b/libUseful-2.4/Vars.c @@ -1,31 +1,54 @@ #include "includes.h" #include "defines.h" #include "list.h" +#include "Time.h" -void SetVar(ListNode *Vars, const char *Name, const char *Data) +void SetDetailVar(ListNode *Vars, const char *Name, const char *Data, int ItemType, time_t Time) { ListNode *Node; char *Tempstr=NULL; +if (! Vars) return; Tempstr=CopyStr(Tempstr,Name); //strlwr(Tempstr); Node=ListFindNamedItem(Vars,Tempstr); if (Node) Node->Item=(void *) CopyStr((char *) Node->Item,Data); -else ListAddNamedItem(Vars,Tempstr,CopyStr(NULL,Data)); +else Node=ListAddNamedItem(Vars,Tempstr,CopyStr(NULL,Data)); + +Node->ItemType=ItemType; +Node->Time=Time; DestroyString(Tempstr); } + +void SetTypedVar(ListNode *Vars, const char *Name, const char *Data, int ItemType) +{ +SetDetailVar(Vars, Name, Data, ItemType, 0); +} + + +void SetVar(ListNode *Vars, const char *Name, const char *Data) +{ +SetDetailVar(Vars, Name, Data,0, 0); +} + + char *GetVar(ListNode *Vars, const char *Name) { ListNode *Node; -char *Tempstr=NULL; -Tempstr=CopyStr(Tempstr,Name); -//strlwr(Tempstr); -Node=ListFindNamedItem(Vars,Tempstr); -DestroyString(Tempstr); -if (Node) return((char *) Node->Item); +Node=ListFindNamedItem(Vars, Name); +if (Node) +{ + if ((Vars->Flags & LIST_FLAG_TIMEOUT) && (Node->Time > 0) && (Node->Time < GetTime(TIME_CACHED))) + { + printf("TIMED OUT %s\n",Node->Tag); + DestroyString((char *) Node->Item); + return(NULL); + } + return((char *) Node->Item); +} return(NULL); } @@ -71,14 +94,13 @@ Curr=ListGetNext(Curr); void CopyVars(ListNode *Dest, ListNode *Source) { ListNode *Curr; -char *Str; if (! Dest) return; if (! Source) return; Curr=ListGetNext(Source); while (Curr) { -SetVar(Dest,Curr->Tag,Curr->Item); +SetTypedVar(Dest,Curr->Tag,Curr->Item,Curr->ItemType); Curr=ListGetNext(Curr); } @@ -94,8 +116,17 @@ const char *ptr, *vptr; OutStr=Buff; ptr=*Line; -if (*ptr=='(') ptr++; - +switch (*ptr) +{ + //the var name is itself a var, dereference that first + case '$': + ptr++; + Tempstr=ParseVar(Tempstr,&ptr,LocalVars,Flags); + break; + + //Vars in brackets + case '(': + ptr++; while ((*ptr !=')') && (*ptr !='\0')) { if (*ptr=='$') @@ -104,9 +135,28 @@ if (*ptr=='(') ptr++; Tempstr=ParseVar(Tempstr,&ptr,LocalVars,Flags); VarName=CatStr(VarName,Tempstr); } - else VarName=AddCharToStr(VarName,*ptr); - ptr++; + else VarName=AddCharToStr(VarName,*ptr); + ptr++; + } + break; + + //vars seperated by spaces + default: + ptr++; + while ((! isspace(*ptr)) && (*ptr !='\0')) + { + if (*ptr=='$') + { + ptr++; + Tempstr=ParseVar(Tempstr,&ptr,LocalVars,Flags); + VarName=CatStr(VarName,Tempstr); + } + else VarName=AddCharToStr(VarName,*ptr); + ptr++; } + break; +} + *Line=ptr; //very important! Otherwise the calling process will not //know we have consumed some of the text! @@ -136,14 +186,30 @@ return(OutStr); } +char SubstituteQuotedChar(char InChar) +{ + switch (InChar) + { + case '0': return(0); break; + case 'a': return(7); break; + case 'b': return(8); break; + case 'd': return(127); break; + case 'e': return(27); break; + case 'f': return(12); break; + case 't': return(' '); break; + case 'r': return('\r'); break; + case 'n': return('\n'); break; + } + +return(InChar); +} + char *SubstituteVarsInString(char *Buffer, const char *Fmt, ListNode *Vars, int Flags) { char *ReturnStr=NULL, *VarName=NULL, *Tempstr=NULL; const char *FmtPtr; -int count, VarIsPointer=FALSE; -ListNode *Curr; -int len=0, i; +int len=0; ReturnStr=CopyStr(Buffer,""); @@ -155,64 +221,40 @@ while (*FmtPtr !=0) { switch (*FmtPtr) { - case '\\': - FmtPtr++; - switch (*FmtPtr) + if (Flags & SUBS_INTERPRET_BACKSLASH) { - case 't': - ReturnStr=AddCharToStr(ReturnStr,' '); - len=StrLen(ReturnStr); - while ((len % 4) !=0) - { - ReturnStr=AddCharToStr(ReturnStr,' '); - len++; - } - break; - - case 'r': - ReturnStr=AddCharToStr(ReturnStr,'\r'); - len++; - break; - - case 'n': - ReturnStr=AddCharToStr(ReturnStr,'\n'); - len++; - break; - - default: - ReturnStr=AddCharToStr(ReturnStr,*FmtPtr); - len++; + FmtPtr++; + ReturnStr=AddCharToBuffer(ReturnStr, len++, SubstituteQuotedChar(*FmtPtr)); + } + else + { + ReturnStr=AddCharToBuffer(ReturnStr,len++,*FmtPtr); } break; case '$': FmtPtr++; - /* - if (*FmtPtr=='$') - { - VarIsPointer=TRUE; - FmtPtr++; - } - if (*FmtPtr=='(') FmtPtr++; - */ - ReturnStr=ParseVar(ReturnStr, &FmtPtr, Vars, Flags); + len=StrLen(ReturnStr); break; case '"': + if (Flags & SUBS_QUOTES) + { FmtPtr++; while (*FmtPtr && (*FmtPtr !='"')) { - ReturnStr=AddCharToStr(ReturnStr,*FmtPtr); - len++; + ReturnStr=AddCharToBuffer(ReturnStr,len++,*FmtPtr); FmtPtr++; } + } + else ReturnStr=AddCharToBuffer(ReturnStr,len++,*FmtPtr); break; default: - ReturnStr=AddCharToStr(ReturnStr,*FmtPtr); - len++; + ReturnStr=AddCharToBuffer(ReturnStr,len++,*FmtPtr); + break; } FmtPtr++; diff --git a/libUseful-2.0/Vars.h b/libUseful-2.4/Vars.h similarity index 75% rename from libUseful-2.0/Vars.h rename to libUseful-2.4/Vars.h index 5ebfde9..129e089 100644 --- a/libUseful-2.0/Vars.h +++ b/libUseful-2.4/Vars.h @@ -7,6 +7,8 @@ extern "C" { #endif +void SetDetailVar(ListNode *Vars, const char *Name, const char *Data, int ItemType, time_t Time); +void SetTypedVar(ListNode *Vars, const char *Name, const char *Data, int Type); void SetVar(ListNode *Vars, const char *Name, const char *Data); char *GetVar(ListNode *Vars, const char *Name); void UnsetVar(ListNode *Vars,const char *Name); diff --git a/libUseful-2.4/Vars.o b/libUseful-2.4/Vars.o new file mode 100644 index 0000000..aeece00 Binary files /dev/null and b/libUseful-2.4/Vars.o differ diff --git a/libUseful-2.4/ansi.c b/libUseful-2.4/ansi.c new file mode 100644 index 0000000..e10d058 --- /dev/null +++ b/libUseful-2.4/ansi.c @@ -0,0 +1,96 @@ +#include "ansi.h" + + +char *ANSICode(int Color, int BgColor, int Flags) +{ +static char *ANSI=NULL; +int FgVal, BgVal; + +if ((! Color) && (! Flags)) return(""); + +if ( (Color > 0) && (BgColor > 0) ) +{ + //Bg colors are set into the higher byte of 'attribs', so that we can hold both fg and bg in the + //same int, so we must shift them down + BgColor=BgColor >> 8; + + if (Color >= ANSI_DARKGREY) FgVal=90+Color - ANSI_DARKGREY; + else FgVal=30+Color-1; + + if (BgColor >= ANSI_DARKGREY) BgVal=100+BgColor - ANSI_DARKGREY; + else BgVal=40+BgColor-1; + + ANSI=FormatStr(ANSI,"\x1b[%d;%d",FgVal,BgVal); + if (Flags) ANSI=CatStr(ANSI,";"); +} +else if (Color > 0) +{ + if (Color >= ANSI_DARKGREY) FgVal=90+Color - ANSI_DARKGREY; + else FgVal=30+Color-1; + + ANSI=FormatStr(ANSI,"\x1b[%d",FgVal); + if (Flags) ANSI=CatStr(ANSI,";"); +} +else ANSI=CopyStr(ANSI,"\x1b["); + +if (Flags) +{ + if (Flags & ANSI_BOLD) ANSI=CatStr(ANSI,"01"); + if (Flags & ANSI_FAINT) ANSI=CatStr(ANSI,"02"); + if (Flags & ANSI_UNDER) ANSI=CatStr(ANSI,"04"); + if (Flags & ANSI_BLINK) ANSI=CatStr(ANSI,"05"); + if (Flags & ANSI_INVERSE) ANSI=CatStr(ANSI,"07"); +} +ANSI=CatStr(ANSI,"m"); + +return(ANSI); +} + + +char *TerminalReadText(char *RetStr, int Flags, STREAM *S) +{ +int inchar, len=0; +char outchar; + +inchar=STREAMReadChar(S); +while (inchar != EOF) +{ + if (Flags & TERM_SHOWTEXT) outchar=inchar & 0xFF; + if (Flags & TERM_SHOWSTARS) + { + if ((outchar & 0xFF) =='\n') outchar=inchar & 0xFF; + else if ((outchar & 0xFF) =='\b') outchar=inchar & 0xFF; + else outchar='*'; + } + + + if (Flags & TERM_SHOWTEXTSTARS) + { + switch (inchar) + { + + case '\n': + case '\r': + case 0x08: + break; + + default: + if (len > 0) STREAMWriteString("\x08*",S); + break; + } + + outchar=inchar & 0xFF; + } + + + STREAMWriteBytes(S, &outchar,1); + STREAMFlush(S); + if (inchar == '\n') break; + if (inchar == '\r') break; + + RetStr=AddCharToBuffer(RetStr,len++, inchar & 0xFF); + inchar=STREAMReadChar(S); +} + +return(RetStr); +} diff --git a/libUseful-2.4/ansi.h b/libUseful-2.4/ansi.h new file mode 100644 index 0000000..d0e19d6 --- /dev/null +++ b/libUseful-2.4/ansi.h @@ -0,0 +1,37 @@ + +#ifndef LIBUSEFUL_ANSI_H +#define LIBUSEFUL_ANSI_H + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum {ANSI_NONE, ANSI_BLACK, ANSI_RED, ANSI_GREEN, ANSI_YELLOW, ANSI_BLUE, ANSI_MAGENTA, ANSI_CYAN, ANSI_WHITE, ANSI_RESET, ANSI_RESET2, ANSI_DARKGREY, ANSI_LIGHTRED, ANSI_LIGHTGREEN, ANSI_LIGHTYELLOW, ANSI_LIGHTBLUE, ANSI_LIGHTMAGENTA, ANSI_LIGHTCYAN, ANSI_LIGHTWHITE} T_ANSI_COLORS; + +#define TERM_SHOWTEXT 1 +#define TERM_SHOWSTARS 2 +#define TERM_SHOWTEXTSTARS 4 + +#define ANSI_HIDE 65536 +#define ANSI_BOLD 131072 +#define ANSI_FAINT 262144 +#define ANSI_UNDER 524288 +#define ANSI_BLINK 1048576 +#define ANSI_INVERSE 2097152 +#define ANSI_NORM "\x1b[0m" +#define ANSI_BACKSPACE 0x08 + + +char *ANSICode(int Color, int BgColor, int Flags); +char *TerminalReadText(char *RetStr, int Flags, STREAM *S); + + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.4/ansi.o b/libUseful-2.4/ansi.o new file mode 100644 index 0000000..3f9c51b Binary files /dev/null and b/libUseful-2.4/ansi.o differ diff --git a/libUseful-2.0/base64.c b/libUseful-2.4/base64.c similarity index 75% rename from libUseful-2.0/base64.c rename to libUseful-2.4/base64.c index 867c5a5..120d77b 100644 --- a/libUseful-2.0/base64.c +++ b/libUseful-2.4/base64.c @@ -8,9 +8,7 @@ * scheme used here. */ #include - -static const char base64digits[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +#include "defines.h" #define BAD -1 static const char base64val[] = { @@ -23,21 +21,25 @@ static const char base64val[] = { BAD, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,BAD, BAD,BAD,BAD,BAD }; + #define DECODE64(c) (isascii(c) ? base64val[c] : BAD) -void to64frombits(unsigned char *out, const unsigned char *in, int inlen) + + +void Radix64frombits(unsigned char *out, const unsigned char *in, int inlen, const char *base64digits, char pad) /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ { - for (; inlen >= 3; inlen -= 3) - { + for (; inlen >= 3; inlen -= 3) + { *out++ = base64digits[in[0] >> 2]; *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)]; *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; *out++ = base64digits[in[2] & 0x3f]; in += 3; - } - if (inlen > 0) - { + } + + if (inlen > 0) + { unsigned char fragment; *out++ = base64digits[in[0] >> 2]; @@ -45,13 +47,23 @@ void to64frombits(unsigned char *out, const unsigned char *in, int inlen) if (inlen > 1) fragment |= in[1] >> 4; *out++ = base64digits[fragment]; - *out++ = (inlen < 2) ? '=' : base64digits[(in[1] << 2) & 0x3c]; - *out++ = '='; - } - *out = '\0'; + *out++ = (inlen < 2) ? pad : base64digits[(in[1] << 2) & 0x3c]; + *out++ = pad; + } + *out = '\0'; } -int from64tobits(char *out, const char *in) + + +void to64frombits(char *out, const char *in, int inlen) +{ + Radix64frombits(out, in, inlen, BASE64_CHARS,'='); +} + + + + +int Radix64tobits(char *out, const char *in, const char *base64digits, char pad) /* base 64 to raw bytes in quasi-big-endian order, returning count of bytes */ { int len = 0; @@ -70,28 +82,35 @@ int from64tobits(char *out, const char *in) if (DECODE64(digit2) == BAD) return(-1); digit3 = in[2]; - if (digit3 != '=' && DECODE64(digit3) == BAD) + if (digit3 != pad && DECODE64(digit3) == BAD) return(-1); digit4 = in[3]; - if (digit4 != '=' && DECODE64(digit4) == BAD) + if (digit4 != pad && DECODE64(digit4) == BAD) return(-1); in += 4; *out++ = (DECODE64(digit1) << 2) | (DECODE64(digit2) >> 4); ++len; - if (digit3 != '=') + if (digit3 != pad) { *out++ = ((DECODE64(digit2) << 4) & 0xf0) | (DECODE64(digit3) >> 2); ++len; - if (digit4 != '=') + if (digit4 != pad) { *out++ = ((DECODE64(digit3) << 6) & 0xc0) | DECODE64(digit4); ++len; } } } while - (*in && *in != '\r' && digit4 != '='); + (*in && *in != '\r' && digit4 != pad); return (len); } + + +int from64tobits(char *out, const char *in) +{ + return(Radix64tobits(out, in, BASE64_CHARS,'=')); +} + /* base64.c ends here */ diff --git a/libUseful-2.0/base64.h b/libUseful-2.4/base64.h similarity index 54% rename from libUseful-2.0/base64.h rename to libUseful-2.4/base64.h index e6a10d4..2721649 100644 --- a/libUseful-2.0/base64.h +++ b/libUseful-2.4/base64.h @@ -5,6 +5,9 @@ extern "C" { #endif +void Radix64frombits(unsigned char *out, const unsigned char *in, int inlen, const char *base64digits, char pad); +int Radix64tobits(char *out, const char *in, const char *base64digits, char pad); + void to64frombits(unsigned char *out, const unsigned char *in, int inlen); int from64tobits(char *out, const char *in); diff --git a/libUseful-2.4/base64.o b/libUseful-2.4/base64.o new file mode 100644 index 0000000..bbb1418 Binary files /dev/null and b/libUseful-2.4/base64.o differ diff --git a/libUseful-2.4/buckets.c b/libUseful-2.4/buckets.c new file mode 100644 index 0000000..8635f2f --- /dev/null +++ b/libUseful-2.4/buckets.c @@ -0,0 +1,100 @@ +#include "libUseful-2.0/libUseful.h" +#include + +#define FNV_INIT_VAL 2166136261 + +unsigned int fnv_data2bucket(unsigned char *key, int size, int NoOfItems) +{ + unsigned char *p, *end; + unsigned int h = FNV_INIT_VAL; + int i; + + end=key+size; + for (p=key; p < end ; p++ ) h = ( h * 16777619 ) ^ *p; + + return(h % NoOfItems); +} + +unsigned int fnv_string2bucket(unsigned char *key, int size, int NoOfItems) +{ + unsigned char *p; + unsigned int h = FNV_INIT_VAL; + int i; + + for (p=key; *p !='\0' ; p++ ) h = ( h * 16777619 ) ^ *p; + + return(h % NoOfItems); +} + + +unsigned int mmx_hash_bucket_data(unsigned char *key, int size, int NoOfItems) +{ + char *p, *end; + __m64 v1, v2, s; + int val; + + if (size < 8) return(fnv_data2bucket(key, size, NoOfItems)); + + p=key; + end=key+size; + _mm_empty(); // emms + v1=_mm_set1_pi32(FNV_INIT_VAL); + + while ((end-p) > 7) + { + v2=_mm_setr_pi32(*p,*(p+4)); + v1=_mm_add_pi16(v1, v2); + v1=_mm_slli_pi32(v1, 3); + p+=8; + } + + val=_mm_cvtsi64_si32(v1); + _mm_empty(); // emms + + if (val < 0) val=1-val; + val =val % NoOfItems; + return(val); +} + + + + + +main(int argc, char *argv[]) +{ +int val, len; +STREAM *S; +char *Tempstr=NULL; +clock_t start, mid, end; + +S=STREAMOpenFile(argv[1],SF_RDONLY); +start=clock(); +Tempstr=STREAMReadLine(Tempstr,S); +while (Tempstr) +{ + len=StrLen(Tempstr); + val=mmx_hash_bucket_data(Tempstr, len, 9999); + Tempstr=STREAMReadLine(Tempstr,S); +} +end=clock(); + +printf("MMX: %d\n",end-start,val,Tempstr); +STREAMSeek(S,0,SEEK_SET); + +start=clock(); +Tempstr=STREAMReadLine(Tempstr,S); +while (Tempstr) +{ + len=StrLen(Tempstr); + val=fnv_string2bucket(Tempstr,len, 9999); + Tempstr=STREAMReadLine(Tempstr,S); +} +end=clock(); +printf("FNV: %d\n",end-start,val,Tempstr); + + + + +STREAMClose(S); +} + diff --git a/libUseful-2.0/configure b/libUseful-2.4/configure similarity index 94% rename from libUseful-2.0/configure rename to libUseful-2.4/configure index 162cc96..06db83d 100755 --- a/libUseful-2.0/configure +++ b/libUseful-2.4/configure @@ -674,9 +674,11 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking -enable_largefiles +enable_largefile +enable_sendfile +enable_ip6 enable_ssl -enable_z +enable_zlib enable_oss ' ac_precious_vars='build_alias @@ -1295,7 +1297,9 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-largefiles enable largefile support + --disable-largefile omit support for large files + --enable-sendfile enable sendfile support + --enable-ip6 enable IPv6 support --enable-ssl use Secure Sockets Layer --enable-zlib use ZLib Compression --enable-oss use Open Sound System @@ -1553,73 +1557,6 @@ fi } # ac_fn_c_try_link -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* 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_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using @@ -1737,6 +1674,73 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -3300,28 +3304,325 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if ${ac_cv_sys_largefile_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if ${ac_cv_sys_file_offset_bits+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if ${ac_cv_sys_large_files+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi + + +fi + cf_have_libssl=no cf_have_libcrypto=no -cf_have_libz=no +cf_have_libz=yes cf_have_oss=no cf_have_libesd=no +cf_have_sendfile=no +cf_have_ptsname_r=no + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ptsname_r in -lc" >&5 +$as_echo_n "checking for ptsname_r in -lc... " >&6; } +if ${ac_cv_lib_c_ptsname_r+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ptsname_r (); +int +main () +{ +return ptsname_r (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_ptsname_r=yes +else + ac_cv_lib_c_ptsname_r=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_ptsname_r" >&5 +$as_echo "$ac_cv_lib_c_ptsname_r" >&6; } +if test "x$ac_cv_lib_c_ptsname_r" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBC 1 +_ACEOF + + LIBS="-lc $LIBS" + +fi + +cf_have_ptsname_r=$ac_cv_lib_c_ptsname_r +if test "$cf_have_ptsname_r" +then +$as_echo "#define HAVE_PTSNAME_R 1" >>confdefs.h + +fi -# Check whether --enable-largefiles was given. -if test "${enable_largefiles+set}" = set; then : - enableval=$enable_largefiles; cf_use_largefiles=$enableval +# Check whether --enable-sendfile was given. +if test "${enable_sendfile+set}" = set; then : + enableval=$enable_sendfile; cf_use_sendfile=$enableval fi -if test "$cf_use_largefiles" = "yes" +if test "$cf_use_sendfile" != "no" then -$as_echo "#define _LARGEFILE64_SOURCE 1" >>confdefs.h +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +ac_fn_c_check_header_mongrel "$LINENO" "sys/sendfile.h" "ac_cv_header_sys_sendfile_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_sendfile_h" = xyes; then : + cf_have_sendfile=yes +else + cf_have_sendfile=no +fi + + +fi + +if test "$cf_have_sendfile" = "yes" +then +$as_echo "#define USE_SENDFILE 1" >>confdefs.h + +fi + + + +# Check whether --enable-ip6 was given. +if test "${enable_ip6+set}" = set; then : + enableval=$enable_ip6; cf_use_ip6=$enableval +fi + -$as_echo "#define _FILE_OFFSET_BITS 64" >>confdefs.h +if test "$cf_use_ip6" = "yes" +then +$as_echo "#define USE_INET6 1" >>confdefs.h fi + # Check whether --enable-ssl was given. if test "${enable_ssl+set}" = set; then : enableval=$enable_ssl; cf_use_ssl=$enableval @@ -3471,9 +3772,9 @@ cf_use_zlib=yes fi -# Check whether --enable-z was given. -if test "${enable_z+set}" = set; then : - enableval=$enable_z; cf_use_zlib=$enableval +# Check whether --enable-zlib was given. +if test "${enable_zlib+set}" = set; then : + enableval=$enable_zlib; cf_use_zlib=$enableval fi @@ -3538,23 +3839,6 @@ cf_use_oss=yes if test "$cf_use_oss" = "yes" then -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default" if test "x$ac_cv_header_sys_soundcard_h" = xyes; then : $as_echo "#define HAVE_OSS 1" >>confdefs.h @@ -3619,7 +3903,6 @@ fi cf_have_libesd=$ac_cv_lib_esd_esd_open_sound fi - ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF @@ -4777,3 +5060,43 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + +echo +echo +echo "############# libUseful Build Config: #############" +if test "$ac_cv_sys_file_offset_bits" = "64" +then +echo "Largefiles ( > 2GB ) enabled" +else +echo "Largefiles ( > 2GB ) NOT enabled" +fi + +if test "$cf_have_sendfile" = "yes" +then +echo "Linux sendfile syscall enabled" +else +echo "Linux sendfile syscall NOT enabled" +fi + +if test "$cf_use_ip6" = "yes" +then +echo "IPv6 enabled" +else +echo "IPv6 NOT enabled" +fi + +if test "$cf_have_libssl" = "yes" +then +echo "SSL/TLS enabled" +else +echo "SSL/TLS NOT enabled" +fi + +if test "$cf_use_zlib" = "yes" +then +echo "zlib support enabled" +else +echo "zlib NOT enabled" +fi + + diff --git a/libUseful-2.0/configure.in b/libUseful-2.4/configure.ac similarity index 55% rename from libUseful-2.0/configure.in rename to libUseful-2.4/configure.ac index 75a048a..b51a769 100644 --- a/libUseful-2.0/configure.in +++ b/libUseful-2.4/configure.ac @@ -4,26 +4,51 @@ AC_INIT(defines.h) VERSION="0.0.1" AC_SUBST(VERSION) -AC_PROG_CC -AC_LANG_C -AC_PROG_MAKE_SET -AC_HEADER_STDC +AC_PROG_CC +AC_LANG_C +AC_PROG_MAKE_SET +AC_HEADER_STDC +AC_SYS_LARGEFILE cf_have_libssl=no cf_have_libcrypto=no -cf_have_libz=no +cf_have_libz=yes cf_have_oss=no cf_have_libesd=no +cf_have_sendfile=no +cf_have_ptsname_r=no -AC_ARG_ENABLE(largefiles, [ --enable-largefiles enable largefile support], cf_use_largefiles=$enableval ) +AC_CHECK_LIB(c,ptsname_r,,) +cf_have_ptsname_r=$ac_cv_lib_c_ptsname_r +if test "$cf_have_ptsname_r" +then +AC_DEFINE([HAVE_PTSNAME_R]) +fi + + +AC_ARG_ENABLE(sendfile, [ --enable-sendfile enable sendfile support], cf_use_sendfile=$enableval ) + +if test "$cf_use_sendfile" != "no" +then +AC_CHECK_HEADER(sys/sendfile.h,cf_have_sendfile=yes,cf_have_sendfile=no,) +fi + +if test "$cf_have_sendfile" = "yes" +then +AC_DEFINE([USE_SENDFILE]) +fi + + + +AC_ARG_ENABLE(ip6, [ --enable-ip6 enable IPv6 support], cf_use_ip6=$enableval ) -if test "$cf_use_largefiles" = "yes" +if test "$cf_use_ip6" = "yes" then -AC_DEFINE([_LARGEFILE64_SOURCE]) -AC_DEFINE([_FILE_OFFSET_BITS],[64]) +AC_DEFINE([USE_INET6],1) fi + AC_ARG_ENABLE(ssl, [ --enable-ssl use Secure Sockets Layer], cf_use_ssl=$enableval ) if test "$cf_use_ssl" = "yes" @@ -55,7 +80,7 @@ cf_use_zlib=yes fi -AC_ARG_ENABLE(z, [ --enable-zlib use ZLib Compression], cf_use_zlib=$enableval ) +AC_ARG_ENABLE(zlib, [ --enable-zlib use ZLib Compression], cf_use_zlib=$enableval ) if test "$cf_use_zlib" = "yes" then @@ -83,6 +108,45 @@ AC_CHECK_LIB(esd,esd_open_sound,,) cf_have_libesd=$ac_cv_lib_esd_esd_open_sound fi - dnl read Makefile.in and write Makefile AC_OUTPUT(Makefile) + +echo +echo +echo "############# libUseful Build Config: #############" +if test "$ac_cv_sys_file_offset_bits" = "64" +then +echo "Largefiles ( > 2GB ) enabled" +else +echo "Largefiles ( > 2GB ) NOT enabled" +fi + +if test "$cf_have_sendfile" = "yes" +then +echo "Linux sendfile syscall enabled" +else +echo "Linux sendfile syscall NOT enabled" +fi + +if test "$cf_use_ip6" = "yes" +then +echo "IPv6 enabled" +else +echo "IPv6 NOT enabled" +fi + +if test "$cf_have_libssl" = "yes" +then +echo "SSL/TLS enabled" +else +echo "SSL/TLS NOT enabled" +fi + +if test "$cf_use_zlib" = "yes" +then +echo "zlib support enabled" +else +echo "zlib NOT enabled" +fi + + diff --git a/libUseful-2.0/crc32.c b/libUseful-2.4/crc32.c similarity index 100% rename from libUseful-2.0/crc32.c rename to libUseful-2.4/crc32.c diff --git a/libUseful-2.0/crc32.h b/libUseful-2.4/crc32.h similarity index 100% rename from libUseful-2.0/crc32.h rename to libUseful-2.4/crc32.h diff --git a/libUseful-2.4/crc32.o b/libUseful-2.4/crc32.o new file mode 100644 index 0000000..8a724e1 Binary files /dev/null and b/libUseful-2.4/crc32.o differ diff --git a/libUseful-2.4/defines.h b/libUseful-2.4/defines.h new file mode 100644 index 0000000..1d3dd2e --- /dev/null +++ b/libUseful-2.4/defines.h @@ -0,0 +1,53 @@ +#ifndef LIBUSEFUL_DEFINES_H +#define LIBUSEFUL_DEFINES_H + +#define FALSE 0 +#define TRUE 1 + +#define FTIMEOUT -2 + + +#define ENCODE_NONE 0 +#define ENCODE_OCTAL 8 +#define ENCODE_DECIMAL 10 +#define ENCODE_HEX 16 +#define ENCODE_HEXUPPER 17 +#define ENCODE_BASE64 64 +#define ENCODE_IBASE64 65 +#define ENCODE_PBASE64 66 +#define ENCODE_XXENC 67 +#define ENCODE_UUENC 68 +#define ENCODE_CRYPT 69 + +#define ENCODE_ASCII85 85 +#define ENCODE_Z85 86 + +#define SUBS_QUOTE_VARS 1 +#define SUBS_CASE_VARNAMES 2 +#define SUBS_STRIP_VARS_WHITESPACE 4 +#define SUBS_INTERPRET_BACKSLASH 8 +#define SUBS_QUOTES 16 + +#define HEX_CHARS "0123456789ABCDEF" +#define ALPHA_CHARS "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +#define BASE64_CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" +#define IBASE64_CHARS "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789+/" +#define SBASE64_CHARS "0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" +#define CRYPT_CHARS "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +#define UUENC_CHARS " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" +#define XXENC_CHARS "+-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +#define ASCII85_CHARS "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstu" +#define Z85_CHARS "01234567899abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#." + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int (*BASIC_FUNC)(void *Data); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libUseful-2.0/expect.c b/libUseful-2.4/expect.c similarity index 96% rename from libUseful-2.0/expect.c rename to libUseful-2.4/expect.c index 34494d1..2c3fcab 100644 --- a/libUseful-2.0/expect.c +++ b/libUseful-2.4/expect.c @@ -33,7 +33,7 @@ free(ExpectDialog); int STREAMExpectDialog(STREAM *S, ListNode *ExpectDialogs) { -int len=0, inchar; +int inchar; ListNode *Curr; TExpectDialog *ExpectDialog; @@ -96,7 +96,11 @@ while (inchar !=EOF) match++; if (match==len) { - if (Reply) STREAMWriteLine(Reply,S); + if (Reply) + { + STREAMWriteLine(Reply,S); + STREAMFlush(S); + } return(TRUE); } } diff --git a/libUseful-2.0/expect.h b/libUseful-2.4/expect.h similarity index 100% rename from libUseful-2.0/expect.h rename to libUseful-2.4/expect.h diff --git a/libUseful-2.4/expect.o b/libUseful-2.4/expect.o new file mode 100644 index 0000000..5778204 Binary files /dev/null and b/libUseful-2.4/expect.o differ diff --git a/libUseful-2.4/file.c b/libUseful-2.4/file.c new file mode 100644 index 0000000..f982b80 --- /dev/null +++ b/libUseful-2.4/file.c @@ -0,0 +1,1578 @@ +#include "includes.h" +#include "DataProcessing.h" +#include "pty.h" +#include "expect.h" +#include +#include "securemem.h" +#include + +#ifdef HAVE_LIBSSL +#include +#include +#include +#include +#include +#endif + + +//A difficult function to fit in order +int STREAMReadCharsToBuffer(STREAM *S); + + +int FDSelect(int fd, int Flags, struct timeval *tv) +{ +fd_set *readset=NULL, *writeset=NULL; +int result, RetVal=0; + + +if (Flags & SELECT_READ) +{ + readset=(fd_set *) calloc(1,sizeof(fd_set)); + FD_ZERO(readset); + FD_SET(fd, readset); +} + +if (Flags & SELECT_WRITE) +{ + writeset=(fd_set *) calloc(1,sizeof(fd_set)); + FD_ZERO(writeset); + FD_SET(fd, writeset); +} + + +result=select(fd+1,readset,writeset,NULL,tv); +if ((result==-1) && (errno==EBADF)) RetVal=0; +else if (result > 0) +{ + if (readset && FD_ISSET(fd, readset)) RetVal |= SELECT_READ; + if (writeset && FD_ISSET(fd, writeset)) RetVal |= SELECT_WRITE; +} + +if (readset) free(readset); +if (writeset) free(writeset); + +return(RetVal); +} + + +int FDIsWritable(int fd) +{ +struct timeval tv; + +tv.tv_sec=0; +tv.tv_usec=0; +if (FDSelect(fd, SELECT_WRITE, &tv) & SELECT_WRITE) return(TRUE); +return(FALSE); +} + + + +int FDCheckForBytes(int fd) +{ +struct timeval tv; + +tv.tv_sec=0; +tv.tv_usec=0; +if (FDSelect(fd, SELECT_READ, &tv) & SELECT_READ) return(TRUE); +return(FALSE); +} + + + +/*STREAM Functions */ + +void STREAMSetFlags(STREAM *S, int Set, int UnSet) +{ +int val; + + S->Flags &= ~UnSet; + S->Flags |= Set; + + //yes, flags are RETURNED, argument ignored + val=fcntl(S->in_fd,F_GETFL,NULL); + + //Handling nonblock flag involves setting nonblock on or off + //sadly fcntl does not honor O_CLOEXEC flag, so we have to set + //that using F_SETFD below + if (S->Flags & SF_NONBLOCK) val |= O_NONBLOCK; + else val &= (~O_NONBLOCK); + + //these two sets of flags should be the same + fcntl(S->in_fd, F_SETFL, val); + fcntl(S->out_fd, F_SETFL, val); + + + //F_GETFD, NOT F_GETFL as above + val=fcntl(S->in_fd,F_GETFD, NULL); + //Handling close-on-exec flag + if (S->Flags & SF_EXEC_INHERIT) val &= (~FD_CLOEXEC); + else val |= FD_CLOEXEC; + + //NOTE F_SETFD IS NOT SAME AS F_SETFL ABOVE! + //these two sets of flags should be the same + fcntl(S->in_fd, F_SETFD, val); + fcntl(S->out_fd, F_SETFD, val); +} + + +/*Set timeout for select calls within STREAM*/ +void STREAMSetTimeout(STREAM *S, int val) +{ +S->Timeout=val; +} + + +/*Set flush type for STREAM*/ +void STREAMSetFlushType(STREAM *S, int Type, int StartPoint, int BlockSize) +{ +S->Flags &= ~(FLUSH_ALWAYS | FLUSH_LINE | FLUSH_BLOCK | FLUSH_BUFFER); +S->Flags |= Type; +S->StartPoint=StartPoint; +S->BlockSize=BlockSize; +} + +/* This reads chunks from a file and when if finds a newline it resets */ +/* the file pointer to that position */ +void STREAMResizeBuffer(STREAM *S, int size) +{ + if (S->Flags & SF_MMAP) return; + + if (S->Flags & SF_SECURE) + { + if (! (S->Flags & SF_WRONLY)) SecureRealloc(&S->InputBuff, S->BuffSize, size, SMEM_SECURE); + if (! (S->Flags & SF_RDONLY)) SecureRealloc(&S->OutputBuff, S->BuffSize, size, SMEM_SECURE); + } + else + { + if (! (S->Flags & SF_WRONLY)) S->InputBuff =(char *) realloc(S->InputBuff,size); + if (! (S->Flags & SF_RDONLY)) S->OutputBuff=(char *) realloc(S->OutputBuff,size); + } + S->BuffSize=size; + + if (S->InStart > S->BuffSize) S->InStart=0; + if (S->InEnd > S->BuffSize) S->InEnd=0; + if (S->OutEnd > S->BuffSize) S->OutEnd=0; +} + + + + +int STREAMCheckForBytes(STREAM *S) +{ +off_t pos; +struct stat Stat; + + if (! S) return(FALSE); + if (S->State & SS_EMBARGOED) return(FALSE); + if (S->InEnd > S->InStart) return(TRUE); + if (S->in_fd==-1) return(FALSE); + + if (S->Flags & SF_FOLLOW) + { + while (1) + { + pos=STREAMTell(S); + fstat(S->in_fd,&Stat); + if (Stat.st_size > pos) return(TRUE); + } + } + return(FDCheckForBytes(S->in_fd)); +} + + + +int STREAMCountWaitingBytes(STREAM *S) +{ +int read_result=0, result; + + if (! S) return(0); + if (S->State & SS_EMBARGOED) return(0); + + result=FDCheckForBytes(S->in_fd); + if (result > 0) read_result=STREAMReadCharsToBuffer(S); + else if (result < 0) read_result=STREAM_CLOSED; + result=S->InEnd - S->InStart; + + if (result > 0) return(result); + if (read_result==STREAM_CLOSED) return(STREAM_CLOSED); + if (read_result==STREAM_DATA_ERROR) return(STREAM_CLOSED); + return(0); +} + + +STREAM *STREAMSelect(ListNode *Streams, struct timeval *tv) +{ + fd_set SelectSet; + STREAM *S; + ListNode *Curr; + int highfd=0, result; + + FD_ZERO(&SelectSet); + + Curr=ListGetNext(Streams); + while (Curr) + { + S=(STREAM *) Curr->Item; + if (! (S->State & SS_EMBARGOED)) + { + //Pump any data in the stream + STREAMFlush(S); + if (S->InEnd > S->InStart) return(S); + FD_SET(S->in_fd,&SelectSet); + if (S->in_fd > highfd) highfd=S->in_fd; + } + + Curr=ListGetNext(Curr); + } + + result=select(highfd+1,&SelectSet,NULL,NULL,tv); + + if (result > 0) + { + Curr=ListGetNext(Streams); + while (Curr) + { + S=(STREAM *) Curr->Item; + if (FD_ISSET(S->in_fd,&SelectSet)) return(S); + Curr=ListGetNext(Curr); + } + } + + return(NULL); +} + + +int STREAMCheckForWaitingChar(STREAM *S,unsigned char check_char) +{ +int read_result=0, result; +char *found_char; + +if (! S) return(0); +if (S->State & SS_EMBARGOED) return(0); + +result=FDCheckForBytes(S->in_fd); +if (result > 0) read_result=STREAMReadCharsToBuffer(S); +else if (result < 0) read_result=STREAM_CLOSED; + +if (S->InStart < S->InEnd) +{ + found_char=memchr(S->InputBuff + S->InStart,check_char,S->InEnd - S->InStart); + if (found_char > 0) return(TRUE); +} + +if (read_result==STREAM_CLOSED) return(STREAM_CLOSED); +if (read_result==STREAM_DATA_ERROR) return(STREAM_CLOSED); +return(FALSE); +} + + + +int STREAMInternalFinalWriteBytes(STREAM *S, const char *Data, int DataLen) +{ +fd_set selectset; +int result=0, count=0, len; +struct timeval tv; + +if (! S) return(STREAM_CLOSED); +if (S->out_fd==-1) return(STREAM_CLOSED); + + +//if we are flushing blocks, then pad out to the blocksize +if (S->Flags & FLUSH_BLOCK) +{ +DataLen=S->BlockSize; +if (DataLen > S->OutEnd) DataLen=S->OutEnd; + +/* + if (DataLen < S->BlockSize) + { + if (DataLen==0) DataLen=S->BlockSize; + else + { + len=(DataLen / S->BlockSize) * S->BlockSize; + if (S->OutEnd > len) len+=S->BlockSize; + memset(S->OutputBuff+S->OutEnd,0,len - S->OutEnd); + DataLen=len; + } + } +*/ +} + +while (count < DataLen) +{ +if (S->State & SS_SSL) +{ +#ifdef HAVE_LIBSSL +result=SSL_write((SSL *) STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"), Data + count, DataLen - count); +#endif +} +else +{ + if (S->Timeout > 0) + { + FD_ZERO(&selectset); + FD_SET(S->out_fd, &selectset); + result=(S->Timeout % 100); + tv.tv_usec=result * 10000; + tv.tv_sec=S->Timeout / 100; + result=select(S->out_fd+1,NULL,&selectset,NULL,&tv); + + if (result==-1) return(STREAM_CLOSED); + if (result == 0) return(STREAM_TIMEOUT); + } + + if (S->Flags & SF_WRLOCK) flock(S->out_fd,LOCK_EX); + result=DataLen-count; + //if (S->BlockSize && (S->BlockSize < (DataLen-count))) result=S->BlockSize; + result=write(S->out_fd, Data + count, result); + if (S->Flags & SF_WRLOCK) flock(S->out_fd,LOCK_UN); + + //yes, we neglect to do a sync. The idea here is to work opportunisitically, flushing out those pages + //that have been written. We do a sync and another fadvise in STREAMClose + #ifdef POSIX_FADV_DONTNEED + if (S->Flags & SF_NOCACHE) posix_fadvise(S->out_fd, 0,0,POSIX_FADV_DONTNEED); + #endif + +} + + + if (result < 1 && (errno !=EINTR) ) break; + if (result < 0) result=0; + count+=result; + S->BytesWritten+=result; +} + + +//memmove any remaining data so that we add onto the end of it +S->OutEnd -= count; +if (S->OutEnd > 0) memmove(S->OutputBuff,S->OutputBuff+count, S->OutEnd); + + +return(count); +} + + + + +int STREAMFlush(STREAM *S) +{ + return(STREAMInternalFinalWriteBytes(S, S->OutputBuff, S->OutEnd)); +} + +void STREAMClear(STREAM *S) +{ + STREAMFlush(S); + S->InStart=0; +} + + +/*A stream can have a series of 'processor modules' associated with it' */ +/*which do things to the data before it is read/written. This function */ +/*pumps the data through the processor list, and eventually writes it out */ +int STREAMReadThroughProcessors(STREAM *S, char *Bytes, int InLen) +{ +TProcessingModule *Mod; +ListNode *Curr; +char *InBuff=NULL, *OutputBuff=NULL; +int len=0, olen=0, state=STREAM_CLOSED, Flush; + + +len=InLen; + +if (InLen > 0) +{ +InBuff=SetStrLen(InBuff,len+1); +memcpy(InBuff,Bytes ,len); +} + +Curr=ListGetNext(S->ProcessingModules); +while (Curr) +{ + Mod=(TProcessingModule *) Curr->Item; + if (len < BUFSIZ) olen=BUFSIZ; + else olen=len * 8; + + OutputBuff=SetStrLen(OutputBuff,olen); + + if (Mod->Read) + { + if (len < 0) Flush=TRUE; + else Flush=FALSE; + len=Mod->Read(Mod,InBuff,len,&OutputBuff,&olen, Flush); + + if (len != STREAM_CLOSED) state=0; + + if (len > 0) + { + InBuff=SetStrLen(InBuff,len); + memcpy(InBuff,OutputBuff,len); + } + } + + Curr=ListGetNext(Curr); +} + +if ( + (! (S->State & SS_DATA_ERROR)) && + (len > 0) + ) +{ +//Whatever happened above, InBuff should now contain the data to be written! +//note that we resize buff to S->InEnd + len, where len is length of the new +//data. Even if S->InStart > 0 (meaning there are 'sent' bytes in the buffer) +//we consider S->InStart to be 0 as regards sizeing the buffer, because those +//sent bytes are still there. +if ((len + S->InEnd) > S->BuffSize) STREAMResizeBuffer(S, len + S->InEnd); +memcpy(S->InputBuff + S->InEnd, InBuff, len); +S->InEnd+=len; +} + +DestroyString(OutputBuff); +DestroyString(InBuff); + +len=S->InEnd - S->InStart; + +if (len==0) +{ + if (state ==STREAM_CLOSED) return(STREAM_TIMEOUT); + if (S->State & SS_DATA_ERROR) return(STREAM_DATA_ERROR); +} +return(len); +} + + + + +int STREAMLock(STREAM *S, int val) +{ +int result; + +result=flock(S->in_fd,val); + +if (result==0) return(TRUE); +return(FALSE); +} + + +STREAM *STREAMCreate() +{ +STREAM *S; + +S=(STREAM *) calloc(1,sizeof(STREAM)); +STREAMResizeBuffer(S,BUFSIZ); +S->in_fd=-1; +S->out_fd=-1; +S->Timeout=3000; +S->Flags |= FLUSH_ALWAYS; + +return(S); +} + +STREAM *STREAMFromFD(int fd) +{ +STREAM *Stream; + +if (fd==-1) return(NULL); + +Stream=STREAMCreate(); +Stream->in_fd=fd; +Stream->out_fd=fd; +return(Stream); +} + + +STREAM *STREAMFromDualFD(int in_fd, int out_fd) +{ +STREAM *Stream; + +if (in_fd==-1) return(NULL); +if (out_fd==-1) return(NULL); + +Stream=STREAMCreate(); +Stream->in_fd=in_fd; +Stream->out_fd=out_fd; +return(Stream); +} + + + +int STREAMOpenMMap(STREAM *S, int offset, int len, int Flags) +{ +char *ptr; +int MProt=PROT_READ; + +if (S->InputBuff) free(S->InputBuff); +if (Flags & (SF_WRONLY | SF_RDWR)) MProt |= PROT_WRITE; +ptr=(char *) mmap(0, len, MProt, MAP_SHARED, S->in_fd, offset); +if (ptr==MAP_FAILED) return(FALSE); +S->InEnd=len; +S->InStart=0; +S->Flags |= SF_MMAP; +S->InputBuff=ptr; +if (Flags & SF_SECURE) mlock(ptr, len); + +return(TRUE); +} + + +STREAM *STREAMOpenFile(const char *FilePath, int Flags) +{ +int fd, Mode=0; +STREAM *Stream; +struct stat myStat; + +if (Flags & SF_WRONLY) Mode=O_WRONLY; +else if (Flags & SF_RDONLY) Mode=O_RDONLY; +else Mode=O_RDWR; + +if (Flags & SF_CREATE) Mode |= O_CREAT; + +if (strcmp(FilePath,"-")==0) +{ +Stream=STREAMFromDualFD(0,1); +Stream->Path=CopyStr(Stream->Path,FilePath); +Stream->Flags=Flags; +} +else +{ + fd=open(FilePath, Mode, 0600); + if (fd==-1) return(NULL); + + if (Flags & SF_WRLOCK) + { + if (flock(fd,LOCK_EX | LOCK_NB)==-1) + { + close(fd); + return(NULL); + } + } + + if (Flags & SF_RDLOCK) + { + if (flock(fd,LOCK_SH | LOCK_NB)==-1) + { + close(fd); + return(NULL); + } + } + + + // check for symlink naughtyness. Basically a malicious user can + // try to guess the name of the file we are going to open in order + // to get us to write somewhere other than intended. + + + if (! (Flags & SF_SYMLINK_OK)) + { + if (lstat(FilePath, &myStat) !=0) + { + close(fd); + return(NULL); + } + + if (S_ISLNK(myStat.st_mode)) + { + syslog(LOG_USER | LOG_WARNING, "STREAMOpenFile Opened symlink when trying to open %s. Possible DOS attack?",FilePath); + close(fd); + return(NULL); + } + } + else + { + stat(FilePath, &myStat); + } + + //CREATE THE STREAM OBJECT !! + Stream=STREAMFromFD(fd); + STREAMSetTimeout(Stream,0); + + if ( (Flags & (SF_RDONLY | SF_MMAP)) == (SF_RDONLY | SF_MMAP) ) STREAMOpenMMap(Stream, 0, myStat.st_size, Flags); + else + { + if (Flags & SF_TRUNC) ftruncate(fd,0); + if (Flags & SF_APPEND) lseek(fd,0,SEEK_END); + } + +} +Stream->Flags |= Flags; +if (Stream->Flags & SF_SECURE) STREAMResizeBuffer(Stream, Stream->BuffSize); +Stream->Path=CopyStr(Stream->Path,FilePath); +STREAMSetFlushType(Stream,FLUSH_FULL,0,0); + +return(Stream); +} + + +STREAM *STREAMClose(STREAM *S) +{ +ListNode *Curr; +int val; + +if (! S) return(NULL); + +STREAMReadThroughProcessors(S, NULL, 0); +STREAMFlush(S); + +if ( + (StrLen(S->Path)==0) || + (strcmp(S->Path,"-") !=0) + ) +{ + if ((S->out_fd != -1) && (S->out_fd != S->in_fd)) + { + #ifdef POSIX_FADV_DONTNEED + if (S->Flags & SF_NOCACHE) + { + fdatasync(S->out_fd); + posix_fadvise(S->out_fd, 0,0,POSIX_FADV_DONTNEED); + } + #endif + + close(S->out_fd); + } + + if (S->in_fd != -1) + { + #ifdef POSIX_FADV_DONTNEED + if (S->Flags & SF_NOCACHE) posix_fadvise(S->in_fd, 0,0,POSIX_FADV_DONTNEED); + #endif + + close(S->in_fd); + } +} + +Curr=ListGetNext(S->Values); +while (Curr) +{ + if (strncmp(Curr->Tag,"HelperPID",9)==0) + { + val=atoi(Curr->Item); + if (val > 1) kill(val, SIGKILL); + } + Curr=ListGetNext(Curr); +} + +if (S->Flags & SF_SECURE) +{ + SecureDestroy(S->InputBuff,S->BuffSize); + SecureDestroy(S->OutputBuff,S->BuffSize); +} +else +{ + if (! (S->Flags & SF_MMAP)) DestroyString(S->InputBuff); + DestroyString(S->OutputBuff); +} + +ListDestroy(S->Values,(LIST_ITEM_DESTROY_FUNC)DestroyString); +ListDestroy(S->ProcessingModules,DataProcessorDestroy); +DestroyString(S->Path); +free(S); + +return(NULL); +} + + +int STREAMDisassociateFromFD(STREAM *S) +{ +int fd; + +if (! S) return(-1); +fd=S->in_fd; +STREAMFlush(S); +if (! (S->Flags & SF_MMAP)) DestroyString(S->InputBuff); +DestroyString(S->OutputBuff); +DestroyString(S->Path); +free(S); +return(fd); +} + + + + +int STREAMReadCharsToBuffer(STREAM *S) +{ +fd_set selectset; +int result=0, diff, read_result=0, WaitForBytes=TRUE; +struct timeval tv; +char *tmpBuff=NULL; +#ifdef HAVE_LIBSSL +void *SSL_CTX=NULL; +#endif + +if (! S) return(0); + +//we don't read from and embargoed stream. Embargoed is a state that we +//use to indicate a stream must be ignored for a while +if (S->State & SS_EMBARGOED) return(0); + +//we don't read to mmaped streams. We just update pointers to the mmap +if (S->Flags & SF_MMAP) +{ + result=S->InEnd-S->InStart; + if (result < 1) return(STREAM_CLOSED); + return(result); +} + + +if (S->InStart >= S->InEnd) +{ + S->InEnd=0; + S->InStart=0; +} + +diff=S->InEnd-S->InStart; + +if (S->InStart > (S->BuffSize / 2)) +{ + memmove(S->InputBuff,S->InputBuff + S->InStart,diff); + S->InStart=0; + S->InEnd=diff; +} + +//if no room in buffer, we can't read in more bytes +if (S->InEnd >= S->BuffSize) return(1); + + +//This is used in multiple places below, do don't just move it to within the first place +#ifdef HAVE_LIBSSL +SSL_CTX=STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"); +#endif + +//if there are bytes available in the internal OpenSSL buffers, when we don't have to +//wait on a select, we can just go straight through to SSL_read +#ifdef HAVE_LIBSSL +if (S->State & SS_SSL) +{ +if (SSL_pending((SSL *) SSL_CTX) > 0) WaitForBytes=FALSE; +} +#endif + + +//if ((S->Timeout > 0) && (! (S->Flags & SF_NONBLOCK)) && WaitForBytes) +if ((S->Timeout > 0) && WaitForBytes) +{ + FD_ZERO(&selectset); + FD_SET(S->in_fd, &selectset); + result=(S->Timeout % 100); + tv.tv_usec=result * 10000; + tv.tv_sec=S->Timeout / 100; + result=select(S->in_fd+1,&selectset,NULL,NULL,&tv); + + + switch (result) + { + //we are only checking one FD, so should be 1 + case 1: + read_result=0; + break; + + case 0: + errno=ETIMEDOUT; + read_result=STREAM_TIMEOUT; + break; + + default: + if (errno==EINTR) read_result=STREAM_TIMEOUT; + else read_result=STREAM_CLOSED; + break; + + } + +} + +//must do this, as we need it to be 0 if we don't do the reads +result=0; + +if (read_result==0) +{ + tmpBuff=SetStrLen(tmpBuff,S->BuffSize-S->InEnd); + + #ifdef HAVE_LIBSSL + if (S->State & SS_SSL) + { + read_result=SSL_read((SSL *) SSL_CTX, tmpBuff, S->BuffSize-S->InEnd); + } + else + #endif + { + if (S->Flags & SF_RDLOCK) flock(S->in_fd,LOCK_SH); + read_result=read(S->in_fd, tmpBuff, S->BuffSize-S->InEnd); + if (S->Flags & SF_RDLOCK) flock(S->in_fd,LOCK_UN); + } + + if (read_result > 0) + { + result=read_result; + S->BytesRead+=read_result; + } + else + { + if ((read_result == -1) && (errno==EAGAIN)) result=STREAM_NODATA; + else result=STREAM_CLOSED; + } +} + +if (result < 0) read_result=STREAMReadThroughProcessors(S, tmpBuff, 0); +else read_result=STREAMReadThroughProcessors(S, tmpBuff, result); + +if (read_result < 1) +{ + if (result < 0) read_result=result; + else read_result=STREAM_NODATA; +} + + +//We are not returning number of bytes read. We only return something if +//there is a condition (like socket close) where the thing we are waiting for +//may not appear + +DestroyString(tmpBuff); +return(read_result); +} + + +inline int STREAMTransferBytesOut(STREAM *S, char *Dest, int DestSize) +{ +int bytes; + + bytes=S->InEnd - S->InStart; + + if (bytes > DestSize) bytes=DestSize; + if (bytes < 1) return(0); + + memcpy(Dest,S->InputBuff+S->InStart,bytes); + S->InStart+=bytes; + + return(bytes); +} + + + +int STREAMReadBytes(STREAM *S, char *Buffer, int Buffsize) +{ +int bytes=0, result=0, total=0; + + +if (S->InStart >= S->InEnd) +{ + result=STREAMReadCharsToBuffer(S); + if (S->InStart >= S->InEnd) + { + if (result==STREAM_CLOSED) return(STREAM_CLOSED); + if (result==STREAM_TIMEOUT) return(STREAM_TIMEOUT); + if (result==STREAM_DATA_ERROR) return(STREAM_DATA_ERROR); + } +} + +while (total < Buffsize) +{ + total+=STREAMTransferBytesOut(S, Buffer+total, Buffsize-total); + + bytes=S->InEnd - S->InStart; + + if (bytes < 1) + { + //in testing, the best way to prevent doing constant checking for new bytes, + //and so filling up the buffer, was to only check for new bytes if + //we didn't have enough to satisfy another read like the one we just had + + //We must check for '< 1' rather than '-1' because + if (S->Flags & SF_MMAP) result=-1; + else result=FDCheckForBytes(S->in_fd); + + if (result ==-1) + { + if (total==0) total=STREAM_CLOSED; + break; + } + if (result < 1) break; + + result=STREAMReadCharsToBuffer(S); + if (result < 1) + { + if (total > 0) return(total); + else return(result); + } + } + + +} +return(total); +} + + + +double STREAMTell(STREAM *S) +{ +double pos; + +if (S->Flags & SF_MMAP) return((double) S->InStart); +if (S->OutEnd > 0) STREAMFlush(S); + +#ifdef _LARGEFILE64_SOURCE +pos=(double) lseek64(S->in_fd,0,SEEK_CUR); +#else +pos=(double) lseek(S->in_fd,0,SEEK_CUR); +#endif +pos-=(S->InEnd-S->InStart); + +return(pos); +} + + +double STREAMSeek(STREAM *S, double offset, int whence) +{ +double pos; +int wherefrom; + +if (S->Flags & SF_MMAP) +{ + switch (whence) + { + case SEEK_SET: S->InStart=offset; break; + case SEEK_CUR: S->InStart += offset; break; + case SEEK_END: S->InStart=S->InEnd-offset; break; + } + return((double) S->InStart); +} + +if (S->OutEnd > 0) STREAMFlush(S); + +if (whence==SEEK_CUR) +{ + pos=STREAMTell(S); + pos+=offset; + wherefrom=SEEK_SET; +} +else +{ + pos=offset; + wherefrom=whence; +} +S->InStart=0; +S->InEnd=0; + +#ifdef _LARGEFILE64_SOURCE +pos=(double) lseek64(S->in_fd,(off64_t) pos, wherefrom); +#else +pos=(double) lseek(S->in_fd,(off_t) pos, wherefrom); +#endif + + +return(pos); +} + + + +int STREAMInternalPushProcessingModules(STREAM *S, const char *InData, int InLen, char **OutData, int *OutLen) +{ +TProcessingModule *Mod; +ListNode *Curr, *Next; +int len, AllDataWritten=TRUE; +char *TempBuff=NULL; +const char *ptr; +int Flush=FALSE; + + len=InLen; + ptr=InData; + if (InLen==0) Flush=TRUE; + + //Go through processing modules feeding the data from the previous one into them + Curr=ListGetNext(S->ProcessingModules); + while (Curr) + { + Next=ListGetNext(Curr); + Mod=(TProcessingModule *) Curr->Item; + + if (Mod->Write && ((len > 0) || Flush)) + { + len=Mod->Write(Mod,ptr,len,OutData,OutLen,Flush); + if (Flush && (len !=STREAM_CLOSED)) AllDataWritten=FALSE; + if (Next) + { + TempBuff=SetStrLen(TempBuff, *OutLen); + memcpy(TempBuff,*OutData,*OutLen); + ptr=TempBuff; + len=*OutLen; + } + } + Curr=Next; + } + +DestroyString(TempBuff); +return(AllDataWritten); +} + + +//this function returns the number of bytes *queued*, not number +//written +int STREAMInternalQueueBytes(STREAM *S, const char *Bytes, int Len) +{ +int o_len, queued=0, avail, val=0, result=0; +const char *ptr; + + o_len=Len; + ptr=Bytes; + + do + { + //Calc avail space to queue into and queue + if (o_len > 0) + { + avail=S->BuffSize - S->OutEnd; + if (avail > 0) + { + if (avail > o_len) avail=o_len; + + memcpy(S->OutputBuff+S->OutEnd,ptr,avail); + ptr+=avail; + o_len-=avail; + S->OutEnd+=avail; + + queued+=avail; + } + } + + //Buffer Full, Write some bytes!!! + if ( + (S->OutEnd >= S->BuffSize) || + ((S->OutEnd > S->StartPoint) && ( (S->Flags & FLUSH_ALWAYS) || ((S->Flags & FLUSH_BLOCK) && (S->OutEnd >= S->BlockSize)) ) ) + ) + { + //Any decision about how much to write takes place in InternalFinalWrite + result=STREAMInternalFinalWriteBytes(S, S->OutputBuff, S->OutEnd); + if (result < 1) break; + S->StartPoint=0; + } + } while (o_len > 0); + +if ((result < 0) && (result != STREAM_TIMEOUT)) return(result); +return(queued); +} + + + +/*A stream can have a series of 'processor modules' associated with it' */ +/*which do things to the data before it is read/written. This function */ +/*pumps the data through the processor list, and eventually writes it out */ +int STREAMWriteBytes(STREAM *S, const char *Data, int DataLen) +{ +const char *i_data; +char *TempBuff=NULL; +int len, result=0; + + +if (! S) return(STREAM_CLOSED); +if (S->out_fd==-1) return(STREAM_CLOSED); +if (S->State & SS_WRITE_ERROR) return(STREAM_CLOSED); + + +i_data=Data; +len=DataLen; + +if (ListSize(S->ProcessingModules)) +{ + STREAMInternalPushProcessingModules(S, i_data, len, &TempBuff, &len); + i_data=TempBuff; +} + +//This always queues all the data, though it may not flush it all +//thus the calling application always believes all data is written +//Thus we only report errors if len==0; +if (len > 0) result=STREAMInternalQueueBytes(S, i_data, len); +else if (S->OutEnd > S->StartPoint) STREAMInternalFinalWriteBytes(S, S->OutputBuff, S->OutEnd); + +DestroyString(TempBuff); + +return(result); +} + + + + +int STREAMWriteString(const char *Buffer, STREAM *S) +{ +int result; + +if (StrLen(Buffer) < 1) return(FALSE); +result=STREAMWriteBytes(S,Buffer,strlen(Buffer)); +return(result); +} + +int STREAMWriteLine(const char *Buffer, STREAM *S) +{ +int result; + +if (StrLen(Buffer) < 1) return(FALSE); +result=STREAMWriteBytes(S,Buffer,strlen(Buffer)); +if (result < 0) return(result); +if (S->Flags & FLUSH_LINE) result=STREAMFlush(S); +return(result); +} + + +int STREAMReadChar(STREAM *S) +{ +unsigned char inchar; +int result; + +result=STREAMReadBytes(S, &inchar,1); +if (result < 0) return(result); +if (result==0) return(STREAM_NODATA); +return((int) inchar); +} + + + +int STREAMPeekChar(STREAM *S) +{ +int result; + +if (S->InStart >= S->InEnd) +{ + result=STREAMReadCharsToBuffer(S); + if (result < 1) return(result); +} + +return(* (S->InputBuff + S->InStart)); +} + + +int STREAMPeekBytes(STREAM *S, char *Buffer, int Buffsize) +{ +int len=0, result=0; + +if (S->InStart >= S->InEnd) +{ + result=STREAMReadCharsToBuffer(S); + if (S->InStart >= S->InEnd) + { + if (result==STREAM_CLOSED) return(STREAM_CLOSED); + if (result==STREAM_TIMEOUT) return(STREAM_TIMEOUT); + if (result==STREAM_DATA_ERROR) return(STREAM_DATA_ERROR); + } +} + +len=S->InEnd-S->InStart; +if (len > Buffsize) len=Buffsize; + +if (len > 0) memcpy(Buffer,S->InputBuff + S->InStart,len); + +return(len); +} + + + +int STREAMWriteChar(STREAM *S,unsigned char inchar) +{ +char tmpchar; + +tmpchar=(char) inchar; +return(STREAMWriteBytes(S,&tmpchar,1)); +} + + + +int STREAMReadBytesToTerm(STREAM *S, char *Buffer, int BuffSize,unsigned char Term) +{ +int inchar, pos=0; + +inchar=STREAMReadChar(S); +while (inchar != STREAM_CLOSED) +{ +if (inchar > -1) +{ +Buffer[pos]=inchar; +pos++; +if (inchar==Term) break; +if (pos==BuffSize) break; +} +inchar=STREAMReadChar(S); +} + +if ((pos==0) && (inchar==STREAM_CLOSED)) return(STREAM_CLOSED); +return(pos); +} + + +char *STREAMReadToTerminator(char *Buffer, STREAM *S, unsigned char Term) +{ +int result, len=0, bytes_read=0; +char *RetStr=NULL, *ptr; + + +RetStr=CopyStr(Buffer,""); +while (1) +{ + if (S->InEnd > S->InStart) + { + //memchr is wicked fast, so use it + ptr=memchr(S->InputBuff+S->InStart,Term,S->InEnd - S->InStart); + if (ptr) len=(ptr+1)-(S->InputBuff+S->InStart); + else len=S->InEnd-S->InStart; + + RetStr=SetStrLen(RetStr,bytes_read + len); + len=STREAMTransferBytesOut(S, RetStr+bytes_read , len); + bytes_read+=len; + *(RetStr+bytes_read)='\0'; + + //Only return if we found the terminator (using memchr, above) + if (ptr) return(RetStr); + } + + result=STREAMReadCharsToBuffer(S); + if (S->InStart >= S->InEnd) + { + if (result==STREAM_TIMEOUT) return(RetStr); + if (result==STREAM_NODATA) return(RetStr); + + if (bytes_read==0) + { + DestroyString(RetStr); + return(NULL); + } + return(RetStr); + } +} + +//impossible to get here! +return(NULL); +} + + + +char *STREAMReadToMultiTerminator(char *Buffer, STREAM *S, char *Terms) +{ +int inchar, len=0; +char *Tempptr; + +Tempptr=CopyStr(Buffer,""); + +inchar=STREAMReadChar(S); + + +//All error conditions are negative, but '0' can just mean +//no more data to read +while (inchar > -1) +{ + //if ((len % 100)== 0) Tempptr=realloc(Tempptr,(len/100 +1) *100 +2); + //*(Tempptr+len)=inchar; + + if (inchar > 0) + { + Tempptr=AddCharToBuffer(Tempptr,len,(char) inchar); + len++; + + if (strchr(Terms,inchar)) break; + } + inchar=STREAMReadChar(S); +} + + +*(Tempptr+len)='\0'; + +//if ((inchar==STREAM_CLOSED) && (errno==ECONNREFUSED)) return(Tempptr); +if ( + ((inchar==STREAM_CLOSED) || (inchar==STREAM_DATA_ERROR)) + && + (StrLen(Tempptr)==0) + ) +{ + free(Tempptr); + return(NULL); +} + +return(Tempptr); +} + + + + +char *STREAMReadLine(char *Buffer, STREAM *S) +{ +return(STREAMReadToTerminator(Buffer,S,'\n')); +} + + +void STREAMResetInputBuffers(STREAM *S) +{ +double pos; + +pos=STREAMTell(S); +S->InStart=0; +S->InEnd=0; +STREAMSeek(S,pos,SEEK_SET); +} + + + +char *STREAMGetValue(STREAM *S, const char *Name) +{ +ListNode *Curr; + +if (! S->Values) return(NULL); +Curr=ListFindNamedItem(S->Values,Name); +if (Curr) return(Curr->Item); +return(NULL); +} + + +void STREAMSetValue(STREAM *S, const char *Name, const char *Value) +{ + +if (! S->Values) S->Values=ListCreate(); +SetVar(S->Values,Name,Value); +} + +void *STREAMGetItem(STREAM *S, const char *Name) +{ +ListNode *Curr; + +if (! S->Items) return(NULL); +Curr=ListFindNamedItem(S->Items,Name); +if (Curr) return(Curr->Item); +return(NULL); +} + + +void STREAMSetItem(STREAM *S, const char *Name, void *Value) +{ +ListNode *Curr; + +if (! S->Items) S->Items=ListCreate(); +Curr=ListFindNamedItem(S->Items,Name); +if (Curr) Curr->Item=Value; +else ListAddNamedItem(S->Items,Name,Value); +} + + +int STREAMFindCompare(const char *Line, const char *Item, const char *Delimiter, char **RetStr) +{ +char *ptr=NULL; +int result; + + if (StrValid(Delimiter)) ptr=strstr(Line, Delimiter); + + if (ptr) result=strncmp(Item, Line, ptr-Line); + else result=strcmp(Item, Line); + + if (RetStr && (result==0)) *RetStr=CopyStr(*RetStr, Line); + +return(result); +} + + + +int STREAMFindBinarySearch(STREAM *S, const char *Item, const char *Delimiter, char **RetStr) +{ +char *Tempstr=NULL; +struct stat Stat; +double Size, delta, pos; +int result, inchar; + + +if (S->Flags & SF_MMAP) Size=S->InEnd; +else +{ + fstat(S->in_fd, &Stat); + Size=Stat.st_size; +} + +delta=Size / 2; +pos=delta; +while (delta > 100) +{ + STREAMSeek(S, pos, SEEK_SET); + inchar=STREAMReadChar(S); + while ((inchar != '\n') && (inchar != EOF)) inchar=STREAMReadChar(S); + if (inchar==EOF) return(FALSE); + Tempstr=STREAMReadLine(Tempstr, S); + StripTrailingWhitespace(Tempstr); + result=STREAMFindCompare(Tempstr, Item, Delimiter, RetStr); + if (result ==0) break; + + delta /= 2; + if (result > 0) pos+=delta; + else pos-=delta; +} + +//rewind if we need to +while ((result < 0) && (pos > 0)) +{ +pos-=1024; +//if we're near the start of the file, then just seek back to the start +if (pos < 1024) pos=0; +STREAMSeek(S, pos, SEEK_SET); +if (pos > 0) +{ +inchar=STREAMReadChar(S); +while ((inchar != '\n') && (inchar != EOF)) inchar=STREAMReadChar(S); +} + +Tempstr=STREAMReadLine(Tempstr, S); +StripTrailingWhitespace(Tempstr); + +result=STREAMFindCompare(Tempstr, Item, Delimiter, RetStr); +} + +while (Tempstr) +{ + result=STREAMFindCompare(Tempstr, Item, Delimiter, RetStr); + if (result < 1) + { + DestroyString(Tempstr); + if (result==0) return(TRUE); + return(FALSE); + } + Tempstr=STREAMReadLine(Tempstr, S); + StripTrailingWhitespace(Tempstr); +} + +DestroyString(Tempstr); +return(FALSE); +} + + +int STREAMFindItem(STREAM *S, const char *Item, const char *Delimiter, char **RetStr) +{ +char *Tempstr=NULL; + +if (!S) return(FALSE); + +if (S->Flags & SF_SORTED) return(STREAMFindBinarySearch(S, Item, Delimiter, RetStr)); + +Tempstr=STREAMReadLine(Tempstr, S); +while (Tempstr) +{ + StripTrailingWhitespace(Tempstr); + if (STREAMFindCompare(Tempstr, Item, Delimiter, RetStr)==0) + { + DestroyString(Tempstr); + return(TRUE); + } + Tempstr=STREAMReadLine(Tempstr, S); +} + +DestroyString(Tempstr); +return(FALSE); +} + + + + +unsigned long STREAMSendFile(STREAM *In, STREAM *Out, unsigned long Max, int Flags) +{ +unsigned long bytes_transferred=0; +int result; +int UseSendFile=FALSE; + +//val has to be as long as possible, because it will hold the difference +//between two long values. However, use of 'long long' resulted in an +//unsigned value, which caused all manner of problems, so a long is the +//best we can manage +long val, len; + + + +//if we are not using ssl and not using processor modules, we can use +//kernel-level copy! + +if (Max==0) len=BUFSIZ; +else len=(long) (Max-bytes_transferred); + + +#ifdef USE_SENDFILE +#include + +if ( + (Flags & SENDFILE_KERNEL) && + (! (In->State & SS_SSL)) && + (! (Out->State & SS_SSL)) && + (ListSize(In->ProcessingModules)==0) && + (ListSize(Out->ProcessingModules)==0) +) +{ + UseSendFile=TRUE; + STREAMFlush(Out); +} +#endif + + +while (len > 0) +{ +#ifdef USE_SENDFILE + if (UseSendFile) + { + result=sendfile(Out->out_fd, In->in_fd,0,len); + if (result < 1) + { + if (bytes_transferred==0) UseSendFile=FALSE; + result=STREAM_CLOSED; + } + else + { + //if used sendfile we need to do this because we didn't call + //lower level functions like 'STREAMReadCharsToBuffer' that would + //update these + In->BytesRead+=result; + Out->BytesWritten+=result; + } + } +#endif + + if (! UseSendFile) + { + //How much still left to transfer? + + //if outbuff is full do some flushing + val=Out->BuffSize - Out->OutEnd; + if (val < 1) + { + STREAMFlush(Out); + sleep(0); + break; + val=Out->BuffSize - Out->OutEnd; + } + + result=0; + + + val=In->InEnd - In->InStart; + //only read if we don't already have some in inbuff + if (val < 1) + { + result=STREAMReadCharsToBuffer(In); + val=In->InEnd - In->InStart; + } + + if (len > val) len=val; + + //nothing to write! + if (len < 1) + { + //nothing in either buffer! Stream empty. Is it closed? + if ((Out->OutEnd==0) && (result==STREAM_CLOSED)) break; + len=0; + } + + result=STREAMWriteBytes(Out,In->InputBuff+In->InStart,len); + + if (result > 0) + { + In->InStart+=result; + bytes_transferred+=result; + } + + } + + +if (! (Flags & SENDFILE_LOOP)) break; + +if (Max==0) len=BUFSIZ; +else len=(long) (Max-bytes_transferred); +} + +if ((result==STREAM_CLOSED) && (bytes_transferred==0) ) return(STREAM_CLOSED); +return(bytes_transferred); +} + diff --git a/libUseful-2.0/file.h b/libUseful-2.4/file.h similarity index 75% rename from libUseful-2.0/file.h rename to libUseful-2.4/file.h index 9f1feec..c83e478 100644 --- a/libUseful-2.0/file.h +++ b/libUseful-2.4/file.h @@ -6,6 +6,8 @@ #include "list.h" +#define STREAM_FLUSH -1 + #define STREAM_CLOSED -1 #define STREAM_NODATA -2 #define STREAM_TIMEOUT -3 @@ -37,15 +39,27 @@ #define FLUSH_LINE 1 #define FLUSH_BLOCK 2 #define FLUSH_ALWAYS 4 -#define SF_RDONLY 8 -#define SF_WRONLY 16 -#define SF_RDWR 32 -#define SF_NONBLOCK 65 -#define SF_SYMLINK_OK 128 -#define SF_SSL 256 -#define SF_AUTH 512 +#define FLUSH_BUFFER 8 + +#define SF_RDWR 0 //is the default +//FLUSH_ flags go in this gap +#define SF_RDONLY 16 +#define SF_WRONLY 32 +#define SF_CREAT 64 +#define SF_CREATE 64 +#define SF_APPEND 128 +#define SF_TRUNC 256 +#define SF_MMAP 512 #define SF_WRLOCK 1024 #define SF_RDLOCK 2048 +#define SF_FOLLOW 4096 +#define SF_SECURE 8192 +#define SF_NONBLOCK 16384 +#define SF_EXEC_INHERIT 131072 +#define SF_SYMLINK_OK 262144 +#define SF_NOCACHE 524288 +#define SF_SORTED 1048576 + //Stream state values #define SS_CONNECTING 1 @@ -54,7 +68,12 @@ #define SS_DATA_ERROR 8 #define SS_WRITE_ERROR 16 #define SS_EMBARGOED 32 +#define SS_SSL 4096 #define SS_AUTH 8192 +#define SS_USER1 268435456 +#define SS_USER2 536870912 +#define SS_USER3 1073741824 +#define SS_USER4 2147483648 #define STREAM_TYPE_FILE 0 #define STREAM_TYPE_UNIX 1 @@ -71,6 +90,10 @@ #define SELECT_READ 1 #define SELECT_WRITE 2 + +#define SENDFILE_KERNEL 1 +#define SENDFILE_LOOP 2 + typedef struct { int Type; @@ -80,6 +103,7 @@ unsigned int State; unsigned int Timeout; unsigned int BlockSize; unsigned int BuffSize; +unsigned int StartPoint; unsigned int InStart, InEnd; unsigned int OutEnd; @@ -104,9 +128,9 @@ int FDSelect(int fd, int Flags, struct timeval *tv); int FDIsWritable(int); int FDCheckForBytes(int); -void STREAMSetNonBlock(STREAM *S, int val); +void STREAMSetFlags(STREAM *S, int Set, int UnSet); void STREAMSetTimeout(STREAM *, int); -void STREAMSetFlushType(STREAM *Stream, int Type, int val); +void STREAMSetFlushType(STREAM *Stream, int Type, int StartPoint, int BlockSize); STREAM *STREAMCreate(); @@ -121,17 +145,19 @@ void STREAMResizeBuffer(STREAM *, int); int STREAMReadChar(STREAM *); int STREAMWriteChar(STREAM *,unsigned char); char* STREAMReadLine(char *Buffer, STREAM *); -int ReadBytesToTerm(STREAM *S, char *Buffer, int BuffSize,unsigned char Term); +int STREAMReadBytesToTerm(STREAM *S, char *Buffer, int BuffSize,unsigned char Term); char* STREAMReadToTerminator(char *Buffer, STREAM *,unsigned char Term); char* STREAMReadToMultiTerminator(char *Buffer, STREAM *, char *Terms); int STREAMWriteString(const char *Buffer, STREAM *); int STREAMWriteLine(const char *Buffer, STREAM *); STREAM *STREAMFromFD(int fd); STREAM *STREAMFromDualFD(int in_fd, int out_fd); -STREAM *STREAMSpawnCommand(const char *Command, int type); int STREAMDisassociateFromFD(STREAM *Stream); int STREAMPeekChar(STREAM *); +int STREAMPeekBytes(STREAM *S, char *Buffer, int Buffsize); +void STREAMResetInputBuffers(STREAM *S); +int STREAMReadThroughProcessors(STREAM *S, char *Bytes, int InLen); int STREAMReadBytes(STREAM *, char *Buffer, int Bytes); int STREAMWriteBytes(STREAM *, const char *Buffer, int Bytes); @@ -145,6 +171,7 @@ char *STREAMGetValue(STREAM *S, const char *Name); void STREAMSetItem(STREAM *S, const char *Name, void *Item); void *STREAMGetItem(STREAM *S, const char *Name); +unsigned long STREAMSendFile(STREAM *In, STREAM *Out, unsigned long Max, int Flags); #ifdef __cplusplus } diff --git a/libUseful-2.4/file.o b/libUseful-2.4/file.o new file mode 100644 index 0000000..2ec3b16 Binary files /dev/null and b/libUseful-2.4/file.o differ diff --git a/libUseful-2.0/http.c b/libUseful-2.4/http.c similarity index 68% rename from libUseful-2.0/http.c rename to libUseful-2.4/http.c index a8787a1..fc279c6 100644 --- a/libUseful-2.0/http.c +++ b/libUseful-2.4/http.c @@ -1,36 +1,18 @@ #include "http.h" #include "DataProcessing.h" +#include "ConnectionChain.h" #include "Hash.h" #include "ParseURL.h" +#include "Time.h" +#include "base64.h" +const char *HTTP_AUTH_BY_TOKEN="AuthTokenType"; ListNode *Cookies=NULL; +ListNode *HTTPVars=NULL; int g_Flags=0; -void HTTPAuthSet(HTTPAuthStruct *Auth, char *Logon, char *Password, int Type) -{ - Auth->Logon=CopyStr(Auth->Logon,Logon); - Auth->Password=CopyStr(Auth->Password,Password); - Auth->Flags |= Type; -} - - -void HTTPAuthDestroy(void *p_Auth) -{ -HTTPAuthStruct *Auth; - -if (! p_Auth) return; -Auth=(HTTPAuthStruct *) p_Auth; -DestroyString(Auth->AuthRealm); -DestroyString(Auth->AuthQOP); -DestroyString(Auth->AuthNonce); -DestroyString(Auth->AuthOpaque); -DestroyString(Auth->Logon); -DestroyString(Auth->Password); - -free(Auth); -} void HTTPInfoDestroy(void *p_Info) { @@ -38,8 +20,9 @@ HTTPInfoStruct *Info; if (! p_Info) return; Info=(HTTPInfoStruct *) p_Info; -DestroyString(Info->Host); +DestroyString(Info->Protocol); DestroyString(Info->Method); +DestroyString(Info->Host); DestroyString(Info->Doc); DestroyString(Info->Destination); DestroyString(Info->ResponseCode); @@ -50,16 +33,24 @@ DestroyString(Info->Timestamp); DestroyString(Info->PostData); DestroyString(Info->PostContentType); DestroyString(Info->Proxy); +DestroyString(Info->Authorization); +DestroyString(Info->ProxyAuthorization); ListDestroy(Info->ServerHeaders,DestroyString); ListDestroy(Info->CustomSendHeaders,DestroyString); -if (Info->Authorization) HTTPAuthDestroy(Info->Authorization); -if (Info->ProxyAuthorization) HTTPAuthDestroy(Info->ProxyAuthorization); free(Info); } +void HTTPSetVar(const char *Name, const char *Var) +{ + if (! HTTPVars) HTTPVars=ListCreate(); + SetVar(HTTPVars,Name,Var); +} + + + //These functions relate to adding a 'Data processor' to the stream that //will decode chunked HTTP transfers @@ -70,6 +61,8 @@ int ChunkSize; int BuffLen; } THTTPChunk; + + int HTTPChunkedInit(TProcessingModule *Mod, const char *Args) { @@ -78,28 +71,33 @@ Mod->Data=(THTTPChunk *) calloc(1, sizeof(THTTPChunk)); return(TRUE); } -int HTTPChunkedRead(TProcessingModule *Mod, const char *InBuff, int InLen, char **OutBuff, int *OutLen) + + +int HTTPChunkedRead(TProcessingModule *Mod, const char *InBuff, int InLen, char **OutBuff, int *OutLen, int Flush) { int len=0, val=0; THTTPChunk *Chunk; char *ptr, *vptr; Chunk=(THTTPChunk *) Mod->Data; +if (InLen > 0) +{ len=Chunk->BuffLen+InLen; Chunk->Buffer=SetStrLen(Chunk->Buffer,len); memcpy(Chunk->Buffer+Chunk->BuffLen,InBuff,InLen); Chunk->BuffLen=len; Chunk->Buffer[len]='\0'; +} +else len=Chunk->BuffLen; ptr=Chunk->Buffer; - if (Chunk->ChunkSize==0) { //if chunksize == 0 then read the size of the next chunk //if there's nothing in our buffer, and nothing being added, then //we've already finished! - if (InLen==0) return(EOF); + if ((Chunk->BuffLen==0) && (InLen==0)) return(STREAM_CLOSED); vptr=ptr; //skip past any leading '\r' or '\n' @@ -108,6 +106,7 @@ if (Chunk->ChunkSize==0) ptr=strchr(vptr,'\n'); + //sometimes people seem to miss off the final '\n', so if we get told there's no more data //we should use a '\r' if we've got one if ((! ptr) && (InLen==0)) ptr=strchr(vptr,'\r'); @@ -117,15 +116,18 @@ if (Chunk->ChunkSize==0) ptr++; } else return(0); + Chunk->ChunkSize=strtol(vptr,NULL,16); - Chunk->BuffLen=Chunk->Buffer+len-ptr; if (Chunk->BuffLen > 0) memmove(Chunk->Buffer,ptr,Chunk->BuffLen); + //in case it went negative in the above calcuation + else Chunk->BuffLen=0; + - //if we got chunksize of 0 then we're done, return EOF - if (Chunk->ChunkSize==0) return(EOF); + //if we got chunksize of 0 then we're done, return STREAM_CLOSED + if (Chunk->ChunkSize==0) return(STREAM_CLOSED); } else if (len >= Chunk->ChunkSize) { @@ -178,9 +180,10 @@ TProcessingModule *Mod=NULL; -char *HTTPUnQuote(char *RetBuff, char *Str) +char *HTTPUnQuote(char *RetBuff, const char *Str) { -char *RetStr=NULL, *Token=NULL, *ptr; +char *RetStr=NULL, *Token=NULL; +const char *ptr; int olen=0, ilen; RetStr=CopyStr(RetStr,""); @@ -216,9 +219,10 @@ return(RetStr); } -char *HTTPQuoteChars(char *RetBuff, char *Str, char *CharList) +char *HTTPQuoteChars(char *RetBuff, const char *Str, const char *CharList) { -char *RetStr=NULL, *Token=NULL, *ptr; +char *RetStr=NULL, *Token=NULL; +const char *ptr; int olen=0, ilen; RetStr=CopyStr(RetStr,""); @@ -247,9 +251,10 @@ return(RetStr); -char *HTTPQuote(char *RetBuff, char *Str) +char *HTTPQuote(char *RetBuff, const char *Str) { -char *RetStr=NULL, *Token=NULL, *ptr; +char *RetStr=NULL, *Token=NULL; +const char *ptr; int olen=0, ilen; RetStr=CopyStr(RetStr,""); @@ -300,14 +305,7 @@ return(RetStr); } -void HTTPInfoSetAuth(HTTPInfoStruct *Info, char *Logon, char *Password, int Type) -{ -if (! Info->Authorization) Info->Authorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); -HTTPAuthSet(Info->Authorization,Logon, Password, Type); -} - - -void HTTPInfoSetValues(HTTPInfoStruct *Info, char *Host, int Port, char *Logon, char *Password, char *Method, char *Doc, char *ContentType, int ContentLength) +void HTTPInfoSetValues(HTTPInfoStruct *Info, const char *Host, int Port, const char *Logon, const char *Password, const char *Method, const char *Doc, const char *ContentType, int ContentLength) { Info->State=0; Info->PostData=CopyStr(Info->PostData,""); @@ -318,29 +316,31 @@ Info->Method=CopyStr(Info->Method,Method); Info->Doc=CopyStr(Info->Doc,Doc); Info->PostContentType=CopyStr(Info->PostContentType,ContentType); Info->PostContentLength=ContentLength; +Info->UserName=CopyStr(Info->UserName, Logon); -if (StrLen(Logon) || StrLen(Password)) HTTPInfoSetAuth(Info, Logon, Password, HTTP_AUTH_BASIC); +if (StrLen(Password)) CredsStoreAdd(Host, Logon, Password); } -HTTPInfoStruct *HTTPInfoCreate(char *Host, int Port, char *Logon, char *Password, char *Method, char *Doc, char *ContentType, int ContentLength) +HTTPInfoStruct *HTTPInfoCreate(const char *Protocol, const char *Host, int Port, const char *Logon, const char *Password, const char *Method, const char *Doc, const char *ContentType, int ContentLength) { HTTPInfoStruct *Info; char *ptr; Info=(HTTPInfoStruct *) calloc(1,sizeof(HTTPInfoStruct)); +Info->Protocol=CopyStr(Info->Protocol,Protocol); HTTPInfoSetValues(Info, Host, Port, Logon, Password, Method, Doc, ContentType, ContentLength); Info->ServerHeaders=ListCreate(); Info->CustomSendHeaders=ListCreate(); -//SetVar(Info->CustomSendHeaders,"Accept","*/*"); +SetVar(Info->CustomSendHeaders,"Accept","*/*"); if (g_Flags) Info->Flags=g_Flags; ptr=LibUsefulGetValue("HTTP:Proxy"); -if (StrLen(ptr)) +if (StrValid(ptr)) { Info->Proxy=CopyStr(Info->Proxy,ptr); strlwr(Info->Proxy); @@ -368,47 +368,59 @@ return(RetStr); } -HTTPInfoStruct *HTTPInfoFromURL(char *Method, char *URL) +void HTTPInfoSetURL(HTTPInfoStruct *Info, const char *Method, const char *URL) { -HTTPInfoStruct *Info; char *Proto=NULL, *User=NULL, *Pass=NULL, *Token=NULL; -char *ptr=NULL; -int Port=0; - -Info=HTTPInfoCreate("", 80, "", "", Method, "", "",0); if (strcasecmp(Method,"POST")==0) ParseURL(URL, &Proto, &Info->Host, &Token, &User, &Pass,&Info->Doc,&Info->PostData); else ParseURL(URL, &Proto, &Info->Host, &Token, &User, &Pass,&Info->Doc, NULL); -if (StrLen(Token)) Info->Port=atoi(Token); +if (StrValid(Token)) Info->Port=atoi(Token); -if (StrLen(User) || StrLen(Pass)) +if (StrValid(User) || StrValid(Pass)) { - Info->Authorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); - HTTPAuthSet(Info->Authorization,User, Pass, HTTP_AUTH_BASIC); + Info->UserName=CopyStr(Info->UserName, User); } -if (StrLen(Proto) && (strcmp(Proto,"https")==0)) Info->Flags |= HTTP_SSL; +if (StrValid(Proto) && (strcmp(Proto,"https")==0)) Info->Flags |= HTTP_SSL; + -if (StrLen(Info->PostData)) +//if there were arguments in URL, and HTTP_POSTARGS is set, then post these +//otherwise include them in the URL again +if (StrValid(Info->PostData)) +{ +if (Info->Flags & HTTP_POSTARGS) { Info->PostContentType=CopyStr(Info->PostContentType,"application/x-www-form-urlencoded"); Info->PostContentLength=StrLen(Info->PostData); } +else +{ + Info->Doc=MCatStr(Info->Doc,"?",Info->PostData, NULL); + Info->PostData=CopyStr(Info->PostData, ""); +} +} DestroyString(User); DestroyString(Pass); DestroyString(Token); DestroyString(Proto); - -return(Info); } +HTTPInfoStruct *HTTPInfoFromURL(const char *Method, const char *URL) +{ +HTTPInfoStruct *Info; +Info=HTTPInfoCreate("HTTP/1.1","", 80, "", "", Method, "", "",0); +HTTPInfoSetURL(Info, Method, URL); -void HTTPParseCookie(HTTPInfoStruct *Info, char *Str) +return(Info); +} + + +void HTTPParseCookie(HTTPInfoStruct *Info, const char *Str) { - char *startptr, *endptr; + const char *startptr, *endptr; char *Tempstr=NULL; ListNode *Curr; int len; @@ -449,7 +461,6 @@ DestroyString(Tempstr); char *AppendCookies(char *InStr, ListNode *CookieList) { ListNode *Curr; - int count=0; char *Tempstr=NULL; Tempstr=InStr; @@ -470,22 +481,22 @@ char *AppendCookies(char *InStr, ListNode *CookieList) return(Tempstr); } - -void HTTPHandleWWWAuthenticate(HTTPInfoStruct *Info, char *Line) +int HTTPHandleWWWAuthenticate(char *Line, int *Type, char **Config) { char *ptr, *ptr2, *Token=NULL, *Name=NULL, *Value=NULL; -char *AuthTypeStrings[]={"Basic","Digest",NULL}; -typedef enum {AUTH_BASIC, AUTH_DIGEST} TAuthTypes; -int result; +char *Realm=NULL, *QOP=NULL, *Nonce=NULL, *Opaque=NULL, *AuthType=NULL; -if (! Info->Authorization) Info->Authorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); ptr=Line; while (isspace(*ptr)) ptr++; ptr=GetToken(ptr," ",&Token,0); +*Type=0; +if (strcasecmp(Token,"basic")==0) *Type |= HTTP_AUTH_BASIC; +if (strcasecmp(Token,"digest")==0) *Type |= HTTP_AUTH_DIGEST; -result=MatchTokenFromList(Token,AuthTypeStrings,0); -if (result==AUTH_BASIC) Info->Authorization->Flags |=HTTP_AUTH_BASIC; -if (result==AUTH_DIGEST) Info->Authorization->Flags |=HTTP_AUTH_DIGEST; +QOP=CopyStr(QOP,""); +Realm=CopyStr(Realm,""); +Nonce=CopyStr(Nonce,""); +Opaque=CopyStr(Opaque,""); while (ptr) { @@ -496,15 +507,25 @@ ptr2=GetToken(Token,"=",&Name,GETTOKEN_QUOTES); ptr2=GetToken(ptr2,"=",&Value,GETTOKEN_QUOTES); -if (strcasecmp(Name,"realm")==0) Info->Authorization->AuthRealm=CopyStr(Info->Authorization->AuthRealm,Value); -if (strcasecmp(Name,"qop")==0) Info->Authorization->AuthQOP=CopyStr(Info->Authorization->AuthQOP,Value); -if (strcasecmp(Name,"nonce")==0) Info->Authorization->AuthNonce=CopyStr(Info->Authorization->AuthNonce,Value); -if (strcasecmp(Name,"opaque")==0) Info->Authorization->AuthOpaque=CopyStr(Info->Authorization->AuthOpaque,Value); +if (strcasecmp(Name,"realm")==0) Realm=CopyStr(Realm,Value); +if (strcasecmp(Name,"qop")==0) QOP=CopyStr(QOP,Value); +if (strcasecmp(Name,"nonce")==0) Nonce=CopyStr(Nonce,Value); +if (strcasecmp(Name,"opaque")==0) Opaque=CopyStr(Opaque,Value); + } +if (*Type & HTTP_AUTH_DIGEST) *Config=MCopyStr(*Config, Realm,":", Nonce, ":", QOP, ":", Opaque, ":", NULL); + DestroyString(Token); DestroyString(Name); DestroyString(Value); +DestroyString(Realm); +DestroyString(QOP); +DestroyString(Nonce); +DestroyString(Opaque); +DestroyString(AuthType); + +return(*Type); } @@ -513,8 +534,6 @@ DestroyString(Value); void HTTPParseHeader(STREAM *S, HTTPInfoStruct *Info, char *Header) { char *Token=NULL, *Tempstr=NULL; -int count=0; -int result; char *ptr; if (Info->Flags & HTTP_DEBUG) fprintf(stderr,"HEADER: %s\n",Header); @@ -525,7 +544,7 @@ Tempstr=MCopyStr(Tempstr,"HTTP:",Token,NULL); STREAMSetValue(S,Tempstr,ptr); ListAddNamedItem(Info->ServerHeaders,Token,CopyStr(NULL,ptr)); -if (StrLen(Token) && StrLen(ptr)) +if (StrValid(Token) && StrValid(ptr)) { switch (*Token) { @@ -548,6 +567,8 @@ if (StrLen(Token) && StrLen(ptr)) if (! (Info->Flags & HTTP_NODECODE)) { strlwr(ptr); + + if ( (strcmp(ptr,"gzip")==0) || (strcmp(ptr,"x-gzip")==0) @@ -586,9 +607,14 @@ if (StrLen(Token) && StrLen(ptr)) } break; + case 'P': + case 'p': + if (strcasecmp(Token,"Proxy-Authenticate")==0) HTTPHandleWWWAuthenticate(ptr, &Info->Flags, &Info->ProxyAuthorization); + break; + case 'W': case 'w': - if (strcasecmp(Token,"WWW-Authenticate")==0) HTTPHandleWWWAuthenticate(Info,ptr); + if (strcasecmp(Token,"WWW-Authenticate")==0) HTTPHandleWWWAuthenticate(ptr, &Info->Flags, &Info->Authorization); break; case 'S': @@ -627,54 +653,105 @@ DestroyString(Tempstr); } - -char *HTTPHeadersAppendAuth(char *RetStr, char *AuthHeader, HTTPInfoStruct *Info, HTTPAuthStruct *AuthInfo) +char *HTTPDigest(char *RetStr, const char *Method, const char *Logon, const char *Password, const char *Realm, const char *Doc, const char *Nonce) { -char *SendStr=NULL, *Tempstr=NULL; -char *HA1=NULL, *HA2=NULL, *ClientNonce=NULL, *Digest=NULL; -int i, AuthCounter; +char *Tempstr=NULL, *HA1=NULL, *HA2=NULL, *ClientNonce=NULL, *Digest=NULL; +int len1, len2; -if (! AuthInfo) return(RetStr); + Tempstr=FormatStr(Tempstr,"%s:%s:%s",Logon,Realm,Password); + len1=HashBytes(&HA1,"md5",Tempstr,StrLen(Tempstr),ENCODE_HEX); +printf("HA1: %s\n",Tempstr); -SendStr=CatStr(RetStr,""); + Tempstr=FormatStr(Tempstr,"%s:%s",Method,Doc); + len2=HashBytes(&HA2,"md5",Tempstr,StrLen(Tempstr),ENCODE_HEX); +printf("HA2: %s\n",Tempstr); - if (AuthInfo->Flags & HTTP_AUTH_DIGEST) - { - AuthCounter++; - Tempstr=FormatStr(Tempstr,"%s:%s:%s",AuthInfo->Logon,AuthInfo->AuthRealm,AuthInfo->Password); - HashBytes(&HA1,"md5",Tempstr,StrLen(Tempstr),0); - Tempstr=FormatStr(Tempstr,"%s:%s",Info->Method,Info->Doc); - HashBytes(&HA2,"md5",Tempstr,StrLen(Tempstr),0); + /* + Tempstr=SetStrLen(len1+len2+StrLen(Nonce)+20); + ptr=Tempstr; + memcpy(ptr,HA1,len1); + ptr+=len1; + *ptr=':'; + ptr++; + len1=StrLen(Nonce); + memcpy(ptr,Nonce,len1); + ptr+=len1; + *ptr=':'; + ptr++; + + memcpy(ptr,HA2,len2); + ptr+=len2; +*/ + + Tempstr=MCopyStr(Tempstr,HA1,":",Nonce,":",HA2,NULL); + len2=HashBytes(&Digest,"md5",Tempstr,StrLen(Tempstr),ENCODE_HEX); + RetStr=MCopyStr(RetStr, "username=\"",Logon,"\", realm=\"",Realm,"\", nonce=\"",Nonce,"\", response=\"",Digest,"\", ","uri=\"",Doc,"\", algorithm=\"MD5\"", NULL); + + /* AVANCED DIGEST for (i=0; i < 10; i++) { Tempstr=FormatStr(Tempstr,"%x",rand() % 255); ClientNonce=CatStr(ClientNonce,Tempstr); } - Tempstr=FormatStr(Tempstr,"%s:%s:%08d:%s:auth:%s",HA1,AuthInfo->AuthNonce,AuthCounter,ClientNonce,HA2); + Tempstr=FormatStr(Tempstr,"%s:%s:%08d:%s:auth:%s",HA1,Nonce,AuthCounter,ClientNonce,HA2); HashBytes(&Digest,"md5",Tempstr,StrLen(Tempstr),0); - Tempstr=FormatStr(Tempstr,"%s: Digest username=\"%s\",realm=\"%s\",nonce=\"%s\",uri=\"%s\",qop=auth,nc=%08d,cnonce=\"%s\",response=\"%s\"\r\n",AuthHeader,AuthInfo->Logon,AuthInfo->AuthRealm,AuthInfo->AuthNonce,Info->Doc,AuthCounter,ClientNonce,Digest); - SendStr=CatStr(SendStr,Tempstr); - AuthInfo->Flags |= HTTP_SENT_AUTH; - } - else - { - Tempstr=CopyStr(Tempstr,AuthInfo->Logon); - Tempstr=CatStr(Tempstr,":"); - Tempstr=CatStr(Tempstr,AuthInfo->Password); - Digest=SetStrLen(Digest,StrLen(Tempstr) *2); - to64frombits(Digest,Tempstr,strlen(Tempstr)); - Tempstr=FormatStr(Tempstr,"%s: %s %s\r\n",AuthHeader,"Basic",Digest); + Tempstr=FormatStr(Tempstr,"%s: Digest username=\"%s\",realm=\"%s\",nonce=\"%s\",uri=\"%s\",qop=auth,nc=%08d,cnonce=\"%s\",response=\"%s\"\r\n",AuthHeader,Logon,Realm,Nonce,Doc,AuthCounter,ClientNonce,Digest); SendStr=CatStr(SendStr,Tempstr); - AuthInfo->Flags |= HTTP_SENT_AUTH; - } + */ +DestroyString(Tempstr); DestroyString(HA1); DestroyString(HA2); -DestroyString(ClientNonce); DestroyString(Digest); + +return(RetStr); +} + + +char *HTTPHeadersAppendAuth(char *RetStr, char *AuthHeader, HTTPInfoStruct *Info, char *AuthInfo) +{ +char *SendStr=NULL, *Tempstr=NULL, *Realm=NULL, *Nonce=NULL, *ptr; +char *Logon=NULL; +char *p_Password=NULL; + + if (StrEnd(AuthInfo)) return(RetStr); + + SendStr=CatStr(RetStr,""); + + ptr=GetToken(AuthInfo,":",&Realm,0); + ptr=GetToken(ptr,":",&Nonce,0); + + //Authentication by an opaque authentication token that is handled + //elsewhere, and is set as the 'Password' + p_Password=CredsStoreGetSecret(Realm, Info->UserName); + if (! p_Password) p_Password=CredsStoreGetSecret(Info->Host, Info->UserName); + + if (Info->AuthFlags & HTTP_AUTH_TOKEN) SendStr=MCatStr(SendStr,AuthHeader,": ",AuthInfo,"\r\n",NULL); + else if (Info->AuthFlags & HTTP_AUTH_DIGEST) + { + Tempstr=HTTPDigest(Tempstr, Info->Method, Info->UserName, p_Password, Realm, Info->Doc, Nonce); + SendStr=MCatStr(SendStr,AuthHeader,": Digest ", Tempstr, "\r\n",NULL); + } + else + { + Tempstr=MCopyStr(Tempstr,Info->UserName,":",p_Password,NULL); + //We should now have Logon:Password + Nonce=SetStrLen(Nonce,StrLen(Tempstr) *2); + + to64frombits((unsigned char *) Nonce, (unsigned char *) Tempstr,strlen(Tempstr)); + SendStr=MCatStr(SendStr,AuthHeader,": Basic ",Nonce,"\r\n",NULL); + } + + Info->AuthFlags |= HTTP_AUTH_SENT; + //Lock creds again + CredsStoreGetSecret("", ""); + DestroyString(Tempstr); +DestroyString(Logon); +DestroyString(Realm); +DestroyString(Nonce); return(SendStr); } @@ -684,9 +761,6 @@ void HTTPSendHeaders(STREAM *S, HTTPInfoStruct *Info) { char *SendStr=NULL, *Tempstr=NULL, *ptr; ListNode *Curr; -int count; -int i; -static int AuthCounter=0; STREAMClearDataProcessors(S); SendStr=CopyStr(SendStr,Info->Method); @@ -697,21 +771,21 @@ else Tempstr=HTTPQuoteChars(Tempstr,Info->Doc," "); SendStr=CatStr(SendStr,Tempstr); if (Info->Flags & HTTP_VER1_0) SendStr=CatStr(SendStr," HTTP/1.0\r\n"); -else SendStr=MCatStr(SendStr," HTTP/1.1\r\n","Host: ",Info->Host,"\r\n",NULL); +else SendStr=MCatStr(SendStr," ",Info->Protocol,"\r\n","Host: ",Info->Host,"\r\n",NULL); -if (StrLen(Info->PostContentType) >0) +if (StrValid(Info->PostContentType)) { Tempstr=FormatStr(Tempstr,"Content-type: %s\r\n",Info->PostContentType); SendStr=CatStr(SendStr,Tempstr); } -if (Info->PostContentLength > 0) +if (strcasecmp(Info->Method,"POST")==0) { Tempstr=FormatStr(Tempstr,"Content-Length: %d\r\n",Info->PostContentLength); SendStr=CatStr(SendStr,Tempstr); } -if (StrLen(Info->Destination)) +if (StrValid(Info->Destination)) { Tempstr=FormatStr(Tempstr,"Destination: %s\r\n",Info->Destination); SendStr=CatStr(SendStr,Tempstr); @@ -756,16 +830,15 @@ if ( if (! (Info->Flags & HTTP_NOCOMPRESS)) { - if (DataProcessorAvailable("Compression","gzip")) Tempstr=CatStr(Tempstr,"gzip"); - if (DataProcessorAvailable("Compression","zlib")) + if (DataProcessorAvailable("compress","gzip")) Tempstr=CatStr(Tempstr,"gzip"); + if (DataProcessorAvailable("compress","zlib")) { - if (StrLen(Tempstr)) Tempstr=CatStr(Tempstr,", deflate"); + if (StrValid(Tempstr)) Tempstr=CatStr(Tempstr,", deflate"); else Tempstr=CatStr(Tempstr,"deflate"); } } - if (StrLen(Tempstr)) SendStr=MCatStr(SendStr,"Accept-Encoding: ",Tempstr,"\r\n",NULL); - else SendStr=CatStr(SendStr,"Accept-Encoding: *.*\r\n"); + if (StrValid(Tempstr)) SendStr=MCatStr(SendStr,"Accept-Encoding: ",Tempstr,"\r\n",NULL); } if (Info->Flags & HTTP_KEEPALIVE) @@ -780,7 +853,7 @@ else } ptr=LibUsefulGetValue("HTTP:User-Agent"); -if (StrLen(ptr)) SendStr=MCatStr(SendStr,"User-Agent: ",ptr, "\r\n",NULL); +//if (StrValid(ptr)) SendStr=MCatStr(SendStr,"User-Agent: ",ptr, "\r\n",NULL); Curr=ListGetNext(Info->CustomSendHeaders); while (Curr) @@ -810,7 +883,7 @@ DestroyString(SendStr); void HTTPReadHeaders(STREAM *S, HTTPInfoStruct *Info) { -char *Tempstr=NULL, *ptr; +char *Tempstr=NULL, *Token=NULL, *ptr; ListClear(Info->ServerHeaders,DestroyString); @@ -823,28 +896,23 @@ Tempstr=STREAMReadLine(Tempstr,S); if (Tempstr) { if (Info->Flags & HTTP_DEBUG) fprintf(stderr,"RESPONSE: %s\n",Tempstr); - if (strncmp(Tempstr,"HTTP/",5)==0) - { - ptr=strchr(Tempstr,' '); - ptr++; - - Info->ResponseCode=CopyStrLen(Info->ResponseCode,ptr,3); - STREAMSetValue(S,"HTTP:ResponseCode",Info->ResponseCode); - - } + //Token will be protocol (HTTP/1.0 or ICY or whatever) + ptr=GetToken(Tempstr,"\\S",&Token,0); + Info->ResponseCode=CopyStrLen(Info->ResponseCode,ptr,3); + STREAMSetValue(S,"HTTP:ResponseCode",Info->ResponseCode); Tempstr=STREAMReadLine(Tempstr,S); } while (Tempstr) { StripTrailingWhitespace(Tempstr); -if (StrLen(Tempstr)==0) break; +if (StrEnd(Tempstr)) break; HTTPParseHeader(S, Info,Tempstr); Tempstr=STREAMReadLine(Tempstr,S); } //Handle Response Codes -if (StrLen(Info->ResponseCode)) +if (StrValid(Info->ResponseCode)) { if (*Info->ResponseCode=='3') { @@ -854,25 +922,26 @@ if (StrLen(Info->ResponseCode)) if (strcmp(Info->ResponseCode,"401")==0) { - if (Info->Authorization) Info->Authorization->Flags |= HTTP_AUTH_BASIC; + if (Info->AuthFlags) Info->AuthFlags |= HTTP_AUTH_BASIC; } if (strcmp(Info->ResponseCode,"407")==0) { - if (Info->ProxyAuthorization) Info->ProxyAuthorization->Flags |= HTTP_PROXY_AUTH; + if (Info->AuthFlags) Info->AuthFlags |= HTTP_AUTH_PROXY; } } S->BytesRead=0; + DestroyString(Tempstr); +DestroyString(Token); } int HTTPProcessResponse(HTTPInfoStruct *HTTPInfo) { -char *ptr, *login_ptr, *pass_ptr; int result=HTTP_ERROR; char *Proto=NULL, *PortStr=NULL; int RCode; @@ -939,7 +1008,7 @@ switch (RCode) break; case 407: - result=HTTP_PROXY_AUTH; + result=HTTP_AUTH_PROXY; break; default: @@ -957,7 +1026,8 @@ return(result); STREAM *HTTPSetupConnection(HTTPInfoStruct *Info, int ForceHTTPS) { -char *Proto=NULL, *Host=NULL, *Token=NULL; +char *Tempstr=NULL, *Host=NULL, *Token=NULL, *ptr; +char *Logon=NULL, *Pass=NULL; int Port=0, Flags=0; STREAM *S; @@ -965,17 +1035,14 @@ S=STREAMCreate(); if (Info->Flags & HTTP_PROXY) { - if (! Info->ProxyAuthorization) - { - Info->ProxyAuthorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); - } - ParseURL(Info->Proxy, &Proto, &Host, &Token, &Info->ProxyAuthorization->Logon, &Info->ProxyAuthorization->Password,NULL,NULL); + ParseURL(Info->Proxy, &Tempstr, &Host, &Token, &Logon, &Pass, NULL,NULL); + //&Info->ProxyAuthorization->Logon, Port=atoi(Token); - if (ForceHTTPS) Proto=CopyStr(Proto,"https"); + if (ForceHTTPS) Tempstr=CopyStr(Tempstr,"https"); - if (strcasecmp(Proto,"https")==0) Flags |= CONNECT_SSL; + if (strcasecmp(Tempstr,"https")==0) Flags |= CONNECT_SSL; } else { @@ -995,8 +1062,17 @@ else } } +Tempstr=CopyStr(Tempstr,GetVar(HTTPVars,"Tunnel")); +ptr=GetToken(Tempstr,",",&Token,0); +while (ptr) +{ + STREAMAddConnectionHop(S,Token); + ptr=GetToken(ptr,",",&Token,0); +} + if (Info->Flags & HTTP_TUNNEL) STREAMAddConnectionHop(S,Info->Proxy); -if (STREAMConnectToHost(S,Host,Port,Flags)) +Tempstr=FormatStr(Tempstr,"tcp:%s:%d",Host,Port); +if (STREAMConnect(S,Tempstr,Flags)) { HTTPSendHeaders(S,Info); } @@ -1008,8 +1084,8 @@ else Info->S=S; +DestroyString(Tempstr); DestroyString(Token); -DestroyString(Proto); DestroyString(Host); return(S); @@ -1055,7 +1131,7 @@ while (1) //through here once Info->State |= HTTP_CLIENTDATA_SENT; - if (StrLen(Info->PostData)) + if (StrValid(Info->PostData)) { STREAMWriteLine(Info->PostData,Info->S); if (Info->Flags & HTTP_DEBUG) fprintf(stderr,"\n%s\n",Info->PostData); @@ -1078,9 +1154,12 @@ while (1) if (Info->Flags & HTTP_GZIP) { - STREAMAddStandardDataProcessor(Info->S,"compression","gzip",""); + STREAMAddStandardDataProcessor(Info->S,"uncompress","gzip",""); + } + else if (Info->Flags & HTTP_DEFLATE) + { + STREAMAddStandardDataProcessor(Info->S,"uncompress","zlib",""); } - else if (Info->Flags & HTTP_DEFLATE) STREAMAddStandardDataProcessor(Info->S,"compression","zlib",""); if (result == HTTP_OKAY) break; if (result == HTTP_NOTFOUND) break; @@ -1092,12 +1171,9 @@ while (1) if (result == HTTP_AUTH_BASIC) { if ( - (! Info->Authorization) || - ( - (Info->Authorization->Flags & HTTP_SENT_AUTH) || - (! Info->Authorization->Logon) || - (StrLen(Info->Authorization->Logon)==0) - ) + (Info->AuthFlags & HTTP_AUTH_SENT) || + (Info->AuthFlags & HTTP_AUTH_RETURN) || + (StrEnd(Info->Authorization)) ) { if (result == HTTP_AUTH_BASIC) break; @@ -1106,12 +1182,8 @@ while (1) } if ( - (result == HTTP_PROXY_AUTH) && - ( - (Info->ProxyAuthorization->Flags & HTTP_SENT_AUTH) || - (! Info->ProxyAuthorization->Logon) || - (StrLen(Info->ProxyAuthorization->Logon)==0) - ) + (result == HTTP_AUTH_PROXY) && + (StrEnd(Info->ProxyAuthorization)) ) { break; @@ -1129,17 +1201,24 @@ return(Info->S); -STREAM *HTTPMethod(char *Method, char *URL, char *Logon, char *Password) +STREAM *HTTPMethod(const char *Method, const char *URL, const char *Logon, const char *Password, const char *ContentType, const char *ContentData, int ContentLength) { HTTPInfoStruct *Info; STREAM *S; Info=HTTPInfoFromURL(Method, URL); -if (StrLen(Logon) || StrLen(Password)) + +if (StrValid(ContentType)) +{ +Info->PostContentType=CopyStr(Info->PostContentType,ContentType); +Info->PostData=CopyStr(Info->PostData,ContentData); +Info->PostContentLength=ContentLength; +} + +if (StrValid(Logon) || StrValid(Password)) { - if (! Info->Authorization) Info->Authorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); - HTTPAuthSet(Info->Authorization,Logon, Password, HTTP_AUTH_BASIC); + Info->UserName=CopyStr(Info->UserName, Logon); } S=HTTPTransact(Info); @@ -1148,31 +1227,15 @@ return(S); } -STREAM *HTTPGet(char *URL, char *Logon, char *Password) +STREAM *HTTPGet(const char *URL, const char *Logon, const char *Password) { -return(HTTPMethod("GET", URL, Logon, Password)); +return(HTTPMethod("GET", URL, Logon, Password,"","",0)); } -STREAM *HTTPPost(char *URL, char *Logon, char *Password, char *ContentType, char *Content) -{ -HTTPInfoStruct *Info; -STREAM *S; - - -Info=HTTPInfoFromURL("POST", URL); -Info->PostContentType=CopyStr(Info->PostContentType,ContentType); -Info->PostData=CopyStr(Info->PostData,Content); -Info->PostContentLength=StrLen(Content); -if (StrLen(Logon) || StrLen(Password)) +STREAM *HTTPPost(const char *URL, const char *Logon, const char *Password, const char *ContentType, const char *Content) { - if (! Info->Authorization) Info->Authorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); - HTTPAuthSet(Info->Authorization,Logon, Password, HTTP_AUTH_BASIC); -} -S=HTTPTransact(Info); - -HTTPInfoDestroy(Info); -return(S); +return(HTTPMethod("POST", URL, Logon, Password, ContentType, Content, StrLen(Content))); } @@ -1220,3 +1283,5 @@ int HTTPGetFlags() { return(g_Flags); } + + diff --git a/libUseful-2.0/http.h b/libUseful-2.4/http.h similarity index 52% rename from libUseful-2.0/http.h rename to libUseful-2.4/http.h index b7e9470..88c9684 100644 --- a/libUseful-2.0/http.h +++ b/libUseful-2.4/http.h @@ -7,8 +7,11 @@ #define HTTP_AUTH_BASIC 1 #define HTTP_AUTH_DIGEST 2 -#define HTTP_SENT_AUTH 4 -#define HTTP_PROXY_AUTH 8 +#define HTTP_AUTH_TOKEN 4 +#define HTTP_AUTH_OAUTH 8 +#define HTTP_AUTH_PROXY 64 +#define HTTP_AUTH_SENT 128 +#define HTTP_AUTH_RETURN 256 #define HTTP_OKAY 0 @@ -28,6 +31,7 @@ #define HTTP_TRY_HTTPS 64 #define HTTP_REQ_HTTPS 128 #define HTTP_KEEPALIVE 256 +#define HTTP_POSTARGS 512 #define HTTP_SSL 1024 #define HTTP_SSL_REWRITE 2048 #define HTTP_PROXY 4096 @@ -44,20 +48,13 @@ #define HTTP_CLIENTDATA_SENT 2 #define HTTP_HEADERS_READ 4 -typedef struct -{ -int Flags; -char *AuthRealm; -char *AuthQOP; -char *AuthNonce; -char *AuthOpaque; -char *Logon; -char *Password; -} HTTPAuthStruct; +extern const char *HTTP_AUTH_BY_TOKEN; + typedef struct { +char *Protocol; char *Host; int Port; char *Method; @@ -65,6 +62,7 @@ char *Doc; char *Destination; char *ResponseCode; int Flags; +int AuthFlags; int State; char *RedirectPath; char *PreviousRedirect; @@ -79,8 +77,9 @@ char *Proxy; time_t IfModifiedSince; ListNode *ServerHeaders; ListNode *CustomSendHeaders; -HTTPAuthStruct *Authorization; -HTTPAuthStruct *ProxyAuthorization; +char *UserName; +char *Authorization; +char *ProxyAuthorization; STREAM *S; } HTTPInfoStruct; @@ -88,21 +87,28 @@ STREAM *S; extern "C" { #endif -char *HTTPQuote(char *, char*); -char *HTTPQuoteChars(char *RetBuff, char *Str, char *CharList); -char *HTTPUnQuote(char *, char*); +char *HTTPQuote(char *RetBuff, const char *Str); +char *HTTPQuoteChars(char *RetBuff, const char *Str, const char *CharList); +char *HTTPUnQuote(char *RetBuff, const char *Str); + +void HTTPSetVar(const char *Name, const char *Var); void HTTPInfoDestroy(void *p_Info); -void HTTPInfoSetValues(HTTPInfoStruct *Info, char *Host, int Port, char *Logon, char *Password, char *Method, char *Doc, char *ContentType, int ContentLength); -void HTTPInfoSetAuth(HTTPInfoStruct *Auth, char *Logon, char *Password, int Type); -HTTPInfoStruct *HTTPInfoCreate(char *Host, int Port, char *Logon, char *Password, char *Method, char *Doc, char *ContentType, int ContentLength); +void HTTPInfoSetValues(HTTPInfoStruct *Info, const char *Host, int Port, const char *Logon, const char *Password, const char *Method, const char *Doc, const char *ContentType, int ContentLength); +void HTTPInfoSetAuth(HTTPInfoStruct *Auth, const char *Logon, const char *Password, int Type); +char *HTTPDigest(char *RetStr, const char *Method, const char *Logon, const char *Password, const char *Realm, const char *Doc, const char *Nonce); + +HTTPInfoStruct *HTTPInfoCreate(const char *Protocol, const char *Host, int Port, const char *Logon, const char *Password, const char *Method, const char *Doc, const char *ContentType, int ContentLength); + + STREAM *HTTPConnect(HTTPInfoStruct *Info); STREAM *HTTPTransact(HTTPInfoStruct *Info); -HTTPInfoStruct *HTTPInfoFromURL(char *Method, char *URL); -STREAM *HTTPMethod(char *Method, char *URL, char *Logon, char *Password); -STREAM *HTTPGet(char *URL, char *Logon, char *Password); -STREAM *HTTPPost(char *URL, char *Logon, char *Password, char *ContentType, char *Content); +void HTTPInfoSetURL(HTTPInfoStruct *Info, const char *Method, const char *URL); +HTTPInfoStruct *HTTPInfoFromURL(const char *Method, const char *URL); +STREAM *HTTPMethod(const char *Method, const char *URL, const char *Logon, const char *Password, const char *ContentType, const char *ContentData, int ContentLength); +STREAM *HTTPGet(const char *URL, const char *Logon, const char *Password); +STREAM *HTTPPost(const char *URL, const char *Logon, const char *Password, const char *ContentType, const char *Content); int HTTPReadBytes(STREAM *Con, char **Buffer); void HTTPCopyToSTREAM(STREAM *Con, STREAM *S); int HTTPDownload(char *URL, char *Login, char *Password, STREAM *S); @@ -110,7 +116,6 @@ void HTTPSetUserAgent(char *AgentName); void HTTPSetProxy(char *Proxy); void HTTPSetFlags(int Flags); int HTTPGetFlags(); -char *HTTPParseURL(char *URL, char **Proto, char **Host, int *Port, char **Login, char **Password); #ifdef __cplusplus diff --git a/libUseful-2.4/http.o b/libUseful-2.4/http.o new file mode 100644 index 0000000..fc1fa35 Binary files /dev/null and b/libUseful-2.4/http.o differ diff --git a/libUseful-2.0/includes.h b/libUseful-2.4/includes.h similarity index 89% rename from libUseful-2.0/includes.h rename to libUseful-2.4/includes.h index 50a57df..e9325e9 100644 --- a/libUseful-2.0/includes.h +++ b/libUseful-2.4/includes.h @@ -17,14 +17,17 @@ #include #include #include +#include #include "defines.h" #include "string.h" #include "list.h" -#include "GeneralFunctions.h" #include "file.h" #include "socket.h" +#include "openssl.h" #include "Vars.h" #include "libsettings.h" +#include "GeneralFunctions.h" +#include "Tokenizer.h" #endif diff --git a/libUseful-2.0/inet.c b/libUseful-2.4/inet.c similarity index 92% rename from libUseful-2.0/inet.c rename to libUseful-2.4/inet.c index e58da36..a1abf5f 100644 --- a/libUseful-2.0/inet.c +++ b/libUseful-2.4/inet.c @@ -47,8 +47,6 @@ return(RetStr); char *GetExternalIP(char *RetStr) { -STREAM *S; - RetStr=CopyStr(RetStr,""); if (! StrLen(RetStr)) RetStr=ExtractFromWebpage(RetStr,"http://checkip.dyndns.org", "Current IP Address: $(extract_item)",4); if (! StrLen(RetStr)) RetStr=ExtractFromWebpage(RetStr,"http://ip.appspot.com/", "",4); @@ -62,7 +60,8 @@ int IPGeoLocate(char *IP, ListNode *Vars) { STREAM *S=NULL; char *ptr, *TagType=NULL, *TagData=NULL, *Tempstr=NULL, *Token=NULL; -char *DesiredTags[]={"CountryCode","CountryName","City","RegionName","Latitude","Longitude","TimeZone",NULL}; +const char *DesiredTags[]={"CountryCode","CountryName","City","RegionName","Latitude","Longitude","TimeZone",NULL}; +int result=FALSE; if (! IsIPAddress(IP)) Token=CopyStr(Token,LookupHostIP(IP)); else Token=CopyStr(Token,IP); @@ -83,6 +82,7 @@ if (S) //we can't re-use 'TagType', we still need it ptr=XMLGetTag(ptr,NULL,&Token,&TagData); SetVar(Vars,TagType,TagData); + result=TRUE; } ptr=XMLGetTag(ptr,NULL,&TagType,&TagData); } @@ -96,5 +96,7 @@ DestroyString(Tempstr); DestroyString(Token); DestroyString(TagType); DestroyString(TagData); + +return(result); } diff --git a/libUseful-2.0/inet.h b/libUseful-2.4/inet.h similarity index 100% rename from libUseful-2.0/inet.h rename to libUseful-2.4/inet.h diff --git a/libUseful-2.4/inet.o b/libUseful-2.4/inet.o new file mode 100644 index 0000000..4a83c5f Binary files /dev/null and b/libUseful-2.4/inet.o differ diff --git a/libUseful-2.0/install-sh b/libUseful-2.4/install-sh similarity index 100% rename from libUseful-2.0/install-sh rename to libUseful-2.4/install-sh diff --git a/libUseful-2.4/jh_ref.c b/libUseful-2.4/jh_ref.c new file mode 100644 index 0000000..bfe21ee --- /dev/null +++ b/libUseful-2.4/jh_ref.c @@ -0,0 +1,321 @@ +#include "jh_ref.h" +#include + +/*The constant for the Round 0 of E8*/ +const unsigned char roundconstant_zero[64] = {0x6,0xa,0x0,0x9,0xe,0x6,0x6,0x7,0xf,0x3,0xb,0xc,0xc,0x9,0x0,0x8,0xb,0x2,0xf,0xb,0x1,0x3,0x6,0x6,0xe,0xa,0x9,0x5,0x7,0xd,0x3,0xe,0x3,0xa,0xd,0xe,0xc,0x1,0x7,0x5,0x1,0x2,0x7,0x7,0x5,0x0,0x9,0x9,0xd,0xa,0x2,0xf,0x5,0x9,0x0,0xb,0x0,0x6,0x6,0x7,0x3,0x2,0x2,0xa}; + +/*The two Sboxes S0 and S1*/ +unsigned char S[2][16] = {{9,0,4,11,13,12,3,15,1,10,2,6,7,5,8,14},{3,12,6,13,5,7,1,9,15,2,0,4,11,10,14,8}}; + +/*The linear transformation L, the MDS code*/ +#define L(a, b) { \ + (b) ^= ( ( (a) << 1) ^ ( (a) >> 3) ^ (( (a) >> 2) & 2) ) & 0xf; \ + (a) ^= ( ( (b) << 1) ^ ( (b) >> 3) ^ (( (b) >> 2) & 2) ) & 0xf; \ +} + +void R8(hashState *state); /* The round function of E8 */ +void update_roundconstant(hashState *state); /* Update the round constant of E8 */ +void E8_initialgroup(hashState *state); /* Grouping the state into 4-bit elements at the beginning of E8 */ +void E8_finaldegroup(hashState *state); /* Inverse of the grouping at the end of E8 */ +void E8(hashState *state); /* The bijective function E8 */ +void F8(hashState *state); /* The compression function F8 */ + +/*the round function of E8 */ +void R8(hashState *state) +{ + unsigned int i; + unsigned char tem[256],t; + unsigned char roundconstant_expanded[256]; /*the round constant expanded into 256 1-bit element;*/ + + /*expand the round constant into 256 one-bit element*/ + for (i = 0; i < 256; i++) { + roundconstant_expanded[i] = (state->roundconstant[i >> 2] >> (3 - (i & 3)) ) & 1; + } + + /*S box layer, each constant bit selects one Sbox from S0 and S1*/ + for (i = 0; i < 256; i++) { + tem[i] = S[roundconstant_expanded[i]][state->A[i]]; /*constant bits are used to determine which Sbox to use*/ + } + + /*MDS Layer*/ + for (i = 0; i < 256; i=i+2) L(tem[i], tem[i+1]); + + /*The following is the permuation layer P_8*/ + + /*initial swap Pi_8*/ + for ( i = 0; i < 256; i=i+4) { + t = tem[i+2]; + tem[i+2] = tem[i+3]; + tem[i+3] = t; + } + + /*permutation P'_8*/ + for (i = 0; i < 128; i=i+1) { + state->A[i] = tem[i<<1]; + state->A[i+128] = tem[(i<<1)+1]; + } + + /*final swap Phi_8*/ + for ( i = 128; i < 256; i=i+2) { + t = state->A[i]; + state->A[i] = state->A[i+1]; + state->A[i+1] = t; + } +} + + +/*The following function generates the next round constant from the current + round constant; R6 is used for generating round constants for E8, with + the round constants of R6 being set as 0; +*/ +void update_roundconstant(hashState *state) { + int i; + unsigned char tem[64],t; + + /*Sbox layer*/ + for (i = 0; i < 64; i++) tem[i] = S[0][state->roundconstant[i]]; + + /*MDS layer*/ + for (i = 0; i < 64; i=i+2) L(tem[i], tem[i+1]); + + /*The following is the permutation layer P_6 */ + + /*initial swap Pi_6*/ + for ( i = 0; i < 64; i=i+4) { + t = tem[i+2]; + tem[i+2] = tem[i+3]; + tem[i+3] = t; + } + + /*permutation P'_6*/ + for ( i = 0; i < 32; i=i+1) { + state->roundconstant[i] = tem[i<<1]; + state->roundconstant[i+32] = tem[(i<<1)+1]; + } + + /*final swap Phi_6*/ + for ( i = 32; i < 64; i=i+2 ) { + t = state->roundconstant[i]; + state->roundconstant[i] = state->roundconstant[i+1]; + state->roundconstant[i+1] = t; + } +} + +/*initial group at the begining of E_8: group the bits of H into 4-bit elements of A. + After the grouping, the i-th, (i+256)-th, (i+512)-th, (i+768)-th bits of state->H + become the i-th 4-bit element of state->A +*/ +void E8_initialgroup(hashState *state) { + unsigned int i; + unsigned char t0,t1,t2,t3; + unsigned char tem[256]; + + /*t0 is the i-th bit of H, i = 0, 1, 2, 3, ... , 127*/ + /*t1 is the (i+256)-th bit of H*/ + /*t2 is the (i+512)-th bit of H*/ + /*t3 is the (i+768)-th bit of H*/ + for (i = 0; i < 256; i++) { + t0 = (state->H[i>>3] >> (7 - (i & 7)) ) & 1; + t1 = (state->H[(i+256)>>3] >> (7 - (i & 7)) ) & 1; + t2 = (state->H[(i+ 512 )>>3] >> (7 - (i & 7)) ) & 1; + t3 = (state->H[(i+ 768 )>>3] >> (7 - (i & 7)) ) & 1; + tem[i] = (t0 << 3) | (t1 << 2) | (t2 << 1) | (t3 << 0); + } + /*padding the odd-th elements and even-th elements separately*/ + for (i = 0; i < 128; i++) { + state->A[i << 1] = tem[i]; + state->A[(i << 1)+1] = tem[i+128]; + } +} + +/*de-group at the end of E_8: it is the inverse of E8_initialgroup + The 256 4-bit elements in state->A are degouped into the 1024-bit state->H +*/ +void E8_finaldegroup(hashState *state) { + unsigned int i; + unsigned char t0,t1,t2,t3; + unsigned char tem[256]; + + for (i = 0; i < 128; i++) { + tem[i] = state->A[i << 1]; + tem[i+128] = state->A[(i << 1)+1]; + } + + for (i = 0; i < 128; i++) state->H[i] = 0; + + for (i = 0; i < 256; i++) { + t0 = (tem[i] >> 3) & 1; + t1 = (tem[i] >> 2) & 1; + t2 = (tem[i] >> 1) & 1; + t3 = (tem[i] >> 0) & 1; + + state->H[i>>3] |= t0 << (7 - (i & 7)); + state->H[(i + 256)>>3] |= t1 << (7 - (i & 7)); + state->H[(i + 512)>>3] |= t2 << (7 - (i & 7)); + state->H[(i + 768)>>3] |= t3 << (7 - (i & 7)); + } +} + +/*bijective function E8 */ +void E8(hashState *state) +{ + unsigned int i; + //unsigned char t0,t1,t2,t3; + //unsigned char tem[256]; + + /*initialize the round constant*/ + for (i = 0; i < 64; i++) state->roundconstant[i] = roundconstant_zero[i]; + + /*initial group at the begining of E_8: group the H value into 4-bit elements and store them in A */ + E8_initialgroup(state); + + /* 42 rounds */ + for (i = 0; i < 42; i++) { + R8(state); + update_roundconstant(state); + } + + /*de-group at the end of E_8: decompose the 4-bit elements of A into the 1024-bit H*/ + E8_finaldegroup(state); +} + +/* compression function F8 */ +void F8(hashState *state) +{ + unsigned int i; + + /*xor the message with the first half of H*/ + for (i = 0; i < 64; i++) state->H[i] ^= state->buffer[i]; + + /* Bijective function E8 */ + E8(state); + + /* xor the message with the last half of H */ + for (i = 0; i < 64; i++) state->H[i+64] ^= state->buffer[i]; +} + +/*before hashing a message, initialize the hash state as H0 */ +HashReturn JHInit(hashState *state, int hashbitlen) +{ + unsigned int i; + + state->databitlen = 0; + state->datasize_in_buffer = 0; + + state->hashbitlen = hashbitlen; + + for (i = 0; i < 64; i++) state->buffer[i] = 0; + for (i = 0; i < 128; i++) state->H[i] = 0; + + /*initialize the initial hash value of JH*/ + /*step 1: set H(-1) to the message digest size*/ + state->H[1] = hashbitlen & 0xff; + state->H[0] = (hashbitlen >> 8) & 0xff; + /*step 2: compute H0 from H(-1) with message M(0) being set as 0*/ + F8(state); + + return(SUCCESS); +} + +/*hash each 512-bit message block, except the last partial block*/ +HashReturn JHUpdate(hashState *state, const unsigned char *data, DataLength databitlen) +{ + DataLength index; /*the starting address of the data to be compressed*/ + + state->databitlen += databitlen; + index = 0; + + /*if there is remaining data in the buffer, fill it to a full message block first*/ + /*we assume that the size of the data in the buffer is the multiple of 8 bits if it is not at the end of a message*/ + + /*There is data in the buffer, but the incoming data is insufficient for a full block*/ + if ( (state->datasize_in_buffer > 0 ) && (( state->datasize_in_buffer + databitlen) < 512) ) { + if ( (databitlen & 7) == 0 ) { + memcpy(state->buffer + (state->datasize_in_buffer >> 3), data, 64-(state->datasize_in_buffer >> 3)) ; + } + else memcpy(state->buffer + (state->datasize_in_buffer >> 3), data, 64-(state->datasize_in_buffer >> 3)+1) ; + state->datasize_in_buffer += databitlen; + databitlen = 0; + } + + /*There is data in the buffer, and the incoming data is sufficient for a full block*/ + if ( (state->datasize_in_buffer > 0 ) && (( state->datasize_in_buffer + databitlen) >= 512) ) { + memcpy( state->buffer + (state->datasize_in_buffer >> 3), data, 64-(state->datasize_in_buffer >> 3) ) ; + index = 64-(state->datasize_in_buffer >> 3); + databitlen = databitlen - (512 - state->datasize_in_buffer); + F8(state); + state->datasize_in_buffer = 0; + } + + /*hash the remaining full message blocks*/ + for ( ; databitlen >= 512; index = index+64, databitlen = databitlen - 512) { + memcpy(state->buffer, data+index, 64); + F8(state); + } + + /*store the partial block into buffer, assume that -- if part of the last byte is not part of the message, then that part consists of 0 bits*/ + if ( databitlen > 0) { + if ((databitlen & 7) == 0) + memcpy(state->buffer, data+index, (databitlen & 0x1ff) >> 3); + else + memcpy(state->buffer, data+index, ((databitlen & 0x1ff) >> 3)+1); + state->datasize_in_buffer = databitlen; + } + + return(SUCCESS); +} + + +/*padding the message, truncate the hash value H and obtain the message digest*/ +unsigned int JHFinal(hashState *state, unsigned char *hashval) +{ + unsigned int i, len=0; + + if ( (state->databitlen & 0x1ff) == 0) { + /*pad the message when databitlen is multiple of 512 bits, then process the padded block*/ + for (i = 0; i < 64; i++) state->buffer[i] = 0; + state->buffer[0] = 0x80; + state->buffer[63] = state->databitlen & 0xff; + state->buffer[62] = (state->databitlen >> 8) & 0xff; + state->buffer[61] = (state->databitlen >> 16) & 0xff; + state->buffer[60] = (state->databitlen >> 24) & 0xff; + state->buffer[59] = (state->databitlen >> 32) & 0xff; + state->buffer[58] = (state->databitlen >> 40) & 0xff; + state->buffer[57] = (state->databitlen >> 48) & 0xff; + state->buffer[56] = (state->databitlen >> 56) & 0xff; + F8(state); + } + else { + /*set the rest of the bytes in the buffer to 0*/ + if ( (state->datasize_in_buffer & 7) == 0) + for (i = (state->databitlen & 0x1ff) >> 3; i < 64; i++) state->buffer[i] = 0; + else + for (i = ((state->databitlen & 0x1ff) >> 3)+1; i < 64; i++) state->buffer[i] = 0; + + /*pad and process the partial block when databitlen is not multiple of 512 bits, then hash the padded blocks*/ + state->buffer[((state->databitlen & 0x1ff) >> 3)] |= 1 << (7- (state->databitlen & 7)); + F8(state); + for (i = 0; i < 64; i++) state->buffer[i] = 0; + state->buffer[63] = state->databitlen & 0xff; + state->buffer[62] = (state->databitlen >> 8) & 0xff; + state->buffer[61] = (state->databitlen >> 16) & 0xff; + state->buffer[60] = (state->databitlen >> 24) & 0xff; + state->buffer[59] = (state->databitlen >> 32) & 0xff; + state->buffer[58] = (state->databitlen >> 40) & 0xff; + state->buffer[57] = (state->databitlen >> 48) & 0xff; + state->buffer[56] = (state->databitlen >> 56) & 0xff; + F8(state); + } + + /*truncating the final hash value to generate the message digest*/ + switch (state->hashbitlen) { + case 224: len=28; memcpy(hashval,state->H+100,len); break; + case 256: len=32; memcpy(hashval,state->H+96, len); break; + case 384: len=48; memcpy(hashval,state->H+80, len); break; + case 512: len=64; memcpy(hashval,state->H+64, len); break; + } + + return(len); +} + + diff --git a/libUseful-2.4/jh_ref.h b/libUseful-2.4/jh_ref.h new file mode 100644 index 0000000..2eaf552 --- /dev/null +++ b/libUseful-2.4/jh_ref.h @@ -0,0 +1,39 @@ +/* This program gives the reference implementation of JH. + It implements the standard description of JH (not bitslice) + The description given in this program is suitable for hardware implementation + + -------------------------------- + Comparing to the original reference implementation, + two functions are added to make the porgram more readable. + One function is E8_initialgroup() at the beginning of E8; + another function is E8_finaldegroup() at the end of E8. + + -------------------------------- + + Last Modified: January 16, 2011 +*/ + + +#ifndef JH_HASH_H +#define JH_HASH_H + + +typedef unsigned long long DataLength;typedef enum { SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2 } HashReturn; + +typedef struct { + int hashbitlen; /*the message digest size*/ + unsigned long long databitlen; /*the message size in bits*/ + unsigned long long datasize_in_buffer; /*the size of the message remained in buffer; assumed to be multiple of 8bits except for the last partial block at the end of the message*/ + unsigned char H[128]; /*the hash value H; 128 bytes;*/ + unsigned char A[256]; /*the temporary round value; 256 4-bit elements*/ + unsigned char roundconstant[64]; /*round constant for one round; 64 4-bit elements*/ + unsigned char buffer[64]; /*the message block to be hashed; 64 bytes*/ +} hashState; + +/*The API functions*/ +HashReturn JHInit(hashState *state, int hashbitlen); +HashReturn JHUpdate(hashState *state, const unsigned char *data, DataLength databitlen); +unsigned int JHFinal(hashState *state, unsigned char *hashval); + + +#endif diff --git a/libUseful-2.4/jh_ref.o b/libUseful-2.4/jh_ref.o new file mode 100644 index 0000000..eb191ce Binary files /dev/null and b/libUseful-2.4/jh_ref.o differ diff --git a/libUseful-2.4/libUseful-2.4.a b/libUseful-2.4/libUseful-2.4.a new file mode 100644 index 0000000..b522314 Binary files /dev/null and b/libUseful-2.4/libUseful-2.4.a differ diff --git a/libUseful-2.4/libUseful-2.4.so b/libUseful-2.4/libUseful-2.4.so new file mode 100755 index 0000000..2434f47 Binary files /dev/null and b/libUseful-2.4/libUseful-2.4.so differ diff --git a/libUseful-2.0/libUseful.h b/libUseful-2.4/libUseful.h similarity index 72% rename from libUseful-2.0/libUseful.h rename to libUseful-2.4/libUseful.h index 473f5e8..2296218 100644 --- a/libUseful-2.0/libUseful.h +++ b/libUseful-2.4/libUseful.h @@ -9,10 +9,17 @@ #define TRUE 1 #endif +#define __LIBUSEFUL_VERSION__ "2.0" +#define __LIBUSEFUL_BUILD_DATE__ __DATE__ +#define __LIBUSEFUL_BUILD_TIME__ __TIME__ + +//__TIME__ + #include #include #include #include +#include "memory.h" #include "socket.h" #include "unix_socket.h" #include "string.h" @@ -20,6 +27,7 @@ #include "list.h" #include "file.h" #include "base64.h" +#include "Tokenizer.h" #include "FileSystem.h" #include "GeneralFunctions.h" #include "DataProcessing.h" @@ -27,16 +35,21 @@ #include "ConnectManager.h" #include "Hash.h" #include "Compression.h" -#include "sound.h" -#include "pty.h" -#include "Log.h" -#include "http.h" -#include "oauth.h" #include "Time.h" #include "Vars.h" #include "Markup.h" #include "MathExpr.h" #include "PatternMatch.h" #include "SpawnPrograms.h" +#include "ParseURL.h" +#include "sound.h" +#include "pty.h" +#include "Log.h" +#include "http.h" +#include "oauth.h" +#include "tar.h" +#include "ansi.h" +#include "proctitle.h" +#include "securemem.h" #endif diff --git a/libUseful-2.4/libsettings.c b/libUseful-2.4/libsettings.c new file mode 100644 index 0000000..3fef58f --- /dev/null +++ b/libUseful-2.4/libsettings.c @@ -0,0 +1,41 @@ +#include "defines.h" +#include "includes.h" +#include "Vars.h" +#include "libUseful.h" + +/* These functions provide an interface for setting variables that */ +/* are used by libUseful itself */ + +ListNode *LibUsefulSettings=NULL; + +ListNode *LibUsefulValuesGetHead() +{ +return(LibUsefulSettings); +} + +void LibUsefulInitSettings() +{ +char *Tempstr=NULL; + + LibUsefulSettings=ListCreate(); + SetVar(LibUsefulSettings,"LibUsefulVersion",__LIBUSEFUL_VERSION__); + Tempstr=MCopyStr(Tempstr,__LIBUSEFUL_BUILD_DATE__," ",__LIBUSEFUL_BUILD_TIME__,NULL); + SetVar(LibUsefulSettings,"LibUsefulBuildTime",Tempstr); + DestroyString(Tempstr); +} + + +void LibUsefulSetValue(char *Name, char *Value) +{ + if (! LibUsefulSettings) LibUsefulInitSettings(); + SetVar(LibUsefulSettings,Name,Value); +} + +char *LibUsefulGetValue(char *Name) +{ +if (! LibUsefulSettings) LibUsefulInitSettings(); + +if (!StrLen(Name)) return(""); +return(GetVar(LibUsefulSettings,Name)); +} + diff --git a/libUseful-2.0/libsettings.h b/libUseful-2.4/libsettings.h similarity index 100% rename from libUseful-2.0/libsettings.h rename to libUseful-2.4/libsettings.h diff --git a/libUseful-2.4/libsettings.o b/libUseful-2.4/libsettings.o new file mode 100644 index 0000000..138b6d4 Binary files /dev/null and b/libUseful-2.4/libsettings.o differ diff --git a/libUseful-2.0/list.c b/libUseful-2.4/list.c similarity index 77% rename from libUseful-2.0/list.c rename to libUseful-2.4/list.c index e622c4c..65003c3 100644 --- a/libUseful-2.0/list.c +++ b/libUseful-2.4/list.c @@ -1,4 +1,6 @@ #include "includes.h" +#include "Time.h" + ListNode *ListGetHead(ListNode *Node) @@ -23,6 +25,13 @@ return(*intptr); } +void ListSetFlags(ListNode *List, int Flags) +{ +ListNode *Head; + +Head=ListGetHead(List); +Head->Flags=Flags; +} int ListSetNoOfItems(ListNode *LastItem, int val) @@ -104,8 +113,6 @@ ListSetNoOfItems(ListStart,0); void ListDestroy(ListNode *ListStart, LIST_ITEM_DESTROY_FUNC ItemDestroyer) { - ListNode *Curr,*Next; - if (! ListStart) return; ListClear(ListStart, ItemDestroyer); free(ListStart->Item); @@ -148,6 +155,7 @@ Curr->Item=Item; Curr->Head=ListGetHead(ListStart); Curr->Next=NULL; if (Name) Curr->Tag=CopyStr(NULL,Name); +Curr->Time=GetTime(TIME_CACHED); ListIncrNoOfItems(Curr); return(Curr); @@ -157,7 +165,7 @@ return(Curr); ListNode *ListAddNamedItem(ListNode *ListStart,const char *Name,void *Item) { -ListNode *Head, *Curr; +ListNode *Curr; Curr=ListGetLast(ListStart); if (Curr==NULL) return(Curr); @@ -183,7 +191,7 @@ if (Next) Next->Prev=Prev; void ListThreadNode(ListNode *Prev, ListNode *Node) { -ListNode *NewItem, *Next; +ListNode *Next; //Never thread something to itself! if (Prev==Node) return; @@ -205,11 +213,13 @@ NewItem=(ListNode *) calloc(1,sizeof(ListNode)); NewItem->Item=Item; NewItem->Prev=InsertNode; NewItem->Next=Next; -InsertNode->Next=NewItem; NewItem->Head=InsertNode->Head; +InsertNode->Next=NewItem; if (Next) Next->Prev=NewItem; /* Next might be NULL! */ ListIncrNoOfItems(NewItem); if (StrLen(Name)) NewItem->Tag=CopyStr(NewItem->Tag,Name); +NewItem->Time=GetTime(TIME_CACHED); + return(NewItem); } @@ -217,74 +227,142 @@ return(NewItem); void OrderedListAddJump(ListNode *From, ListNode *To) { int result; +static int depth=0; if (! From) return; if (! To) return; +depth++; +if (depth > 100) +{ + printf("ERROR: OLJ DEEEP\n"); + exit(1); +} + if (From->Jump) { result=strcmp(From->Jump->Tag, To->Tag); - if (result > 0) OrderedListAddJump(From->Next,To); - else if (result==0) - { - return; - } - else +// if (result > 0) OrderedListAddJump(From->Next,To); +// else + if (result < 0) { OrderedListAddJump(From->Next,From->Jump); From->Jump=To; } } else From->Jump=To; + +depth--; } -ListNode *OrderedListAddNamedItem(ListNode *Head, const char *Name, void *Item) + +ListNode *ListFindNamedItemInsert(ListNode *Head, const char *Name) { -ListNode *NewItem, *Prev, *Curr, *Start; -int count=0, jcount=0, result=-1; +ListNode *Prev, *Curr, *Start=NULL; +int result=0, count=0; +int hops=0, jumps=0, miss=0; +if (! Head) return(Head); +if (! StrLen(Name)) return(Head); +Curr=ListGetNext(Head); +if (! Curr) return(Head); -if (! Head) return(NULL); -Prev=Head; -Curr=Head->Next; -Start=Curr; +//Check last item in list +Prev=Head->Prev; +if (Prev && (Prev != Head) && Prev->Tag) +{ + if (Head->Flags & LIST_FLAG_CASE) result=strcmp(Prev->Tag,Name); + else result=strcasecmp(Prev->Tag,Name); -while (Curr) + if ((Head->Flags & LIST_FLAG_ORDERED) && (result < 1)) return(Prev); +} + +/* +if ((Head->Flags & LIST_FLAG_CACHE) && (Head->Jump)) { -if (Curr->Jump) + Prev=Head->Jump; + if (Prev->Tag) + { + if (Head->Flags & LIST_FLAG_CASE) result=strcmp(Prev->Tag,Name); + else result=strcasecmp(Prev->Tag,Name); + if (result < 1) Curr=Prev; + } +} +*/ + + +Prev=Head; +while (Curr) { - count=0; - result=strcmp(Curr->Jump->Tag,Name); - if (result < 0) + if (Curr->Jump && Curr->Jump->Tag) + { + if (Head->Flags & LIST_FLAG_CASE) result=strcmp(Curr->Jump->Tag,Name); + else result=strcasecmp(Curr->Jump->Tag,Name); + if (result < 1) + { + if ((result < 0) && Curr->Jump->Next) Curr->Jump=Curr->Jump->Next; + Curr=Curr->Jump; + jumps++; + count=0; + } + else miss++; + } else if (! Start) Start=Curr; + + if (Curr->Tag) { - Curr=Curr->Jump; - Prev=Curr->Prev; - jcount++; - if (jcount > 5) + if (Head->Flags & LIST_FLAG_CASE) result=strcmp(Curr->Tag,Name); + else result=strcasecmp(Curr->Tag,Name); + + if (result==0) + { + if (Head->Flags & LIST_FLAG_SELFORG) ListSwapItems(Curr->Prev, Curr); + if (Head->Flags & LIST_FLAG_CACHE) Head->Jump=Curr; + return(Curr); + } + if ((result > 0) && (Head->Flags & LIST_FLAG_ORDERED)) { - OrderedListAddJump(Head->Next, Curr); - jcount=0; + return(Prev); } - Start=Curr->Next; } + +hops++; +count++; + + + Prev=Curr; + Curr=ListGetNext(Curr); } -if (Curr->Tag) result=strcmp(Curr->Tag,Name); -if (result > -1) break; +return(Prev); +} -count++; -if (count > 100) + + +ListNode *ListFindNamedItem(ListNode *Head, const char *Name) { - OrderedListAddJump(Start, Curr); - count=0; - Start=Curr->Next; -} + ListNode *Node; + int result; -Prev=Curr; -Curr=Curr->Next; + Node=ListFindNamedItemInsert(Head, Name); + if ((! Node) || (Node==Head) || (! Node->Tag)) return(NULL); + if (Head->Flags & LIST_FLAG_CASE) result=strcmp(Node->Tag,Name); + else result=strcasecmp(Node->Tag,Name); + + if (result==0) + { + Node->Hits++; + return(Node); + } + return(NULL); } + +ListNode *OrderedListAddNamedItem(ListNode *Head, const char *Name, void *Item) +{ +ListNode *NewItem, *Prev; + +Prev=ListFindNamedItemInsert(Head, Name); NewItem=(ListNode *) calloc(1,sizeof(ListNode)); NewItem->Item=Item; NewItem->Prev=Prev; @@ -294,16 +372,7 @@ NewItem->Head=Prev->Head; if (NewItem->Next) NewItem->Next->Prev=NewItem; /* Next might be NULL! */ ListIncrNoOfItems(NewItem); if (StrLen(Name)) NewItem->Tag=CopyStr(NewItem->Tag,Name); - - -result=ListSize(NewItem); - -if ((result % 2000)==0) -{ -Curr=ListGetNth(Head,result / 2); -OrderedListAddJump(Head->Next, Curr); -} - +NewItem->Time=GetTime(TIME_CACHED); return(NewItem); } @@ -358,11 +427,13 @@ ListNode *Head; Head=ListGetHead(CurrItem); -if (! Head) return(NULL); +if (! Head) return(CurrItem); /* the dummy header has a 'Prev' entry that points to the last item! */ return(Head->Prev); } + + ListNode *ListGetNth(ListNode *Head, int n) { ListNode *Curr; @@ -473,11 +544,16 @@ ListNode *Head, *Prev, *Next; if (! Item1) return; if (! Item2) return; +Head=ListGetHead(Item1); +if (Head==Item1) return; +if (Head==Item2) return; + Prev=Item1->Prev; Next=Item2->Next; -Head=ListGetHead(Item1); if (Head->Next==Item1) Head->Next=Item2; +if (Head->Prev==Item1) Head->Prev=Item2; + if (Prev) Prev->Next=Item2; Item1->Prev=Item2; Item1->Next=Next; @@ -545,26 +621,6 @@ while (! sorted) } -ListNode *ListFindNamedItem(ListNode *Head, const char *Name) -{ -ListNode *Curr; -int result; - -if (! StrLen(Name)) return(NULL); -Curr=ListGetNext(Head); -while (Curr) -{ - if (Curr->Jump) - { - result=strcasecmp(Curr->Jump->Tag,Name); - if (result < 0) Curr=Curr->Jump; - } - if (Curr->Tag && (strcasecmp(Curr->Tag,Name)==0)) return(Curr); - Curr=ListGetNext(Curr); -} -return(Curr); -} - @@ -576,8 +632,12 @@ if (! Item) return(NULL); Curr=ListGetNext(Head); while (Curr) { - if (Curr->Item==Item) return(Curr); - Curr=ListGetNext(Curr); + if (Curr->Item==Item) + { + if (Head->Flags & LIST_FLAG_SELFORG) ListSwapItems(Curr->Prev, Curr); + return(Curr); + } + Curr=ListGetNext(Curr); } return(Curr); } @@ -585,39 +645,21 @@ return(Curr); void *ListDeleteNode(ListNode *Node) { -ListNode *Prev, *Next, *Curr; +ListNode *Head, *Prev, *Next; void *Contents; -int result; if (Node==NULL) { return(NULL); } -Curr=Node->Head; -if (Curr) Curr=Curr->Next; -while (Curr) -{ -if (Curr->Jump) -{ - if (Curr->Jump==Node) Curr->Jump=NULL; - /* - if (strcmp(Curr->Jump->Tag,Node->Tag) > -1) - { - Curr=Curr->Jump; - continue; - } - */ -} - -Curr=ListGetNext(Curr); -} - +Head=ListGetHead(Node); Prev=Node->Prev; Next=Node->Next; if (Prev !=NULL) Prev->Next=Next; if (Next !=NULL) Next->Prev=Prev; - +if (Head->Next==Node) Head->Next=Next; +if (Head->Prev==Node) Head->Prev=Prev; Contents=Node->Item; @@ -634,6 +676,8 @@ ListNode *Node; Node=ListFindItem(Head, Item); if (Node) ListDeleteNode(Node); + +return(NULL); } diff --git a/libUseful-2.0/list.h b/libUseful-2.4/list.h similarity index 69% rename from libUseful-2.0/list.h rename to libUseful-2.4/list.h index 975b470..d2195eb 100644 --- a/libUseful-2.0/list.h +++ b/libUseful-2.4/list.h @@ -2,17 +2,40 @@ #define LIB_USEFUL_LIST #define LIST_FLAG_DELETE 1 +#define LIST_FLAG_CASE 2 +#define LIST_FLAG_SELFORG 4 +#define LIST_FLAG_ORDERED 8 +#define LIST_FLAG_CACHE 16 +#define LIST_FLAG_TIMEOUT 32 +#define LIST_FLAG_DEBUG 8192 + +#define LIST_FLAG_USER1 1048576 +#define LIST_FLAG_USER2 2097152 +#define LIST_FLAG_USER3 4194304 +#define LIST_FLAG_USER4 8388608 +#define LIST_FLAG_USER5 16777216 +#define LIST_FLAG_USER6 33554432 +#define LIST_FLAG_USER7 67108864 +#define LIST_FLAG_USER8 134217728 +#define LIST_FLAG_USER0 268435456 +#define LIST_FLAG_USERA 536870912 +#define LIST_FLAG_USERB 1073741824 +#define LIST_FLAG_USERC 2147483648 +#define LIST_FLAG_USERD 4294967296 + typedef struct lnode { -int ItemType; -int Flags; +unsigned int ItemType; +unsigned int Flags; char *Tag; void *Item; struct lnode *Head; struct lnode *Jump; struct lnode *Prev; struct lnode *Next; +unsigned int Hits; +time_t Time; } ListNode; @@ -20,10 +43,14 @@ struct lnode *Next; extern "C" { #endif + typedef void (*LIST_ITEM_DESTROY_FUNC)(void *); typedef void *(*LIST_ITEM_CLONE_FUNC)(void *); + ListNode *ListCreate(); +void ListSetFlags(ListNode *List, int Flags); + void *IndexArrayOnList(ListNode *); void *AddItemToArray(void *Array,int size, void *Item); void *DeleteItemFromArray(void *Array,int size, int ItemNo); @@ -41,6 +68,7 @@ ListNode *ListGetPrev(ListNode *); ListNode *ListGetHead(ListNode *); ListNode *ListGetLast(ListNode *); ListNode *ListGetNth(ListNode *Head, int n); +ListNode *ListFindNamedItemInsert(ListNode *Head, const char *Name); ListNode *ListFindNamedItem(ListNode *Head, const char *Name); ListNode *ListFindItem(ListNode *Head, void *Item); ListNode *ListJoin(ListNode *, ListNode *); diff --git a/libUseful-2.4/list.o b/libUseful-2.4/list.o new file mode 100644 index 0000000..b63ddf3 Binary files /dev/null and b/libUseful-2.4/list.o differ diff --git a/libUseful-2.0/md5-global.h b/libUseful-2.4/md5-global.h similarity index 100% rename from libUseful-2.0/md5-global.h rename to libUseful-2.4/md5-global.h diff --git a/libUseful-2.4/md5.h b/libUseful-2.4/md5.h new file mode 100644 index 0000000..e810f03 --- /dev/null +++ b/libUseful-2.4/md5.h @@ -0,0 +1,27 @@ +#ifndef MD5_H +#define MD5_H +#ifndef HEADER_MD5_H +/* Try to avoid clashes with OpenSSL */ +#define HEADER_MD5_H +#endif + +#include + +struct MD5Context { + uint32_t buf[4]; + uint32_t bits[2]; + unsigned char in[64]; +}; + +void MD5Init(struct MD5Context *context); +void MD5Update(struct MD5Context *context, unsigned char const *buf, + unsigned len); +void MD5Final(unsigned char digest[16], struct MD5Context *context); +void MD5Transform(uint32_t buf[4], uint32_t const in[16]); + +/* + * This is needed to make RSAREF happy on some MS-DOS compilers. + */ +typedef struct MD5Context MD5_CTX; + +#endif /* !MD5_H */ diff --git a/libUseful-2.4/md5c.c b/libUseful-2.4/md5c.c new file mode 100644 index 0000000..ada7ac5 --- /dev/null +++ b/libUseful-2.4/md5c.c @@ -0,0 +1,248 @@ +/* This MD5 implmentation is taken from fetchmail, and is declared as + in the public domain in the COPYING file that comes with fetchmail +*/ + + +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + */ + +#include "md5.h" +#ifdef HAVE_STRING_H +#include /* memmove */ +#endif + +/* + * Note: this code is harmless on little-endian machines. + */ +static void byteReverse(unsigned char *buf, unsigned longs) +{ + uint32_t t; + do { + t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | + ((unsigned) buf[1] << 8 | buf[0]); + *(uint32_t *) buf = t; + buf += 4; + } while (--longs); +} + +/* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +void MD5Init(struct MD5Context *ctx) +{ + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; + + ctx->bits[0] = 0; + ctx->bits[1] = 0; +} + +/* + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) +{ + register uint32_t t; + + /* Update bitcount */ + + t = ctx->bits[0]; + if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) + ctx->bits[1]++; /* Carry from low to high */ + ctx->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ + + /* Handle any leading odd-sized chunks */ + + if (t) { + unsigned char *p = (unsigned char *) ctx->in + t; + + t = 64 - t; + if (len < t) { + memmove(p, buf, len); + return; + } + memmove(p, buf, t); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + buf += t; + len -= t; + } + /* Process data in 64-byte chunks */ + + while (len >= 64) { + memmove(ctx->in, buf, 64); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + buf += 64; + len -= 64; + } + + /* Handle any remaining bytes of data. */ + + memmove(ctx->in, buf, len); +} + +/* + * Final wrapup - pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) + */ +void MD5Final(unsigned char digest[16], struct MD5Context *ctx) +{ + unsigned int count; + unsigned char *p; + + /* Compute number of bytes mod 64 */ + count = (ctx->bits[0] >> 3) & 0x3F; + + /* Set the first char of padding to 0x80. This is safe since there is + always at least one byte free */ + p = ctx->in + count; + *p++ = 0x80; + + /* Bytes of padding needed to make 64 bytes */ + count = 64 - 1 - count; + + /* Pad out to 56 mod 64 */ + if (count < 8) { + /* Two lots of padding: Pad the first block to 64 bytes */ + memset(p, 0, count); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + + /* Now fill the next block with 56 bytes */ + memset(ctx->in, 0, 56); + } else { + /* Pad block to 56 bytes */ + memset(p, 0, count - 8); + } + byteReverse(ctx->in, 14); + + /* Append length in bits and transform */ + ((uint32_t *) ctx->in)[14] = ctx->bits[0]; + ((uint32_t *) ctx->in)[15] = ctx->bits[1]; + + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + byteReverse((unsigned char *) ctx->buf, 4); + memmove(digest, ctx->buf, 16); + memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ +} + +/* The four core functions - F1 is optimized somewhat */ + +/* #define F1(x, y, z) (x & y | ~x & z) */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +/* This is the central step in the MD5 algorithm. */ +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +void MD5Transform(uint32_t buf[4], uint32_t const in[16]) +{ + register uint32_t a, b, c, d; + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} diff --git a/libUseful-2.4/md5c.o b/libUseful-2.4/md5c.o new file mode 100644 index 0000000..ac064b7 Binary files /dev/null and b/libUseful-2.4/md5c.o differ diff --git a/libUseful-2.4/mmap.c b/libUseful-2.4/mmap.c new file mode 100644 index 0000000..18afdb3 --- /dev/null +++ b/libUseful-2.4/mmap.c @@ -0,0 +1,17 @@ +#include "libUseful.h" + +main() +{ +STREAM *S; +char *Tempstr=NULL; + +S=STREAMOpenFile("/etc/services",SF_RDONLY | SF_MMAP); +Tempstr=STREAMReadLine(Tempstr, S); +while (Tempstr) +{ +printf("%s",Tempstr); +Tempstr=STREAMReadLine(Tempstr, S); +} + +DestroyString(Tempstr); +} diff --git a/libUseful-2.4/mmap.exe b/libUseful-2.4/mmap.exe new file mode 100755 index 0000000..19ccc34 Binary files /dev/null and b/libUseful-2.4/mmap.exe differ diff --git a/libUseful-2.0/oauth.c b/libUseful-2.4/oauth.c similarity index 93% rename from libUseful-2.0/oauth.c rename to libUseful-2.4/oauth.c index 86421cd..a6a84dc 100644 --- a/libUseful-2.0/oauth.c +++ b/libUseful-2.4/oauth.c @@ -1,5 +1,6 @@ #include "oauth.h" #include "http.h" +#include "Markup.h" void ParseTagData(char *TagName,char *TagData,char **RType,char **RName,char **RValue) { @@ -105,7 +106,7 @@ Tempstr=MCopyStr(Tempstr,LoginURL,"?client_id=",Encode,NULL); Encode=HTTPQuote(Encode,Scope); Tempstr=MCatStr(Tempstr,"&scope=",Encode,NULL); -S=HTTPMethod("POST",Tempstr,"",""); +S=HTTPMethod("POST",Tempstr,"","","","",0); if (S) { @@ -149,7 +150,7 @@ Tempstr=MCatStr(Tempstr,"&client_secret=",Encode,NULL); Tempstr=MCatStr(Tempstr,"&code=",DeviceCode,NULL); Tempstr=MCatStr(Tempstr,"&grant_type=","http://oauth.net/grant_type/device/1.0",NULL); -S=HTTPMethod("POST",Tempstr,"",""); +S=HTTPMethod("POST",Tempstr,"","","","",0); if (S) { Tempstr=STREAMReadLine(Tempstr,S); @@ -172,7 +173,7 @@ DestroyString(Encode); -void OAuthDeviceRefreshToken(char *TokenURL, char *ClientID, char *ClientSecret, char *RefreshToken, char **AccessToken) +void OAuthDeviceRefreshToken(char *TokenURL, char *ClientID, char *ClientSecret, char *RequestRefreshToken, char **AccessToken, char **RefreshToken) { char *Tempstr=NULL, *Encode=NULL; ListNode *Vars=NULL; @@ -182,10 +183,10 @@ Vars=ListCreate(); Tempstr=MCopyStr(Tempstr,TokenURL,"?client_id=",ClientID,NULL); Tempstr=MCatStr(Tempstr,"&client_secret=",ClientSecret,NULL); -Tempstr=MCatStr(Tempstr,"&refresh_token=",RefreshToken,NULL); +Tempstr=MCatStr(Tempstr,"&refresh_token=",RequestRefreshToken,NULL); Tempstr=MCatStr(Tempstr,"&grant_type=","refresh_token",NULL); -S=HTTPMethod("POST",Tempstr,"",""); +S=HTTPMethod("POST",Tempstr,"","","","",0); if (S) { Tempstr=STREAMReadLine(Tempstr,S); @@ -199,7 +200,7 @@ Tempstr=STREAMReadLine(Tempstr,S); } *AccessToken=CopyStr(*AccessToken,GetVar(Vars,"access_token")); -//*RefreshToken=CopyStr(*RefreshToken,GetVar(Vars,"refresh_token")); +*RefreshToken=CopyStr(*RefreshToken,GetVar(Vars,"refresh_token")); ListDestroy(Vars,DestroyString); DestroyString(Tempstr); @@ -237,14 +238,14 @@ Tempstr=MCatStr(Tempstr,"&code=",AuthCode,NULL); Tempstr=MCatStr(Tempstr,"&redirect_uri=",RedirectURL,NULL); Tempstr=MCatStr(Tempstr,"&grant_type=","authorization_code",NULL); -S=HTTPMethod("POST",Tempstr,"",""); +S=HTTPMethod("POST",Tempstr,"","","","",0); if (S) { Tempstr=STREAMReadLine(Tempstr,S); while (Tempstr) { StripTrailingWhitespace(Tempstr); -printf("OA: %s\n",Tempstr); +fprintf(stderr,"OA: %s\n",Tempstr); OAuthParseJSON(Tempstr, Vars); Tempstr=STREAMReadLine(Tempstr,S); } diff --git a/libUseful-2.0/oauth.h b/libUseful-2.4/oauth.h similarity index 87% rename from libUseful-2.0/oauth.h rename to libUseful-2.4/oauth.h index 652a3f4..58ad8eb 100644 --- a/libUseful-2.0/oauth.h +++ b/libUseful-2.4/oauth.h @@ -5,9 +5,11 @@ extern "C" { #endif +#include "includes.h" + void OAuthDeviceLogin(char *LoginURL, char *ClientID, char *Scope, char **DeviceCode, char **UserCode, char **NextURL); void OAuthDeviceGetAccessToken(char *TokenURL, char *ClientID, char *ClientSecret, char *DeviceCode, char **AccessToken, char **RefreshToken); -void OAuthDeviceRefreshToken(char *TokenURL, char *ClientID, char *ClientSecret, char *RefreshToken, char **AccessToken); +void OAuthDeviceRefreshToken(char *TokenURL, char *ClientID, char *ClientSecret, char *RequestRefreshToken, char **AccessToken, char **RefreshToken); void OAuthInstalledAppURL(char *LoginURL, char *ClientID, char *Scope, char *RedirectURL, char **NextURL); void OAuthInstalledAppGetAccessToken(char *TokenURL, char *ClientID, char *ClientSecret, char *AuthCode, char *RedirectURL, char **AccessToken, char **RefreshToken); diff --git a/libUseful-2.4/oauth.o b/libUseful-2.4/oauth.o new file mode 100644 index 0000000..35194f5 Binary files /dev/null and b/libUseful-2.4/oauth.o differ diff --git a/libUseful-2.4/openssl.c b/libUseful-2.4/openssl.c new file mode 100644 index 0000000..87397d3 --- /dev/null +++ b/libUseful-2.4/openssl.c @@ -0,0 +1,517 @@ +#include "includes.h" +#include "Tokenizer.h" + +#include +#include +#include + +#ifdef HAVE_LIBSSL +#include +#include +#include +#include +#include +#include + +DH *CachedDH=NULL; + + + +void OpenSSLReseedRandom() +{ +int len=32; +char *Tempstr=NULL; + + +len=GenerateRandomBytes(&Tempstr, len, ENCODE_NONE); +RAND_seed(Tempstr,len); +memset(Tempstr,0,len); //extra paranoid step, don't keep those bytes in memory! + +DestroyString(Tempstr); +} + + + +void OpenSSLGenerateDHParams() +{ + CachedDH = DH_new(); + if(CachedDH) + { + OpenSSLReseedRandom(); + DH_generate_parameters_ex(CachedDH, 512, DH_GENERATOR_5, 0); + //DH_check(CachedDH, &codes); + } +} + + + + + + + + +void STREAM_INTERNAL_SSL_ADD_SECURE_KEYS(STREAM *S, SSL_CTX *ctx) +{ +ListNode *Curr; +char *VerifyFile=NULL, *VerifyPath=NULL; + +Curr=ListGetNext(LibUsefulValuesGetHead()); +while (Curr) +{ + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_CERT_FILE:",14)==0)) + { + SSL_CTX_use_certificate_chain_file(ctx,(char *) Curr->Item); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_KEY_FILE:",13)==0)) + { + SSL_CTX_use_PrivateKey_file(ctx,(char *) Curr->Item,SSL_FILETYPE_PEM); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTDIR",18)==0)) + { + VerifyPath=CopyStr(VerifyPath,(char *) Curr->Item); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTFILE",19)==0)) + { + VerifyFile=CopyStr(VerifyFile,(char *) Curr->Item); + } + + Curr=ListGetNext(Curr); +} + + +Curr=ListGetNext(S->Values); +while (Curr) +{ + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_CERT_FILE:",14)==0)) + { + SSL_CTX_use_certificate_chain_file(ctx,(char *) Curr->Item); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_KEY_FILE:",13)==0)) + { + SSL_CTX_use_PrivateKey_file(ctx,(char *) Curr->Item,SSL_FILETYPE_PEM); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTDIR",18)==0)) + { + VerifyPath=CopyStr(VerifyPath,(char *) Curr->Item); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTFILE",19)==0)) + { + VerifyFile=CopyStr(VerifyFile,(char *) Curr->Item); + } + + + Curr=ListGetNext(Curr); +} + + +SSL_CTX_load_verify_locations(ctx,VerifyFile,VerifyPath); + +DestroyString(VerifyFile); +DestroyString(VerifyPath); + +} +#endif + + +void HandleSSLError() +{ +#ifdef HAVE_LIBSSL +int val; + + val=ERR_get_error(); + fprintf(stderr,"Failed to create SSL_CTX: %s\n",ERR_error_string(val,NULL)); + fflush(NULL); +#endif +} + + +int INTERNAL_SSL_INIT() +{ +#ifdef HAVE_LIBSSL +char *Tempstr=NULL; +static int InitDone=FALSE; + +//Always reseed RAND on a new connection +//OpenSSLReseedRandom(); + +if (InitDone) return(TRUE); + + SSL_library_init(); +#ifdef USE_OPENSSL_ADD_ALL_ALGORITHMS + OpenSSL_add_all_algorithms(); +#endif + SSL_load_error_strings(); + Tempstr=MCopyStr(Tempstr,SSLeay_version(SSLEAY_VERSION)," : ", SSLeay_version(SSLEAY_BUILT_ON), " : ",SSLeay_version(SSLEAY_CFLAGS),NULL); + LibUsefulSetValue("SSL-Library", Tempstr); + LibUsefulSetValue("SSL-Level", "tls"); + DestroyString(Tempstr); + InitDone=TRUE; + return(TRUE); +#endif + +return(FALSE); +} + + +int SSLAvailable() +{ + return(INTERNAL_SSL_INIT()); +} + +const char *OpenSSLQueryCipher(STREAM *S) +{ +void *ptr; + +if (! S) return(NULL); +ptr=STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"); +if (! ptr) return(NULL); + +#ifdef HAVE_LIBSSL +const SSL_CIPHER *Cipher; +char *Tempstr=NULL; + +Cipher=SSL_get_current_cipher((const SSL *) ptr); + +if (Cipher) +{ +Tempstr=FormatStr(Tempstr,"%d",SSL_CIPHER_get_bits(Cipher,NULL)); +STREAMSetValue(S,"SSL-Bits",Tempstr); +Tempstr=FormatStr(Tempstr,"%s",SSL_CIPHER_get_name(Cipher)); +STREAMSetValue(S,"SSL-Cipher",Tempstr); + +Tempstr=SetStrLen(Tempstr,1024); +Tempstr=SSL_CIPHER_description(Cipher, Tempstr, 1024); + + +STREAMSetValue(S,"SSL-Cipher-Details",Tempstr); +} + +DestroyString(Tempstr); +return(STREAMGetValue(S,"SSL-Cipher")); + +#else +return(NULL); +#endif +} + + +#ifdef HAVE_LIBSSL +int OpenSSLVerifyCallback(int PreverifyStatus, X509_STORE_CTX *X509) +{ +//This does nothing. verification is done in 'OpenSSLVerifyCertificate' instead +return(1); +} +#endif + +int OpenSSLVerifyCertificate(STREAM *S) +{ +int RetVal=FALSE; +#ifdef HAVE_LIBSSL +char *Name=NULL, *Value=NULL, *ptr; +int val; +X509 *cert=NULL; +SSL *ssl; + +ptr=STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"); +if (! ptr) return(FALSE); + +ssl=(SSL *) ptr; + +cert=SSL_get_peer_certificate(ssl); +if (cert) +{ + STREAMSetValue(S,"SSL-Certificate-Issuer",X509_NAME_oneline( X509_get_issuer_name(cert),NULL, 0)); + ptr=X509_NAME_oneline( X509_get_subject_name(cert),NULL, 0); + STREAMSetValue(S,"SSL-Certificate-Subject", ptr); + + ptr=GetNameValuePair(ptr,"/","=",&Name,&Value); + while (ptr) + { + if (StrLen(Name) && (strcmp(Name,"CN")==0)) STREAMSetValue(S,"SSL-Certificate-CommonName",Value); + ptr=GetNameValuePair(ptr,"/","=",&Name,&Value); + } + + val=SSL_get_verify_result(ssl); + + switch(val) + { + case X509_V_OK: STREAMSetValue(S,"SSL-Certificate-Verify","OK"); RetVal=TRUE; break; + case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: STREAMSetValue(S,"SSL-Certificate-Verify","unable to get issuer"); break; + case X509_V_ERR_UNABLE_TO_GET_CRL: STREAMSetValue(S,"SSL-Certificate-Verify","unable to get certificate CRL"); break; + case X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: STREAMSetValue(S,"SSL-Certificate-Verify","unable to decrypt certificate's signature"); break; + case X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: STREAMSetValue(S,"SSL-Certificate-Verify","unable to decrypt CRL's signature"); break; + case X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: STREAMSetValue(S,"SSL-Certificate-Verify","unable to decode issuer public key"); break; + case X509_V_ERR_CERT_SIGNATURE_FAILURE: STREAMSetValue(S,"SSL-Certificate-Verify","certificate signature invalid"); break; + case X509_V_ERR_CRL_SIGNATURE_FAILURE: STREAMSetValue(S,"SSL-Certificate-Verify","CRL signature invalid"); break; + case X509_V_ERR_CERT_NOT_YET_VALID: STREAMSetValue(S,"SSL-Certificate-Verify","certificate is not yet valid"); break; + case X509_V_ERR_CERT_HAS_EXPIRED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate has expired"); break; + case X509_V_ERR_CRL_NOT_YET_VALID: STREAMSetValue(S,"SSL-Certificate-Verify","CRL is not yet valid the CRL is not yet valid."); break; + case X509_V_ERR_CRL_HAS_EXPIRED: STREAMSetValue(S,"SSL-Certificate-Verify","CRL has expired the CRL has expired."); break; + case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid notBefore value"); break; + case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid notAfter value"); break; + case X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid CRL lastUpdate value"); break; + case X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid CRL nextUpdate value"); break; + case X509_V_ERR_OUT_OF_MEM: STREAMSetValue(S,"SSL-Certificate-Verify","out of memory"); break; + case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: STREAMSetValue(S,"SSL-Certificate-Verify","self signed certificate"); break; + case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: STREAMSetValue(S,"SSL-Certificate-Verify","self signed certificate in certificate chain"); break; + case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: STREAMSetValue(S,"SSL-Certificate-Verify","cant find root certificate in local database"); break; + case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: STREAMSetValue(S,"SSL-Certificate-Verify","ERROR: unable to verify the first certificate"); break; + case X509_V_ERR_CERT_CHAIN_TOO_LONG: STREAMSetValue(S,"SSL-Certificate-Verify","certificate chain too long"); break; + case X509_V_ERR_CERT_REVOKED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate revoked"); break; + case X509_V_ERR_INVALID_CA: STREAMSetValue(S,"SSL-Certificate-Verify","invalid CA certificate"); break; + case X509_V_ERR_PATH_LENGTH_EXCEEDED: STREAMSetValue(S,"SSL-Certificate-Verify","path length constraint exceeded"); break; + case X509_V_ERR_INVALID_PURPOSE: STREAMSetValue(S,"SSL-Certificate-Verify","unsupported certificate purpose"); break; + case X509_V_ERR_CERT_UNTRUSTED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate not trusted"); break; + case X509_V_ERR_CERT_REJECTED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate rejected"); break; + case X509_V_ERR_SUBJECT_ISSUER_MISMATCH: STREAMSetValue(S,"SSL-Certificate-Verify","subject issuer mismatch"); break; + case X509_V_ERR_AKID_SKID_MISMATCH: STREAMSetValue(S,"SSL-Certificate-Verify","authority and subject key identifier mismatch"); break; + case X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: STREAMSetValue(S,"SSL-Certificate-Verify","authority and issuer serial number mismatch"); break; + case X509_V_ERR_KEYUSAGE_NO_CERTSIGN: STREAMSetValue(S,"SSL-Certificate-Verify","key usage does not include certificate signing"); break; + case X509_V_ERR_APPLICATION_VERIFICATION: STREAMSetValue(S,"SSL-Certificate-Verify","application verification failure"); break; + } +} +else +{ + STREAMSetValue(S,"SSL-Certificate-Verify","no certificate"); +} + + +DestroyString(Name); +DestroyString(Value); + +#endif + +return(RetVal); +} + + + + +int DoSSLClientNegotiation(STREAM *S, int Flags) +{ +int result=FALSE, Options=0; +#ifdef HAVE_LIBSSL +const SSL_METHOD *Method; +SSL_CTX *ctx; +SSL *ssl; +//struct x509 *cert=NULL; +char *ptr; + +if (S) +{ + INTERNAL_SSL_INIT(); + // SSL_load_ciphers(); + Method=SSLv23_client_method(); + ctx=SSL_CTX_new(Method); + if (! ctx) HandleSSLError(); + else + { + STREAM_INTERNAL_SSL_ADD_SECURE_KEYS(S,ctx); + SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, OpenSSLVerifyCallback); + ssl=SSL_new(ctx); + SSL_set_fd(ssl,S->in_fd); + STREAMSetItem(S,"LIBUSEFUL-SSL-CTX",ssl); + + Options=SSL_OP_SINGLE_DH_USE | SSL_OP_NO_SSLv2; + ptr=STREAMGetValue(S,"SSL-Level"); + if (! StrLen(ptr)) ptr=LibUsefulGetValue("SSL-Level"); + + if (StrLen(ptr)) + { + if (strncasecmp(ptr,"ssl",3)==0) Options &= ~(SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1); + if (strncasecmp(ptr,"tls",3)==0) Options |=SSL_OP_NO_SSLv3; + if (strcasecmp(ptr,"tls1.1")==0) Options |=SSL_OP_NO_TLSv1; + if (strcasecmp(ptr,"tls1.2")==0) Options |=SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1; + } + + SSL_set_options(ssl, Options); + ptr=LibUsefulGetValue("SSL-Permitted-Ciphers"); + if (ptr) SSL_set_cipher_list(ssl, ptr); + result=SSL_connect(ssl); + while (result==-1) + { + result=SSL_get_error(ssl, result); + if ( (result!=SSL_ERROR_WANT_READ) && (result != SSL_ERROR_WANT_WRITE) ) break; + usleep(300); + result=SSL_connect(ssl); + } + S->State |= SS_SSL; + + OpenSSLQueryCipher(S); + OpenSSLVerifyCertificate(S); + } +} + +#endif +return(result); +} + + +#ifdef HAVE_LIBSSL +void OpenSSLSetupECDH(SSL_CTX *ctx) +{ +EC_KEY* ecdh; + +ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); +//ecdh = EC_KEY_new_by_curve_name( NID_secp384r1); + +{ + SSL_CTX_set_tmp_ecdh(ctx, ecdh); + EC_KEY_free(ecdh); +} + +} + + + +void OpenSSLSetupDH(SSL_CTX *ctx) +{ +char *Tempstr=NULL, *ptr; +DH *dh=NULL; +FILE *paramfile; + +if (CachedDH) dh=CachedDH; +else +{ + ptr=LibUsefulGetValue("SSL-DHParams-File"); + if (StrLen(ptr)) Tempstr=CopyStr(Tempstr,ptr); + + paramfile = fopen(Tempstr, "r"); + if (paramfile) + { + CachedDH = PEM_read_DHparams(paramfile, NULL, NULL, NULL); + dh=CachedDH; + fclose(paramfile); + } + + if (! dh) + { + //OpenSSLGenerateDHParams(); + dh=CachedDH; + } +} + +if (dh) SSL_CTX_set_tmp_dh(ctx, dh); + +//Don't free these parameters, as they are cached +//DH_KEY_free(dh); + +DestroyString(Tempstr); +} +#endif + + + + +int DoSSLServerNegotiation(STREAM *S, int Flags) +{ +int result=FALSE, Options=0; +#ifdef HAVE_LIBSSL +const SSL_METHOD *Method; +SSL_CTX *ctx; +SSL *ssl; +char *ptr; + + +if (S) +{ + INTERNAL_SSL_INIT(); + Method=SSLv23_server_method(); + if (Method) + { + ctx=SSL_CTX_new(Method); + + if (ctx) + { + STREAM_INTERNAL_SSL_ADD_SECURE_KEYS(S,ctx); + if (Flags & LU_SSL_PFS) + { + OpenSSLSetupDH(ctx); + OpenSSLSetupECDH(ctx); + } + if (Flags & LU_SSL_VERIFY_PEER) + { + SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, OpenSSLVerifyCallback); + SSL_CTX_set_verify_depth(ctx,1); + } + SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); + ssl=SSL_new(ctx); + + Options=SSL_OP_NO_SSLv2|SSL_OP_SINGLE_DH_USE|SSL_OP_CIPHER_SERVER_PREFERENCE; + ptr=STREAMGetValue(S,"SSL-Level"); + if (! StrLen(ptr)) ptr=LibUsefulGetValue("SSL-Level"); + + if (StrLen(ptr)) + { + if (strncasecmp(ptr,"ssl",3)==0) Options &= ~(SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1); + if (strncasecmp(ptr,"tls",3)==0) Options |=SSL_OP_NO_SSLv3; + if (strcasecmp(ptr,"tls1.1")==0) Options |=SSL_OP_NO_TLSv1; + if (strcasecmp(ptr,"tls1.2")==0) Options |=SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1; + } + + SSL_set_options(ssl, Options); + SSL_set_fd(ssl,S->in_fd); + STREAMSetItem(S,"LIBUSEFUL-SSL-CTX",ssl); + ptr=LibUsefulGetValue("SSL-Permitted-Ciphers"); + if (ptr) SSL_set_cipher_list(ssl, ptr); + SSL_set_accept_state(ssl); + + while (1) + { + result=SSL_accept(ssl); + if (result != TRUE) result=SSL_get_error(ssl,result); + switch (result) + { + case SSL_ERROR_WANT_READ: + case SSL_ERROR_WANT_WRITE: + usleep(300); + result=-1; + break; + + case TRUE: + S->State |= SS_SSL; + if (Flags & SSL_VERIFY_PEER) OpenSSLVerifyCertificate(S); + OpenSSLQueryCipher(S); + break; + + default: + result=ERR_get_error(); + STREAMSetValue(S, "SSL-Error", ERR_error_string(result,NULL)); + result=FALSE; + break; + } + if (result !=-1) break; + } + } + } +} + +#endif +return(result); +} + + + +int STREAMIsPeerAuth(STREAM *S) +{ +#ifdef HAVE_LIBSSL +void *ptr; + +ptr=STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"); +if (! ptr) return(FALSE); + +if (SSL_get_verify_result((SSL *) ptr)==X509_V_OK) +{ + if (SSL_get_peer_certificate((SSL *) ptr) !=NULL) return(TRUE); +} +#endif +return(FALSE); +} + + diff --git a/libUseful-2.4/openssl.h b/libUseful-2.4/openssl.h new file mode 100644 index 0000000..d23effd --- /dev/null +++ b/libUseful-2.4/openssl.h @@ -0,0 +1,16 @@ + +#ifndef LIBUSEFUL_OPENSSL_H +#define LIBUSEFUL_OPENSSL_H +#include "includes.h" + +#define LU_SSL_PFS 1 +#define LU_SSL_VERIFY_PEER 2 + +void OpenSSLGenerateDHParams(); +void HandleSSLError(); +int SSLAvailable(); +int DoSSLClientNegotiation(STREAM *S, int Flags); +int DoSSLServerNegotiation(STREAM *S, int Flags); +int STREAMIsPeerAuth(STREAM *S); + +#endif diff --git a/libUseful-2.4/openssl.o b/libUseful-2.4/openssl.o new file mode 100644 index 0000000..8ca4e78 Binary files /dev/null and b/libUseful-2.4/openssl.o differ diff --git a/libUseful-2.4/proctitle.c b/libUseful-2.4/proctitle.c new file mode 100644 index 0000000..3b1bca8 --- /dev/null +++ b/libUseful-2.4/proctitle.c @@ -0,0 +1,82 @@ +#include "proctitle.h" +#define __GNU_SOURCE +#include "errno.h" + +/*This is code to change the command-line of a program as visible in ps */ + +extern char **environ; +char *TitleBuffer=NULL; +int TitleLen=0; + + +void CopyEnv(const char *Env) +{ +char *tmp, *ptr; + + tmp=strdup(Env); + if (tmp) + { + ptr=strchr(tmp,'='); + if (ptr) + { + *ptr='\0'; + ptr++; + } + else ptr=NULL; + setenv(tmp,ptr,1); + free(tmp); + } +} + +//The command-line args that we've been passed (argv) will occupy a block of contiguous memory that +//contains these args and the environment strings. In order to change the command-line args we isolate +//this block of memory by iterating through all the strings in it, and making copies of them. The +//pointers in 'argv' and 'environ' are then redirected to these copies. Now we can overwrite the whole +//block of memory with our new command-line arguments. +void ProcessTitleCaptureBuffer(char **argv) +{ +char **arg, *end=NULL, *tmp; + +#ifdef __GNU_LIBRARY__ +extern char *program_invocation_name; +extern char *program_invocation_short_name; + +program_invocation_name=strdup(program_invocation_name); +program_invocation_short_name=strdup(program_invocation_short_name); +#endif + +TitleBuffer=argv[0]; +arg=argv; +while (*arg) +{ +for (end=*arg; *end != '\0'; end++) ; +*arg=strdup(*arg); +arg++; +} + +arg=environ; +//clearenv(); //clearenv is not portable +environ[0]=NULL; +while (*arg) +{ + for (end=*arg; *end != '\0'; end++); + CopyEnv(*arg); + arg++; +} + +TitleLen=end-TitleBuffer; +} + + +void ProcessSetTitle(char **argv, char *FmtStr, ...) +{ +va_list args; + + if (! TitleBuffer) ProcessTitleCaptureBuffer(argv); + memset(TitleBuffer,0,TitleLen); + + va_start(args,FmtStr); + vsnprintf(TitleBuffer,TitleLen,FmtStr,args); + va_end(args); +} + diff --git a/libUseful-2.4/proctitle.h b/libUseful-2.4/proctitle.h new file mode 100644 index 0000000..dcba88f --- /dev/null +++ b/libUseful-2.4/proctitle.h @@ -0,0 +1,8 @@ +#ifndef LIBUSEFUL_PROCTITLE_H +#define LIBUSEFUL_PROCTITLE_H + +#include "includes.h" + +void ProcessSetTitle(char **argv, char *FmtStr, ...); + +#endif diff --git a/libUseful-2.4/proctitle.o b/libUseful-2.4/proctitle.o new file mode 100644 index 0000000..8bebfb5 Binary files /dev/null and b/libUseful-2.4/proctitle.o differ diff --git a/libUseful-2.0/pty.c b/libUseful-2.4/pty.c similarity index 75% rename from libUseful-2.0/pty.c rename to libUseful-2.4/pty.c index b7f2002..9919cc5 100644 --- a/libUseful-2.0/pty.c +++ b/libUseful-2.4/pty.c @@ -1,27 +1,31 @@ -#include -#include -#include -#include +#define _XOPEN_SOURCE +#define _GNU_SOURCE + +#include "includes.h" #include "file.h" #include "GeneralFunctions.h" #include "string.h" #include "pty.h" +#include +#include +#include +#include +#include + ListNode *TTYAttribs=NULL; void HangUpLine(int tty) { -int result; struct termios tty_data, oldtty_data; -result=tcgetattr(tty,&oldtty_data); -result=tcgetattr(tty,&tty_data); -result=cfsetispeed(&tty_data,B0); -result=cfsetospeed(&tty_data,B0); - -result=tcsetattr(tty,TCSANOW,&tty_data); +tcgetattr(tty,&oldtty_data); +tcgetattr(tty,&tty_data); +cfsetispeed(&tty_data,B0); +cfsetospeed(&tty_data,B0); +tcsetattr(tty,TCSANOW,&tty_data); sleep(5); tcsetattr(tty,TCSANOW,&oldtty_data); } @@ -48,7 +52,7 @@ DestroyString(Tempstr); void InitTTY(int tty, int LineSpeed, int Flags) { struct termios tty_data, *old_tty_data; -int result, val; +int val; char *Tempstr=NULL; ListNode *Curr; @@ -65,7 +69,7 @@ else old_tty_data=(struct termios *) Curr->Item; tcgetattr(tty,old_tty_data); //tcgetattr(tty,&tty_data); -memset(&tty_data,0,sizeof(tty_data)); +memset(&tty_data,0,sizeof(struct termios)); //ignore break characters and parity errors tty_data.c_iflag=IGNBRK | IGNPAR; @@ -74,6 +78,7 @@ tty_data.c_iflag=IGNBRK | IGNPAR; if (! (Flags & TTYFLAG_CRLF_KEEP)) { //translate carriage-return to newline + if (Flags & TTYFLAG_CRLF) tty_data.c_iflag |= ICRNL; else tty_data.c_iflag &= ~ICRNL; @@ -165,7 +170,7 @@ cfsetospeed(&tty_data,val); } tcflush(tty,TCIFLUSH); -result=tcsetattr(tty,TCSANOW,&tty_data); +tcsetattr(tty,TCSANOW,&tty_data); DestroyString(Tempstr); } @@ -190,7 +195,7 @@ return(tty); int GrabPseudoTTY(int *pty, int *tty, int TermFlags) { char c1,c2; -char *Buffer=NULL; +char *Tempstr=NULL; //first try unix98 style *pty=open("/dev/ptmx",O_RDWR); @@ -198,12 +203,21 @@ if (*pty > -1) { grantpt(*pty); unlockpt(*pty); - if ( (*tty=open((char *) ptsname(*pty),O_RDWR)) >-1) + SetStrLen(Tempstr,100); +#ifdef HAVE_PTSNAME_R + if (ptsname_r(*pty,Tempstr,100) != 0) Tempstr=CopyStr(Tempstr,ptsname(*pty)); +#else + Tempstr=CopyStr(Tempstr,ptsname(*pty)); +#endif + if (StrLen(Tempstr)) { - InitTTY(*tty,0,TermFlags); - return(1); + if ( (*tty=open(Tempstr,O_RDWR)) >-1) + { + InitTTY(*tty,0,TermFlags); + return(1); + } } - + close(*pty); } //if unix98 fails, try old BSD style @@ -212,13 +226,13 @@ for (c1='p'; c1 < 's'; c1++) { for (c2='5'; c2 <='9'; c2++) { - Buffer=FormatStr(Buffer,"/dev/pty%c%c",c1,c2); - if ( (*pty=open(Buffer,O_RDWR)) >-1) + Tempstr=FormatStr(Tempstr,"/dev/pty%c%c",c1,c2); + if ( (*pty=open(Tempstr,O_RDWR)) >-1) { - Buffer=FormatStr(Buffer,"/dev/tty%c%c",c1,c2); - if ( (*tty=OpenTTY(Buffer,0,TermFlags)) >-1) + Tempstr=FormatStr(Tempstr,"/dev/tty%c%c",c1,c2); + if ( (*tty=OpenTTY(Tempstr,0,TermFlags)) >-1) { - DestroyString(Buffer); + DestroyString(Tempstr); return(1); } else close(*pty); @@ -228,8 +242,30 @@ for (c1='p'; c1 < 's'; c1++) } -DestroyString(Buffer); +DestroyString(Tempstr); return(0); } + +char *TTYReadSecret(char *RetStr, STREAM *S, int Flags) +{ +int len=0, inchar; + +//Turn off echo (and other things) +InitTTY(0,0, TTYFLAG_CRLF); +inchar=STREAMReadChar(S); +while (inchar != EOF) +{ + RetStr=AddCharToBuffer(RetStr,len++,inchar); + if (inchar=='\n') break; + if (Flags & TEXT_STARS) write(1,"*",1); + inchar=STREAMReadChar(S); +} +//turn echo back on +ResetTTY(0); +printf("\n"); + +return(RetStr); +} + diff --git a/libUseful-2.0/pty.h b/libUseful-2.4/pty.h similarity index 85% rename from libUseful-2.0/pty.h rename to libUseful-2.4/pty.h index 409be8e..82f22c0 100644 --- a/libUseful-2.0/pty.h +++ b/libUseful-2.4/pty.h @@ -13,6 +13,9 @@ #define TTYFLAG_CRLF_KEEP 32768 #define TTYFLAG_IGNSIG 65536 +#define TEXT_STARS 1 +#define TEXT_STAR_ONE 2 + #ifdef __cplusplus extern "C" { #endif @@ -22,6 +25,7 @@ int OpenTTY(char *devname, int LineSpeed, int Flags); void InitTTY(int tty, int LineSpeed, int Flags); void ResetTTY(int tty); int GrabPseudoTTY(int *pty, int *tty, int Flags); +char *TTYReadSecret(char *RetStr, STREAM *S, int Flags); #ifdef __cplusplus } diff --git a/libUseful-2.4/pty.o b/libUseful-2.4/pty.o new file mode 100644 index 0000000..b691d37 Binary files /dev/null and b/libUseful-2.4/pty.o differ diff --git a/libUseful-2.4/securemem.c b/libUseful-2.4/securemem.c new file mode 100644 index 0000000..f1de681 --- /dev/null +++ b/libUseful-2.4/securemem.c @@ -0,0 +1,184 @@ +#include "securemem.h" + +#include +#include +#include +#include +#include +#include "string.h" + +char *CredsStore=NULL; +int CredsStoreSize=0; +int CredsStoreUsed=0; + +void SecureClearMem(char *Mem, int Size) +{ +char *ptr; + + if (! Mem) return; + xmemset((volatile char *) Mem,0,Size); + for (ptr=Mem; ptr < (Mem + Size); ptr++) + { + if (*ptr != 0) + { + fprintf(stderr,"LIBUSEFUL ERROR: Failed to clear secure memory"); + exit(3); + } + } +} + + +void SecureDestroy(char *Mem, int Size) +{ + + if (! Mem) return; + SecureClearMem(Mem, Size); + munlock(Mem, Size); + free(Mem); +} + + +int SecureRealloc(char **OldMem, int OldSize, int NewSize, int Flags) +{ +int MemSize; +char *NewMem=NULL; +int val=0, PageSize; + +PageSize=getpagesize(); +MemSize=(NewSize / PageSize + 1) * PageSize; +if (OldMem && (NewSize < OldSize)) return(OldSize); + +if (posix_memalign((void **) &NewMem, PageSize, MemSize)==0) +{ + if (OldMem) + { + //both needed + mprotect(*OldMem, OldSize, PROT_READ|PROT_WRITE); + memcpy(NewMem,*OldMem,OldSize); + SecureDestroy(*OldMem, OldSize); + } + + + #ifdef HAVE_MADVISE + + #ifdef MADV_NOFORK + if (Flags & SMEM_NOFORK) madvise(NewMem,NewSize,MADV_DONTFORK); + #endif + + #ifdef MADV_DONTDUMP + if (Flags & SMEM_NODUMP) madvise(NewMem,NewSize,MADV_DONTDUMP); + #endif + + #endif + + #ifdef HAVE_MLOCK + if (Flags & SMEM_LOCK) mlock(NewMem, NewSize); + #endif + + if (Flags & SMEM_NOACCESS) mprotect(NewMem, NewSize, PROT_NONE); + else if (Flags & SMEM_WRITEONLY) mprotect(NewMem, NewSize, PROT_WRITE); + else if (Flags & SMEM_READONLY) mprotect(NewMem, NewSize, PROT_READ); +} +else +{ + fprintf(stderr,"LIBUSEFUL ERROR: Failed to allocate secure memory"); + exit(3); +} + +*OldMem=NewMem; +return(NewSize); +} + + +char *CredsStoreWrite(char *Dest, const char *String, int len) +{ +uint16_t *plen; +char *ptr; + +ptr=Dest; +plen=(uint16_t *) ptr; +*plen=len; +ptr+=sizeof(uint16_t); +memcpy(ptr, String, len); +ptr+=len; +*ptr='\0'; +ptr++; +return(ptr); +} + + +char *CredsStoreGetSecret(const char *Realm, const char *User) +{ +uint16_t plen, rlen, ulen; +char *ptr, *end, *frealm, *fuser; + +rlen=StrLen(Realm); +ulen=StrLen(User); +ptr=CredsStore; +end=CredsStore + CredsStoreUsed; + +if (rlen && ulen) +{ +mprotect(CredsStore, CredsStoreSize, PROT_READ); +while (ptr < end) +{ + frealm=NULL; + fuser=NULL; + + plen=*(uint16_t *) ptr; + ptr+=sizeof(uint16_t); + if (plen == rlen) frealm=ptr; + ptr+=plen+1; + + plen=*(uint16_t *) ptr; + ptr+=sizeof(uint16_t); + if (plen == ulen) fuser=ptr; + ptr+=plen+1; + + plen=*(uint16_t *) ptr; + ptr+=sizeof(uint16_t); + if ( + (frealm && fuser) && + (strcmp(frealm,Realm)==0) && + (strcmp(fuser,User)==0) + ) + { + printf("FOUND %s\n",ptr); + return(ptr); + } + ptr+=plen+1; +} +} +mprotect(CredsStore, CredsStoreSize, PROT_NONE); + +return(NULL); +} + + +void CredsStoreAdd(const char *Realm, const char *User, const char *Secret) +{ +int len; +char *ptr; + +//Don't add if already exists +ptr=CredsStoreGetSecret(Realm, User); +if (ptr && (strcmp(Secret, ptr)==0)) +{ +mprotect(CredsStore, CredsStoreSize, PROT_NONE); +return; +} + +len=CredsStoreUsed+StrLen(Realm) + StrLen(User) + StrLen(Secret) + 100; +CredsStoreSize=SecureRealloc(&CredsStore, CredsStoreSize, len, SMEM_NOFORK | SMEM_NODUMP | SMEM_LOCK); + +mprotect(CredsStore, CredsStoreSize, PROT_WRITE); +ptr=CredsStoreWrite(CredsStore+CredsStoreUsed, Realm, StrLen(Realm)); +ptr=CredsStoreWrite(ptr, User, StrLen(User)); +ptr=CredsStoreWrite(ptr, Secret, StrLen(Secret)); +mprotect(CredsStore, CredsStoreSize, PROT_NONE); + +CredsStoreUsed=ptr-CredsStore; +} + + + diff --git a/libUseful-2.4/securemem.h b/libUseful-2.4/securemem.h new file mode 100644 index 0000000..a0acc9e --- /dev/null +++ b/libUseful-2.4/securemem.h @@ -0,0 +1,20 @@ +#ifndef LIBUSEFUL_SECUREMEM_H +#define LIBUSEFUL_SECUREMEM_H + +#define SMEM_LOCK 1 +#define SMEM_NODUMP 2 +#define SMEM_NOFORK 4 +#define SMEM_READONLY 8 +#define SMEM_WRITEONLY 16 +#define SMEM_NOACCESS 32 +#define SMEM_SECURE (SMEM_LOCK | SMEM_NOFORK | SMEM_NODUMP) +#define SMEM_PARANOID (SMEM_SECURE | SMEM_NOACCESS) + +void SecureClearMem(char *Mem, int Size); +void SecureDestroy(char *Mem, int Size); +int SecureRealloc(char **OldMem, int OldSize, int NewSize, int Flags); + +void CredsStoreAdd(const char *Realm, const char *User, const char *Secret); +char *CredsStoreGetSecret(const char *Realm, const char *User); + +#endif diff --git a/libUseful-2.4/securemem.o b/libUseful-2.4/securemem.o new file mode 100644 index 0000000..f53982e Binary files /dev/null and b/libUseful-2.4/securemem.o differ diff --git a/libUseful-2.0/sha1.c b/libUseful-2.4/sha1.c similarity index 100% rename from libUseful-2.0/sha1.c rename to libUseful-2.4/sha1.c diff --git a/libUseful-2.0/sha1.h b/libUseful-2.4/sha1.h similarity index 100% rename from libUseful-2.0/sha1.h rename to libUseful-2.4/sha1.h diff --git a/libUseful-2.4/sha1.o b/libUseful-2.4/sha1.o new file mode 100644 index 0000000..2b66482 Binary files /dev/null and b/libUseful-2.4/sha1.o differ diff --git a/libUseful-2.0/sha2.c b/libUseful-2.4/sha2.c similarity index 79% rename from libUseful-2.0/sha2.c rename to libUseful-2.4/sha2.c index fb42ade..005a8d4 100644 --- a/libUseful-2.0/sha2.c +++ b/libUseful-2.4/sha2.c @@ -119,9 +119,9 @@ typedef u_int64_t sha2_word64; /* Exactly 8 bytes */ /*** SHA-256/384/512 Various Length Definitions ***********************/ /* NOTE: Most of these are in sha2.h */ -#define SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8) -#define SHA384_SHORT_BLOCK_LENGTH (SHA384_BLOCK_LENGTH - 16) -#define SHA512_SHORT_BLOCK_LENGTH (SHA512_BLOCK_LENGTH - 16) +#define SHA2_SHA256_SHORT_BLOCK_LENGTH (SHA2_SHA256_BLOCK_LENGTH - 8) +#define SHA2_SHA384_SHORT_BLOCK_LENGTH (SHA2_SHA384_BLOCK_LENGTH - 16) +#define SHA2_SHA512_SHORT_BLOCK_LENGTH (SHA2_SHA512_BLOCK_LENGTH - 16) /*** ENDIAN REVERSAL MACROS *******************************************/ @@ -218,9 +218,9 @@ typedef u_int64_t sha2_word64; /* Exactly 8 bytes */ * library -- they are intended for private internal visibility/use * only. */ -void SHA512_Last(SHA512_CTX*); -void SHA256_Transform(SHA256_CTX*, const sha2_word32*); -void SHA512_Transform(SHA512_CTX*, const sha2_word64*); +void SHA2_SHA512_Last(SHA2_SHA512_CTX*); +void SHA2_SHA256_Transform(SHA2_SHA256_CTX*, const sha2_word32*); +void SHA2_SHA512_Transform(SHA2_SHA512_CTX*, const sha2_word64*); /*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/ @@ -332,12 +332,12 @@ static const char *sha2_hex_digits = "0123456789abcdef"; /*** SHA-256: *********************************************************/ -void SHA256_Init(SHA256_CTX* context) { - if (context == (SHA256_CTX*)0) { +void SHA2_SHA256_Init(SHA2_SHA256_CTX* context) { + if (context == (SHA2_SHA256_CTX*)0) { return; } - MEMCPY_BCOPY(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH); - MEMSET_BZERO(context->buffer, SHA256_BLOCK_LENGTH); + MEMCPY_BCOPY(context->state, sha256_initial_hash_value, SHA2_SHA256_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, SHA2_SHA256_BLOCK_LENGTH); context->bitcount = 0; } @@ -378,7 +378,7 @@ void SHA256_Init(SHA256_CTX* context) { (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ j++ -void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { +void SHA2_SHA256_Transform(SHA2_SHA256_CTX* context, const sha2_word32* data) { sha2_word32 a, b, c, d, e, f, g, h, s0, s1; sha2_word32 T1, *W256; int j; @@ -436,7 +436,7 @@ void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { #else /* SHA2_UNROLL_TRANSFORM */ -void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { +void SHA2_SHA256_Transform(SHA2_SHA256_CTX* context, const sha2_word32* data) { sha2_word32 a, b, c, d, e, f, g, h, s0, s1; sha2_word32 T1, T2, *W256; int j; @@ -516,7 +516,7 @@ void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { #endif /* SHA2_UNROLL_TRANSFORM */ -void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { +void SHA2_SHA256_Update(SHA2_SHA256_CTX* context, const sha2_byte *data, size_t len) { unsigned int freespace, usedspace; if (len == 0) { @@ -525,12 +525,12 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { } /* Sanity check: */ - assert(context != (SHA256_CTX*)0 && data != (sha2_byte*)0); + assert(context != (SHA2_SHA256_CTX*)0 && data != (sha2_byte*)0); - usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH; + usedspace = (context->bitcount >> 3) % SHA2_SHA256_BLOCK_LENGTH; if (usedspace > 0) { /* Calculate how much free space is available in the buffer */ - freespace = SHA256_BLOCK_LENGTH - usedspace; + freespace = SHA2_SHA256_BLOCK_LENGTH - usedspace; if (len >= freespace) { /* Fill the buffer completely and process it */ @@ -538,7 +538,7 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { context->bitcount += freespace << 3; len -= freespace; data += freespace; - SHA256_Transform(context, (sha2_word32*)context->buffer); + SHA2_SHA256_Transform(context, (sha2_word32*)context->buffer); } else { /* The buffer is not yet full */ MEMCPY_BCOPY(&context->buffer[usedspace], data, len); @@ -548,12 +548,12 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { return; } } - while (len >= SHA256_BLOCK_LENGTH) { + while (len >= SHA2_SHA256_BLOCK_LENGTH) { /* Process as many complete blocks as we can */ - SHA256_Transform(context, (sha2_word32*)data); - context->bitcount += SHA256_BLOCK_LENGTH << 3; - len -= SHA256_BLOCK_LENGTH; - data += SHA256_BLOCK_LENGTH; + SHA2_SHA256_Transform(context, (sha2_word32*)data); + context->bitcount += SHA2_SHA256_BLOCK_LENGTH << 3; + len -= SHA2_SHA256_BLOCK_LENGTH; + data += SHA2_SHA256_BLOCK_LENGTH; } if (len > 0) { /* There's left-overs, so save 'em */ @@ -564,16 +564,16 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { usedspace = freespace = 0; } -void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { +void SHA2_SHA256_Final(sha2_byte digest[], SHA2_SHA256_CTX* context) { sha2_word32 *d = (sha2_word32*)digest; unsigned int usedspace; /* Sanity check: */ - assert(context != (SHA256_CTX*)0); + assert(context != (SHA2_SHA256_CTX*)0); /* If no digest buffer is passed, we don't bother doing this: */ if (digest != (sha2_byte*)0) { - usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH; + usedspace = (context->bitcount >> 3) % SHA2_SHA256_BLOCK_LENGTH; #if BYTE_ORDER == LITTLE_ENDIAN /* Convert FROM host byte order */ REVERSE64(context->bitcount,context->bitcount); @@ -582,31 +582,31 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { /* Begin padding with a 1 bit: */ context->buffer[usedspace++] = 0x80; - if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) { + if (usedspace <= SHA2_SHA256_SHORT_BLOCK_LENGTH) { /* Set-up for the last transform: */ - MEMSET_BZERO(&context->buffer[usedspace], SHA256_SHORT_BLOCK_LENGTH - usedspace); + MEMSET_BZERO(&context->buffer[usedspace], SHA2_SHA256_SHORT_BLOCK_LENGTH - usedspace); } else { - if (usedspace < SHA256_BLOCK_LENGTH) { - MEMSET_BZERO(&context->buffer[usedspace], SHA256_BLOCK_LENGTH - usedspace); + if (usedspace < SHA2_SHA256_BLOCK_LENGTH) { + MEMSET_BZERO(&context->buffer[usedspace], SHA2_SHA256_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ - SHA256_Transform(context, (sha2_word32*)context->buffer); + SHA2_SHA256_Transform(context, (sha2_word32*)context->buffer); /* And set-up for the last transform: */ - MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH); + MEMSET_BZERO(context->buffer, SHA2_SHA256_SHORT_BLOCK_LENGTH); } } else { /* Set-up for the last transform: */ - MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH); + MEMSET_BZERO(context->buffer, SHA2_SHA256_SHORT_BLOCK_LENGTH); /* Begin padding with a 1 bit: */ *context->buffer = 0x80; } /* Set the bit count: */ - *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount; + *(sha2_word64*)&context->buffer[SHA2_SHA256_SHORT_BLOCK_LENGTH] = context->bitcount; /* Final transform: */ - SHA256_Transform(context, (sha2_word32*)context->buffer); + SHA2_SHA256_Transform(context, (sha2_word32*)context->buffer); #if BYTE_ORDER == LITTLE_ENDIAN { @@ -618,54 +618,54 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { } } #else - MEMCPY_BCOPY(d, context->state, SHA256_DIGEST_LENGTH); + MEMCPY_BCOPY(d, context->state, SHA2_SHA256_DIGEST_LENGTH); #endif } /* Clean up state data: */ - MEMSET_BZERO(context, sizeof(SHA256_CTX)); + MEMSET_BZERO(context, sizeof(SHA2_SHA256_CTX)); usedspace = 0; } -char *SHA256_End(SHA256_CTX* context, char buffer[]) { - sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest; +char *SHA2_SHA256_End(SHA2_SHA256_CTX* context, char buffer[]) { + sha2_byte digest[SHA2_SHA256_DIGEST_LENGTH], *d = digest; int i; /* Sanity check: */ - assert(context != (SHA256_CTX*)0); + assert(context != (SHA2_SHA256_CTX*)0); if (buffer != (char*)0) { - SHA256_Final(digest, context); + SHA2_SHA256_Final(digest, context); - for (i = 0; i < SHA256_DIGEST_LENGTH; i++) { + for (i = 0; i < SHA2_SHA256_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; *buffer++ = sha2_hex_digits[*d & 0x0f]; d++; } *buffer = (char)0; } else { - MEMSET_BZERO(context, sizeof(SHA256_CTX)); + MEMSET_BZERO(context, sizeof(SHA2_SHA256_CTX)); } - MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH); + MEMSET_BZERO(digest, SHA2_SHA256_DIGEST_LENGTH); return buffer; } -char* SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) { - SHA256_CTX context; +char* SHA2_SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA2_SHA256_DIGEST_STRING_LENGTH]) { + SHA2_SHA256_CTX context; - SHA256_Init(&context); - SHA256_Update(&context, data, len); - return SHA256_End(&context, digest); + SHA2_SHA256_Init(&context); + SHA2_SHA256_Update(&context, data, len); + return SHA2_SHA256_End(&context, digest); } /*** SHA-512: *********************************************************/ -void SHA512_Init(SHA512_CTX* context) { - if (context == (SHA512_CTX*)0) { +void SHA2_SHA512_Init(SHA2_SHA512_CTX* context) { + if (context == (SHA2_SHA512_CTX*)0) { return; } - MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH); - MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH); + MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA2_SHA512_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, SHA2_SHA512_BLOCK_LENGTH); context->bitcount[0] = context->bitcount[1] = 0; } @@ -705,7 +705,7 @@ void SHA512_Init(SHA512_CTX* context) { (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ j++ -void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { +void SHA2_SHA512_Transform(SHA2_SHA512_CTX* context, const sha2_word64* data) { sha2_word64 a, b, c, d, e, f, g, h, s0, s1; sha2_word64 T1, *W512 = (sha2_word64*)context->buffer; int j; @@ -760,7 +760,7 @@ void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { #else /* SHA2_UNROLL_TRANSFORM */ -void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { +void SHA2_SHA512_Transform(SHA2_SHA512_CTX* context, const sha2_word64* data) { sha2_word64 a, b, c, d, e, f, g, h, s0, s1; sha2_word64 T1, T2, *W512 = (sha2_word64*)context->buffer; int j; @@ -838,7 +838,7 @@ void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { #endif /* SHA2_UNROLL_TRANSFORM */ -void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { +void SHA2_SHA512_Update(SHA2_SHA512_CTX* context, const sha2_byte *data, size_t len) { unsigned int freespace, usedspace; if (len == 0) { @@ -847,12 +847,12 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { } /* Sanity check: */ - assert(context != (SHA512_CTX*)0 && data != (sha2_byte*)0); + assert(context != (SHA2_SHA512_CTX*)0 && data != (sha2_byte*)0); - usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; + usedspace = (context->bitcount[0] >> 3) % SHA2_SHA512_BLOCK_LENGTH; if (usedspace > 0) { /* Calculate how much free space is available in the buffer */ - freespace = SHA512_BLOCK_LENGTH - usedspace; + freespace = SHA2_SHA512_BLOCK_LENGTH - usedspace; if (len >= freespace) { /* Fill the buffer completely and process it */ @@ -860,7 +860,7 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { ADDINC128(context->bitcount, freespace << 3); len -= freespace; data += freespace; - SHA512_Transform(context, (sha2_word64*)context->buffer); + SHA2_SHA512_Transform(context, (sha2_word64*)context->buffer); } else { /* The buffer is not yet full */ MEMCPY_BCOPY(&context->buffer[usedspace], data, len); @@ -870,12 +870,12 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { return; } } - while (len >= SHA512_BLOCK_LENGTH) { + while (len >= SHA2_SHA512_BLOCK_LENGTH) { /* Process as many complete blocks as we can */ - SHA512_Transform(context, (sha2_word64*)data); - ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3); - len -= SHA512_BLOCK_LENGTH; - data += SHA512_BLOCK_LENGTH; + SHA2_SHA512_Transform(context, (sha2_word64*)data); + ADDINC128(context->bitcount, SHA2_SHA512_BLOCK_LENGTH << 3); + len -= SHA2_SHA512_BLOCK_LENGTH; + data += SHA2_SHA512_BLOCK_LENGTH; } if (len > 0) { /* There's left-overs, so save 'em */ @@ -886,10 +886,10 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { usedspace = freespace = 0; } -void SHA512_Last(SHA512_CTX* context) { +void SHA2_SHA512_Last(SHA2_SHA512_CTX* context) { unsigned int usedspace; - usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; + usedspace = (context->bitcount[0] >> 3) % SHA2_SHA512_BLOCK_LENGTH; #if BYTE_ORDER == LITTLE_ENDIAN /* Convert FROM host byte order */ REVERSE64(context->bitcount[0],context->bitcount[0]); @@ -899,43 +899,43 @@ void SHA512_Last(SHA512_CTX* context) { /* Begin padding with a 1 bit: */ context->buffer[usedspace++] = 0x80; - if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) { + if (usedspace <= SHA2_SHA512_SHORT_BLOCK_LENGTH) { /* Set-up for the last transform: */ - MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace); + MEMSET_BZERO(&context->buffer[usedspace], SHA2_SHA512_SHORT_BLOCK_LENGTH - usedspace); } else { - if (usedspace < SHA512_BLOCK_LENGTH) { - MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace); + if (usedspace < SHA2_SHA512_BLOCK_LENGTH) { + MEMSET_BZERO(&context->buffer[usedspace], SHA2_SHA512_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ - SHA512_Transform(context, (sha2_word64*)context->buffer); + SHA2_SHA512_Transform(context, (sha2_word64*)context->buffer); /* And set-up for the last transform: */ - MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2); + MEMSET_BZERO(context->buffer, SHA2_SHA512_BLOCK_LENGTH - 2); } } else { /* Prepare for final transform: */ - MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH); + MEMSET_BZERO(context->buffer, SHA2_SHA512_SHORT_BLOCK_LENGTH); /* Begin padding with a 1 bit: */ *context->buffer = 0x80; } /* Store the length of input data (in bits): */ - *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; - *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; + *(sha2_word64*)&context->buffer[SHA2_SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; + *(sha2_word64*)&context->buffer[SHA2_SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; /* Final transform: */ - SHA512_Transform(context, (sha2_word64*)context->buffer); + SHA2_SHA512_Transform(context, (sha2_word64*)context->buffer); } -void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { +void SHA2_SHA512_Final(sha2_byte digest[], SHA2_SHA512_CTX* context) { sha2_word64 *d = (sha2_word64*)digest; /* Sanity check: */ - assert(context != (SHA512_CTX*)0); + assert(context != (SHA2_SHA512_CTX*)0); /* If no digest buffer is passed, we don't bother doing this: */ if (digest != (sha2_byte*)0) { - SHA512_Last(context); + SHA2_SHA512_Last(context); /* Save the hash data for output: */ #if BYTE_ORDER == LITTLE_ENDIAN @@ -948,69 +948,69 @@ void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { } } #else - MEMCPY_BCOPY(d, context->state, SHA512_DIGEST_LENGTH); + MEMCPY_BCOPY(d, context->state, SHA2_SHA512_DIGEST_LENGTH); #endif } /* Zero out state data */ - MEMSET_BZERO(context, sizeof(SHA512_CTX)); + MEMSET_BZERO(context, sizeof(SHA2_SHA512_CTX)); } -char *SHA512_End(SHA512_CTX* context, char buffer[]) { - sha2_byte digest[SHA512_DIGEST_LENGTH], *d = digest; +char *SHA2_SHA512_End(SHA2_SHA512_CTX* context, char buffer[]) { + sha2_byte digest[SHA2_SHA512_DIGEST_LENGTH], *d = digest; int i; /* Sanity check: */ - assert(context != (SHA512_CTX*)0); + assert(context != (SHA2_SHA512_CTX*)0); if (buffer != (char*)0) { - SHA512_Final(digest, context); + SHA2_SHA512_Final(digest, context); - for (i = 0; i < SHA512_DIGEST_LENGTH; i++) { + for (i = 0; i < SHA2_SHA512_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; *buffer++ = sha2_hex_digits[*d & 0x0f]; d++; } *buffer = (char)0; } else { - MEMSET_BZERO(context, sizeof(SHA512_CTX)); + MEMSET_BZERO(context, sizeof(SHA2_SHA512_CTX)); } - MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH); + MEMSET_BZERO(digest, SHA2_SHA512_DIGEST_LENGTH); return buffer; } -char* SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) { - SHA512_CTX context; +char* SHA2_SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA2_SHA512_DIGEST_STRING_LENGTH]) { + SHA2_SHA512_CTX context; - SHA512_Init(&context); - SHA512_Update(&context, data, len); - return SHA512_End(&context, digest); + SHA2_SHA512_Init(&context); + SHA2_SHA512_Update(&context, data, len); + return SHA2_SHA512_End(&context, digest); } /*** SHA-384: *********************************************************/ -void SHA384_Init(SHA384_CTX* context) { - if (context == (SHA384_CTX*)0) { +void SHA2_SHA384_Init(SHA2_SHA384_CTX* context) { + if (context == (SHA2_SHA384_CTX*)0) { return; } - MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH); - MEMSET_BZERO(context->buffer, SHA384_BLOCK_LENGTH); + MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA2_SHA512_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, SHA2_SHA384_BLOCK_LENGTH); context->bitcount[0] = context->bitcount[1] = 0; } -void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) { - SHA512_Update((SHA512_CTX*)context, data, len); +void SHA2_SHA384_Update(SHA2_SHA384_CTX* context, const sha2_byte* data, size_t len) { + SHA2_SHA512_Update((SHA2_SHA512_CTX*)context, data, len); } -void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { +void SHA2_SHA384_Final(sha2_byte digest[], SHA2_SHA384_CTX* context) { sha2_word64 *d = (sha2_word64*)digest; /* Sanity check: */ - assert(context != (SHA384_CTX*)0); + assert(context != (SHA2_SHA384_CTX*)0); /* If no digest buffer is passed, we don't bother doing this: */ if (digest != (sha2_byte*)0) { - SHA512_Last((SHA512_CTX*)context); + SHA2_SHA512_Last((SHA2_SHA512_CTX*)context); /* Save the hash data for output: */ #if BYTE_ORDER == LITTLE_ENDIAN @@ -1023,42 +1023,42 @@ void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { } } #else - MEMCPY_BCOPY(d, context->state, SHA384_DIGEST_LENGTH); + MEMCPY_BCOPY(d, context->state, SHA2_SHA384_DIGEST_LENGTH); #endif } /* Zero out state data */ - MEMSET_BZERO(context, sizeof(SHA384_CTX)); + MEMSET_BZERO(context, sizeof(SHA2_SHA384_CTX)); } -char *SHA384_End(SHA384_CTX* context, char buffer[]) { - sha2_byte digest[SHA384_DIGEST_LENGTH], *d = digest; +char *SHA2_SHA384_End(SHA2_SHA384_CTX* context, char buffer[]) { + sha2_byte digest[SHA2_SHA384_DIGEST_LENGTH], *d = digest; int i; /* Sanity check: */ - assert(context != (SHA384_CTX*)0); + assert(context != (SHA2_SHA384_CTX*)0); if (buffer != (char*)0) { - SHA384_Final(digest, context); + SHA2_SHA384_Final(digest, context); - for (i = 0; i < SHA384_DIGEST_LENGTH; i++) { + for (i = 0; i < SHA2_SHA384_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; *buffer++ = sha2_hex_digits[*d & 0x0f]; d++; } *buffer = (char)0; } else { - MEMSET_BZERO(context, sizeof(SHA384_CTX)); + MEMSET_BZERO(context, sizeof(SHA2_SHA384_CTX)); } - MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH); + MEMSET_BZERO(digest, SHA2_SHA384_DIGEST_LENGTH); return buffer; } -char* SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) { - SHA384_CTX context; +char* SHA2_SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA2_SHA384_DIGEST_STRING_LENGTH]) { + SHA2_SHA384_CTX context; - SHA384_Init(&context); - SHA384_Update(&context, data, len); - return SHA384_End(&context, digest); + SHA2_SHA384_Init(&context); + SHA2_SHA384_Update(&context, data, len); + return SHA2_SHA384_End(&context, digest); } diff --git a/libUseful-2.0/sha2.h b/libUseful-2.4/sha2.h similarity index 52% rename from libUseful-2.0/sha2.h rename to libUseful-2.4/sha2.h index bf759ad..b8631ef 100644 --- a/libUseful-2.0/sha2.h +++ b/libUseful-2.4/sha2.h @@ -55,15 +55,15 @@ extern "C" { /*** SHA-256/384/512 Various Length Definitions ***********************/ -#define SHA256_BLOCK_LENGTH 64 -#define SHA256_DIGEST_LENGTH 32 -#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) -#define SHA384_BLOCK_LENGTH 128 -#define SHA384_DIGEST_LENGTH 48 -#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) -#define SHA512_BLOCK_LENGTH 128 -#define SHA512_DIGEST_LENGTH 64 -#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) +#define SHA2_SHA256_BLOCK_LENGTH 64 +#define SHA2_SHA256_DIGEST_LENGTH 32 +#define SHA2_SHA256_DIGEST_STRING_LENGTH (SHA2_SHA256_DIGEST_LENGTH * 2 + 1) +#define SHA2_SHA384_BLOCK_LENGTH 128 +#define SHA2_SHA384_DIGEST_LENGTH 48 +#define SHA2_SHA384_DIGEST_STRING_LENGTH (SHA2_SHA384_DIGEST_LENGTH * 2 + 1) +#define SHA2_SHA512_BLOCK_LENGTH 128 +#define SHA2_SHA512_DIGEST_LENGTH 64 +#define SHA2_SHA512_DIGEST_STRING_LENGTH (SHA2_SHA512_DIGEST_LENGTH * 2 + 1) /*** SHA-256/384/512 Context Structures *******************************/ @@ -94,92 +94,92 @@ typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */ */ #ifdef SHA2_USE_INTTYPES_H -typedef struct _SHA256_CTX { +typedef struct _SHA2_SHA256_CTX { uint32_t state[8]; uint64_t bitcount; - uint8_t buffer[SHA256_BLOCK_LENGTH]; -} SHA256_CTX; -typedef struct _SHA512_CTX { + uint8_t buffer[SHA2_SHA256_BLOCK_LENGTH]; +} SHA2_SHA256_CTX; +typedef struct _SHA2_SHA512_CTX { uint64_t state[8]; uint64_t bitcount[2]; - uint8_t buffer[SHA512_BLOCK_LENGTH]; -} SHA512_CTX; + uint8_t buffer[SHA2_SHA512_BLOCK_LENGTH]; +} SHA2_SHA512_CTX; #else /* SHA2_USE_INTTYPES_H */ -typedef struct _SHA256_CTX { +typedef struct _SHA2_SHA256_CTX { u_int32_t state[8]; u_int64_t bitcount; - u_int8_t buffer[SHA256_BLOCK_LENGTH]; -} SHA256_CTX; -typedef struct _SHA512_CTX { + u_int8_t buffer[SHA2_SHA256_BLOCK_LENGTH]; +} SHA2_SHA256_CTX; +typedef struct _SHA2_SHA512_CTX { u_int64_t state[8]; u_int64_t bitcount[2]; - u_int8_t buffer[SHA512_BLOCK_LENGTH]; -} SHA512_CTX; + u_int8_t buffer[SHA2_SHA512_BLOCK_LENGTH]; +} SHA2_SHA512_CTX; #endif /* SHA2_USE_INTTYPES_H */ -typedef SHA512_CTX SHA384_CTX; +typedef SHA2_SHA512_CTX SHA2_SHA384_CTX; /*** SHA-256/384/512 Function Prototypes ******************************/ #ifndef NOPROTO #ifdef SHA2_USE_INTTYPES_H -void SHA256_Init(SHA256_CTX *); -void SHA256_Update(SHA256_CTX*, const uint8_t*, size_t); -void SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); -char* SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); -char* SHA256_Data(const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); +void SHA2_SHA256_Init(SHA2_SHA256_CTX *); +void SHA2_SHA256_Update(SHA2_SHA256_CTX*, const uint8_t*, size_t); +void SHA2_SHA256_Final(uint8_t[SHA2_SHA256_DIGEST_LENGTH], SHA2_SHA256_CTX*); +char* SHA2_SHA256_End(SHA2_SHA256_CTX*, char[SHA2_SHA256_DIGEST_STRING_LENGTH]); +char* SHA2_SHA256_Data(const uint8_t*, size_t, char[SHA2_SHA256_DIGEST_STRING_LENGTH]); -void SHA384_Init(SHA384_CTX*); -void SHA384_Update(SHA384_CTX*, const uint8_t*, size_t); -void SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); -char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); -char* SHA384_Data(const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); +void SHA2_SHA384_Init(SHA2_SHA384_CTX*); +void SHA2_SHA384_Update(SHA2_SHA384_CTX*, const uint8_t*, size_t); +void SHA2_SHA384_Final(uint8_t[SHA2_SHA384_DIGEST_LENGTH], SHA2_SHA384_CTX*); +char* SHA2_SHA384_End(SHA2_SHA384_CTX*, char[SHA2_SHA384_DIGEST_STRING_LENGTH]); +char* SHA2_SHA384_Data(const uint8_t*, size_t, char[SHA2_SHA384_DIGEST_STRING_LENGTH]); -void SHA512_Init(SHA512_CTX*); -void SHA512_Update(SHA512_CTX*, const uint8_t*, size_t); -void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); -char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); -char* SHA512_Data(const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); +void SHA2_SHA512_Init(SHA2_SHA512_CTX*); +void SHA2_SHA512_Update(SHA2_SHA512_CTX*, const uint8_t*, size_t); +void SHA2_SHA512_Final(uint8_t[SHA2_SHA512_DIGEST_LENGTH], SHA2_SHA512_CTX*); +char* SHA2_SHA512_End(SHA2_SHA512_CTX*, char[SHA2_SHA512_DIGEST_STRING_LENGTH]); +char* SHA2_SHA512_Data(const uint8_t*, size_t, char[SHA2_SHA512_DIGEST_STRING_LENGTH]); #else /* SHA2_USE_INTTYPES_H */ -void SHA256_Init(SHA256_CTX *); -void SHA256_Update(SHA256_CTX*, const u_int8_t*, size_t); -void SHA256_Final(u_int8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); -char* SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); -char* SHA256_Data(const u_int8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); +void SHA2_SHA256_Init(SHA2_SHA256_CTX *); +void SHA2_SHA256_Update(SHA2_SHA256_CTX*, const u_int8_t*, size_t); +void SHA2_SHA256_Final(u_int8_t[SHA2_SHA256_DIGEST_LENGTH], SHA2_SHA256_CTX*); +char* SHA2_SHA256_End(SHA2_SHA256_CTX*, char[SHA2_SHA256_DIGEST_STRING_LENGTH]); +char* SHA2_SHA256_Data(const u_int8_t*, size_t, char[SHA2_SHA256_DIGEST_STRING_LENGTH]); -void SHA384_Init(SHA384_CTX*); -void SHA384_Update(SHA384_CTX*, const u_int8_t*, size_t); -void SHA384_Final(u_int8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); -char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); -char* SHA384_Data(const u_int8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); +void SHA2_SHA384_Init(SHA2_SHA384_CTX*); +void SHA2_SHA384_Update(SHA2_SHA384_CTX*, const u_int8_t*, size_t); +void SHA2_SHA384_Final(u_int8_t[SHA2_SHA384_DIGEST_LENGTH], SHA2_SHA384_CTX*); +char* SHA2_SHA384_End(SHA2_SHA384_CTX*, char[SHA2_SHA384_DIGEST_STRING_LENGTH]); +char* SHA2_SHA384_Data(const u_int8_t*, size_t, char[SHA2_SHA384_DIGEST_STRING_LENGTH]); -void SHA512_Init(SHA512_CTX*); -void SHA512_Update(SHA512_CTX*, const u_int8_t*, size_t); -void SHA512_Final(u_int8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); -char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); -char* SHA512_Data(const u_int8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); +void SHA2_SHA512_Init(SHA2_SHA512_CTX*); +void SHA2_SHA512_Update(SHA2_SHA512_CTX*, const u_int8_t*, size_t); +void SHA2_SHA512_Final(u_int8_t[SHA2_SHA512_DIGEST_LENGTH], SHA2_SHA512_CTX*); +char* SHA2_SHA512_End(SHA2_SHA512_CTX*, char[SHA2_SHA512_DIGEST_STRING_LENGTH]); +char* SHA2_SHA512_Data(const u_int8_t*, size_t, char[SHA2_SHA512_DIGEST_STRING_LENGTH]); #endif /* SHA2_USE_INTTYPES_H */ #else /* NOPROTO */ -void SHA256_Init(); -void SHA256_Update(); -void SHA256_Final(); -char* SHA256_End(); -char* SHA256_Data(); - -void SHA384_Init(); -void SHA384_Update(); -void SHA384_Final(); -char* SHA384_End(); -char* SHA384_Data(); +void SHA2_SHA256_Init(); +void SHA2_SHA256_Update(); +void SHA2_SHA256_Final(); +char* SHA2_SHA256_End(); +char* SHA2_SHA256_Data(); + +void SHA2_SHA384_Init(); +void SHA2_SHA384_Update(); +void SHA2_SHA384_Final(); +char* SHA2_SHA384_End(); +char* SHA2_SHA384_Data(); void SHA512_Init(); void SHA512_Update(); diff --git a/libUseful-2.4/sha2.o b/libUseful-2.4/sha2.o new file mode 100644 index 0000000..e3e320b Binary files /dev/null and b/libUseful-2.4/sha2.o differ diff --git a/libUseful-2.4/socket.c b/libUseful-2.4/socket.c new file mode 100644 index 0000000..3bdd0de --- /dev/null +++ b/libUseful-2.4/socket.c @@ -0,0 +1,981 @@ +#include "socket.h" +#include "ConnectionChain.h" +#include "unix_socket.h" + +#include +#include +#include +#include +#include + + +int IsIP4Address(const char *Str) +{ +const char *ptr; +int dot_count=0; +int AllowDot=FALSE; + +if (! Str) return(FALSE); + +for (ptr=Str; *ptr != '\0'; ptr++) +{ + if (*ptr == '.') + { + if (! AllowDot) return(FALSE); + dot_count++; + AllowDot=FALSE; + } + else + { + if (! isdigit(*ptr)) return(FALSE); + AllowDot=TRUE; + } +} + +if (dot_count != 3) return(FALSE); + +return(TRUE); +} + + +int IsIP6Address(const char *Str) +{ +const char *ptr; +const char *IP6CHARS="0123456789abcdefABCDEF:%"; + +if (!Str) return(FALSE); + +for (ptr=Str; *ptr != '\0'; ptr++) +{ + if (*ptr=='%') break; + if (! strchr(IP6CHARS,*ptr)) return(FALSE); +} + +return(TRUE); +} + + + + +/* This is a simple function to decide if a string is an IP address as */ +/* opposed to a host/domain name. */ + +int IsIPAddress(const char *Str) +{ +int len,count; +len=strlen(Str); +if (len <1) return(FALSE); +for (count=0; count < len; count++) + if ((! isdigit(Str[count])) && (Str[count] !='.')) return(FALSE); + return(TRUE); +} + + + + +int IsSockConnected(int sock) +{ +struct sockaddr_in sa; +socklen_t salen; +int result; + +if (sock==-1) return(FALSE); +salen=sizeof(sa); +result=getpeername(sock,(struct sockaddr *) &sa, &salen); +if (result==0) return(TRUE); +if (errno==ENOTCONN) return(SOCK_CONNECTING); +return(FALSE); +} + + +int SockSetOptions(int sock, int SetFlags, int UnsetFlags) +{ +int result; + +result=TRUE; +if (SetFlags & SOCK_BROADCAST) result=setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &result,sizeof(int)); + +if (SetFlags & SOCK_DONTROUTE) result=setsockopt(sock, SOL_SOCKET, SO_DONTROUTE, &result,sizeof(int)); + +if (SetFlags & SOCK_REUSEPORT) result=setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &result,sizeof(int)); + +if (SetFlags & SOCK_TPROXY) result=setsockopt(sock, IPPROTO_IP, IP_TRANSPARENT, &result,sizeof(int)); + +if (SetFlags & SOCK_PEERCREDS) result=setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &result,sizeof(int)); + +//Default is KEEPALIVE ON +setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &result,sizeof(int)); + +if (SetFlags & CONNECT_NONBLOCK) fcntl(sock,F_SETFL,O_NONBLOCK); + + +result=FALSE; +if (SetFlags & SOCK_NOKEEPALIVE) setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &result,sizeof(int)); + +if (UnsetFlags & SOCK_BROADCAST) result=setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &result,sizeof(int)); + +if (UnsetFlags & SOCK_DONTROUTE) result=setsockopt(sock, SOL_SOCKET, SO_DONTROUTE, &result,sizeof(int)); + +if (UnsetFlags & SOCK_REUSEPORT) result=setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &result,sizeof(int)); + +if (UnsetFlags & SOCK_TPROXY) result=setsockopt(sock, IPPROTO_IP, IP_TRANSPARENT, &result,sizeof(int)); + +if (UnsetFlags & SOCK_PEERCREDS) result=setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &result,sizeof(int)); +} + + +int SockSetAttribute(int sock, int Attrib, int Value) +{ + + +} + +int SockGetAttribute(int sock, int Attrib, int Value) +{ + + +} + + + +int GetHostARP(const char *IP, char **Device, char **MAC) +{ +char *Tempstr=NULL, *Token=NULL; +int result=FALSE; +const char *ptr; +FILE *F; + +Tempstr=SetStrLen(Tempstr, 255); +F=fopen("/proc/net/arp","r"); +if (F) +{ + *Device=CopyStr(*Device,"remote"); + *MAC=CopyStr(*MAC,"remote"); + //Read Title Line + fgets(Tempstr,255,F); + + while (fgets(Tempstr,255,F)) + { + StripTrailingWhitespace(Tempstr); + ptr=GetToken(Tempstr," ",&Token,0); + if (strcmp(Token,IP)==0) + { + while (isspace(*ptr)) ptr++; + ptr=GetToken(ptr," ",&Token,0); + + while (isspace(*ptr)) ptr++; + ptr=GetToken(ptr," ",&Token,0); + + while (isspace(*ptr)) ptr++; + ptr=GetToken(ptr," ",MAC,0); + strlwr(*MAC); + + while (isspace(*ptr)) ptr++; + ptr=GetToken(ptr," ",&Token,0); + + while (isspace(*ptr)) ptr++; + ptr=GetToken(ptr," ",Device,0); + + result=TRUE; + } + } +fclose(F); +} + +DestroyString(Tempstr); +DestroyString(Token); + +return(result); +} + + + + +const char *GetInterfaceIP(const char *Interface) +{ + int fd, result; + struct ifreq ifr; + + fd = socket(AF_INET, SOCK_DGRAM, 0); + if (fd==-1) return(""); + + ifr.ifr_addr.sa_family = AF_INET; + strncpy(ifr.ifr_name, Interface, IFNAMSIZ-1); + result=ioctl(fd, SIOCGIFADDR, &ifr); + if (result==-1) return(""); + close(fd); + + return(inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr)); +} + + + +#include + +/*--------------------------------------------------------------------*/ +/*--- checksum - standard 1s complement checksum ---*/ +/*--------------------------------------------------------------------*/ +unsigned short checksum(void *b, int len) +{ + unsigned short *buf = b; + unsigned int sum=0; + unsigned short result; + + for ( sum = 0; len > 1; len -= 2 ) + sum += *buf++; + if ( len == 1 ) + sum += *(unsigned char*)buf; + sum = (sum >> 16) + (sum & 0xFFFF); + sum += (sum >> 16); + result = ~sum; + return result; +} + + +int ICMPSend(int sock, const char *Host, int Type, int Code, int TTL, char *Data, int len) +{ +struct icmphdr *ICMPHead; +char *Tempstr=NULL; +int packet_len; +static int seq=0; +struct sockaddr_in sa; +int result; + +result=TTL; +if (setsockopt(sock, SOL_IP, IP_TTL, &result, sizeof(int)) != 0) return(0); + +packet_len=len+sizeof(struct icmphdr); +Tempstr=(char *) calloc(1, packet_len+1); +ICMPHead=(struct icmphdr *) Tempstr; +ICMPHead->type=ICMP_ECHO; +ICMPHead->un.echo.id=getpid(); +ICMPHead->un.echo.sequence=seq++; +if ((len > 0) && Data) memcpy(Tempstr + sizeof(struct icmphdr), Data, len); +ICMPHead->checksum=checksum(Tempstr, packet_len); + +memset(&sa, 0, sizeof(sa)); +sa.sin_family=AF_INET; +sa.sin_port=0; +sa.sin_addr.s_addr=StrtoIP(Host); +result=sendto(sock, Tempstr, packet_len, 0, (struct sockaddr*) &sa, sizeof(struct sockaddr)); + +DestroyString(Tempstr); + +return(result); +} + + +int SockAddrCreate(struct sockaddr **ret_sa, int Family, const char *Addr, int Port) +{ +struct sockaddr_in *sa4; +struct sockaddr_in6 *sa6; +char *Token=NULL, *ptr; +socklen_t salen; + +if (Family==AF_INET) +{ + sa4=(struct sockaddr_in *) calloc(1,sizeof(struct sockaddr_in)); + if (StrLen(Addr)) sa4->sin_addr.s_addr=StrtoIP(Addr); + else sa4->sin_addr.s_addr=INADDR_ANY; + sa4->sin_port=htons(Port); + sa4->sin_family=AF_INET; + *ret_sa=(struct sockaddr *) sa4; + salen=sizeof(struct sockaddr_in); +} +else +{ + sa6=(struct sockaddr_in6 *) calloc(1,sizeof(struct sockaddr_in6)); + if (StrLen(Addr)) + { + ptr=GetToken(Addr, "%",&Token,0); + if (StrLen(ptr)) sa6->sin6_scope_id=if_nametoindex(ptr); + inet_pton(AF_INET6, Token, &(sa6->sin6_addr)); + } + else sa6->sin6_addr=in6addr_any; + sa6->sin6_port=htons(Port); + sa6->sin6_family=AF_INET6; + + *ret_sa=(struct sockaddr *) sa6; + salen=sizeof(struct sockaddr_in6); +} + +DestroyString(Token); + +return(salen); +} + + +int UDPOpen(const char *Addr, int Port, int Flags) +{ + int result, Family=AF_INET6; + struct sockaddr *sa; + socklen_t salen; + int fd; + + if (IsIP4Address(Addr)) Family=AF_INET; + salen=SockAddrCreate(&sa, Family, Addr, Port); + fd=socket(Family, SOCK_DGRAM,0); + result=bind(fd, sa, salen); + if (result !=0) + { + close(fd); + return(-1); + } + + SockSetOptions(fd, Flags, 0); + return(fd); +} + + + + +int UDPSend(int sock, const char *Host, int Port, char *Data, int len) +{ +int Family=AF_INET; +struct sockaddr *sa=NULL; +socklen_t salen; +int result; + +if (IsIP6Address(Host)) Family=AF_INET6; + +salen=SockAddrCreate(&sa, Family, Host, Port); + +result=sendto(sock, Data, len, 0, sa , salen); +free(sa); +return(result); +} + + + +int STREAMSendDgram(STREAM *S, const char *Host, int Port, char *Data, int len) +{ +return(UDPSend(S->out_fd, Host, Port, Data, len)); +} + + +#ifdef USE_INET6 +int InitServerSock(int Type, const char *Address, int Port) +{ +int sock; +//struct sockaddr_storage sa; +struct sockaddr_in *sa4; +struct sockaddr_in6 *sa6; +struct sockaddr *sa=NULL; +socklen_t salen; +int result, Family=AF_INET6; +const char *p_Addr=NULL, *ptr; + + +if (StrLen(Address)) +{ + if (IsIP4Address(Address)) + { + Family=AF_INET; + p_Addr=Address; + } + else if (IsIP6Address(Address)) + { + Family=AF_INET6; + p_Addr=Address; + } + else + { + Family=AF_INET; + p_Addr=GetInterfaceIP(Address); + } +} + +salen=SockAddrCreate(&sa, Family, p_Addr, Port); + +if (Type==0) Type=SOCK_STREAM; +sock=socket(Family,Type,0); +if (sock <0) return(-1); + +//No reason to pass server/listen sockets across an exec +fcntl(sock, F_SETFD, FD_CLOEXEC); + +result=1; +setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&result,sizeof(result)); + +result=bind(sock, sa, salen); + +if ((result==0) && (Type==SOCK_STREAM)) +{ + result=listen(sock,10); +} + +free(sa); + +if (result==0) return(sock); + +close(sock); +return(-1); +} + +#else + +int InitServerSock(int Type, const char *Address, int Port) +{ +struct sockaddr_in sa; +int result; +const char *ptr; +socklen_t salen; +int sock; + +sa.sin_port=htons(Port); +sa.sin_family=AF_INET; + + +if (StrLen(Address) > 0) +{ + if (IsIP6Address(Address)) return(-1); + + if (IsIP4Address(Address)) ptr=Address; + else ptr=GetInterfaceIP(Address); + sa.sin_addr.s_addr=StrtoIP(ptr); +} +else sa.sin_addr.s_addr=INADDR_ANY; + +if (Type==0) Type=SOCK_STREAM; +sock=socket(AF_INET, Type,0); +if (sock <0) return(-1); + +//No reason to pass server/listen sockets across an exec +fcntl(sock, F_SETFD, FD_CLOEXEC); + +result=1; +salen=sizeof(result); +setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&result,salen); + + +salen=sizeof(struct sockaddr_in); +result=bind(sock,(struct sockaddr *) &sa, salen); + +if ((result==0) && (Type==SOCK_STREAM)) +{ + result=listen(sock,10); +} + +if (result==0) return(sock); +else +{ +close(sock); +return(-1); +} +} +#endif + + +int TCPServerSockAccept(int ServerSock, char **Addr) +{ +struct sockaddr_storage sa; +socklen_t salen; +int sock; + +salen=sizeof(sa); +sock=accept(ServerSock,(struct sockaddr *) &sa, &salen); +if (Addr && (sock > -1)) +{ +*Addr=SetStrLen(*Addr,NI_MAXHOST); +getnameinfo((struct sockaddr *) &sa, salen, *Addr, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); +} +return(sock); +} + + + + + + + + + + +#ifdef USE_INET6 +int GetSockDetails(int sock, char **LocalAddress, int *LocalPort, char **RemoteAddress, int *RemotePort) +{ +socklen_t salen; +int result; +struct sockaddr_storage sa; +char *Tempstr=NULL, *ptr; + +*LocalPort=0; +*RemotePort=0; +*LocalAddress=CopyStr(*LocalAddress,""); +*RemoteAddress=CopyStr(*RemoteAddress,""); + +salen=sizeof(struct sockaddr_storage); +result=getsockname(sock, (struct sockaddr *) &sa, &salen); + +if (result==0) +{ + *LocalAddress=SetStrLen(*LocalAddress,NI_MAXHOST); + Tempstr=SetStrLen(Tempstr,NI_MAXSERV); + getnameinfo((struct sockaddr *) &sa, salen, *LocalAddress, NI_MAXHOST, Tempstr, NI_MAXSERV, NI_NUMERICHOST|NI_NUMERICSERV); + *LocalPort=atoi(Tempstr); + + if ((strncmp(*LocalAddress,"::ffff:",7)==0) && strchr(*LocalAddress,'.')) + { + ptr=*LocalAddress; + ptr+=7; + memmove(*LocalAddress,ptr,StrLen(*LocalAddress)-6); + } + + + //Set Address to be the same as control sock, as it might not be INADDR_ANY + result=getpeername(sock, (struct sockaddr *) &sa, &salen); + + if (result==0) + { + *RemoteAddress=SetStrLen(*RemoteAddress,NI_MAXHOST); + Tempstr=SetStrLen(Tempstr,NI_MAXSERV); + getnameinfo((struct sockaddr *) &sa, salen, *RemoteAddress, NI_MAXHOST, Tempstr, NI_MAXSERV, NI_NUMERICHOST|NI_NUMERICSERV); + *RemotePort=atoi(Tempstr); + + if ((strncmp(*RemoteAddress,"::ffff:",7)==0) && strchr(*RemoteAddress,'.')) + { + ptr=*RemoteAddress; + ptr+=7; + memmove(*RemoteAddress,ptr,StrLen(*RemoteAddress)-6); + } + } + + //We've got the local sock, so lets still call it a success + result=0; +} + +DestroyString(Tempstr); + +if (result==0) return(TRUE); +return(FALSE); +} + +#else + +int GetSockDetails(int sock, char **LocalAddress, int *LocalPort, char **RemoteAddress, int *RemotePort) +{ +socklen_t salen; +int result; +struct sockaddr_in sa; + +*LocalPort=0; +*RemotePort=0; +*LocalAddress=CopyStr(*LocalAddress,""); +*RemoteAddress=CopyStr(*RemoteAddress,""); + +salen=sizeof(struct sockaddr_in); +result=getsockname(sock, (struct sockaddr *) &sa, &salen); + +if (result==0) +{ + *LocalAddress=CopyStr(*LocalAddress,IPtoStr(sa.sin_addr.s_addr)); + *LocalPort=ntohs(sa.sin_port); + + //Set Address to be the same as control sock, as it might not be INADDR_ANY + result=getpeername(sock, (struct sockaddr *) &sa, &salen); + + if (result==0) + { + *RemoteAddress=CopyStr(*RemoteAddress,IPtoStr(sa.sin_addr.s_addr)); + *RemotePort=sa.sin_port; + } + + //We've got the local sock, so lets still call it a success + result=0; +} + +if (result==0) return(TRUE); +return(FALSE); +} + +#endif + + + + +/* Users will probably only use this function if they want to reconnect */ +/* a broken connection, or reuse a socket for multiple connections, hence */ +/* the name... */ +int IPReconnect(int sock, const char *Host, int Port, int Flags) +{ +socklen_t salen; +int result; +struct sockaddr_in sa; +struct hostent *hostdata; + +sa.sin_family=AF_INET; +sa.sin_port=htons(Port); + +if (IsIP4Address(Host)) +{ +inet_aton(Host, (struct in_addr *) &sa.sin_addr); +} +else +{ + hostdata=gethostbyname(Host); + if (!hostdata) + { + return(-1); + } +sa.sin_addr=*(struct in_addr *) *hostdata->h_addr_list; +} + +salen=sizeof(sa); +SockSetOptions(sock, Flags, 0); + +result=connect(sock,(struct sockaddr *)&sa, salen); +if (result==0) result=TRUE; + +if ((result==-1) && (Flags & CONNECT_NONBLOCK) && (errno == EINPROGRESS)) result=FALSE; +return(result); +} + + +int TCPConnectWithAttributes(const char *Host, int Port, int Flags, int TTL, int ToS) +{ +int sock, result; + +sock=socket(AF_INET,SOCK_STREAM,0); +if (sock <0) return(-1); + +if (TTL > 0) setsockopt(sock, IPPROTO_IP, IP_TTL, &TTL, sizeof(int)); +if (ToS > 0) setsockopt(sock, IPPROTO_IP, IP_TOS, &ToS, sizeof(int)); + +result=IPReconnect(sock,Host,Port,Flags); +if (result==-1) +{ +close(sock); +return(-1); +} + +return(sock); + +} + + +int TCPConnect(const char *Host, int Port, int Flags) +{ +return(TCPConnectWithAttributes(Host, Port, Flags, 0, 0)); +} + + + +int CheckForTerm(DownloadContext *CTX, char inchar) +{ + + if (inchar == CTX->TermStr[CTX->TermPos]) + { + CTX->TermPos++; + if (CTX->TermPos >=strlen(CTX->TermStr)) + { + CTX->TermPos=0; + return(TRUE); + } + } + else + { + if (CTX->TermPos >0) + { + STREAMWriteBytes(CTX->Output, CTX->TermStr,CTX->TermPos); + CTX->TermPos=0; + return(CheckForTerm(CTX,inchar)); + } + } +return(FALSE); +} + + + +int ProcessIncommingBytes(DownloadContext *CTX) +{ +int inchar, FoundTerm=FALSE; + + inchar=STREAMReadChar(CTX->Input); + + if (inchar==EOF) return(TRUE); + + FoundTerm=CheckForTerm(CTX,(char) inchar); + while ((inchar !=EOF) && (! FoundTerm)) + { + if (CTX->TermPos==0) STREAMWriteChar(CTX->Output, (char) inchar); + inchar=STREAMReadChar(CTX->Input); + FoundTerm=CheckForTerm(CTX, (char) inchar); + } +if (inchar==EOF) return(TRUE); +if (FoundTerm) return(TRUE); +return(FALSE); +} + + +int DownloadToTermStr2(STREAM *Connection, STREAM *SaveFile, char *TermStr) +{ +DownloadContext CTX; + +CTX.TermStr=CopyStr(NULL,TermStr); +CTX.Input=Connection; +CTX.Output=SaveFile; +CTX.TermPos=0; + +while(ProcessIncommingBytes(&CTX) !=TRUE); + +DestroyString(CTX.TermStr); +return(TRUE); +} + +int DownloadToDot(STREAM *Connection, STREAM *SaveFile) +{ +return(DownloadToTermStr2(Connection,SaveFile,"\r\n.\r\n")); +} + + +int DownloadToTermStr(STREAM *Connection, STREAM *SaveFile, char *TermStr) +{ +char *Tempstr=NULL; + +Tempstr=STREAMReadLine(Tempstr,Connection); +while (Tempstr) +{ + if (strcmp(Tempstr,TermStr)==0) +{ + break; +} + STREAMWriteLine(Tempstr,SaveFile); + Tempstr=STREAMReadLine(Tempstr,Connection); +} +return(TRUE); +} + + + +char *LookupHostIP(const char *Host) +{ +struct hostent *hostdata; + + hostdata=gethostbyname(Host); + if (!hostdata) + { + return(NULL); + } + +//inet_ntoa shouldn't need this cast to 'char *', but it emitts a warning +//without it +return((char *) inet_ntoa(*(struct in_addr *) *hostdata->h_addr_list)); +} + + + + +char *GetRemoteIP(int sock) +{ +struct sockaddr_in sa; +socklen_t salen; +int result; + +salen=sizeof(struct sockaddr_in); +result=getpeername(sock,(struct sockaddr *) &sa, &salen); +if (result==-1) +{ +if (errno==ENOTSOCK) return("127.0.0.1"); +else return("0.0.0.0"); +} + +return((char *) inet_ntoa(sa.sin_addr)); +} + + +char *IPStrToHostName(const char *IPAddr) +{ +struct sockaddr_in sa; +struct hostent *hostdata=NULL; + +inet_aton(IPAddr,& sa.sin_addr); +hostdata=gethostbyaddr(&sa.sin_addr.s_addr,sizeof((sa.sin_addr.s_addr)),AF_INET); +if (hostdata) return(hostdata->h_name); +else return(""); +} + + + + +char *IPtoStr(unsigned long Address) +{ +struct sockaddr_in sa; +sa.sin_addr.s_addr=Address; +return((char *) inet_ntoa(sa.sin_addr)); + +} + +unsigned long StrtoIP(const char *Str) +{ +struct sockaddr_in sa; +if (inet_aton(Str,&sa.sin_addr)) return(sa.sin_addr.s_addr); +return(0); +} + + +int STREAMIsConnected(STREAM *S) +{ +int result=FALSE; + +if (! S) return(FALSE); +result=IsSockConnected(S->in_fd); +if (result==TRUE) +{ + if (S->State & SS_CONNECTING) + { + S->State |= SS_CONNECTED; + S->State &= (~SS_CONNECTING); + } +} +if ((result==SOCK_CONNECTING) && (! (S->State & SS_CONNECTING))) result=FALSE; +return(result); +} + + + +int STREAMDoPostConnect(STREAM *S, int Flags) +{ +int result=FALSE; +char *ptr; +struct timeval tv; + +if (! S) return(FALSE); +if ((S->in_fd > -1) && (S->Timeout > 0) ) +{ + tv.tv_sec=S->Timeout; + tv.tv_usec=0; + if (FDSelect(S->in_fd, SELECT_WRITE, &tv) != SELECT_WRITE) + { + close(S->in_fd); + S->in_fd=-1; + S->out_fd=-1; + } +} + +if (S->in_fd > -1) +{ +//We will have been non-blocking during connection, but if we don't +//really want the stream to be non blocking, we unset that here +if (! (Flags & CONNECT_NONBLOCK)) STREAMSetFlags(S, 0, SF_NONBLOCK); + +S->Type=STREAM_TYPE_TCP; +result=TRUE; +STREAMSetFlushType(S,FLUSH_LINE,0,0); +if (Flags & CONNECT_SSL) DoSSLClientNegotiation(S, Flags); + +ptr=GetRemoteIP(S->in_fd); +if (ptr) STREAMSetValue(S,"PeerIP",ptr); +} + +return(result); +} + +extern char *GlobalConnectionChain; + +int STREAMTCPConnect(STREAM *S, const char *Host, int Port, int TTL, int ToS, int Flags) +{ +ListNode *Curr, *LastHop; +char *Token=NULL, *ptr; +int HopNo=0, result=FALSE; + + +if (! STREAMGetValue(S, "ConnectHop:0")) +{ +if (StrValid(GlobalConnectionChain)) STREAMAddConnectionHop(S, GlobalConnectionChain); +} + +//Find the last hop, used to decide what ssh command to use +Curr=ListGetNext(S->Values); +while (Curr) +{ +GetToken(Curr->Tag,":",&Token,0); +if (strcasecmp(Token,"ConnectHop")==0) LastHop=Curr; +if (strcasecmp(Curr->Tag,"TTL")==0) TTL=atoi(Curr->Item); +if (strcasecmp(Curr->Tag,"ToS")==0) ToS=atoi(Curr->Item); +Curr=ListGetNext(Curr); +} + + +Curr=ListGetNext(S->Values); +while (Curr) +{ + GetToken(Curr->Tag,":",&Token,0); + + if (strcasecmp(Token,"ConnectHop")==0) result=STREAMProcessConnectHop(S, (char *) Curr->Item,Curr==LastHop); + + HopNo++; + if (! result) break; + Curr=ListGetNext(Curr); +} + +//If we're not handling the connection through 'Connect hops' then +//just connect to host +if ((HopNo==0) && StrLen(Host)) +{ + if (Flags & CONNECT_NONBLOCK) S->Flags |= SF_NONBLOCK; + + //Flags are handled in this function + S->in_fd=TCPConnectWithAttributes(Host,Port,Flags,TTL,ToS); + + S->out_fd=S->in_fd; + if (S->in_fd > -1) result=TRUE; +} + +if (result==TRUE) +{ + if (Flags & CONNECT_NONBLOCK) + { + S->State |=SS_CONNECTING; + S->Flags |=SF_NONBLOCK; + } + else + { + S->State |=SS_CONNECTED; + result=STREAMDoPostConnect(S, Flags); + } +} + +return(result); +} + + + +int STREAMConnect(STREAM *S, const char *URL, int Flags) +{ +ListNode *Curr; +int result=FALSE, fd; +unsigned int Port=0, TTL=0, ToS=0; +char *Proto=NULL, *Host=NULL, *Token=NULL, *Path=NULL; + + +ParseURL(URL, &Proto, &Host, &Token,NULL, NULL,&Path,NULL); +S->Path=FormatStr(S->Path,URL); +Port=strtoul(Token,0,10); + +STREAMSetFlushType(S,FLUSH_LINE,0,0); +if (strcasecmp(Proto,"unix")==0) result=STREAMConnectUnixSocket(S, Host, SOCK_STREAM); +if (strcasecmp(Proto,"unixdgm")==0) result=STREAMConnectUnixSocket(S, Host, SOCK_DGRAM); +else if ((strcasecmp(Proto,"udp")==0) || (strcasecmp(Proto,"bcast")==0)) +{ + fd=UDPOpen("", 0, Flags); + if (fd > -1) + { + S->in_fd=fd; + S->out_fd=fd; + S->Type=STREAM_TYPE_UDP; + result=IPReconnect(fd,Host,Port,0); + if (strcasecmp(Proto,"bcast")==0) SockSetOptions(fd, SOCK_BROADCAST, 0); + } +} +else if (strcasecmp(Proto,"ssl")==0) result=STREAMTCPConnect(S, Host, Port, TTL, ToS, Flags | CONNECT_SSL); +else result=STREAMTCPConnect(S, Host, Port, TTL, ToS, Flags); + +DestroyString(Token); +DestroyString(Proto); +DestroyString(Host); +DestroyString(Path); + +return(result); +} + + diff --git a/libUseful-2.0/socket.h b/libUseful-2.4/socket.h similarity index 54% rename from libUseful-2.0/socket.h rename to libUseful-2.4/socket.h index 6d1bfd3..6f86099 100644 --- a/libUseful-2.0/socket.h +++ b/libUseful-2.4/socket.h @@ -1,50 +1,62 @@ #ifndef LIBUSEFUL_SOCK #define LIBUSEFUL_SOCK -#include -#include "file.h" +#include "includes.h" #define CONNECT_NONBLOCK 1 #define CONNECT_SSL 2 #define CONNECT_HTTP_PROXY 4 #define CONNECT_SOCKS_PROXY 8 +#define SOCK_NOKEEPALIVE 16 +#define SOCK_BROADCAST 32 +#define SOCK_DONTROUTE 64 +#define SOCK_REUSEPORT 128 +#define SOCK_TPROXY 256 +#define SOCK_PEERCREDS 512 #define SOCK_CONNECTED 1 #define SOCK_CONNECTING -1 + + #ifdef __cplusplus extern "C" { #endif +int IsIP4Address(const char *Str); +int IsIP6Address(const char *Str); +int IsIPAddress(const char *); + +const char *GetInterfaceIP(const char *Interface); +int GetHostARP(const char *IP, char **Device, char **MAC); + +int ICMPSend(int sock, const char *Host, int Type, int Code, int TTL, char *Data, int len); +int UDPOpen(const char *Addr, int Port,int NonBlock); +int UDPSend(int sock, const char *Host, int Port, char *Data, int len); /* Server Socket Funcs*/ -int InitServerSock(char *Address, int Port); -int InitUnixServerSock(char *Path); -int TCPServerSockAccept(int ServerSock,int *Addr); +int InitServerSock(int Type, const char *Address, int Port); +int InitUnixServerSock(int Type, const char *Path); + +int TCPServerSockAccept(int ServerSock,char **Addr); int UnixServerSockAccept(int ServerSock); int GetSockDetails(int fd, char **LocalAddress, int *LocalPort, char **RemoteAddress, int *RemotePort); /* Client Socket Funcs*/ int IsSockConnected(int sock); -int ReconnectSock(int sock, char *Host, int Port, int Flags); -int ConnectToHost(char *Host, int Port, int Flags); +int TCPReconnect(int sock, const char *Host, int Port, int Flags); +int TCPConnect(const char *Host, int Port, int Flags); /* int CheckForData(int sock); */ int SendText(int sock, char *Text); int ReadText(int sock, char *Buffer, int MaxLen); int ReadToCR(int fd, char *Buffer, int MaxLen); -STREAM *STREAMOpenUDP(int Port,int NonBlock); -int STREAMSendDgram(STREAM *S, char *Host, int Port, char *Bytes, int len); -int STREAMConnectToHost(STREAM *S, char *Host, int Port, int Flags); +int STREAMConnect(STREAM *S, const char *URL, int Flags); int STREAMIsConnected(STREAM *S); int DoPostConnect(STREAM *S, int Flags); -int DoSSLClientNegotiation(STREAM *S, int Flags); -int DoSSLServerNegotiation(STREAM *S, int Flags); -const char *STREAMQuerySSLCipher(STREAM *S); -int STREAMIsPeerAuth(STREAM *S); /* Stuff relating to standard inet download procedure (until \r\n.\r\n) */ typedef struct @@ -59,18 +71,15 @@ int ProcessIncommingBytes(DownloadContext *); //int DownloadToDot(int sock, FILE *SaveFile); int DownloadToDot(STREAM *Connection, STREAM *SaveFile); int DownloadToTermStr(STREAM *Connection, STREAM *SaveFile, char *TermStr); -void ParseConnectDetails(char *Str, char **Type, char **Host, char **Port, char **User, char **Pass, char **InitDir); /* IP Address and host lookup functions */ -char *LookupHostIP(char *Host); char *GetRemoteIP(int sock); -char *IPStrToHostName(char *); +char *LookupHostIP(const char *Host); +char *IPStrToHostName(const char *); char *IPtoStr(unsigned long); -unsigned long StrtoIP(char *); -int IsIPAddress(char *); +unsigned long StrtoIP(const char *); -int SSLAvailable(); #ifdef __cplusplus } diff --git a/libUseful-2.4/socket.o b/libUseful-2.4/socket.o new file mode 100644 index 0000000..d5782d8 Binary files /dev/null and b/libUseful-2.4/socket.o differ diff --git a/libUseful-2.0/sound.c b/libUseful-2.4/sound.c similarity index 90% rename from libUseful-2.0/sound.c rename to libUseful-2.4/sound.c index 114c0ee..13f89a7 100644 --- a/libUseful-2.0/sound.c +++ b/libUseful-2.4/sound.c @@ -37,7 +37,7 @@ uint32_t DataSize; -char *VolTypeStrings[]={"master","pcm","cd","mic","line","video","phonein","phoneout","all",NULL}; +const char *VolTypeStrings[]={"master","pcm","cd","mic","line","video","phonein","phoneout","all",NULL}; typedef enum {VOL_MASTER,VOL_PCM,VOL_CD,VOL_MIC,VOL_LINE1,VOL_VIDEO,VOL_PHONEIN,VOL_PHONEOUT,VOL_ALL} TVOLUME_CHANNELS; @@ -50,6 +50,7 @@ int SoundReformat(char **Out, char *In, int Len, TAudioInfo *AI) { int len, i; +len=Len; //Expand mono to both channels if (AI->Channels==1) { @@ -57,8 +58,8 @@ if (AI->Channels==1) *Out=SetStrLen(*Out, Len*2); for (i=0; i < Len; i++) { - Out[i*2]=In[i]; - Out[i*2+1]=In[i]; + (*Out)[i*2]=In[i]; + (*Out)[i*2+1]=In[i]; } } @@ -118,9 +119,9 @@ void SoundWriteWAVHeader(STREAM *S, TAudioInfo *AI) { WAVHeader WavHead; - strcpy(WavHead.RIFF,"RIFF"); - strcpy(WavHead.Format,"WAVE"); - strcpy(WavHead.Block,"fmt "); + memcpy(WavHead.RIFF,"RIFF",4); + memcpy(WavHead.Format,"WAVE",4); + memcpy(WavHead.Block,"fmt ",4); WavHead.FileSize=AI->DataSize+44; WavHead.AudioFormat=1; WavHead.Channels=AI->Channels; @@ -129,7 +130,7 @@ void SoundWriteWAVHeader(STREAM *S, TAudioInfo *AI) WavHead.ByteRate=WavHead.SampleRate * WavHead.BlockAlign; WavHead.BitsPerSample=AI->SampleSize * 8; WavHead.ChunkSize=WavHead.BitsPerSample; - strcpy(WavHead.DataHeader,"data"); + memcpy(WavHead.DataHeader,"data",4); WavHead.DataSize=AI->DataSize; @@ -180,6 +181,35 @@ return(AudioInfo); +TAudioInfo *SoundOpenFile(char *FilePath) +{ +TAudioInfo *AudioInfo=NULL; +char *FourCharacter; +STREAM *S; + +S=STREAMOpenFile(FilePath,SF_RDONLY); +if (! S) return(NULL); + +FourCharacter=calloc(4, sizeof(char)); +STREAMReadBytes(S,FourCharacter,4); +STREAMSeek(S,0,SEEK_SET); +if (strcmp(FourCharacter,".snd")==0) AudioInfo=SoundReadAU(S); +else if (strcmp(FourCharacter,"RIFF")==0) AudioInfo=SoundReadWAV(S); + +free(FourCharacter); + +if (! AudioInfo) +{ + STREAMClose(S); + return(NULL); +} +AudioInfo->S=S; + +return(AudioInfo); +} + + + #ifdef HAVE_OSS @@ -187,8 +217,7 @@ return(AudioInfo); /* ------------------------ OSS Functions -------------------- */ int OpenOSSDevice(char *Dev, int Type, TAudioInfo *Info) { - int fd, i; - unsigned char *data; + int fd; int val; if (Type==OUTPUT) val=O_WRONLY; @@ -255,7 +284,7 @@ return(OpenOSSDevice(Dev,OUTPUT,Info)); int OSSAlterVolumeType(char *device, int Type, int delta) { -int left_val, right_val, val, mixfd=0; +int left_val=-1, right_val=-1, val, mixfd=0; mixfd=open(device, O_RDWR); if (mixfd > -1) @@ -353,45 +382,36 @@ return(left_val); int OSSAlterVolume(char *device, char *type_str, int delta) { -int type; +int type, result=-1; + type=MatchTokenFromList(type_str,VolTypeStrings,0); if ((type==VOL_ALL) || (type==-1)) { -OSSAlterVolumeType(device, VOL_MASTER, delta); -OSSAlterVolumeType(device, VOL_PCM, delta); +result=OSSAlterVolumeType(device, VOL_MASTER, delta); +result=OSSAlterVolumeType(device, VOL_PCM, delta); } -else OSSAlterVolumeType(device, type, delta); +else result=OSSAlterVolumeType(device, type, delta); + +return(result); } int OSSPlaySoundFile(char *DevPath, char *FilePath, int Vol) { -STREAM *S; char *Buffer=NULL, *Tempstr=NULL; int result, fd=-1, mixfd=-1; -int Flags, val, oldvol; -char FourCharacter[5]; +int val, oldvol; TAudioInfo *AudioInfo=NULL; -S=STREAMOpenFile(FilePath,O_RDONLY); -if (! S) return(FALSE); -STREAMReadBytes(S,FourCharacter,4); -FourCharacter[4]='\0'; -STREAMSeek(S,0,SEEK_SET); -if (strcmp(FourCharacter,".snd")==0) AudioInfo=SoundReadAU(S); -else if (strcmp(FourCharacter,"RIFF")==0) AudioInfo=SoundReadWAV(S); - -if (AudioInfo==NULL) -{ - STREAMClose(S); - return(FALSE); -} +AudioInfo=SoundOpenFile(FilePath); +if (AudioInfo==NULL) return(FALSE); //Must do all the above before we do open oss! fd=OpenOSSOutput(DevPath, AudioInfo); if (fd==-1) { - STREAMClose(S); + STREAMClose(AudioInfo->S); + free(AudioInfo); return(FALSE); } @@ -409,7 +429,7 @@ if (Vol != VOLUME_LEAVEALONE) } Buffer=SetStrLen(Buffer,1024); -result=STREAMReadBytes(S,Buffer,1024); +result=STREAMReadBytes(AudioInfo->S,Buffer,1024); /* if (AudioInfo->Channels==1) @@ -426,7 +446,7 @@ while (result > 0) write(fd,Buffer,result); val+=result; if ((AudioInfo->DataSize > 0) && (val >= AudioInfo->DataSize)) break; -result=STREAMReadBytes(S,Buffer,1024); +result=STREAMReadBytes(AudioInfo->S,Buffer,1024); } close(fd); @@ -439,7 +459,9 @@ close(mixfd); DestroyString(Buffer); DestroyString(Tempstr); -STREAMClose(S); +STREAMClose(AudioInfo->S); +free(AudioInfo); + return(TRUE); } @@ -485,10 +507,9 @@ DestroyString(Tempstr); int ESDPlaySoundFile(char *SoundFilePath, int Vol) { -int result, fd; - if (StrLen(SoundFilePath) < 1) return(FALSE); #ifdef HAVE_LIBESD +int fd; fd=ESDGetConnection(); if (fd > -1) @@ -635,6 +656,3 @@ DestroyString(device); return(val); } - - - diff --git a/libUseful-2.0/sound.h b/libUseful-2.4/sound.h similarity index 96% rename from libUseful-2.0/sound.h rename to libUseful-2.4/sound.h index 99defee..88a15cd 100644 --- a/libUseful-2.0/sound.h +++ b/libUseful-2.4/sound.h @@ -10,6 +10,7 @@ unsigned int Channels; unsigned int SampleRate; unsigned int SampleSize; unsigned int DataSize; +STREAM *S; }TAudioInfo; #define VOLUME_LEAVEALONE -1 @@ -71,6 +72,7 @@ int SoundOpenInput(char *Dev, TAudioInfo *Info); TAudioInfo *SoundReadWAV(STREAM *S); TAudioInfo *SoundReadAU(STREAM *S); void SoundWriteWAVHeader(STREAM *S, TAudioInfo *AI); +TAudioInfo *SoundOpenFile(char *FilePath); #ifdef __cplusplus diff --git a/libUseful-2.4/sound.o b/libUseful-2.4/sound.o new file mode 100644 index 0000000..053d6f0 Binary files /dev/null and b/libUseful-2.4/sound.o differ diff --git a/libUseful-2.4/string.c b/libUseful-2.4/string.c new file mode 100644 index 0000000..c34795e --- /dev/null +++ b/libUseful-2.4/string.c @@ -0,0 +1,674 @@ +#include "includes.h" +#include + +#ifndef va_copy +#define va_copy(dest, src) (dest) = (src) +#endif + + +/* +size_t StrLen(const char *Str) +{ +char *ptr, *end; + +if (! Str) return(0); + +ptr=Str; +end=ptr + LibUsefulObjectSize(Str, 0); +while ((ptr < end) && (*ptr != '\0')) ptr++; +return(ptr-Str); +} +*/ + + + + +void DestroyString(void *Obj) +{ +if (Obj) free(Obj); +} + + + +int CompareStr(const char *S1, const char *S2) +{ +if ( + ((!S1) || (*S1=='\0')) && + ((!S2) || (*S2=='\0')) + ) return(0); + +if ((!S1) || (*S1=='\0')) return(-1); +if ((!S2) || (*S2=='\0')) return(1); + +return(strcmp(S1,S2)); +} + + +char *CopyStrLen(char *Dest, const char *Src, size_t len) +{ +const char *src, *end; +char *dst; + +Dest=(char *)realloc(Dest,len+1); +dst=Dest; +src=Src; +if (src) +{ +end=src+len; +while ((src < end) && (*src != '\0')) +{ +*dst=*src; +dst++; +src++; +} +} +*dst='\0'; + +return(Dest); +} + + +char *CatStrLen(char *Dest, const char *Src, size_t len) +{ +const char *src, *end; +char *dst; +int dstlen; + +dstlen=StrLen(Dest); +Dest=(char *)realloc(Dest,dstlen+len+1); +dst=Dest+dstlen; +src=Src; +end=src+len; +while ((src < end) && (*src != '\0')) +{ +*dst=*src; +dst++; +src++; +} +*dst='\0'; + +return(Dest); +} + + + +char *CatStr(char *Dest, const char *Src) +{ +return(CatStrLen(Dest, Src, StrLen(Src))); +} + + +char *CopyStr(char *Dest, const char *Src) +{ +if (Dest) *Dest=0; +return(CatStr(Dest,Src)); +} + + + +char *VCatStr(char *Dest, const char *Str1, va_list args) +{ +//initialize these to keep valgrind happy +size_t len=0, ilen; +char *ptr=NULL; +const char *sptr=NULL; +char *eptr; + + +if (Dest !=NULL) +{ +len=StrLen(Dest); +ptr=Dest; +} +else ptr=(char *) calloc(10,1); + +if (! Str1) return(ptr); + +for (sptr=Str1; sptr !=NULL; sptr=va_arg(args,const char *)) +{ + ilen=StrLen(sptr); + if (ilen > 0) + { + ptr=(char *) realloc(ptr,len+ilen+10); + if (ptr) + { + memcpy(ptr+len, sptr, ilen); + len+=ilen; + } + } +} +ptr[len]='\0'; + +return(ptr); +} + +char *MCatStr(char *Dest, const char *Str1, ...) +{ +char *ptr=NULL; +va_list args; + +va_start(args,Str1); +ptr=VCatStr(Dest,Str1,args); +va_end(args); + +return(ptr); +} + + +char *MCopyStr(char *Dest, const char *Str1, ...) +{ +char *ptr=NULL; +va_list args; + +ptr=Dest; +if (ptr) *ptr='\0'; +va_start(args,Str1); +ptr=VCatStr(ptr,Str1,args); +va_end(args); + +return(ptr); +} + + + + + +char *PadStr(char*Dest, char Pad, int PadLen) +{ +char *NewStr=NULL; +int i, len; + +if (PadLen==0) return(Dest); + +len=StrLen(Dest); +if (PadLen > 0) +{ + NewStr=Dest; + while (len < PadLen) NewStr=AddCharToBuffer(NewStr,len++,Pad); +} +else if (PadLen < 0) +{ + for (i=0; i < (0-PadLen)-len; i++) NewStr=AddCharToBuffer(NewStr,i,Pad); + NewStr=CatStr(NewStr,Dest); + //NewStr really is new, so we destroy Dest + DestroyString(Dest); +} + +return(NewStr); +} + +char *CopyPadStr(char*Dest, char *Src, char Pad, int PadLen) +{ +Dest=CopyStr(Dest,Src); +Dest=PadStr(Dest,Pad,PadLen); +return(Dest); +} + + + +//Clone string is really intended to be passed into the 'ListClone' function +//in the manner of a copy constructor, for most uses it's best to stick to +//CopyStr + +char *CloneStr(const char *Str) +{ +return(CopyStr(NULL,Str)); +} + + +char *VFormatStr(char *InBuff, const char *InputFmtStr, va_list args) +{ +int inc=100, count=1, result=0, FmtLen; +char *Tempstr=NULL, *FmtStr=NULL, *ptr; +va_list argscopy; + +Tempstr=InBuff; + +//Take a copy of the supplied Format string and change it. +//Do not allow '%n', it's useable for exploits + +FmtLen=StrLen(InputFmtStr); +#ifdef USE_ALLOCA +FmtStr=alloca(FmtLen); +strncpy(FmtStr,InputFmtStr,FmtLen); +#else +FmtStr=CopyStr(FmtStr,InputFmtStr); +#endif + +//Deny %n. Replace it with %x which prints out the value of any supplied argument +ptr=strstr(FmtStr,"%n"); +while (ptr) +{ + memcpy(ptr,"%x",2); + ptr++; + ptr=strstr(ptr,"%n"); +} + + +inc=4 * FmtLen; //this should be a good average +for (count=1; count < 100; count++) +{ + result=inc * count +1; + Tempstr=SetStrLen(Tempstr, result); + + //the vsnprintf function DESTROYS the arg list that is passed to it. + //This is just plain WRONG, it's a long-standing bug. The solution is to + //us va_copy to make a new one every time and pass that in. + va_copy(argscopy,args); + result=vsnprintf(Tempstr,result,FmtStr,argscopy); + va_end(argscopy); + + /* old style returns -1 to say couldn't fit data into buffer.. so we */ + /* have to guess again */ + if (result==-1) continue; + + /* new style returns how long buffer should have been.. so we resize it */ + if (result > (inc * count)) + { + Tempstr=SetStrLen(Tempstr, result+10); + va_copy(argscopy,args); + result=vsnprintf(Tempstr,result+10,FmtStr,argscopy); + va_end(argscopy); + } + + break; +} + +#ifndef USE_ALLOCA +DestroyString(FmtStr); +#endif + +return(Tempstr); +} + + + +char *FormatStr(char *InBuff, const char *FmtStr, ...) +{ +char *tempstr=NULL; +va_list args; + +va_start(args,FmtStr); +tempstr=VFormatStr(InBuff,FmtStr,args); +va_end(args); +return(tempstr); +} + + +char *AddCharToStr(char *Dest,char Src) +{ +char temp[2]; +char *ptr=NULL; + +temp[0]=Src; +temp[1]=0; +ptr=CatStr(Dest,temp); +return(ptr); +} + + +inline char *AddCharToBuffer(char *Dest, size_t DestLen, char Char) +{ +char *actb_ptr; + +//if (Dest==NULL || ((DestLen % 100)==0)) +actb_ptr=(char *) realloc((void *) Dest,DestLen +110); +//else actb_ptr=Dest; + +actb_ptr[DestLen]=Char; +actb_ptr[DestLen+1]='\0'; + +return(actb_ptr); +} + + +inline char *AddBytesToBuffer(char *Dest, size_t DestLen, char *Bytes, size_t NoOfBytes) +{ +char *actb_ptr=NULL; + +//if (Dest==NULL || ((DestLen % 100)==0)) +actb_ptr=(char *) realloc((void *) Dest,DestLen + NoOfBytes +10); +//else actb_ptr=Dest; + +memcpy(actb_ptr+DestLen,Bytes,NoOfBytes); + +return(actb_ptr); +} + + + +char *SetStrLen(char *Str,size_t len) +{ +/* Note len+1 to allow for terminating NULL */ +if (Str==NULL) return((char *) calloc(1,len+1)); +else return( (char *) realloc(Str,len+1)); +} + + +char *strlwr(char *str) +{ +char *ptr; + +if (! str) return(NULL); +for (ptr=str; *ptr !='\0'; ptr++) *ptr=tolower(*ptr); +return(str); +} + + +char *strupr(char *str) +{ +char *ptr; +if (! str) return(NULL); +for (ptr=str; *ptr !='\0'; ptr++) *ptr=toupper(*ptr); +return(str); +} + + +char *strrep(char *str, char oldchar, char newchar) +{ +char *ptr; + +if (! str) return(NULL); +for (ptr=str; *ptr !='\0'; ptr++) +{ +if (*ptr==oldchar) *ptr=newchar; +} +return(str); +} + +char *strmrep(char *str, char *oldchars, char newchar) +{ +char *ptr; + +if (! str) return(NULL); +for (ptr=str; *ptr !='\0'; ptr++) +{ +if (strchr(oldchars,*ptr)) *ptr=newchar; +} +return(str); +} + +void StripTrailingWhitespace(char *str) +{ +size_t len; +char *ptr; + +len=StrLen(str); +if (len==0) return; +for(ptr=str+len-1; (ptr >= str) && isspace(*ptr); ptr--) *ptr='\0'; +} + + +void StripLeadingWhitespace(char *str) +{ +char *ptr, *start=NULL; + +if (! str) return; +for(ptr=str; *ptr !='\0'; ptr++) +{ + if ((! start) && (! isspace(*ptr))) start=ptr; +} + +if (!start) start=ptr; + memmove(str,start,ptr+1-start); +} + + + +void StripCRLF(char *Line) +{ +size_t len; +char *ptr; + +len=StrLen(Line); +if (len < 1) return; + +for (ptr=Line+len-1; ptr >= Line; ptr--) +{ + if (strchr("\n\r",*ptr)) *ptr='\0'; + else break; +} + +} + + +void StripQuotes(char *Str) +{ +int len; +char *ptr, StartQuote='\0'; + +ptr=Str; +while (isspace(*ptr)) ptr++; + +if ((*ptr=='"') || (*ptr=='\'')) +{ + StartQuote=*ptr; + len=StrLen(ptr); + if ((len > 0) && (StartQuote != '\0') && (ptr[len-1]==StartQuote)) + { + if (ptr[len-1]==StartQuote) ptr[len-1]='\0'; + memmove(Str,ptr+1,len); + } +} + +} + + +char *EnquoteStr(char *Out, const char *In) +{ +const char *ptr; +char *ReturnStr=NULL; +size_t len=0; + +ptr=In; +ReturnStr=CopyStr(Out,""); + +while (ptr && (*ptr != '\0')) +{ + switch (*ptr) + { + case '\\': + case '"': + case '\'': + ReturnStr=AddCharToBuffer(ReturnStr,len,'\\'); + len++; + ReturnStr=AddCharToBuffer(ReturnStr,len, *ptr); + len++; + break; + + + case '\r': + ReturnStr=AddCharToBuffer(ReturnStr,len,'\\'); + len++; + ReturnStr=AddCharToBuffer(ReturnStr,len, 'r'); + len++; + break; + + + case '\n': + ReturnStr=AddCharToBuffer(ReturnStr,len,'\\'); + len++; + ReturnStr=AddCharToBuffer(ReturnStr,len, 'n'); + len++; + break; + + default: + ReturnStr=AddCharToBuffer(ReturnStr,len, *ptr); + len++; + break; + } + ptr++; +} + +return(ReturnStr); +} + + + +int MatchTokenFromList(const char *Token,const char **List, int Flags) +{ +int count; +size_t tlen, ilen; +char Up1stChar, Lwr1stChar; +const char *Item; + +if ((! Token) || (*Token=='\0')) return(-1); +Up1stChar=toupper(*Token); +Lwr1stChar=tolower(*Token); +tlen=StrLen(Token); +for (count=0; List[count] !=NULL; count++) +{ + Item=List[count]; + if ((*Item==Lwr1stChar) || (*Item==Up1stChar)) + { + ilen=StrLen(Item); + + if (Flags & MATCH_TOKEN_PART) + { + if (tlen > ilen) continue; + if (Flags & MATCH_TOKEN_CASE) + { + if (strncmp(Token,Item,ilen)==0) return(count); + } + else if (strncasecmp(Token,Item,ilen)==0) return(count); + } + else + { + if (tlen != ilen) continue; + if (Flags & MATCH_TOKEN_CASE) + { + if(strcmp(Token,List[count])==0) return(count); + } + else if (strcasecmp(Token,List[count])==0) return(count); + } + } +} +return(-1); +} + + + +int MatchLineStartFromList(const char *Token,char **List) +{ +int count; +size_t len; + +if ((! Token) || (*Token=='\0')) return(-1); +if (! List) return(-1); +for (count=0; List[count] !=NULL; count++) +{ + if (*Token==*List[count]) + { + len=StrLen(List[count]); + + if ( + (len >0) && + (strncasecmp(Token,List[count],len)==0) + ) return(count); + } +} +return(-1); +} + + + + + + +#define ESC 0x1B + +char *DeQuoteStr(char *Buffer, const char *Line) +{ +char *out, *in; +size_t olen=0; +char hex[3]; + +if (Line==NULL) return(NULL); +out=CopyStr(Buffer,""); +in=(char *) Line; + +while(in && (*in != '\0') ) +{ + if (*in=='\\') + { + in++; + switch (*in) + { + case 'e': + out=AddCharToBuffer(out,olen,ESC); + olen++; + break; + + + case 'n': + out=AddCharToBuffer(out,olen,'\n'); + olen++; + break; + + case 'r': + out=AddCharToBuffer(out,olen,'\r'); + olen++; + break; + + case 't': + out=AddCharToBuffer(out,olen,'\t'); + olen++; + break; + + case 'x': + in++; hex[0]=*in; + in++; hex[1]=*in; + hex[2]='\0'; + out=AddCharToBuffer(out,olen,strtol(hex,NULL,16) & 0xFF); + olen++; + break; + + case '\\': + default: + out=AddCharToBuffer(out,olen,*in); + olen++; + break; + + } + } + else + { + out=AddCharToBuffer(out,olen,*in); + olen++; + } + in++; +} + +return(out); +} + + + +char *QuoteCharsInStr(char *Buffer, const char *String, const char *QuoteChars) +{ +char *RetStr=NULL; +const char *sptr, *cptr; +size_t olen=0; + +RetStr=CopyStr(Buffer,""); +if (! String) return(RetStr); + +for (sptr=String; *sptr !='\0'; sptr++) +{ + for (cptr=QuoteChars; *cptr !='\0'; cptr++) + { + if (*sptr==*cptr) + { + RetStr=AddCharToBuffer(RetStr,olen, '\\'); + olen++; + break; + } + } + RetStr=AddCharToBuffer(RetStr,olen,*sptr); + olen++; +} + +return(RetStr); +} + + diff --git a/libUseful-2.0/string.h b/libUseful-2.4/string.h similarity index 62% rename from libUseful-2.0/string.h rename to libUseful-2.4/string.h index 0b5f238..b624286 100644 --- a/libUseful-2.0/string.h +++ b/libUseful-2.4/string.h @@ -3,9 +3,7 @@ #include #include //for strlen, used below in StrLen - -#define GETTOKEN_QUOTES 1 -#define GETTOKEN_MULTI_SEPARATORS 2 +#include "defines.h" #define MATCH_TOKEN_PART 1 #define MATCH_TOKEN_CASE 2 @@ -18,22 +16,27 @@ extern "C" { //down to macros using weird stuff like the ternary condition //operator '?' and the dreaded comma operator ',' #define StrLen(str) ( str ? strlen(str) : 0 ) +#define StrValid(str) ( (str && (*(const char *) str != '\0')) ? TRUE : FALSE ) +//#define StrEnd(str) ( ((! str) || (*str == '\0') || (str > __builtin_frame_address (0)) ? TRUE : FALSE ) +#define StrEnd(str) ( (str && (*(const char *) str != '\0')) ? FALSE : TRUE ) -//int StrLen(char *Str); -char *DestroyString(char *); +//size_t StrLen(const char *Str); +void DestroyString(void *); int CompareStr(const char *S1, const char *S2); -char *CopyStrLen(char *,const char *,int); +char *CopyStrLen(char *,const char *,size_t); char *CopyStr(char *, const char *); char *MCatStr(char *, const char *, ...); char *MCopyStr(char *, const char *, ...); char *CatStr(char *, const char *); -char *CatStrLen(char *,const char *,int); +char *CatStrLen(char *,const char *,size_t); +char *PadStr(char*Dest, char Pad, int PadLen); +char *CopyPadStr(char*Dest, char *Src, char Pad, int PadLen); char *VFormatStr(char *,const char *,va_list); char *FormatStr(char *,const char *,...); char *AddCharToStr(char *,char); -char *AddCharToBuffer(char *Buffer, int BuffLen, char Char); -char *AddBytesToBuffer(char *Buffer, int BuffLen, char *Bytes, int Len); -char *SetStrLen(char *,int); +char *AddCharToBuffer(char *Buffer, size_t BuffLen, char Char); +char *AddBytesToBuffer(char *Buffer, size_t BuffLen, char *Bytes, size_t Len); +char *SetStrLen(char *,size_t); char *strupr(char *); char *strlwr(char *); char *strrep(char *,char, char); @@ -46,9 +49,8 @@ void StripQuotes(char *); char *QuoteCharsInStr(char *Buffer, const char *String,const char *QuoteChars); char *DeQuoteStr(char *Buffer, const char *Line); char *EnquoteStr(char *Out, const char *In); -int MatchTokenFromList(const char *Token,char **List, int Flags); +int MatchTokenFromList(const char *Token,const char **List, int Flags); int MatchLineStartFromList(const char *Token,char **List); -char *GetToken(const char *SearchStr, const char *Delim, char **Token, int Flags); #ifdef __cplusplus } diff --git a/libUseful-2.4/string.o b/libUseful-2.4/string.o new file mode 100644 index 0000000..4c4a485 Binary files /dev/null and b/libUseful-2.4/string.o differ diff --git a/libUseful-2.0/tar.c b/libUseful-2.4/tar.c similarity index 93% rename from libUseful-2.0/tar.c rename to libUseful-2.4/tar.c index 57abb23..94177ac 100644 --- a/libUseful-2.0/tar.c +++ b/libUseful-2.4/tar.c @@ -2,7 +2,7 @@ #include #include #include - +#include "FileSystem.h" #define TAR_RECORDSIZE 512 @@ -39,13 +39,13 @@ typedef struct int TarReadHeader(STREAM *S, ListNode *Vars) { -char *Tempstr=NULL, *ptr; +char *Tempstr=NULL; int len, result, RetVal=FALSE; TTarHeader *Head; len=sizeof(TTarHeader); Head=(TTarHeader *) calloc(1,len); -result=STREAMReadBytes(S,Head,len); +result=STREAMReadBytes(S,(char *) Head,len); printf("HEAD: %d %s\n",result,(char *) Head); if (result == len) { @@ -113,7 +113,7 @@ while (TarReadHeader(Tar, Vars)) else if (strcmp(ptr,"file")==0) { MakeDirPath(Path,0700); - S=STREAMOpenFile(Path,O_WRONLY|O_CREAT|O_TRUNC); + S=STREAMOpenFile(Path,SF_WRONLY|SF_CREAT|SF_TRUNC); if (S) fchmod(S->out_fd,atoi(GetVar(Vars,"Mode"))); bytes_read=0; bytes_total=atoi(GetVar(Vars,"Size")); @@ -160,8 +160,8 @@ Head=(TTarHeader *) calloc(1,sizeof(TTarHeader)); sprintf(Head->mode,"%07o",FStat->st_mode); sprintf(Head->uid,"%07o",FStat->st_uid); sprintf(Head->gid,"%07o",FStat->st_gid); - sprintf(Head->size,"%011o",FStat->st_size); - sprintf(Head->mtime,"%011o",FStat->st_mtime); + sprintf(Head->size,"%011lo",(unsigned long) FStat->st_size); + sprintf(Head->mtime,"%011lo",(unsigned long) FStat->st_mtime); if (S_ISDIR(FStat->st_mode)) Head->typeflag='5'; else if (S_ISLNK(FStat->st_mode)) Head->typeflag='2'; @@ -172,8 +172,8 @@ Head=(TTarHeader *) calloc(1,sizeof(TTarHeader)); memset(Head->chksum,' ',8); - strcpy(Head->magic,"ustar "); - //memcpy(Head->version,"00",2); + memcpy(Head->magic,"ustar\0",6); + memcpy(Head->version,"00",2); pwd=getpwuid(FStat->st_uid); if (pwd) strcpy(Head->uname,pwd->pw_name); @@ -189,7 +189,7 @@ Head=(TTarHeader *) calloc(1,sizeof(TTarHeader)); ptr=(char *) Head; for (i=0; i < 512; i++) chksum+=*(ptr+i); - sprintf(Head->chksum,"%06o\0",chksum); + snprintf(Head->chksum,8,"%06o",chksum); STREAMWriteBytes(S,(char *) Head,512); @@ -262,7 +262,7 @@ for (i=0; i < Glob.gl_pathc; i++) } else { - S=STREAMOpenFile(Glob.gl_pathv[i],O_RDONLY); + S=STREAMOpenFile(Glob.gl_pathv[i],SF_RDONLY); if (S) { TarWriteHeader(Tar, Glob.gl_pathv[i],&FStat); diff --git a/libUseful-2.0/tar.h b/libUseful-2.4/tar.h similarity index 100% rename from libUseful-2.0/tar.h rename to libUseful-2.4/tar.h diff --git a/libUseful-2.4/tar.o b/libUseful-2.4/tar.o new file mode 100644 index 0000000..aef320f Binary files /dev/null and b/libUseful-2.4/tar.o differ diff --git a/libUseful-2.4/test.c b/libUseful-2.4/test.c new file mode 100644 index 0000000..2a7dde7 --- /dev/null +++ b/libUseful-2.4/test.c @@ -0,0 +1,14 @@ +#include "libUseful.h" + +main() +{ +char *ptr; + +CredsStoreAdd("test1", "user1", "pass1"); +CredsStoreAdd("test2", "user2", "pass2"); +CredsStoreAdd("test3", "user3", "pass3"); +CredsStoreAdd("test4", "user4", "pass4"); +ptr=CredsStoreGetSecret("test3", "user3"); + +printf("%s\n",ptr); +} diff --git a/libUseful-2.4/test.exe b/libUseful-2.4/test.exe new file mode 100755 index 0000000..c68e3dc Binary files /dev/null and b/libUseful-2.4/test.exe differ diff --git a/libUseful-2.4/unix_socket.c b/libUseful-2.4/unix_socket.c new file mode 100644 index 0000000..1a1b087 --- /dev/null +++ b/libUseful-2.4/unix_socket.c @@ -0,0 +1,91 @@ +#include "unix_socket.h" +#include +#include +#include + + +int OpenUnixSocket(const char *Path, int Type) +{ +int sock; +struct sockaddr_un sa; +int val; + +if (Type==0) Type=SOCK_STREAM; + +sock=socket(AF_UNIX, Type, FALSE); +if (sock==-1) return(-1); + +memset(&sa,0,sizeof(struct sockaddr_un)); +sa.sun_family=AF_UNIX; +strcpy(sa.sun_path,Path); +val=sizeof(sa); +if (connect(sock,(struct sockaddr *) &sa,val)==0) return(sock); + +close(sock); +return(-1); +} + + + +int STREAMConnectUnixSocket(STREAM *S, const char *Path, int ConType) +{ + + S->in_fd=OpenUnixSocket(Path, ConType); + if (S->in_fd==-1) return(FALSE); + S->out_fd=S->in_fd; + S->Type=ConType; + + return(TRUE); +} + + + +int InitUnixServerSock(int Type, const char *Path) +{ +int sock; +struct sockaddr_un sa; +socklen_t salen; +int result; + +if (Type==0) Type=SOCK_STREAM; +sock=socket(AF_UNIX, Type, 0); +if (sock <0) return(-1); + +//No reason to pass server/listen sockets across an exec +fcntl(sock, F_SETFD, FD_CLOEXEC); + +result=1; +salen=sizeof(result); +strcpy(sa.sun_path,Path); +sa.sun_family=AF_UNIX; +salen=sizeof(struct sockaddr_un); +result=bind(sock,(struct sockaddr *) &sa, salen); + +if ((result==0) && (Type==SOCK_STREAM)) +{ + result=listen(sock,10); +} + +if (result==0) return(sock); +else +{ +close(sock); +return(-1); +} +} + + + +int UnixServerSockAccept(int ServerSock) +{ +struct sockaddr_un sa; +socklen_t salen; +int sock; + +salen=sizeof(sa); +sock=accept(ServerSock,(struct sockaddr *) &sa,&salen); +return(sock); +} + + + diff --git a/libUseful-2.0/unix_socket.h b/libUseful-2.4/unix_socket.h similarity index 72% rename from libUseful-2.0/unix_socket.h rename to libUseful-2.4/unix_socket.h index 779d289..900313f 100644 --- a/libUseful-2.0/unix_socket.h +++ b/libUseful-2.4/unix_socket.h @@ -3,15 +3,16 @@ #include "file.h" #include "defines.h" +#include "includes.h" #ifdef __cplusplus extern "C" { #endif - -int InitUnixServerSocket(const char *Path, int SockType); int OpenUnixSocket(const char *Path, int SockType); int STREAMConnectUnixSocket(STREAM *S, const char *Path, int SockType); +int InitUnixServerSock(int Type, const char *Path); +int UnixServerSockAccept(int ServerSock); #ifdef __cplusplus } diff --git a/libUseful-2.4/unix_socket.o b/libUseful-2.4/unix_socket.o new file mode 100644 index 0000000..4c651fa Binary files /dev/null and b/libUseful-2.4/unix_socket.o differ diff --git a/libUseful-2.4/whirlpool.c b/libUseful-2.4/whirlpool.c new file mode 100644 index 0000000..38e24b1 --- /dev/null +++ b/libUseful-2.4/whirlpool.c @@ -0,0 +1,1673 @@ +/** + * The Whirlpool hashing function. + * + *

+ * References + * + *

+ * The Whirlpool algorithm was developed by + * Paulo S. L. M. Barreto and + * Vincent Rijmen. + * + * See + * P.S.L.M. Barreto, V. Rijmen, + * ``The Whirlpool hashing function,'' + * WHIRLPOOL submission, 2000 (tweaked version, 2001), + * + * + * @author Paulo S.L.M. Barreto + * @author Vincent Rijmen. + * + * @version 3.0 (2003.03.12) + * + * ============================================================================= + * + * Differences from version 2.1: + * + * - Suboptimal diffusion matrix replaced by cir(1, 1, 4, 1, 8, 5, 2, 9). + * + * ============================================================================= + * + * Differences from version 2.0: + * + * - Generation of ISO/IEC 10118-3 test vectors. + * - Bug fix: nonzero carry was ignored when tallying the data length + * (this bug apparently only manifested itself when feeding data + * in pieces rather than in a single chunk at once). + * - Support for MS Visual C++ 64-bit integer arithmetic. + * + * Differences from version 1.0: + * + * - Original S-box replaced by the tweaked, hardware-efficient version. + * + * ============================================================================= + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include +#include + +#include "whirlpool.h" + +#if UINT_MAX >= 4294967295UL + +#define ONE32 0xffffffffU + +#else + +#define ONE32 0xffffffffUL + +#endif + +#define ONE8 0xffU +#define ONE16 0xffffU + +#define T8(x) ((x) & ONE8) +#define T16(x) ((x) & ONE16) +#define T32(x) ((x) & ONE32) + +#define LL(v) (v##ULL) +#define ONE64 LL(0xffffffffffffffff) + + +#define T64(x) ((x) & ONE64) +#define ROTR64(v, n) (((v) >> (n)) | T64((v) << (64 - (n)))) +/* + * Note: the test is used to detect native 64-bit architectures; + * if the unsigned long is strictly greater than 32-bit, it is + * assumed to be at least 64-bit. This will not work correctly + * on (old) 36-bit architectures (PDP-11 for instance). + * + * On non-64-bit architectures, "long long" is used. + */ + +/* + * U8TO32_BIG(c) returns the 32-bit value stored in big-endian convention + * in the unsigned char array pointed to by c. + */ +#define U8TO32_BIG(c) (((uint32_t)T8(*(c)) << 24) | ((uint32_t)T8(*((c) + 1)) << 16) | ((uint32_t)T8(*((c) + 2)) << 8) | ((uint32_t)T8(*((c) + 3)))) + +/* + * U8TO32_LITTLE(c) returns the 32-bit value stored in little-endian convention + * in the unsigned char array pointed to by c. + */ +#define U8TO32_LITTLE(c) (((uint32_t)T8(*(c))) | ((uint32_t)T8(*((c) + 1)) << 8) | (uint32_t)T8(*((c) + 2)) << 16) | ((uint32_t)T8(*((c) + 3)) << 24)) + +/* + * U8TO32_BIG(c, v) stores the 32-bit-value v in big-endian convention + * into the unsigned char array pointed to by c. + */ +#define U32TO8_BIG(c, v) do { uint32_t x = (v); unsigned char *d = (c); d[0] = T8(x >> 24); d[1] = T8(x >> 16); d[2] = T8(x >> 8); d[3] = T8(x); } while (0) + +/* + * U8TO32_LITTLE(c, v) stores the 32-bit-value v in little-endian convention + * into the unsigned char array pointed to by c. + */ +#define U32TO8_LITTLE(c, v) do { uint32_t x = (v); unsigned char *d = (c); d[0] = T8(x); d[1] = T8(x >> 8); d[2] = T8(x >> 16); d[3] = T8(x >> 24); } while (0) + +/* + * ROTL32(v, n) returns the value of the 32-bit unsigned value v after + * a rotation of n bits to the left. It might be replaced by the appropriate + * architecture-specific macro. + * + * It evaluates v and n twice. + * + * The compiler might emit a warning if n is the constant 0. The result + * is undefined if n is greater than 31. + */ +#define ROTL32(v, n) (T32((v) << (n)) | ((v) >> (32 - (n)))) + +/* + * Whirlpool-specific definitions. + */ + + + + +/* #define TRACE_INTERMEDIATE_VALUES */ + +/* + * The number of rounds of the internal dedicated block cipher. + */ +#define R 10 + +/* + * Though Whirlpool is endianness-neutral, the encryption tables are listed + * in BIG-ENDIAN format, which is adopted throughout this implementation + * (but little-endian notation would be equally suitable if consistently + * employed). + */ + +static const uint64_t C0[256] = { + LL(0x18186018c07830d8), LL(0x23238c2305af4626), LL(0xc6c63fc67ef991b8), LL(0xe8e887e8136fcdfb), + LL(0x878726874ca113cb), LL(0xb8b8dab8a9626d11), LL(0x0101040108050209), LL(0x4f4f214f426e9e0d), + LL(0x3636d836adee6c9b), LL(0xa6a6a2a6590451ff), LL(0xd2d26fd2debdb90c), LL(0xf5f5f3f5fb06f70e), + LL(0x7979f979ef80f296), LL(0x6f6fa16f5fcede30), LL(0x91917e91fcef3f6d), LL(0x52525552aa07a4f8), + LL(0x60609d6027fdc047), LL(0xbcbccabc89766535), LL(0x9b9b569baccd2b37), LL(0x8e8e028e048c018a), + LL(0xa3a3b6a371155bd2), LL(0x0c0c300c603c186c), LL(0x7b7bf17bff8af684), LL(0x3535d435b5e16a80), + LL(0x1d1d741de8693af5), LL(0xe0e0a7e05347ddb3), LL(0xd7d77bd7f6acb321), LL(0xc2c22fc25eed999c), + LL(0x2e2eb82e6d965c43), LL(0x4b4b314b627a9629), LL(0xfefedffea321e15d), LL(0x575741578216aed5), + LL(0x15155415a8412abd), LL(0x7777c1779fb6eee8), LL(0x3737dc37a5eb6e92), LL(0xe5e5b3e57b56d79e), + LL(0x9f9f469f8cd92313), LL(0xf0f0e7f0d317fd23), LL(0x4a4a354a6a7f9420), LL(0xdada4fda9e95a944), + LL(0x58587d58fa25b0a2), LL(0xc9c903c906ca8fcf), LL(0x2929a429558d527c), LL(0x0a0a280a5022145a), + LL(0xb1b1feb1e14f7f50), LL(0xa0a0baa0691a5dc9), LL(0x6b6bb16b7fdad614), LL(0x85852e855cab17d9), + LL(0xbdbdcebd8173673c), LL(0x5d5d695dd234ba8f), LL(0x1010401080502090), LL(0xf4f4f7f4f303f507), + LL(0xcbcb0bcb16c08bdd), LL(0x3e3ef83eedc67cd3), LL(0x0505140528110a2d), LL(0x676781671fe6ce78), + LL(0xe4e4b7e47353d597), LL(0x27279c2725bb4e02), LL(0x4141194132588273), LL(0x8b8b168b2c9d0ba7), + LL(0xa7a7a6a7510153f6), LL(0x7d7de97dcf94fab2), LL(0x95956e95dcfb3749), LL(0xd8d847d88e9fad56), + LL(0xfbfbcbfb8b30eb70), LL(0xeeee9fee2371c1cd), LL(0x7c7ced7cc791f8bb), LL(0x6666856617e3cc71), + LL(0xdddd53dda68ea77b), LL(0x17175c17b84b2eaf), LL(0x4747014702468e45), LL(0x9e9e429e84dc211a), + LL(0xcaca0fca1ec589d4), LL(0x2d2db42d75995a58), LL(0xbfbfc6bf9179632e), LL(0x07071c07381b0e3f), + LL(0xadad8ead012347ac), LL(0x5a5a755aea2fb4b0), LL(0x838336836cb51bef), LL(0x3333cc3385ff66b6), + LL(0x636391633ff2c65c), LL(0x02020802100a0412), LL(0xaaaa92aa39384993), LL(0x7171d971afa8e2de), + LL(0xc8c807c80ecf8dc6), LL(0x19196419c87d32d1), LL(0x494939497270923b), LL(0xd9d943d9869aaf5f), + LL(0xf2f2eff2c31df931), LL(0xe3e3abe34b48dba8), LL(0x5b5b715be22ab6b9), LL(0x88881a8834920dbc), + LL(0x9a9a529aa4c8293e), LL(0x262698262dbe4c0b), LL(0x3232c8328dfa64bf), LL(0xb0b0fab0e94a7d59), + LL(0xe9e983e91b6acff2), LL(0x0f0f3c0f78331e77), LL(0xd5d573d5e6a6b733), LL(0x80803a8074ba1df4), + LL(0xbebec2be997c6127), LL(0xcdcd13cd26de87eb), LL(0x3434d034bde46889), LL(0x48483d487a759032), + LL(0xffffdbffab24e354), LL(0x7a7af57af78ff48d), LL(0x90907a90f4ea3d64), LL(0x5f5f615fc23ebe9d), + LL(0x202080201da0403d), LL(0x6868bd6867d5d00f), LL(0x1a1a681ad07234ca), LL(0xaeae82ae192c41b7), + LL(0xb4b4eab4c95e757d), LL(0x54544d549a19a8ce), LL(0x93937693ece53b7f), LL(0x222288220daa442f), + LL(0x64648d6407e9c863), LL(0xf1f1e3f1db12ff2a), LL(0x7373d173bfa2e6cc), LL(0x12124812905a2482), + LL(0x40401d403a5d807a), LL(0x0808200840281048), LL(0xc3c32bc356e89b95), LL(0xecec97ec337bc5df), + LL(0xdbdb4bdb9690ab4d), LL(0xa1a1bea1611f5fc0), LL(0x8d8d0e8d1c830791), LL(0x3d3df43df5c97ac8), + LL(0x97976697ccf1335b), LL(0x0000000000000000), LL(0xcfcf1bcf36d483f9), LL(0x2b2bac2b4587566e), + LL(0x7676c57697b3ece1), LL(0x8282328264b019e6), LL(0xd6d67fd6fea9b128), LL(0x1b1b6c1bd87736c3), + LL(0xb5b5eeb5c15b7774), LL(0xafaf86af112943be), LL(0x6a6ab56a77dfd41d), LL(0x50505d50ba0da0ea), + LL(0x45450945124c8a57), LL(0xf3f3ebf3cb18fb38), LL(0x3030c0309df060ad), LL(0xefef9bef2b74c3c4), + LL(0x3f3ffc3fe5c37eda), LL(0x55554955921caac7), LL(0xa2a2b2a2791059db), LL(0xeaea8fea0365c9e9), + LL(0x656589650fecca6a), LL(0xbabad2bab9686903), LL(0x2f2fbc2f65935e4a), LL(0xc0c027c04ee79d8e), + LL(0xdede5fdebe81a160), LL(0x1c1c701ce06c38fc), LL(0xfdfdd3fdbb2ee746), LL(0x4d4d294d52649a1f), + LL(0x92927292e4e03976), LL(0x7575c9758fbceafa), LL(0x06061806301e0c36), LL(0x8a8a128a249809ae), + LL(0xb2b2f2b2f940794b), LL(0xe6e6bfe66359d185), LL(0x0e0e380e70361c7e), LL(0x1f1f7c1ff8633ee7), + LL(0x6262956237f7c455), LL(0xd4d477d4eea3b53a), LL(0xa8a89aa829324d81), LL(0x96966296c4f43152), + LL(0xf9f9c3f99b3aef62), LL(0xc5c533c566f697a3), LL(0x2525942535b14a10), LL(0x59597959f220b2ab), + LL(0x84842a8454ae15d0), LL(0x7272d572b7a7e4c5), LL(0x3939e439d5dd72ec), LL(0x4c4c2d4c5a619816), + LL(0x5e5e655eca3bbc94), LL(0x7878fd78e785f09f), LL(0x3838e038ddd870e5), LL(0x8c8c0a8c14860598), + LL(0xd1d163d1c6b2bf17), LL(0xa5a5aea5410b57e4), LL(0xe2e2afe2434dd9a1), LL(0x616199612ff8c24e), + LL(0xb3b3f6b3f1457b42), LL(0x2121842115a54234), LL(0x9c9c4a9c94d62508), LL(0x1e1e781ef0663cee), + LL(0x4343114322528661), LL(0xc7c73bc776fc93b1), LL(0xfcfcd7fcb32be54f), LL(0x0404100420140824), + LL(0x51515951b208a2e3), LL(0x99995e99bcc72f25), LL(0x6d6da96d4fc4da22), LL(0x0d0d340d68391a65), + LL(0xfafacffa8335e979), LL(0xdfdf5bdfb684a369), LL(0x7e7ee57ed79bfca9), LL(0x242490243db44819), + LL(0x3b3bec3bc5d776fe), LL(0xabab96ab313d4b9a), LL(0xcece1fce3ed181f0), LL(0x1111441188552299), + LL(0x8f8f068f0c890383), LL(0x4e4e254e4a6b9c04), LL(0xb7b7e6b7d1517366), LL(0xebeb8beb0b60cbe0), + LL(0x3c3cf03cfdcc78c1), LL(0x81813e817cbf1ffd), LL(0x94946a94d4fe3540), LL(0xf7f7fbf7eb0cf31c), + LL(0xb9b9deb9a1676f18), LL(0x13134c13985f268b), LL(0x2c2cb02c7d9c5851), LL(0xd3d36bd3d6b8bb05), + LL(0xe7e7bbe76b5cd38c), LL(0x6e6ea56e57cbdc39), LL(0xc4c437c46ef395aa), LL(0x03030c03180f061b), + LL(0x565645568a13acdc), LL(0x44440d441a49885e), LL(0x7f7fe17fdf9efea0), LL(0xa9a99ea921374f88), + LL(0x2a2aa82a4d825467), LL(0xbbbbd6bbb16d6b0a), LL(0xc1c123c146e29f87), LL(0x53535153a202a6f1), + LL(0xdcdc57dcae8ba572), LL(0x0b0b2c0b58271653), LL(0x9d9d4e9d9cd32701), LL(0x6c6cad6c47c1d82b), + LL(0x3131c43195f562a4), LL(0x7474cd7487b9e8f3), LL(0xf6f6fff6e309f115), LL(0x464605460a438c4c), + LL(0xacac8aac092645a5), LL(0x89891e893c970fb5), LL(0x14145014a04428b4), LL(0xe1e1a3e15b42dfba), + LL(0x16165816b04e2ca6), LL(0x3a3ae83acdd274f7), LL(0x6969b9696fd0d206), LL(0x09092409482d1241), + LL(0x7070dd70a7ade0d7), LL(0xb6b6e2b6d954716f), LL(0xd0d067d0ceb7bd1e), LL(0xeded93ed3b7ec7d6), + LL(0xcccc17cc2edb85e2), LL(0x424215422a578468), LL(0x98985a98b4c22d2c), LL(0xa4a4aaa4490e55ed), + LL(0x2828a0285d885075), LL(0x5c5c6d5cda31b886), LL(0xf8f8c7f8933fed6b), LL(0x8686228644a411c2), +}; + +static const uint64_t C1[256] = { + LL(0xd818186018c07830), LL(0x2623238c2305af46), LL(0xb8c6c63fc67ef991), LL(0xfbe8e887e8136fcd), + LL(0xcb878726874ca113), LL(0x11b8b8dab8a9626d), LL(0x0901010401080502), LL(0x0d4f4f214f426e9e), + LL(0x9b3636d836adee6c), LL(0xffa6a6a2a6590451), LL(0x0cd2d26fd2debdb9), LL(0x0ef5f5f3f5fb06f7), + LL(0x967979f979ef80f2), LL(0x306f6fa16f5fcede), LL(0x6d91917e91fcef3f), LL(0xf852525552aa07a4), + LL(0x4760609d6027fdc0), LL(0x35bcbccabc897665), LL(0x379b9b569baccd2b), LL(0x8a8e8e028e048c01), + LL(0xd2a3a3b6a371155b), LL(0x6c0c0c300c603c18), LL(0x847b7bf17bff8af6), LL(0x803535d435b5e16a), + LL(0xf51d1d741de8693a), LL(0xb3e0e0a7e05347dd), LL(0x21d7d77bd7f6acb3), LL(0x9cc2c22fc25eed99), + LL(0x432e2eb82e6d965c), LL(0x294b4b314b627a96), LL(0x5dfefedffea321e1), LL(0xd5575741578216ae), + LL(0xbd15155415a8412a), LL(0xe87777c1779fb6ee), LL(0x923737dc37a5eb6e), LL(0x9ee5e5b3e57b56d7), + LL(0x139f9f469f8cd923), LL(0x23f0f0e7f0d317fd), LL(0x204a4a354a6a7f94), LL(0x44dada4fda9e95a9), + LL(0xa258587d58fa25b0), LL(0xcfc9c903c906ca8f), LL(0x7c2929a429558d52), LL(0x5a0a0a280a502214), + LL(0x50b1b1feb1e14f7f), LL(0xc9a0a0baa0691a5d), LL(0x146b6bb16b7fdad6), LL(0xd985852e855cab17), + LL(0x3cbdbdcebd817367), LL(0x8f5d5d695dd234ba), LL(0x9010104010805020), LL(0x07f4f4f7f4f303f5), + LL(0xddcbcb0bcb16c08b), LL(0xd33e3ef83eedc67c), LL(0x2d0505140528110a), LL(0x78676781671fe6ce), + LL(0x97e4e4b7e47353d5), LL(0x0227279c2725bb4e), LL(0x7341411941325882), LL(0xa78b8b168b2c9d0b), + LL(0xf6a7a7a6a7510153), LL(0xb27d7de97dcf94fa), LL(0x4995956e95dcfb37), LL(0x56d8d847d88e9fad), + LL(0x70fbfbcbfb8b30eb), LL(0xcdeeee9fee2371c1), LL(0xbb7c7ced7cc791f8), LL(0x716666856617e3cc), + LL(0x7bdddd53dda68ea7), LL(0xaf17175c17b84b2e), LL(0x454747014702468e), LL(0x1a9e9e429e84dc21), + LL(0xd4caca0fca1ec589), LL(0x582d2db42d75995a), LL(0x2ebfbfc6bf917963), LL(0x3f07071c07381b0e), + LL(0xacadad8ead012347), LL(0xb05a5a755aea2fb4), LL(0xef838336836cb51b), LL(0xb63333cc3385ff66), + LL(0x5c636391633ff2c6), LL(0x1202020802100a04), LL(0x93aaaa92aa393849), LL(0xde7171d971afa8e2), + LL(0xc6c8c807c80ecf8d), LL(0xd119196419c87d32), LL(0x3b49493949727092), LL(0x5fd9d943d9869aaf), + LL(0x31f2f2eff2c31df9), LL(0xa8e3e3abe34b48db), LL(0xb95b5b715be22ab6), LL(0xbc88881a8834920d), + LL(0x3e9a9a529aa4c829), LL(0x0b262698262dbe4c), LL(0xbf3232c8328dfa64), LL(0x59b0b0fab0e94a7d), + LL(0xf2e9e983e91b6acf), LL(0x770f0f3c0f78331e), LL(0x33d5d573d5e6a6b7), LL(0xf480803a8074ba1d), + LL(0x27bebec2be997c61), LL(0xebcdcd13cd26de87), LL(0x893434d034bde468), LL(0x3248483d487a7590), + LL(0x54ffffdbffab24e3), LL(0x8d7a7af57af78ff4), LL(0x6490907a90f4ea3d), LL(0x9d5f5f615fc23ebe), + LL(0x3d202080201da040), LL(0x0f6868bd6867d5d0), LL(0xca1a1a681ad07234), LL(0xb7aeae82ae192c41), + LL(0x7db4b4eab4c95e75), LL(0xce54544d549a19a8), LL(0x7f93937693ece53b), LL(0x2f222288220daa44), + LL(0x6364648d6407e9c8), LL(0x2af1f1e3f1db12ff), LL(0xcc7373d173bfa2e6), LL(0x8212124812905a24), + LL(0x7a40401d403a5d80), LL(0x4808082008402810), LL(0x95c3c32bc356e89b), LL(0xdfecec97ec337bc5), + LL(0x4ddbdb4bdb9690ab), LL(0xc0a1a1bea1611f5f), LL(0x918d8d0e8d1c8307), LL(0xc83d3df43df5c97a), + LL(0x5b97976697ccf133), LL(0x0000000000000000), LL(0xf9cfcf1bcf36d483), LL(0x6e2b2bac2b458756), + LL(0xe17676c57697b3ec), LL(0xe68282328264b019), LL(0x28d6d67fd6fea9b1), LL(0xc31b1b6c1bd87736), + LL(0x74b5b5eeb5c15b77), LL(0xbeafaf86af112943), LL(0x1d6a6ab56a77dfd4), LL(0xea50505d50ba0da0), + LL(0x5745450945124c8a), LL(0x38f3f3ebf3cb18fb), LL(0xad3030c0309df060), LL(0xc4efef9bef2b74c3), + LL(0xda3f3ffc3fe5c37e), LL(0xc755554955921caa), LL(0xdba2a2b2a2791059), LL(0xe9eaea8fea0365c9), + LL(0x6a656589650fecca), LL(0x03babad2bab96869), LL(0x4a2f2fbc2f65935e), LL(0x8ec0c027c04ee79d), + LL(0x60dede5fdebe81a1), LL(0xfc1c1c701ce06c38), LL(0x46fdfdd3fdbb2ee7), LL(0x1f4d4d294d52649a), + LL(0x7692927292e4e039), LL(0xfa7575c9758fbcea), LL(0x3606061806301e0c), LL(0xae8a8a128a249809), + LL(0x4bb2b2f2b2f94079), LL(0x85e6e6bfe66359d1), LL(0x7e0e0e380e70361c), LL(0xe71f1f7c1ff8633e), + LL(0x556262956237f7c4), LL(0x3ad4d477d4eea3b5), LL(0x81a8a89aa829324d), LL(0x5296966296c4f431), + LL(0x62f9f9c3f99b3aef), LL(0xa3c5c533c566f697), LL(0x102525942535b14a), LL(0xab59597959f220b2), + LL(0xd084842a8454ae15), LL(0xc57272d572b7a7e4), LL(0xec3939e439d5dd72), LL(0x164c4c2d4c5a6198), + LL(0x945e5e655eca3bbc), LL(0x9f7878fd78e785f0), LL(0xe53838e038ddd870), LL(0x988c8c0a8c148605), + LL(0x17d1d163d1c6b2bf), LL(0xe4a5a5aea5410b57), LL(0xa1e2e2afe2434dd9), LL(0x4e616199612ff8c2), + LL(0x42b3b3f6b3f1457b), LL(0x342121842115a542), LL(0x089c9c4a9c94d625), LL(0xee1e1e781ef0663c), + LL(0x6143431143225286), LL(0xb1c7c73bc776fc93), LL(0x4ffcfcd7fcb32be5), LL(0x2404041004201408), + LL(0xe351515951b208a2), LL(0x2599995e99bcc72f), LL(0x226d6da96d4fc4da), LL(0x650d0d340d68391a), + LL(0x79fafacffa8335e9), LL(0x69dfdf5bdfb684a3), LL(0xa97e7ee57ed79bfc), LL(0x19242490243db448), + LL(0xfe3b3bec3bc5d776), LL(0x9aabab96ab313d4b), LL(0xf0cece1fce3ed181), LL(0x9911114411885522), + LL(0x838f8f068f0c8903), LL(0x044e4e254e4a6b9c), LL(0x66b7b7e6b7d15173), LL(0xe0ebeb8beb0b60cb), + LL(0xc13c3cf03cfdcc78), LL(0xfd81813e817cbf1f), LL(0x4094946a94d4fe35), LL(0x1cf7f7fbf7eb0cf3), + LL(0x18b9b9deb9a1676f), LL(0x8b13134c13985f26), LL(0x512c2cb02c7d9c58), LL(0x05d3d36bd3d6b8bb), + LL(0x8ce7e7bbe76b5cd3), LL(0x396e6ea56e57cbdc), LL(0xaac4c437c46ef395), LL(0x1b03030c03180f06), + LL(0xdc565645568a13ac), LL(0x5e44440d441a4988), LL(0xa07f7fe17fdf9efe), LL(0x88a9a99ea921374f), + LL(0x672a2aa82a4d8254), LL(0x0abbbbd6bbb16d6b), LL(0x87c1c123c146e29f), LL(0xf153535153a202a6), + LL(0x72dcdc57dcae8ba5), LL(0x530b0b2c0b582716), LL(0x019d9d4e9d9cd327), LL(0x2b6c6cad6c47c1d8), + LL(0xa43131c43195f562), LL(0xf37474cd7487b9e8), LL(0x15f6f6fff6e309f1), LL(0x4c464605460a438c), + LL(0xa5acac8aac092645), LL(0xb589891e893c970f), LL(0xb414145014a04428), LL(0xbae1e1a3e15b42df), + LL(0xa616165816b04e2c), LL(0xf73a3ae83acdd274), LL(0x066969b9696fd0d2), LL(0x4109092409482d12), + LL(0xd77070dd70a7ade0), LL(0x6fb6b6e2b6d95471), LL(0x1ed0d067d0ceb7bd), LL(0xd6eded93ed3b7ec7), + LL(0xe2cccc17cc2edb85), LL(0x68424215422a5784), LL(0x2c98985a98b4c22d), LL(0xeda4a4aaa4490e55), + LL(0x752828a0285d8850), LL(0x865c5c6d5cda31b8), LL(0x6bf8f8c7f8933fed), LL(0xc28686228644a411), +}; + +static const uint64_t C2[256] = { + LL(0x30d818186018c078), LL(0x462623238c2305af), LL(0x91b8c6c63fc67ef9), LL(0xcdfbe8e887e8136f), + LL(0x13cb878726874ca1), LL(0x6d11b8b8dab8a962), LL(0x0209010104010805), LL(0x9e0d4f4f214f426e), + LL(0x6c9b3636d836adee), LL(0x51ffa6a6a2a65904), LL(0xb90cd2d26fd2debd), LL(0xf70ef5f5f3f5fb06), + LL(0xf2967979f979ef80), LL(0xde306f6fa16f5fce), LL(0x3f6d91917e91fcef), LL(0xa4f852525552aa07), + LL(0xc04760609d6027fd), LL(0x6535bcbccabc8976), LL(0x2b379b9b569baccd), LL(0x018a8e8e028e048c), + LL(0x5bd2a3a3b6a37115), LL(0x186c0c0c300c603c), LL(0xf6847b7bf17bff8a), LL(0x6a803535d435b5e1), + LL(0x3af51d1d741de869), LL(0xddb3e0e0a7e05347), LL(0xb321d7d77bd7f6ac), LL(0x999cc2c22fc25eed), + LL(0x5c432e2eb82e6d96), LL(0x96294b4b314b627a), LL(0xe15dfefedffea321), LL(0xaed5575741578216), + LL(0x2abd15155415a841), LL(0xeee87777c1779fb6), LL(0x6e923737dc37a5eb), LL(0xd79ee5e5b3e57b56), + LL(0x23139f9f469f8cd9), LL(0xfd23f0f0e7f0d317), LL(0x94204a4a354a6a7f), LL(0xa944dada4fda9e95), + LL(0xb0a258587d58fa25), LL(0x8fcfc9c903c906ca), LL(0x527c2929a429558d), LL(0x145a0a0a280a5022), + LL(0x7f50b1b1feb1e14f), LL(0x5dc9a0a0baa0691a), LL(0xd6146b6bb16b7fda), LL(0x17d985852e855cab), + LL(0x673cbdbdcebd8173), LL(0xba8f5d5d695dd234), LL(0x2090101040108050), LL(0xf507f4f4f7f4f303), + LL(0x8bddcbcb0bcb16c0), LL(0x7cd33e3ef83eedc6), LL(0x0a2d050514052811), LL(0xce78676781671fe6), + LL(0xd597e4e4b7e47353), LL(0x4e0227279c2725bb), LL(0x8273414119413258), LL(0x0ba78b8b168b2c9d), + LL(0x53f6a7a7a6a75101), LL(0xfab27d7de97dcf94), LL(0x374995956e95dcfb), LL(0xad56d8d847d88e9f), + LL(0xeb70fbfbcbfb8b30), LL(0xc1cdeeee9fee2371), LL(0xf8bb7c7ced7cc791), LL(0xcc716666856617e3), + LL(0xa77bdddd53dda68e), LL(0x2eaf17175c17b84b), LL(0x8e45474701470246), LL(0x211a9e9e429e84dc), + LL(0x89d4caca0fca1ec5), LL(0x5a582d2db42d7599), LL(0x632ebfbfc6bf9179), LL(0x0e3f07071c07381b), + LL(0x47acadad8ead0123), LL(0xb4b05a5a755aea2f), LL(0x1bef838336836cb5), LL(0x66b63333cc3385ff), + LL(0xc65c636391633ff2), LL(0x041202020802100a), LL(0x4993aaaa92aa3938), LL(0xe2de7171d971afa8), + LL(0x8dc6c8c807c80ecf), LL(0x32d119196419c87d), LL(0x923b494939497270), LL(0xaf5fd9d943d9869a), + LL(0xf931f2f2eff2c31d), LL(0xdba8e3e3abe34b48), LL(0xb6b95b5b715be22a), LL(0x0dbc88881a883492), + LL(0x293e9a9a529aa4c8), LL(0x4c0b262698262dbe), LL(0x64bf3232c8328dfa), LL(0x7d59b0b0fab0e94a), + LL(0xcff2e9e983e91b6a), LL(0x1e770f0f3c0f7833), LL(0xb733d5d573d5e6a6), LL(0x1df480803a8074ba), + LL(0x6127bebec2be997c), LL(0x87ebcdcd13cd26de), LL(0x68893434d034bde4), LL(0x903248483d487a75), + LL(0xe354ffffdbffab24), LL(0xf48d7a7af57af78f), LL(0x3d6490907a90f4ea), LL(0xbe9d5f5f615fc23e), + LL(0x403d202080201da0), LL(0xd00f6868bd6867d5), LL(0x34ca1a1a681ad072), LL(0x41b7aeae82ae192c), + LL(0x757db4b4eab4c95e), LL(0xa8ce54544d549a19), LL(0x3b7f93937693ece5), LL(0x442f222288220daa), + LL(0xc86364648d6407e9), LL(0xff2af1f1e3f1db12), LL(0xe6cc7373d173bfa2), LL(0x248212124812905a), + LL(0x807a40401d403a5d), LL(0x1048080820084028), LL(0x9b95c3c32bc356e8), LL(0xc5dfecec97ec337b), + LL(0xab4ddbdb4bdb9690), LL(0x5fc0a1a1bea1611f), LL(0x07918d8d0e8d1c83), LL(0x7ac83d3df43df5c9), + LL(0x335b97976697ccf1), LL(0x0000000000000000), LL(0x83f9cfcf1bcf36d4), LL(0x566e2b2bac2b4587), + LL(0xece17676c57697b3), LL(0x19e68282328264b0), LL(0xb128d6d67fd6fea9), LL(0x36c31b1b6c1bd877), + LL(0x7774b5b5eeb5c15b), LL(0x43beafaf86af1129), LL(0xd41d6a6ab56a77df), LL(0xa0ea50505d50ba0d), + LL(0x8a5745450945124c), LL(0xfb38f3f3ebf3cb18), LL(0x60ad3030c0309df0), LL(0xc3c4efef9bef2b74), + LL(0x7eda3f3ffc3fe5c3), LL(0xaac755554955921c), LL(0x59dba2a2b2a27910), LL(0xc9e9eaea8fea0365), + LL(0xca6a656589650fec), LL(0x6903babad2bab968), LL(0x5e4a2f2fbc2f6593), LL(0x9d8ec0c027c04ee7), + LL(0xa160dede5fdebe81), LL(0x38fc1c1c701ce06c), LL(0xe746fdfdd3fdbb2e), LL(0x9a1f4d4d294d5264), + LL(0x397692927292e4e0), LL(0xeafa7575c9758fbc), LL(0x0c3606061806301e), LL(0x09ae8a8a128a2498), + LL(0x794bb2b2f2b2f940), LL(0xd185e6e6bfe66359), LL(0x1c7e0e0e380e7036), LL(0x3ee71f1f7c1ff863), + LL(0xc4556262956237f7), LL(0xb53ad4d477d4eea3), LL(0x4d81a8a89aa82932), LL(0x315296966296c4f4), + LL(0xef62f9f9c3f99b3a), LL(0x97a3c5c533c566f6), LL(0x4a102525942535b1), LL(0xb2ab59597959f220), + LL(0x15d084842a8454ae), LL(0xe4c57272d572b7a7), LL(0x72ec3939e439d5dd), LL(0x98164c4c2d4c5a61), + LL(0xbc945e5e655eca3b), LL(0xf09f7878fd78e785), LL(0x70e53838e038ddd8), LL(0x05988c8c0a8c1486), + LL(0xbf17d1d163d1c6b2), LL(0x57e4a5a5aea5410b), LL(0xd9a1e2e2afe2434d), LL(0xc24e616199612ff8), + LL(0x7b42b3b3f6b3f145), LL(0x42342121842115a5), LL(0x25089c9c4a9c94d6), LL(0x3cee1e1e781ef066), + LL(0x8661434311432252), LL(0x93b1c7c73bc776fc), LL(0xe54ffcfcd7fcb32b), LL(0x0824040410042014), + LL(0xa2e351515951b208), LL(0x2f2599995e99bcc7), LL(0xda226d6da96d4fc4), LL(0x1a650d0d340d6839), + LL(0xe979fafacffa8335), LL(0xa369dfdf5bdfb684), LL(0xfca97e7ee57ed79b), LL(0x4819242490243db4), + LL(0x76fe3b3bec3bc5d7), LL(0x4b9aabab96ab313d), LL(0x81f0cece1fce3ed1), LL(0x2299111144118855), + LL(0x03838f8f068f0c89), LL(0x9c044e4e254e4a6b), LL(0x7366b7b7e6b7d151), LL(0xcbe0ebeb8beb0b60), + LL(0x78c13c3cf03cfdcc), LL(0x1ffd81813e817cbf), LL(0x354094946a94d4fe), LL(0xf31cf7f7fbf7eb0c), + LL(0x6f18b9b9deb9a167), LL(0x268b13134c13985f), LL(0x58512c2cb02c7d9c), LL(0xbb05d3d36bd3d6b8), + LL(0xd38ce7e7bbe76b5c), LL(0xdc396e6ea56e57cb), LL(0x95aac4c437c46ef3), LL(0x061b03030c03180f), + LL(0xacdc565645568a13), LL(0x885e44440d441a49), LL(0xfea07f7fe17fdf9e), LL(0x4f88a9a99ea92137), + LL(0x54672a2aa82a4d82), LL(0x6b0abbbbd6bbb16d), LL(0x9f87c1c123c146e2), LL(0xa6f153535153a202), + LL(0xa572dcdc57dcae8b), LL(0x16530b0b2c0b5827), LL(0x27019d9d4e9d9cd3), LL(0xd82b6c6cad6c47c1), + LL(0x62a43131c43195f5), LL(0xe8f37474cd7487b9), LL(0xf115f6f6fff6e309), LL(0x8c4c464605460a43), + LL(0x45a5acac8aac0926), LL(0x0fb589891e893c97), LL(0x28b414145014a044), LL(0xdfbae1e1a3e15b42), + LL(0x2ca616165816b04e), LL(0x74f73a3ae83acdd2), LL(0xd2066969b9696fd0), LL(0x124109092409482d), + LL(0xe0d77070dd70a7ad), LL(0x716fb6b6e2b6d954), LL(0xbd1ed0d067d0ceb7), LL(0xc7d6eded93ed3b7e), + LL(0x85e2cccc17cc2edb), LL(0x8468424215422a57), LL(0x2d2c98985a98b4c2), LL(0x55eda4a4aaa4490e), + LL(0x50752828a0285d88), LL(0xb8865c5c6d5cda31), LL(0xed6bf8f8c7f8933f), LL(0x11c28686228644a4), +}; + +static const uint64_t C3[256] = { + LL(0x7830d818186018c0), LL(0xaf462623238c2305), LL(0xf991b8c6c63fc67e), LL(0x6fcdfbe8e887e813), + LL(0xa113cb878726874c), LL(0x626d11b8b8dab8a9), LL(0x0502090101040108), LL(0x6e9e0d4f4f214f42), + LL(0xee6c9b3636d836ad), LL(0x0451ffa6a6a2a659), LL(0xbdb90cd2d26fd2de), LL(0x06f70ef5f5f3f5fb), + LL(0x80f2967979f979ef), LL(0xcede306f6fa16f5f), LL(0xef3f6d91917e91fc), LL(0x07a4f852525552aa), + LL(0xfdc04760609d6027), LL(0x766535bcbccabc89), LL(0xcd2b379b9b569bac), LL(0x8c018a8e8e028e04), + LL(0x155bd2a3a3b6a371), LL(0x3c186c0c0c300c60), LL(0x8af6847b7bf17bff), LL(0xe16a803535d435b5), + LL(0x693af51d1d741de8), LL(0x47ddb3e0e0a7e053), LL(0xacb321d7d77bd7f6), LL(0xed999cc2c22fc25e), + LL(0x965c432e2eb82e6d), LL(0x7a96294b4b314b62), LL(0x21e15dfefedffea3), LL(0x16aed55757415782), + LL(0x412abd15155415a8), LL(0xb6eee87777c1779f), LL(0xeb6e923737dc37a5), LL(0x56d79ee5e5b3e57b), + LL(0xd923139f9f469f8c), LL(0x17fd23f0f0e7f0d3), LL(0x7f94204a4a354a6a), LL(0x95a944dada4fda9e), + LL(0x25b0a258587d58fa), LL(0xca8fcfc9c903c906), LL(0x8d527c2929a42955), LL(0x22145a0a0a280a50), + LL(0x4f7f50b1b1feb1e1), LL(0x1a5dc9a0a0baa069), LL(0xdad6146b6bb16b7f), LL(0xab17d985852e855c), + LL(0x73673cbdbdcebd81), LL(0x34ba8f5d5d695dd2), LL(0x5020901010401080), LL(0x03f507f4f4f7f4f3), + LL(0xc08bddcbcb0bcb16), LL(0xc67cd33e3ef83eed), LL(0x110a2d0505140528), LL(0xe6ce78676781671f), + LL(0x53d597e4e4b7e473), LL(0xbb4e0227279c2725), LL(0x5882734141194132), LL(0x9d0ba78b8b168b2c), + LL(0x0153f6a7a7a6a751), LL(0x94fab27d7de97dcf), LL(0xfb374995956e95dc), LL(0x9fad56d8d847d88e), + LL(0x30eb70fbfbcbfb8b), LL(0x71c1cdeeee9fee23), LL(0x91f8bb7c7ced7cc7), LL(0xe3cc716666856617), + LL(0x8ea77bdddd53dda6), LL(0x4b2eaf17175c17b8), LL(0x468e454747014702), LL(0xdc211a9e9e429e84), + LL(0xc589d4caca0fca1e), LL(0x995a582d2db42d75), LL(0x79632ebfbfc6bf91), LL(0x1b0e3f07071c0738), + LL(0x2347acadad8ead01), LL(0x2fb4b05a5a755aea), LL(0xb51bef838336836c), LL(0xff66b63333cc3385), + LL(0xf2c65c636391633f), LL(0x0a04120202080210), LL(0x384993aaaa92aa39), LL(0xa8e2de7171d971af), + LL(0xcf8dc6c8c807c80e), LL(0x7d32d119196419c8), LL(0x70923b4949394972), LL(0x9aaf5fd9d943d986), + LL(0x1df931f2f2eff2c3), LL(0x48dba8e3e3abe34b), LL(0x2ab6b95b5b715be2), LL(0x920dbc88881a8834), + LL(0xc8293e9a9a529aa4), LL(0xbe4c0b262698262d), LL(0xfa64bf3232c8328d), LL(0x4a7d59b0b0fab0e9), + LL(0x6acff2e9e983e91b), LL(0x331e770f0f3c0f78), LL(0xa6b733d5d573d5e6), LL(0xba1df480803a8074), + LL(0x7c6127bebec2be99), LL(0xde87ebcdcd13cd26), LL(0xe468893434d034bd), LL(0x75903248483d487a), + LL(0x24e354ffffdbffab), LL(0x8ff48d7a7af57af7), LL(0xea3d6490907a90f4), LL(0x3ebe9d5f5f615fc2), + LL(0xa0403d202080201d), LL(0xd5d00f6868bd6867), LL(0x7234ca1a1a681ad0), LL(0x2c41b7aeae82ae19), + LL(0x5e757db4b4eab4c9), LL(0x19a8ce54544d549a), LL(0xe53b7f93937693ec), LL(0xaa442f222288220d), + LL(0xe9c86364648d6407), LL(0x12ff2af1f1e3f1db), LL(0xa2e6cc7373d173bf), LL(0x5a24821212481290), + LL(0x5d807a40401d403a), LL(0x2810480808200840), LL(0xe89b95c3c32bc356), LL(0x7bc5dfecec97ec33), + LL(0x90ab4ddbdb4bdb96), LL(0x1f5fc0a1a1bea161), LL(0x8307918d8d0e8d1c), LL(0xc97ac83d3df43df5), + LL(0xf1335b97976697cc), LL(0x0000000000000000), LL(0xd483f9cfcf1bcf36), LL(0x87566e2b2bac2b45), + LL(0xb3ece17676c57697), LL(0xb019e68282328264), LL(0xa9b128d6d67fd6fe), LL(0x7736c31b1b6c1bd8), + LL(0x5b7774b5b5eeb5c1), LL(0x2943beafaf86af11), LL(0xdfd41d6a6ab56a77), LL(0x0da0ea50505d50ba), + LL(0x4c8a574545094512), LL(0x18fb38f3f3ebf3cb), LL(0xf060ad3030c0309d), LL(0x74c3c4efef9bef2b), + LL(0xc37eda3f3ffc3fe5), LL(0x1caac75555495592), LL(0x1059dba2a2b2a279), LL(0x65c9e9eaea8fea03), + LL(0xecca6a656589650f), LL(0x686903babad2bab9), LL(0x935e4a2f2fbc2f65), LL(0xe79d8ec0c027c04e), + LL(0x81a160dede5fdebe), LL(0x6c38fc1c1c701ce0), LL(0x2ee746fdfdd3fdbb), LL(0x649a1f4d4d294d52), + LL(0xe0397692927292e4), LL(0xbceafa7575c9758f), LL(0x1e0c360606180630), LL(0x9809ae8a8a128a24), + LL(0x40794bb2b2f2b2f9), LL(0x59d185e6e6bfe663), LL(0x361c7e0e0e380e70), LL(0x633ee71f1f7c1ff8), + LL(0xf7c4556262956237), LL(0xa3b53ad4d477d4ee), LL(0x324d81a8a89aa829), LL(0xf4315296966296c4), + LL(0x3aef62f9f9c3f99b), LL(0xf697a3c5c533c566), LL(0xb14a102525942535), LL(0x20b2ab59597959f2), + LL(0xae15d084842a8454), LL(0xa7e4c57272d572b7), LL(0xdd72ec3939e439d5), LL(0x6198164c4c2d4c5a), + LL(0x3bbc945e5e655eca), LL(0x85f09f7878fd78e7), LL(0xd870e53838e038dd), LL(0x8605988c8c0a8c14), + LL(0xb2bf17d1d163d1c6), LL(0x0b57e4a5a5aea541), LL(0x4dd9a1e2e2afe243), LL(0xf8c24e616199612f), + LL(0x457b42b3b3f6b3f1), LL(0xa542342121842115), LL(0xd625089c9c4a9c94), LL(0x663cee1e1e781ef0), + LL(0x5286614343114322), LL(0xfc93b1c7c73bc776), LL(0x2be54ffcfcd7fcb3), LL(0x1408240404100420), + LL(0x08a2e351515951b2), LL(0xc72f2599995e99bc), LL(0xc4da226d6da96d4f), LL(0x391a650d0d340d68), + LL(0x35e979fafacffa83), LL(0x84a369dfdf5bdfb6), LL(0x9bfca97e7ee57ed7), LL(0xb44819242490243d), + LL(0xd776fe3b3bec3bc5), LL(0x3d4b9aabab96ab31), LL(0xd181f0cece1fce3e), LL(0x5522991111441188), + LL(0x8903838f8f068f0c), LL(0x6b9c044e4e254e4a), LL(0x517366b7b7e6b7d1), LL(0x60cbe0ebeb8beb0b), + LL(0xcc78c13c3cf03cfd), LL(0xbf1ffd81813e817c), LL(0xfe354094946a94d4), LL(0x0cf31cf7f7fbf7eb), + LL(0x676f18b9b9deb9a1), LL(0x5f268b13134c1398), LL(0x9c58512c2cb02c7d), LL(0xb8bb05d3d36bd3d6), + LL(0x5cd38ce7e7bbe76b), LL(0xcbdc396e6ea56e57), LL(0xf395aac4c437c46e), LL(0x0f061b03030c0318), + LL(0x13acdc565645568a), LL(0x49885e44440d441a), LL(0x9efea07f7fe17fdf), LL(0x374f88a9a99ea921), + LL(0x8254672a2aa82a4d), LL(0x6d6b0abbbbd6bbb1), LL(0xe29f87c1c123c146), LL(0x02a6f153535153a2), + LL(0x8ba572dcdc57dcae), LL(0x2716530b0b2c0b58), LL(0xd327019d9d4e9d9c), LL(0xc1d82b6c6cad6c47), + LL(0xf562a43131c43195), LL(0xb9e8f37474cd7487), LL(0x09f115f6f6fff6e3), LL(0x438c4c464605460a), + LL(0x2645a5acac8aac09), LL(0x970fb589891e893c), LL(0x4428b414145014a0), LL(0x42dfbae1e1a3e15b), + LL(0x4e2ca616165816b0), LL(0xd274f73a3ae83acd), LL(0xd0d2066969b9696f), LL(0x2d12410909240948), + LL(0xade0d77070dd70a7), LL(0x54716fb6b6e2b6d9), LL(0xb7bd1ed0d067d0ce), LL(0x7ec7d6eded93ed3b), + LL(0xdb85e2cccc17cc2e), LL(0x578468424215422a), LL(0xc22d2c98985a98b4), LL(0x0e55eda4a4aaa449), + LL(0x8850752828a0285d), LL(0x31b8865c5c6d5cda), LL(0x3fed6bf8f8c7f893), LL(0xa411c28686228644), +}; + +static const uint64_t C4[256] = { + LL(0xc07830d818186018), LL(0x05af462623238c23), LL(0x7ef991b8c6c63fc6), LL(0x136fcdfbe8e887e8), + LL(0x4ca113cb87872687), LL(0xa9626d11b8b8dab8), LL(0x0805020901010401), LL(0x426e9e0d4f4f214f), + LL(0xadee6c9b3636d836), LL(0x590451ffa6a6a2a6), LL(0xdebdb90cd2d26fd2), LL(0xfb06f70ef5f5f3f5), + LL(0xef80f2967979f979), LL(0x5fcede306f6fa16f), LL(0xfcef3f6d91917e91), LL(0xaa07a4f852525552), + LL(0x27fdc04760609d60), LL(0x89766535bcbccabc), LL(0xaccd2b379b9b569b), LL(0x048c018a8e8e028e), + LL(0x71155bd2a3a3b6a3), LL(0x603c186c0c0c300c), LL(0xff8af6847b7bf17b), LL(0xb5e16a803535d435), + LL(0xe8693af51d1d741d), LL(0x5347ddb3e0e0a7e0), LL(0xf6acb321d7d77bd7), LL(0x5eed999cc2c22fc2), + LL(0x6d965c432e2eb82e), LL(0x627a96294b4b314b), LL(0xa321e15dfefedffe), LL(0x8216aed557574157), + LL(0xa8412abd15155415), LL(0x9fb6eee87777c177), LL(0xa5eb6e923737dc37), LL(0x7b56d79ee5e5b3e5), + LL(0x8cd923139f9f469f), LL(0xd317fd23f0f0e7f0), LL(0x6a7f94204a4a354a), LL(0x9e95a944dada4fda), + LL(0xfa25b0a258587d58), LL(0x06ca8fcfc9c903c9), LL(0x558d527c2929a429), LL(0x5022145a0a0a280a), + LL(0xe14f7f50b1b1feb1), LL(0x691a5dc9a0a0baa0), LL(0x7fdad6146b6bb16b), LL(0x5cab17d985852e85), + LL(0x8173673cbdbdcebd), LL(0xd234ba8f5d5d695d), LL(0x8050209010104010), LL(0xf303f507f4f4f7f4), + LL(0x16c08bddcbcb0bcb), LL(0xedc67cd33e3ef83e), LL(0x28110a2d05051405), LL(0x1fe6ce7867678167), + LL(0x7353d597e4e4b7e4), LL(0x25bb4e0227279c27), LL(0x3258827341411941), LL(0x2c9d0ba78b8b168b), + LL(0x510153f6a7a7a6a7), LL(0xcf94fab27d7de97d), LL(0xdcfb374995956e95), LL(0x8e9fad56d8d847d8), + LL(0x8b30eb70fbfbcbfb), LL(0x2371c1cdeeee9fee), LL(0xc791f8bb7c7ced7c), LL(0x17e3cc7166668566), + LL(0xa68ea77bdddd53dd), LL(0xb84b2eaf17175c17), LL(0x02468e4547470147), LL(0x84dc211a9e9e429e), + LL(0x1ec589d4caca0fca), LL(0x75995a582d2db42d), LL(0x9179632ebfbfc6bf), LL(0x381b0e3f07071c07), + LL(0x012347acadad8ead), LL(0xea2fb4b05a5a755a), LL(0x6cb51bef83833683), LL(0x85ff66b63333cc33), + LL(0x3ff2c65c63639163), LL(0x100a041202020802), LL(0x39384993aaaa92aa), LL(0xafa8e2de7171d971), + LL(0x0ecf8dc6c8c807c8), LL(0xc87d32d119196419), LL(0x7270923b49493949), LL(0x869aaf5fd9d943d9), + LL(0xc31df931f2f2eff2), LL(0x4b48dba8e3e3abe3), LL(0xe22ab6b95b5b715b), LL(0x34920dbc88881a88), + LL(0xa4c8293e9a9a529a), LL(0x2dbe4c0b26269826), LL(0x8dfa64bf3232c832), LL(0xe94a7d59b0b0fab0), + LL(0x1b6acff2e9e983e9), LL(0x78331e770f0f3c0f), LL(0xe6a6b733d5d573d5), LL(0x74ba1df480803a80), + LL(0x997c6127bebec2be), LL(0x26de87ebcdcd13cd), LL(0xbde468893434d034), LL(0x7a75903248483d48), + LL(0xab24e354ffffdbff), LL(0xf78ff48d7a7af57a), LL(0xf4ea3d6490907a90), LL(0xc23ebe9d5f5f615f), + LL(0x1da0403d20208020), LL(0x67d5d00f6868bd68), LL(0xd07234ca1a1a681a), LL(0x192c41b7aeae82ae), + LL(0xc95e757db4b4eab4), LL(0x9a19a8ce54544d54), LL(0xece53b7f93937693), LL(0x0daa442f22228822), + LL(0x07e9c86364648d64), LL(0xdb12ff2af1f1e3f1), LL(0xbfa2e6cc7373d173), LL(0x905a248212124812), + LL(0x3a5d807a40401d40), LL(0x4028104808082008), LL(0x56e89b95c3c32bc3), LL(0x337bc5dfecec97ec), + LL(0x9690ab4ddbdb4bdb), LL(0x611f5fc0a1a1bea1), LL(0x1c8307918d8d0e8d), LL(0xf5c97ac83d3df43d), + LL(0xccf1335b97976697), LL(0x0000000000000000), LL(0x36d483f9cfcf1bcf), LL(0x4587566e2b2bac2b), + LL(0x97b3ece17676c576), LL(0x64b019e682823282), LL(0xfea9b128d6d67fd6), LL(0xd87736c31b1b6c1b), + LL(0xc15b7774b5b5eeb5), LL(0x112943beafaf86af), LL(0x77dfd41d6a6ab56a), LL(0xba0da0ea50505d50), + LL(0x124c8a5745450945), LL(0xcb18fb38f3f3ebf3), LL(0x9df060ad3030c030), LL(0x2b74c3c4efef9bef), + LL(0xe5c37eda3f3ffc3f), LL(0x921caac755554955), LL(0x791059dba2a2b2a2), LL(0x0365c9e9eaea8fea), + LL(0x0fecca6a65658965), LL(0xb9686903babad2ba), LL(0x65935e4a2f2fbc2f), LL(0x4ee79d8ec0c027c0), + LL(0xbe81a160dede5fde), LL(0xe06c38fc1c1c701c), LL(0xbb2ee746fdfdd3fd), LL(0x52649a1f4d4d294d), + LL(0xe4e0397692927292), LL(0x8fbceafa7575c975), LL(0x301e0c3606061806), LL(0x249809ae8a8a128a), + LL(0xf940794bb2b2f2b2), LL(0x6359d185e6e6bfe6), LL(0x70361c7e0e0e380e), LL(0xf8633ee71f1f7c1f), + LL(0x37f7c45562629562), LL(0xeea3b53ad4d477d4), LL(0x29324d81a8a89aa8), LL(0xc4f4315296966296), + LL(0x9b3aef62f9f9c3f9), LL(0x66f697a3c5c533c5), LL(0x35b14a1025259425), LL(0xf220b2ab59597959), + LL(0x54ae15d084842a84), LL(0xb7a7e4c57272d572), LL(0xd5dd72ec3939e439), LL(0x5a6198164c4c2d4c), + LL(0xca3bbc945e5e655e), LL(0xe785f09f7878fd78), LL(0xddd870e53838e038), LL(0x148605988c8c0a8c), + LL(0xc6b2bf17d1d163d1), LL(0x410b57e4a5a5aea5), LL(0x434dd9a1e2e2afe2), LL(0x2ff8c24e61619961), + LL(0xf1457b42b3b3f6b3), LL(0x15a5423421218421), LL(0x94d625089c9c4a9c), LL(0xf0663cee1e1e781e), + LL(0x2252866143431143), LL(0x76fc93b1c7c73bc7), LL(0xb32be54ffcfcd7fc), LL(0x2014082404041004), + LL(0xb208a2e351515951), LL(0xbcc72f2599995e99), LL(0x4fc4da226d6da96d), LL(0x68391a650d0d340d), + LL(0x8335e979fafacffa), LL(0xb684a369dfdf5bdf), LL(0xd79bfca97e7ee57e), LL(0x3db4481924249024), + LL(0xc5d776fe3b3bec3b), LL(0x313d4b9aabab96ab), LL(0x3ed181f0cece1fce), LL(0x8855229911114411), + LL(0x0c8903838f8f068f), LL(0x4a6b9c044e4e254e), LL(0xd1517366b7b7e6b7), LL(0x0b60cbe0ebeb8beb), + LL(0xfdcc78c13c3cf03c), LL(0x7cbf1ffd81813e81), LL(0xd4fe354094946a94), LL(0xeb0cf31cf7f7fbf7), + LL(0xa1676f18b9b9deb9), LL(0x985f268b13134c13), LL(0x7d9c58512c2cb02c), LL(0xd6b8bb05d3d36bd3), + LL(0x6b5cd38ce7e7bbe7), LL(0x57cbdc396e6ea56e), LL(0x6ef395aac4c437c4), LL(0x180f061b03030c03), + LL(0x8a13acdc56564556), LL(0x1a49885e44440d44), LL(0xdf9efea07f7fe17f), LL(0x21374f88a9a99ea9), + LL(0x4d8254672a2aa82a), LL(0xb16d6b0abbbbd6bb), LL(0x46e29f87c1c123c1), LL(0xa202a6f153535153), + LL(0xae8ba572dcdc57dc), LL(0x582716530b0b2c0b), LL(0x9cd327019d9d4e9d), LL(0x47c1d82b6c6cad6c), + LL(0x95f562a43131c431), LL(0x87b9e8f37474cd74), LL(0xe309f115f6f6fff6), LL(0x0a438c4c46460546), + LL(0x092645a5acac8aac), LL(0x3c970fb589891e89), LL(0xa04428b414145014), LL(0x5b42dfbae1e1a3e1), + LL(0xb04e2ca616165816), LL(0xcdd274f73a3ae83a), LL(0x6fd0d2066969b969), LL(0x482d124109092409), + LL(0xa7ade0d77070dd70), LL(0xd954716fb6b6e2b6), LL(0xceb7bd1ed0d067d0), LL(0x3b7ec7d6eded93ed), + LL(0x2edb85e2cccc17cc), LL(0x2a57846842421542), LL(0xb4c22d2c98985a98), LL(0x490e55eda4a4aaa4), + LL(0x5d8850752828a028), LL(0xda31b8865c5c6d5c), LL(0x933fed6bf8f8c7f8), LL(0x44a411c286862286), +}; + +static const uint64_t C5[256] = { + LL(0x18c07830d8181860), LL(0x2305af462623238c), LL(0xc67ef991b8c6c63f), LL(0xe8136fcdfbe8e887), + LL(0x874ca113cb878726), LL(0xb8a9626d11b8b8da), LL(0x0108050209010104), LL(0x4f426e9e0d4f4f21), + LL(0x36adee6c9b3636d8), LL(0xa6590451ffa6a6a2), LL(0xd2debdb90cd2d26f), LL(0xf5fb06f70ef5f5f3), + LL(0x79ef80f2967979f9), LL(0x6f5fcede306f6fa1), LL(0x91fcef3f6d91917e), LL(0x52aa07a4f8525255), + LL(0x6027fdc04760609d), LL(0xbc89766535bcbcca), LL(0x9baccd2b379b9b56), LL(0x8e048c018a8e8e02), + LL(0xa371155bd2a3a3b6), LL(0x0c603c186c0c0c30), LL(0x7bff8af6847b7bf1), LL(0x35b5e16a803535d4), + LL(0x1de8693af51d1d74), LL(0xe05347ddb3e0e0a7), LL(0xd7f6acb321d7d77b), LL(0xc25eed999cc2c22f), + LL(0x2e6d965c432e2eb8), LL(0x4b627a96294b4b31), LL(0xfea321e15dfefedf), LL(0x578216aed5575741), + LL(0x15a8412abd151554), LL(0x779fb6eee87777c1), LL(0x37a5eb6e923737dc), LL(0xe57b56d79ee5e5b3), + LL(0x9f8cd923139f9f46), LL(0xf0d317fd23f0f0e7), LL(0x4a6a7f94204a4a35), LL(0xda9e95a944dada4f), + LL(0x58fa25b0a258587d), LL(0xc906ca8fcfc9c903), LL(0x29558d527c2929a4), LL(0x0a5022145a0a0a28), + LL(0xb1e14f7f50b1b1fe), LL(0xa0691a5dc9a0a0ba), LL(0x6b7fdad6146b6bb1), LL(0x855cab17d985852e), + LL(0xbd8173673cbdbdce), LL(0x5dd234ba8f5d5d69), LL(0x1080502090101040), LL(0xf4f303f507f4f4f7), + LL(0xcb16c08bddcbcb0b), LL(0x3eedc67cd33e3ef8), LL(0x0528110a2d050514), LL(0x671fe6ce78676781), + LL(0xe47353d597e4e4b7), LL(0x2725bb4e0227279c), LL(0x4132588273414119), LL(0x8b2c9d0ba78b8b16), + LL(0xa7510153f6a7a7a6), LL(0x7dcf94fab27d7de9), LL(0x95dcfb374995956e), LL(0xd88e9fad56d8d847), + LL(0xfb8b30eb70fbfbcb), LL(0xee2371c1cdeeee9f), LL(0x7cc791f8bb7c7ced), LL(0x6617e3cc71666685), + LL(0xdda68ea77bdddd53), LL(0x17b84b2eaf17175c), LL(0x4702468e45474701), LL(0x9e84dc211a9e9e42), + LL(0xca1ec589d4caca0f), LL(0x2d75995a582d2db4), LL(0xbf9179632ebfbfc6), LL(0x07381b0e3f07071c), + LL(0xad012347acadad8e), LL(0x5aea2fb4b05a5a75), LL(0x836cb51bef838336), LL(0x3385ff66b63333cc), + LL(0x633ff2c65c636391), LL(0x02100a0412020208), LL(0xaa39384993aaaa92), LL(0x71afa8e2de7171d9), + LL(0xc80ecf8dc6c8c807), LL(0x19c87d32d1191964), LL(0x497270923b494939), LL(0xd9869aaf5fd9d943), + LL(0xf2c31df931f2f2ef), LL(0xe34b48dba8e3e3ab), LL(0x5be22ab6b95b5b71), LL(0x8834920dbc88881a), + LL(0x9aa4c8293e9a9a52), LL(0x262dbe4c0b262698), LL(0x328dfa64bf3232c8), LL(0xb0e94a7d59b0b0fa), + LL(0xe91b6acff2e9e983), LL(0x0f78331e770f0f3c), LL(0xd5e6a6b733d5d573), LL(0x8074ba1df480803a), + LL(0xbe997c6127bebec2), LL(0xcd26de87ebcdcd13), LL(0x34bde468893434d0), LL(0x487a75903248483d), + LL(0xffab24e354ffffdb), LL(0x7af78ff48d7a7af5), LL(0x90f4ea3d6490907a), LL(0x5fc23ebe9d5f5f61), + LL(0x201da0403d202080), LL(0x6867d5d00f6868bd), LL(0x1ad07234ca1a1a68), LL(0xae192c41b7aeae82), + LL(0xb4c95e757db4b4ea), LL(0x549a19a8ce54544d), LL(0x93ece53b7f939376), LL(0x220daa442f222288), + LL(0x6407e9c86364648d), LL(0xf1db12ff2af1f1e3), LL(0x73bfa2e6cc7373d1), LL(0x12905a2482121248), + LL(0x403a5d807a40401d), LL(0x0840281048080820), LL(0xc356e89b95c3c32b), LL(0xec337bc5dfecec97), + LL(0xdb9690ab4ddbdb4b), LL(0xa1611f5fc0a1a1be), LL(0x8d1c8307918d8d0e), LL(0x3df5c97ac83d3df4), + LL(0x97ccf1335b979766), LL(0x0000000000000000), LL(0xcf36d483f9cfcf1b), LL(0x2b4587566e2b2bac), + LL(0x7697b3ece17676c5), LL(0x8264b019e6828232), LL(0xd6fea9b128d6d67f), LL(0x1bd87736c31b1b6c), + LL(0xb5c15b7774b5b5ee), LL(0xaf112943beafaf86), LL(0x6a77dfd41d6a6ab5), LL(0x50ba0da0ea50505d), + LL(0x45124c8a57454509), LL(0xf3cb18fb38f3f3eb), LL(0x309df060ad3030c0), LL(0xef2b74c3c4efef9b), + LL(0x3fe5c37eda3f3ffc), LL(0x55921caac7555549), LL(0xa2791059dba2a2b2), LL(0xea0365c9e9eaea8f), + LL(0x650fecca6a656589), LL(0xbab9686903babad2), LL(0x2f65935e4a2f2fbc), LL(0xc04ee79d8ec0c027), + LL(0xdebe81a160dede5f), LL(0x1ce06c38fc1c1c70), LL(0xfdbb2ee746fdfdd3), LL(0x4d52649a1f4d4d29), + LL(0x92e4e03976929272), LL(0x758fbceafa7575c9), LL(0x06301e0c36060618), LL(0x8a249809ae8a8a12), + LL(0xb2f940794bb2b2f2), LL(0xe66359d185e6e6bf), LL(0x0e70361c7e0e0e38), LL(0x1ff8633ee71f1f7c), + LL(0x6237f7c455626295), LL(0xd4eea3b53ad4d477), LL(0xa829324d81a8a89a), LL(0x96c4f43152969662), + LL(0xf99b3aef62f9f9c3), LL(0xc566f697a3c5c533), LL(0x2535b14a10252594), LL(0x59f220b2ab595979), + LL(0x8454ae15d084842a), LL(0x72b7a7e4c57272d5), LL(0x39d5dd72ec3939e4), LL(0x4c5a6198164c4c2d), + LL(0x5eca3bbc945e5e65), LL(0x78e785f09f7878fd), LL(0x38ddd870e53838e0), LL(0x8c148605988c8c0a), + LL(0xd1c6b2bf17d1d163), LL(0xa5410b57e4a5a5ae), LL(0xe2434dd9a1e2e2af), LL(0x612ff8c24e616199), + LL(0xb3f1457b42b3b3f6), LL(0x2115a54234212184), LL(0x9c94d625089c9c4a), LL(0x1ef0663cee1e1e78), + LL(0x4322528661434311), LL(0xc776fc93b1c7c73b), LL(0xfcb32be54ffcfcd7), LL(0x0420140824040410), + LL(0x51b208a2e3515159), LL(0x99bcc72f2599995e), LL(0x6d4fc4da226d6da9), LL(0x0d68391a650d0d34), + LL(0xfa8335e979fafacf), LL(0xdfb684a369dfdf5b), LL(0x7ed79bfca97e7ee5), LL(0x243db44819242490), + LL(0x3bc5d776fe3b3bec), LL(0xab313d4b9aabab96), LL(0xce3ed181f0cece1f), LL(0x1188552299111144), + LL(0x8f0c8903838f8f06), LL(0x4e4a6b9c044e4e25), LL(0xb7d1517366b7b7e6), LL(0xeb0b60cbe0ebeb8b), + LL(0x3cfdcc78c13c3cf0), LL(0x817cbf1ffd81813e), LL(0x94d4fe354094946a), LL(0xf7eb0cf31cf7f7fb), + LL(0xb9a1676f18b9b9de), LL(0x13985f268b13134c), LL(0x2c7d9c58512c2cb0), LL(0xd3d6b8bb05d3d36b), + LL(0xe76b5cd38ce7e7bb), LL(0x6e57cbdc396e6ea5), LL(0xc46ef395aac4c437), LL(0x03180f061b03030c), + LL(0x568a13acdc565645), LL(0x441a49885e44440d), LL(0x7fdf9efea07f7fe1), LL(0xa921374f88a9a99e), + LL(0x2a4d8254672a2aa8), LL(0xbbb16d6b0abbbbd6), LL(0xc146e29f87c1c123), LL(0x53a202a6f1535351), + LL(0xdcae8ba572dcdc57), LL(0x0b582716530b0b2c), LL(0x9d9cd327019d9d4e), LL(0x6c47c1d82b6c6cad), + LL(0x3195f562a43131c4), LL(0x7487b9e8f37474cd), LL(0xf6e309f115f6f6ff), LL(0x460a438c4c464605), + LL(0xac092645a5acac8a), LL(0x893c970fb589891e), LL(0x14a04428b4141450), LL(0xe15b42dfbae1e1a3), + LL(0x16b04e2ca6161658), LL(0x3acdd274f73a3ae8), LL(0x696fd0d2066969b9), LL(0x09482d1241090924), + LL(0x70a7ade0d77070dd), LL(0xb6d954716fb6b6e2), LL(0xd0ceb7bd1ed0d067), LL(0xed3b7ec7d6eded93), + LL(0xcc2edb85e2cccc17), LL(0x422a578468424215), LL(0x98b4c22d2c98985a), LL(0xa4490e55eda4a4aa), + LL(0x285d8850752828a0), LL(0x5cda31b8865c5c6d), LL(0xf8933fed6bf8f8c7), LL(0x8644a411c2868622), +}; + +static const uint64_t C6[256] = { + LL(0x6018c07830d81818), LL(0x8c2305af46262323), LL(0x3fc67ef991b8c6c6), LL(0x87e8136fcdfbe8e8), + LL(0x26874ca113cb8787), LL(0xdab8a9626d11b8b8), LL(0x0401080502090101), LL(0x214f426e9e0d4f4f), + LL(0xd836adee6c9b3636), LL(0xa2a6590451ffa6a6), LL(0x6fd2debdb90cd2d2), LL(0xf3f5fb06f70ef5f5), + LL(0xf979ef80f2967979), LL(0xa16f5fcede306f6f), LL(0x7e91fcef3f6d9191), LL(0x5552aa07a4f85252), + LL(0x9d6027fdc0476060), LL(0xcabc89766535bcbc), LL(0x569baccd2b379b9b), LL(0x028e048c018a8e8e), + LL(0xb6a371155bd2a3a3), LL(0x300c603c186c0c0c), LL(0xf17bff8af6847b7b), LL(0xd435b5e16a803535), + LL(0x741de8693af51d1d), LL(0xa7e05347ddb3e0e0), LL(0x7bd7f6acb321d7d7), LL(0x2fc25eed999cc2c2), + LL(0xb82e6d965c432e2e), LL(0x314b627a96294b4b), LL(0xdffea321e15dfefe), LL(0x41578216aed55757), + LL(0x5415a8412abd1515), LL(0xc1779fb6eee87777), LL(0xdc37a5eb6e923737), LL(0xb3e57b56d79ee5e5), + LL(0x469f8cd923139f9f), LL(0xe7f0d317fd23f0f0), LL(0x354a6a7f94204a4a), LL(0x4fda9e95a944dada), + LL(0x7d58fa25b0a25858), LL(0x03c906ca8fcfc9c9), LL(0xa429558d527c2929), LL(0x280a5022145a0a0a), + LL(0xfeb1e14f7f50b1b1), LL(0xbaa0691a5dc9a0a0), LL(0xb16b7fdad6146b6b), LL(0x2e855cab17d98585), + LL(0xcebd8173673cbdbd), LL(0x695dd234ba8f5d5d), LL(0x4010805020901010), LL(0xf7f4f303f507f4f4), + LL(0x0bcb16c08bddcbcb), LL(0xf83eedc67cd33e3e), LL(0x140528110a2d0505), LL(0x81671fe6ce786767), + LL(0xb7e47353d597e4e4), LL(0x9c2725bb4e022727), LL(0x1941325882734141), LL(0x168b2c9d0ba78b8b), + LL(0xa6a7510153f6a7a7), LL(0xe97dcf94fab27d7d), LL(0x6e95dcfb37499595), LL(0x47d88e9fad56d8d8), + LL(0xcbfb8b30eb70fbfb), LL(0x9fee2371c1cdeeee), LL(0xed7cc791f8bb7c7c), LL(0x856617e3cc716666), + LL(0x53dda68ea77bdddd), LL(0x5c17b84b2eaf1717), LL(0x014702468e454747), LL(0x429e84dc211a9e9e), + LL(0x0fca1ec589d4caca), LL(0xb42d75995a582d2d), LL(0xc6bf9179632ebfbf), LL(0x1c07381b0e3f0707), + LL(0x8ead012347acadad), LL(0x755aea2fb4b05a5a), LL(0x36836cb51bef8383), LL(0xcc3385ff66b63333), + LL(0x91633ff2c65c6363), LL(0x0802100a04120202), LL(0x92aa39384993aaaa), LL(0xd971afa8e2de7171), + LL(0x07c80ecf8dc6c8c8), LL(0x6419c87d32d11919), LL(0x39497270923b4949), LL(0x43d9869aaf5fd9d9), + LL(0xeff2c31df931f2f2), LL(0xabe34b48dba8e3e3), LL(0x715be22ab6b95b5b), LL(0x1a8834920dbc8888), + LL(0x529aa4c8293e9a9a), LL(0x98262dbe4c0b2626), LL(0xc8328dfa64bf3232), LL(0xfab0e94a7d59b0b0), + LL(0x83e91b6acff2e9e9), LL(0x3c0f78331e770f0f), LL(0x73d5e6a6b733d5d5), LL(0x3a8074ba1df48080), + LL(0xc2be997c6127bebe), LL(0x13cd26de87ebcdcd), LL(0xd034bde468893434), LL(0x3d487a7590324848), + LL(0xdbffab24e354ffff), LL(0xf57af78ff48d7a7a), LL(0x7a90f4ea3d649090), LL(0x615fc23ebe9d5f5f), + LL(0x80201da0403d2020), LL(0xbd6867d5d00f6868), LL(0x681ad07234ca1a1a), LL(0x82ae192c41b7aeae), + LL(0xeab4c95e757db4b4), LL(0x4d549a19a8ce5454), LL(0x7693ece53b7f9393), LL(0x88220daa442f2222), + LL(0x8d6407e9c8636464), LL(0xe3f1db12ff2af1f1), LL(0xd173bfa2e6cc7373), LL(0x4812905a24821212), + LL(0x1d403a5d807a4040), LL(0x2008402810480808), LL(0x2bc356e89b95c3c3), LL(0x97ec337bc5dfecec), + LL(0x4bdb9690ab4ddbdb), LL(0xbea1611f5fc0a1a1), LL(0x0e8d1c8307918d8d), LL(0xf43df5c97ac83d3d), + LL(0x6697ccf1335b9797), LL(0x0000000000000000), LL(0x1bcf36d483f9cfcf), LL(0xac2b4587566e2b2b), + LL(0xc57697b3ece17676), LL(0x328264b019e68282), LL(0x7fd6fea9b128d6d6), LL(0x6c1bd87736c31b1b), + LL(0xeeb5c15b7774b5b5), LL(0x86af112943beafaf), LL(0xb56a77dfd41d6a6a), LL(0x5d50ba0da0ea5050), + LL(0x0945124c8a574545), LL(0xebf3cb18fb38f3f3), LL(0xc0309df060ad3030), LL(0x9bef2b74c3c4efef), + LL(0xfc3fe5c37eda3f3f), LL(0x4955921caac75555), LL(0xb2a2791059dba2a2), LL(0x8fea0365c9e9eaea), + LL(0x89650fecca6a6565), LL(0xd2bab9686903baba), LL(0xbc2f65935e4a2f2f), LL(0x27c04ee79d8ec0c0), + LL(0x5fdebe81a160dede), LL(0x701ce06c38fc1c1c), LL(0xd3fdbb2ee746fdfd), LL(0x294d52649a1f4d4d), + LL(0x7292e4e039769292), LL(0xc9758fbceafa7575), LL(0x1806301e0c360606), LL(0x128a249809ae8a8a), + LL(0xf2b2f940794bb2b2), LL(0xbfe66359d185e6e6), LL(0x380e70361c7e0e0e), LL(0x7c1ff8633ee71f1f), + LL(0x956237f7c4556262), LL(0x77d4eea3b53ad4d4), LL(0x9aa829324d81a8a8), LL(0x6296c4f431529696), + LL(0xc3f99b3aef62f9f9), LL(0x33c566f697a3c5c5), LL(0x942535b14a102525), LL(0x7959f220b2ab5959), + LL(0x2a8454ae15d08484), LL(0xd572b7a7e4c57272), LL(0xe439d5dd72ec3939), LL(0x2d4c5a6198164c4c), + LL(0x655eca3bbc945e5e), LL(0xfd78e785f09f7878), LL(0xe038ddd870e53838), LL(0x0a8c148605988c8c), + LL(0x63d1c6b2bf17d1d1), LL(0xaea5410b57e4a5a5), LL(0xafe2434dd9a1e2e2), LL(0x99612ff8c24e6161), + LL(0xf6b3f1457b42b3b3), LL(0x842115a542342121), LL(0x4a9c94d625089c9c), LL(0x781ef0663cee1e1e), + LL(0x1143225286614343), LL(0x3bc776fc93b1c7c7), LL(0xd7fcb32be54ffcfc), LL(0x1004201408240404), + LL(0x5951b208a2e35151), LL(0x5e99bcc72f259999), LL(0xa96d4fc4da226d6d), LL(0x340d68391a650d0d), + LL(0xcffa8335e979fafa), LL(0x5bdfb684a369dfdf), LL(0xe57ed79bfca97e7e), LL(0x90243db448192424), + LL(0xec3bc5d776fe3b3b), LL(0x96ab313d4b9aabab), LL(0x1fce3ed181f0cece), LL(0x4411885522991111), + LL(0x068f0c8903838f8f), LL(0x254e4a6b9c044e4e), LL(0xe6b7d1517366b7b7), LL(0x8beb0b60cbe0ebeb), + LL(0xf03cfdcc78c13c3c), LL(0x3e817cbf1ffd8181), LL(0x6a94d4fe35409494), LL(0xfbf7eb0cf31cf7f7), + LL(0xdeb9a1676f18b9b9), LL(0x4c13985f268b1313), LL(0xb02c7d9c58512c2c), LL(0x6bd3d6b8bb05d3d3), + LL(0xbbe76b5cd38ce7e7), LL(0xa56e57cbdc396e6e), LL(0x37c46ef395aac4c4), LL(0x0c03180f061b0303), + LL(0x45568a13acdc5656), LL(0x0d441a49885e4444), LL(0xe17fdf9efea07f7f), LL(0x9ea921374f88a9a9), + LL(0xa82a4d8254672a2a), LL(0xd6bbb16d6b0abbbb), LL(0x23c146e29f87c1c1), LL(0x5153a202a6f15353), + LL(0x57dcae8ba572dcdc), LL(0x2c0b582716530b0b), LL(0x4e9d9cd327019d9d), LL(0xad6c47c1d82b6c6c), + LL(0xc43195f562a43131), LL(0xcd7487b9e8f37474), LL(0xfff6e309f115f6f6), LL(0x05460a438c4c4646), + LL(0x8aac092645a5acac), LL(0x1e893c970fb58989), LL(0x5014a04428b41414), LL(0xa3e15b42dfbae1e1), + LL(0x5816b04e2ca61616), LL(0xe83acdd274f73a3a), LL(0xb9696fd0d2066969), LL(0x2409482d12410909), + LL(0xdd70a7ade0d77070), LL(0xe2b6d954716fb6b6), LL(0x67d0ceb7bd1ed0d0), LL(0x93ed3b7ec7d6eded), + LL(0x17cc2edb85e2cccc), LL(0x15422a5784684242), LL(0x5a98b4c22d2c9898), LL(0xaaa4490e55eda4a4), + LL(0xa0285d8850752828), LL(0x6d5cda31b8865c5c), LL(0xc7f8933fed6bf8f8), LL(0x228644a411c28686), +}; + +static const uint64_t C7[256] = { + LL(0x186018c07830d818), LL(0x238c2305af462623), LL(0xc63fc67ef991b8c6), LL(0xe887e8136fcdfbe8), + LL(0x8726874ca113cb87), LL(0xb8dab8a9626d11b8), LL(0x0104010805020901), LL(0x4f214f426e9e0d4f), + LL(0x36d836adee6c9b36), LL(0xa6a2a6590451ffa6), LL(0xd26fd2debdb90cd2), LL(0xf5f3f5fb06f70ef5), + LL(0x79f979ef80f29679), LL(0x6fa16f5fcede306f), LL(0x917e91fcef3f6d91), LL(0x525552aa07a4f852), + LL(0x609d6027fdc04760), LL(0xbccabc89766535bc), LL(0x9b569baccd2b379b), LL(0x8e028e048c018a8e), + LL(0xa3b6a371155bd2a3), LL(0x0c300c603c186c0c), LL(0x7bf17bff8af6847b), LL(0x35d435b5e16a8035), + LL(0x1d741de8693af51d), LL(0xe0a7e05347ddb3e0), LL(0xd77bd7f6acb321d7), LL(0xc22fc25eed999cc2), + LL(0x2eb82e6d965c432e), LL(0x4b314b627a96294b), LL(0xfedffea321e15dfe), LL(0x5741578216aed557), + LL(0x155415a8412abd15), LL(0x77c1779fb6eee877), LL(0x37dc37a5eb6e9237), LL(0xe5b3e57b56d79ee5), + LL(0x9f469f8cd923139f), LL(0xf0e7f0d317fd23f0), LL(0x4a354a6a7f94204a), LL(0xda4fda9e95a944da), + LL(0x587d58fa25b0a258), LL(0xc903c906ca8fcfc9), LL(0x29a429558d527c29), LL(0x0a280a5022145a0a), + LL(0xb1feb1e14f7f50b1), LL(0xa0baa0691a5dc9a0), LL(0x6bb16b7fdad6146b), LL(0x852e855cab17d985), + LL(0xbdcebd8173673cbd), LL(0x5d695dd234ba8f5d), LL(0x1040108050209010), LL(0xf4f7f4f303f507f4), + LL(0xcb0bcb16c08bddcb), LL(0x3ef83eedc67cd33e), LL(0x05140528110a2d05), LL(0x6781671fe6ce7867), + LL(0xe4b7e47353d597e4), LL(0x279c2725bb4e0227), LL(0x4119413258827341), LL(0x8b168b2c9d0ba78b), + LL(0xa7a6a7510153f6a7), LL(0x7de97dcf94fab27d), LL(0x956e95dcfb374995), LL(0xd847d88e9fad56d8), + LL(0xfbcbfb8b30eb70fb), LL(0xee9fee2371c1cdee), LL(0x7ced7cc791f8bb7c), LL(0x66856617e3cc7166), + LL(0xdd53dda68ea77bdd), LL(0x175c17b84b2eaf17), LL(0x47014702468e4547), LL(0x9e429e84dc211a9e), + LL(0xca0fca1ec589d4ca), LL(0x2db42d75995a582d), LL(0xbfc6bf9179632ebf), LL(0x071c07381b0e3f07), + LL(0xad8ead012347acad), LL(0x5a755aea2fb4b05a), LL(0x8336836cb51bef83), LL(0x33cc3385ff66b633), + LL(0x6391633ff2c65c63), LL(0x020802100a041202), LL(0xaa92aa39384993aa), LL(0x71d971afa8e2de71), + LL(0xc807c80ecf8dc6c8), LL(0x196419c87d32d119), LL(0x4939497270923b49), LL(0xd943d9869aaf5fd9), + LL(0xf2eff2c31df931f2), LL(0xe3abe34b48dba8e3), LL(0x5b715be22ab6b95b), LL(0x881a8834920dbc88), + LL(0x9a529aa4c8293e9a), LL(0x2698262dbe4c0b26), LL(0x32c8328dfa64bf32), LL(0xb0fab0e94a7d59b0), + LL(0xe983e91b6acff2e9), LL(0x0f3c0f78331e770f), LL(0xd573d5e6a6b733d5), LL(0x803a8074ba1df480), + LL(0xbec2be997c6127be), LL(0xcd13cd26de87ebcd), LL(0x34d034bde4688934), LL(0x483d487a75903248), + LL(0xffdbffab24e354ff), LL(0x7af57af78ff48d7a), LL(0x907a90f4ea3d6490), LL(0x5f615fc23ebe9d5f), + LL(0x2080201da0403d20), LL(0x68bd6867d5d00f68), LL(0x1a681ad07234ca1a), LL(0xae82ae192c41b7ae), + LL(0xb4eab4c95e757db4), LL(0x544d549a19a8ce54), LL(0x937693ece53b7f93), LL(0x2288220daa442f22), + LL(0x648d6407e9c86364), LL(0xf1e3f1db12ff2af1), LL(0x73d173bfa2e6cc73), LL(0x124812905a248212), + LL(0x401d403a5d807a40), LL(0x0820084028104808), LL(0xc32bc356e89b95c3), LL(0xec97ec337bc5dfec), + LL(0xdb4bdb9690ab4ddb), LL(0xa1bea1611f5fc0a1), LL(0x8d0e8d1c8307918d), LL(0x3df43df5c97ac83d), + LL(0x976697ccf1335b97), LL(0x0000000000000000), LL(0xcf1bcf36d483f9cf), LL(0x2bac2b4587566e2b), + LL(0x76c57697b3ece176), LL(0x82328264b019e682), LL(0xd67fd6fea9b128d6), LL(0x1b6c1bd87736c31b), + LL(0xb5eeb5c15b7774b5), LL(0xaf86af112943beaf), LL(0x6ab56a77dfd41d6a), LL(0x505d50ba0da0ea50), + LL(0x450945124c8a5745), LL(0xf3ebf3cb18fb38f3), LL(0x30c0309df060ad30), LL(0xef9bef2b74c3c4ef), + LL(0x3ffc3fe5c37eda3f), LL(0x554955921caac755), LL(0xa2b2a2791059dba2), LL(0xea8fea0365c9e9ea), + LL(0x6589650fecca6a65), LL(0xbad2bab9686903ba), LL(0x2fbc2f65935e4a2f), LL(0xc027c04ee79d8ec0), + LL(0xde5fdebe81a160de), LL(0x1c701ce06c38fc1c), LL(0xfdd3fdbb2ee746fd), LL(0x4d294d52649a1f4d), + LL(0x927292e4e0397692), LL(0x75c9758fbceafa75), LL(0x061806301e0c3606), LL(0x8a128a249809ae8a), + LL(0xb2f2b2f940794bb2), LL(0xe6bfe66359d185e6), LL(0x0e380e70361c7e0e), LL(0x1f7c1ff8633ee71f), + LL(0x62956237f7c45562), LL(0xd477d4eea3b53ad4), LL(0xa89aa829324d81a8), LL(0x966296c4f4315296), + LL(0xf9c3f99b3aef62f9), LL(0xc533c566f697a3c5), LL(0x25942535b14a1025), LL(0x597959f220b2ab59), + LL(0x842a8454ae15d084), LL(0x72d572b7a7e4c572), LL(0x39e439d5dd72ec39), LL(0x4c2d4c5a6198164c), + LL(0x5e655eca3bbc945e), LL(0x78fd78e785f09f78), LL(0x38e038ddd870e538), LL(0x8c0a8c148605988c), + LL(0xd163d1c6b2bf17d1), LL(0xa5aea5410b57e4a5), LL(0xe2afe2434dd9a1e2), LL(0x6199612ff8c24e61), + LL(0xb3f6b3f1457b42b3), LL(0x21842115a5423421), LL(0x9c4a9c94d625089c), LL(0x1e781ef0663cee1e), + LL(0x4311432252866143), LL(0xc73bc776fc93b1c7), LL(0xfcd7fcb32be54ffc), LL(0x0410042014082404), + LL(0x515951b208a2e351), LL(0x995e99bcc72f2599), LL(0x6da96d4fc4da226d), LL(0x0d340d68391a650d), + LL(0xfacffa8335e979fa), LL(0xdf5bdfb684a369df), LL(0x7ee57ed79bfca97e), LL(0x2490243db4481924), + LL(0x3bec3bc5d776fe3b), LL(0xab96ab313d4b9aab), LL(0xce1fce3ed181f0ce), LL(0x1144118855229911), + LL(0x8f068f0c8903838f), LL(0x4e254e4a6b9c044e), LL(0xb7e6b7d1517366b7), LL(0xeb8beb0b60cbe0eb), + LL(0x3cf03cfdcc78c13c), LL(0x813e817cbf1ffd81), LL(0x946a94d4fe354094), LL(0xf7fbf7eb0cf31cf7), + LL(0xb9deb9a1676f18b9), LL(0x134c13985f268b13), LL(0x2cb02c7d9c58512c), LL(0xd36bd3d6b8bb05d3), + LL(0xe7bbe76b5cd38ce7), LL(0x6ea56e57cbdc396e), LL(0xc437c46ef395aac4), LL(0x030c03180f061b03), + LL(0x5645568a13acdc56), LL(0x440d441a49885e44), LL(0x7fe17fdf9efea07f), LL(0xa99ea921374f88a9), + LL(0x2aa82a4d8254672a), LL(0xbbd6bbb16d6b0abb), LL(0xc123c146e29f87c1), LL(0x535153a202a6f153), + LL(0xdc57dcae8ba572dc), LL(0x0b2c0b582716530b), LL(0x9d4e9d9cd327019d), LL(0x6cad6c47c1d82b6c), + LL(0x31c43195f562a431), LL(0x74cd7487b9e8f374), LL(0xf6fff6e309f115f6), LL(0x4605460a438c4c46), + LL(0xac8aac092645a5ac), LL(0x891e893c970fb589), LL(0x145014a04428b414), LL(0xe1a3e15b42dfbae1), + LL(0x165816b04e2ca616), LL(0x3ae83acdd274f73a), LL(0x69b9696fd0d20669), LL(0x092409482d124109), + LL(0x70dd70a7ade0d770), LL(0xb6e2b6d954716fb6), LL(0xd067d0ceb7bd1ed0), LL(0xed93ed3b7ec7d6ed), + LL(0xcc17cc2edb85e2cc), LL(0x4215422a57846842), LL(0x985a98b4c22d2c98), LL(0xa4aaa4490e55eda4), + LL(0x28a0285d88507528), LL(0x5c6d5cda31b8865c), LL(0xf8c7f8933fed6bf8), LL(0x86228644a411c286), +}; + +#ifdef OBSOLETE +static const uint64_t C0[256] = { + LL(0x1818281878c0d878), LL(0x23236523af0526af), LL(0xc6c657c6f97eb8f9), LL(0xe8e825e86f13fb6f), + LL(0x87879487a14ccba1), LL(0xb8b8d5b862a91162), LL(0x0101030105080905), LL(0x4f4fd14f6e420d6e), + LL(0x36365a36eead9bee), LL(0xa6a6f7a60459ff04), LL(0xd2d26bd2bdde0cbd), LL(0xf5f502f506fb0e06), + LL(0x79798b7980ef9680), LL(0x6f6fb16fce5f30ce), LL(0x9191ae91effc6def), LL(0x5252f65207aaf807), + LL(0x6060a060fd2747fd), LL(0xbcbcd9bc76893576), LL(0x9b9bb09bcdac37cd), LL(0x8e8e8f8e8c048a8c), + LL(0xa3a3f8a31571d215), LL(0x0c0c140c3c606c3c), LL(0x7b7b8d7b8aff848a), LL(0x35355f35e1b580e1), + LL(0x1d1d271d69e8f569), LL(0xe0e03de04753b347), LL(0xd7d764d7acf621ac), LL(0xc2c25bc2ed5e9ced), + LL(0x2e2e722e966d4396), LL(0x4b4bdd4b7a62297a), LL(0xfefe1ffe21a35d21), LL(0x5757f9571682d516), + LL(0x15153f1541a8bd41), LL(0x77779977b69fe8b6), LL(0x37375937eba592eb), LL(0xe5e532e5567b9e56), + LL(0x9f9fbc9fd98c13d9), LL(0xf0f00df017d32317), LL(0x4a4ade4a7f6a207f), LL(0xdada73da959e4495), + LL(0x5858e85825faa225), LL(0xc9c946c9ca06cfca), LL(0x29297b298d557c8d), LL(0x0a0a1e0a22505a22), + LL(0xb1b1ceb14fe1504f), LL(0xa0a0fda01a69c91a), LL(0x6b6bbd6bda7f14da), LL(0x85859285ab5cd9ab), + LL(0xbdbddabd73813c73), LL(0x5d5de75d34d28f34), LL(0x1010301050809050), LL(0xf4f401f403f30703), + LL(0xcbcb40cbc016ddc0), LL(0x3e3e423ec6edd3c6), LL(0x05050f0511282d11), LL(0x6767a967e61f78e6), + LL(0xe4e431e453739753), LL(0x27276927bb2502bb), LL(0x4141c34158327358), LL(0x8b8b808b9d2ca79d), + LL(0xa7a7f4a70151f601), LL(0x7d7d877d94cfb294), LL(0x9595a295fbdc49fb), LL(0xd8d875d89f8e569f), + LL(0xfbfb10fb308b7030), LL(0xeeee2fee7123cd71), LL(0x7c7c847c91c7bb91), LL(0x6666aa66e31771e3), + LL(0xdddd7add8ea67b8e), LL(0x171739174bb8af4b), LL(0x4747c94746024546), LL(0x9e9ebf9edc841adc), + LL(0xcaca43cac51ed4c5), LL(0x2d2d772d99755899), LL(0xbfbfdcbf79912e79), LL(0x070709071b383f1b), + LL(0xadadeaad2301ac23), LL(0x5a5aee5a2feab02f), LL(0x83839883b56cefb5), LL(0x33335533ff85b6ff), + LL(0x6363a563f23f5cf2), LL(0x020206020a10120a), LL(0xaaaae3aa38399338), LL(0x71719371a8afdea8), + LL(0xc8c845c8cf0ec6cf), LL(0x19192b197dc8d17d), LL(0x4949db4970723b70), LL(0xd9d976d99a865f9a), + LL(0xf2f20bf21dc3311d), LL(0xe3e338e3484ba848), LL(0x5b5bed5b2ae2b92a), LL(0x888885889234bc92), + LL(0x9a9ab39ac8a43ec8), LL(0x26266a26be2d0bbe), LL(0x32325632fa8dbffa), LL(0xb0b0cdb04ae9594a), + LL(0xe9e926e96a1bf26a), LL(0x0f0f110f33787733), LL(0xd5d562d5a6e633a6), LL(0x80809d80ba74f4ba), + LL(0xbebedfbe7c99277c), LL(0xcdcd4acdde26ebde), LL(0x34345c34e4bd89e4), LL(0x4848d848757a3275), + LL(0xffff1cff24ab5424), LL(0x7a7a8e7a8ff78d8f), LL(0x9090ad90eaf464ea), LL(0x5f5fe15f3ec29d3e), + LL(0x20206020a01d3da0), LL(0x6868b868d5670fd5), LL(0x1a1a2e1a72d0ca72), LL(0xaeaeefae2c19b72c), + LL(0xb4b4c1b45ec97d5e), LL(0x5454fc54199ace19), LL(0x9393a893e5ec7fe5), LL(0x22226622aa0d2faa), + LL(0x6464ac64e90763e9), LL(0xf1f10ef112db2a12), LL(0x73739573a2bfcca2), LL(0x121236125a90825a), + LL(0x4040c0405d3a7a5d), LL(0x0808180828404828), LL(0xc3c358c3e85695e8), LL(0xecec29ec7b33df7b), + LL(0xdbdb70db90964d90), LL(0xa1a1fea11f61c01f), LL(0x8d8d8a8d831c9183), LL(0x3d3d473dc9f5c8c9), + LL(0x9797a497f1cc5bf1), LL(0x0000000000000000), LL(0xcfcf4ccfd436f9d4), LL(0x2b2b7d2b87456e87), + LL(0x76769a76b397e1b3), LL(0x82829b82b064e6b0), LL(0xd6d667d6a9fe28a9), LL(0x1b1b2d1b77d8c377), + LL(0xb5b5c2b55bc1745b), LL(0xafafecaf2911be29), LL(0x6a6abe6adf771ddf), LL(0x5050f0500dbaea0d), + LL(0x4545cf454c12574c), LL(0xf3f308f318cb3818), LL(0x30305030f09dadf0), LL(0xefef2cef742bc474), + LL(0x3f3f413fc3e5dac3), LL(0x5555ff551c92c71c), LL(0xa2a2fba21079db10), LL(0xeaea23ea6503e965), + LL(0x6565af65ec0f6aec), LL(0xbabad3ba68b90368), LL(0x2f2f712f93654a93), LL(0xc0c05dc0e74e8ee7), + LL(0xdede7fde81be6081), LL(0x1c1c241c6ce0fc6c), LL(0xfdfd1afd2ebb462e), LL(0x4d4dd74d64521f64), + LL(0x9292ab92e0e476e0), LL(0x75759f75bc8ffabc), LL(0x06060a061e30361e), LL(0x8a8a838a9824ae98), + LL(0xb2b2cbb240f94b40), LL(0xe6e637e659638559), LL(0x0e0e120e36707e36), LL(0x1f1f211f63f8e763), + LL(0x6262a662f73755f7), LL(0xd4d461d4a3ee3aa3), LL(0xa8a8e5a832298132), LL(0x9696a796f4c452f4), + LL(0xf9f916f93a9b623a), LL(0xc5c552c5f666a3f6), LL(0x25256f25b13510b1), LL(0x5959eb5920f2ab20), + LL(0x84849184ae54d0ae), LL(0x72729672a7b7c5a7), LL(0x39394b39ddd5ecdd), LL(0x4c4cd44c615a1661), + LL(0x5e5ee25e3bca943b), LL(0x7878887885e79f85), LL(0x38384838d8dde5d8), LL(0x8c8c898c86149886), + LL(0xd1d16ed1b2c617b2), LL(0xa5a5f2a50b41e40b), LL(0xe2e23be24d43a14d), LL(0x6161a361f82f4ef8), + LL(0xb3b3c8b345f14245), LL(0x21216321a51534a5), LL(0x9c9cb99cd69408d6), LL(0x1e1e221e66f0ee66), + LL(0x4343c54352226152), LL(0xc7c754c7fc76b1fc), LL(0xfcfc19fc2bb34f2b), LL(0x04040c0414202414), + LL(0x5151f35108b2e308), LL(0x9999b699c7bc25c7), LL(0x6d6db76dc44f22c4), LL(0x0d0d170d39686539), + LL(0xfafa13fa35837935), LL(0xdfdf7cdf84b66984), LL(0x7e7e827e9bd7a99b), LL(0x24246c24b43d19b4), + LL(0x3b3b4d3bd7c5fed7), LL(0xababe0ab3d319a3d), LL(0xcece4fced13ef0d1), LL(0x1111331155889955), + LL(0x8f8f8c8f890c8389), LL(0x4e4ed24e6b4a046b), LL(0xb7b7c4b751d16651), LL(0xebeb20eb600be060), + LL(0x3c3c443cccfdc1cc), LL(0x81819e81bf7cfdbf), LL(0x9494a194fed440fe), LL(0xf7f704f70ceb1c0c), + LL(0xb9b9d6b967a11867), LL(0x131335135f988b5f), LL(0x2c2c742c9c7d519c), LL(0xd3d368d3b8d605b8), + LL(0xe7e734e75c6b8c5c), LL(0x6e6eb26ecb5739cb), LL(0xc4c451c4f36eaaf3), LL(0x030305030f181b0f), + LL(0x5656fa56138adc13), LL(0x4444cc44491a5e49), LL(0x7f7f817f9edfa09e), LL(0xa9a9e6a937218837), + LL(0x2a2a7e2a824d6782), LL(0xbbbbd0bb6db10a6d), LL(0xc1c15ec1e24687e2), LL(0x5353f55302a2f102), + LL(0xdcdc79dc8bae728b), LL(0x0b0b1d0b27585327), LL(0x9d9dba9dd39c01d3), LL(0x6c6cb46cc1472bc1), + LL(0x31315331f595a4f5), LL(0x74749c74b987f3b9), LL(0xf6f607f609e31509), LL(0x4646ca46430a4c43), + LL(0xacace9ac2609a526), LL(0x89898689973cb597), LL(0x14143c1444a0b444), LL(0xe1e13ee1425bba42), + LL(0x16163a164eb0a64e), LL(0x3a3a4e3ad2cdf7d2), LL(0x6969bb69d06f06d0), LL(0x09091b092d48412d), + LL(0x70709070ada7d7ad), LL(0xb6b6c7b654d96f54), LL(0xd0d06dd0b7ce1eb7), LL(0xeded2aed7e3bd67e), + LL(0xcccc49ccdb2ee2db), LL(0x4242c642572a6857), LL(0x9898b598c2b42cc2), LL(0xa4a4f1a40e49ed0e), + LL(0x28287828885d7588), LL(0x5c5ce45c31da8631), LL(0xf8f815f83f936b3f), LL(0x86869786a444c2a4), +}; + +static const uint64_t C1[256] = { + LL(0x781818281878c0d8), LL(0xaf23236523af0526), LL(0xf9c6c657c6f97eb8), LL(0x6fe8e825e86f13fb), + LL(0xa187879487a14ccb), LL(0x62b8b8d5b862a911), LL(0x0501010301050809), LL(0x6e4f4fd14f6e420d), + LL(0xee36365a36eead9b), LL(0x04a6a6f7a60459ff), LL(0xbdd2d26bd2bdde0c), LL(0x06f5f502f506fb0e), + LL(0x8079798b7980ef96), LL(0xce6f6fb16fce5f30), LL(0xef9191ae91effc6d), LL(0x075252f65207aaf8), + LL(0xfd6060a060fd2747), LL(0x76bcbcd9bc768935), LL(0xcd9b9bb09bcdac37), LL(0x8c8e8e8f8e8c048a), + LL(0x15a3a3f8a31571d2), LL(0x3c0c0c140c3c606c), LL(0x8a7b7b8d7b8aff84), LL(0xe135355f35e1b580), + LL(0x691d1d271d69e8f5), LL(0x47e0e03de04753b3), LL(0xacd7d764d7acf621), LL(0xedc2c25bc2ed5e9c), + LL(0x962e2e722e966d43), LL(0x7a4b4bdd4b7a6229), LL(0x21fefe1ffe21a35d), LL(0x165757f9571682d5), + LL(0x4115153f1541a8bd), LL(0xb677779977b69fe8), LL(0xeb37375937eba592), LL(0x56e5e532e5567b9e), + LL(0xd99f9fbc9fd98c13), LL(0x17f0f00df017d323), LL(0x7f4a4ade4a7f6a20), LL(0x95dada73da959e44), + LL(0x255858e85825faa2), LL(0xcac9c946c9ca06cf), LL(0x8d29297b298d557c), LL(0x220a0a1e0a22505a), + LL(0x4fb1b1ceb14fe150), LL(0x1aa0a0fda01a69c9), LL(0xda6b6bbd6bda7f14), LL(0xab85859285ab5cd9), + LL(0x73bdbddabd73813c), LL(0x345d5de75d34d28f), LL(0x5010103010508090), LL(0x03f4f401f403f307), + LL(0xc0cbcb40cbc016dd), LL(0xc63e3e423ec6edd3), LL(0x1105050f0511282d), LL(0xe66767a967e61f78), + LL(0x53e4e431e4537397), LL(0xbb27276927bb2502), LL(0x584141c341583273), LL(0x9d8b8b808b9d2ca7), + LL(0x01a7a7f4a70151f6), LL(0x947d7d877d94cfb2), LL(0xfb9595a295fbdc49), LL(0x9fd8d875d89f8e56), + LL(0x30fbfb10fb308b70), LL(0x71eeee2fee7123cd), LL(0x917c7c847c91c7bb), LL(0xe36666aa66e31771), + LL(0x8edddd7add8ea67b), LL(0x4b171739174bb8af), LL(0x464747c947460245), LL(0xdc9e9ebf9edc841a), + LL(0xc5caca43cac51ed4), LL(0x992d2d772d997558), LL(0x79bfbfdcbf79912e), LL(0x1b070709071b383f), + LL(0x23adadeaad2301ac), LL(0x2f5a5aee5a2feab0), LL(0xb583839883b56cef), LL(0xff33335533ff85b6), + LL(0xf26363a563f23f5c), LL(0x0a020206020a1012), LL(0x38aaaae3aa383993), LL(0xa871719371a8afde), + LL(0xcfc8c845c8cf0ec6), LL(0x7d19192b197dc8d1), LL(0x704949db4970723b), LL(0x9ad9d976d99a865f), + LL(0x1df2f20bf21dc331), LL(0x48e3e338e3484ba8), LL(0x2a5b5bed5b2ae2b9), LL(0x92888885889234bc), + LL(0xc89a9ab39ac8a43e), LL(0xbe26266a26be2d0b), LL(0xfa32325632fa8dbf), LL(0x4ab0b0cdb04ae959), + LL(0x6ae9e926e96a1bf2), LL(0x330f0f110f337877), LL(0xa6d5d562d5a6e633), LL(0xba80809d80ba74f4), + LL(0x7cbebedfbe7c9927), LL(0xdecdcd4acdde26eb), LL(0xe434345c34e4bd89), LL(0x754848d848757a32), + LL(0x24ffff1cff24ab54), LL(0x8f7a7a8e7a8ff78d), LL(0xea9090ad90eaf464), LL(0x3e5f5fe15f3ec29d), + LL(0xa020206020a01d3d), LL(0xd56868b868d5670f), LL(0x721a1a2e1a72d0ca), LL(0x2caeaeefae2c19b7), + LL(0x5eb4b4c1b45ec97d), LL(0x195454fc54199ace), LL(0xe59393a893e5ec7f), LL(0xaa22226622aa0d2f), + LL(0xe96464ac64e90763), LL(0x12f1f10ef112db2a), LL(0xa273739573a2bfcc), LL(0x5a121236125a9082), + LL(0x5d4040c0405d3a7a), LL(0x2808081808284048), LL(0xe8c3c358c3e85695), LL(0x7becec29ec7b33df), + LL(0x90dbdb70db90964d), LL(0x1fa1a1fea11f61c0), LL(0x838d8d8a8d831c91), LL(0xc93d3d473dc9f5c8), + LL(0xf19797a497f1cc5b), LL(0x0000000000000000), LL(0xd4cfcf4ccfd436f9), LL(0x872b2b7d2b87456e), + LL(0xb376769a76b397e1), LL(0xb082829b82b064e6), LL(0xa9d6d667d6a9fe28), LL(0x771b1b2d1b77d8c3), + LL(0x5bb5b5c2b55bc174), LL(0x29afafecaf2911be), LL(0xdf6a6abe6adf771d), LL(0x0d5050f0500dbaea), + LL(0x4c4545cf454c1257), LL(0x18f3f308f318cb38), LL(0xf030305030f09dad), LL(0x74efef2cef742bc4), + LL(0xc33f3f413fc3e5da), LL(0x1c5555ff551c92c7), LL(0x10a2a2fba21079db), LL(0x65eaea23ea6503e9), + LL(0xec6565af65ec0f6a), LL(0x68babad3ba68b903), LL(0x932f2f712f93654a), LL(0xe7c0c05dc0e74e8e), + LL(0x81dede7fde81be60), LL(0x6c1c1c241c6ce0fc), LL(0x2efdfd1afd2ebb46), LL(0x644d4dd74d64521f), + LL(0xe09292ab92e0e476), LL(0xbc75759f75bc8ffa), LL(0x1e06060a061e3036), LL(0x988a8a838a9824ae), + LL(0x40b2b2cbb240f94b), LL(0x59e6e637e6596385), LL(0x360e0e120e36707e), LL(0x631f1f211f63f8e7), + LL(0xf76262a662f73755), LL(0xa3d4d461d4a3ee3a), LL(0x32a8a8e5a8322981), LL(0xf49696a796f4c452), + LL(0x3af9f916f93a9b62), LL(0xf6c5c552c5f666a3), LL(0xb125256f25b13510), LL(0x205959eb5920f2ab), + LL(0xae84849184ae54d0), LL(0xa772729672a7b7c5), LL(0xdd39394b39ddd5ec), LL(0x614c4cd44c615a16), + LL(0x3b5e5ee25e3bca94), LL(0x857878887885e79f), LL(0xd838384838d8dde5), LL(0x868c8c898c861498), + LL(0xb2d1d16ed1b2c617), LL(0x0ba5a5f2a50b41e4), LL(0x4de2e23be24d43a1), LL(0xf86161a361f82f4e), + LL(0x45b3b3c8b345f142), LL(0xa521216321a51534), LL(0xd69c9cb99cd69408), LL(0x661e1e221e66f0ee), + LL(0x524343c543522261), LL(0xfcc7c754c7fc76b1), LL(0x2bfcfc19fc2bb34f), LL(0x1404040c04142024), + LL(0x085151f35108b2e3), LL(0xc79999b699c7bc25), LL(0xc46d6db76dc44f22), LL(0x390d0d170d396865), + LL(0x35fafa13fa358379), LL(0x84dfdf7cdf84b669), LL(0x9b7e7e827e9bd7a9), LL(0xb424246c24b43d19), + LL(0xd73b3b4d3bd7c5fe), LL(0x3dababe0ab3d319a), LL(0xd1cece4fced13ef0), LL(0x5511113311558899), + LL(0x898f8f8c8f890c83), LL(0x6b4e4ed24e6b4a04), LL(0x51b7b7c4b751d166), LL(0x60ebeb20eb600be0), + LL(0xcc3c3c443cccfdc1), LL(0xbf81819e81bf7cfd), LL(0xfe9494a194fed440), LL(0x0cf7f704f70ceb1c), + LL(0x67b9b9d6b967a118), LL(0x5f131335135f988b), LL(0x9c2c2c742c9c7d51), LL(0xb8d3d368d3b8d605), + LL(0x5ce7e734e75c6b8c), LL(0xcb6e6eb26ecb5739), LL(0xf3c4c451c4f36eaa), LL(0x0f030305030f181b), + LL(0x135656fa56138adc), LL(0x494444cc44491a5e), LL(0x9e7f7f817f9edfa0), LL(0x37a9a9e6a9372188), + LL(0x822a2a7e2a824d67), LL(0x6dbbbbd0bb6db10a), LL(0xe2c1c15ec1e24687), LL(0x025353f55302a2f1), + LL(0x8bdcdc79dc8bae72), LL(0x270b0b1d0b275853), LL(0xd39d9dba9dd39c01), LL(0xc16c6cb46cc1472b), + LL(0xf531315331f595a4), LL(0xb974749c74b987f3), LL(0x09f6f607f609e315), LL(0x434646ca46430a4c), + LL(0x26acace9ac2609a5), LL(0x9789898689973cb5), LL(0x4414143c1444a0b4), LL(0x42e1e13ee1425bba), + LL(0x4e16163a164eb0a6), LL(0xd23a3a4e3ad2cdf7), LL(0xd06969bb69d06f06), LL(0x2d09091b092d4841), + LL(0xad70709070ada7d7), LL(0x54b6b6c7b654d96f), LL(0xb7d0d06dd0b7ce1e), LL(0x7eeded2aed7e3bd6), + LL(0xdbcccc49ccdb2ee2), LL(0x574242c642572a68), LL(0xc29898b598c2b42c), LL(0x0ea4a4f1a40e49ed), + LL(0x8828287828885d75), LL(0x315c5ce45c31da86), LL(0x3ff8f815f83f936b), LL(0xa486869786a444c2), +}; + +static const uint64_t C2[256] = { + LL(0xd8781818281878c0), LL(0x26af23236523af05), LL(0xb8f9c6c657c6f97e), LL(0xfb6fe8e825e86f13), + LL(0xcba187879487a14c), LL(0x1162b8b8d5b862a9), LL(0x0905010103010508), LL(0x0d6e4f4fd14f6e42), + LL(0x9bee36365a36eead), LL(0xff04a6a6f7a60459), LL(0x0cbdd2d26bd2bdde), LL(0x0e06f5f502f506fb), + LL(0x968079798b7980ef), LL(0x30ce6f6fb16fce5f), LL(0x6def9191ae91effc), LL(0xf8075252f65207aa), + LL(0x47fd6060a060fd27), LL(0x3576bcbcd9bc7689), LL(0x37cd9b9bb09bcdac), LL(0x8a8c8e8e8f8e8c04), + LL(0xd215a3a3f8a31571), LL(0x6c3c0c0c140c3c60), LL(0x848a7b7b8d7b8aff), LL(0x80e135355f35e1b5), + LL(0xf5691d1d271d69e8), LL(0xb347e0e03de04753), LL(0x21acd7d764d7acf6), LL(0x9cedc2c25bc2ed5e), + LL(0x43962e2e722e966d), LL(0x297a4b4bdd4b7a62), LL(0x5d21fefe1ffe21a3), LL(0xd5165757f9571682), + LL(0xbd4115153f1541a8), LL(0xe8b677779977b69f), LL(0x92eb37375937eba5), LL(0x9e56e5e532e5567b), + LL(0x13d99f9fbc9fd98c), LL(0x2317f0f00df017d3), LL(0x207f4a4ade4a7f6a), LL(0x4495dada73da959e), + LL(0xa2255858e85825fa), LL(0xcfcac9c946c9ca06), LL(0x7c8d29297b298d55), LL(0x5a220a0a1e0a2250), + LL(0x504fb1b1ceb14fe1), LL(0xc91aa0a0fda01a69), LL(0x14da6b6bbd6bda7f), LL(0xd9ab85859285ab5c), + LL(0x3c73bdbddabd7381), LL(0x8f345d5de75d34d2), LL(0x9050101030105080), LL(0x0703f4f401f403f3), + LL(0xddc0cbcb40cbc016), LL(0xd3c63e3e423ec6ed), LL(0x2d1105050f051128), LL(0x78e66767a967e61f), + LL(0x9753e4e431e45373), LL(0x02bb27276927bb25), LL(0x73584141c3415832), LL(0xa79d8b8b808b9d2c), + LL(0xf601a7a7f4a70151), LL(0xb2947d7d877d94cf), LL(0x49fb9595a295fbdc), LL(0x569fd8d875d89f8e), + LL(0x7030fbfb10fb308b), LL(0xcd71eeee2fee7123), LL(0xbb917c7c847c91c7), LL(0x71e36666aa66e317), + LL(0x7b8edddd7add8ea6), LL(0xaf4b171739174bb8), LL(0x45464747c9474602), LL(0x1adc9e9ebf9edc84), + LL(0xd4c5caca43cac51e), LL(0x58992d2d772d9975), LL(0x2e79bfbfdcbf7991), LL(0x3f1b070709071b38), + LL(0xac23adadeaad2301), LL(0xb02f5a5aee5a2fea), LL(0xefb583839883b56c), LL(0xb6ff33335533ff85), + LL(0x5cf26363a563f23f), LL(0x120a020206020a10), LL(0x9338aaaae3aa3839), LL(0xdea871719371a8af), + LL(0xc6cfc8c845c8cf0e), LL(0xd17d19192b197dc8), LL(0x3b704949db497072), LL(0x5f9ad9d976d99a86), + LL(0x311df2f20bf21dc3), LL(0xa848e3e338e3484b), LL(0xb92a5b5bed5b2ae2), LL(0xbc92888885889234), + LL(0x3ec89a9ab39ac8a4), LL(0x0bbe26266a26be2d), LL(0xbffa32325632fa8d), LL(0x594ab0b0cdb04ae9), + LL(0xf26ae9e926e96a1b), LL(0x77330f0f110f3378), LL(0x33a6d5d562d5a6e6), LL(0xf4ba80809d80ba74), + LL(0x277cbebedfbe7c99), LL(0xebdecdcd4acdde26), LL(0x89e434345c34e4bd), LL(0x32754848d848757a), + LL(0x5424ffff1cff24ab), LL(0x8d8f7a7a8e7a8ff7), LL(0x64ea9090ad90eaf4), LL(0x9d3e5f5fe15f3ec2), + LL(0x3da020206020a01d), LL(0x0fd56868b868d567), LL(0xca721a1a2e1a72d0), LL(0xb72caeaeefae2c19), + LL(0x7d5eb4b4c1b45ec9), LL(0xce195454fc54199a), LL(0x7fe59393a893e5ec), LL(0x2faa22226622aa0d), + LL(0x63e96464ac64e907), LL(0x2a12f1f10ef112db), LL(0xcca273739573a2bf), LL(0x825a121236125a90), + LL(0x7a5d4040c0405d3a), LL(0x4828080818082840), LL(0x95e8c3c358c3e856), LL(0xdf7becec29ec7b33), + LL(0x4d90dbdb70db9096), LL(0xc01fa1a1fea11f61), LL(0x91838d8d8a8d831c), LL(0xc8c93d3d473dc9f5), + LL(0x5bf19797a497f1cc), LL(0x0000000000000000), LL(0xf9d4cfcf4ccfd436), LL(0x6e872b2b7d2b8745), + LL(0xe1b376769a76b397), LL(0xe6b082829b82b064), LL(0x28a9d6d667d6a9fe), LL(0xc3771b1b2d1b77d8), + LL(0x745bb5b5c2b55bc1), LL(0xbe29afafecaf2911), LL(0x1ddf6a6abe6adf77), LL(0xea0d5050f0500dba), + LL(0x574c4545cf454c12), LL(0x3818f3f308f318cb), LL(0xadf030305030f09d), LL(0xc474efef2cef742b), + LL(0xdac33f3f413fc3e5), LL(0xc71c5555ff551c92), LL(0xdb10a2a2fba21079), LL(0xe965eaea23ea6503), + LL(0x6aec6565af65ec0f), LL(0x0368babad3ba68b9), LL(0x4a932f2f712f9365), LL(0x8ee7c0c05dc0e74e), + LL(0x6081dede7fde81be), LL(0xfc6c1c1c241c6ce0), LL(0x462efdfd1afd2ebb), LL(0x1f644d4dd74d6452), + LL(0x76e09292ab92e0e4), LL(0xfabc75759f75bc8f), LL(0x361e06060a061e30), LL(0xae988a8a838a9824), + LL(0x4b40b2b2cbb240f9), LL(0x8559e6e637e65963), LL(0x7e360e0e120e3670), LL(0xe7631f1f211f63f8), + LL(0x55f76262a662f737), LL(0x3aa3d4d461d4a3ee), LL(0x8132a8a8e5a83229), LL(0x52f49696a796f4c4), + LL(0x623af9f916f93a9b), LL(0xa3f6c5c552c5f666), LL(0x10b125256f25b135), LL(0xab205959eb5920f2), + LL(0xd0ae84849184ae54), LL(0xc5a772729672a7b7), LL(0xecdd39394b39ddd5), LL(0x16614c4cd44c615a), + LL(0x943b5e5ee25e3bca), LL(0x9f857878887885e7), LL(0xe5d838384838d8dd), LL(0x98868c8c898c8614), + LL(0x17b2d1d16ed1b2c6), LL(0xe40ba5a5f2a50b41), LL(0xa14de2e23be24d43), LL(0x4ef86161a361f82f), + LL(0x4245b3b3c8b345f1), LL(0x34a521216321a515), LL(0x08d69c9cb99cd694), LL(0xee661e1e221e66f0), + LL(0x61524343c5435222), LL(0xb1fcc7c754c7fc76), LL(0x4f2bfcfc19fc2bb3), LL(0x241404040c041420), + LL(0xe3085151f35108b2), LL(0x25c79999b699c7bc), LL(0x22c46d6db76dc44f), LL(0x65390d0d170d3968), + LL(0x7935fafa13fa3583), LL(0x6984dfdf7cdf84b6), LL(0xa99b7e7e827e9bd7), LL(0x19b424246c24b43d), + LL(0xfed73b3b4d3bd7c5), LL(0x9a3dababe0ab3d31), LL(0xf0d1cece4fced13e), LL(0x9955111133115588), + LL(0x83898f8f8c8f890c), LL(0x046b4e4ed24e6b4a), LL(0x6651b7b7c4b751d1), LL(0xe060ebeb20eb600b), + LL(0xc1cc3c3c443cccfd), LL(0xfdbf81819e81bf7c), LL(0x40fe9494a194fed4), LL(0x1c0cf7f704f70ceb), + LL(0x1867b9b9d6b967a1), LL(0x8b5f131335135f98), LL(0x519c2c2c742c9c7d), LL(0x05b8d3d368d3b8d6), + LL(0x8c5ce7e734e75c6b), LL(0x39cb6e6eb26ecb57), LL(0xaaf3c4c451c4f36e), LL(0x1b0f030305030f18), + LL(0xdc135656fa56138a), LL(0x5e494444cc44491a), LL(0xa09e7f7f817f9edf), LL(0x8837a9a9e6a93721), + LL(0x67822a2a7e2a824d), LL(0x0a6dbbbbd0bb6db1), LL(0x87e2c1c15ec1e246), LL(0xf1025353f55302a2), + LL(0x728bdcdc79dc8bae), LL(0x53270b0b1d0b2758), LL(0x01d39d9dba9dd39c), LL(0x2bc16c6cb46cc147), + LL(0xa4f531315331f595), LL(0xf3b974749c74b987), LL(0x1509f6f607f609e3), LL(0x4c434646ca46430a), + LL(0xa526acace9ac2609), LL(0xb59789898689973c), LL(0xb44414143c1444a0), LL(0xba42e1e13ee1425b), + LL(0xa64e16163a164eb0), LL(0xf7d23a3a4e3ad2cd), LL(0x06d06969bb69d06f), LL(0x412d09091b092d48), + LL(0xd7ad70709070ada7), LL(0x6f54b6b6c7b654d9), LL(0x1eb7d0d06dd0b7ce), LL(0xd67eeded2aed7e3b), + LL(0xe2dbcccc49ccdb2e), LL(0x68574242c642572a), LL(0x2cc29898b598c2b4), LL(0xed0ea4a4f1a40e49), + LL(0x758828287828885d), LL(0x86315c5ce45c31da), LL(0x6b3ff8f815f83f93), LL(0xc2a486869786a444), +}; + +static const uint64_t C3[256] = { + LL(0xc0d8781818281878), LL(0x0526af23236523af), LL(0x7eb8f9c6c657c6f9), LL(0x13fb6fe8e825e86f), + LL(0x4ccba187879487a1), LL(0xa91162b8b8d5b862), LL(0x0809050101030105), LL(0x420d6e4f4fd14f6e), + LL(0xad9bee36365a36ee), LL(0x59ff04a6a6f7a604), LL(0xde0cbdd2d26bd2bd), LL(0xfb0e06f5f502f506), + LL(0xef968079798b7980), LL(0x5f30ce6f6fb16fce), LL(0xfc6def9191ae91ef), LL(0xaaf8075252f65207), + LL(0x2747fd6060a060fd), LL(0x893576bcbcd9bc76), LL(0xac37cd9b9bb09bcd), LL(0x048a8c8e8e8f8e8c), + LL(0x71d215a3a3f8a315), LL(0x606c3c0c0c140c3c), LL(0xff848a7b7b8d7b8a), LL(0xb580e135355f35e1), + LL(0xe8f5691d1d271d69), LL(0x53b347e0e03de047), LL(0xf621acd7d764d7ac), LL(0x5e9cedc2c25bc2ed), + LL(0x6d43962e2e722e96), LL(0x62297a4b4bdd4b7a), LL(0xa35d21fefe1ffe21), LL(0x82d5165757f95716), + LL(0xa8bd4115153f1541), LL(0x9fe8b677779977b6), LL(0xa592eb37375937eb), LL(0x7b9e56e5e532e556), + LL(0x8c13d99f9fbc9fd9), LL(0xd32317f0f00df017), LL(0x6a207f4a4ade4a7f), LL(0x9e4495dada73da95), + LL(0xfaa2255858e85825), LL(0x06cfcac9c946c9ca), LL(0x557c8d29297b298d), LL(0x505a220a0a1e0a22), + LL(0xe1504fb1b1ceb14f), LL(0x69c91aa0a0fda01a), LL(0x7f14da6b6bbd6bda), LL(0x5cd9ab85859285ab), + LL(0x813c73bdbddabd73), LL(0xd28f345d5de75d34), LL(0x8090501010301050), LL(0xf30703f4f401f403), + LL(0x16ddc0cbcb40cbc0), LL(0xedd3c63e3e423ec6), LL(0x282d1105050f0511), LL(0x1f78e66767a967e6), + LL(0x739753e4e431e453), LL(0x2502bb27276927bb), LL(0x3273584141c34158), LL(0x2ca79d8b8b808b9d), + LL(0x51f601a7a7f4a701), LL(0xcfb2947d7d877d94), LL(0xdc49fb9595a295fb), LL(0x8e569fd8d875d89f), + LL(0x8b7030fbfb10fb30), LL(0x23cd71eeee2fee71), LL(0xc7bb917c7c847c91), LL(0x1771e36666aa66e3), + LL(0xa67b8edddd7add8e), LL(0xb8af4b171739174b), LL(0x0245464747c94746), LL(0x841adc9e9ebf9edc), + LL(0x1ed4c5caca43cac5), LL(0x7558992d2d772d99), LL(0x912e79bfbfdcbf79), LL(0x383f1b070709071b), + LL(0x01ac23adadeaad23), LL(0xeab02f5a5aee5a2f), LL(0x6cefb583839883b5), LL(0x85b6ff33335533ff), + LL(0x3f5cf26363a563f2), LL(0x10120a020206020a), LL(0x399338aaaae3aa38), LL(0xafdea871719371a8), + LL(0x0ec6cfc8c845c8cf), LL(0xc8d17d19192b197d), LL(0x723b704949db4970), LL(0x865f9ad9d976d99a), + LL(0xc3311df2f20bf21d), LL(0x4ba848e3e338e348), LL(0xe2b92a5b5bed5b2a), LL(0x34bc928888858892), + LL(0xa43ec89a9ab39ac8), LL(0x2d0bbe26266a26be), LL(0x8dbffa32325632fa), LL(0xe9594ab0b0cdb04a), + LL(0x1bf26ae9e926e96a), LL(0x7877330f0f110f33), LL(0xe633a6d5d562d5a6), LL(0x74f4ba80809d80ba), + LL(0x99277cbebedfbe7c), LL(0x26ebdecdcd4acdde), LL(0xbd89e434345c34e4), LL(0x7a32754848d84875), + LL(0xab5424ffff1cff24), LL(0xf78d8f7a7a8e7a8f), LL(0xf464ea9090ad90ea), LL(0xc29d3e5f5fe15f3e), + LL(0x1d3da020206020a0), LL(0x670fd56868b868d5), LL(0xd0ca721a1a2e1a72), LL(0x19b72caeaeefae2c), + LL(0xc97d5eb4b4c1b45e), LL(0x9ace195454fc5419), LL(0xec7fe59393a893e5), LL(0x0d2faa22226622aa), + LL(0x0763e96464ac64e9), LL(0xdb2a12f1f10ef112), LL(0xbfcca273739573a2), LL(0x90825a121236125a), + LL(0x3a7a5d4040c0405d), LL(0x4048280808180828), LL(0x5695e8c3c358c3e8), LL(0x33df7becec29ec7b), + LL(0x964d90dbdb70db90), LL(0x61c01fa1a1fea11f), LL(0x1c91838d8d8a8d83), LL(0xf5c8c93d3d473dc9), + LL(0xcc5bf19797a497f1), LL(0x0000000000000000), LL(0x36f9d4cfcf4ccfd4), LL(0x456e872b2b7d2b87), + LL(0x97e1b376769a76b3), LL(0x64e6b082829b82b0), LL(0xfe28a9d6d667d6a9), LL(0xd8c3771b1b2d1b77), + LL(0xc1745bb5b5c2b55b), LL(0x11be29afafecaf29), LL(0x771ddf6a6abe6adf), LL(0xbaea0d5050f0500d), + LL(0x12574c4545cf454c), LL(0xcb3818f3f308f318), LL(0x9dadf030305030f0), LL(0x2bc474efef2cef74), + LL(0xe5dac33f3f413fc3), LL(0x92c71c5555ff551c), LL(0x79db10a2a2fba210), LL(0x03e965eaea23ea65), + LL(0x0f6aec6565af65ec), LL(0xb90368babad3ba68), LL(0x654a932f2f712f93), LL(0x4e8ee7c0c05dc0e7), + LL(0xbe6081dede7fde81), LL(0xe0fc6c1c1c241c6c), LL(0xbb462efdfd1afd2e), LL(0x521f644d4dd74d64), + LL(0xe476e09292ab92e0), LL(0x8ffabc75759f75bc), LL(0x30361e06060a061e), LL(0x24ae988a8a838a98), + LL(0xf94b40b2b2cbb240), LL(0x638559e6e637e659), LL(0x707e360e0e120e36), LL(0xf8e7631f1f211f63), + LL(0x3755f76262a662f7), LL(0xee3aa3d4d461d4a3), LL(0x298132a8a8e5a832), LL(0xc452f49696a796f4), + LL(0x9b623af9f916f93a), LL(0x66a3f6c5c552c5f6), LL(0x3510b125256f25b1), LL(0xf2ab205959eb5920), + LL(0x54d0ae84849184ae), LL(0xb7c5a772729672a7), LL(0xd5ecdd39394b39dd), LL(0x5a16614c4cd44c61), + LL(0xca943b5e5ee25e3b), LL(0xe79f857878887885), LL(0xdde5d838384838d8), LL(0x1498868c8c898c86), + LL(0xc617b2d1d16ed1b2), LL(0x41e40ba5a5f2a50b), LL(0x43a14de2e23be24d), LL(0x2f4ef86161a361f8), + LL(0xf14245b3b3c8b345), LL(0x1534a521216321a5), LL(0x9408d69c9cb99cd6), LL(0xf0ee661e1e221e66), + LL(0x2261524343c54352), LL(0x76b1fcc7c754c7fc), LL(0xb34f2bfcfc19fc2b), LL(0x20241404040c0414), + LL(0xb2e3085151f35108), LL(0xbc25c79999b699c7), LL(0x4f22c46d6db76dc4), LL(0x6865390d0d170d39), + LL(0x837935fafa13fa35), LL(0xb66984dfdf7cdf84), LL(0xd7a99b7e7e827e9b), LL(0x3d19b424246c24b4), + LL(0xc5fed73b3b4d3bd7), LL(0x319a3dababe0ab3d), LL(0x3ef0d1cece4fced1), LL(0x8899551111331155), + LL(0x0c83898f8f8c8f89), LL(0x4a046b4e4ed24e6b), LL(0xd16651b7b7c4b751), LL(0x0be060ebeb20eb60), + LL(0xfdc1cc3c3c443ccc), LL(0x7cfdbf81819e81bf), LL(0xd440fe9494a194fe), LL(0xeb1c0cf7f704f70c), + LL(0xa11867b9b9d6b967), LL(0x988b5f131335135f), LL(0x7d519c2c2c742c9c), LL(0xd605b8d3d368d3b8), + LL(0x6b8c5ce7e734e75c), LL(0x5739cb6e6eb26ecb), LL(0x6eaaf3c4c451c4f3), LL(0x181b0f030305030f), + LL(0x8adc135656fa5613), LL(0x1a5e494444cc4449), LL(0xdfa09e7f7f817f9e), LL(0x218837a9a9e6a937), + LL(0x4d67822a2a7e2a82), LL(0xb10a6dbbbbd0bb6d), LL(0x4687e2c1c15ec1e2), LL(0xa2f1025353f55302), + LL(0xae728bdcdc79dc8b), LL(0x5853270b0b1d0b27), LL(0x9c01d39d9dba9dd3), LL(0x472bc16c6cb46cc1), + LL(0x95a4f531315331f5), LL(0x87f3b974749c74b9), LL(0xe31509f6f607f609), LL(0x0a4c434646ca4643), + LL(0x09a526acace9ac26), LL(0x3cb5978989868997), LL(0xa0b44414143c1444), LL(0x5bba42e1e13ee142), + LL(0xb0a64e16163a164e), LL(0xcdf7d23a3a4e3ad2), LL(0x6f06d06969bb69d0), LL(0x48412d09091b092d), + LL(0xa7d7ad70709070ad), LL(0xd96f54b6b6c7b654), LL(0xce1eb7d0d06dd0b7), LL(0x3bd67eeded2aed7e), + LL(0x2ee2dbcccc49ccdb), LL(0x2a68574242c64257), LL(0xb42cc29898b598c2), LL(0x49ed0ea4a4f1a40e), + LL(0x5d75882828782888), LL(0xda86315c5ce45c31), LL(0x936b3ff8f815f83f), LL(0x44c2a486869786a4), +}; + +static const uint64_t C4[256] = { + LL(0x78c0d87818182818), LL(0xaf0526af23236523), LL(0xf97eb8f9c6c657c6), LL(0x6f13fb6fe8e825e8), + LL(0xa14ccba187879487), LL(0x62a91162b8b8d5b8), LL(0x0508090501010301), LL(0x6e420d6e4f4fd14f), + LL(0xeead9bee36365a36), LL(0x0459ff04a6a6f7a6), LL(0xbdde0cbdd2d26bd2), LL(0x06fb0e06f5f502f5), + LL(0x80ef968079798b79), LL(0xce5f30ce6f6fb16f), LL(0xeffc6def9191ae91), LL(0x07aaf8075252f652), + LL(0xfd2747fd6060a060), LL(0x76893576bcbcd9bc), LL(0xcdac37cd9b9bb09b), LL(0x8c048a8c8e8e8f8e), + LL(0x1571d215a3a3f8a3), LL(0x3c606c3c0c0c140c), LL(0x8aff848a7b7b8d7b), LL(0xe1b580e135355f35), + LL(0x69e8f5691d1d271d), LL(0x4753b347e0e03de0), LL(0xacf621acd7d764d7), LL(0xed5e9cedc2c25bc2), + LL(0x966d43962e2e722e), LL(0x7a62297a4b4bdd4b), LL(0x21a35d21fefe1ffe), LL(0x1682d5165757f957), + LL(0x41a8bd4115153f15), LL(0xb69fe8b677779977), LL(0xeba592eb37375937), LL(0x567b9e56e5e532e5), + LL(0xd98c13d99f9fbc9f), LL(0x17d32317f0f00df0), LL(0x7f6a207f4a4ade4a), LL(0x959e4495dada73da), + LL(0x25faa2255858e858), LL(0xca06cfcac9c946c9), LL(0x8d557c8d29297b29), LL(0x22505a220a0a1e0a), + LL(0x4fe1504fb1b1ceb1), LL(0x1a69c91aa0a0fda0), LL(0xda7f14da6b6bbd6b), LL(0xab5cd9ab85859285), + LL(0x73813c73bdbddabd), LL(0x34d28f345d5de75d), LL(0x5080905010103010), LL(0x03f30703f4f401f4), + LL(0xc016ddc0cbcb40cb), LL(0xc6edd3c63e3e423e), LL(0x11282d1105050f05), LL(0xe61f78e66767a967), + LL(0x53739753e4e431e4), LL(0xbb2502bb27276927), LL(0x583273584141c341), LL(0x9d2ca79d8b8b808b), + LL(0x0151f601a7a7f4a7), LL(0x94cfb2947d7d877d), LL(0xfbdc49fb9595a295), LL(0x9f8e569fd8d875d8), + LL(0x308b7030fbfb10fb), LL(0x7123cd71eeee2fee), LL(0x91c7bb917c7c847c), LL(0xe31771e36666aa66), + LL(0x8ea67b8edddd7add), LL(0x4bb8af4b17173917), LL(0x460245464747c947), LL(0xdc841adc9e9ebf9e), + LL(0xc51ed4c5caca43ca), LL(0x997558992d2d772d), LL(0x79912e79bfbfdcbf), LL(0x1b383f1b07070907), + LL(0x2301ac23adadeaad), LL(0x2feab02f5a5aee5a), LL(0xb56cefb583839883), LL(0xff85b6ff33335533), + LL(0xf23f5cf26363a563), LL(0x0a10120a02020602), LL(0x38399338aaaae3aa), LL(0xa8afdea871719371), + LL(0xcf0ec6cfc8c845c8), LL(0x7dc8d17d19192b19), LL(0x70723b704949db49), LL(0x9a865f9ad9d976d9), + LL(0x1dc3311df2f20bf2), LL(0x484ba848e3e338e3), LL(0x2ae2b92a5b5bed5b), LL(0x9234bc9288888588), + LL(0xc8a43ec89a9ab39a), LL(0xbe2d0bbe26266a26), LL(0xfa8dbffa32325632), LL(0x4ae9594ab0b0cdb0), + LL(0x6a1bf26ae9e926e9), LL(0x337877330f0f110f), LL(0xa6e633a6d5d562d5), LL(0xba74f4ba80809d80), + LL(0x7c99277cbebedfbe), LL(0xde26ebdecdcd4acd), LL(0xe4bd89e434345c34), LL(0x757a32754848d848), + LL(0x24ab5424ffff1cff), LL(0x8ff78d8f7a7a8e7a), LL(0xeaf464ea9090ad90), LL(0x3ec29d3e5f5fe15f), + LL(0xa01d3da020206020), LL(0xd5670fd56868b868), LL(0x72d0ca721a1a2e1a), LL(0x2c19b72caeaeefae), + LL(0x5ec97d5eb4b4c1b4), LL(0x199ace195454fc54), LL(0xe5ec7fe59393a893), LL(0xaa0d2faa22226622), + LL(0xe90763e96464ac64), LL(0x12db2a12f1f10ef1), LL(0xa2bfcca273739573), LL(0x5a90825a12123612), + LL(0x5d3a7a5d4040c040), LL(0x2840482808081808), LL(0xe85695e8c3c358c3), LL(0x7b33df7becec29ec), + LL(0x90964d90dbdb70db), LL(0x1f61c01fa1a1fea1), LL(0x831c91838d8d8a8d), LL(0xc9f5c8c93d3d473d), + LL(0xf1cc5bf19797a497), LL(0x0000000000000000), LL(0xd436f9d4cfcf4ccf), LL(0x87456e872b2b7d2b), + LL(0xb397e1b376769a76), LL(0xb064e6b082829b82), LL(0xa9fe28a9d6d667d6), LL(0x77d8c3771b1b2d1b), + LL(0x5bc1745bb5b5c2b5), LL(0x2911be29afafecaf), LL(0xdf771ddf6a6abe6a), LL(0x0dbaea0d5050f050), + LL(0x4c12574c4545cf45), LL(0x18cb3818f3f308f3), LL(0xf09dadf030305030), LL(0x742bc474efef2cef), + LL(0xc3e5dac33f3f413f), LL(0x1c92c71c5555ff55), LL(0x1079db10a2a2fba2), LL(0x6503e965eaea23ea), + LL(0xec0f6aec6565af65), LL(0x68b90368babad3ba), LL(0x93654a932f2f712f), LL(0xe74e8ee7c0c05dc0), + LL(0x81be6081dede7fde), LL(0x6ce0fc6c1c1c241c), LL(0x2ebb462efdfd1afd), LL(0x64521f644d4dd74d), + LL(0xe0e476e09292ab92), LL(0xbc8ffabc75759f75), LL(0x1e30361e06060a06), LL(0x9824ae988a8a838a), + LL(0x40f94b40b2b2cbb2), LL(0x59638559e6e637e6), LL(0x36707e360e0e120e), LL(0x63f8e7631f1f211f), + LL(0xf73755f76262a662), LL(0xa3ee3aa3d4d461d4), LL(0x32298132a8a8e5a8), LL(0xf4c452f49696a796), + LL(0x3a9b623af9f916f9), LL(0xf666a3f6c5c552c5), LL(0xb13510b125256f25), LL(0x20f2ab205959eb59), + LL(0xae54d0ae84849184), LL(0xa7b7c5a772729672), LL(0xddd5ecdd39394b39), LL(0x615a16614c4cd44c), + LL(0x3bca943b5e5ee25e), LL(0x85e79f8578788878), LL(0xd8dde5d838384838), LL(0x861498868c8c898c), + LL(0xb2c617b2d1d16ed1), LL(0x0b41e40ba5a5f2a5), LL(0x4d43a14de2e23be2), LL(0xf82f4ef86161a361), + LL(0x45f14245b3b3c8b3), LL(0xa51534a521216321), LL(0xd69408d69c9cb99c), LL(0x66f0ee661e1e221e), + LL(0x522261524343c543), LL(0xfc76b1fcc7c754c7), LL(0x2bb34f2bfcfc19fc), LL(0x1420241404040c04), + LL(0x08b2e3085151f351), LL(0xc7bc25c79999b699), LL(0xc44f22c46d6db76d), LL(0x396865390d0d170d), + LL(0x35837935fafa13fa), LL(0x84b66984dfdf7cdf), LL(0x9bd7a99b7e7e827e), LL(0xb43d19b424246c24), + LL(0xd7c5fed73b3b4d3b), LL(0x3d319a3dababe0ab), LL(0xd13ef0d1cece4fce), LL(0x5588995511113311), + LL(0x890c83898f8f8c8f), LL(0x6b4a046b4e4ed24e), LL(0x51d16651b7b7c4b7), LL(0x600be060ebeb20eb), + LL(0xccfdc1cc3c3c443c), LL(0xbf7cfdbf81819e81), LL(0xfed440fe9494a194), LL(0x0ceb1c0cf7f704f7), + LL(0x67a11867b9b9d6b9), LL(0x5f988b5f13133513), LL(0x9c7d519c2c2c742c), LL(0xb8d605b8d3d368d3), + LL(0x5c6b8c5ce7e734e7), LL(0xcb5739cb6e6eb26e), LL(0xf36eaaf3c4c451c4), LL(0x0f181b0f03030503), + LL(0x138adc135656fa56), LL(0x491a5e494444cc44), LL(0x9edfa09e7f7f817f), LL(0x37218837a9a9e6a9), + LL(0x824d67822a2a7e2a), LL(0x6db10a6dbbbbd0bb), LL(0xe24687e2c1c15ec1), LL(0x02a2f1025353f553), + LL(0x8bae728bdcdc79dc), LL(0x275853270b0b1d0b), LL(0xd39c01d39d9dba9d), LL(0xc1472bc16c6cb46c), + LL(0xf595a4f531315331), LL(0xb987f3b974749c74), LL(0x09e31509f6f607f6), LL(0x430a4c434646ca46), + LL(0x2609a526acace9ac), LL(0x973cb59789898689), LL(0x44a0b44414143c14), LL(0x425bba42e1e13ee1), + LL(0x4eb0a64e16163a16), LL(0xd2cdf7d23a3a4e3a), LL(0xd06f06d06969bb69), LL(0x2d48412d09091b09), + LL(0xada7d7ad70709070), LL(0x54d96f54b6b6c7b6), LL(0xb7ce1eb7d0d06dd0), LL(0x7e3bd67eeded2aed), + LL(0xdb2ee2dbcccc49cc), LL(0x572a68574242c642), LL(0xc2b42cc29898b598), LL(0x0e49ed0ea4a4f1a4), + LL(0x885d758828287828), LL(0x31da86315c5ce45c), LL(0x3f936b3ff8f815f8), LL(0xa444c2a486869786), +}; + +static const uint64_t C5[256] = { + LL(0x1878c0d878181828), LL(0x23af0526af232365), LL(0xc6f97eb8f9c6c657), LL(0xe86f13fb6fe8e825), + LL(0x87a14ccba1878794), LL(0xb862a91162b8b8d5), LL(0x0105080905010103), LL(0x4f6e420d6e4f4fd1), + LL(0x36eead9bee36365a), LL(0xa60459ff04a6a6f7), LL(0xd2bdde0cbdd2d26b), LL(0xf506fb0e06f5f502), + LL(0x7980ef968079798b), LL(0x6fce5f30ce6f6fb1), LL(0x91effc6def9191ae), LL(0x5207aaf8075252f6), + LL(0x60fd2747fd6060a0), LL(0xbc76893576bcbcd9), LL(0x9bcdac37cd9b9bb0), LL(0x8e8c048a8c8e8e8f), + LL(0xa31571d215a3a3f8), LL(0x0c3c606c3c0c0c14), LL(0x7b8aff848a7b7b8d), LL(0x35e1b580e135355f), + LL(0x1d69e8f5691d1d27), LL(0xe04753b347e0e03d), LL(0xd7acf621acd7d764), LL(0xc2ed5e9cedc2c25b), + LL(0x2e966d43962e2e72), LL(0x4b7a62297a4b4bdd), LL(0xfe21a35d21fefe1f), LL(0x571682d5165757f9), + LL(0x1541a8bd4115153f), LL(0x77b69fe8b6777799), LL(0x37eba592eb373759), LL(0xe5567b9e56e5e532), + LL(0x9fd98c13d99f9fbc), LL(0xf017d32317f0f00d), LL(0x4a7f6a207f4a4ade), LL(0xda959e4495dada73), + LL(0x5825faa2255858e8), LL(0xc9ca06cfcac9c946), LL(0x298d557c8d29297b), LL(0x0a22505a220a0a1e), + LL(0xb14fe1504fb1b1ce), LL(0xa01a69c91aa0a0fd), LL(0x6bda7f14da6b6bbd), LL(0x85ab5cd9ab858592), + LL(0xbd73813c73bdbdda), LL(0x5d34d28f345d5de7), LL(0x1050809050101030), LL(0xf403f30703f4f401), + LL(0xcbc016ddc0cbcb40), LL(0x3ec6edd3c63e3e42), LL(0x0511282d1105050f), LL(0x67e61f78e66767a9), + LL(0xe453739753e4e431), LL(0x27bb2502bb272769), LL(0x41583273584141c3), LL(0x8b9d2ca79d8b8b80), + LL(0xa70151f601a7a7f4), LL(0x7d94cfb2947d7d87), LL(0x95fbdc49fb9595a2), LL(0xd89f8e569fd8d875), + LL(0xfb308b7030fbfb10), LL(0xee7123cd71eeee2f), LL(0x7c91c7bb917c7c84), LL(0x66e31771e36666aa), + LL(0xdd8ea67b8edddd7a), LL(0x174bb8af4b171739), LL(0x47460245464747c9), LL(0x9edc841adc9e9ebf), + LL(0xcac51ed4c5caca43), LL(0x2d997558992d2d77), LL(0xbf79912e79bfbfdc), LL(0x071b383f1b070709), + LL(0xad2301ac23adadea), LL(0x5a2feab02f5a5aee), LL(0x83b56cefb5838398), LL(0x33ff85b6ff333355), + LL(0x63f23f5cf26363a5), LL(0x020a10120a020206), LL(0xaa38399338aaaae3), LL(0x71a8afdea8717193), + LL(0xc8cf0ec6cfc8c845), LL(0x197dc8d17d19192b), LL(0x4970723b704949db), LL(0xd99a865f9ad9d976), + LL(0xf21dc3311df2f20b), LL(0xe3484ba848e3e338), LL(0x5b2ae2b92a5b5bed), LL(0x889234bc92888885), + LL(0x9ac8a43ec89a9ab3), LL(0x26be2d0bbe26266a), LL(0x32fa8dbffa323256), LL(0xb04ae9594ab0b0cd), + LL(0xe96a1bf26ae9e926), LL(0x0f337877330f0f11), LL(0xd5a6e633a6d5d562), LL(0x80ba74f4ba80809d), + LL(0xbe7c99277cbebedf), LL(0xcdde26ebdecdcd4a), LL(0x34e4bd89e434345c), LL(0x48757a32754848d8), + LL(0xff24ab5424ffff1c), LL(0x7a8ff78d8f7a7a8e), LL(0x90eaf464ea9090ad), LL(0x5f3ec29d3e5f5fe1), + LL(0x20a01d3da0202060), LL(0x68d5670fd56868b8), LL(0x1a72d0ca721a1a2e), LL(0xae2c19b72caeaeef), + LL(0xb45ec97d5eb4b4c1), LL(0x54199ace195454fc), LL(0x93e5ec7fe59393a8), LL(0x22aa0d2faa222266), + LL(0x64e90763e96464ac), LL(0xf112db2a12f1f10e), LL(0x73a2bfcca2737395), LL(0x125a90825a121236), + LL(0x405d3a7a5d4040c0), LL(0x0828404828080818), LL(0xc3e85695e8c3c358), LL(0xec7b33df7becec29), + LL(0xdb90964d90dbdb70), LL(0xa11f61c01fa1a1fe), LL(0x8d831c91838d8d8a), LL(0x3dc9f5c8c93d3d47), + LL(0x97f1cc5bf19797a4), LL(0x0000000000000000), LL(0xcfd436f9d4cfcf4c), LL(0x2b87456e872b2b7d), + LL(0x76b397e1b376769a), LL(0x82b064e6b082829b), LL(0xd6a9fe28a9d6d667), LL(0x1b77d8c3771b1b2d), + LL(0xb55bc1745bb5b5c2), LL(0xaf2911be29afafec), LL(0x6adf771ddf6a6abe), LL(0x500dbaea0d5050f0), + LL(0x454c12574c4545cf), LL(0xf318cb3818f3f308), LL(0x30f09dadf0303050), LL(0xef742bc474efef2c), + LL(0x3fc3e5dac33f3f41), LL(0x551c92c71c5555ff), LL(0xa21079db10a2a2fb), LL(0xea6503e965eaea23), + LL(0x65ec0f6aec6565af), LL(0xba68b90368babad3), LL(0x2f93654a932f2f71), LL(0xc0e74e8ee7c0c05d), + LL(0xde81be6081dede7f), LL(0x1c6ce0fc6c1c1c24), LL(0xfd2ebb462efdfd1a), LL(0x4d64521f644d4dd7), + LL(0x92e0e476e09292ab), LL(0x75bc8ffabc75759f), LL(0x061e30361e06060a), LL(0x8a9824ae988a8a83), + LL(0xb240f94b40b2b2cb), LL(0xe659638559e6e637), LL(0x0e36707e360e0e12), LL(0x1f63f8e7631f1f21), + LL(0x62f73755f76262a6), LL(0xd4a3ee3aa3d4d461), LL(0xa832298132a8a8e5), LL(0x96f4c452f49696a7), + LL(0xf93a9b623af9f916), LL(0xc5f666a3f6c5c552), LL(0x25b13510b125256f), LL(0x5920f2ab205959eb), + LL(0x84ae54d0ae848491), LL(0x72a7b7c5a7727296), LL(0x39ddd5ecdd39394b), LL(0x4c615a16614c4cd4), + LL(0x5e3bca943b5e5ee2), LL(0x7885e79f85787888), LL(0x38d8dde5d8383848), LL(0x8c861498868c8c89), + LL(0xd1b2c617b2d1d16e), LL(0xa50b41e40ba5a5f2), LL(0xe24d43a14de2e23b), LL(0x61f82f4ef86161a3), + LL(0xb345f14245b3b3c8), LL(0x21a51534a5212163), LL(0x9cd69408d69c9cb9), LL(0x1e66f0ee661e1e22), + LL(0x43522261524343c5), LL(0xc7fc76b1fcc7c754), LL(0xfc2bb34f2bfcfc19), LL(0x041420241404040c), + LL(0x5108b2e3085151f3), LL(0x99c7bc25c79999b6), LL(0x6dc44f22c46d6db7), LL(0x0d396865390d0d17), + LL(0xfa35837935fafa13), LL(0xdf84b66984dfdf7c), LL(0x7e9bd7a99b7e7e82), LL(0x24b43d19b424246c), + LL(0x3bd7c5fed73b3b4d), LL(0xab3d319a3dababe0), LL(0xced13ef0d1cece4f), LL(0x1155889955111133), + LL(0x8f890c83898f8f8c), LL(0x4e6b4a046b4e4ed2), LL(0xb751d16651b7b7c4), LL(0xeb600be060ebeb20), + LL(0x3cccfdc1cc3c3c44), LL(0x81bf7cfdbf81819e), LL(0x94fed440fe9494a1), LL(0xf70ceb1c0cf7f704), + LL(0xb967a11867b9b9d6), LL(0x135f988b5f131335), LL(0x2c9c7d519c2c2c74), LL(0xd3b8d605b8d3d368), + LL(0xe75c6b8c5ce7e734), LL(0x6ecb5739cb6e6eb2), LL(0xc4f36eaaf3c4c451), LL(0x030f181b0f030305), + LL(0x56138adc135656fa), LL(0x44491a5e494444cc), LL(0x7f9edfa09e7f7f81), LL(0xa937218837a9a9e6), + LL(0x2a824d67822a2a7e), LL(0xbb6db10a6dbbbbd0), LL(0xc1e24687e2c1c15e), LL(0x5302a2f1025353f5), + LL(0xdc8bae728bdcdc79), LL(0x0b275853270b0b1d), LL(0x9dd39c01d39d9dba), LL(0x6cc1472bc16c6cb4), + LL(0x31f595a4f5313153), LL(0x74b987f3b974749c), LL(0xf609e31509f6f607), LL(0x46430a4c434646ca), + LL(0xac2609a526acace9), LL(0x89973cb597898986), LL(0x1444a0b44414143c), LL(0xe1425bba42e1e13e), + LL(0x164eb0a64e16163a), LL(0x3ad2cdf7d23a3a4e), LL(0x69d06f06d06969bb), LL(0x092d48412d09091b), + LL(0x70ada7d7ad707090), LL(0xb654d96f54b6b6c7), LL(0xd0b7ce1eb7d0d06d), LL(0xed7e3bd67eeded2a), + LL(0xccdb2ee2dbcccc49), LL(0x42572a68574242c6), LL(0x98c2b42cc29898b5), LL(0xa40e49ed0ea4a4f1), + LL(0x28885d7588282878), LL(0x5c31da86315c5ce4), LL(0xf83f936b3ff8f815), LL(0x86a444c2a4868697), +}; + +static const uint64_t C6[256] = { + LL(0x281878c0d8781818), LL(0x6523af0526af2323), LL(0x57c6f97eb8f9c6c6), LL(0x25e86f13fb6fe8e8), + LL(0x9487a14ccba18787), LL(0xd5b862a91162b8b8), LL(0x0301050809050101), LL(0xd14f6e420d6e4f4f), + LL(0x5a36eead9bee3636), LL(0xf7a60459ff04a6a6), LL(0x6bd2bdde0cbdd2d2), LL(0x02f506fb0e06f5f5), + LL(0x8b7980ef96807979), LL(0xb16fce5f30ce6f6f), LL(0xae91effc6def9191), LL(0xf65207aaf8075252), + LL(0xa060fd2747fd6060), LL(0xd9bc76893576bcbc), LL(0xb09bcdac37cd9b9b), LL(0x8f8e8c048a8c8e8e), + LL(0xf8a31571d215a3a3), LL(0x140c3c606c3c0c0c), LL(0x8d7b8aff848a7b7b), LL(0x5f35e1b580e13535), + LL(0x271d69e8f5691d1d), LL(0x3de04753b347e0e0), LL(0x64d7acf621acd7d7), LL(0x5bc2ed5e9cedc2c2), + LL(0x722e966d43962e2e), LL(0xdd4b7a62297a4b4b), LL(0x1ffe21a35d21fefe), LL(0xf9571682d5165757), + LL(0x3f1541a8bd411515), LL(0x9977b69fe8b67777), LL(0x5937eba592eb3737), LL(0x32e5567b9e56e5e5), + LL(0xbc9fd98c13d99f9f), LL(0x0df017d32317f0f0), LL(0xde4a7f6a207f4a4a), LL(0x73da959e4495dada), + LL(0xe85825faa2255858), LL(0x46c9ca06cfcac9c9), LL(0x7b298d557c8d2929), LL(0x1e0a22505a220a0a), + LL(0xceb14fe1504fb1b1), LL(0xfda01a69c91aa0a0), LL(0xbd6bda7f14da6b6b), LL(0x9285ab5cd9ab8585), + LL(0xdabd73813c73bdbd), LL(0xe75d34d28f345d5d), LL(0x3010508090501010), LL(0x01f403f30703f4f4), + LL(0x40cbc016ddc0cbcb), LL(0x423ec6edd3c63e3e), LL(0x0f0511282d110505), LL(0xa967e61f78e66767), + LL(0x31e453739753e4e4), LL(0x6927bb2502bb2727), LL(0xc341583273584141), LL(0x808b9d2ca79d8b8b), + LL(0xf4a70151f601a7a7), LL(0x877d94cfb2947d7d), LL(0xa295fbdc49fb9595), LL(0x75d89f8e569fd8d8), + LL(0x10fb308b7030fbfb), LL(0x2fee7123cd71eeee), LL(0x847c91c7bb917c7c), LL(0xaa66e31771e36666), + LL(0x7add8ea67b8edddd), LL(0x39174bb8af4b1717), LL(0xc947460245464747), LL(0xbf9edc841adc9e9e), + LL(0x43cac51ed4c5caca), LL(0x772d997558992d2d), LL(0xdcbf79912e79bfbf), LL(0x09071b383f1b0707), + LL(0xeaad2301ac23adad), LL(0xee5a2feab02f5a5a), LL(0x9883b56cefb58383), LL(0x5533ff85b6ff3333), + LL(0xa563f23f5cf26363), LL(0x06020a10120a0202), LL(0xe3aa38399338aaaa), LL(0x9371a8afdea87171), + LL(0x45c8cf0ec6cfc8c8), LL(0x2b197dc8d17d1919), LL(0xdb4970723b704949), LL(0x76d99a865f9ad9d9), + LL(0x0bf21dc3311df2f2), LL(0x38e3484ba848e3e3), LL(0xed5b2ae2b92a5b5b), LL(0x85889234bc928888), + LL(0xb39ac8a43ec89a9a), LL(0x6a26be2d0bbe2626), LL(0x5632fa8dbffa3232), LL(0xcdb04ae9594ab0b0), + LL(0x26e96a1bf26ae9e9), LL(0x110f337877330f0f), LL(0x62d5a6e633a6d5d5), LL(0x9d80ba74f4ba8080), + LL(0xdfbe7c99277cbebe), LL(0x4acdde26ebdecdcd), LL(0x5c34e4bd89e43434), LL(0xd848757a32754848), + LL(0x1cff24ab5424ffff), LL(0x8e7a8ff78d8f7a7a), LL(0xad90eaf464ea9090), LL(0xe15f3ec29d3e5f5f), + LL(0x6020a01d3da02020), LL(0xb868d5670fd56868), LL(0x2e1a72d0ca721a1a), LL(0xefae2c19b72caeae), + LL(0xc1b45ec97d5eb4b4), LL(0xfc54199ace195454), LL(0xa893e5ec7fe59393), LL(0x6622aa0d2faa2222), + LL(0xac64e90763e96464), LL(0x0ef112db2a12f1f1), LL(0x9573a2bfcca27373), LL(0x36125a90825a1212), + LL(0xc0405d3a7a5d4040), LL(0x1808284048280808), LL(0x58c3e85695e8c3c3), LL(0x29ec7b33df7becec), + LL(0x70db90964d90dbdb), LL(0xfea11f61c01fa1a1), LL(0x8a8d831c91838d8d), LL(0x473dc9f5c8c93d3d), + LL(0xa497f1cc5bf19797), LL(0x0000000000000000), LL(0x4ccfd436f9d4cfcf), LL(0x7d2b87456e872b2b), + LL(0x9a76b397e1b37676), LL(0x9b82b064e6b08282), LL(0x67d6a9fe28a9d6d6), LL(0x2d1b77d8c3771b1b), + LL(0xc2b55bc1745bb5b5), LL(0xecaf2911be29afaf), LL(0xbe6adf771ddf6a6a), LL(0xf0500dbaea0d5050), + LL(0xcf454c12574c4545), LL(0x08f318cb3818f3f3), LL(0x5030f09dadf03030), LL(0x2cef742bc474efef), + LL(0x413fc3e5dac33f3f), LL(0xff551c92c71c5555), LL(0xfba21079db10a2a2), LL(0x23ea6503e965eaea), + LL(0xaf65ec0f6aec6565), LL(0xd3ba68b90368baba), LL(0x712f93654a932f2f), LL(0x5dc0e74e8ee7c0c0), + LL(0x7fde81be6081dede), LL(0x241c6ce0fc6c1c1c), LL(0x1afd2ebb462efdfd), LL(0xd74d64521f644d4d), + LL(0xab92e0e476e09292), LL(0x9f75bc8ffabc7575), LL(0x0a061e30361e0606), LL(0x838a9824ae988a8a), + LL(0xcbb240f94b40b2b2), LL(0x37e659638559e6e6), LL(0x120e36707e360e0e), LL(0x211f63f8e7631f1f), + LL(0xa662f73755f76262), LL(0x61d4a3ee3aa3d4d4), LL(0xe5a832298132a8a8), LL(0xa796f4c452f49696), + LL(0x16f93a9b623af9f9), LL(0x52c5f666a3f6c5c5), LL(0x6f25b13510b12525), LL(0xeb5920f2ab205959), + LL(0x9184ae54d0ae8484), LL(0x9672a7b7c5a77272), LL(0x4b39ddd5ecdd3939), LL(0xd44c615a16614c4c), + LL(0xe25e3bca943b5e5e), LL(0x887885e79f857878), LL(0x4838d8dde5d83838), LL(0x898c861498868c8c), + LL(0x6ed1b2c617b2d1d1), LL(0xf2a50b41e40ba5a5), LL(0x3be24d43a14de2e2), LL(0xa361f82f4ef86161), + LL(0xc8b345f14245b3b3), LL(0x6321a51534a52121), LL(0xb99cd69408d69c9c), LL(0x221e66f0ee661e1e), + LL(0xc543522261524343), LL(0x54c7fc76b1fcc7c7), LL(0x19fc2bb34f2bfcfc), LL(0x0c04142024140404), + LL(0xf35108b2e3085151), LL(0xb699c7bc25c79999), LL(0xb76dc44f22c46d6d), LL(0x170d396865390d0d), + LL(0x13fa35837935fafa), LL(0x7cdf84b66984dfdf), LL(0x827e9bd7a99b7e7e), LL(0x6c24b43d19b42424), + LL(0x4d3bd7c5fed73b3b), LL(0xe0ab3d319a3dabab), LL(0x4fced13ef0d1cece), LL(0x3311558899551111), + LL(0x8c8f890c83898f8f), LL(0xd24e6b4a046b4e4e), LL(0xc4b751d16651b7b7), LL(0x20eb600be060ebeb), + LL(0x443cccfdc1cc3c3c), LL(0x9e81bf7cfdbf8181), LL(0xa194fed440fe9494), LL(0x04f70ceb1c0cf7f7), + LL(0xd6b967a11867b9b9), LL(0x35135f988b5f1313), LL(0x742c9c7d519c2c2c), LL(0x68d3b8d605b8d3d3), + LL(0x34e75c6b8c5ce7e7), LL(0xb26ecb5739cb6e6e), LL(0x51c4f36eaaf3c4c4), LL(0x05030f181b0f0303), + LL(0xfa56138adc135656), LL(0xcc44491a5e494444), LL(0x817f9edfa09e7f7f), LL(0xe6a937218837a9a9), + LL(0x7e2a824d67822a2a), LL(0xd0bb6db10a6dbbbb), LL(0x5ec1e24687e2c1c1), LL(0xf55302a2f1025353), + LL(0x79dc8bae728bdcdc), LL(0x1d0b275853270b0b), LL(0xba9dd39c01d39d9d), LL(0xb46cc1472bc16c6c), + LL(0x5331f595a4f53131), LL(0x9c74b987f3b97474), LL(0x07f609e31509f6f6), LL(0xca46430a4c434646), + LL(0xe9ac2609a526acac), LL(0x8689973cb5978989), LL(0x3c1444a0b4441414), LL(0x3ee1425bba42e1e1), + LL(0x3a164eb0a64e1616), LL(0x4e3ad2cdf7d23a3a), LL(0xbb69d06f06d06969), LL(0x1b092d48412d0909), + LL(0x9070ada7d7ad7070), LL(0xc7b654d96f54b6b6), LL(0x6dd0b7ce1eb7d0d0), LL(0x2aed7e3bd67eeded), + LL(0x49ccdb2ee2dbcccc), LL(0xc642572a68574242), LL(0xb598c2b42cc29898), LL(0xf1a40e49ed0ea4a4), + LL(0x7828885d75882828), LL(0xe45c31da86315c5c), LL(0x15f83f936b3ff8f8), LL(0x9786a444c2a48686), +}; + +static const uint64_t C7[256] = { + LL(0x18281878c0d87818), LL(0x236523af0526af23), LL(0xc657c6f97eb8f9c6), LL(0xe825e86f13fb6fe8), + LL(0x879487a14ccba187), LL(0xb8d5b862a91162b8), LL(0x0103010508090501), LL(0x4fd14f6e420d6e4f), + LL(0x365a36eead9bee36), LL(0xa6f7a60459ff04a6), LL(0xd26bd2bdde0cbdd2), LL(0xf502f506fb0e06f5), + LL(0x798b7980ef968079), LL(0x6fb16fce5f30ce6f), LL(0x91ae91effc6def91), LL(0x52f65207aaf80752), + LL(0x60a060fd2747fd60), LL(0xbcd9bc76893576bc), LL(0x9bb09bcdac37cd9b), LL(0x8e8f8e8c048a8c8e), + LL(0xa3f8a31571d215a3), LL(0x0c140c3c606c3c0c), LL(0x7b8d7b8aff848a7b), LL(0x355f35e1b580e135), + LL(0x1d271d69e8f5691d), LL(0xe03de04753b347e0), LL(0xd764d7acf621acd7), LL(0xc25bc2ed5e9cedc2), + LL(0x2e722e966d43962e), LL(0x4bdd4b7a62297a4b), LL(0xfe1ffe21a35d21fe), LL(0x57f9571682d51657), + LL(0x153f1541a8bd4115), LL(0x779977b69fe8b677), LL(0x375937eba592eb37), LL(0xe532e5567b9e56e5), + LL(0x9fbc9fd98c13d99f), LL(0xf00df017d32317f0), LL(0x4ade4a7f6a207f4a), LL(0xda73da959e4495da), + LL(0x58e85825faa22558), LL(0xc946c9ca06cfcac9), LL(0x297b298d557c8d29), LL(0x0a1e0a22505a220a), + LL(0xb1ceb14fe1504fb1), LL(0xa0fda01a69c91aa0), LL(0x6bbd6bda7f14da6b), LL(0x859285ab5cd9ab85), + LL(0xbddabd73813c73bd), LL(0x5de75d34d28f345d), LL(0x1030105080905010), LL(0xf401f403f30703f4), + LL(0xcb40cbc016ddc0cb), LL(0x3e423ec6edd3c63e), LL(0x050f0511282d1105), LL(0x67a967e61f78e667), + LL(0xe431e453739753e4), LL(0x276927bb2502bb27), LL(0x41c3415832735841), LL(0x8b808b9d2ca79d8b), + LL(0xa7f4a70151f601a7), LL(0x7d877d94cfb2947d), LL(0x95a295fbdc49fb95), LL(0xd875d89f8e569fd8), + LL(0xfb10fb308b7030fb), LL(0xee2fee7123cd71ee), LL(0x7c847c91c7bb917c), LL(0x66aa66e31771e366), + LL(0xdd7add8ea67b8edd), LL(0x1739174bb8af4b17), LL(0x47c9474602454647), LL(0x9ebf9edc841adc9e), + LL(0xca43cac51ed4c5ca), LL(0x2d772d997558992d), LL(0xbfdcbf79912e79bf), LL(0x0709071b383f1b07), + LL(0xadeaad2301ac23ad), LL(0x5aee5a2feab02f5a), LL(0x839883b56cefb583), LL(0x335533ff85b6ff33), + LL(0x63a563f23f5cf263), LL(0x0206020a10120a02), LL(0xaae3aa38399338aa), LL(0x719371a8afdea871), + LL(0xc845c8cf0ec6cfc8), LL(0x192b197dc8d17d19), LL(0x49db4970723b7049), LL(0xd976d99a865f9ad9), + LL(0xf20bf21dc3311df2), LL(0xe338e3484ba848e3), LL(0x5bed5b2ae2b92a5b), LL(0x8885889234bc9288), + LL(0x9ab39ac8a43ec89a), LL(0x266a26be2d0bbe26), LL(0x325632fa8dbffa32), LL(0xb0cdb04ae9594ab0), + LL(0xe926e96a1bf26ae9), LL(0x0f110f337877330f), LL(0xd562d5a6e633a6d5), LL(0x809d80ba74f4ba80), + LL(0xbedfbe7c99277cbe), LL(0xcd4acdde26ebdecd), LL(0x345c34e4bd89e434), LL(0x48d848757a327548), + LL(0xff1cff24ab5424ff), LL(0x7a8e7a8ff78d8f7a), LL(0x90ad90eaf464ea90), LL(0x5fe15f3ec29d3e5f), + LL(0x206020a01d3da020), LL(0x68b868d5670fd568), LL(0x1a2e1a72d0ca721a), LL(0xaeefae2c19b72cae), + LL(0xb4c1b45ec97d5eb4), LL(0x54fc54199ace1954), LL(0x93a893e5ec7fe593), LL(0x226622aa0d2faa22), + LL(0x64ac64e90763e964), LL(0xf10ef112db2a12f1), LL(0x739573a2bfcca273), LL(0x1236125a90825a12), + LL(0x40c0405d3a7a5d40), LL(0x0818082840482808), LL(0xc358c3e85695e8c3), LL(0xec29ec7b33df7bec), + LL(0xdb70db90964d90db), LL(0xa1fea11f61c01fa1), LL(0x8d8a8d831c91838d), LL(0x3d473dc9f5c8c93d), + LL(0x97a497f1cc5bf197), LL(0x0000000000000000), LL(0xcf4ccfd436f9d4cf), LL(0x2b7d2b87456e872b), + LL(0x769a76b397e1b376), LL(0x829b82b064e6b082), LL(0xd667d6a9fe28a9d6), LL(0x1b2d1b77d8c3771b), + LL(0xb5c2b55bc1745bb5), LL(0xafecaf2911be29af), LL(0x6abe6adf771ddf6a), LL(0x50f0500dbaea0d50), + LL(0x45cf454c12574c45), LL(0xf308f318cb3818f3), LL(0x305030f09dadf030), LL(0xef2cef742bc474ef), + LL(0x3f413fc3e5dac33f), LL(0x55ff551c92c71c55), LL(0xa2fba21079db10a2), LL(0xea23ea6503e965ea), + LL(0x65af65ec0f6aec65), LL(0xbad3ba68b90368ba), LL(0x2f712f93654a932f), LL(0xc05dc0e74e8ee7c0), + LL(0xde7fde81be6081de), LL(0x1c241c6ce0fc6c1c), LL(0xfd1afd2ebb462efd), LL(0x4dd74d64521f644d), + LL(0x92ab92e0e476e092), LL(0x759f75bc8ffabc75), LL(0x060a061e30361e06), LL(0x8a838a9824ae988a), + LL(0xb2cbb240f94b40b2), LL(0xe637e659638559e6), LL(0x0e120e36707e360e), LL(0x1f211f63f8e7631f), + LL(0x62a662f73755f762), LL(0xd461d4a3ee3aa3d4), LL(0xa8e5a832298132a8), LL(0x96a796f4c452f496), + LL(0xf916f93a9b623af9), LL(0xc552c5f666a3f6c5), LL(0x256f25b13510b125), LL(0x59eb5920f2ab2059), + LL(0x849184ae54d0ae84), LL(0x729672a7b7c5a772), LL(0x394b39ddd5ecdd39), LL(0x4cd44c615a16614c), + LL(0x5ee25e3bca943b5e), LL(0x78887885e79f8578), LL(0x384838d8dde5d838), LL(0x8c898c861498868c), + LL(0xd16ed1b2c617b2d1), LL(0xa5f2a50b41e40ba5), LL(0xe23be24d43a14de2), LL(0x61a361f82f4ef861), + LL(0xb3c8b345f14245b3), LL(0x216321a51534a521), LL(0x9cb99cd69408d69c), LL(0x1e221e66f0ee661e), + LL(0x43c5435222615243), LL(0xc754c7fc76b1fcc7), LL(0xfc19fc2bb34f2bfc), LL(0x040c041420241404), + LL(0x51f35108b2e30851), LL(0x99b699c7bc25c799), LL(0x6db76dc44f22c46d), LL(0x0d170d396865390d), + LL(0xfa13fa35837935fa), LL(0xdf7cdf84b66984df), LL(0x7e827e9bd7a99b7e), LL(0x246c24b43d19b424), + LL(0x3b4d3bd7c5fed73b), LL(0xabe0ab3d319a3dab), LL(0xce4fced13ef0d1ce), LL(0x1133115588995511), + LL(0x8f8c8f890c83898f), LL(0x4ed24e6b4a046b4e), LL(0xb7c4b751d16651b7), LL(0xeb20eb600be060eb), + LL(0x3c443cccfdc1cc3c), LL(0x819e81bf7cfdbf81), LL(0x94a194fed440fe94), LL(0xf704f70ceb1c0cf7), + LL(0xb9d6b967a11867b9), LL(0x1335135f988b5f13), LL(0x2c742c9c7d519c2c), LL(0xd368d3b8d605b8d3), + LL(0xe734e75c6b8c5ce7), LL(0x6eb26ecb5739cb6e), LL(0xc451c4f36eaaf3c4), LL(0x0305030f181b0f03), + LL(0x56fa56138adc1356), LL(0x44cc44491a5e4944), LL(0x7f817f9edfa09e7f), LL(0xa9e6a937218837a9), + LL(0x2a7e2a824d67822a), LL(0xbbd0bb6db10a6dbb), LL(0xc15ec1e24687e2c1), LL(0x53f55302a2f10253), + LL(0xdc79dc8bae728bdc), LL(0x0b1d0b275853270b), LL(0x9dba9dd39c01d39d), LL(0x6cb46cc1472bc16c), + LL(0x315331f595a4f531), LL(0x749c74b987f3b974), LL(0xf607f609e31509f6), LL(0x46ca46430a4c4346), + LL(0xace9ac2609a526ac), LL(0x898689973cb59789), LL(0x143c1444a0b44414), LL(0xe13ee1425bba42e1), + LL(0x163a164eb0a64e16), LL(0x3a4e3ad2cdf7d23a), LL(0x69bb69d06f06d069), LL(0x091b092d48412d09), + LL(0x709070ada7d7ad70), LL(0xb6c7b654d96f54b6), LL(0xd06dd0b7ce1eb7d0), LL(0xed2aed7e3bd67eed), + LL(0xcc49ccdb2ee2dbcc), LL(0x42c642572a685742), LL(0x98b598c2b42cc298), LL(0xa4f1a40e49ed0ea4), + LL(0x287828885d758828), LL(0x5ce45c31da86315c), LL(0xf815f83f936b3ff8), LL(0x869786a444c2a486), +}; +#endif /* OBSOLETE */ + +static const uint64_t rc[R + 1] = { + LL(0x0000000000000000), + LL(0x1823c6e887b8014f), + LL(0x36a6d2f5796f9152), + LL(0x60bc9b8ea30c7b35), + LL(0x1de0d7c22e4bfe57), + LL(0x157737e59ff04ada), + LL(0x58c9290ab1a06b85), + LL(0xbd5d10f4cb3e0567), + LL(0xe427418ba77d95d8), + LL(0xfbee7c66dd17479e), + LL(0xca2dbf07ad5a8333), +}; + +/** + * The core Whirlpool transform. + */ +static void processBuffer(struct WHIRLPOOLstruct * const structpointer) { + int i, r; + uint64_t K[8]; /* the round key */ + uint64_t block[8]; /* mu(buffer) */ + uint64_t state[8]; /* the cipher state */ + uint64_t L[8]; + unsigned char *buffer = structpointer->buffer; + + /* + * map the buffer to a block: + */ + for (i = 0; i < 8; i++, buffer += 8) { + block[i] = + (((uint64_t)buffer[0] ) << 56) ^ + (((uint64_t)buffer[1] & 0xffL) << 48) ^ + (((uint64_t)buffer[2] & 0xffL) << 40) ^ + (((uint64_t)buffer[3] & 0xffL) << 32) ^ + (((uint64_t)buffer[4] & 0xffL) << 24) ^ + (((uint64_t)buffer[5] & 0xffL) << 16) ^ + (((uint64_t)buffer[6] & 0xffL) << 8) ^ + (((uint64_t)buffer[7] & 0xffL) ); + } + /* + * compute and apply K^0 to the cipher state: + */ + state[0] = block[0] ^ (K[0] = structpointer->hash[0]); + state[1] = block[1] ^ (K[1] = structpointer->hash[1]); + state[2] = block[2] ^ (K[2] = structpointer->hash[2]); + state[3] = block[3] ^ (K[3] = structpointer->hash[3]); + state[4] = block[4] ^ (K[4] = structpointer->hash[4]); + state[5] = block[5] ^ (K[5] = structpointer->hash[5]); + state[6] = block[6] ^ (K[6] = structpointer->hash[6]); + state[7] = block[7] ^ (K[7] = structpointer->hash[7]); + + /* + * iterate over all rounds: + */ + for (r = 1; r <= R; r++) { + /* + * compute K^r from K^{r-1}: + */ + L[0] = + C0[(int)(K[0] >> 56) ] ^ + C1[(int)(K[7] >> 48) & 0xff] ^ + C2[(int)(K[6] >> 40) & 0xff] ^ + C3[(int)(K[5] >> 32) & 0xff] ^ + C4[(int)(K[4] >> 24) & 0xff] ^ + C5[(int)(K[3] >> 16) & 0xff] ^ + C6[(int)(K[2] >> 8) & 0xff] ^ + C7[(int)(K[1] ) & 0xff] ^ + rc[r]; + L[1] = + C0[(int)(K[1] >> 56) ] ^ + C1[(int)(K[0] >> 48) & 0xff] ^ + C2[(int)(K[7] >> 40) & 0xff] ^ + C3[(int)(K[6] >> 32) & 0xff] ^ + C4[(int)(K[5] >> 24) & 0xff] ^ + C5[(int)(K[4] >> 16) & 0xff] ^ + C6[(int)(K[3] >> 8) & 0xff] ^ + C7[(int)(K[2] ) & 0xff]; + L[2] = + C0[(int)(K[2] >> 56) ] ^ + C1[(int)(K[1] >> 48) & 0xff] ^ + C2[(int)(K[0] >> 40) & 0xff] ^ + C3[(int)(K[7] >> 32) & 0xff] ^ + C4[(int)(K[6] >> 24) & 0xff] ^ + C5[(int)(K[5] >> 16) & 0xff] ^ + C6[(int)(K[4] >> 8) & 0xff] ^ + C7[(int)(K[3] ) & 0xff]; + L[3] = + C0[(int)(K[3] >> 56) ] ^ + C1[(int)(K[2] >> 48) & 0xff] ^ + C2[(int)(K[1] >> 40) & 0xff] ^ + C3[(int)(K[0] >> 32) & 0xff] ^ + C4[(int)(K[7] >> 24) & 0xff] ^ + C5[(int)(K[6] >> 16) & 0xff] ^ + C6[(int)(K[5] >> 8) & 0xff] ^ + C7[(int)(K[4] ) & 0xff]; + L[4] = + C0[(int)(K[4] >> 56) ] ^ + C1[(int)(K[3] >> 48) & 0xff] ^ + C2[(int)(K[2] >> 40) & 0xff] ^ + C3[(int)(K[1] >> 32) & 0xff] ^ + C4[(int)(K[0] >> 24) & 0xff] ^ + C5[(int)(K[7] >> 16) & 0xff] ^ + C6[(int)(K[6] >> 8) & 0xff] ^ + C7[(int)(K[5] ) & 0xff]; + L[5] = + C0[(int)(K[5] >> 56) ] ^ + C1[(int)(K[4] >> 48) & 0xff] ^ + C2[(int)(K[3] >> 40) & 0xff] ^ + C3[(int)(K[2] >> 32) & 0xff] ^ + C4[(int)(K[1] >> 24) & 0xff] ^ + C5[(int)(K[0] >> 16) & 0xff] ^ + C6[(int)(K[7] >> 8) & 0xff] ^ + C7[(int)(K[6] ) & 0xff]; + L[6] = + C0[(int)(K[6] >> 56) ] ^ + C1[(int)(K[5] >> 48) & 0xff] ^ + C2[(int)(K[4] >> 40) & 0xff] ^ + C3[(int)(K[3] >> 32) & 0xff] ^ + C4[(int)(K[2] >> 24) & 0xff] ^ + C5[(int)(K[1] >> 16) & 0xff] ^ + C6[(int)(K[0] >> 8) & 0xff] ^ + C7[(int)(K[7] ) & 0xff]; + L[7] = + C0[(int)(K[7] >> 56) ] ^ + C1[(int)(K[6] >> 48) & 0xff] ^ + C2[(int)(K[5] >> 40) & 0xff] ^ + C3[(int)(K[4] >> 32) & 0xff] ^ + C4[(int)(K[3] >> 24) & 0xff] ^ + C5[(int)(K[2] >> 16) & 0xff] ^ + C6[(int)(K[1] >> 8) & 0xff] ^ + C7[(int)(K[0] ) & 0xff]; + K[0] = L[0]; + K[1] = L[1]; + K[2] = L[2]; + K[3] = L[3]; + K[4] = L[4]; + K[5] = L[5]; + K[6] = L[6]; + K[7] = L[7]; + /* + * apply the r-th round transformation: + */ + L[0] = + C0[(int)(state[0] >> 56) ] ^ + C1[(int)(state[7] >> 48) & 0xff] ^ + C2[(int)(state[6] >> 40) & 0xff] ^ + C3[(int)(state[5] >> 32) & 0xff] ^ + C4[(int)(state[4] >> 24) & 0xff] ^ + C5[(int)(state[3] >> 16) & 0xff] ^ + C6[(int)(state[2] >> 8) & 0xff] ^ + C7[(int)(state[1] ) & 0xff] ^ + K[0]; + L[1] = + C0[(int)(state[1] >> 56) ] ^ + C1[(int)(state[0] >> 48) & 0xff] ^ + C2[(int)(state[7] >> 40) & 0xff] ^ + C3[(int)(state[6] >> 32) & 0xff] ^ + C4[(int)(state[5] >> 24) & 0xff] ^ + C5[(int)(state[4] >> 16) & 0xff] ^ + C6[(int)(state[3] >> 8) & 0xff] ^ + C7[(int)(state[2] ) & 0xff] ^ + K[1]; + L[2] = + C0[(int)(state[2] >> 56) ] ^ + C1[(int)(state[1] >> 48) & 0xff] ^ + C2[(int)(state[0] >> 40) & 0xff] ^ + C3[(int)(state[7] >> 32) & 0xff] ^ + C4[(int)(state[6] >> 24) & 0xff] ^ + C5[(int)(state[5] >> 16) & 0xff] ^ + C6[(int)(state[4] >> 8) & 0xff] ^ + C7[(int)(state[3] ) & 0xff] ^ + K[2]; + L[3] = + C0[(int)(state[3] >> 56) ] ^ + C1[(int)(state[2] >> 48) & 0xff] ^ + C2[(int)(state[1] >> 40) & 0xff] ^ + C3[(int)(state[0] >> 32) & 0xff] ^ + C4[(int)(state[7] >> 24) & 0xff] ^ + C5[(int)(state[6] >> 16) & 0xff] ^ + C6[(int)(state[5] >> 8) & 0xff] ^ + C7[(int)(state[4] ) & 0xff] ^ + K[3]; + L[4] = + C0[(int)(state[4] >> 56) ] ^ + C1[(int)(state[3] >> 48) & 0xff] ^ + C2[(int)(state[2] >> 40) & 0xff] ^ + C3[(int)(state[1] >> 32) & 0xff] ^ + C4[(int)(state[0] >> 24) & 0xff] ^ + C5[(int)(state[7] >> 16) & 0xff] ^ + C6[(int)(state[6] >> 8) & 0xff] ^ + C7[(int)(state[5] ) & 0xff] ^ + K[4]; + L[5] = + C0[(int)(state[5] >> 56) ] ^ + C1[(int)(state[4] >> 48) & 0xff] ^ + C2[(int)(state[3] >> 40) & 0xff] ^ + C3[(int)(state[2] >> 32) & 0xff] ^ + C4[(int)(state[1] >> 24) & 0xff] ^ + C5[(int)(state[0] >> 16) & 0xff] ^ + C6[(int)(state[7] >> 8) & 0xff] ^ + C7[(int)(state[6] ) & 0xff] ^ + K[5]; + L[6] = + C0[(int)(state[6] >> 56) ] ^ + C1[(int)(state[5] >> 48) & 0xff] ^ + C2[(int)(state[4] >> 40) & 0xff] ^ + C3[(int)(state[3] >> 32) & 0xff] ^ + C4[(int)(state[2] >> 24) & 0xff] ^ + C5[(int)(state[1] >> 16) & 0xff] ^ + C6[(int)(state[0] >> 8) & 0xff] ^ + C7[(int)(state[7] ) & 0xff] ^ + K[6]; + L[7] = + C0[(int)(state[7] >> 56) ] ^ + C1[(int)(state[6] >> 48) & 0xff] ^ + C2[(int)(state[5] >> 40) & 0xff] ^ + C3[(int)(state[4] >> 32) & 0xff] ^ + C4[(int)(state[3] >> 24) & 0xff] ^ + C5[(int)(state[2] >> 16) & 0xff] ^ + C6[(int)(state[1] >> 8) & 0xff] ^ + C7[(int)(state[0] ) & 0xff] ^ + K[7]; + state[0] = L[0]; + state[1] = L[1]; + state[2] = L[2]; + state[3] = L[3]; + state[4] = L[4]; + state[5] = L[5]; + state[6] = L[6]; + state[7] = L[7]; + } + /* + * apply the Miyaguchi-Preneel compression function: + */ + structpointer->hash[0] ^= state[0] ^ block[0]; + structpointer->hash[1] ^= state[1] ^ block[1]; + structpointer->hash[2] ^= state[2] ^ block[2]; + structpointer->hash[3] ^= state[3] ^ block[3]; + structpointer->hash[4] ^= state[4] ^ block[4]; + structpointer->hash[5] ^= state[5] ^ block[5]; + structpointer->hash[6] ^= state[6] ^ block[6]; + structpointer->hash[7] ^= state[7] ^ block[7]; +} + +/** + * Initialize the hashing state. + */ +void WHIRLPOOLinit(struct WHIRLPOOLstruct * const structpointer) { + int i; + + memset(structpointer->bitLength, 0, 32); + structpointer->bufferBits = structpointer->bufferPos = 0; + structpointer->buffer[0] = 0; /* it's only necessary to cleanup buffer[bufferPos] */ + for (i = 0; i < 8; i++) { + structpointer->hash[i] = 0L; /* initial value */ + } +} + +/** + * Delivers input data to the hashing algorithm. + * + * @param source plaintext data to hash. + * @param sourceBits how many bits of plaintext to process. + * + * This method maintains the invariant: bufferBits < WHIRLPOOL_DIGESTBITS + */ +void WHIRLPOOLadd(const unsigned char * const source, + unsigned long sourceBits, + struct WHIRLPOOLstruct * const structpointer) { + /* + sourcePos + | + +-------+-------+------- + ||||||||||||||||||||| source + +-------+-------+------- + +-------+-------+-------+-------+-------+------- + |||||||||||||||||||||| buffer + +-------+-------+-------+-------+-------+------- + | + bufferPos + */ + int sourcePos = 0; /* index of leftmost source unsigned char containing data (1 to 8 bits). */ + int sourceGap = (8 - ((int)sourceBits & 7)) & 7; /* space on source[sourcePos]. */ + int bufferRem = structpointer->bufferBits & 7; /* occupied bits on buffer[bufferPos]. */ + int i; + uint32_t b, carry; + unsigned char *buffer = structpointer->buffer; + unsigned char *bitLength = structpointer->bitLength; + int bufferBits = structpointer->bufferBits; + int bufferPos = structpointer->bufferPos; + + /* + * tally the length of the added data: + */ + uint64_t value = sourceBits; + for (i = 31, carry = 0; i >= 0 && (carry != 0 || value != LL(0)); i--) { + carry += bitLength[i] + ((uint32_t)value & 0xff); + bitLength[i] = (unsigned char)carry; + carry >>= 8; + value >>= 8; + } + /* + * process data in chunks of 8 bits (a more efficient approach would be to take whole-word chunks): + */ + while (sourceBits > 8) { + /* N.B. at least source[sourcePos] and source[sourcePos+1] contain data. */ + /* + * take a byte from the source: + */ + b = ((source[sourcePos] << sourceGap) & 0xff) | + ((source[sourcePos + 1] & 0xff) >> (8 - sourceGap)); + /* + * process this byte: + */ + buffer[bufferPos++] |= (unsigned char)(b >> bufferRem); + bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */ + if (bufferBits == WHIRLPOOL_DIGESTBITS) { + /* + * process data block: + */ + processBuffer(structpointer); + /* + * reset buffer: + */ + bufferBits = bufferPos = 0; + } + buffer[bufferPos] = b << (8 - bufferRem); + bufferBits += bufferRem; + /* + * proceed to remaining data: + */ + sourceBits -= 8; + sourcePos++; + } + /* now 0 <= sourceBits <= 8; + * furthermore, all data (if any is left) is in source[sourcePos]. + */ + if (sourceBits > 0) { + b = (source[sourcePos] << sourceGap) & 0xff; /* bits are left-justified on b. */ + /* + * process the remaining bits: + */ + buffer[bufferPos] |= b >> bufferRem; + } else { + b = 0; + } + if (bufferRem + sourceBits < 8) { + /* + * all remaining data fits on buffer[bufferPos], + * and there still remains some space. + */ + bufferBits += sourceBits; + } else { + /* + * buffer[bufferPos] is full: + */ + bufferPos++; + bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */ + sourceBits -= 8 - bufferRem; + /* now 0 <= sourceBits < 8; + * furthermore, all data (if any is left) is in source[sourcePos]. + */ + if (bufferBits == WHIRLPOOL_DIGESTBITS) { + /* + * process data block: + */ + processBuffer(structpointer); + /* + * reset buffer: + */ + bufferBits = bufferPos = 0; + } + buffer[bufferPos] = b << (8 - bufferRem); + bufferBits += (int)sourceBits; + } + structpointer->bufferBits = bufferBits; + structpointer->bufferPos = bufferPos; +} + +/** + * Get the hash value from the hashing state. + * + * This method uses the invariant: bufferBits < WHIRLPOOL_DIGESTBITS + */ +void WHIRLPOOLfinalize(struct WHIRLPOOLstruct * const structpointer, + unsigned char * const result) { + int i; + unsigned char *buffer = structpointer->buffer; + unsigned char *bitLength = structpointer->bitLength; + int bufferBits = structpointer->bufferBits; + int bufferPos = structpointer->bufferPos; + unsigned char *digest = result; + + /* + * append a '1'-bit: + */ + buffer[bufferPos] |= 0x80U >> (bufferBits & 7); + bufferPos++; /* all remaining bits on the current unsigned char are set to zero. */ + /* + * pad with zero bits to complete (N*WBLOCKBITS - LENGTHBITS) bits: + */ + if (bufferPos > WBLOCKBYTES - LENGTHBYTES) { + if (bufferPos < WBLOCKBYTES) { + memset(&buffer[bufferPos], 0, WBLOCKBYTES - bufferPos); + } + /* + * process data block: + */ + processBuffer(structpointer); + /* + * reset buffer: + */ + bufferPos = 0; + } + if (bufferPos < WBLOCKBYTES - LENGTHBYTES) { + memset(&buffer[bufferPos], 0, (WBLOCKBYTES - LENGTHBYTES) - bufferPos); + } + bufferPos = WBLOCKBYTES - LENGTHBYTES; + /* + * append bit length of hashed data: + */ + memcpy(&buffer[WBLOCKBYTES - LENGTHBYTES], bitLength, LENGTHBYTES); + /* + * process data block: + */ + processBuffer(structpointer); + /* + * return the completed message digest: + */ + for (i = 0; i < WHIRLPOOL_DIGESTBYTES/8; i++) { + digest[0] = (unsigned char)(structpointer->hash[i] >> 56); + digest[1] = (unsigned char)(structpointer->hash[i] >> 48); + digest[2] = (unsigned char)(structpointer->hash[i] >> 40); + digest[3] = (unsigned char)(structpointer->hash[i] >> 32); + digest[4] = (unsigned char)(structpointer->hash[i] >> 24); + digest[5] = (unsigned char)(structpointer->hash[i] >> 16); + digest[6] = (unsigned char)(structpointer->hash[i] >> 8); + digest[7] = (unsigned char)(structpointer->hash[i] ); + digest += 8; + } + structpointer->bufferBits = bufferBits; + structpointer->bufferPos = bufferPos; +} + diff --git a/libUseful-2.4/whirlpool.h b/libUseful-2.4/whirlpool.h new file mode 100644 index 0000000..bfc5c20 --- /dev/null +++ b/libUseful-2.4/whirlpool.h @@ -0,0 +1,36 @@ + +#ifndef HASH_WHIRLPOOL_H +#define HASH_WHIRLPOOL_H + +#include + +/* + * Whirlpool-specific definitions. + */ + +#define WHIRLPOOL_DIGESTBYTES 64 +#define WHIRLPOOL_DIGESTBITS (8*WHIRLPOOL_DIGESTBYTES) /* 512 */ + +#define WBLOCKBYTES 64 +#define WBLOCKBITS (8*WBLOCKBYTES) /* 512 */ + +#define LENGTHBYTES 32 +#define LENGTHBITS (8*LENGTHBYTES) /* 256 */ + +typedef struct WHIRLPOOLstruct { + unsigned char bitLength[LENGTHBYTES]; /* global number of hashed bits (256-bit counter) */ + unsigned char buffer[WBLOCKBYTES]; /* buffer of data to hash */ + int bufferBits; /* current number of bits on the buffer */ + int bufferPos; /* current (possibly incomplete) byte slot on the buffer */ + uint64_t hash[WHIRLPOOL_DIGESTBYTES/8]; /* the hashing state */ +} WHIRLPOOLstruct; + + +void WHIRLPOOLinit(struct WHIRLPOOLstruct * const structpointer); +void WHIRLPOOLadd(const unsigned char * const source, unsigned long sourceBits, struct WHIRLPOOLstruct * const structpointer); +void WHIRLPOOLfinalize(struct WHIRLPOOLstruct * const structpointer, unsigned char * const result); + + +#endif + + diff --git a/libUseful-2.4/whirlpool.o b/libUseful-2.4/whirlpool.o new file mode 100644 index 0000000..ad15c59 Binary files /dev/null and b/libUseful-2.4/whirlpool.o differ diff --git a/main.c b/main.c index beec084..1c78174 100644 --- a/main.c +++ b/main.c @@ -24,8 +24,6 @@ #include "download.h" #include "outputfiles.h" #include "youtube.h" -#include "dailymotion.h" -#include "cbsnews.h" #include "ehow.h" #include "display.h" @@ -37,7 +35,8 @@ char *FormatPreference=NULL; ListNode *DownloadQueue=NULL; STREAM *StdIn=NULL; char *Username=NULL, *Password=NULL; -int STREAMTimeout=30; +char *Proxy=NULL; +int STREAMTimeout=3000; int Type=TYPE_NONE; int CheckForKeyboardInput() @@ -80,23 +79,18 @@ if (!StrLen(Path)) return(FALSE); Type=MovType; NextPath=CopyStr(NextPath,Path); ParseURL(Path,&Proto,&Server,&Tempstr,NULL,NULL,&Doc,NULL); -Port=atoi(Tempstr); +if (Tempstr) Port=atoi(Tempstr); -if (strcasecmp(Proto,"https")==0) +if (Proto && (strcasecmp(Proto,"https")==0) ) { - if (SSLAvailable) Flags |= FLAG_HTTPS; - else + if (! SSLAvailable) { printf("SSL NOT COMPILED IN! Switching from 'https' to 'http'\n"); NextPath=MCopyStr(NextPath,"http://",Server,"/",ptr); } } -if (Type==TYPE_NONE) -{ -if (GetContainerFileType(Path) != -1) Type=TYPE_CONTAINERFILE; -else Type=IdentifyServiceType(Server); -} +if (Type==TYPE_NONE) Type=IdentifyServiceType(Path); if (Type==TYPE_NONE) @@ -105,13 +99,8 @@ if (! (Flags & FLAG_QUIET)) fprintf(stderr,"Unrecognized url type. Falling Back Type=TYPE_GENERIC; } -if (Type==TYPE_CONTAINERFILE) RetVal=DownloadContainer(NextPath,Title,Flags); -else -{ NextPath=SiteSpecificPreprocessing(NextPath, Path, Proto, Server, Port, Doc, &Type, &Title, &Flags); - -if (DownloadPage(NextPath, Type,Title,Flags)) RetVal=TRUE; -} +if (DownloadPage(NextPath, Type, Title, Flags)) RetVal=TRUE; DestroyString(Tempstr); DestroyString(Server); @@ -172,8 +161,9 @@ Tempstr=GatherMatchingFormats(Tempstr,"",Vars); for (i=0; i < 3; i++) { if (DisplayAvailableFormats(Vars, Tempstr, DisplaySize)) break; - printf("Connection Refused, sleeping for 20 secs before retry\n"); - sleep(10); + //printf("Connection Refused, sleeping for 20 secs before retry\n"); + //sleep(10); + break; } } @@ -189,9 +179,8 @@ Tempstr=GatherMatchingFormats(Tempstr,"",Vars); Curr=ListGetNext(Vars); while (Curr) { - if (FmtIDMatches(FmtID,Curr->Tag, (char *) Curr->Item)) - { + { if (Flags & (FLAG_DEBUG)) { Tempstr=GatherMatchingFormats(Tempstr,FmtID,Vars); @@ -217,14 +206,15 @@ Tempstr=GatherMatchingFormats(Tempstr,"",Vars); if (StrLen(Selected)) { if (strcmp(Selected,"item:reference")==0) RetVal=TYPE_REFERENCE; + if (strncmp(Selected,"item:m3u8-stream",16)==0) RetVal=TYPE_CONTAINERFILE_M3U8; else RetVal=WebsiteType; } if (! (Flags & FLAG_TEST_SITES)) { -if (RetVal==-1) fprintf(stderr,"No suitable download format found from '%s'\n\n",FormatPreference); -else if (RetVal==TYPE_REFERENCE) fprintf(stderr,"Reference to another site: %s\n",GetVar(Vars,"ID")); -else fprintf(stderr,"Selected format %s\n",Selected); + if (RetVal==-1) fprintf(stderr,"No suitable download format found from '%s'\n\n",FormatPreference); + else if (RetVal==TYPE_REFERENCE) fprintf(stderr,"Reference to another site: %s\n",GetVar(Vars,"ID")); + else fprintf(stderr,"Selected format %s\n",Selected); } @@ -271,6 +261,7 @@ fprintf(stdout,"'-p' address of http/https/sstunnel proxy server in URL format. fprintf(stdout,"'-proxy' address of http/https/sstunnel proxy server in URL format.\n"); fprintf(stdout,"'-w' Wait for addresses to be entered on stdin.\n"); fprintf(stdout,"'-st' Connection inactivity timeout in seconds. Set high for sites that 'throttle'\n"); +fprintf(stdout,"'-tw ' Set max width of item title in progress display (Default 50 chars)\n"); fprintf(stdout,"'-t' specifies website type.\n"); fprintf(stdout,"'-r' Resume download (only works when writing a single file, not with +o).\n"); fprintf(stdout,"'-f' specifies preferred video/audio formats for sites that offer more than one\n"); @@ -364,6 +355,7 @@ for (i=1; i < argc; i++) else if (strcmp(argv[i],"-x")==0) Flags |= FLAG_PORN; else if (strcmp(argv[i],"-T")==0) Flags |= FLAG_TEST; else if (strcmp(argv[i],"-w")==0) Flags |= FLAG_STDIN; + else if (strcmp(argv[i],"-dt")==0) DisplayTitleWidth=atoi(argv[++i]); else if (strcmp(argv[i],"-st")==0) STREAMTimeout=atoi(argv[++i]); else if (strcmp(argv[i],"-P")==0) Player=CopyStr(Player,argv[++i]); else if (strcmp(argv[i],"-Pp")==0) PlayerLaunchPercent=atoi(argv[++i]); @@ -407,7 +399,6 @@ if (DebugLevel > 2) Flags |= FLAG_DEBUG3; void CheckSettings() { char *Token=NULL, *ptr; -char *ProxyTypes[]={"http","https","sshtunnel",NULL}; int i; if ((! isatty(1)) && (! (Flags & FLAG_STDOUT))) @@ -415,17 +406,6 @@ if ((! isatty(1)) && (! (Flags & FLAG_STDOUT))) fprintf(stderr,"\nWARNING: Stdout does not seem to be a terminal, so it could be a pipe to another program. But you've not used '-o -' or '+o -' to redirect output into a pipe. Hence output will be written to a file. If you're piping into a player app, and there's no sound/video, then you need to add '-o -'\n\n"); } -if (StrLen(Proxy)) -{ - ptr=GetToken(Proxy,":",&Token,0); - if (MatchTokenFromList(Token,ProxyTypes,0)==-1) - { - fprintf(stderr,"\nWARNING: Unknown proxy type '%s'. Probably won't work. Known types are: ",Proxy); - for (i=0; ProxyTypes[i] != NULL; i++) fprintf(stderr," %s,",ProxyTypes[i]); - fprintf(stderr,"\n\n"); - } -} - DestroyString(Token); } @@ -466,7 +446,7 @@ int OverrideType=TYPE_NONE; char *Tempstr=NULL; int result; -HTTPSetFlags(HTTP_NOCOMPRESS); +//HTTPSetFlags(HTTP_NOCOMPRESS); StdIn=STREAMFromFD(0); STREAMSetTimeout(StdIn,0); ParseEnvironmentVariables(); @@ -474,11 +454,20 @@ ParseEnvironmentVariables(); DownloadQueue=ListCreate(); Tempstr=MCopyStr(Tempstr,"Movgrab ",Version,NULL); HTTPSetUserAgent(Tempstr); -FormatPreference=CopyStr(FormatPreference,"mp4,flv,webm,m4v,mov,mpg,mpeg,wmv,avi,3gp,reference,mp3,m4a,wma,stream"); +FormatPreference=CopyStr(FormatPreference,"mp4,flv,webm,m4v,mov,mpg,mpeg,wmv,avi,3gp,reference,mp3,m4a,wma,m3u8,m3u8-stream"); AddOutputFile("", TRUE); ParseCommandLine(argc, argv, DownloadQueue, &OverrideType); CheckSettings(); +if (StrLen(Proxy)) +{ + if (! SetGlobalConnectionChain(Proxy)) + { + printf("ERROR: Failed to set proxy settings to '%s'\n",Proxy); + exit(1); + } +} + if (Flags & FLAG_PRINT_USAGE) PrintUsage(); @@ -507,6 +496,7 @@ while (1) fflush(NULL); } + result=GrabMovie((char *) Curr->Item,OverrideType); Next=ListGetNext(Curr); //must do this after grab movie //incase more items added while grabbing diff --git a/outputfiles.c b/outputfiles.c index 7022a09..2a85ec9 100644 --- a/outputfiles.c +++ b/outputfiles.c @@ -28,7 +28,7 @@ return(Str); //guess the extension of a file, some sites don't have extensions //on their filenames -char *GuessExtn(char *ContentType, char *Format, char *ID) +char *GuessExtn(const char *ContentType, const char *Format, const char *ID) { static char *Extn=NULL; char *ptr; @@ -63,27 +63,27 @@ return(Extn); //URL is used to provide a unique MD5 so that two downloads from //different sites with the same title don't overwrite each other -char *GetSaveFilePath(char *RetStr, char *Title, char *URL) +char *GetSaveFilePath(char *RetStr, const char *Title, const char *URL) { char *ptr=NULL; char *Tempstr=NULL, *MD5=NULL; - if (StrLen(Title)) ptr=Title; else { + Tempstr=CopyStr(Tempstr, URL); //Assume the filename is the document part of the url - ptr=strrchr(URL,'?'); + ptr=strrchr(Tempstr,'?'); if (ptr) *ptr='\0'; - ptr=strrchr(URL,'/'); + ptr=strrchr(Tempstr,'/'); if (ptr) ptr++; - else ptr=URL; + else ptr=Tempstr; } -Tempstr=MakeFilesystemSafeName(RetStr, ptr); -ptr=strrchr(Tempstr,'.'); +RetStr=MakeFilesystemSafeName(RetStr, ptr); +ptr=strrchr(RetStr,'.'); //some titles might have '.' in them, but not have an extension //only assume it's an extension if it's under six chars long @@ -91,16 +91,16 @@ if (ptr && (StrLen(ptr) < 6)) *ptr='\0'; if (! (Flags & FLAG_RESUME)) { - HashBytes(&MD5,"md5",URL,StrLen(URL),ENCODE_HEX); + HashBytes(&MD5,"md5",Tempstr,StrLen(Tempstr),ENCODE_HEX); Tempstr=MCatStr(Tempstr,"-",MD5,NULL); } //Some stupid sites start pagenames with a space, and we don't want this in the filename -StripLeadingWhitespace(Tempstr); +StripLeadingWhitespace(RetStr); DestroyString(MD5); -return(Tempstr); +return(RetStr); } @@ -109,7 +109,7 @@ return(Tempstr); //If that's set to '-' then open stdout and write to that, if it's //set to anything else, then use that as the filename. Otherwise //build the filename from available info. -STREAM *OpenSaveFile(char *Path, double *FileSize, int ResumeDownload) +STREAM *OpenSaveFile(const char *Path, double *FileSize, int ResumeDownload) { STREAM *S=NULL; struct stat FStat; @@ -145,6 +145,7 @@ else return(S); } + STREAM *OpenCacheFile(char *Title, char *URL) { char *Tempstr=NULL; @@ -168,11 +169,16 @@ DestroyString(Tempstr); return(S); } -void OpenOutputFiles(char *Title, char *URL, double *FileSize) + +//some apps expect to be able to read data in multiples of 1024, so if we are writing +//to standard out (probably piped into such an app) we work in blocks +#define BLOCKSIZE 4096 +void OpenOutputFiles(const char *Title, const char *URL, double *FileSize) { char *Tempstr=NULL; ListNode *Curr; int val=0, Resume=FALSE; +STREAM *S; if ((Flags & FLAG_RESUME) && (ListSize(OutputFiles)==1)) Resume=TRUE; @@ -184,7 +190,13 @@ while (Curr) Tempstr=GetSaveFilePath(Tempstr, Title, URL); Curr->Item=OpenSaveFile(Tempstr, FileSize, Resume); } - else if (strcmp(Curr->Tag,"-")==0) Curr->Item=STREAMFromFD(1); + else if (strcmp(Curr->Tag,"-")==0) + { + S=STREAMFromFD(1); + STREAMResizeBuffer(S, BLOCKSIZE * 8); + STREAMSetFlushType(S, FLUSH_BLOCK, BLOCKSIZE * 4, BLOCKSIZE); + Curr->Item=S; + } else Curr->Item=OpenSaveFile(Curr->Tag, FileSize, Resume); Curr=ListGetNext(Curr); @@ -195,7 +207,7 @@ DestroyString(Tempstr); } -void WriteOutputFiles(char *Data, int Len) +void WriteOutputFiles(const char *Data, int Len) { ListNode *Curr; @@ -207,6 +219,7 @@ Curr=ListGetNext(Curr); } } + void CloseOutputFiles(char *Extn) { ListNode *Curr; @@ -232,7 +245,7 @@ DestroyString(Tempstr); } -void AddOutputFile(char *Path, int SingleOutput) +void AddOutputFile(const char *Path, int SingleOutput) { //if 'SingleOutput' is set then overwrite any existing outputs, this should be the //only one diff --git a/outputfiles.h b/outputfiles.h index 00be7f6..acdd69b 100644 --- a/outputfiles.h +++ b/outputfiles.h @@ -5,10 +5,10 @@ #include "common.h" char *OutputFilesGetFilePath(); -void OpenOutputFiles(char *Title, char *URL, double *FileSize); -void WriteOutputFiles(char *Data, int Len); -void AddOutputFile(char *Path, int SingleOutput); -char *GuessExtn(char *ContentType, char *Format, char *ID); +void OpenOutputFiles(const char *Title, const char *URL, double *FileSize); +void WriteOutputFiles(const char *Data, int Len); +void AddOutputFile(const char *Path, int SingleOutput); +char *GuessExtn(const char *ContentType, const char *Format, const char *ID); #endif diff --git a/servicetypes.c b/servicetypes.c index 6603f6f..5233e4a 100644 --- a/servicetypes.c +++ b/servicetypes.c @@ -13,31 +13,24 @@ Then site specific //Site type names used at the command line etc -char *DownloadTypes[]={"none","generic","youtube","metacafe","dailymotion","break","ehow","vimeo","vbox7","blip.tv","ted","myvideo","mytopclip","redbalcony","mobango","yale","princeton","reuters","liveleak","academicearth","photobucket","aljazeera","mefeedia","iviewtube","washingtonpost","cbsnews","france24","euronews","metatube","motionfeeds","escapist","guardian","redorbit","scivee","izlese","uctv.tv","royalsociety.tv","britishacademy","kitp","dotsub","astronomy.com","teachertube.com","discovery","bloomberg","nationalgeographic","videobash","ibtimes","smh","videojug","animehere","funnyordie",NULL}; +char *DownloadTypes[]={"none","generic","youtube","youtu.be","metacafe","dailymotion","break","ehow","vimeo","ted","redbalcony","yale","reuters","liveleak","photobucket","iviewtube","washingtonpost","cbsnews","france24","euronews","metatube","guardian","redorbit","scivee","izlese","uctv.tv","royalsociety.tv","britishacademy","kitp","dotsub","astronomy.com","discovery","bloomberg","nationalgeographic","videobash","ibtimes","smh","animehere","funnyordie",NULL}; //Longer names used in display char *DownloadNames[]={"none", "Generic: Search in page for http://*.flv, http://*.mp3, http//*.mp4 etc, etc, etc", "YouTube: http://www.youtube.com", +"youtu.be: http://www.youtu.be", "Metacafe: http://www.metacafe.com", "Daily Motion: http://www.dailymotion.com", "www.break.com", "www.ehow.com", "www.vimeo.com", -"www.vbox7.com", -"www.blip.tv", "www.ted.com", -"www.myvideo.de", -"www.mytopclip.com", "www.redbalcony.com", -"www.mobango.com", "Yale University: http://oyc.yale.edu", -"Princeton University: http://www.princeton.edu/WebMedia/", "Reuters: http://www.reuters.com/", "Liveleak: http://www.liveleak.com", -"Academic Earth: http://www.academicearth.org", "Photobucket: http://www.photobucket.com", -"Aljazeera: english.aljazeera.net", "mefeedia.com", "iViewTube: www.iviewtube.com", "Washington Post: www.washingtonpost.com", @@ -45,8 +38,6 @@ char *DownloadNames[]={"none", "France24: www.france24.com", "Euronews: www.euronews.net", "www.metatube.com", -"www.motionfeeds.com", -"www.escapistmagazine.com", "www.guardian.co.uk", "www.redorbit.com", "www.scivee.tv", @@ -57,14 +48,12 @@ char *DownloadNames[]={"none", "KAVLI INSTITUTE: http://online.itp.ucsb.edu/plecture/", "dotsub.com", "astronomy.com", -"teachertube.com", "dsc.discovery.com", "www.bloomberg.com (not bloomberg.tv)", "National Geographic (http://video.nationalgeographic.com)", "videobash", "International Business Times", "Sidney Morning Herald", -"www.videojug.com", "www.animehere.com", "Funny or Die (http://www.funnyordie.com)", NULL}; @@ -74,36 +63,26 @@ NULL}; //works with movgrab char *TestLinks[]={"", "", "http://www.youtube.com/watch?v=Vxp3seoRNgY", +"https://youtu.be/OdrEId7YI1k", "http://www.metacafe.com/watch/6063075/how_to_use_chopsticks/", "http://www.dailymotion.com/video/x5790e_hubblecast-16-galaxies-gone-wild_tech", "http://www.break.com/index/ninja-cat.html", "http://www.ehow.com/video_6819748_creamy-thyme-scrambled-eggs-recipe.html", "broken", -"http://www.vbox7.com/play:1417ad5a", -"http://blip.tv/greshamcollege/whengalaxiescollide_carolincrawford-6575570", "http://www.ted.com/talks/janine_benyus_shares_nature_s_designs.html", -"http://www.myvideo.de/watch/9949/tornados", -"http://www.mytopclip.com/videos/32501/flip-over-card-trick-revealed", "http://www.redbalcony.com/?vid=29433", -"http://www.mobango.com/media_details/struck_in_tsunami/%21tKpzdHIo5E%3D/", "http://oyc.yale.edu/economics/game-theory/contents/sessions/session-1-introduction-five-first-lessons", -"http://www.princeton.edu/WebMedia/flash/lectures/20100428_publect_taibbi_tett.shtml", -"http://www.reuters.com/news/video/story?videoId=193471398&videoChannel=4", -"http://www.liveleak.com/view?i=a7b_1299633723", -"http://www.academicearth.org/lectures/interaction-with-physical-environment", +"http://www.reuters.com/video/2016/05/02/foam-swords-drawn-in-mass-play-fight-in?videoId=368328211", +"http://www.liveleak.com/view?i=e28_1462299205", "http://gs147.photobucket.com/groups/r299/QM25Y4IJEP/?action=view¤t=BlackSwan1.mp4", -"http://english.aljazeera.net/programmes/countingthecost/2011/02/2011219142816937101.html", -"http://www.mefeedia.com/video/36135458", "http://www.iviewtube.com/v/152128/insane-hail-storm-oklahoma-city", "http://www.washingtonpost.com/business/on-leadership-modern-day-machiavellis-/2011/02/18/ABYgckH_video.html", "http://www.cbsnews.com/video/watch/?id=7357739n", -"http://www.france24.com/en/20110219-beyond-business-cybercriminality-iphone-mobile-security", +"http://www.france24.com/en/20160430-down-earth-fast-fashion-pollution-environment-ethical-consumption", "http://www.euronews.com/news/bulletin/", "http://www.metatube.com/en/videos/cid2/Funny-Videos/53210/Rail-Jump-Fail/", -"http://www.motionfeeds.com/10401/helsinki-travel-guide.html", -"http://www.escapistmagazine.com/videos/view/zero-punctuation/1776-Red-Dead-Redemption", "http://www.guardian.co.uk/world/video/2011/may/13/fukushima-radiation-dairy-farmers-video", -"http://www.redorbit.com/news/video/science_2/2598565/unlocking_mysteries_of_sharks/index.html", +"http://www.redorbit.com/video/using-f1-technology-to-transform-healthcare-012016/" "http://www.scivee.tv/node/5300", "http://www.izlese.org/hot-girl-hot-cars-911-turbo-vs-mercedes-s550-vs-rally-car.html", "http://www.uctv.tv/search-details.aspx?showID=20888", @@ -112,14 +91,12 @@ char *TestLinks[]={"", "", "http://online.itp.ucsb.edu/plecture/bmonreal11/", "http://dotsub.com/view/5d90ef11-d5e5-42fb-8263-a4c128fb64df", "http://www.astronomy.com/News-Observing/Liz%20and%20Bills%20Cosmic%20Adventures/2011/02/Episode%202.aspx", -"http://www.teachertube.com/viewVideo.php?video_id=114089&title=Marco_Polo", "http://dsc.discovery.com/videos/how-the-universe-works-birth-of-a-black-hole.html", "http://www.bloomberg.com/video/72477250/", "http://video.nationalgeographic.com/video/environment/environment-natural-disasters/earthquakes/earthquake-101/", "http://www.videobash.com/video_show/wing-suit-amazing-footage-6086", "http://tv.ibtimes.com/woolly-mammoth-skeleton-discovered-near-paris-nicknamed-helmut-7190", "http://www.smh.com.au/technology/sci-tech/newly-discovered-planets-include-superearth-20110913-1k7tl.html", -"http://www.videojug.com/film/how-to-do-the-best-card-trick-in-the-world", "http://www.animehere.com/accel-world-episode-1.html", "http://www.funnyordie.com/videos/032785be3a/genie-on-hard-times-with-parker-posey?playlist=featured_videos", NULL}; @@ -129,15 +106,32 @@ int SelectDownloadFormat(ListNode *Vars, int WebsiteType, int DisplaySize); //Guess service type from servername in URL -int IdentifyServiceType(char *Server) +int IdentifyServiceType(const char *URL) { -int Type=0; +int Type=TYPE_NONE; +char *Proto=NULL, *Server=NULL, *Tempstr=NULL; + +if (! URL) return(TYPE_NONE); + +Type=GetContainerFileType(URL); +if (Type != TYPE_NONE) return(Type); + +ParseURL(URL,&Proto,&Server,&Tempstr,NULL,NULL,NULL,NULL); +if (! StrValid(Server)) +{ +DestroyString(Proto); +DestroyString(Server); +DestroyString(Tempstr); +return(TYPE_NONE); +} if ( (strstr(Server,"youtube")) ) Type=TYPE_YOUTUBE; - -if (strcmp(Server,"www.metacafe.com")==0) +else if ( + (strcmp(Server,"youtu.be")==0) + ) Type=TYPE_YOUTUBE_SHORT; +else if (strcmp(Server,"www.metacafe.com")==0) { Type=TYPE_METACAFE; } @@ -161,42 +155,18 @@ else if (strcmp(Server,"oyc.yale.edu")==0) { Type=TYPE_YALE; } -else if (strcmp(Server,"www.princeton.edu")==0) -{ - Type=TYPE_PRINCETON; -} -else if (strcmp(Server,"www.academicearth.org")==0) -{ - Type=TYPE_ACADEMIC_EARTH; -} else if (strstr(Server,"photobucket.com")) { Type=TYPE_PHOTOBUCKET; } -else if (strstr(Server,"vbox7.com")) -{ - Type=TYPE_VBOX7; -} -else if (strstr(Server,"myvideo")) -{ - Type=TYPE_MYVIDEO; -} else if (strstr(Server,"redbalcony.com")) { Type=TYPE_REDBALCONY; } -else if (strstr(Server,"mobango.com")) -{ - Type=TYPE_MOBANGO; -} else if (strstr(Server,"izlese.org")) { Type=TYPE_IZLESE; } -else if (strstr(Server,"mytopclip.com")) -{ - Type=TYPE_MYTOPCLIP; -} else if (strstr(Server,"liveleak")) { Type=TYPE_LIVELEAK; @@ -209,10 +179,6 @@ else if (strstr(Server,"smh.com.au")) { Type=TYPE_SMH; } -else if (strstr(Server,"blip.tv")) -{ - Type=TYPE_BLIPTV; -} else if (strstr(Server,"vimeo.com")) { Type=TYPE_VIMEO; @@ -221,10 +187,6 @@ else if (strstr(Server,"reuters")) { Type=TYPE_REUTERS; } -else if (strstr(Server,"mefeedia.com")) -{ - Type=TYPE_MEFEEDIA; -} else if (strstr(Server,"ucsd.tv")) { Type=TYPE_UCTV; @@ -233,10 +195,6 @@ else if (strstr(Server,"uctv.tv")) { Type=TYPE_UCTV; } -else if (strstr(Server,"aljazeera.net")) -{ - Type=TYPE_ALJAZEERA; -} else if (strstr(Server,"iviewtube.com")) { Type=TYPE_IVIEWTUBE; @@ -261,10 +219,6 @@ else if (strstr(Server,"metatube")) { Type=TYPE_METATUBE; } -else if (strstr(Server,"motionfeeds")) -{ - Type=TYPE_MOTIONFEEDS; -} else if (strstr(Server,"guardian")) { Type=TYPE_GUARDIAN; @@ -277,10 +231,6 @@ else if (strstr(Server,"scivee")) { Type=TYPE_SCIVEE; } -else if (strstr(Server,"escapistmagazine.com")) -{ - Type=TYPE_ESCAPIST; -} else if (strcmp(Server,"royalsociety.tv")==0) { Type=TYPE_ROYALSOCIETY_STAGE2; @@ -305,10 +255,6 @@ else if (strstr(Server,"astronomy.com")) { Type=TYPE_ASTRONOMYCOM; } -else if (strstr(Server,"teachertube.com")) -{ - Type=TYPE_TEACHERTUBE; -} else if (strstr(Server,"discovery.com")) { Type=TYPE_DISCOVERY; @@ -325,10 +271,6 @@ else if (strstr(Server,"www.videobash.com")) { Type=TYPE_VIDEOBASH; } -else if (strstr(Server,"www.videojug.com")) -{ - Type=TYPE_VIDEOJUG; -} else if (strstr(Server,"animehere.com")) { Type=TYPE_ANIMEHERE; @@ -342,36 +284,15 @@ else if (strstr(Server,".google.")) Type=TYPE_GOOGLE_URL; } -return(Type); -} - +DestroyString(Server); +DestroyString(Proto); +DestroyString(Tempstr); -//A couple of old functions related to specific sites. As these sites no longer -//work it is likely that these functions will be removed some day -int DoVBOX7(char *ID, char *Title) -{ -char *Dir=NULL, *Tempstr=NULL; -int i, RetVal=FALSE; - -Dir=CopyStrLen(Dir,ID,2); - -for (i=1; i < 50; i++) -{ - if (i==0) Tempstr=FormatStr(Tempstr,"http://media.vbox7.com/s/%s/%s.flv",Dir,ID); - else Tempstr=FormatStr(Tempstr,"http://media%02d.vbox7.com/s/%s/%s.flv",i,Dir,ID); - if (DownloadItem(Tempstr, Title, Flags)) - { - RetVal=TRUE; - break; - } +return(Type); } -DestroyString(Dir); -DestroyString(Tempstr); -return(RetVal); -} char *ExtractMetacafeMediaURL(char *RetStr, char *Data, char *Start, char *End) @@ -396,66 +317,6 @@ return(RetStr); } -// These functions used by escapist magazine, but the method might be more -// generic than just that one side -void ParseFlashPlaylistItem(char *Data,ListNode *Vars) -{ -char *Name=NULL, *Value=NULL, *URL=NULL, *Type=NULL, *ptr; - -strrep(Data,'\'',' '); -ptr=GetNameValuePair(Data,",",":",&Name,&Value); -while (ptr) -{ -StripTrailingWhitespace(Name); -StripLeadingWhitespace(Name); -StripQuotes(Name); - -StripTrailingWhitespace(Value); -StripLeadingWhitespace(Value); -StripQuotes(Value); - - -if (StrLen(Name)) -{ - if (strcmp(Name,"eventCategory")==0) Type=CopyStr(Type,Value); - if (strcmp(Name,"url")==0) URL=CopyStr(URL,Value); -} - -ptr=GetNameValuePair(ptr,",",":",&Name,&Value); -} - -if (StrLen(Type) && (strcmp(Type,"Video")==0)) SetVar(Vars,"item:mp4",URL); - -DestroyString(Name); -DestroyString(Value); -DestroyString(URL); -DestroyString(Type); - -} - - -void ParseFlashPlaylist(char *Data, ListNode *Vars) -{ -char *Tempstr=NULL, *Item=NULL, *ptr; - -//This clips the playlist structure out into Tempstr -ptr=GetToken(Data,"{'playlist':[",&Tempstr,0); -ptr=GetToken(ptr,"]",&Tempstr,0); - -ptr=GetToken(Tempstr,"{",&Item,0); -while (ptr) -{ -//'Item' no contains one playlist item -ptr=GetToken(ptr,"}",&Item,0); -ParseFlashPlaylistItem(Item,Vars); - -ptr=GetToken(ptr,"{",&Item,0); -} - -DestroyString(Tempstr); -DestroyString(Item); -} - //This function is called before we even pull the first page from a site @@ -469,9 +330,17 @@ char *ptr, *Token=NULL; NextPath=CopyStr(RetBuff,Path); -if (*Type==TYPE_YOUTUBE) +switch (*Type) { +case TYPE_YOUTUBE_SHORT: + //something like https://youtu.be/OdrEId7YI1k + ptr=Doc; + while (*ptr=='/') ptr++; + NextPath=MCopyStr(NextPath,Proto,"://www.youtube.com/get_video_info?&video_id=",ptr,"&el=detailpage&ps=default&eurl=&gl=US&hl=enB",NULL); + *Type=TYPE_YOUTUBE; +break; +case TYPE_YOUTUBE: //hmm.. have we been given the http://www.youtube.com/v/ or https://www.youtube.com/embed/ format? if (strncmp(Doc,"/v/",3)==0) Token=CopyStr(Token,Doc+3); @@ -495,9 +364,10 @@ if (*Type==TYPE_YOUTUBE) //Do we have authentication info? //if (StrLen(Username) && StrLen(Password)) YoutubeLogin(Username,Password); -} -else if (*Type==TYPE_METACAFE) -{ +break; + + +case TYPE_METACAFE: ptr=GetToken(Doc,"watch/",&Token,0); ptr=GetToken(ptr,"/",&Token,0); if (strchr(Token,'-')) @@ -528,7 +398,7 @@ else if (*Type==TYPE_METACAFE) { //Initial 'turn off family filter' Tempstr=FormatStr(Tempstr,"%s://%s:%d/f/index.php?inputType=filter&controllerGroup=user&filters=0&submit=Continue+-+I%27m+over+18",Proto,Server,Port); - S=HTTPMethod("POST",Tempstr,"",""); + S=HTTPMethod("POST",Tempstr,"","","","",0); STREAMClose(S); //But we have to do it twice, probably something to do with cookies @@ -536,46 +406,42 @@ else if (*Type==TYPE_METACAFE) } else NextPath=CopyStr(NextPath,Path); } -} -else if (*Type==TYPE_DAILYMOTION) -{ +break; + +case TYPE_DAILYMOTION: if (*Flags & FLAG_PORN) { Tempstr=HTTPQuote(Tempstr,Doc); NextPath=FormatStr(NextPath,"http://%s:%d/family_filter?urlback=/%s&enable=false",Server,Port,Tempstr); } else NextPath=CopyStr(NextPath,Path); -} -else if (*Type==TYPE_PRINCETON) -{ - ptr=strrchr(Doc,'/'); - if (ptr) - { - ptr++; - *Title=CopyStr(*Title,ptr); - ptr=strrchr(*Title,'.'); - if (ptr) *ptr='\0'; - } - NextPath=CopyStr(NextPath,Path); -} -else if (*Type==TYPE_VIMEO) -{ +break; + +case TYPE_VIMEO: NextPath=MCopyStr(NextPath,"http://player.vimeo.com/video/",Doc,NULL); -} -else if (*Type==TYPE_GOOGLE_URL) -{ - ptr=strstr(Path,"url?q="); +break; + +case TYPE_GOOGLE_URL: + + ptr=strchr(Path, '?'); if (ptr) { - ptr+=6; - ptr=GetToken(ptr,"&",&Token,NULL); - NextPath=HTTPUnQuote(NextPath,Token); - *Type==TYPE_REFERENCE; + ptr++; + ptr=GetToken(ptr,"&",&Token,0); + while (ptr) + { + if (strncmp(Token, "url=", 4)==0) NextPath=HTTPUnQuote(NextPath,Token+4); + if (strncmp(Token, "q=", 2)==0) NextPath=HTTPUnQuote(NextPath,Token+2); + ptr=GetToken(ptr,"&",&Token,0); + } + *Type=IdentifyServiceType(NextPath); } -} -else -{ +break; + +default: NextPath=CopyStr(NextPath,Path); +break; + } DestroyString(Tempstr); @@ -644,7 +510,6 @@ endpos=MediaCount; Tempstr=FormatStr(Tempstr,"ID:%d",i); ptr=GetVar(Vars,Tempstr); SetVar(Vars,"ID",ptr); - //GetNextURL(Type, Server, Flags, Vars); GrabMovie(ptr, TYPE_YOUTUBE); } @@ -663,16 +528,27 @@ int GetNextURL(int Type, char *Server, int Flags, ListNode *Vars) { char *Tempstr=NULL, *Title=NULL, *Fmt=NULL, *ptr; int RetVal=FALSE; +STREAM *Con; Title=CopyStr(Title,GetVar(Vars,"Title")); Fmt=CopyStr(Fmt,GetVar(Vars,"DownloadFormat")); switch (Type) { +case TYPE_M3U8_STREAM: + Tempstr=CopyStr(Tempstr,GetVar(Vars,"ID")); + Con=ConnectAndRetryUntilDownload(Tempstr, 0, 0); + if (Con) + { + M3UStreamDownload(Con, Tempstr, Title); + STREAMClose(Con); + } +break; + case TYPE_REFERENCE: +case TYPE_GOOGLE_URL: Tempstr=CopyStr(Tempstr,GetVar(Vars,"ID")); - if (GetContainerFileType(Tempstr) != -1) RetVal=DownloadContainer(Tempstr, Title, Flags); - else RetVal=GrabMovie(Tempstr,TYPE_NONE); + RetVal=GrabMovie(Tempstr,TYPE_NONE); break; case TYPE_YOUTUBE: @@ -685,27 +561,6 @@ case TYPE_YOUTUBE_PLAYLIST: RetVal=DownloadPage(Tempstr,TYPE_YOUTUBE, Title, Flags); break; - -case TYPE_BREAK_COM: - Tempstr=CopyStr(Tempstr,GetVar(Vars,"ID")); - RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); -break; - -case TYPE_EHOW: - ptr=GetVar(Vars,"ID"); - if (strncmp(ptr,"http:",5)==0) RetVal=DownloadItem(ptr,Title, Fmt, Flags); - else - { - Tempstr=SubstituteVarsInString(Tempstr,"http://$(Server):$(Port)/embedvars.aspx?isEhow=true&show_related=true&id=$(ID)",Vars,0); - RetVal=DownloadPage(Tempstr,TYPE_EHOW_STAGE2, Title,Flags); - } -break; - -case TYPE_EHOW_STAGE2: - RetVal=DownloadItem(GetVar(Vars,"ID"), Title, Fmt, Flags); -break; - - case TYPE_METACAFE: #define METACAFE_OVER_18 "allowAdultContent=1&submit=Continue+-+I%27m+over+18" Tempstr=SubstituteVarsInString(Tempstr,"$(ID)&$(METACAFE_OVER_18)",Vars,0); @@ -713,43 +568,17 @@ case TYPE_METACAFE: break; -case TYPE_DAILYMOTION: - Tempstr=SubstituteVarsInString(Tempstr,"http://www.dailymotion.com/services/oembed?url=$(ID)&format=xml",Vars,0); - RetVal=DownloadPage(Tempstr,TYPE_DAILYMOTION_STAGE2,Title,Flags); -break; - -case TYPE_DAILYMOTION_STAGE2: - Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); - RetVal=DownloadPage(Tempstr,TYPE_DAILYMOTION_STAGE3,Title,Flags); -break; - -case TYPE_DAILYMOTION_STAGE3: - Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); - RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); -break; - -case TYPE_VIDEOJUG: - Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); - RetVal=DownloadPage(Tempstr,TYPE_VIDEOJUG_STAGE2,Title,Flags); -break; -case TYPE_VIDEOJUG_STAGE2: - Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); - RetVal=DownloadPage(Tempstr,TYPE_VIDEOJUG_STAGE3,Title,Flags); +case TYPE_BREAK_COM: + Tempstr=CopyStr(Tempstr,GetVar(Vars,"ID")); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); break; -case TYPE_VIDEOJUG_STAGE3: +case TYPE_DAILYMOTION: Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); break; - - -case TYPE_MOBANGO: - //Tempstr=SubstituteVarsInString(Tempstr,"http://www.mobango.com/$(ID)",Vars,0); - RetVal=DownloadItem(GetVar(Vars,"ID"), Title, Fmt, Flags); -break; - case TYPE_WASHINGTONPOST_JSON: RetVal=DownloadPage(GetVar(Vars,"ID"),TYPE_WASHINGTONPOST_STAGE2,Title,Flags); break; @@ -760,15 +589,6 @@ case TYPE_WASHINGTONPOST_STAGE2: break; -case TYPE_MYVIDEO: - Tempstr=SubstituteVarsInString(Tempstr,"$(MyVidURL)/$(ID).flv",Vars,0); - RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); -break; - -case TYPE_VBOX7: - RetVal=DoVBOX7(GetVar(Vars,"ID"), Title); -break; - case TYPE_VIMEO: RetVal=DownloadPage(GetVar(Vars,"ID"),TYPE_VIMEO_STAGE2,Title,Flags); break; @@ -784,26 +604,12 @@ case TYPE_YALE: RetVal=DownloadItem(Tempstr,Title, Fmt, Flags); break; -case TYPE_BLIPTV: - Tempstr=FormatStr(Tempstr,"http://%s/%s",Server,GetVar(Vars,"ID")); - RetVal=DownloadPage(Tempstr,TYPE_BLIPTV_STAGE2, Title,Flags); -break; - -case TYPE_ESCAPIST: - Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); - RetVal=DownloadPage(Tempstr,TYPE_ESCAPIST_STAGE2, Title,Flags); -break; - case TYPE_REDBALCONY: Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); RetVal=DownloadPage(Tempstr,TYPE_REDBALCONY_STAGE2, Title,Flags); break; -case TYPE_REDORBIT: - Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); - RetVal=DownloadPage(Tempstr,TYPE_REDORBIT_STAGE2, Title,Flags); -break; case TYPE_ROYALSOCIETY: ptr=GetVar(Vars,"ID"); @@ -817,7 +623,7 @@ break; case TYPE_ROYALSOCIETY_STAGE2: Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); - RetVal=DownloadM3U(Tempstr, Title, Flags); + //RetVal=DownloadM3U(Tempstr, Title, Flags); break; @@ -828,7 +634,7 @@ break; case TYPE_BRITISHACADEMY_STAGE2: Tempstr=SubstituteVarsInString(Tempstr,"http://britac.studyserve.com/home/lectures/$(ID)",Vars,0); - RetVal=DownloadASX(Tempstr, Title,Flags); + RetVal=DownloadPage(Tempstr,TYPE_CONTAINERFILE_ASX, Title,Flags); break; case TYPE_KAVLIINSTITUTE: @@ -836,26 +642,12 @@ case TYPE_KAVLIINSTITUTE: RetVal=DownloadPage(Tempstr,TYPE_KAVLIINSTITUTE_STAGE2, Title,Flags); break; -case TYPE_EURONEWS: - Tempstr=SubstituteVarsInString(Tempstr,"http://video.euronews.net/$(ID).flv",Vars,0); - RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); -break; - -case TYPE_DOTSUB: - Tempstr=SubstituteVarsInString(Tempstr,"$(SERV)$(ID)",Vars,0); - RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); -break; case TYPE_ASTRONOMYCOM: Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); RetVal=DownloadPage(Tempstr,TYPE_ASTRONOMYCOM_STAGE2, Title,Flags); break; -case TYPE_TEACHERTUBE: - Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); - RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); -break; - case TYPE_BLOOMBERG: Tempstr=SubstituteVarsInString(Tempstr,"http://videos.bloomberg.com/$(ID).flv",Vars,0); RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); @@ -871,12 +663,10 @@ case TYPE_ANIMEHERE: RetVal=DownloadPage(Tempstr,TYPE_ANIMEHERE_STAGE2, Title,Flags); break; +case TYPE_DOTSUB: case TYPE_KAVLIINSTITUTE_STAGE2: case TYPE_SCIVEE: -case TYPE_BLIPTV_STAGE2: case TYPE_GENERIC: -case TYPE_MYTOPCLIP: -case TYPE_PRINCETON: case TYPE_TED: case TYPE_NATGEO: case TYPE_UCTV: @@ -884,23 +674,27 @@ case TYPE_IZLESE: case TYPE_REUTERS: case TYPE_LIVELEAK: case TYPE_IBTIMES: +case TYPE_EURONEWS: case TYPE_SMH: -case TYPE_ACADEMIC_EARTH: +case TYPE_REDORBIT: case TYPE_PHOTOBUCKET: -case TYPE_ALJAZEERA: case TYPE_IVIEWTUBE: case TYPE_WASHINGTONPOST: case TYPE_CBSNEWS: case TYPE_FRANCE24: case TYPE_METATUBE: -case TYPE_MOTIONFEEDS: case TYPE_GUARDIAN: -case TYPE_ESCAPIST_STAGE2: case TYPE_REDORBIT_STAGE2: case TYPE_REDBALCONY_STAGE2: case TYPE_ASTRONOMYCOM_STAGE2: case TYPE_ANIMEHERE_STAGE2: - Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); +case TYPE_FUNNYORDIE: +case TYPE_EHOW: +case TYPE_CONTAINERFILE_PLS: +case TYPE_CONTAINERFILE_ASX: +case TYPE_CONTAINERFILE_M3U8: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + if ((strncmp(Tempstr,"http:",5)!=0) && (strncmp(Tempstr,"https:",6)!=0)) Tempstr=SubstituteVarsInString(Tempstr,"http:$(ID)",Vars,0); RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); break; @@ -947,8 +741,40 @@ DestroyString(Tempstr); +void ExtractDailyMotion(const char *Line, const char *Start, const char *End, ListNode *Vars) +{ +const char *ptr, *tptr, *eptr;; +char *Item=NULL, *Name=NULL, *Res=NULL; + + ptr=Line; + while (ptr) + { + ptr=GenericExtractFromLine(ptr, "item", Start, End, Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); + Item=CopyStr(Item,GetVar(Vars,"item")); + tptr=strstr(Item, "H264-"); + if (tptr) + { + tptr+=5; + GetToken(tptr,"/",&Res,0); + Name=MCopyStr(Name,"item:mp4:",Res,NULL); + SetVar(Vars, Name, Item); + } + } + +DestroyString(Item); +DestroyString(Name); +DestroyString(Res); +} + + + + + +/******************************************************************************************************* // This is the main function that 'screen scrapes' a webpage looking for // information that it can use to get a video +*******************************************************************************************************/ + int ExtractItemInfo(STREAM *S, int Type, char *URL, char *Title, int Flags) { char *Tempstr=NULL, *Token=NULL, *VarName=NULL, *Server=NULL; @@ -973,37 +799,92 @@ SetVar(Vars,"Title",Title); if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"\n------- DOWNLOADING DOCUMENT ------\n"); Tempstr=STREAMReadLine(Tempstr, S); + while (Tempstr) { StripTrailingWhitespace(Tempstr); StripLeadingWhitespace(Tempstr); if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"%s\n",Tempstr); + + switch (Type) { +case TYPE_CONTAINERFILE_PLS: + ptr=GetToken(Tempstr,"=",&Token,0); + if (strncmp(Token,"File",4)==0) + { + GenericExtractFromLine(Tempstr, "item:mp3","=", "", Vars, EXTRACT_DESLASHQUOTE|EXTRACT_GUESSTYPE); + } +break; + +case TYPE_CONTAINERFILE_ASX: + #define ASX_ITEM_START "" #define EHOW_TITLE_END "" -#define EHOW_ITEM2 "showPlayer({" - if (strstr(Tempstr,EHOW_ITEM)) + if (strstr(Tempstr,EHOW_LINE)) { GenericExtractFromLine(Tempstr, "item:flv",EHOW_ITEM,EHOW_ITEM_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); } - if (strstr(Tempstr,EHOW_HD_ITEM)) - { - GenericExtractFromLine(Tempstr, "item:flv:hd",EHOW_HD_ITEM,EHOW_HD_ITEM_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); - } - - - ptr=strstr(Tempstr,EHOW_ITEM2); - if (ptr) - { - EhowExtractShowPlayer(S,ptr,Vars); - } - - - ptr=strstr(Tempstr,EHOW_TITLE); - if (ptr) - { - GenericExtractFromLine(Tempstr, "Title",EHOW_TITLE,EHOW_TITLE_END,Vars,EXTRACT_DEQUOTE); - } -break; - -case TYPE_EHOW_STAGE2: -#define EHOW_STAGE2_ITEM "source=" -#define EHOW_STAGE2_ITEM_END "&" - - ptr=strstr(Tempstr,EHOW_STAGE2_ITEM); - if (ptr) - { - GenericExtractFromLine(Tempstr, "item:flv",EHOW_STAGE2_ITEM,EHOW_STAGE2_ITEM_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); - } - ptr=strstr(Tempstr,EHOW_TITLE); if (ptr) { @@ -1204,52 +1029,10 @@ case TYPE_VIMEO_STAGE3: break; -case TYPE_VIDEOJUG: -#define VIDEOJUG_ITEM "type=\"application/xml+oembed\" href=\"" -#define VIDEOJUG_ITEM_END "\"" -#define VIDEOJUG_TITLE "<iframe" -#define VIDEOJUG_S2_ITEM "src=\"" -#define VIDEOJUG_S2_ITEM_END "\"" - - if (strstr(Tempstr,VIDEOJUG_S2_LINE)) - { - GenericExtractFromLine(Tempstr, "ID",VIDEOJUG_S2_ITEM,VIDEOJUG_S2_ITEM_END,Vars,EXTRACT_NOSPACES); - } -break; - -case TYPE_VIDEOJUG_STAGE3: -#define VIDEOJUG_S3_LINE "var html5Embed =" -#define VIDEOJUG_S3_ITEM "src=\"" -#define VIDEOJUG_S3_ITEM_END "\"" - - if (strstr(Tempstr,VIDEOJUG_S3_LINE)) - { - GenericExtractFromLine(Tempstr, "ID",VIDEOJUG_S3_ITEM,VIDEOJUG_S3_ITEM_END,Vars,EXTRACT_NOSPACES); - } -break; - - case TYPE_DAILYMOTION: -#define DAILYMOTION_ITEM "oembed?url=" -#define DAILYMOTION_ITEM_END "&format=xml" +#define DAILYMOTION_ITEM "/mp4\",\"url\":\"" +#define DAILYMOTION_ITEM_END "\"}" #define DAILYMOTION_TITLE_START "" #define IZLESE_TITLE_END "" #define IZLESE_TITLE2_START "" @@ -1520,22 +1179,16 @@ break; case TYPE_IZLESE: if (strstr(Tempstr,IZLESE_ITEM_START) && strstr(Tempstr,IZLESE_ITEM_END)) { - GenericExtractFromLine(Tempstr, "tmp",IZLESE_ITEM_START,IZLESE_ITEM_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); - ptr=GetVar(Vars,"tmp"); - if (ptr) - { - //put 'http' back on - Tempstr=MCopyStr(Tempstr,"http",ptr,NULL); - - } + GenericExtractFromLine(Tempstr, "tmp",IZLESE_ITEM_START,IZLESE_ITEM_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); + ptr=GetVar(Vars,"tmp"); if (strstr(ptr,"youtube")) { - SetVar(Vars,"item:reference",Tempstr); + SetVar(Vars,"item:reference",ptr); } else { - SetVar(Vars,"item:flv",Tempstr); + SetVar(Vars,"item:flv",ptr); } } @@ -1582,22 +1235,6 @@ case TYPE_REUTERS: break; -#define AE_YT_ITEM1_START "href=\"http://www.youtube.com/watch?v=" -#define AE_YT_ITEM1_END "\"" - -case TYPE_ACADEMIC_EARTH: - ptr=strstr(Tempstr,AE_YT_ITEM1_START); - if (ptr) - { - GenericExtractFromLine(Tempstr, "item:reference",AE_YT_ITEM1_START,AE_YT_ITEM1_END,Vars, EXTRACT_NOSPACES); - - Tempstr=MCopyStr(Tempstr,"http://youtube.com/watch?v=",GetVar(Vars,"item:reference"),NULL); - SetVar(Vars,"item:reference",Tempstr); - } - -break; - - #define PHOTOBUCKET_START "\"fullsizeUrl\":\"" #define PHOTOBUCKET_END "\"" @@ -1749,28 +1386,38 @@ break; + case TYPE_CBSNEWS: -ExtractCBSNews(Vars, Tempstr); +#define CBS_ITEM_START "\"bitrate\":1000,\"url\":\"" +#define CBS_ITEM_END "\"" + if (strstr(Tempstr,GENERIC_TITLE_START)) { GenericExtractFromLine(Tempstr, "Title",GENERIC_TITLE_START,GENERIC_TITLE_END,Vars,EXTRACT_DEQUOTE); } +if (strstr(Tempstr,CBS_ITEM_START) ) +{ + ptr=Tempstr; + while (ptr) ptr=GenericExtractFromLine(ptr, "item:flv",CBS_ITEM_START,CBS_ITEM_END,Vars,EXTRACT_GUESSTYPE|EXTRACT_DESLASHQUOTE); +} break; case TYPE_FRANCE24: -#define FRANCE24_ITEM_START "meta property=\"og:video\" content=\"" +#define FRANCE24_ITEM_LINE "window.BSPlayer.items" +#define FRANCE24_ITEM_START "\"is_default\":0,\"source\":\"" #define FRANCE24_ITEM_END "\"" #define FRANCE24_ITEM2_START "file=" #define FRANCE24_ITEM2_END "&" -if (strstr(Tempstr,FRANCE24_ITEM_START) ) +if (strstr(Tempstr,FRANCE24_ITEM_LINE) ) { - GenericExtractFromLine(Tempstr, "item:flv",FRANCE24_ITEM_START,FRANCE24_ITEM_END,Vars,EXTRACT_GUESSTYPE); + ptr=Tempstr; + while (ptr) ptr=GenericExtractFromLine(ptr, "item:flv",FRANCE24_ITEM_START,FRANCE24_ITEM_END,Vars,EXTRACT_GUESSTYPE|EXTRACT_DESLASHQUOTE); + } - -if (strstr(Tempstr,FRANCE24_ITEM2_START) ) +else if (strstr(Tempstr,FRANCE24_ITEM2_START) ) { GenericExtractFromLine(Tempstr, "item:flv",FRANCE24_ITEM2_START,FRANCE24_ITEM2_END,Vars,EXTRACT_GUESSTYPE); } @@ -1786,7 +1433,7 @@ break; case TYPE_EURONEWS: -#define EURONEWS_ITEM_START "videofile:\"" +#define EURONEWS_ITEM_START "sources: [{file: \"" #define EURONEWS_BULLETIN_START "vid0:\"" #define EURONEWS_ITEM_END "\"" @@ -1794,7 +1441,7 @@ if (strstr(Tempstr,EURONEWS_ITEM_START) ) { //don't try using 'guesstype' here, as we stick .flv on later, and need //to be able to find 'ID', not 'item:guessed' - GenericExtractFromLine(Tempstr, "ID",EURONEWS_ITEM_START,EURONEWS_ITEM_END,Vars,0); + GenericExtractFromLine(Tempstr, "ID",EURONEWS_ITEM_START,EURONEWS_ITEM_END,Vars,EXTRACT_GUESSTYPE); } if (strstr(Tempstr,EURONEWS_BULLETIN_START) ) @@ -1814,20 +1461,22 @@ break; case TYPE_METATUBE: -#define METATUBE_ITEM_START "flashvars.src = \"" -#define METATUBE_ITEM_END "\";" +#define METATUBE_ITEM_START "\"sources\":[\"" +#define METATUBE_ITEM_END "\"" #define METATUBE_ITEM2_START "<video src=\"" #define METATUBE_ITEM2_END "\"" if (strstr(Tempstr,METATUBE_ITEM_START) ) { - GenericExtractFromLine(Tempstr, "item:flv",METATUBE_ITEM_START,METATUBE_ITEM_END,Vars,EXTRACT_GUESSTYPE); + GenericExtractFromLine(Tempstr, "item:flv",METATUBE_ITEM_START,METATUBE_ITEM_END,Vars,EXTRACT_GUESSTYPE | EXTRACT_DESLASHQUOTE); } +/* if (strstr(Tempstr,METATUBE_ITEM2_START) ) { GenericExtractFromLine(Tempstr, "item:flv",METATUBE_ITEM2_START,METATUBE_ITEM2_END,Vars,EXTRACT_GUESSTYPE); } +*/ if (strstr(Tempstr,GENERIC_TITLE_START)) { @@ -1836,63 +1485,6 @@ if (strstr(Tempstr,GENERIC_TITLE_START)) break; -case TYPE_MOTIONFEEDS: -#define MOTIONFEEDS_ITEM_LINE "param name=\"movie\" " -#define MOTIONFEEDS_ITEM_START1 "file=" -#define MOTIONFEEDS_ITEM_START2 "value=" -#define MOTIONFEEDS_ITEM_START3 "http://www.youtube.com/watch?v=" -#define MOTIONFEEDS_ITEM_END "&" - -if (strstr(Tempstr,MOTIONFEEDS_ITEM_LINE) ) -{ -if (strstr(Tempstr,MOTIONFEEDS_ITEM_START1) ) GenericExtractFromLine(Tempstr, "item:flv",MOTIONFEEDS_ITEM_START1,MOTIONFEEDS_ITEM_END,Vars,0); -else if (strstr(Tempstr,MOTIONFEEDS_ITEM_START2) ) GenericExtractFromLine(Tempstr, "item:reference",MOTIONFEEDS_ITEM_START2,MOTIONFEEDS_ITEM_END,Vars,0); -} - - -if (strstr(Tempstr,GENERIC_TITLE_START)) -{ - GenericExtractFromLine(Tempstr, "Title",GENERIC_TITLE_START,GENERIC_TITLE_END,Vars,0); -} - -if (strstr(Tempstr,MOTIONFEEDS_ITEM_START3) ) -{ -GenericExtractFromLine(Tempstr, "item:reference",MOTIONFEEDS_ITEM_START3,MOTIONFEEDS_ITEM_END,Vars,0); -Tempstr=MCopyStr(Tempstr,MOTIONFEEDS_ITEM_START3,GetVar(Vars,"item:reference"),NULL); -SetVar(Vars,"item:reference",Tempstr); -} - -break; - - - -case TYPE_ESCAPIST: -#define ESCAPIST_ITEM_START "swf?config=" -#define ESCAPIST_ITEM_END "&" -#define ESCAPIST_TITLE_START "<meta property=\"og:title\" content=\"" -#define ESCAPIST_TITLE_END "\"" - -if (strstr(Tempstr,ESCAPIST_ITEM_START) ) -{ - GenericExtractFromLine(Tempstr, "ID",ESCAPIST_ITEM_START,ESCAPIST_ITEM_END,Vars,EXTRACT_DEQUOTE); -} - -if (strstr(Tempstr,ESCAPIST_TITLE_START) ) -{ -GenericExtractFromLine(Tempstr, "Title",ESCAPIST_TITLE_START,ESCAPIST_TITLE_END,Vars,0); -} -break; - -case TYPE_ESCAPIST_STAGE2: -/* -#define ESCAPIST_STAGE2_ITEM_START "'},{'url':'" -#define ESCAPIST_STAGE2_ITEM_END "'" -if (strstr(Tempstr,ESCAPIST_STAGE2_ITEM_START) ) GenericExtractFromLine(Tempstr, "item:mp4",ESCAPIST_STAGE2_ITEM_START,ESCAPIST_STAGE2_ITEM_END,Vars,0); - -*/ - -ParseFlashPlaylist(Tempstr, Vars); -break; case TYPE_GUARDIAN: @@ -1923,12 +1515,13 @@ if (strstr(Tempstr,GENERIC_TITLE_START)) break; case TYPE_REDORBIT: -#define REDORBIT_ITEM_START "playlist=" -#define REDORBIT_ITEM_END "'" +#define REDORBIT_ITEM_LINE "<source type=\"video/" +#define REDORBIT_ITEM_START "src=\"" +#define REDORBIT_ITEM_END "\"" -if (strstr(Tempstr,REDORBIT_ITEM_START) ) +if (strstr(Tempstr,REDORBIT_ITEM_LINE) ) { - GenericExtractFromLine(Tempstr, "ID",REDORBIT_ITEM_START,REDORBIT_ITEM_END,Vars,EXTRACT_DEQUOTE); + GenericExtractFromLine(Tempstr, "ID",REDORBIT_ITEM_START,REDORBIT_ITEM_END,Vars,EXTRACT_DEQUOTE|EXTRACT_GUESSTYPE); } @@ -1940,15 +1533,6 @@ if (strstr(Tempstr,GENERIC_TITLE_START)) break; -case TYPE_REDORBIT_STAGE2: -#define REDORBIT2_ITEM_START "<media:content url=\"" -#define REDORBIT2_ITEM_END "\"" - -if (strstr(Tempstr,REDORBIT2_ITEM_START) ) -{ - GenericExtractFromLine(Tempstr, "item:flv",REDORBIT2_ITEM_START,REDORBIT2_ITEM_END,Vars,EXTRACT_GUESSTYPE); -} -break; case TYPE_SCIVEE: #define SCIVEE_ITEM_START "<param name=\"flashvars\" value=\"id=" @@ -2043,18 +1627,13 @@ case TYPE_KAVLIINSTITUTE_STAGE2: break; case TYPE_DOTSUB: -#define DOTSUB_ITEMSTART "mediaUri = '" -#define DOTSUB_ITEMEND "'" -#define DOTSUB_SERVSTART "webAppUrl = '" +#define DOTSUB_ITEMSTART "<source src=\"" +#define DOTSUB_ITEMEND "\"" #define DOTSUB_TITLESTART "og:title\" content=\"" #define DOTSUB_TITLEEND "\"" - if (strstr(Tempstr,DOTSUB_ITEMSTART)) GenericExtractFromLine(Tempstr, "ID",DOTSUB_ITEMSTART,DOTSUB_ITEMEND,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); - if (strstr(Tempstr,DOTSUB_SERVSTART)) GenericExtractFromLine(Tempstr, "SERV",DOTSUB_SERVSTART,DOTSUB_ITEMEND,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); - if (strstr(Tempstr,DOTSUB_TITLESTART)) - { - GenericExtractFromLine(Tempstr, "Title",DOTSUB_TITLESTART,DOTSUB_TITLEEND,Vars,0); - } + if (strstr(Tempstr,DOTSUB_ITEMSTART)) GenericExtractFromLine(Tempstr, "ID",DOTSUB_ITEMSTART,DOTSUB_ITEMEND,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES | EXTRACT_GUESSTYPE); + if (strstr(Tempstr,DOTSUB_TITLESTART)) GenericExtractFromLine(Tempstr, "Title",DOTSUB_TITLESTART,DOTSUB_TITLEEND,Vars,0); break; case TYPE_ASTRONOMYCOM: @@ -2090,21 +1669,6 @@ case TYPE_ASTRONOMYCOM_STAGE2: break; -case TYPE_TEACHERTUBE: -#define TEACHERTUBE_ITEMSTART "'file': '" -#define TEACHERTUBE_ITEMEND "'" - - if (strstr(Tempstr,GENERIC_TITLE_START)) - { - GenericExtractFromLine(Tempstr, "Title",GENERIC_TITLE_START,GENERIC_TITLE_END,Vars,EXTRACT_DEQUOTE); - } - - if (strstr(Tempstr,TEACHERTUBE_ITEMSTART)) - { - GenericExtractFromLine(Tempstr, "ID",TEACHERTUBE_ITEMSTART,TEACHERTUBE_ITEMEND,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); - } -break; - case TYPE_DISCOVERY: #define DISCOVERY_ITEMSTART "\"m3u8\": \"" @@ -2219,19 +1783,13 @@ break; case TYPE_FUNNYORDIE: #define FOD_ITEMSTART "<source src=\"" -#define FOD_ITEMEND ".m3u8" -#define FOD_TITLE_START "title: \"" +#define FOD_ITEMEND "\"" +#define FOD_TITLE_START "meta property=\"og:title\" content=\"" #define FOD_TITLE_END "\"" if (strstr(Tempstr,FOD_ITEMSTART)) { - GenericExtractFromLine(Tempstr, "item:reference",FOD_ITEMSTART,FOD_ITEMEND,Vars,EXTRACT_DESLASHQUOTE | EXTRACT_NOSPACES); - ptr=GetVar(Vars,"item:reference"); - if (ptr) - { - Tempstr=MCopyStr(Tempstr,ptr,".m3u8",NULL); - SetVar(Vars,"item:reference",Tempstr); - } + GenericExtractFromLine(Tempstr, "ID",FOD_ITEMSTART,FOD_ITEMEND,Vars,EXTRACT_DESLASHQUOTE | EXTRACT_NOSPACES | EXTRACT_GUESSTYPE); } if (strstr(Tempstr,FOD_TITLE_START)) @@ -2244,15 +1802,13 @@ break; case TYPE_GOOGLE_URL: SetVar(Vars,"item:reference",URL); + Type=TYPE_REFERENCE; break; -case TYPE_MYTOPCLIP: -case TYPE_PRINCETON: case TYPE_UCTV: case TYPE_GENERIC: -case TYPE_ALJAZEERA: //some sites are actually just frontends to youtube #define YOUTUBE_REFERENCE1 "http://www.youtube.com/watch?v=" @@ -2279,7 +1835,7 @@ if (strstr(Tempstr,YOUTUBE_REFERENCE2)) //pick up on it } -for (i=0; i < ContainerTypes[i]; i++) +for (i=0; ContainerTypes[i] !=NULL; i++) { if (strstr(Tempstr,ContainerTypes[i])) { @@ -2335,6 +1891,8 @@ break; if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"\n------- END DOCUMENT ------\n\n"); +//ptr=GetVar(Vars,"item:m3u8"); +//if (StrValid(ptr)) M3UContainer(ptr, Vars); if (MediaCount > 0) HandleMultipleMedia(Type,Server,Flags,Vars,MediaCount); else @@ -2345,6 +1903,7 @@ else } ptr=GetVar(Vars,"ID"); + if (ptr) RetVal=GetNextURL(Type, Server, Flags, Vars); else if (! (Flags & FLAG_QUIET)) { diff --git a/servicetypes.h b/servicetypes.h index 0a4fe58..76d4638 100644 --- a/servicetypes.h +++ b/servicetypes.h @@ -4,13 +4,13 @@ #include "common.h" -typedef enum {TYPE_NONE, TYPE_GENERIC, TYPE_YOUTUBE, TYPE_METACAFE, TYPE_DAILYMOTION, TYPE_BREAK_COM, TYPE_EHOW, TYPE_VIMEO, TYPE_VBOX7,TYPE_BLIPTV,TYPE_TED, TYPE_MYVIDEO, TYPE_MYTOPCLIP,TYPE_REDBALCONY, TYPE_MOBANGO, TYPE_YALE, TYPE_PRINCETON, TYPE_REUTERS, TYPE_LIVELEAK, TYPE_ACADEMIC_EARTH,TYPE_PHOTOBUCKET,TYPE_VIDEOEMO,TYPE_ALJAZEERA,TYPE_MEFEEDIA,TYPE_IVIEWTUBE,TYPE_WASHINGTONPOST,TYPE_CBSNEWS,TYPE_FRANCE24,TYPE_EURONEWS,TYPE_METATUBE,TYPE_MOTIONFEEDS,TYPE_ESCAPIST,TYPE_GUARDIAN,TYPE_REDORBIT,TYPE_SCIVEE,TYPE_IZLESE, TYPE_UCTV, TYPE_ROYALSOCIETY, TYPE_BRITISHACADEMY, TYPE_KAVLIINSTITUTE,TYPE_DOTSUB,TYPE_ASTRONOMYCOM, TYPE_TEACHERTUBE, TYPE_DISCOVERY, TYPE_BLOOMBERG,TYPE_NATGEO,TYPE_VIDEOBASH,TYPE_IBTIMES,TYPE_SMH,TYPE_VIDEOJUG,TYPE_ANIMEHERE,TYPE_FUNNYORDIE, +typedef enum {TYPE_NONE, TYPE_GENERIC, TYPE_YOUTUBE, TYPE_YOUTUBE_SHORT, TYPE_METACAFE, TYPE_DAILYMOTION, TYPE_BREAK_COM, TYPE_EHOW, TYPE_VIMEO, TYPE_TED, TYPE_REDBALCONY, TYPE_YALE, TYPE_REUTERS, TYPE_LIVELEAK, TYPE_PHOTOBUCKET,TYPE_IVIEWTUBE,TYPE_WASHINGTONPOST,TYPE_CBSNEWS,TYPE_FRANCE24,TYPE_EURONEWS,TYPE_METATUBE,TYPE_GUARDIAN,TYPE_REDORBIT,TYPE_SCIVEE,TYPE_IZLESE, TYPE_UCTV, TYPE_ROYALSOCIETY, TYPE_BRITISHACADEMY, TYPE_KAVLIINSTITUTE,TYPE_DOTSUB,TYPE_ASTRONOMYCOM, TYPE_DISCOVERY, TYPE_BLOOMBERG,TYPE_NATGEO,TYPE_VIDEOBASH,TYPE_IBTIMES,TYPE_SMH,TYPE_ANIMEHERE,TYPE_FUNNYORDIE, /*Following ones are not real types, but used by internal processes */ -TYPE_DAILYMOTION_STAGE2, TYPE_DAILYMOTION_STAGE3, TYPE_VIMEO_STAGE2, TYPE_VIMEO_STAGE3, TYPE_EHOW_STAGE2, TYPE_CLIPSHACK_STAGE2, TYPE_CLIPSHACK_STAGE3, TYPE_VIDEOEMO_STAGE2,TYPE_MYVIDO1_STAGE2, TYPE_REFERENCE, TYPE_WASHINGTONPOST_JSON, TYPE_WASHINGTONPOST_STAGE2, TYPE_BLIPTV_STAGE2, TYPE_BLIPTV_STAGE3, TYPE_ESCAPIST_STAGE2, TYPE_REDORBIT_STAGE2, TYPE_REDBALCONY_STAGE2,TYPE_BRITISHACADEMY_STAGE2, TYPE_KAVLIINSTITUTE_STAGE2,TYPE_ASTRONOMYCOM_STAGE2,TYPE_CONTAINERFILE,TYPE_TEACHERTUBE_STAGE2,TYPE_VIDEOJUG_STAGE2,TYPE_VIDEOJUG_STAGE3, TYPE_ANIMEHERE_STAGE2, TYPE_GOOGLE_URL, TYPE_YOUTUBE_PLAYLIST, TYPE_ROYALSOCIETY_STAGE2} TDT; +TYPE_VIMEO_STAGE2, TYPE_VIMEO_STAGE3, TYPE_CLIPSHACK_STAGE2, TYPE_CLIPSHACK_STAGE3, TYPE_VIDEOEMO_STAGE2,TYPE_MYVIDO1_STAGE2, TYPE_REFERENCE, TYPE_WASHINGTONPOST_JSON, TYPE_WASHINGTONPOST_STAGE2, TYPE_REDORBIT_STAGE2, TYPE_REDBALCONY_STAGE2,TYPE_BRITISHACADEMY_STAGE2, TYPE_KAVLIINSTITUTE_STAGE2,TYPE_ASTRONOMYCOM_STAGE2,TYPE_CONTAINERFILE, TYPE_ANIMEHERE_STAGE2, TYPE_GOOGLE_URL, TYPE_YOUTUBE_PLAYLIST, TYPE_ROYALSOCIETY_STAGE2, TYPE_M3U8_STREAM, TYPE_CONTAINERFILE_M3U8, TYPE_CONTAINERFILE_PLS, TYPE_CONTAINERFILE_ASX} TDT; extern char *DownloadTypes[], *DownloadNames[], *TestLinks[]; -int IdentifyServiceType(char *Server); +int IdentifyServiceType(const char *Path); char *SiteSpecificPreprocessing(char *RetBuf, char *Path, char *Proto, char *Server, int Port, char *Doc, int *Type, char **Title, int *Post); int GetNextURL(int Type, char *Server, int Post, ListNode *Vars); int ExtractItemInfo(STREAM *S, int Type, char *URL, char *Title, int Post); diff --git a/youtube.c b/youtube.c index b2a5f0d..e399d1b 100644 --- a/youtube.c +++ b/youtube.c @@ -24,16 +24,18 @@ DestroyString(Tempstr); -void YouTubeFormatGetData(char *Data, char **URL, char **Code) +void YouTubeFormatGetData(char *Data, char **URL, char **Code, ListNode *Vars) { char *Name=NULL, *Value=NULL, *ptr; +char *Extra=NULL; ptr=GetNameValuePair(Data,"&","=",&Name,&Value); while (ptr) { if (StrLen(Name)) { - if (strcmp(Name,"sig")==0) *URL=MCatStr(*URL,"&signature=", Value, NULL); + if (strcmp(Name,"sig")==0) Extra=MCatStr(Extra,"&signature=", Value, NULL); + if (strcmp(Name,"fallback_host")==0) Extra=MCatStr(Extra,"&fallback_host=", Value, NULL); if (strcmp(Name,"url")==0) *URL=HTTPUnQuote(*URL,Value); if (strcmp(Name,"itag")==0) *Code=CopyStr(*Code,Value); } @@ -41,8 +43,10 @@ while (ptr) ptr=GetNameValuePair(ptr,"&","=",&Name,&Value); } +*URL=CatStr(*URL,Extra); DestroyString(Name); DestroyString(Value); +DestroyString(Extra); } @@ -53,7 +57,7 @@ char *Token=NULL, *Tempstr=NULL, *TypeCode=NULL, *URL=NULL, *ptr; ptr=GetToken(Formats,",",&Token,0); while (ptr) { - YouTubeFormatGetData(Token, &URL, &TypeCode); + YouTubeFormatGetData(Token, &URL, &TypeCode, Vars); switch (atoi(TypeCode)) { case 5: @@ -117,6 +121,11 @@ while (ptr) SetVar(Vars,"item:webm:1920x1080",URL); break; + case 59: + case 78: + SetVar(Vars,"item:mp4:640x480",URL); + break; + case 82: SetVar(Vars,"item:mp4-3D:640x360",URL); break;