diff --git a/CHANGES b/CHANGES old mode 100644 new mode 100755 diff --git a/Docs/HowToAddSites.txt b/Docs/HowToAddSites.txt old mode 100644 new mode 100755 diff --git a/Docs/Proxys.txt b/Docs/Proxys.txt old mode 100644 new mode 100755 diff --git a/Docs/Radio.txt b/Docs/Radio.txt old mode 100644 new mode 100755 diff --git a/Docs/Usage.txt b/Docs/Usage.txt old mode 100644 new mode 100755 diff --git a/INSTALL b/INSTALL old mode 100644 new mode 100755 diff --git a/LICENCE b/LICENCE old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 index d14c90a..a79fcb4 --- 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=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 +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.4; $(MAKE) - $(CC) $(FLAGS) -o movgrab main.c $(LIBS) $(OBJ) libUseful-2.4/libUseful-2.4.a + @cd libUseful-2.6; $(MAKE) + $(CC) $(FLAGS) -o movgrab main.c $(LIBS) $(OBJ) libUseful-2.6/libUseful-2.6.a clean: - @rm -f movgrab *.o libUseful-2.4/*.o libUseful-2.4/*.a libUseful-2.4/*.so + @rm -f movgrab *.o libUseful-2.6/*.o libUseful-2.6/*.a libUseful-2.6/*.so containerfiles.o: containerfiles.c containerfiles.h $(CC) $(FLAGS) -c containerfiles.c diff --git a/Makefile.in b/Makefile.in old mode 100644 new mode 100755 index a8e1f19..6276234 --- a/Makefile.in +++ b/Makefile.in @@ -10,11 +10,11 @@ FLAGS=$(CFLAGS) @DEFS@ 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.4; $(MAKE) - $(CC) $(FLAGS) -o movgrab main.c $(LIBS) $(OBJ) libUseful-2.4/libUseful-2.4.a + @cd libUseful-2.6; $(MAKE) + $(CC) $(FLAGS) -o movgrab main.c $(LIBS) $(OBJ) libUseful-2.6/libUseful-2.6.a clean: - @rm -f movgrab *.o libUseful-2.4/*.o libUseful-2.4/*.a libUseful-2.4/*.so + @rm -f movgrab *.o libUseful-2.6/*.o libUseful-2.6/*.a libUseful-2.6/*.so containerfiles.o: containerfiles.c containerfiles.h $(CC) $(FLAGS) -c containerfiles.c diff --git a/README b/README old mode 100644 new mode 100755 diff --git a/autom4te.cache/output.0 b/autom4te.cache/output.0 old mode 100644 new mode 100755 index 418c7ac..4cb9c94 --- a/autom4te.cache/output.0 +++ b/autom4te.cache/output.0 @@ -655,7 +655,7 @@ LDFLAGS LIBS CPPFLAGS CPP' -ac_subdirs_all='libUseful-2.4' +ac_subdirs_all='libUseful-2.6' # Initialize some variables set by options. ac_init_help= @@ -1904,7 +1904,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -subdirs="$subdirs libUseful-2.4" +subdirs="$subdirs libUseful-2.6" ac_ext=c diff --git a/autom4te.cache/requests b/autom4te.cache/requests old mode 100644 new mode 100755 index 0ff5f0e..6df8440 --- a/autom4te.cache/requests +++ b/autom4te.cache/requests @@ -14,63 +14,63 @@ 'configure.in' ], { - '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_SUBST' => 1, - 'AC_CANONICAL_HOST' => 1, - 'AC_FC_SRCEXT' => 1, - 'AC_PROG_LIBTOOL' => 1, - 'AM_INIT_AUTOMAKE' => 1, - 'AC_CONFIG_SUBDIRS' => 1, - 'AM_PATH_GUILE' => 1, - 'AM_AUTOMAKE_VERSION' => 1, - 'LT_CONFIG_LTDL_DIR' => 1, - 'AC_CONFIG_LINKS' => 1, - 'AC_REQUIRE_AUX_FILE' => 1, - 'LT_SUPPORTED_TAG' => 1, 'm4_sinclude' => 1, - 'AM_MAINTAINER_MODE' => 1, - 'AM_NLS' => 1, + 'LT_CONFIG_LTDL_DIR' => 1, + 'LT_INIT' => 1, + 'AC_CANONICAL_HOST' => 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, - 'AM_GNU_GETTEXT' => 1, - 'AM_PROG_AR' => 1, + 'AC_REQUIRE_AUX_FILE' => 1, + '_m4_warn' => 1, + 'AM_PROG_CC_C_O' => 1, + '_LT_AC_TAGCONFIG' => 1, 'AC_LIBSOURCE' => 1, - 'AC_CANONICAL_BUILD' => 1, - 'AM_PROG_FC_C_O' => 1, + 'AM_NLS' => 1, 'AC_FC_FREEFORM' => 1, + '_AM_SUBST_NOTMAKE' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AC_FC_SRCEXT' => 1, + 'AC_CONFIG_LINKS' => 1, + 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, + 'AM_POT_TOOLS' => 1, + 'm4_pattern_forbid' => 1, + 'AC_CANONICAL_SYSTEM' => 1, 'AC_FC_PP_SRCEXT' => 1, - 'AH_OUTPUT' => 1, + 'AC_CONFIG_FILES' => 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, + 'AM_PROG_MOC' => 1, + 'AC_CONFIG_SUBDIRS' => 1, 'AM_XGETTEXT_OPTION' => 1, + 'AM_PATH_GUILE' => 1, + 'AM_PROG_FC_C_O' => 1, + 'AC_PROG_LIBTOOL' => 1, + '_AM_COND_ELSE' => 1, + 'AM_CONDITIONAL' => 1, + '_AM_COND_IF' => 1, + 'AC_INIT' => 1, + 'AC_SUBST_TRACE' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'include' => 1, + 'AM_PROG_F77_C_O' => 1, + 'AM_MAKEFILE_INCLUDE' => 1, + 'LT_SUPPORTED_TAG' => 1, + 'AM_SILENT_RULES' => 1, + '_AM_MAKEFILE_INCLUDE' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AM_PROG_AR' => 1, 'AC_CONFIG_HEADERS' => 1, - 'AC_DEFINE_TRACE_LITERAL' => 1, - 'AM_POT_TOOLS' => 1, + 'AC_CANONICAL_BUILD' => 1, + 'AM_PROG_CXX_C_O' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, 'm4_include' => 1, - '_AM_COND_ELSE' => 1, - 'AC_SUBST_TRACE' => 1 + 'AC_SUBST' => 1, + 'AM_GNU_GETTEXT' => 1, + 'AC_CANONICAL_TARGET' => 1, + 'AM_MAINTAINER_MODE' => 1, + 'AM_ENABLE_MULTILIB' => 1, + 'AH_OUTPUT' => 1, + 'm4_pattern_allow' => 1 } ], 'Autom4te::Request' ) ); diff --git a/autom4te.cache/traces.0 b/autom4te.cache/traces.0 old mode 100644 new mode 100755 index 78107c7..9d4ccdc --- a/autom4te.cache/traces.0 +++ b/autom4te.cache/traces.0 @@ -149,8 +149,8 @@ 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.4]) -m4trace:configure.in:8: -1- AC_SUBST([subdirs], ["$subdirs m4_normalize([libUseful-2.4])"]) +m4trace:configure.in:8: -1- AC_CONFIG_SUBDIRS([libUseful-2.6]) +m4trace:configure.in:8: -1- AC_SUBST([subdirs], ["$subdirs m4_normalize([libUseful-2.6])"]) m4trace:configure.in:8: -1- AC_SUBST_TRACE([subdirs]) m4trace:configure.in:8: -1- m4_pattern_allow([^subdirs$]) m4trace:configure.in:10: -1- AC_SUBST([CC]) diff --git a/common.c b/common.c old mode 100644 new mode 100755 diff --git a/common.h b/common.h old mode 100644 new mode 100755 index 58c061d..9d450b4 --- a/common.h +++ b/common.h @@ -4,7 +4,7 @@ //This is doable through autoconf, but I'm sick of fighting with it #define Version "2.0.0" -#include "libUseful-2.4/libUseful.h" +#include "libUseful-2.6/libUseful.h" #include #include #include "extract_text.h" diff --git a/config.log b/config.log old mode 100644 new mode 100755 index 2c5d181..8397b1a --- a/config.log +++ b/config.log @@ -4,17 +4,17 @@ 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 + $ ./configure --enable-ssl ## --------- ## ## Platform. ## ## --------- ## -hostname = ferrara -uname -m = i686 -uname -r = 3.19.3amd +hostname = colums-hp +uname -m = x86_64 +uname -r = 4.7.4-64 uname -s = Linux -uname -v = #1 Sat Apr 4 03:25:36 UTC 2015 +uname -v = #1 SMP Fri Sep 16 22:00:54 UTC 2016 /usr/bin/uname -p = unknown /bin/uname -X = unknown @@ -33,12 +33,24 @@ PATH: /usr/bin PATH: /usr/X11R7/bin PATH: /bin PATH: /usr/games/bin -PATH: /opt/Python-3.4.3/bin -PATH: /opt/tcl-8.6.3/bin -PATH: /opt/git-2.3.5/bin -PATH: /opt/wine-1.7.38/bin +PATH: . +PATH: /opt/Csound-6.05/bin +PATH: /opt/Qt4/bin +PATH: /opt/SDL/bin +PATH: /opt/SDL2/bin +PATH: /opt/chkrootkit-0.50/bin +PATH: /opt/ghostscript-9.19/bin +PATH: /opt/git-2.9.3/bin +PATH: /opt/jx9-1.0/bin +PATH: /opt/lua-5.3.3/bin +PATH: /opt/lxc-2.0.3/bin +PATH: /opt/mujs-b005928/bin PATH: /opt/perl-5.20.1/bin -PATH: /opt/curl-7.41.0/ +PATH: /opt/poppler-0.43.0/bin +PATH: /opt/qemu-2.5.0/bin +PATH: /opt/schily/bin +PATH: /opt/wine-1.9.18/bin +PATH: /opt/x86_64/bin ## ----------- ## @@ -50,8 +62,8 @@ 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.9.2 -Copyright (C) 2014 Free Software Foundation, Inc. +gcc (GCC) 5.3.0 +Copyright (C) 2015 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. @@ -59,11 +71,11 @@ 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.9.2/lto-wrapper +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-pc-linux-gnu/5.3.0/lto-wrapper Target: i486-pc-linux-gnu -Configured with: ../gcc-4.9.2-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 +Configured with: ../gcc-5.3.0-src/configure --prefix=/usr --sysconfdir=/etc --includedir=/usr/include --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,c++,go --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i486-pc-linux-gnu --enable-bootstrap Thread model: posix -gcc version 4.9.2 (GCC) +gcc version 5.3.0 (GCC) configure:2234: $? = 0 configure:2223: gcc -V >&5 gcc: error: unrecognized command line option '-V' @@ -116,8 +128,6 @@ 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 - #include - ^ compilation terminated. configure:2880: $? = 1 configure: failed program was: @@ -135,8 +145,6 @@ 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 - #include - ^ compilation terminated. configure:2939: $? = 1 configure: failed program was: @@ -165,6 +173,14 @@ 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 ## ---------------------- ## @@ -180,11 +196,11 @@ generated by GNU Autoconf 2.69. Invocation command line was CONFIG_COMMANDS = $ ./config.status -on ferrara +on colums-hp config.status:729: creating Makefile -configure:4604: === configuring in libUseful-2.4 (/home/meta/Movgrab/libUseful-2.4) -configure:4667: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/local' --cache-file=/dev/null --srcdir=. +configure:4604: === configuring in libUseful-2.6 (/mnt/Movgrab-2.0.0/libUseful-2.6) +configure:4667: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/local' '--enable-ssl' --cache-file=/dev/null --srcdir=. ## ---------------- ## ## Cache variables. ## @@ -210,6 +226,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 +247,7 @@ 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_LIBZ=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64' +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,7 +259,7 @@ INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' LDFLAGS='' LIBOBJS='' -LIBS='-lz ' +LIBS='-lcrypto -lssl -lz ' LTLIBOBJS='' OBJEXT='o' PACKAGE_BUGREPORT='' @@ -278,7 +296,7 @@ program_transform_name='s,x,x,' psdir='${docdir}' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' -subdirs=' libUseful-2.4' +subdirs=' libUseful-2.6' sysconfdir='${prefix}/etc' target_alias='' @@ -297,5 +315,7 @@ target_alias='' #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 cbbf808..408a943 100755 --- a/config.status +++ b/config.status @@ -417,7 +417,7 @@ $config_files Report bugs to the package provider." -ac_cs_config="" +ac_cs_config="'--enable-ssl'" ac_cs_version="\ config.status configured by ./configure, generated by GNU Autoconf 2.69, @@ -427,7 +427,7 @@ 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' +ac_pwd='/mnt/Movgrab-2.0.0' srcdir='.' INSTALL='/bin/install -c' test -n "$AWK" || AWK=awk @@ -496,7 +496,7 @@ if $ac_cs_silent; then fi if $ac_cs_recheck; then - set X /bin/sh './configure' $ac_configure_extra_args --no-create --no-recursion + 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' @@ -598,17 +598,17 @@ S["CPPFLAGS"]="" S["LDFLAGS"]="" S["CFLAGS"]="-g -O2" S["CC"]="gcc" -S["subdirs"]=" libUseful-2.4" +S["subdirs"]=" libUseful-2.6" S["VERSION"]="1.2.1" S["target_alias"]="" S["host_alias"]="" S["build_alias"]="" -S["LIBS"]="-lz " +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_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" diff --git a/configure b/configure index 4e39e66..5633922 100755 --- a/configure +++ b/configure @@ -655,7 +655,7 @@ LDFLAGS LIBS CPPFLAGS CPP' -ac_subdirs_all='libUseful-2.4' +ac_subdirs_all='libUseful-2.6' # Initialize some variables set by options. ac_init_help= @@ -1904,7 +1904,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -subdirs="$subdirs libUseful-2.4" +subdirs="$subdirs libUseful-2.6" ac_ext=c diff --git a/configure.in b/configure.in old mode 100644 new mode 100755 index a405d85..f212d7e --- 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.4]) +AC_CONFIG_SUBDIRS([libUseful-2.6]) AC_PROG_CC AC_LANG_C diff --git a/containerfiles.c b/containerfiles.c old mode 100644 new mode 100755 diff --git a/containerfiles.h b/containerfiles.h old mode 100644 new mode 100755 diff --git a/display.c b/display.c old mode 100644 new mode 100755 index 5c017db..951e31d --- a/display.c +++ b/display.c @@ -13,7 +13,7 @@ void LaunchPlayer() char *Tempstr=NULL; Tempstr=MCopyStr(Tempstr,Player," ",OutputFilesGetFilePath(),NULL); -PlayerPid=Spawn(Tempstr,"","",""); +PlayerPid=Spawn(Tempstr,0,""); DestroyString(Tempstr); } diff --git a/display.h b/display.h old mode 100644 new mode 100755 diff --git a/download.c b/download.c old mode 100644 new mode 100755 diff --git a/download.h b/download.h old mode 100644 new mode 100755 diff --git a/ehow.c b/ehow.c old mode 100644 new mode 100755 diff --git a/ehow.h b/ehow.h old mode 100644 new mode 100755 diff --git a/extract_text.c b/extract_text.c old mode 100644 new mode 100755 index f4da147..fe70e72 --- a/extract_text.c +++ b/extract_text.c @@ -38,8 +38,8 @@ int GTF=0; 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 if (ExtractFlags & EXTRACT_DEHTMLQUOTE) Item=HtmlUnQuote(Item,Token); + else if (ExtractFlags & EXTRACT_DESLASHQUOTE) Item=UnQuoteStr(Item,Token); else Item=CopyStr(Item,Token); StripLeadingWhitespace(Item); StripTrailingWhitespace(Item); diff --git a/extract_text.h b/extract_text.h old mode 100644 new mode 100755 diff --git a/libUseful-2.4/SpawnPrograms.c b/libUseful-2.4/SpawnPrograms.c deleted file mode 100644 index 2538d0e..0000000 --- a/libUseful-2.4/SpawnPrograms.c +++ /dev/null @@ -1,404 +0,0 @@ -#include "SpawnPrograms.h" -#include "Log.h" -#include "pty.h" -#include "file.h" -#include "string.h" -#include - -char *MakeShellSafeString(char *RetStr, const char *String, int SafeLevel) -{ -char *Tempstr=NULL; -char *BadChars=";|&`"; - -if (SafeLevel==SHELLSAFE_BLANK) -{ - Tempstr=CopyStr(RetStr,String); - strmrep(Tempstr,BadChars,' '); -} -else Tempstr=QuoteCharsInStr(RetStr,String,BadChars); - -if (strcmp(Tempstr,String) !=0) -{ - //if (EventCallback) EventCallback(String); -} -return(Tempstr); -} - - -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) -{ -pid_t pid; - -LogFileFlushAll(TRUE); -pid=fork(); -if (pid==0) -{ - if (StrLen(Dir)) chdir(Dir); - if (StrLen(Group)) SwitchGroup(Group); - if (StrLen(User)) SwitchUser(User); -} -return(pid); -} - - -/* This function turns our process into a demon */ -int demonize() -{ -int result, i=0; - -LogFileFlushAll(TRUE); -//Don't fork with context here, as a demonize involves two forks, so -//it's wasted work here. -result=fork(); -if (result != 0) exit(0); - -/*we can only get to here if result= 0 i.e. we are the child process*/ -setsid(); - -result=ForkWithContext(NULL, NULL, NULL); -if (result !=0) exit(0); -umask(0); - -/* close stdin, stdout and std error, but only if they are a tty. In some */ -/* situations (like working out of cron) we may not have been given in/out/err */ -/* and thus the first files we open will be 0,1,2. If we close them, we will have */ -/* closed files that we need! Alternatively, the user may have used shell redirection */ -/* to send output for a file, and I'm sure they don't want us to close that file */ - -//for (i=0; i < 3; i++) -{ - if (isatty(i)) - { - close(i); - /* reopen to /dev/null so that any output gets thrown away */ - /* but the program still has somewhere to write to */ - open("/dev/null",O_RDWR); - } -} - - -return(1); -} - - - -int ForkWithIO(int StdIn, int StdOut, int StdErr) -{ -pid_t pid; -int fd; - -pid=ForkWithContext(NULL, NULL, NULL); -if (pid==0) -{ - if (StdIn > -1) - { - if (StdIn !=0) - { - close(0); - dup(StdIn); - } - } - else - { - fd=open("/dev/null",O_RDONLY); - dup(fd); - close(fd); - } - - if (StdOut > -1) - { - if (StdOut !=1) - { - close(1); - dup(StdOut); - } - } - else - { - fd=open("/dev/null",O_WRONLY); - dup(fd); - close(fd); - } - - if (StdErr > -1) - { - if (StdErr !=2) - { - close(2); - dup(StdErr); - } - } -} - - -/* WTF?! Why do this in the parent? -else -{ - fd=open("/dev/null",O_WRONLY); - dup(fd); - close(fd); -} -*/ - -return(pid); -} - - - -pid_t SpawnWithIO(const char *CommandLine, int StdIn, int StdOut, int StdErr) -{ -pid_t pid; - -pid=ForkWithIO(StdIn,StdOut,StdErr); -if (pid==0) -{ -SwitchProgram(CommandLine,NULL,NULL,NULL); -_exit(pid); -} - -return(pid); -} - - -int Spawn(const char *ProgName, const char *User, const char *Group, const char *Dir) -{ -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, const char *User, const char *Group) -{ -pid_t pid; -int channel1[2], channel2[2], channel3[2], DevNull=-1; - -if (infd) pipe(channel1); -if (outfd) pipe(channel2); -if (errfd) pipe(channel3); - -pid=ForkWithContext(NULL,NULL,NULL); -if (pid==0) -{ -/* we are the child */ -if (infd) close(channel1[1]); -else if (DevNull==-1) DevNull=open("/dev/null",O_RDWR); -if (outfd) close(channel2[0]); -else if (DevNull==-1) DevNull=open("/dev/null",O_RDWR); -if (errfd) close(channel3[0]); -else if (DevNull==-1) DevNull=open("/dev/null",O_RDWR); - -/*close stdin, stdout and stderr*/ -close(0); -close(1); -close(2); -/*channel 1 is going to be our stdin, so we close the writing side of it*/ -if (infd) dup(channel1[0]); -else dup(DevNull); -/* channel 2 is stdout */ -if (outfd) dup(channel2[1]); -else dup(DevNull); -/* channel 3 is stderr */ -if (errfd) -{ - //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); -} -else -{ -/* we close the appropriate halves of the link */ -if (infd) -{ - close(channel1[0]); - *infd=channel1[1]; -} -if (outfd) -{ - close(channel2[1]); - *outfd=channel2[0]; -} -if (errfd) -{ - 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]; -} - -} - -return(pid); -} - - -int BASIC_FUNC_EXEC_COMMAND(void *Command) -{ -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, const char *User, const char *Group) -{ -return(PipeSpawnFunction(infd,outfd,errfd, BASIC_FUNC_EXEC_COMMAND, (void *) Command, User, Group)); -} - - - - -pid_t PseudoTTYSpawnFunction(int *ret_pty, BASIC_FUNC Func, void *Data, const char *User, const char *Group, int TTYFlags) -{ -pid_t pid=-1; -int tty, pty, i; - -if (GrabPseudoTTY(&pty, &tty, TTYFlags)) -{ -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); - -///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); -} - -close(tty); -} - -*ret_pty=pty; -return(pid); -} - - -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, User, Group, TTYFlags)); -} - - -STREAM *STREAMSpawnCommand(const char *Command, const char *User, const char *Group, int Flags) -{ -int to_fd, from_fd; -pid_t pid; -STREAM *S=NULL; -char *Tempstr=NULL; - - -if (Flags & SPAWN_TRUST_COMMAND) Tempstr=CopyStr(Tempstr,Command); -else Tempstr=MakeShellSafeString(Tempstr, Command, 0); - -if (Flags & COMMS_BY_PTY) -{ - 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,User,Group); - } - 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,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); -} - -DestroyString(Tempstr); -return(S); -} diff --git a/libUseful-2.4/SpawnPrograms.h b/libUseful-2.4/SpawnPrograms.h deleted file mode 100644 index ce88cad..0000000 --- a/libUseful-2.4/SpawnPrograms.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef LIBUSEFUL_SPAWN_H -#define LIBUSEFUL_SPAWN_H - -#include "includes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define COMMS_BY_PIPE 0 -#define COMMS_BY_PTY 1 -#define SPAWN_TRUST_COMMAND 2 -#define COMMS_COMBINE_STDERR 4 - -//up to 128, beyond that is TTYFLAG_ - -#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(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, 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 -} -#endif - - -#endif diff --git a/libUseful-2.4/test.c b/libUseful-2.4/test.c deleted file mode 100644 index 2a7dde7..0000000 --- a/libUseful-2.4/test.c +++ /dev/null @@ -1,14 +0,0 @@ -#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 deleted file mode 100755 index c68e3dc..0000000 Binary files a/libUseful-2.4/test.exe and /dev/null differ diff --git a/libUseful-2.4/Compression.c b/libUseful-2.6/Compression.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Compression.c rename to libUseful-2.6/Compression.c diff --git a/libUseful-2.4/Compression.h b/libUseful-2.6/Compression.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Compression.h rename to libUseful-2.6/Compression.h diff --git a/libUseful-2.4/ConnectManager.c b/libUseful-2.6/ConnectManager.c old mode 100644 new mode 100755 similarity index 99% rename from libUseful-2.4/ConnectManager.c rename to libUseful-2.6/ConnectManager.c index fa167d4..af2974e --- a/libUseful-2.4/ConnectManager.c +++ b/libUseful-2.6/ConnectManager.c @@ -273,7 +273,7 @@ while (1) { if (STREAMIsConnected(S)) { - STREAMSetFlags(S, 0, STREAM_NONBLOCK); + STREAMSetFlags(S, 0, SF_NONBLOCK); if (Item->OnConnect) Item->OnConnect(Item); } diff --git a/libUseful-2.4/ConnectManager.h b/libUseful-2.6/ConnectManager.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/ConnectManager.h rename to libUseful-2.6/ConnectManager.h diff --git a/libUseful-2.4/ConnectionChain.c b/libUseful-2.6/ConnectionChain.c old mode 100644 new mode 100755 similarity index 97% rename from libUseful-2.4/ConnectionChain.c rename to libUseful-2.6/ConnectionChain.c index 8537b41..65f15b9 --- a/libUseful-2.4/ConnectionChain.c +++ b/libUseful-2.6/ConnectionChain.c @@ -85,7 +85,9 @@ Tempstr[0]=5; //Number of Auth Methods (just 1, username/password) Tempstr[1]=1; //Auth method 2, username/password -Tempstr[2]=2; +if (StrLen(User)) Tempstr[2]=2; +else Tempstr[2]=0; + STREAMWriteBytes(S,Tempstr,3); STREAMFlush(S); @@ -294,7 +296,7 @@ STREAM *LocalFile; Tempstr=FormatStr(Tempstr,"rm -f %s ; touch %s; chmod 0600 %s\n",KeyFile,KeyFile,KeyFile); STREAMWriteLine(Tempstr,S); -LocalFile=STREAMOpenFile(LocalPath,STREAM_RDONLY); +LocalFile=STREAMOpenFile(LocalPath,SF_RDONLY); if (LocalFile) { Line=STREAMReadLine(Line,LocalFile); @@ -351,13 +353,13 @@ if (strncmp(Pass,"keyfile:",8)==0) if (Type==CONNECT_HOP_SSHTUNNEL) { Tempstr=CatStr(Tempstr, " 2> /dev/null"); - AuthS=STREAMSpawnCommand(Tempstr,"", "", COMMS_BY_PTY); + 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); + PseudoTTYSpawn(&S->in_fd,Tempstr,0,""); S->out_fd=S->in_fd; if (S->in_fd > -1) { @@ -454,7 +456,7 @@ switch (val) if (S->in_fd==-1) { - PseudoTTYSpawn(& S->in_fd,Tempstr,"","",0); + PseudoTTYSpawn(& S->in_fd,Tempstr,0,""); S->out_fd=S->in_fd; if (S->in_fd > -1) { diff --git a/libUseful-2.4/ConnectionChain.h b/libUseful-2.6/ConnectionChain.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/ConnectionChain.h rename to libUseful-2.6/ConnectionChain.h diff --git a/libUseful-2.4/DataProcessing.c b/libUseful-2.6/DataProcessing.c old mode 100644 new mode 100755 similarity index 99% rename from libUseful-2.4/DataProcessing.c rename to libUseful-2.6/DataProcessing.c index b40fad1..0ad205a --- a/libUseful-2.4/DataProcessing.c +++ b/libUseful-2.6/DataProcessing.c @@ -127,7 +127,7 @@ if (! StrLen(Value) ) } -S=STREAMSpawnCommand(Value, "", "", COMMS_BY_PIPE); +S=STREAMSpawnCommand(Value, COMMS_BY_PIPE, ""); ProcMod->Data=(void *) S; result=TRUE; diff --git a/libUseful-2.4/DataProcessing.h b/libUseful-2.6/DataProcessing.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/DataProcessing.h rename to libUseful-2.6/DataProcessing.h diff --git a/libUseful-2.4/Docs/ConnectManager.txt b/libUseful-2.6/Docs/ConnectManager.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/ConnectManager.txt rename to libUseful-2.6/Docs/ConnectManager.txt diff --git a/libUseful-2.4/Docs/DataProcessing.txt b/libUseful-2.6/Docs/DataProcessing.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/DataProcessing.txt rename to libUseful-2.6/Docs/DataProcessing.txt diff --git a/libUseful-2.4/Docs/EncryptedFiles.txt b/libUseful-2.6/Docs/EncryptedFiles.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/EncryptedFiles.txt rename to libUseful-2.6/Docs/EncryptedFiles.txt diff --git a/libUseful-2.4/Docs/GeneralFunctions.txt b/libUseful-2.6/Docs/GeneralFunctions.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/GeneralFunctions.txt rename to libUseful-2.6/Docs/GeneralFunctions.txt diff --git a/libUseful-2.4/Docs/Hash.txt b/libUseful-2.6/Docs/Hash.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/Hash.txt rename to libUseful-2.6/Docs/Hash.txt diff --git a/libUseful-2.4/Docs/Log.txt b/libUseful-2.6/Docs/Log.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/Log.txt rename to libUseful-2.6/Docs/Log.txt diff --git a/libUseful-2.4/Docs/directory b/libUseful-2.6/Docs/directory old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/directory rename to libUseful-2.6/Docs/directory diff --git a/libUseful-2.4/Docs/expect.txt b/libUseful-2.6/Docs/expect.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/expect.txt rename to libUseful-2.6/Docs/expect.txt diff --git a/libUseful-2.4/Docs/file.txt b/libUseful-2.6/Docs/file.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/file.txt rename to libUseful-2.6/Docs/file.txt diff --git a/libUseful-2.4/Docs/http.txt b/libUseful-2.6/Docs/http.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/http.txt rename to libUseful-2.6/Docs/http.txt diff --git a/libUseful-2.4/Docs/includes.txt b/libUseful-2.6/Docs/includes.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/includes.txt rename to libUseful-2.6/Docs/includes.txt diff --git a/libUseful-2.4/Docs/inet.txt b/libUseful-2.6/Docs/inet.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/inet.txt rename to libUseful-2.6/Docs/inet.txt diff --git a/libUseful-2.4/Docs/list.txt b/libUseful-2.6/Docs/list.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/list.txt rename to libUseful-2.6/Docs/list.txt diff --git a/libUseful-2.4/Docs/pty.txt b/libUseful-2.6/Docs/pty.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/pty.txt rename to libUseful-2.6/Docs/pty.txt diff --git a/libUseful-2.4/Docs/socket.txt b/libUseful-2.6/Docs/socket.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/socket.txt rename to libUseful-2.6/Docs/socket.txt diff --git a/libUseful-2.4/Docs/sound.txt b/libUseful-2.6/Docs/sound.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/sound.txt rename to libUseful-2.6/Docs/sound.txt diff --git a/libUseful-2.4/Docs/string.txt b/libUseful-2.6/Docs/string.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/string.txt rename to libUseful-2.6/Docs/string.txt diff --git a/libUseful-2.4/Docs/unix_socket.txt b/libUseful-2.6/Docs/unix_socket.txt old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Docs/unix_socket.txt rename to libUseful-2.6/Docs/unix_socket.txt diff --git a/libUseful-2.4/EncryptedFiles.c b/libUseful-2.6/EncryptedFiles.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/EncryptedFiles.c rename to libUseful-2.6/EncryptedFiles.c diff --git a/libUseful-2.4/EncryptedFiles.h b/libUseful-2.6/EncryptedFiles.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/EncryptedFiles.h rename to libUseful-2.6/EncryptedFiles.h diff --git a/libUseful-2.4/FileSystem.c b/libUseful-2.6/FileSystem.c old mode 100644 new mode 100755 similarity index 98% rename from libUseful-2.4/FileSystem.c rename to libUseful-2.6/FileSystem.c index 9809d49..34e2704 --- a/libUseful-2.4/FileSystem.c +++ b/libUseful-2.6/FileSystem.c @@ -1,9 +1,9 @@ #include "FileSystem.h" #include -char *GetBasename(char *Path) +const char *GetBasename(const char *Path) { -char *ptr; +const char *ptr; int len; len=StrLen(Path); diff --git a/libUseful-2.4/FileSystem.h b/libUseful-2.6/FileSystem.h old mode 100644 new mode 100755 similarity index 94% rename from libUseful-2.4/FileSystem.h rename to libUseful-2.6/FileSystem.h index 291a960..80a06f9 --- a/libUseful-2.4/FileSystem.h +++ b/libUseful-2.6/FileSystem.h @@ -7,7 +7,7 @@ extern "C" { #endif -char *GetBasename(char *Path); +const char *GetBasename(const char *Path); char *SlashTerminateDirectoryPath(char *DirPath); char *StripDirectorySlash(char *DirPath); int FileExists(const char *); diff --git a/libUseful-2.4/GeneralFunctions.c b/libUseful-2.6/GeneralFunctions.c old mode 100644 new mode 100755 similarity index 99% rename from libUseful-2.4/GeneralFunctions.c rename to libUseful-2.6/GeneralFunctions.c index 2680c77..dddb66c --- a/libUseful-2.4/GeneralFunctions.c +++ b/libUseful-2.6/GeneralFunctions.c @@ -131,7 +131,6 @@ for (ptr=Bytes; ptr < end; ) //so for the last chracter RetStr=CatStrLen(RetStr,Buff,ptr-block); } -printf("\n"); return(RetStr); } diff --git a/libUseful-2.4/GeneralFunctions.h b/libUseful-2.6/GeneralFunctions.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/GeneralFunctions.h rename to libUseful-2.6/GeneralFunctions.h diff --git a/libUseful-2.4/Hash.c b/libUseful-2.6/Hash.c old mode 100644 new mode 100755 similarity index 72% rename from libUseful-2.4/Hash.c rename to libUseful-2.6/Hash.c index ae9234b..1f5f0ca --- a/libUseful-2.4/Hash.c +++ b/libUseful-2.6/Hash.c @@ -30,7 +30,7 @@ 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); +len=Hash->Finish(Hash,&HMAC->Key1); HMAC->Key2=SetStrLen(HMAC->Key2,HMAC_BLOCKSIZE+len); memcpy(HMAC->Key2+HMAC_BLOCKSIZE,HMAC->Key1,len); @@ -105,8 +105,6 @@ HMAC->Key1Len=Len; - - #include "crc32.h" void HashUpdateCRC(THash *Hash, char *Data, int Len) @@ -128,7 +126,7 @@ return(NewHash); } -int HashFinishCRC(THash *Hash, int Encoding, char **HashStr) +int HashFinishCRC(THash *Hash, char **HashStr) { unsigned long crc; int len; @@ -137,17 +135,9 @@ 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); -} +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,&crc,len); +return(len); } @@ -186,28 +176,19 @@ return(NewHash); } -int HashFinishMD5(THash *Hash, int Encoding, char **HashStr) +int HashFinishMD5(THash *Hash, char **HashStr) { int len; -char *Tempstr=NULL, *DigestBuff=NULL; +char *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); -} +len=MD5LEN; +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,DigestBuff,len); DestroyString(DigestBuff); -DestroyString(Tempstr); return(len); } @@ -244,28 +225,19 @@ return(NewHash); } -int HashFinishSHA1(THash *Hash, int Encoding, char **HashStr) +int HashFinishSHA1(THash *Hash, char **HashStr) { int len; -char *Tempstr=NULL, *DigestBuff=NULL; +char *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); } @@ -274,29 +246,19 @@ return(len); #include "sha2.h" -int HashFinishSHA256(THash *Hash, int Encoding, char **HashStr) +int HashFinishSHA256(THash *Hash, 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); -} +len=SHA2_SHA256_DIGEST_LENGTH; +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,DigestBuff,len); DestroyString(DigestBuff); -DestroyString(Tempstr); return(len); } @@ -321,28 +283,19 @@ SHA2_SHA256_Update((SHA2_SHA256_CTX *) Hash->Ctx, (unsigned char *) Data, Len); } -int HashFinishSHA512(THash *Hash, int Encoding, char **HashStr) +int HashFinishSHA512(THash *Hash, char **HashStr) { int len; -char *Tempstr=NULL, *DigestBuff=NULL; +char *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); } @@ -405,28 +358,19 @@ break; #include "whirlpool.h" -int HashFinishWhirlpool(THash *Hash, int Encoding, char **HashStr) +int HashFinishWhirlpool(THash *Hash, char **HashStr) { int len; -char *Tempstr=NULL, *DigestBuff=NULL; +char *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); } @@ -464,28 +408,18 @@ Hash->Clone=HashCloneWhirlpool; #include "jh_ref.h" -int HashFinishJH(THash *Hash, int Encoding, char **HashStr) +int HashFinishJH(THash *Hash, char **HashStr) { int len; -char *Tempstr=NULL, *DigestBuff=NULL; +char *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); -} +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,DigestBuff,len); DestroyString(DigestBuff); -DestroyString(Tempstr); return(len); } @@ -562,35 +496,80 @@ for (i=0; HashTypes[i] !=NULL; i++) SetVar(Vars,HashTypes[i], HashTypes[i]); } -THash *HashInit(char *Type) +THash *HashInit(const char *Type) { THash *Hash=NULL; +char *InitialType=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); +strrep(Hash->Type,',',' '); + +GetToken(Hash->Type,"\\S",&InitialType,0); +if (strcasecmp(InitialType,"md5")==0) HashInitMD5(Hash, 0); +else if (strcasecmp(InitialType,"sha")==0) HashInitSHA(Hash, 0); +else if (strcasecmp(InitialType,"sha1")==0) HashInitSHA(Hash, 0); +else if (strcasecmp(InitialType,"sha256")==0) HashInitSHA(Hash, 256); +else if (strcasecmp(InitialType,"sha512")==0) HashInitSHA(Hash, 512); +else if (strcasecmp(InitialType,"sha-256")==0) HashInitSHA(Hash, 256); +else if (strcasecmp(InitialType,"sha-512")==0) HashInitSHA(Hash, 512); +else if (strcasecmp(InitialType,"whirl")==0) HashInitWhirlpool(Hash, 0); +else if (strcasecmp(InitialType,"whirlpool")==0) HashInitWhirlpool(Hash, 0); +else if (strcasecmp(InitialType,"jh224")==0) HashInitJH(Hash,224); +else if (strcasecmp(InitialType,"jh256")==0) HashInitJH(Hash,256); +else if (strcasecmp(InitialType,"jh384")==0) HashInitJH(Hash,384); +else if (strcasecmp(InitialType,"jh512")==0) HashInitJH(Hash,512); +else if (strcasecmp(InitialType,"jh-224")==0) HashInitJH(Hash,224); +else if (strcasecmp(InitialType,"jh-256")==0) HashInitJH(Hash,256); +else if (strcasecmp(InitialType,"jh-384")==0) HashInitJH(Hash,384); +else if (strcasecmp(InitialType,"jh-512")==0) HashInitJH(Hash,512); +//else if (strcasecmp(InitialType,"crc32")==0) HashInitCRC(Hash, 0); +else if (strncasecmp(InitialType,"hmac-",5)==0) HMACInit(Hash); else { HashDestroy(Hash); Hash=NULL; } +DestroyString(InitialType); return(Hash); } +int HashFinish(THash *Hash, int Encoding, char **Return) +{ +char *Token=NULL, *Bytes=NULL, *Hashed=NULL, *ptr; +int len; + +ptr=GetToken(Hash->Type, "\\S", &Token, 0); +len=Hash->Finish(Hash, &Bytes); + +while (StrValid(ptr)) +{ + ptr=GetToken(ptr, "\\S", &Token, 0); + len=HashBytes(&Hashed, Token, Bytes, len, 0); + Bytes=SetStrLen(Bytes, len); + memcpy(Bytes,Hashed,len); +} + +if (Encoding > 0) +{ +*Return=EncodeBytes(*Return, Bytes, len, Encoding); +len=StrLen(*Return); +} +else +{ + *Return=SetStrLen(*Return, len); + memcpy(*Return, Bytes, len); +} + +HashDestroy(Hash); +DestroyString(Hashed); +DestroyString(Token); +DestroyString(Bytes); + +return(len); +} int HashBytes(char **Return, char *Type, char *text, int len, int Encoding) @@ -601,12 +580,43 @@ int result; Hash=HashInit(Type); if (! Hash) return(0); Hash->Update(Hash, text, len); -result=Hash->Finish(Hash, Encoding, Return); -HashDestroy(Hash); +result=HashFinish(Hash, Encoding, Return); return(result); } +int PBK2DF2(char **Return, char *Type, char *Bytes, int Len, char *Salt, int SaltLen, uint32_t Rounds, int Encoding) +{ +char *Tempstr=NULL, *Hash=NULL; +uint32_t RoundsBE; +int i, len, hlen; + +//Network byte order is big endian +RoundsBE=htonl(Rounds); + +Tempstr=SetStrLen(Tempstr, Len + SaltLen + 20); +memcpy(Tempstr, Bytes, Len); +memcpy(Tempstr+Len, Salt, SaltLen); +memcpy(Tempstr+Len+SaltLen, &RoundsBE, sizeof(uint32_t)); +len=Len+SaltLen+sizeof(uint32_t); + +for (i=0; i Finish(Hash, Encoding, Return); -HashDestroy(Hash); +result=HashFinish(Hash, Encoding, Return); return(result); } diff --git a/libUseful-2.4/Hash.h b/libUseful-2.6/Hash.h old mode 100644 new mode 100755 similarity index 73% rename from libUseful-2.4/Hash.h rename to libUseful-2.6/Hash.h index 5039951..1f0b79a --- a/libUseful-2.4/Hash.h +++ b/libUseful-2.6/Hash.h @@ -13,7 +13,7 @@ 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); +typedef int (*HASH_FINISH)(THash *Hash, char **RetStr); struct t_hash { @@ -29,11 +29,13 @@ HASH_CLONE Clone; }; void HashAvailableTypes(ListNode *Vars); -THash *HashInit(char *Type); +THash *HashInit(const char *Type); +int HashFinish(THash *Hash, int Encoding, char **Return); void HMACSetKey(THash *HMAC, char *Key, int Len); void HashDestroy(THash *Hash); int HashBytes(char **Return, char *Type, char *text, int len, int Encoding); int HashFile(char **Return, char *Type, char *Path, int Encoding); +int PBK2DF2(char **Return, char *Type, char *Bytes, int Len, char *Salt, int SaltLen, uint32_t Rounds, int Encoding); #ifdef __cplusplus } diff --git a/libUseful-2.4/LICENCE b/libUseful-2.6/LICENCE old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/LICENCE rename to libUseful-2.6/LICENCE diff --git a/libUseful-2.4/Log.c b/libUseful-2.6/Log.c old mode 100644 new mode 100755 similarity index 96% rename from libUseful-2.4/Log.c rename to libUseful-2.6/Log.c index 92b65a8..62bd83e --- a/libUseful-2.4/Log.c +++ b/libUseful-2.6/Log.c @@ -48,7 +48,7 @@ TLogFile *LogFileGetEntry(const char *FileName) else if (strcmp(FileName,"SYSLOG")==0) S=STREAMCreate(); else { - S=STREAMOpenFile(FileName,STREAM_CREAT | STREAM_APPEND | STREAM_WRONLY | STREAM_NOCACHE); + S=STREAMOpenFile(FileName,SF_CREAT | SF_APPEND | SF_WRONLY | SF_NOCACHE); } if (S) @@ -143,7 +143,7 @@ STREAM *LogFileInternalDoRotate(TLogFile *LogFile) if (LogFile->S) STREAMClose(LogFile->S); if (PrevPath) rename(LogFile->Path,PrevPath); - LogFile->S=STREAMOpenFile(LogFile->Path,STREAM_CREAT | STREAM_APPEND | STREAM_WRONLY | STREAM_NOCACHE); + LogFile->S=STREAMOpenFile(LogFile->Path,SF_CREAT | SF_APPEND | SF_WRONLY | SF_NOCACHE); if (LogFile->S) STREAMSetFlushType(LogFile->S, FLUSH_FULL, 0, 0); } } @@ -231,8 +231,8 @@ int LogFileInternalWrite(TLogFile *LF, STREAM *S, int Flags, const char *Str) if (S) { - if (Flags & LOGFILE_LOCK) S->Flags |= STREAM_WRLOCK; - else S->Flags &= ~STREAM_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); @@ -337,7 +337,7 @@ int result=FALSE; LogFile=LogFileGetEntry(LogPath); LogFileClose(TmpLogPath); - S=STREAMOpenFile(TmpLogPath,STREAM_RDONLY); + S=STREAMOpenFile(TmpLogPath,SF_RDONLY); if (LogFile && S) { diff --git a/libUseful-2.4/Log.h b/libUseful-2.6/Log.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Log.h rename to libUseful-2.6/Log.h diff --git a/libUseful-2.4/Makefile b/libUseful-2.6/Makefile old mode 100644 new mode 100755 similarity index 76% rename from libUseful-2.4/Makefile rename to libUseful-2.6/Makefile index f1da531..0854d6c --- a/libUseful-2.4/Makefile +++ b/libUseful-2.6/Makefile @@ -1,16 +1,16 @@ CC = gcc VERSION = 0.0.1 CFLAGS = -g -O2 -LIBS = -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_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_OSS=1 -DHAVE_MADVISE -DHAVE_MADVISE_NOFORK -DHAVE_MADVISE_DONTDUMP -DHAVE_MLOCK +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 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 +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 ssh.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) -shared -o libUseful-2.4.so $(OBJ) $(LIBS) - #ld -i -o libUseful-2.4.a $(OBJ) - ar rcs libUseful-2.4.a $(OBJ) + $(CC) $(FLAGS) -shared -o libUseful-2.6.so $(OBJ) $(LIBS) + #ld -i -o libUseful-2.6.a $(OBJ) + ar rcs libUseful-2.6.a $(OBJ) string.o: string.h string.c @@ -88,6 +88,9 @@ EncryptedFiles.o: EncryptedFiles.h EncryptedFiles.c Hash.o: Hash.h Hash.c $(CC) $(FLAGS) -c Hash.c +ssh.o: ssh.h ssh.c + $(CC) $(FLAGS) -c ssh.c + Compression.o: Compression.h Compression.c $(CC) $(FLAGS) -c Compression.c @@ -143,6 +146,6 @@ clean: -rm -r autom4te.cache config.cache install: - @ln -s libUseful-2.4.so libUseful.so - @ln -s libUseful-2.4.a libUseful.a + @ln -s libUseful-2.6.so libUseful.so + @ln -s libUseful-2.6.a libUseful.a @cp *.so *.a $(prefix)/lib ; mkdir $(prefix)/include/libUseful-$(VERSION) ; cp *.h $(prefix)/include/libUseful-$(VERSION) diff --git a/libUseful-2.4/Makefile.in b/libUseful-2.6/Makefile.in old mode 100644 new mode 100755 similarity index 88% rename from libUseful-2.4/Makefile.in rename to libUseful-2.6/Makefile.in index 950db41..f3b2ffa --- a/libUseful-2.4/Makefile.in +++ b/libUseful-2.6/Makefile.in @@ -4,13 +4,13 @@ CFLAGS = @CFLAGS@ LIBS = @LIBS@ 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 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 +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 ssh.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) -shared -o libUseful-2.4.so $(OBJ) $(LIBS) - #ld -i -o libUseful-2.4.a $(OBJ) - ar rcs libUseful-2.4.a $(OBJ) + $(CC) $(FLAGS) -shared -o libUseful-2.6.so $(OBJ) $(LIBS) + #ld -i -o libUseful-2.6.a $(OBJ) + ar rcs libUseful-2.6.a $(OBJ) string.o: string.h string.c @@ -88,6 +88,9 @@ EncryptedFiles.o: EncryptedFiles.h EncryptedFiles.c Hash.o: Hash.h Hash.c $(CC) $(FLAGS) -c Hash.c +ssh.o: ssh.h ssh.c + $(CC) $(FLAGS) -c ssh.c + Compression.o: Compression.h Compression.c $(CC) $(FLAGS) -c Compression.c @@ -143,6 +146,6 @@ clean: -rm -r autom4te.cache config.cache install: - @ln -s libUseful-2.4.so libUseful.so - @ln -s libUseful-2.4.a libUseful.a + @ln -s libUseful-2.6.so libUseful.so + @ln -s libUseful-2.6.a libUseful.a @cp *.so *.a $(prefix)/lib ; mkdir $(prefix)/include/libUseful-$(VERSION) ; cp *.h $(prefix)/include/libUseful-$(VERSION) diff --git a/libUseful-2.4/Markup.c b/libUseful-2.6/Markup.c old mode 100644 new mode 100755 similarity index 98% rename from libUseful-2.4/Markup.c rename to libUseful-2.6/Markup.c index 9825347..b02d112 --- a/libUseful-2.4/Markup.c +++ b/libUseful-2.6/Markup.c @@ -194,7 +194,7 @@ return(RetStr); -char *HtmlDeQuote(char *RetStr, char *Data) +char *HtmlUnQuote(char *RetStr, char *Data) { char *Output=NULL, *Token=NULL, *ptr; int len=0; diff --git a/libUseful-2.4/Markup.h b/libUseful-2.6/Markup.h old mode 100644 new mode 100755 similarity index 88% rename from libUseful-2.4/Markup.h rename to libUseful-2.6/Markup.h index 79487b5..33c502b --- a/libUseful-2.4/Markup.h +++ b/libUseful-2.6/Markup.h @@ -11,7 +11,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); +char *HtmlUnQuote(char *RetStr, char *Data); diff --git a/libUseful-2.4/MathExpr.c b/libUseful-2.6/MathExpr.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/MathExpr.c rename to libUseful-2.6/MathExpr.c diff --git a/libUseful-2.4/MathExpr.h b/libUseful-2.6/MathExpr.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/MathExpr.h rename to libUseful-2.6/MathExpr.h diff --git a/libUseful-2.6/MessageBus.c b/libUseful-2.6/MessageBus.c new file mode 100755 index 0000000..1f8640e --- /dev/null +++ b/libUseful-2.6/MessageBus.c @@ -0,0 +1,364 @@ +#include "MessageBus.h" +#include "defines.h" +#include "SpawnPrograms.h" +#include "http.h" + +#define MESSAGEAGENT_BUSY 1 + +typedef struct +{ +char *URL; +int MaxConnections; +int Timeout; +ListNode *Connections; +MSG_FUNC AgentFunction; +} TMessageBus; + +ListNode *MessageBusConnections=NULL; +STREAM *MessageS=NULL; + +// typedef void (*MSG_FUNC)(const char *PeerName, ListNode *Variables); + +void MessageBusRegister(const char *URL, int MaxConnections, int Timeout, MSG_FUNC AgentFunction) +{ +TMessageBus *MA; + +if (! MessageBusConnections) MessageBusConnections=ListCreate(); + +MA=(TMessageBus *) calloc(1,sizeof(TMessageBus)); +MA->URL=CopyStr(MA->URL, URL); +MA->Connections=ListCreate(); +MA->AgentFunction=AgentFunction; +ListAddItem(MessageBusConnections, MA); +} + + + +int MessageBusNativeRecv(STREAM *S, char **Source, ListNode *Vars) +{ +char *Tempstr=NULL, *EncName=NULL, *EncValue=NULL; +const char *ptr; +ListNode *Node; + +Tempstr=STREAMReadLine(Tempstr, S); +if (StrEnd(Tempstr)) +{ + //could be blank (timeout) or null. DestroyString will figure it out + DestroyString(Tempstr); + return(FALSE); +} + +StripTrailingWhitespace(Tempstr); +ptr=GetToken(Tempstr, "?", Source, 0); +while (ptr) +{ + ptr=GetNameValuePair(ptr, "&","=", &EncName, &EncValue); + Node=ListAddItem(Vars, NULL); + Node->Tag=HTTPUnQuote(Node->Tag, EncName); + Node->Item=HTTPUnQuote(Node->Item, EncValue); +} + +DestroyString(Tempstr); +DestroyString(EncValue); +DestroyString(EncName); + +return(TRUE); +} + + +void JSONParse(const char *Doc, ListNode *Vars) +{ +char *Prefix=NULL, *Name=NULL, *Value=NULL, *Tempstr=NULL, *tptr; +const char *ptr; + +ptr=Doc; +while (isspace(*ptr) || (*ptr=='{')) ptr++; +while (ptr) +{ + ptr=GetToken(ptr,",|:", &Name, GETTOKEN_MULTI_SEPARATORS); + if (strcmp(Name,"}")==0) + { + //we've come out of one level of nesting. remove last item from prefix + if (StrValid(Prefix)) + { + tptr=strrchr(Prefix, ':'); + if (tptr) + { + *tptr='\0'; + tptr=strrchr(tptr, ':'); + if (tptr) *tptr='\0'; + } + } + } + else + { + ptr=GetToken(ptr,",|:",&Value, GETTOKEN_MULTI_SEPARATORS); + if (strcmp(Value,"{")==0) Prefix=MCatStr(Prefix,Name,":",NULL); + else + { + Tempstr=MCopyStr(Tempstr, Prefix, Name, NULL); + SetVar(Vars, Tempstr, Value); + } + } +} + +DestroyString(Tempstr); +DestroyString(Prefix); +DestroyString(Name); +DestroyString(Value); +} + + +void XMLParse(const char *Doc, ListNode *Vars) +{ +char *Name=NULL, *Value=NULL, *Data=NULL, *Extra=NULL; +const char *ptr; + +ptr=XMLGetTag(Doc, NULL, &Name, &Data); +while (ptr) +{ + if (StrValid(Name)) + { + ptr=XMLGetTag(ptr, NULL, &Extra, &Value); + if (StrValid(Extra)) + { + if (*Name != '/') SetVar(Vars, Name, ""); + Name=CopyStr(Name, Extra); + } + else + { + if (*Name != '/')SetVar(Vars, Name, Value); + ptr=XMLGetTag(ptr, NULL, &Name, &Data); + } + } + else ptr=XMLGetTag(ptr, NULL, &Name, &Data); +} + +DestroyString(Name); +DestroyString(Data); +DestroyString(Value); +DestroyString(Extra); +} + + + +int MessageBusRecv(STREAM *S, char **Source, ListNode *Vars) +{ +char *Doc=NULL, *ptr; +HTTPInfoStruct *Info; +ListNode *Curr; +TMessageBus *MA; +int result=FALSE; + +if (! Vars) return(FALSE); +if (! S) return(FALSE); +ListClear(Vars, DestroyString); + +if (S->Type==STREAM_TYPE_HTTP) +{ + Info=(HTTPInfoStruct *) STREAMGetItem(S, "HTTPInfo"); + if (Info) + { + HTTPTransact(Info); + Doc=HTTPReadDocument(Doc, S); + ptr=STREAMGetValue(S, "HTTP:Content-Type"); + if (strcmp(ptr, "application/json")==0) JSONParse(Doc, Vars); + if (strcmp(ptr, "application/xml")==0) XMLParse(Doc, Vars); + + HTTPInfoDestroy(Info); + DestroyString(Doc); + result=TRUE; + } +} +else result=MessageBusNativeRecv(S, Source, Vars); + +MA=(TMessageBus *) STREAMGetItem(S, "MessageBus:Agent"); +Curr=ListFindItem(MA->Connections, S); +if (Curr) Curr->ItemType=0; +if (! result) +{ + if (Curr) ListDeleteNode(Curr); + STREAMClose(S); +} + +return(result); +} + + +int MessageBusHandler(void *p_MA) +{ +char *URL=NULL; +ListNode *Vars; +TMessageBus *MA; + +MA=(TMessageBus *) p_MA; +Vars=ListCreate(); +MessageS=STREAMFromDualFD(0,1); +MessageS->Type=STREAM_TYPE_MESSAGEBUS; +STREAMSetTimeout(MessageS, MA->Timeout * 100); +STREAMSetItem(MessageS, "MessageBus:Agent", MA); +while (MessageBusRecv(MessageS, &URL, Vars)) +{ + if (MA->AgentFunction) MA->AgentFunction(URL, Vars); +} + +ListDestroy(Vars,DestroyString); +DestroyString(URL); +} + + + +STREAM *MessageBusConnect(TMessageBus *MA, const char *Args) +{ +STREAM *S; +char *Tempstr=NULL; +HTTPInfoStruct *HTTPInfo; + +Tempstr=MCopyStr(Tempstr, MA->URL, Args, NULL); +if (strncmp(MA->URL,"http:",5)==0) +{ + HTTPInfo=HTTPInfoFromURL("GET", MA->URL); + S=HTTPConnect(HTTPInfo); + STREAMSetItem(S, "HTTPInfo", HTTPInfo); +} +else +{ + S=STREAMSpawnFunction(MessageBusHandler, MA); + S->Type=STREAM_TYPE_MESSAGEBUS; +} + +if (S) STREAMSetItem(S, "MessageBus:Agent", MA); +DestroyString(Tempstr); +return(S); +} + + + +STREAM *MessageBusAgentFindConnect(TMessageBus *MA, const char *Args) +{ +STREAM *S=NULL; +ListNode *Curr; + + Curr=ListGetNext(MA->Connections); + while (Curr) + { + if (! Curr->ItemType) S=(STREAM *) Curr->Item; + Curr=ListGetNext(Curr); + } + + if (! S) + { + S=MessageBusConnect(MA, Args); + Curr=ListAddItem(MA->Connections, S); + Curr->ItemType=MESSAGEAGENT_BUSY; + } + +return(S); +} + + + + +STREAM *MessageBusFindConnect(const char *URL, const char *Args) +{ +ListNode *Curr; +TMessageBus *MA, *Found=NULL; +STREAM *S=NULL; + +Curr=ListGetNext(MessageBusConnections); +while (Curr) +{ + MA=(TMessageBus *) Curr->Item; + if (strcmp(MA->URL, URL)==0) + { + Found=MA; + break; + } + Curr=ListGetNext(Curr); +} + +if (Found) +{ + S=MessageBusAgentFindConnect(MA, Args); +} + +return(S); +} + + +STREAM *MessageBusWrite(const char *URL, const char *Args) +{ +char *Message=NULL; +STREAM *S=NULL; + +//we are a messagebus 'client' with a connection to a parent process +//so just write out of that +if (MessageS) S=MessageS; +else +{ + //we are a messagebus 'server' in the parent process, and must find the + //right connection to write to + S=MessageBusFindConnect(URL, Args); + if (! S) return(NULL); +} + + +if (S->Type == STREAM_TYPE_MESSAGEBUS) +{ + Message=MCopyStr(Message, URL, "?", Args, "\r\n", NULL); + STREAMWriteLine(Message, S); + STREAMFlush(S); +} + + +DestroyString(Message); +return(S); +} + + +STREAM *MessageBusSend(const char *URL, ListNode *Args) +{ +char *Tempstr=NULL, *EncodedName=NULL, *EncodedValue=NULL; +ListNode *Curr; +STREAM *S; +int result; + +Tempstr=MCopyStr(Tempstr, URL, "?", NULL); +Curr=ListGetNext(Args); +while (Curr) +{ + EncodedName=HTTPQuote(EncodedName, Curr->Tag); + EncodedValue=HTTPQuote(EncodedValue, (char *) Curr->Item); + Tempstr=MCatStr(Tempstr, EncodedName, "=", EncodedValue, "&", NULL); + Curr=ListGetNext(Curr); +} + +S=MessageBusWrite(URL, Tempstr); + +DestroyString(Tempstr); +DestroyString(EncodedName); +DestroyString(EncodedValue); + +return(S); +} + + + + +int MessageQueueAddToSelect(ListNode *SelectList) +{ +ListNode *Curr; +TMessageBus *MA; + +Curr=ListGetNext(MessageBusConnections); +while (Curr) +{ + MA=(TMessageBus *) Curr->Item; + ListAppendItems(SelectList, MA->Connections, NULL); + Curr=ListGetNext(Curr); +} + +return(TRUE); +} + + diff --git a/libUseful-2.6/MessageBus.h b/libUseful-2.6/MessageBus.h new file mode 100755 index 0000000..ade5def --- /dev/null +++ b/libUseful-2.6/MessageBus.h @@ -0,0 +1,26 @@ +#ifndef LIBUSEFUL_MESSAGE_BUS_H +#define LIBUSEFUL_MESSAGE_BUS_H + +//Vars gives us list node, and also 'GetVar' which is used in the +//.c module of this .h +#include "Vars.h" +#include "file.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*MSG_FUNC)(const char *PeerName, ListNode *Variables); + +void MessageBusRegister(const char *URL, int MaxConnections, int Timeout, MSG_FUNC); +STREAM *MessageBusWrite(const char *URL, const char *Args); +STREAM *MessageBusSend(const char *URL, ListNode *Args); +int MessageBusRecv(STREAM *S, char **Source, ListNode *Vars); +int MessageQueueAddToSelect(ListNode *SelectList); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libUseful-2.4/ParseURL.c b/libUseful-2.6/ParseURL.c old mode 100644 new mode 100755 similarity index 79% rename from libUseful-2.4/ParseURL.c rename to libUseful-2.6/ParseURL.c index 5216583..e45b0e8 --- a/libUseful-2.4/ParseURL.c +++ b/libUseful-2.6/ParseURL.c @@ -1,10 +1,9 @@ #include "ParseURL.h" - -void ParseHostDetails(const char *Data,char **Host,char **Port,char **User, char **Password) +const char *ParseHostDetails(const char *Data,char **Host,char **Port,char **User, char **Password) { -char *Token=NULL; -const char *ptr, *tptr; +char *Token=NULL, *tptr; +const char *ptr; if (Port) *Port=CopyStr(*Port,""); if (Host) *Host=CopyStr(*Host,""); @@ -14,25 +13,30 @@ if (Password) *Password=CopyStr(*Password,""); ptr=strrchr(Data,'@'); if (ptr) { - Token=CopyStrLen(Token,Data,ptr-Data); - if (User) - { - tptr=GetToken(Token,":",User,0); - if (StrLen(tptr)) *Password=CopyStr(*Password,tptr); - } - ptr++; + //in some cases there will be an '@' in the username, so GETTOKEN_QUOTES + //should handle any @ which is prefixed with a \ to quote it out + ptr=GetToken(Data,"@",&Token, GETTOKEN_QUOTES); + if (User) + { + tptr=GetToken(Token,":",User,0); + if (StrLen(tptr)) *Password=CopyStr(*Password,tptr); + } } else ptr=Data; -if (Host) ptr=GetToken(ptr,":",Host,0); -if (Port && StrLen(ptr)) *Port=CopyStr(*Port,ptr); - -DestroyString(Token); +if (Host) ptr=GetToken(ptr,"/",&Token,0); +tptr=strchr(Token,':'); +if (tptr) +{ +*tptr='\0'; +if (Port) *Port=CopyStr(*Port,tptr+1); } +*Host=CopyStr(*Host, Token); +DestroyString(Token); - - +return(ptr); +} void ParseURL(const char *URL, char **Proto, char **Host, char **Port, char **User, char **Password, char **Path, char **Args) { diff --git a/libUseful-2.4/ParseURL.h b/libUseful-2.6/ParseURL.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/ParseURL.h rename to libUseful-2.6/ParseURL.h diff --git a/libUseful-2.4/PatternMatch.c b/libUseful-2.6/PatternMatch.c old mode 100644 new mode 100755 similarity index 77% rename from libUseful-2.4/PatternMatch.c rename to libUseful-2.6/PatternMatch.c index cf05988..cdf6092 --- a/libUseful-2.4/PatternMatch.c +++ b/libUseful-2.6/PatternMatch.c @@ -1,6 +1,6 @@ #include "PatternMatch.h" -typedef enum {MATCH_FAIL, MATCH_FOUND, MATCH_ONE, MATCH_MANY, MATCH_REPEAT, MATCH_CONT, MATCH_QUOT, MATCH_START, MATCH_CHARLIST, MATCH_HEX, MATCH_OCTAL, MATCH_SWITCH_ON, MATCH_SWITCH_OFF} TPMatchElements; +typedef enum {MATCH_FAIL, MATCH_FOUND, MATCH_ONE, MATCH_MANY, MATCH_REPEAT, MATCH_NEXT, MATCH_CONT, MATCH_QUOT, MATCH_START, MATCH_CHARLIST, MATCH_HEX, MATCH_OCTAL, MATCH_SWITCH_ON, MATCH_SWITCH_OFF} TPMatchElements; //Gets Called recursively int pmatch_char(char **P_PtrPtr, char **S_PtrPtr, int *Flags); @@ -58,18 +58,15 @@ else *Flags &= ~NewFlag; } - -int pmatch_quot(char **P_PtrPtr, char **S_PtrPtr, int *Flags) +int pmatch_quot_analyze(char P_Char, char S_Char) { -int result=MATCH_FAIL, OldFlags; -char P_Char, S_Char, *OldPos; - -P_Char=**P_PtrPtr; -S_Char=**S_PtrPtr; +int result=MATCH_FAIL; switch (P_Char) { + case 'a': if (S_Char==7) result=MATCH_ONE; break; case 'b': if (S_Char=='\b') result=MATCH_ONE; break; + case 'd': if (S_Char==127) result=MATCH_ONE; break; case 'e': if (S_Char==27) result=MATCH_ONE; break; //escape case 'n': if (S_Char=='\n') result=MATCH_ONE; break; case 'r': if (S_Char=='\r') result=MATCH_ONE; break; @@ -78,22 +75,9 @@ switch (P_Char) case 'x': result=MATCH_HEX; break; case 'A': if (isalpha(S_Char)) result=MATCH_ONE; break; case 'B': if (isalnum(S_Char)) result=MATCH_ONE; break; + case 'C': if (isprint(S_Char)) result=MATCH_ONE; break; case 'D': if (isdigit(S_Char)) result=MATCH_ONE; break; - case 'S': - /* - if ((S_Char=='\x1b') && (*((*S_PtrPtr)+1)=='[')) - { - //treat vt escape seqences as space - while ((S_Char !='m') && (S_Char != '\0')) - { - (*S_PtrPtr)++; - S_Char=**S_PtrPtr; - } - result=MATCH_ONE; - } - */ - if (isspace(S_Char)) result=MATCH_ONE; - break; + case 'S': if (isspace(S_Char)) result=MATCH_ONE; break; case 'P': if (ispunct(S_Char)) result=MATCH_ONE; break; case 'X': if (isxdigit(S_Char)) result=MATCH_ONE; break; case 'U': if (isupper(S_Char)) result=MATCH_ONE; break; @@ -103,6 +87,22 @@ switch (P_Char) default: if (S_Char==P_Char) result=MATCH_ONE; break; } +return(result); +} + + + +int pmatch_quot(char **P_PtrPtr, char **S_PtrPtr, int *Flags) +{ +int result=MATCH_FAIL, OldFlags; +char P_Char, S_Char, *OldPos, *ptr; + +P_Char=**P_PtrPtr; +S_Char=**S_PtrPtr; + + +result=pmatch_quot_analyze(P_Char, S_Char); + switch (result) { case MATCH_ONE: @@ -121,8 +121,6 @@ switch (result) case MATCH_SWITCH_ON: case MATCH_SWITCH_OFF: - - //some switches need to be applied in order for a pattern to match //(like the case-insensitive switch) others should only be applied if //it matches. So we apply the switch, but if the subsequent pmatch_char fails @@ -264,7 +262,6 @@ else } - //we must still honor switches even if 'nowildcards' is set, as we may want to turn //'nowildcards' off, or turn case or extraction features on or off if (*Flags & PMATCH_NOWILDCARDS) @@ -281,13 +278,34 @@ switch (P_Char) { case '\0': result=MATCH_FOUND; break; case '|': result=MATCH_FOUND; break; - case '*': result=MATCH_MANY;break; - case '?': (*P_PtrPtr)++; result=MATCH_ONE;break; + case '*': result=MATCH_MANY; break; + case '?': (*P_PtrPtr)++; result=MATCH_ONE; break; case '^': (*P_PtrPtr)++; result=MATCH_START; break; case '$': if (S_Char=='\0') result=MATCH_FOUND; else if ((*Flags & PMATCH_NEWLINEEND) && (S_Char=='\n')) result=MATCH_FOUND; break; + + //This is akin to $ (match end) but matches any 'breaking' character + case '%': + switch (S_Char) + { + case '\0': + case '\r': + case '\n': + case ' ': + case ' ': + case '-': + case '_': + case '.': + case ',': + case ':': + case ';': + result=MATCH_FOUND; + break; + } + break; + case '[': (*P_PtrPtr)++; result=pmatch_charlist(P_PtrPtr,S_Char,*Flags); break; case '{': (*P_PtrPtr)++; result=MATCH_REPEAT; break; @@ -312,6 +330,53 @@ return(result); } +//pmatch_many looks ahead to see if the next character can be included in the match +int pmatch_many(char *P_Ptr, char *S_Ptr, char *S_End, int *Flags) +{ +int result=MATCH_FAIL; +char *p_ptr, *s_ptr; + +//This is a LOOKAHEAD function, so we don't want to change any pointer positions +//thus we use local pointers to do all the searching +p_ptr=P_Ptr; +s_ptr=S_Ptr; + +switch (*p_ptr) +{ + //we are at end of pattern. If we are also at end of string, then it's a match + case '\0': + if (s_ptr == S_End) return(MATCH_FOUND); + break; + + //we have a quoted char. Could be a switch, in which case we skip over it + case '\\': + p_ptr++; + result=pmatch_quot_analyze(*p_ptr, *s_ptr); + p_ptr++; + //just ignore switches + if ((result==MATCH_SWITCH_ON) || (result==MATCH_SWITCH_OFF)) + { + p_ptr++; + return(pmatch_many(p_ptr, s_ptr, S_End, Flags)); + } + break; + + default: + //if we've consumed all string, BUT ARE NOT AT END OF PATTERN, then we've failed to find a match + if (s_ptr == S_End) return(MATCH_FAIL); + else result=pmatch_char(&p_ptr, &s_ptr, Flags); + + break; +} + +//if the next character is a match, then we're at the end +//of match many +if (result==MATCH_FAIL) return(MATCH_MANY); + +return(result); +} + + //Somewhat ugly, as we need to iterate through the string, so we need it passed as a ** int pmatch_search(char *Pattern, char **S_PtrPtr, char *S_End, char **MatchStart, char **MatchEnd, int *Flags) @@ -351,41 +416,29 @@ char *P_Ptr, *ptr, *S_Start; //S_Ptr++ below will correct this break; - - case MATCH_FOUND: - if (*Flags & PMATCH_NOEXTRACT) - { - //This is to prevent returning NULL strings in 'MatchStart' and 'MatchEnd' - if (MatchStart && (! *MatchStart)) *MatchStart=S_Start; - if (MatchEnd && (! *MatchEnd)) *MatchEnd=*MatchStart; - } - //else if (MatchEnd) *MatchEnd=*S_PtrPtr; - return(MATCH_ONE); - break; //Match many is a special case. We have too look ahead to see if the next char //Matches, and thus takes us out of 'match many' howerver, If the call to pmatch_char //fails then we have to rewind the pattern pointer to match many's '*' and go round again case MATCH_MANY: - ptr=P_Ptr; - P_Ptr++; - - //pmatch_char will think that if we've reached the end of the pattern, then we've got - //a match, regardless of where we are in the string. However, this is the one case where - //'*' needs to be a little 'greedy'. If the last item in the pattern was '*' (match many) - //then we need to continue until we read the end of the string - if (*P_Ptr=='\0') - { - if (*S_PtrPtr == S_End) result=MATCH_FOUND; - else result=MATCH_FAIL; - } - else + result=pmatch_many(P_Ptr+1, (*S_PtrPtr)+1, S_End, Flags); + + if (result == MATCH_FAIL) return(MATCH_FAIL); + if (result == MATCH_ONE) { - if (*S_PtrPtr == S_End) result=MATCH_FAIL; - else result=pmatch_char(&P_Ptr, S_PtrPtr, Flags); + result=MATCH_NEXT; + P_Ptr++; } + break; - if ((result==MATCH_FAIL) || (result==MATCH_CONT)) P_Ptr=ptr; + case MATCH_FOUND: + if (! (*Flags & PMATCH_NOEXTRACT) ) + { + //This is to prevent returning NULL strings in 'MatchStart' and 'MatchEnd' + if (MatchStart && (! *MatchStart)) *MatchStart=S_Start; + if (MatchEnd && (! *MatchEnd)) *MatchEnd=*MatchStart; + } + return(MATCH_ONE); break; case MATCH_REPEAT: @@ -398,7 +451,10 @@ char *P_Ptr, *ptr, *S_Start; break; } - if ((result==MATCH_CONT) ) + + if (result==MATCH_NEXT) /*do nothing */ ; + else if (result==MATCH_FOUND) continue; + else if ((result==MATCH_CONT) ) { if (MatchStart) *MatchStart=NULL; if (MatchEnd) *MatchEnd=NULL; @@ -410,10 +466,8 @@ char *P_Ptr, *ptr, *S_Start; } //Handle 'MATCH_FOUND' in the switch statement, don't iterate further through Pattern or String - if (result==MATCH_FOUND) continue; (*S_PtrPtr)++; - //if (*S_PtrPtr > S_End) break; result=pmatch_char(&P_Ptr, S_PtrPtr, Flags); } @@ -428,16 +482,25 @@ return(MATCH_ONE); //Wrapper around pmatch_search to make it more user friendly -int pmatch_process_one(char *Pattern, char *String, int len, char **Start, char **End, int Flags) +int pmatch_one(char *Pattern, char *String, int len, char **Start, char **End, int Flags) { char *S_Ptr, *S_End; +int result; + +if (! String) return(FALSE); +if (! Pattern) return(FALSE); S_Ptr=String; S_End=String+len; if (Start) *Start=NULL; if (End) *End=NULL; - return(pmatch_search(Pattern, &S_Ptr, S_End, Start, End, &Flags)); +result=pmatch_search(Pattern, &S_Ptr, S_End, Start, End, &Flags); + +if (result == MATCH_ONE) return(TRUE); +if (result == MATCH_FOUND) return(TRUE); + +return(FALSE); } @@ -457,12 +520,11 @@ int NoOfItems=0; Flags=iFlags &= ~PMATCH_SUBSTR; s_end=String+len; //We handle PMATCH substr in this function -for (p_ptr=Compiled; *p_ptr != NULL; p_ptr++) +for (s_ptr=String; s_ptr < s_end; s_ptr++) { - for (s_ptr=String; s_ptr < s_end; s_ptr++) + for (p_ptr=Compiled; *p_ptr != NULL; p_ptr++) { - result=pmatch_process_one(*p_ptr, s_ptr, s_end-s_ptr, &Start, &End, Flags); - if (result==MATCH_ONE) + if (pmatch_one(*p_ptr, s_ptr, s_end-s_ptr, &Start, &End, Flags)) { NoOfItems++; if (Matches) @@ -471,9 +533,16 @@ for (p_ptr=Compiled; *p_ptr != NULL; p_ptr++) Match->Start=Start; Match->End=End; ListAddItem(Matches,Match); + + //if we allow matches to overlap, then we'll check for a match + //at every position, otherwise we jump to end of this match + if (! (Flags & PMATCH_OVERLAP)) + { + s_ptr=End; + s_ptr--; + } } } - else if (result==MATCH_FAIL) break; } Flags |= PMATCH_NOTSTART; } diff --git a/libUseful-2.6/PatternMatch.c- b/libUseful-2.6/PatternMatch.c- new file mode 100755 index 0000000..0eaeed1 --- /dev/null +++ b/libUseful-2.6/PatternMatch.c- @@ -0,0 +1,549 @@ +#include "PatternMatch.h" + +typedef enum {MATCH_FAIL, MATCH_FOUND, MATCH_ONE, MATCH_MANY, MATCH_REPEAT, MATCH_CONT, MATCH_QUOT, MATCH_START, MATCH_CHARLIST, MATCH_HEX, MATCH_OCTAL, MATCH_SWITCH_ON, MATCH_SWITCH_OFF} TPMatchElements; + +//Gets Called recursively +int pmatch_char(char **P_PtrPtr, char **S_PtrPtr, int *Flags); +int pmatch_search(char *Pattern, char **S_PtrPtr, char *S_End, char **Start, char **End, int *Flags); + + +int pmatch_ascii(char *P_Ptr,char S_Char,int Type) +{ +char ValStr[4]; +int P_Char=-1; + +if (Type==MATCH_HEX) +{ + strncpy(ValStr,P_Ptr,2); + P_Char=strtol(P_Ptr,NULL,16); +} + +if (Type==MATCH_OCTAL) +{ + strncpy(ValStr,P_Ptr,3); + P_Char=strtol(P_Ptr,NULL,8); +} + +if (P_Char==-1) return(FALSE); + +if (P_Char==S_Char) return(TRUE); + +return(FALSE); +} + + +void pmatch_switch(char SwitchType, char SwitchOnOrOff, int *Flags) +{ +int NewFlag=0, OnOrOff=FALSE; + +if (SwitchOnOrOff==MATCH_SWITCH_ON) OnOrOff=TRUE; +else if (SwitchOnOrOff==MATCH_SWITCH_OFF) OnOrOff=FALSE; +else return; + +switch (SwitchType) +{ +//These switches have the opposite meaning to the flags they control. +//+C turns case sensitivity on, but the flag is 'PMATCH_NOCASE' that +//turns it off, so we need to invert the sense of 'OnOrOff' +case 'C': NewFlag=PMATCH_NOCASE; OnOrOff= !OnOrOff; break; +case 'W': NewFlag=PMATCH_NOWILDCARDS; OnOrOff= !OnOrOff; break; +case 'X': NewFlag=PMATCH_NOEXTRACT; OnOrOff= !OnOrOff; break; + +case 'N': NewFlag=PMATCH_NEWLINEEND; break; +} + +if (OnOrOff) *Flags |= NewFlag; +else *Flags &= ~NewFlag; + +} + + + +int pmatch_quot(char **P_PtrPtr, char **S_PtrPtr, int *Flags) +{ +int result=MATCH_FAIL, OldFlags; +char P_Char, S_Char, *OldPos; + +P_Char=**P_PtrPtr; +S_Char=**S_PtrPtr; + +switch (P_Char) +{ + case 'b': if (S_Char=='\b') result=MATCH_ONE; break; + case 'e': if (S_Char==27) result=MATCH_ONE; break; //escape + case 'n': if (S_Char=='\n') result=MATCH_ONE; break; + case 'r': if (S_Char=='\r') result=MATCH_ONE; break; + case 't': if (S_Char==' ') result=MATCH_ONE; break; + case 'l': if (islower(S_Char)) result=MATCH_ONE; break; + case 'x': result=MATCH_HEX; break; + case 'A': if (isalpha(S_Char)) result=MATCH_ONE; break; + case 'B': if (isalnum(S_Char)) result=MATCH_ONE; break; + case 'D': if (isdigit(S_Char)) result=MATCH_ONE; break; + case 'S': + /* + if ((S_Char=='\x1b') && (*((*S_PtrPtr)+1)=='[')) + { + //treat vt escape seqences as space + while ((S_Char !='m') && (S_Char != '\0')) + { + (*S_PtrPtr)++; + S_Char=**S_PtrPtr; + } + result=MATCH_ONE; + } + */ + if (isspace(S_Char)) result=MATCH_ONE; + break; + case 'P': if (ispunct(S_Char)) result=MATCH_ONE; break; + case 'X': if (isxdigit(S_Char)) result=MATCH_ONE; break; + case 'U': if (isupper(S_Char)) result=MATCH_ONE; break; + case '+': result=MATCH_SWITCH_ON; break; + case '-': result=MATCH_SWITCH_OFF; break; + + default: if (S_Char==P_Char) result=MATCH_ONE; break; +} + +switch (result) +{ + case MATCH_ONE: + (*P_PtrPtr)++; + break; + + case MATCH_HEX: + if (! pmatch_ascii((*P_PtrPtr)+1,S_Char,MATCH_HEX)) return(MATCH_FAIL); + (*P_PtrPtr)+=2; + break; + + case MATCH_OCTAL: + if (! pmatch_ascii((*P_PtrPtr)+1,S_Char,MATCH_OCTAL)) return(MATCH_FAIL); + (*P_PtrPtr)+=3; + break; + + case MATCH_SWITCH_ON: + case MATCH_SWITCH_OFF: + + + //some switches need to be applied in order for a pattern to match + //(like the case-insensitive switch) others should only be applied if + //it matches. So we apply the switch, but if the subsequent pmatch_char fails + //we unapply it + OldFlags=*Flags; + OldPos=*P_PtrPtr; + (*P_PtrPtr)++; //go past the + or - to the actual type + pmatch_switch(**P_PtrPtr, result, Flags); + (*P_PtrPtr)++; + result=pmatch_char(P_PtrPtr, S_PtrPtr, Flags); + + if ((result==MATCH_FAIL) || (result==MATCH_CONT)) + { + *P_PtrPtr=OldPos; + *Flags=OldFlags; + } + return(result); + break; + + case MATCH_FAIL: + if (*Flags & PMATCH_SUBSTR) return(MATCH_CONT); + return(MATCH_FAIL); + break; +} + +return(MATCH_ONE); +} + + +#define CHARLIST_NOT 1 + +int pmatch_charlist(char **P_PtrPtr,char S_Char, int Flags) +{ +char P_Char, Prev_Char=0; +int result=MATCH_CONT; +int mode=0; + + +while (**P_PtrPtr != '\0') +{ + if (Flags & PMATCH_NOCASE) P_Char=tolower(**P_PtrPtr); + else P_Char=**P_PtrPtr; + + if (P_Char==']') break; + + switch (P_Char) + { + case '\\': + (*P_PtrPtr)++; + if (Flags & PMATCH_NOCASE) P_Char=tolower(**P_PtrPtr); + else P_Char=**P_PtrPtr; + break; + + case '-': + (*P_PtrPtr)++; + if (Flags & PMATCH_NOCASE) P_Char=tolower(**P_PtrPtr); + else P_Char=**P_PtrPtr; + + if ((S_Char >= Prev_Char) && (S_Char <= P_Char)) result=MATCH_ONE; + break; + + case '!': + mode |= CHARLIST_NOT; + break; + + default: + if (P_Char == S_Char) result=MATCH_ONE; + break; + } + + Prev_Char=P_Char; + (*P_PtrPtr)++; +} + +//go beyond ']' +(*P_PtrPtr)++; + +if (mode & CHARLIST_NOT) +{ + if (result==MATCH_ONE) result=MATCH_CONT; + else result=MATCH_ONE; +} + +return(result); +} + + + +int pmatch_repeat(char **P_PtrPtr, char **S_PtrPtr, char *S_End, int *Flags) +{ +char *SubPattern=NULL, *sp_ptr, *ptr; +int count=0, i, val=0, result=MATCH_FAIL; + +ptr=*P_PtrPtr; +while ( ((**P_PtrPtr) != '}') && ((**P_PtrPtr) != '\0') ) (*P_PtrPtr)++; +if ((**P_PtrPtr)=='\0') return(MATCH_FAIL); + +SubPattern=CopyStrLen(SubPattern,ptr,*P_PtrPtr - ptr); + +sp_ptr=strchr(SubPattern,'|'); +if (sp_ptr) +{ + *sp_ptr='\0'; + sp_ptr++; + count=atoi(SubPattern); + for (i=0; i < count; i++) + { + val=0; + result=pmatch_search(sp_ptr, S_PtrPtr, S_End, NULL, NULL, &val); + if (result==MATCH_CONT) result=MATCH_FAIL; + if (result==MATCH_FAIL) break; + } +} + +(*S_PtrPtr)--; +(*P_PtrPtr)++; +DestroyString(SubPattern); +return(result); +} + + + + +int pmatch_char(char **P_PtrPtr, char **S_PtrPtr, int *Flags) +{ +char P_Char, S_Char, *P_Start; +int result=MATCH_FAIL; + +P_Start=*P_PtrPtr; +if (*Flags & PMATCH_NOCASE) +{ + P_Char=tolower(**P_PtrPtr); + S_Char=tolower(**S_PtrPtr); +} +else +{ + P_Char=**P_PtrPtr; + S_Char=**S_PtrPtr; +} + + + +//we must still honor switches even if 'nowildcards' is set, as we may want to turn +//'nowildcards' off, or turn case or extraction features on or off +if (*Flags & PMATCH_NOWILDCARDS) +{ + if ( + (P_Char=='\\') && + ((*(*P_PtrPtr+1)=='+') || (*(*P_PtrPtr+1)=='-')) + ) /*This is a switch, fall through and process it */ ; + else if (P_Char==S_Char) return(MATCH_ONE); + else return(MATCH_FAIL); +} + +switch (P_Char) +{ + case '\0': result=MATCH_FOUND; break; + case '|': result=MATCH_FOUND; break; + case '*': result=MATCH_MANY;break; + case '?': (*P_PtrPtr)++; result=MATCH_ONE;break; + case '^': (*P_PtrPtr)++; result=MATCH_START; break; + case '$': + if (S_Char=='\0') result=MATCH_FOUND; + else if ((*Flags & PMATCH_NEWLINEEND) && (S_Char=='\n')) result=MATCH_FOUND; + break; + + //This is akin to $ (match end) but matches any 'breaking' character + case '%': + switch (S_Char) + { + case '\0': + case '\r': + case '\n': + case ' ': + case ' ': + case '-': + case '_': + case '.': + case ',': + case ':': + case ';': + result=MATCH_FOUND; + break; + } + break; + + case '[': (*P_PtrPtr)++; result=pmatch_charlist(P_PtrPtr,S_Char,*Flags); break; + + case '{': (*P_PtrPtr)++; result=MATCH_REPEAT; break; + + case '\\': + //results here can either be MATCH_FAIL, MATCH_CONT, MATCH_ONE + (*P_PtrPtr)++; + result=pmatch_quot(P_PtrPtr, S_PtrPtr, Flags); + break; + + default: + (*P_PtrPtr)++; + if (P_Char==S_Char) result=MATCH_ONE; + else if (*Flags & PMATCH_SUBSTR) result=MATCH_CONT; + else result=MATCH_FAIL; + break; +} + +if ((result==MATCH_CONT) || (result==MATCH_FAIL)) *(P_PtrPtr)=P_Start; + +return(result); +} + + + +//Somewhat ugly, as we need to iterate through the string, so we need it passed as a ** +int pmatch_search(char *Pattern, char **S_PtrPtr, char *S_End, char **MatchStart, char **MatchEnd, int *Flags) +{ +int result; +char *P_Ptr, *ptr, *S_Start; + + if (MatchStart) *MatchStart=NULL; + if (MatchEnd) *MatchEnd=NULL; + + P_Ptr=Pattern; + S_Start=*S_PtrPtr; + result=pmatch_char(&P_Ptr, S_PtrPtr, Flags); + while (*S_PtrPtr <= S_End) + { + switch (result) + { + case MATCH_FAIL: + if (*Flags & PMATCH_SUBSTR) return(MATCH_CONT); + return(MATCH_FAIL); + break; + + //Match failed, but we're looking for a substring of 'String' so continue searching for match + case MATCH_CONT: + if (! (*Flags & PMATCH_SUBSTR)) return(MATCH_FAIL); + //if we were some ways through a pattern before hitting the character + //that failed the match, then we must rewind to reconsider that character + //as a fresh match + //if ((*P_Ptr != *Pattern) && (*Pattern != '^')) (*S_PtrPtr)--; + if ((*P_Ptr != *Pattern) ) (*S_PtrPtr)--; + P_Ptr=Pattern; + break; + + case MATCH_START: + if (*Flags & PMATCH_NOTSTART) return(MATCH_FAIL); + (*S_PtrPtr)--; //naughty, were are now pointing before String, but the + //S_Ptr++ below will correct this + break; + + + case MATCH_FOUND: + if (*Flags & PMATCH_NOEXTRACT) + { + //This is to prevent returning NULL strings in 'MatchStart' and 'MatchEnd' + if (MatchStart && (! *MatchStart)) *MatchStart=S_Start; + if (MatchEnd && (! *MatchEnd)) *MatchEnd=*MatchStart; + } + //else if (MatchEnd) *MatchEnd=*S_PtrPtr; + return(MATCH_ONE); + break; + + //Match many is a special case. We have too look ahead to see if the next char + //Matches, and thus takes us out of 'match many' howerver, If the call to pmatch_char + //fails then we have to rewind the pattern pointer to match many's '*' and go round again + case MATCH_MANY: + ptr=P_Ptr; + P_Ptr++; + + //pmatch_char will think that if we've reached the end of the pattern, then we've got + //a match, regardless of where we are in the string. However, this is the one case where + //'*' needs to be a little 'greedy'. If the last item in the pattern was '*' (match many) + //then we need to continue until we read the end of the string + if (*P_Ptr=='\0') + { + if (*S_PtrPtr == S_End) result=MATCH_FOUND; + else result=MATCH_FAIL; + } + else + { + if (*S_PtrPtr == S_End) result=MATCH_FAIL; + else result=pmatch_char(&P_Ptr, S_PtrPtr, Flags); + } + + if ((result==MATCH_FAIL) || (result==MATCH_CONT)) P_Ptr=ptr; + break; + + case MATCH_REPEAT: + result=pmatch_repeat(&P_Ptr, S_PtrPtr, S_End, Flags); + if (result==MATCH_FAIL) + { + if (*Flags & PMATCH_SUBSTR) return(MATCH_CONT); + return(MATCH_FAIL); + } + break; + } + + if ((result==MATCH_CONT) ) + { + if (MatchStart) *MatchStart=NULL; + if (MatchEnd) *MatchEnd=NULL; + } + else if (! (*Flags & PMATCH_NOEXTRACT)) + { + if (MatchStart && (*S_PtrPtr >= S_Start) && (! *MatchStart)) *MatchStart=*S_PtrPtr; + if (MatchEnd && ((*(S_PtrPtr)+1) < S_End)) *MatchEnd=(*S_PtrPtr)+1; + } + + //Handle 'MATCH_FOUND' in the switch statement, don't iterate further through Pattern or String + if (result==MATCH_FOUND) continue; + + (*S_PtrPtr)++; + //if (*S_PtrPtr > S_End) break; + + result=pmatch_char(&P_Ptr, S_PtrPtr, Flags); + } + +//if pattern not exhausted then we didn't get a match +if (*P_Ptr !='\0') return(MATCH_CONT); + +return(MATCH_ONE); +} + + + + +//Wrapper around pmatch_search to make it more user friendly +int pmatch_one(char *Pattern, char *String, int len, char **Start, char **End, int Flags) +{ +char *S_Ptr, *S_End; + + S_Ptr=String; + S_End=String+len; + if (Start) *Start=NULL; + if (End) *End=NULL; + + return(pmatch_search(Pattern, &S_Ptr, S_End, Start, End, &Flags)); +} + + + + +int pmatch_process(char **Compiled, char *String, int len, ListNode *Matches, int iFlags) +{ +//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; +char *Start=NULL, *End=NULL; +int result, Flags; +TPMatch *Match; +int NoOfItems=0; + +Flags=iFlags &= ~PMATCH_SUBSTR; +s_end=String+len; +//We handle PMATCH substr in this function +for (p_ptr=Compiled; *p_ptr != NULL; p_ptr++) +{ + for (s_ptr=String; s_ptr < s_end; s_ptr++) + { + result=pmatch_one(*p_ptr, s_ptr, s_end-s_ptr, &Start, &End, Flags); + if (result==MATCH_ONE) + { + NoOfItems++; + if (Matches) + { + Match=(TPMatch *) calloc(1, sizeof(TPMatch)); + Match->Start=Start; + Match->End=End; + ListAddItem(Matches,Match); + } + } + else if (result==MATCH_FAIL) break; + } + Flags |= PMATCH_NOTSTART; +} + +return(NoOfItems); +} + + + +void pmatch_compile(char *Pattern, char ***Compiled) +{ +int NoOfRecords=0, NoOfItems=0; +char *ptr; + +ptr=Pattern; + +while (ptr && (*ptr != '\0')) +{ + //while ((*ptr=='?') || (*ptr=='*')) ptr++; + NoOfItems++; + if (NoOfItems >= NoOfRecords) + { + NoOfRecords+=10; + *Compiled=(char **) realloc(*Compiled,NoOfRecords*sizeof(char *)); + + } + (*Compiled)[NoOfItems-1]=ptr; + while ((*ptr !='\0') && (*ptr != '|')) ptr++; + if (*ptr=='|') ptr++; +} + +*Compiled=(char **) realloc(*Compiled,(NoOfRecords+1)*sizeof(char *)); +(*Compiled)[NoOfItems]=NULL; +} + + + +int pmatch(char *Pattern, char *String, int Len, ListNode *Matches, int Flags) +{ +char *ptr, **Compiled=NULL; +int result, len; + + pmatch_compile(Pattern,&Compiled); + + ptr=String; + len=Len; + + result=pmatch_process(Compiled, ptr, len, Matches, Flags); + + if (Compiled) free(Compiled); + return(result); +} diff --git a/libUseful-2.4/PatternMatch.h b/libUseful-2.6/PatternMatch.h old mode 100644 new mode 100755 similarity index 75% rename from libUseful-2.4/PatternMatch.h rename to libUseful-2.6/PatternMatch.h index 594cd84..278db15 --- a/libUseful-2.4/PatternMatch.h +++ b/libUseful-2.6/PatternMatch.h @@ -7,7 +7,9 @@ #define PMATCH_NOEXTRACT 8 #define PMATCH_NEWLINEEND 16 #define PMATCH_NOTSTART 32 -#define PMATCH_NOTEND 64 +#define PMATCH_NOTEND 64 +#define PMATCH_OVERLAP 128 + #include "includes.h" @@ -21,6 +23,8 @@ char *Start; char *End; } TPMatch; + +int pmatch_one(char *Pattern, char *String, int len, char **Start, char **End, int Flags); int pmatch(char *Pattern, char *String, int Len, ListNode *Matches, int Flags); diff --git a/libUseful-2.4/README b/libUseful-2.6/README old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/README rename to libUseful-2.6/README diff --git a/libUseful-2.6/SpawnPrograms.c b/libUseful-2.6/SpawnPrograms.c new file mode 100755 index 0000000..283d888 --- /dev/null +++ b/libUseful-2.6/SpawnPrograms.c @@ -0,0 +1,479 @@ +#include "SpawnPrograms.h" +#include "Log.h" +#include "pty.h" +#include "file.h" +#include "string.h" +#include +#include + +//This is the function we call in the child process for 'SpawnCommand' +int BASIC_FUNC_EXEC_COMMAND(void *Command) +{ +int result; + +result=execl("/bin/sh","/bin/sh","-c",(char *) Command,NULL); + +return(result); +} + +pid_t ForkWithContext(const char *User, const char *Dir, const char *Group) +{ +pid_t pid; + +LogFileFlushAll(TRUE); +pid=fork(); +if (pid==0) +{ + if (StrLen(Dir)) chdir(Dir); + if (StrLen(Group)) SwitchGroup(Group); + if (StrLen(User)) SwitchUser(User); +} +return(pid); +} + + +int ForkWithIO(int StdIn, int StdOut, int StdErr) +{ +pid_t pid; +int fd; + +pid=ForkWithContext(NULL, NULL, NULL); +if (pid==0) +{ + if (StdIn > -1) + { + if (StdIn !=0) + { + close(0); + dup(StdIn); + } + } + else + { + fd=open("/dev/null",O_RDONLY); + dup(fd); + close(fd); + } + + if (StdOut > -1) + { + if (StdOut !=1) + { + close(1); + dup(StdOut); + } + } + else + { + fd=open("/dev/null",O_WRONLY); + dup(fd); + close(fd); + } + + if (StdErr > -1) + { + if (StdErr !=2) + { + close(2); + dup(StdErr); + } + } +} + + +return(pid); +} + + +/* This function turns our process into a demon */ +int demonize() +{ +int result, i=0; + +LogFileFlushAll(TRUE); +//Don't fork with context here, as a demonize involves two forks, so +//it's wasted work here. +result=fork(); +if (result != 0) exit(0); + +/*we can only get to here if result= 0 i.e. we are the child process*/ +setsid(); + +result=ForkWithContext(NULL, NULL, NULL); +if (result !=0) exit(0); +umask(0); + +/* close stdin, stdout and std error, but only if they are a tty. In some */ +/* situations (like working out of cron) we may not have been given in/out/err */ +/* and thus the first files we open will be 0,1,2. If we close them, we will have */ +/* closed files that we need! Alternatively, the user may have used shell redirection */ +/* to send output for a file, and I'm sure they don't want us to close that file */ + +//for (i=0; i < 3; i++) +{ + if (isatty(i)) + { + close(i); + /* reopen to /dev/null so that any output gets thrown away */ + /* but the program still has somewhere to write to */ + open("/dev/null",O_RDWR); + } +} + + +return(1); +} + + + + +void SpawnApplyConfig(const char *Config, int Flags) +{ +char *User=NULL, *Group=NULL, *Dir=NULL; +char *Name=NULL, *Value=NULL; +const char *ptr; +struct rlimit limit; +rlim_t val; + +int i; + +//set all signal handlers to default +if (Flags & SPAWN_SIGDEF) +{ +for (i =0; i < _NSIG; i++) signal(i,SIG_DFL); +} + +//Set controlling tty to be stdin. This means that CTRL-C, SIGWINCH etc is handled for the +//stdin file descriptor, not for any oher +if (Flags & SPAWN_DAEMON) demonize(); +else +{ + if (Flags & SPAWN_SETSID) setsid(); + if (Flags & SPAWN_CTRL_TTY) tcsetpgrp(0, getpgrp()); +} + +User=CopyStr(User,""); +Group=CopyStr(Group,""); +ptr=GetNameValuePair(Config,"\\S","=",&Name,&Value); +while (ptr) +{ + if (strcasecmp(Name,"User")==0) User=CopyStr(User, Value); + else if (strcasecmp(Name,"Group")==0) Group=CopyStr(Group, Value); + else if (strcasecmp(Name,"Dir")==0) Dir=CopyStr(Dir, Value); + else if (strcasecmp(Name,"PidFile")==0) WritePidFile(Value); + else if (strcasecmp(Name,"prio")==0) setpriority(PRIO_PROCESS, 0, atoi(Value)); + else if (strcasecmp(Name,"nice")==0) setpriority(PRIO_PROCESS, 0, atoi(Value)); + else if (strcasecmp(Name,"priority")==0) setpriority(PRIO_PROCESS, 0, atoi(Value)); + else if (strcasecmp(Name,"mem")==0) + { + val=(rlim_t) ParseHumanReadableDataQty(Value, 0); + limit.rlim_cur=val; + limit.rlim_max=val; + setrlimit(RLIMIT_DATA, &limit); + } + else if (strcasecmp(Name,"fsize")==0) + { + val=(rlim_t) ParseHumanReadableDataQty(Value, 0); + limit.rlim_cur=val; + limit.rlim_max=val; + setrlimit(RLIMIT_FSIZE, &limit); + } + else if (strcasecmp(Name,"files")==0) + { + val=(rlim_t) ParseHumanReadableDataQty(Value, 0); + limit.rlim_cur=val; + limit.rlim_max=val; + setrlimit(RLIMIT_NOFILE, &limit); + } + else if (strcasecmp(Name,"coredumps")==0) + { + val=(rlim_t) ParseHumanReadableDataQty(Value, 0); + limit.rlim_cur=val; + limit.rlim_max=val; + setrlimit(RLIMIT_CORE, &limit); + } + else if ( (strcasecmp(Name,"procs")==0) || (strcasecmp(Name,"nproc")==0) ) + { + val=(rlim_t) ParseHumanReadableDataQty(Value, 0); + limit.rlim_cur=val; + limit.rlim_max=val; + setrlimit(RLIMIT_NPROC, &limit); + } + ptr=GetNameValuePair(ptr,"\\S","=",&Name,&Value); +} + +// This allows us to chroot into a whole different unix directory tree, with its own +// password file etc +if (Flags & SPAWN_CHROOT) chroot("."); + +if (StrLen(Dir)) chdir(Dir); + +//Always do group first, otherwise we'll lose ability to switch user/group +if (StrLen(Group)) SwitchGroup(Group); +if (StrLen(User)) SwitchUser(User); + +//Must do this last! After parsing Config, and also after functions like +//SwitchUser that will need access to /etc/passwd +if (Flags & SPAWN_JAIL) chroot("."); + +DestroyString(Name); +DestroyString(Value); +DestroyString(User); +DestroyString(Group); +DestroyString(Dir); +} + + +//This Function eliminates characters from a string that can be used to trivially achieve code-exec via the shell +char *MakeShellSafeString(char *RetStr, const char *String, int SafeLevel) +{ +char *Tempstr=NULL; +char *BadChars=";|&`"; + +if (SafeLevel==SHELLSAFE_BLANK) +{ + Tempstr=CopyStr(RetStr,String); + strmrep(Tempstr,BadChars,' '); +} +else Tempstr=QuoteCharsInStr(RetStr,String,BadChars); + +if (strcmp(Tempstr,String) !=0) +{ + //if (EventCallback) EventCallback(String); +} +return(Tempstr); +} + + +void SwitchProgram(const char *CommandLine, int Flags, const char *Config) +{ +char **argv, *ptr; +char *Token=NULL, *SafeStr=NULL; +int i; + +if (Flags & SPAWN_TRUST_COMMAND) SafeStr=CopyStr(SafeStr,CommandLine); +else SafeStr=MakeShellSafeString(SafeStr, CommandLine, 0); + +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); +} + +SpawnApplyConfig(Config, Flags); + +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 SpawnWithIO(const char *CommandLine, int Flags, const char *Config, int StdIn, int StdOut, int StdErr) +{ +pid_t pid; + +pid=ForkWithIO(StdIn,StdOut,StdErr); +if (pid==0) +{ +SwitchProgram(CommandLine, Flags, Config); +_exit(pid); +} + +return(pid); +} + + +int Spawn(const char *ProgName, int Flags, const char *Config) +{ +int pid; + +pid=ForkWithIO(0,1,2); +if (pid==0) +{ + SwitchProgram(ProgName, Flags, Config); + _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, int Flags, const char *Config) +{ +pid_t pid; +int channel1[2], channel2[2], channel3[2], DevNull=-1; + +if (infd) pipe(channel1); +if (outfd) pipe(channel2); +if (errfd) pipe(channel3); + +pid=ForkWithContext(NULL,NULL,NULL); +if (pid==0) +{ + /* we are the child */ + if (infd) close(channel1[1]); + else if (DevNull==-1) DevNull=open("/dev/null",O_RDWR); + if (outfd) close(channel2[0]); + else if (DevNull==-1) DevNull=open("/dev/null",O_RDWR); + if (errfd) close(channel3[0]); + else if (DevNull==-1) DevNull=open("/dev/null",O_RDWR); + + /*close stdin, stdout and stderr*/ + close(0); + close(1); + close(2); + /*channel 1 is going to be our stdin, so we close the writing side of it*/ + if (infd) dup(channel1[0]); + else dup(DevNull); + /* channel 2 is stdout */ + if (outfd) dup(channel2[1]); + else dup(DevNull); + /* channel 3 is stderr */ + if (errfd) + { + //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); + + + SpawnApplyConfig(Config, Flags); + Func(Data); + exit(0); + } +else // This is the parent process, not the spawned child +{ + /* we close the appropriate halves of the link */ + if (infd) + { + close(channel1[0]); + *infd=channel1[1]; + } + if (outfd) + { + close(channel2[1]); + *outfd=channel2[0]; + } + if (errfd) + { + close(channel3[1]); + //Yes, we can pass an integer value as errfd, even though errfd is 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]; + } +} + +return(pid); +} + + + +pid_t PipeSpawn(int *infd,int *outfd,int *errfd, const char *Command, int Flags, const char *Config) +{ +return(PipeSpawnFunction(infd,outfd,errfd, BASIC_FUNC_EXEC_COMMAND, (void *) Command, Flags, Config)); +} + + + + +pid_t PseudoTTYSpawnFunction(int *ret_pty, BASIC_FUNC Func, void *Data, int Flags, const char *Config) +{ +pid_t pid=-1; +int tty, pty, i; + +if (GrabPseudoTTY(&pty, &tty, Flags)) +{ +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); + +///now that we've dupped it, we don't need to keep it open +//as it will be open on stdin/stdout +close(tty); + +SpawnApplyConfig(Config, Flags); +Func((char *) Data); +_exit(0); +} + +close(tty); +} + +*ret_pty=pty; +return(pid); +} + + +pid_t PseudoTTYSpawn(int *pty, const char *Command, int Flags, const char *Config) +{ +return(PseudoTTYSpawnFunction(pty, BASIC_FUNC_EXEC_COMMAND, (void *) Command, Flags, Config)); +} + + + + + +STREAM *STREAMSpawnFunction(BASIC_FUNC Func, void *Data, int Flags, const char *Config) +{ +int to_fd, from_fd, *iptr; +pid_t pid=0; +STREAM *S=NULL; +char *Tempstr=NULL; + +if (Flags & COMMS_BY_PTY) +{ + pid=PseudoTTYSpawn(&to_fd, Tempstr, Flags, Config); +} +else +{ + iptr=NULL; + if (Flags & COMMS_COMBINE_STDERR) iptr=(int *) COMMS_COMBINE_STDERR; + pid=PipeSpawnFunction(&to_fd, &from_fd, iptr, Func, Data, Flags, Config); +} + +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); +} + +DestroyString(Tempstr); +return(S); +} + + +STREAM *STREAMSpawnCommand(const char *Command, int Flags, const char *Config) +{ +STREAM *S=NULL; +char *Tempstr=NULL; + +if (Flags & SPAWN_TRUST_COMMAND) Tempstr=CopyStr(Tempstr,Command); +else Tempstr=MakeShellSafeString(Tempstr, Command, 0); + +S=STREAMSpawnFunction(BASIC_FUNC_EXEC_COMMAND, Tempstr, Flags, Config); +DestroyString(Tempstr); +return(S); +} diff --git a/libUseful-2.6/SpawnPrograms.h b/libUseful-2.6/SpawnPrograms.h new file mode 100755 index 0000000..4dd21b6 --- /dev/null +++ b/libUseful-2.6/SpawnPrograms.h @@ -0,0 +1,45 @@ +#ifndef LIBUSEFUL_SPAWN_H +#define LIBUSEFUL_SPAWN_H + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define COMMS_BY_PIPE 0 +#define COMMS_BY_PTY 1 +#define SPAWN_TRUST_COMMAND 2 +#define COMMS_COMBINE_STDERR 4 +#define SPAWN_DAEMON 8 +#define SPAWN_SETSID 16 +#define SPAWN_CTRL_TTY 32 +#define SPAWN_CHROOT 64 +#define SPAWN_JAIL 128 +#define SPAWN_SIGDEF 256 + +//up to 2048, beyond that is TTYFLAG_ + +#define SHELLSAFE_BLANK 1 + +char *MakeShellSafeString(char *RetStr, const char *String, int SafeLevel); +void SwitchProgram(const char *CommandLine, int Flags, const char *Config); +int ForkWithContext(); +/* This function turns our process into a demon */ +int demonize(); +int ForkWithIO(int StdIn, int StdOut, int StdErr); +int SpawnWithIO(const char *CommandLine, int Flags, const char *Config, int StdIn, int StdOut, int StdErr); +int Spawn(const char *ProgName, int Flags, const char *Config); +/* 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 Flags, const char *Config); +int PipeSpawn(int *infd,int *outfd,int *errfd, const char *Command, int Flags, const char *Config); +int PseudoTTYSpawn(int *pty, const char *Command, int Flags, const char *Config); +STREAM *STREAMSpawnCommand(const char *Command, int Flags, const char *Config); +STREAM *STREAMSpawnFunction(BASIC_FUNC Func, void *Data, int Flags, const char *Config); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.4/Time.c b/libUseful-2.6/Time.c old mode 100644 new mode 100755 similarity index 98% rename from libUseful-2.4/Time.c rename to libUseful-2.6/Time.c index f62573d..b2b6aef --- a/libUseful-2.4/Time.c +++ b/libUseful-2.6/Time.c @@ -1,4 +1,6 @@ #include "Time.h" +#define _XOPEN_SOURCE +#include //we cache seconds because we expect most questions about //time to be in seconds, and this avoids multiplying millisecs up diff --git a/libUseful-2.4/Time.h b/libUseful-2.6/Time.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Time.h rename to libUseful-2.6/Time.h diff --git a/libUseful-2.4/Tokenizer.c b/libUseful-2.6/Tokenizer.c old mode 100644 new mode 100755 similarity index 95% rename from libUseful-2.4/Tokenizer.c rename to libUseful-2.6/Tokenizer.c index d420eab..3de1b1d --- a/libUseful-2.4/Tokenizer.c +++ b/libUseful-2.6/Tokenizer.c @@ -3,6 +3,7 @@ #include "string.h" #define TOK_SPACE 1 +#define TOK_CODE 2 #ifdef __MMX__ #include @@ -46,6 +47,7 @@ switch (*pptr) case '\\': pptr++; if (*pptr=='S') MatchType=TOK_SPACE; + if (*pptr=='X') MatchType=TOK_CODE; break; } @@ -94,7 +96,7 @@ switch (*eptr) case ' ': case '\n': case '\r': - if (MatchType==TOK_SPACE) + if ((MatchType==TOK_SPACE) || (MatchType==TOK_CODE)) { while (isspace(*eptr)) eptr++; eptr--; @@ -103,6 +105,16 @@ switch (*eptr) else if (*eptr != *pptr) return(FALSE); break; + case '(': + case ')': + case '=': + case '!': + case '<': + case '>': + if (MatchType==TOK_CODE) MatchType=0; + else if (*eptr != *pptr) return(FALSE); + break; + default: if (MatchType != 0) return(FALSE); if (*eptr != *pptr) return(FALSE); diff --git a/libUseful-2.4/Tokenizer.h b/libUseful-2.6/Tokenizer.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Tokenizer.h rename to libUseful-2.6/Tokenizer.h diff --git a/libUseful-2.4/Vars.c b/libUseful-2.6/Vars.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Vars.c rename to libUseful-2.6/Vars.c diff --git a/libUseful-2.4/Vars.h b/libUseful-2.6/Vars.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/Vars.h rename to libUseful-2.6/Vars.h diff --git a/libUseful-2.4/ansi.c b/libUseful-2.6/ansi.c old mode 100644 new mode 100755 similarity index 87% rename from libUseful-2.4/ansi.c rename to libUseful-2.6/ansi.c index e10d058..68cc48e --- a/libUseful-2.4/ansi.c +++ b/libUseful-2.6/ansi.c @@ -1,6 +1,20 @@ #include "ansi.h" +const char *ANSIColorStrings[]={"none","black","red","green","yellow","blue","magenta","cyan","white",NULL}; + + + +int ANSIParseColor(const char *Str) +{ +int val; + +val=MatchTokenFromList(Str, ANSIColorStrings, 0); +if (val==-1) val=ANSI_NONE; + +return(val); +} + char *ANSICode(int Color, int BgColor, int Flags) { static char *ANSI=NULL; @@ -10,10 +24,6 @@ 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; diff --git a/libUseful-2.4/ansi.h b/libUseful-2.6/ansi.h old mode 100644 new mode 100755 similarity index 95% rename from libUseful-2.4/ansi.h rename to libUseful-2.6/ansi.h index d0e19d6..8ae688d --- a/libUseful-2.4/ansi.h +++ b/libUseful-2.6/ansi.h @@ -25,6 +25,7 @@ typedef enum {ANSI_NONE, ANSI_BLACK, ANSI_RED, ANSI_GREEN, ANSI_YELLOW, ANSI_BLU char *ANSICode(int Color, int BgColor, int Flags); +int ANSIParseColor(const char *Str); char *TerminalReadText(char *RetStr, int Flags, STREAM *S); diff --git a/libUseful-2.4/base64.c b/libUseful-2.6/base64.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/base64.c rename to libUseful-2.6/base64.c diff --git a/libUseful-2.4/base64.h b/libUseful-2.6/base64.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/base64.h rename to libUseful-2.6/base64.h diff --git a/libUseful-2.4/buckets.c b/libUseful-2.6/buckets.c old mode 100644 new mode 100755 similarity index 97% rename from libUseful-2.4/buckets.c rename to libUseful-2.6/buckets.c index 20a36ad..8635f2f --- a/libUseful-2.4/buckets.c +++ b/libUseful-2.6/buckets.c @@ -67,7 +67,7 @@ STREAM *S; char *Tempstr=NULL; clock_t start, mid, end; -S=STREAMOpenFile(argv[1],STREAM_RDONLY); +S=STREAMOpenFile(argv[1],SF_RDONLY); start=clock(); Tempstr=STREAMReadLine(Tempstr,S); while (Tempstr) diff --git a/libUseful-2.6/config.log b/libUseful-2.6/config.log new file mode 100755 index 0000000..a52ca06 --- /dev/null +++ b/libUseful-2.6/config.log @@ -0,0 +1,655 @@ +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 --disable-option-checking --prefix=/usr/local --enable-ssl --cache-file=/dev/null --srcdir=. + +## --------- ## +## Platform. ## +## --------- ## + +hostname = colums-hp +uname -m = x86_64 +uname -r = 4.7.4-64 +uname -s = Linux +uname -v = #1 SMP Fri Sep 16 22:00:54 UTC 2016 + +/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: . +PATH: /opt/Csound-6.05/bin +PATH: /opt/Qt4/bin +PATH: /opt/SDL/bin +PATH: /opt/SDL2/bin +PATH: /opt/chkrootkit-0.50/bin +PATH: /opt/ghostscript-9.19/bin +PATH: /opt/git-2.9.3/bin +PATH: /opt/jx9-1.0/bin +PATH: /opt/lua-5.3.3/bin +PATH: /opt/lxc-2.0.3/bin +PATH: /opt/mujs-b005928/bin +PATH: /opt/perl-5.20.1/bin +PATH: /opt/poppler-0.43.0/bin +PATH: /opt/qemu-2.5.0/bin +PATH: /opt/schily/bin +PATH: /opt/wine-1.9.18/bin +PATH: /opt/x86_64/bin + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:2148: checking for gcc +configure:2164: found /usr/bin/gcc +configure:2175: result: gcc +configure:2404: checking for C compiler version +configure:2413: gcc --version >&5 +gcc (GCC) 5.3.0 +Copyright (C) 2015 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:2424: $? = 0 +configure:2413: gcc -v >&5 +Using built-in specs. +COLLECT_GCC=gcc +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-pc-linux-gnu/5.3.0/lto-wrapper +Target: i486-pc-linux-gnu +Configured with: ../gcc-5.3.0-src/configure --prefix=/usr --sysconfdir=/etc --includedir=/usr/include --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,c++,go --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i486-pc-linux-gnu --enable-bootstrap +Thread model: posix +gcc version 5.3.0 (GCC) +configure:2424: $? = 0 +configure:2413: gcc -V >&5 +gcc: error: unrecognized command line option '-V' +gcc: fatal error: no input files +compilation terminated. +configure:2424: $? = 1 +configure:2413: gcc -qversion >&5 +gcc: error: unrecognized command line option '-qversion' +gcc: fatal error: no input files +compilation terminated. +configure:2424: $? = 1 +configure:2444: checking whether the C compiler works +configure:2466: gcc conftest.c >&5 +configure:2470: $? = 0 +configure:2518: result: yes +configure:2521: checking for C compiler default output file name +configure:2523: result: a.out +configure:2529: checking for suffix of executables +configure:2536: gcc -o conftest conftest.c >&5 +configure:2540: $? = 0 +configure:2562: result: +configure:2584: checking whether we are cross compiling +configure:2592: gcc -o conftest conftest.c >&5 +configure:2596: $? = 0 +configure:2603: ./conftest +configure:2607: $? = 0 +configure:2622: result: no +configure:2627: checking for suffix of object files +configure:2649: gcc -c conftest.c >&5 +configure:2653: $? = 0 +configure:2674: result: o +configure:2678: checking whether we are using the GNU C compiler +configure:2697: gcc -c conftest.c >&5 +configure:2697: $? = 0 +configure:2706: result: yes +configure:2715: checking whether gcc accepts -g +configure:2735: gcc -c -g conftest.c >&5 +configure:2735: $? = 0 +configure:2776: result: yes +configure:2793: checking for gcc option to accept ISO C89 +configure:2856: gcc -c -g -O2 conftest.c >&5 +configure:2856: $? = 0 +configure:2869: result: none needed +configure:2895: checking whether make sets $(MAKE) +configure:2917: result: yes +configure:2932: checking how to run the C preprocessor +configure:2963: gcc -E conftest.c +configure:2963: $? = 0 +configure:2977: gcc -E conftest.c +conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory +compilation terminated. +configure:2977: $? = 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:3002: result: gcc -E +configure:3022: gcc -E conftest.c +configure:3022: $? = 0 +configure:3036: gcc -E conftest.c +conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory +compilation terminated. +configure:3036: $? = 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:3065: checking for grep that handles long lines and -e +configure:3123: result: /bin/grep +configure:3128: checking for egrep +configure:3190: result: /bin/grep -E +configure:3195: checking for ANSI C header files +configure:3215: gcc -c -g -O2 conftest.c >&5 +configure:3215: $? = 0 +configure:3288: gcc -o conftest -g -O2 conftest.c >&5 +configure:3288: $? = 0 +configure:3288: ./conftest +configure:3288: $? = 0 +configure:3299: result: yes +configure:3314: checking for special C compiler options needed for large files +configure:3359: result: no +configure:3365: checking for _FILE_OFFSET_BITS value needed for large files +configure:3390: gcc -c -g -O2 conftest.c >&5 +conftest.c:15:33: warning: left shift count >= width of type [-Wshift-count-overflow] + #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + ^ +conftest.c:16:23: note: in expansion of macro 'LARGE_OFF_T' + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + ^ +conftest.c:15:57: warning: left shift count >= width of type [-Wshift-count-overflow] + #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + ^ +conftest.c:16:23: note: in expansion of macro 'LARGE_OFF_T' + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + ^ +conftest.c:15:33: warning: left shift count >= width of type [-Wshift-count-overflow] + #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + ^ +conftest.c:17:13: note: in expansion of macro 'LARGE_OFF_T' + && LARGE_OFF_T % 2147483647 == 1) + ^ +conftest.c:15:57: warning: left shift count >= width of type [-Wshift-count-overflow] + #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + ^ +conftest.c:17:13: note: in expansion of macro 'LARGE_OFF_T' + && LARGE_OFF_T % 2147483647 == 1) + ^ +conftest.c:16:7: error: variably modified 'off_t_is_large' at file scope + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + ^ +configure:3390: $? = 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 "" +| #define STDC_HEADERS 1 +| /* 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; +| } +configure:3414: gcc -c -g -O2 conftest.c >&5 +configure:3414: $? = 0 +configure:3422: result: 64 +configure:3517: checking for ptsname_r in -lc +configure:3542: gcc -o conftest -g -O2 conftest.c -lc >&5 +configure:3542: $? = 0 +configure:3551: result: yes +configure:3583: checking for sys/types.h +configure:3583: gcc -c -g -O2 conftest.c >&5 +configure:3583: $? = 0 +configure:3583: result: yes +configure:3583: checking for sys/stat.h +configure:3583: gcc -c -g -O2 conftest.c >&5 +configure:3583: $? = 0 +configure:3583: result: yes +configure:3583: checking for stdlib.h +configure:3583: gcc -c -g -O2 conftest.c >&5 +configure:3583: $? = 0 +configure:3583: result: yes +configure:3583: checking for string.h +configure:3583: gcc -c -g -O2 conftest.c >&5 +configure:3583: $? = 0 +configure:3583: result: yes +configure:3583: checking for memory.h +configure:3583: gcc -c -g -O2 conftest.c >&5 +configure:3583: $? = 0 +configure:3583: result: yes +configure:3583: checking for strings.h +configure:3583: gcc -c -g -O2 conftest.c >&5 +configure:3583: $? = 0 +configure:3583: result: yes +configure:3583: checking for inttypes.h +configure:3583: gcc -c -g -O2 conftest.c >&5 +configure:3583: $? = 0 +configure:3583: result: yes +configure:3583: checking for stdint.h +configure:3583: gcc -c -g -O2 conftest.c >&5 +configure:3583: $? = 0 +configure:3583: result: yes +configure:3583: checking for unistd.h +configure:3583: gcc -c -g -O2 conftest.c >&5 +configure:3583: $? = 0 +configure:3583: result: yes +configure:3595: checking sys/sendfile.h usability +configure:3595: gcc -c -g -O2 conftest.c >&5 +configure:3595: $? = 0 +configure:3595: result: yes +configure:3595: checking sys/sendfile.h presence +configure:3595: gcc -E conftest.c +configure:3595: $? = 0 +configure:3595: result: yes +configure:3595: checking for sys/sendfile.h +configure:3595: result: yes +configure:3634: checking for SSL_library_init in -lssl +configure:3659: gcc -o conftest -g -O2 conftest.c -lssl -lc >&5 +configure:3659: $? = 0 +configure:3668: result: yes +configure:3681: checking for EVP_CIPHER_CTX_init in -lcrypto +configure:3706: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +configure:3706: $? = 0 +configure:3715: result: yes +configure:3731: checking for OpenSSL_add_all_algorithms +configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +/tmp/ccWDByHS.o: In function `main': +/mnt/Movgrab-2.0.0/libUseful-2.6/conftest.c:59: undefined reference to `OpenSSL_add_all_algorithms' +collect2: error: ld returned 1 exit status +configure:3731: $? = 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 "" +| #define STDC_HEADERS 1 +| #define _FILE_OFFSET_BITS 64 +| #define HAVE_LIBC 1 +| #define HAVE_PTSNAME_R 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 USE_SENDFILE 1 +| #define HAVE_LIBSSL 1 +| #define HAVE_LIBCRYPTO 1 +| /* end confdefs.h. */ +| /* Define OpenSSL_add_all_algorithms to an innocuous variant, in case declares OpenSSL_add_all_algorithms. +| For example, HP-UX 11i declares gettimeofday. */ +| #define OpenSSL_add_all_algorithms innocuous_OpenSSL_add_all_algorithms +| +| /* System header to define __stub macros and hopefully few prototypes, +| which can conflict with char OpenSSL_add_all_algorithms (); below. +| Prefer to if __STDC__ is defined, since +| exists even on freestanding compilers. */ +| +| #ifdef __STDC__ +| # include +| #else +| # include +| #endif +| +| #undef OpenSSL_add_all_algorithms +| +| /* 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 OpenSSL_add_all_algorithms (); +| /* 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_OpenSSL_add_all_algorithms || defined __stub___OpenSSL_add_all_algorithms +| choke me +| #endif +| +| int +| main () +| { +| return OpenSSL_add_all_algorithms (); +| ; +| return 0; +| } +configure:3731: result: no +configure:3731: checking for EVP_bf_cbc +configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +configure:3731: $? = 0 +configure:3731: result: yes +configure:3731: checking for EVP_rc2_cbc +configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +configure:3731: $? = 0 +configure:3731: result: yes +configure:3731: checking for EVP_rc4 +configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +configure:3731: $? = 0 +configure:3731: result: yes +configure:3731: checking for EVP_rc5_32_12_16_cbc +configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +/tmp/ccK0AmXk.o: In function `main': +/mnt/Movgrab-2.0.0/libUseful-2.6/conftest.c:62: undefined reference to `EVP_rc5_32_12_16_cbc' +collect2: error: ld returned 1 exit status +configure:3731: $? = 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 "" +| #define STDC_HEADERS 1 +| #define _FILE_OFFSET_BITS 64 +| #define HAVE_LIBC 1 +| #define HAVE_PTSNAME_R 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 USE_SENDFILE 1 +| #define HAVE_LIBSSL 1 +| #define HAVE_LIBCRYPTO 1 +| #define HAVE_EVP_BF_CBC 1 +| #define HAVE_EVP_RC2_CBC 1 +| #define HAVE_EVP_RC4 1 +| /* end confdefs.h. */ +| /* Define EVP_rc5_32_12_16_cbc to an innocuous variant, in case declares EVP_rc5_32_12_16_cbc. +| For example, HP-UX 11i declares gettimeofday. */ +| #define EVP_rc5_32_12_16_cbc innocuous_EVP_rc5_32_12_16_cbc +| +| /* System header to define __stub macros and hopefully few prototypes, +| which can conflict with char EVP_rc5_32_12_16_cbc (); below. +| Prefer to if __STDC__ is defined, since +| exists even on freestanding compilers. */ +| +| #ifdef __STDC__ +| # include +| #else +| # include +| #endif +| +| #undef EVP_rc5_32_12_16_cbc +| +| /* 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_rc5_32_12_16_cbc (); +| /* 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_EVP_rc5_32_12_16_cbc || defined __stub___EVP_rc5_32_12_16_cbc +| choke me +| #endif +| +| int +| main () +| { +| return EVP_rc5_32_12_16_cbc (); +| ; +| return 0; +| } +configure:3731: result: no +configure:3731: checking for EVP_des_cbc +configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +configure:3731: $? = 0 +configure:3731: result: yes +configure:3731: checking for EVP_desx_cbc +configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +configure:3731: $? = 0 +configure:3731: result: yes +configure:3731: checking for EVP_cast5_cbc +configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +configure:3731: $? = 0 +configure:3731: result: yes +configure:3731: checking for EVP_idea_cbc +configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +configure:3731: $? = 0 +configure:3731: result: yes +configure:3731: checking for EVP_aes_128_cbc +configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +configure:3731: $? = 0 +configure:3731: result: yes +configure:3731: checking for EVP_aes_256_cbc +configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 +configure:3731: $? = 0 +configure:3731: result: yes +configure:3741: checking that OpenSSL Library is at least version 0.9.7 +configure:3755: result: yes +configure:3842: checking sys/soundcard.h usability +configure:3842: gcc -c -g -O2 conftest.c >&5 +configure:3842: $? = 0 +configure:3842: result: yes +configure:3842: checking sys/soundcard.h presence +configure:3842: gcc -E conftest.c +configure:3842: $? = 0 +configure:3842: result: yes +configure:3842: checking for sys/soundcard.h +configure:3842: result: yes +configure:4058: 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 colums-hp + +config.status:727: 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_func_EVP_aes_128_cbc=yes +ac_cv_func_EVP_aes_256_cbc=yes +ac_cv_func_EVP_bf_cbc=yes +ac_cv_func_EVP_cast5_cbc=yes +ac_cv_func_EVP_des_cbc=yes +ac_cv_func_EVP_desx_cbc=yes +ac_cv_func_EVP_idea_cbc=yes +ac_cv_func_EVP_rc2_cbc=yes +ac_cv_func_EVP_rc4=yes +ac_cv_func_EVP_rc5_32_12_16_cbc=no +ac_cv_func_OpenSSL_add_all_algorithms=no +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_sendfile_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_lib_c_ptsname_r=yes +ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes +ac_cv_lib_ssl_SSL_library_init=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 +ac_cv_sys_file_offset_bits=64 +ac_cv_sys_largefile_CC=no + +## ----------------- ## +## 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 -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' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='/bin/grep -E' +EXEEXT='' +GREP='/bin/grep' +LDFLAGS='' +LIBOBJS='' +LIBS='-lcrypto -lssl -lc ' +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 _FILE_OFFSET_BITS 64 +#define HAVE_LIBC 1 +#define HAVE_PTSNAME_R 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 USE_SENDFILE 1 +#define HAVE_LIBSSL 1 +#define HAVE_LIBCRYPTO 1 +#define HAVE_EVP_BF_CBC 1 +#define HAVE_EVP_RC2_CBC 1 +#define HAVE_EVP_RC4 1 +#define HAVE_EVP_DES_CBC 1 +#define HAVE_EVP_DESX_CBC 1 +#define HAVE_EVP_CAST5_CBC 1 +#define HAVE_EVP_IDEA_CBC 1 +#define HAVE_EVP_AES_128_CBC 1 +#define HAVE_EVP_AES_256_CBC 1 +#define USE_OPENSSL_ADD_ALL_ALGORITHMS 1 +#define HAVE_OSS 1 + +configure: exit 0 diff --git a/libUseful-2.6/config.status b/libUseful-2.6/config.status new file mode 100755 index 0000000..5c5f067 --- /dev/null +++ b/libUseful-2.6/config.status @@ -0,0 +1,894 @@ +#! /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="'--disable-option-checking' '--prefix=/usr/local' '--enable-ssl' '--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='/mnt/Movgrab-2.0.0/libUseful-2.6' +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' '--disable-option-checking' '--prefix=/usr/local' '--enable-ssl' '--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"]="-lcrypto -lssl -lc " +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"\ +" -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" +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.4/configure b/libUseful-2.6/configure similarity index 99% rename from libUseful-2.4/configure rename to libUseful-2.6/configure index 10b6977..06db83d 100755 --- a/libUseful-2.4/configure +++ b/libUseful-2.6/configure @@ -3551,10 +3551,16 @@ 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 : - cf_have_ptsname_r=yes + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBC 1 +_ACEOF + + LIBS="-lc $LIBS" + fi -if test "$cf_have_ptsname_r" = "yes" +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 diff --git a/libUseful-2.4/configure.ac b/libUseful-2.6/configure.ac old mode 100644 new mode 100755 similarity index 96% rename from libUseful-2.4/configure.ac rename to libUseful-2.6/configure.ac index 31fc85b..b51a769 --- a/libUseful-2.4/configure.ac +++ b/libUseful-2.6/configure.ac @@ -19,8 +19,9 @@ cf_have_sendfile=no cf_have_ptsname_r=no -AC_CHECK_LIB(c,[ptsname_r],[cf_have_ptsname_r=yes]) -if test "$cf_have_ptsname_r" = "yes" +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 diff --git a/libUseful-2.4/crc32.c b/libUseful-2.6/crc32.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/crc32.c rename to libUseful-2.6/crc32.c diff --git a/libUseful-2.4/crc32.h b/libUseful-2.6/crc32.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/crc32.h rename to libUseful-2.6/crc32.h diff --git a/libUseful-2.4/defines.h b/libUseful-2.6/defines.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/defines.h rename to libUseful-2.6/defines.h diff --git a/libUseful-2.4/expect.c b/libUseful-2.6/expect.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/expect.c rename to libUseful-2.6/expect.c diff --git a/libUseful-2.4/expect.h b/libUseful-2.6/expect.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/expect.h rename to libUseful-2.6/expect.h diff --git a/libUseful-2.4/file.c b/libUseful-2.6/file.c old mode 100644 new mode 100755 similarity index 91% rename from libUseful-2.4/file.c rename to libUseful-2.6/file.c index 4d65cd8..fd904e5 --- a/libUseful-2.4/file.c +++ b/libUseful-2.6/file.c @@ -94,7 +94,7 @@ int val; //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 & STREAM_NONBLOCK) val |= O_NONBLOCK; + if (S->Flags & SF_NONBLOCK) val |= O_NONBLOCK; else val &= (~O_NONBLOCK); //these two sets of flags should be the same @@ -105,7 +105,7 @@ int val; //F_GETFD, NOT F_GETFL as above val=fcntl(S->in_fd,F_GETFD, NULL); //Handling close-on-exec flag - if (S->Flags & STREAM_EXEC_INHERIT) val &= (~FD_CLOEXEC); + if (S->Flags & SF_EXEC_INHERIT) val &= (~FD_CLOEXEC); else val |= FD_CLOEXEC; //NOTE F_SETFD IS NOT SAME AS F_SETFL ABOVE! @@ -135,17 +135,17 @@ S->BlockSize=BlockSize; /* the file pointer to that position */ void STREAMResizeBuffer(STREAM *S, int size) { - if (S->Flags & STREAM_MMAP) return; + if (S->Flags & SF_MMAP) return; - if (S->Flags & STREAM_SECURE) + if (S->Flags & SF_SECURE) { - if (! (S->Flags & STREAM_WRONLY)) SecureRealloc(&S->InputBuff, S->BuffSize, size, SMEM_SECURE); - if (! (S->Flags & STREAM_RDONLY)) SecureRealloc(&S->OutputBuff, S->BuffSize, size, SMEM_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 & STREAM_WRONLY)) S->InputBuff =(char *) realloc(S->InputBuff,size); - if (! (S->Flags & STREAM_RDONLY)) S->OutputBuff=(char *) realloc(S->OutputBuff,size); + 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; @@ -167,7 +167,7 @@ struct stat Stat; if (S->InEnd > S->InStart) return(TRUE); if (S->in_fd==-1) return(FALSE); - if (S->Flags & STREAM_FOLLOW) + if (S->Flags & SF_FOLLOW) { while (1) { @@ -321,16 +321,16 @@ else if (result == 0) return(STREAM_TIMEOUT); } - if (S->Flags & STREAM_WRLOCK) flock(S->out_fd,LOCK_EX); + 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 & STREAM_WRLOCK) flock(S->out_fd,LOCK_UN); + 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 & STREAM_NOCACHE) posix_fadvise(S->out_fd, 0,0,POSIX_FADV_DONTNEED); + if (S->Flags & SF_NOCACHE) posix_fadvise(S->out_fd, 0,0,POSIX_FADV_DONTNEED); #endif } @@ -502,14 +502,14 @@ char *ptr; int MProt=PROT_READ; if (S->InputBuff) free(S->InputBuff); -if (Flags & (STREAM_WRONLY | STREAM_RDWR)) MProt |= PROT_WRITE; +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 |= STREAM_MMAP; +S->Flags |= SF_MMAP; S->InputBuff=ptr; -if (Flags & STREAM_SECURE) mlock(ptr, len); +if (Flags & SF_SECURE) mlock(ptr, len); return(TRUE); } @@ -521,25 +521,24 @@ int fd, Mode=0; STREAM *Stream; struct stat myStat; -if (Flags & STREAM_WRONLY) Mode=O_WRONLY; -else if (Flags & STREAM_RDONLY) Mode=O_RDONLY; +if (Flags & SF_WRONLY) Mode=O_WRONLY; +else if (Flags & SF_RDONLY) Mode=O_RDONLY; else Mode=O_RDWR; -if (Flags & STREAM_CREATE) Mode |= O_CREAT; +if (Flags & SF_CREATE) Mode |= O_CREAT; if (strcmp(FilePath,"-")==0) { - Stream=STREAMFromDualFD(0,1); - Stream->Path=CopyStr(Stream->Path,FilePath); - Stream->Flags=Flags; +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 & STREAM_WRLOCK) + if (Flags & SF_WRLOCK) { if (flock(fd,LOCK_EX | LOCK_NB)==-1) { @@ -548,7 +547,7 @@ else } } - if (Flags & STREAM_RDLOCK) + if (Flags & SF_RDLOCK) { if (flock(fd,LOCK_SH | LOCK_NB)==-1) { @@ -563,7 +562,7 @@ else // to get us to write somewhere other than intended. - if (! (Flags & STREAM_SYMLINK_OK)) + if (! (Flags & SF_SYMLINK_OK)) { if (lstat(FilePath, &myStat) !=0) { @@ -587,16 +586,16 @@ else Stream=STREAMFromFD(fd); STREAMSetTimeout(Stream,0); - if ( (Flags & (STREAM_RDONLY | STREAM_MMAP)) == (STREAM_RDONLY | STREAM_MMAP) ) STREAMOpenMMap(Stream, 0, myStat.st_size, Flags); + if ( (Flags & (SF_RDONLY | SF_MMAP)) == (SF_RDONLY | SF_MMAP) ) STREAMOpenMMap(Stream, 0, myStat.st_size, Flags); else { - if (Flags & STREAM_TRUNC) ftruncate(fd,0); - if (Flags & STREAM_APPEND) lseek(fd,0,SEEK_END); + if (Flags & SF_TRUNC) ftruncate(fd,0); + if (Flags & SF_APPEND) lseek(fd,0,SEEK_END); } } Stream->Flags |= Flags; -if (Stream->Flags & STREAM_SECURE) STREAMResizeBuffer(Stream, Stream->BuffSize); +if (Stream->Flags & SF_SECURE) STREAMResizeBuffer(Stream, Stream->BuffSize); Stream->Path=CopyStr(Stream->Path,FilePath); STREAMSetFlushType(Stream,FLUSH_FULL,0,0); @@ -622,13 +621,10 @@ if ( if ((S->out_fd != -1) && (S->out_fd != S->in_fd)) { #ifdef POSIX_FADV_DONTNEED - if (S->Flags & STREAM_NOCACHE) + if (S->Flags & SF_NOCACHE) { - //if we've got fdatasync as well as fadvise we can do this - #ifdef fdatasync fdatasync(S->out_fd); posix_fadvise(S->out_fd, 0,0,POSIX_FADV_DONTNEED); - #endif } #endif @@ -638,7 +634,7 @@ if ( if (S->in_fd != -1) { #ifdef POSIX_FADV_DONTNEED - if (S->Flags & STREAM_NOCACHE) posix_fadvise(S->in_fd, 0,0,POSIX_FADV_DONTNEED); + if (S->Flags & SF_NOCACHE) posix_fadvise(S->in_fd, 0,0,POSIX_FADV_DONTNEED); #endif close(S->in_fd); @@ -656,14 +652,14 @@ while (Curr) Curr=ListGetNext(Curr); } -if (S->Flags & STREAM_SECURE) +if (S->Flags & SF_SECURE) { SecureDestroy(S->InputBuff,S->BuffSize); SecureDestroy(S->OutputBuff,S->BuffSize); } else { - if (! (S->Flags & STREAM_MMAP)) DestroyString(S->InputBuff); + if (! (S->Flags & SF_MMAP)) DestroyString(S->InputBuff); DestroyString(S->OutputBuff); } @@ -683,7 +679,7 @@ int fd; if (! S) return(-1); fd=S->in_fd; STREAMFlush(S); -if (! (S->Flags & STREAM_MMAP)) DestroyString(S->InputBuff); +if (! (S->Flags & SF_MMAP)) DestroyString(S->InputBuff); DestroyString(S->OutputBuff); DestroyString(S->Path); free(S); @@ -710,7 +706,7 @@ if (! S) return(0); if (S->State & SS_EMBARGOED) return(0); //we don't read to mmaped streams. We just update pointers to the mmap -if (S->Flags & STREAM_MMAP) +if (S->Flags & SF_MMAP) { result=S->InEnd-S->InStart; if (result < 1) return(STREAM_CLOSED); @@ -752,7 +748,7 @@ if (SSL_pending((SSL *) SSL_CTX) > 0) WaitForBytes=FALSE; #endif -//if ((S->Timeout > 0) && (! (S->Flags & STREAM_NONBLOCK)) && WaitForBytes) +//if ((S->Timeout > 0) && (! (S->Flags & SF_NONBLOCK)) && WaitForBytes) if ((S->Timeout > 0) && WaitForBytes) { FD_ZERO(&selectset); @@ -799,9 +795,9 @@ if (read_result==0) else #endif { - if (S->Flags & STREAM_RDLOCK) flock(S->in_fd,LOCK_SH); + 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 & STREAM_RDLOCK) flock(S->in_fd,LOCK_UN); + if (S->Flags & SF_RDLOCK) flock(S->in_fd,LOCK_UN); } if (read_result > 0) @@ -835,7 +831,7 @@ return(read_result); } -inline int STREAMTransferBytesOut(STREAM *S, char *Dest, int DestSize) +int STREAMTransferBytesOut(STREAM *S, char *Dest, int DestSize) { int bytes; @@ -881,7 +877,7 @@ while (total < Buffsize) //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 & STREAM_MMAP) result=-1; + if (S->Flags & SF_MMAP) result=-1; else result=FDCheckForBytes(S->in_fd); if (result ==-1) @@ -910,7 +906,7 @@ double STREAMTell(STREAM *S) { double pos; -if (S->Flags & STREAM_MMAP) return((double) S->InStart); +if (S->Flags & SF_MMAP) return((double) S->InStart); if (S->OutEnd > 0) STREAMFlush(S); #ifdef _LARGEFILE64_SOURCE @@ -929,7 +925,7 @@ double STREAMSeek(STREAM *S, double offset, int whence) double pos; int wherefrom; -if (S->Flags & STREAM_MMAP) +if (S->Flags & SF_MMAP) { switch (whence) { @@ -1020,7 +1016,6 @@ const char *ptr; do { - //Calc avail space to queue into and queue if (o_len > 0) { avail=S->BuffSize - S->OutEnd; @@ -1038,9 +1033,12 @@ const char *ptr; } //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)) ) ) + if ( (S->OutEnd > S->StartPoint) && + ( + (S->OutEnd >= S->BuffSize) || + (S->Flags & FLUSH_ALWAYS) || + ((S->Flags & FLUSH_BLOCK) && (S->OutEnd > S->BlockSize)) + ) ) { //Any decision about how much to write takes place in InternalFinalWrite @@ -1375,7 +1373,7 @@ double Size, delta, pos; int result, inchar; -if (S->Flags & STREAM_MMAP) Size=S->InEnd; +if (S->Flags & SF_MMAP) Size=S->InEnd; else { fstat(S->in_fd, &Stat); @@ -1443,7 +1441,7 @@ char *Tempstr=NULL; if (!S) return(FALSE); -if (S->Flags & STREAM_SORTED) return(STREAMFindBinarySearch(S, Item, Delimiter, RetStr)); +if (S->Flags & SF_SORTED) return(STREAMFindBinarySearch(S, Item, Delimiter, RetStr)); Tempstr=STREAMReadLine(Tempstr, S); while (Tempstr) diff --git a/libUseful-2.4/file.h b/libUseful-2.6/file.h old mode 100644 new mode 100755 similarity index 89% rename from libUseful-2.4/file.h rename to libUseful-2.6/file.h index a3e1292..d721b2c --- a/libUseful-2.4/file.h +++ b/libUseful-2.6/file.h @@ -41,24 +41,24 @@ #define FLUSH_ALWAYS 4 #define FLUSH_BUFFER 8 -#define STREAM_RDWR 0 //is the default +#define SF_RDWR 0 //is the default //FLUSH_ flags go in this gap -#define STREAM_RDONLY 16 -#define STREAM_WRONLY 32 -#define STREAM_CREAT 64 -#define STREAM_CREATE 64 -#define STREAM_APPEND 128 -#define STREAM_TRUNC 256 -#define STREAM_MMAP 512 -#define STREAM_WRLOCK 1024 -#define STREAM_RDLOCK 2048 -#define STREAM_FOLLOW 4096 -#define STREAM_SECURE 8192 -#define STREAM_NONBLOCK 16384 -#define STREAM_EXEC_INHERIT 131072 -#define STREAM_SYMLINK_OK 262144 -#define STREAM_NOCACHE 524288 -#define STREAM_SORTED 1048576 +#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 @@ -83,6 +83,7 @@ #define STREAM_TYPE_SSL 5 #define STREAM_TYPE_HTTP 6 #define STREAM_TYPE_CHUNKED_HTTP 7 +#define STREAM_TYPE_MESSAGEBUS 8 #define O_LOCK O_NOCTTY diff --git a/libUseful-2.4/http.c b/libUseful-2.6/http.c old mode 100644 new mode 100755 similarity index 96% rename from libUseful-2.4/http.c rename to libUseful-2.6/http.c index fc279c6..4900f88 --- a/libUseful-2.4/http.c +++ b/libUseful-2.6/http.c @@ -1032,7 +1032,6 @@ int Port=0, Flags=0; STREAM *S; S=STREAMCreate(); - if (Info->Flags & HTTP_PROXY) { ParseURL(Info->Proxy, &Tempstr, &Host, &Token, &Logon, &Pass, NULL,NULL); @@ -1074,6 +1073,7 @@ if (Info->Flags & HTTP_TUNNEL) STREAMAddConnectionHop(S,Info->Proxy); Tempstr=FormatStr(Tempstr,"tcp:%s:%d",Host,Port); if (STREAMConnect(S,Tempstr,Flags)) { + S->Type=STREAM_TYPE_HTTP; HTTPSendHeaders(S,Info); } else @@ -1209,11 +1209,12 @@ STREAM *S; Info=HTTPInfoFromURL(Method, URL); -if (StrValid(ContentType)) +if (StrValid(ContentData)) { -Info->PostContentType=CopyStr(Info->PostContentType,ContentType); -Info->PostData=CopyStr(Info->PostData,ContentData); -Info->PostContentLength=ContentLength; + if (StrValid(ContentType)) Info->PostContentType=CopyStr(Info->PostContentType,ContentType); + else Info->PostContentType=CopyStr(Info->PostContentType,"application/x-www-form-urlencoded"); + Info->PostData=CopyStr(Info->PostData,ContentData); + Info->PostContentLength=ContentLength; } if (StrValid(Logon) || StrValid(Password)) @@ -1255,6 +1256,41 @@ while (result > 0) } +char *HTTPReadDocument(char *RetStr, STREAM *S) +{ +char *Tempstr=NULL, *ptr; +int result, bytes_read=0, len=0; + +ptr=STREAMGetValue(S, "HTTP:Content-Length"); +if (ptr) len=atoi(ptr); + +printf("HTTPREAD: %d [%s]\n",len, ptr); +if (len > 0) +{ + RetStr=SetStrLen(RetStr,len); + while (bytes_read < len) + { + result=STREAMReadBytes(S, RetStr+bytes_read,len-bytes_read); + if (result > 0) bytes_read+=result; + else break; + } + RetStr[bytes_read]='\0'; +} +else +{ + RetStr=CopyStr(RetStr,""); + Tempstr=STREAMReadLine(Tempstr, S); + while (Tempstr) + { + RetStr=CatStr(RetStr, Tempstr); + Tempstr=STREAMReadLine(Tempstr, S); + } +} + +DestroyString(Tempstr); +return(RetStr); +} + int HTTPDownload(char *URL,char *Login,char *Password, STREAM *S) { STREAM *Con; diff --git a/libUseful-2.4/http.h b/libUseful-2.6/http.h old mode 100644 new mode 100755 similarity index 98% rename from libUseful-2.4/http.h rename to libUseful-2.6/http.h index 88c9684..3e1b050 --- a/libUseful-2.4/http.h +++ b/libUseful-2.6/http.h @@ -109,14 +109,14 @@ 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); void HTTPSetUserAgent(char *AgentName); void HTTPSetProxy(char *Proxy); void HTTPSetFlags(int Flags); int HTTPGetFlags(); +char *HTTPReadDocument(char *RetStr, STREAM *S); +void HTTPCopyToSTREAM(STREAM *Con, STREAM *S); +int HTTPDownload(char *URL, char *Login, char *Password, STREAM *S); #ifdef __cplusplus } diff --git a/libUseful-2.4/includes.h b/libUseful-2.6/includes.h old mode 100644 new mode 100755 similarity index 97% rename from libUseful-2.4/includes.h rename to libUseful-2.6/includes.h index e9325e9..0c8ab02 --- a/libUseful-2.4/includes.h +++ b/libUseful-2.6/includes.h @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include diff --git a/libUseful-2.4/inet.c b/libUseful-2.6/inet.c old mode 100644 new mode 100755 similarity index 65% rename from libUseful-2.4/inet.c rename to libUseful-2.6/inet.c index a1abf5f..01037ef --- a/libUseful-2.4/inet.c +++ b/libUseful-2.6/inet.c @@ -56,7 +56,7 @@ return(RetStr); #define IPInfo_API_KEY "1261fcbf647ea02c165aa3bfa66810f0be453d8a1c2e7f653c0666d4e7e205f0" -int IPGeoLocate(char *IP, ListNode *Vars) +int IPInfoDBGeoLocate(char *IP, ListNode *Vars) { STREAM *S=NULL; char *ptr, *TagType=NULL, *TagData=NULL, *Tempstr=NULL, *Token=NULL; @@ -100,3 +100,47 @@ DestroyString(TagData); return(result); } + +int IPGeoLocate(const char *IP, ListNode *Vars) +{ +STREAM *S=NULL; +char *ptr, *Tempstr=NULL, *Token=NULL; +const char *DesiredTags[]={"CountryCode","CountryName","City","RegionName","Latitude","Longitude","TimeZone",NULL}; +int result=FALSE; + +printf("GEOZ: %s\n",IP); +if (! StrValid(IP)) return(FALSE); + +if (! IsIPAddress(IP)) Token=CopyStr(Token, LookupHostIP(IP)); +else Token=CopyStr(Token,IP); + +Tempstr=MCopyStr(Tempstr,"http://freegeoip.net/csv/",Token,NULL); + +S=HTTPGet(Tempstr, "", ""); +printf("GEOX: %d %s\n",S, Tempstr); +if (S) +{ + STREAMSetTimeout(S,100); + Tempstr=HTTPReadDocument(Tempstr,S); +printf("GEO2: %s\n",Tempstr); + ptr=GetToken(Tempstr, ",", &Token,0); //IP + ptr=GetToken(ptr, ",", &Token,0); //CountryCode + strlwr(Token); + SetVar(Vars,"CountryCode",Token); + ptr=GetToken(ptr, ",", &Token,0); //Country name + SetVar(Vars,"CountryName",Token); + ptr=GetToken(ptr, ",", &Token,0); //Region Code + ptr=GetToken(ptr, ",", &Token,0); //Region Name + SetVar(Vars,"RegionName",Token); + ptr=GetToken(ptr, ",", &Token,0); //City + SetVar(Vars,"City",Token); + STREAMClose(S); + result=TRUE; +} + + +DestroyString(Tempstr); +DestroyString(Token); + +return(result); +} diff --git a/libUseful-2.4/inet.h b/libUseful-2.6/inet.h old mode 100644 new mode 100755 similarity index 85% rename from libUseful-2.4/inet.h rename to libUseful-2.6/inet.h index f30ef78..472ced3 --- a/libUseful-2.4/inet.h +++ b/libUseful-2.6/inet.h @@ -10,7 +10,7 @@ extern "C" { char *ExtractFromWebpage(char *RetStr, char *URL, char *ExtractStr, int MinLength); char *GetExternalIP(char *RetStr); -int IPGeoLocate(char *IP, ListNode *Vars); +int IPGeoLocate(const char *IP, ListNode *Vars); #ifdef __cplusplus } diff --git a/libUseful-2.4/install-sh b/libUseful-2.6/install-sh old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/install-sh rename to libUseful-2.6/install-sh diff --git a/libUseful-2.4/jh_ref.c b/libUseful-2.6/jh_ref.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/jh_ref.c rename to libUseful-2.6/jh_ref.c diff --git a/libUseful-2.4/jh_ref.h b/libUseful-2.6/jh_ref.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/jh_ref.h rename to libUseful-2.6/jh_ref.h diff --git a/libUseful-2.6/libUseful-2.6.a b/libUseful-2.6/libUseful-2.6.a new file mode 100755 index 0000000..43adac1 Binary files /dev/null and b/libUseful-2.6/libUseful-2.6.a differ diff --git a/libUseful-2.6/libUseful-2.6.so b/libUseful-2.6/libUseful-2.6.so new file mode 100755 index 0000000..0a84b7a Binary files /dev/null and b/libUseful-2.6/libUseful-2.6.so differ diff --git a/libUseful-2.4/libUseful.h b/libUseful-2.6/libUseful.h old mode 100644 new mode 100755 similarity index 97% rename from libUseful-2.4/libUseful.h rename to libUseful-2.6/libUseful.h index 2296218..145c45a --- a/libUseful-2.4/libUseful.h +++ b/libUseful-2.6/libUseful.h @@ -41,6 +41,7 @@ #include "MathExpr.h" #include "PatternMatch.h" #include "SpawnPrograms.h" +#include "MessageBus.h" #include "ParseURL.h" #include "sound.h" #include "pty.h" diff --git a/libUseful-2.4/libsettings.c b/libUseful-2.6/libsettings.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/libsettings.c rename to libUseful-2.6/libsettings.c diff --git a/libUseful-2.4/libsettings.h b/libUseful-2.6/libsettings.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/libsettings.h rename to libUseful-2.6/libsettings.h diff --git a/libUseful-2.4/list.c b/libUseful-2.6/list.c old mode 100644 new mode 100755 similarity index 97% rename from libUseful-2.4/list.c rename to libUseful-2.6/list.c index 65003c3..df13e88 --- a/libUseful-2.4/list.c +++ b/libUseful-2.6/list.c @@ -120,24 +120,32 @@ void ListDestroy(ListNode *ListStart, LIST_ITEM_DESTROY_FUNC ItemDestroyer) } -ListNode *ListClone(ListNode *ListStart, LIST_ITEM_CLONE_FUNC ItemCloner) +void ListAppendItems(ListNode *Dest, ListNode *Src, LIST_ITEM_CLONE_FUNC ItemCloner) { - ListNode *Curr,*NewList; + ListNode *Curr; void *Item; - if (! ItemCloner) return(NULL); - NewList=ListCreate(); - - Curr=ListGetNext(ListStart); + Curr=ListGetNext(Src); while (Curr !=NULL) { if (ItemCloner) { Item=ItemCloner(Curr->Item); - ListAddNamedItem(NewList,Curr->Tag,Item); + ListAddNamedItem(Dest,Curr->Tag,Item); } - Curr=ListGetNext(Curr); + else ListAddNamedItem(Dest, Curr->Tag, Curr->Item); + Curr=ListGetNext(Curr); } +} + + +ListNode *ListClone(ListNode *ListStart, LIST_ITEM_CLONE_FUNC ItemCloner) +{ + ListNode *NewList; + + NewList=ListCreate(); + + ListAppendItems(NewList, ListStart, ItemCloner); return(NewList); } diff --git a/libUseful-2.4/list.h b/libUseful-2.6/list.h old mode 100644 new mode 100755 similarity index 96% rename from libUseful-2.4/list.h rename to libUseful-2.6/list.h index d2195eb..1db2d1c --- a/libUseful-2.4/list.h +++ b/libUseful-2.6/list.h @@ -1,6 +1,8 @@ #ifndef LIB_USEFUL_LIST #define LIB_USEFUL_LIST +#include + #define LIST_FLAG_DELETE 1 #define LIST_FLAG_CASE 2 #define LIST_FLAG_SELFORG 4 @@ -73,6 +75,7 @@ ListNode *ListFindNamedItem(ListNode *Head, const char *Name); ListNode *ListFindItem(ListNode *Head, void *Item); ListNode *ListJoin(ListNode *, ListNode *); ListNode *ListClone(ListNode *, LIST_ITEM_CLONE_FUNC); +void ListAppendItems(ListNode *Dest, ListNode *Src, LIST_ITEM_CLONE_FUNC ItemCloner); void ListSort(ListNode *, void *Data, int (*LessThanFunc)(void *, void *, void *)); void ListSortNamedItems(ListNode *List); diff --git a/libUseful-2.4/md5-global.h b/libUseful-2.6/md5-global.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/md5-global.h rename to libUseful-2.6/md5-global.h diff --git a/libUseful-2.4/md5.h b/libUseful-2.6/md5.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/md5.h rename to libUseful-2.6/md5.h diff --git a/libUseful-2.4/md5c.c b/libUseful-2.6/md5c.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/md5c.c rename to libUseful-2.6/md5c.c diff --git a/libUseful-2.4/mmap.c b/libUseful-2.6/mmap.c old mode 100644 new mode 100755 similarity index 76% rename from libUseful-2.4/mmap.c rename to libUseful-2.6/mmap.c index 02ff2ac..18afdb3 --- a/libUseful-2.4/mmap.c +++ b/libUseful-2.6/mmap.c @@ -5,7 +5,7 @@ main() STREAM *S; char *Tempstr=NULL; -S=STREAMOpenFile("/etc/services",STREAM_RDONLY | STREAM_MMAP); +S=STREAMOpenFile("/etc/services",SF_RDONLY | SF_MMAP); Tempstr=STREAMReadLine(Tempstr, S); while (Tempstr) { diff --git a/libUseful-2.4/mmap.exe b/libUseful-2.6/mmap.exe similarity index 100% rename from libUseful-2.4/mmap.exe rename to libUseful-2.6/mmap.exe diff --git a/libUseful-2.4/oauth.c b/libUseful-2.6/oauth.c old mode 100644 new mode 100755 similarity index 95% rename from libUseful-2.4/oauth.c rename to libUseful-2.6/oauth.c index a6a84dc..6d75cb6 --- a/libUseful-2.4/oauth.c +++ b/libUseful-2.6/oauth.c @@ -9,11 +9,11 @@ char *Name=NULL, *Value=NULL, *ptr; ptr=GetNameValuePair(TagData," ","=",&Name,&Value); while (ptr) { -if (strcasecmp(Name,"type")==0) *RType=HtmlDeQuote(*RType,Value); -if (strcasecmp(Name,"name")==0) *RName=HtmlDeQuote(*RName,Value); -if (strcasecmp(Name,"value")==0) *RValue=HtmlDeQuote(*RValue,Value); -if (strcasecmp(Name,"method")==0) *RType=HtmlDeQuote(*RType,Value); -if (strcasecmp(Name,"action")==0) *RValue=HtmlDeQuote(*RValue,Value); +if (strcasecmp(Name,"type")==0) *RType=HtmlUnQuote(*RType,Value); +if (strcasecmp(Name,"name")==0) *RName=HtmlUnQuote(*RName,Value); +if (strcasecmp(Name,"value")==0) *RValue=HtmlUnQuote(*RValue,Value); +if (strcasecmp(Name,"method")==0) *RType=HtmlUnQuote(*RType,Value); +if (strcasecmp(Name,"action")==0) *RValue=HtmlUnQuote(*RValue,Value); ptr=GetNameValuePair(ptr," ","=",&Name,&Value); } diff --git a/libUseful-2.4/oauth.h b/libUseful-2.6/oauth.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/oauth.h rename to libUseful-2.6/oauth.h diff --git a/libUseful-2.4/openssl.c b/libUseful-2.6/openssl.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/openssl.c rename to libUseful-2.6/openssl.c diff --git a/libUseful-2.4/openssl.h b/libUseful-2.6/openssl.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/openssl.h rename to libUseful-2.6/openssl.h diff --git a/libUseful-2.4/proctitle.c b/libUseful-2.6/proctitle.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/proctitle.c rename to libUseful-2.6/proctitle.c diff --git a/libUseful-2.4/proctitle.h b/libUseful-2.6/proctitle.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/proctitle.h rename to libUseful-2.6/proctitle.h diff --git a/libUseful-2.4/pty.c b/libUseful-2.6/pty.c old mode 100644 new mode 100755 similarity index 93% rename from libUseful-2.4/pty.c rename to libUseful-2.6/pty.c index b80036c..792e767 --- a/libUseful-2.4/pty.c +++ b/libUseful-2.6/pty.c @@ -136,6 +136,8 @@ else tty_data.c_cc[VTIME]=0; } +//Higher line speeds protected with #ifdef because not all +//operating systems seem to have them if (LineSpeed > 0) { switch (LineSpeed) @@ -145,7 +147,6 @@ case 4800: val=B4800; break; case 9600: val=B9600; break; case 19200: val=B19200; break; case 38400: val=B38400; break; - #ifdef B57600 case 57600: val=B57600; break; #endif @@ -196,22 +197,23 @@ DestroyString(Tempstr); + int OpenTTY(char *devname, int LineSpeed, int Flags) { int tty, flags=O_RDWR | O_NOCTTY; -if (Flags & TTYFLAG_NONBLOCK) +if (Flags & TTYFLAG_NONBLOCK) { - //O_NDELAY should be used only if nothing else available - //as O_NONBLOCK is more 'posixy' - #ifdef O_NDELAY - flags |= O_NDELAY; - #endif - - #ifdef O_NONBLOCK - flags |= O_NONBLOCK; - #endif + //O_NDELAY should be used only if nothing else available + //as O_NONBLOCK is more 'posixy' + #ifdef O_NDELAY + flags |= O_NDELAY; + #endif + + #ifdef O_NONBLOCK + flags |= O_NONBLOCK; + #endif } tty=open(devname, flags); @@ -223,13 +225,13 @@ return(tty); - - int GrabPseudoTTY(int *pty, int *tty, int TermFlags) { char c1,c2; char *Tempstr=NULL; +#ifdef __GNU_LIBRARY__ +#ifdef HAVE_PTSNAME_R //first try unix98 style *pty=open("/dev/ptmx",O_RDWR); if (*pty > -1) @@ -237,11 +239,7 @@ if (*pty > -1) grantpt(*pty); unlockpt(*pty); 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)) { if ( (*tty=open(Tempstr,O_RDWR)) >-1) @@ -252,6 +250,8 @@ if (*pty > -1) } close(*pty); } +#endif +#endif //if unix98 fails, try old BSD style diff --git a/libUseful-2.4/pty.h b/libUseful-2.6/pty.h old mode 100644 new mode 100755 similarity index 84% rename from libUseful-2.4/pty.h rename to libUseful-2.6/pty.h index 82f22c0..198391c --- a/libUseful-2.4/pty.h +++ b/libUseful-2.6/pty.h @@ -3,15 +3,15 @@ #include "defines.h" -#define TTYFLAG_ECHO 256 -#define TTYFLAG_CRLF 512 -#define TTYFLAG_LFCR 1024 -#define TTYFLAG_NONBLOCK 2048 #define TTYFLAG_CANON 4096 #define TTYFLAG_HARDWARE_FLOW 8192 #define TTYFLAG_SOFTWARE_FLOW 16324 #define TTYFLAG_CRLF_KEEP 32768 #define TTYFLAG_IGNSIG 65536 +#define TTYFLAG_ECHO 131072 +#define TTYFLAG_CRLF 262144 +#define TTYFLAG_LFCR 524288 +#define TTYFLAG_NONBLOCK 1048576 #define TEXT_STARS 1 #define TEXT_STAR_ONE 2 diff --git a/libUseful-2.4/securemem.c b/libUseful-2.6/securemem.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/securemem.c rename to libUseful-2.6/securemem.c diff --git a/libUseful-2.4/securemem.h b/libUseful-2.6/securemem.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/securemem.h rename to libUseful-2.6/securemem.h diff --git a/libUseful-2.4/sha1.c b/libUseful-2.6/sha1.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/sha1.c rename to libUseful-2.6/sha1.c diff --git a/libUseful-2.4/sha1.h b/libUseful-2.6/sha1.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/sha1.h rename to libUseful-2.6/sha1.h diff --git a/libUseful-2.4/sha2.c b/libUseful-2.6/sha2.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/sha2.c rename to libUseful-2.6/sha2.c diff --git a/libUseful-2.4/sha2.h b/libUseful-2.6/sha2.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/sha2.h rename to libUseful-2.6/sha2.h diff --git a/libUseful-2.4/socket.c b/libUseful-2.6/socket.c old mode 100644 new mode 100755 similarity index 94% rename from libUseful-2.4/socket.c rename to libUseful-2.6/socket.c index b82203f..842d8c9 --- a/libUseful-2.4/socket.c +++ b/libUseful-2.6/socket.c @@ -1,5 +1,6 @@ #include "socket.h" #include "ConnectionChain.h" +#include "ParseURL.h" #include "unix_socket.h" #include @@ -88,16 +89,23 @@ return(FALSE); } +//Socket options wrapped in ifdef statements to handle systems that lack certain options int SockSetOptions(int sock, int SetFlags, int UnsetFlags) { int result; result=TRUE; +#ifdef SO_BROADCAST if (SetFlags & SOCK_BROADCAST) result=setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &result,sizeof(int)); +#endif +#ifdef SO_DONTROUTE if (SetFlags & SOCK_DONTROUTE) result=setsockopt(sock, SOL_SOCKET, SO_DONTROUTE, &result,sizeof(int)); +#endif +#ifdef SO_REUSEPORT if (SetFlags & SOCK_REUSEPORT) result=setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &result,sizeof(int)); +#endif #ifdef IP_TRANSPARENT if (SetFlags & SOCK_TPROXY) result=setsockopt(sock, IPPROTO_IP, IP_TRANSPARENT, &result,sizeof(int)); @@ -107,20 +115,25 @@ if (SetFlags & SOCK_TPROXY) result=setsockopt(sock, IPPROTO_IP, IP_TRANSPARENT, if (SetFlags & SOCK_PEERCREDS) result=setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &result,sizeof(int)); #endif +#ifdef SO_KEEPALIVE //Default is KEEPALIVE ON setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &result,sizeof(int)); +#endif 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)); - +#ifdef SO_BROADCAST if (UnsetFlags & SOCK_BROADCAST) result=setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &result,sizeof(int)); +#endif +#ifdef SO_DONTROUTE if (UnsetFlags & SOCK_DONTROUTE) result=setsockopt(sock, SOL_SOCKET, SO_DONTROUTE, &result,sizeof(int)); +#endif +#ifdef SO_REUSEPORT if (UnsetFlags & SOCK_REUSEPORT) result=setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &result,sizeof(int)); +#endif #ifdef IP_TRANSPARENT if (UnsetFlags & SOCK_TPROXY) result=setsockopt(sock, IPPROTO_IP, IP_TRANSPARENT, &result,sizeof(int)); @@ -129,9 +142,17 @@ if (UnsetFlags & SOCK_TPROXY) result=setsockopt(sock, IPPROTO_IP, IP_TRANSPARENT #ifdef SO_PASSCRED if (UnsetFlags & SOCK_PEERCREDS) result=setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &result,sizeof(int)); #endif + +result=FALSE; +#ifdef SO_KEEPALIVE +if (SetFlags & SOCK_NOKEEPALIVE) setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &result,sizeof(int)); +#endif } + + + int SockSetAttribute(int sock, int Attrib, int Value) { @@ -217,8 +238,9 @@ const char *GetInterfaceIP(const char *Interface) } -//ICMP stuff is linux specific unfortunately -#ifdef SOL_IP +#ifdef __GNU_LIBRARY__ + + #include /*--------------------------------------------------------------------*/ @@ -239,7 +261,6 @@ unsigned short checksum(void *b, int len) result = ~sum; return result; } -#endif int ICMPSend(int sock, const char *Host, int Type, int Code, int TTL, char *Data, int len) @@ -249,10 +270,8 @@ char *Tempstr=NULL; int packet_len; static int seq=0; struct sockaddr_in sa; -int result=0; +int result; -//right now this will only work on linux which has SOL_IP -#ifdef SOL_IP result=TTL; if (setsockopt(sock, SOL_IP, IP_TTL, &result, sizeof(int)) != 0) return(0); @@ -270,14 +289,13 @@ 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)); -#endif - DestroyString(Tempstr); return(result); } +#endif int SockAddrCreate(struct sockaddr **ret_sa, int Family, const char *Addr, int Port) { @@ -321,12 +339,12 @@ return(salen); int UDPOpen(const char *Addr, int Port, int Flags) { - int result, Family=AF_INET6; + int result, Family=AF_INET; struct sockaddr *sa; socklen_t salen; int fd; - if (IsIP4Address(Addr)) Family=AF_INET; + if (IsIP6Address(Addr)) Family=AF_INET6; salen=SockAddrCreate(&sa, Family, Addr, Port); fd=socket(Family, SOCK_DGRAM,0); result=bind(fd, sa, salen); @@ -340,6 +358,29 @@ int UDPOpen(const char *Addr, int Port, int Flags) return(fd); } +int UDPRecv(int sock, char *Buffer, int len, char **Addr, int *Port) +{ + char *Tempstr=NULL; + struct sockaddr_in sa; + socklen_t salen; + int result; + int fd; + + salen=sizeof(sa); +result=recvfrom(sock, Buffer, len,0, &sa, &salen); +if (result > -1) +{ + *Addr=SetStrLen(*Addr,NI_MAXHOST); + Tempstr=SetStrLen(Tempstr,NI_MAXSERV); + getnameinfo((struct sockaddr *) &sa, salen, *Addr, NI_MAXHOST, Tempstr, NI_MAXSERV, NI_NUMERICHOST|NI_NUMERICSERV); + + *Port=atoi(Tempstr); +} + +DestroyString(Tempstr); + +return(result); +} @@ -367,6 +408,8 @@ return(UDPSend(S->out_fd, Host, Port, Data, len)); } + + #ifdef USE_INET6 int InitServerSock(int Type, const char *Address, int Port) { @@ -870,7 +913,7 @@ 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, STREAM_NONBLOCK); +if (! (Flags & CONNECT_NONBLOCK)) STREAMSetFlags(S, 0, SF_NONBLOCK); S->Type=STREAM_TYPE_TCP; result=TRUE; @@ -926,7 +969,7 @@ while (Curr) //just connect to host if ((HopNo==0) && StrLen(Host)) { - if (Flags & CONNECT_NONBLOCK) S->Flags |= STREAM_NONBLOCK; + if (Flags & CONNECT_NONBLOCK) S->Flags |= SF_NONBLOCK; //Flags are handled in this function S->in_fd=TCPConnectWithAttributes(Host,Port,Flags,TTL,ToS); @@ -940,7 +983,7 @@ if (result==TRUE) if (Flags & CONNECT_NONBLOCK) { S->State |=SS_CONNECTING; - S->Flags |=STREAM_NONBLOCK; + S->Flags |=SF_NONBLOCK; } else { diff --git a/libUseful-2.4/socket.h b/libUseful-2.6/socket.h old mode 100644 new mode 100755 similarity index 93% rename from libUseful-2.4/socket.h rename to libUseful-2.6/socket.h index 6f86099..b3a256a --- a/libUseful-2.4/socket.h +++ b/libUseful-2.6/socket.h @@ -33,6 +33,7 @@ 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); +int UDPRecv(int sock, char *Buffer, int len, char **Host, int *Port); /* Server Socket Funcs*/ @@ -53,7 +54,7 @@ int SendText(int sock, char *Text); int ReadText(int sock, char *Buffer, int MaxLen); int ReadToCR(int fd, char *Buffer, int MaxLen); - +int STREAMTCPConnect(STREAM *S, const char *Host, int Port, int TTL, int ToS, int Flags); int STREAMConnect(STREAM *S, const char *URL, int Flags); int STREAMIsConnected(STREAM *S); int DoPostConnect(STREAM *S, int Flags); diff --git a/libUseful-2.4/sound.c b/libUseful-2.6/sound.c old mode 100644 new mode 100755 similarity index 99% rename from libUseful-2.4/sound.c rename to libUseful-2.6/sound.c index 9633938..13f89a7 --- a/libUseful-2.4/sound.c +++ b/libUseful-2.6/sound.c @@ -187,7 +187,7 @@ TAudioInfo *AudioInfo=NULL; char *FourCharacter; STREAM *S; -S=STREAMOpenFile(FilePath,STREAM_RDONLY); +S=STREAMOpenFile(FilePath,SF_RDONLY); if (! S) return(NULL); FourCharacter=calloc(4, sizeof(char)); diff --git a/libUseful-2.4/sound.h b/libUseful-2.6/sound.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/sound.h rename to libUseful-2.6/sound.h diff --git a/libUseful-2.6/ssh.c b/libUseful-2.6/ssh.c new file mode 100755 index 0000000..3dcaf1b --- /dev/null +++ b/libUseful-2.6/ssh.c @@ -0,0 +1,83 @@ +#include "expect.h" +#include "ssh.h" +#include "pty.h" +#include "SpawnPrograms.h" + +STREAM *SSHConnect(const char *Host, int Port, const char *User, const char *Pass, const char *Command) +{ +ListNode *Dialog; +char *Tempstr=NULL, *KeyFile=NULL, *Token=NULL; +STREAM *S; +int val, i; + +Tempstr=MCopyStr(Tempstr,"ssh -2 -T ",User,"@",Host, " ", NULL ); + +if (Port > 0) +{ + Token=FormatStr(Token," -p %d ",Port); + Tempstr=CatStr(Tempstr,Token); +} + +if (strncmp(Pass,"keyfile:",8)==0) +{ + KeyFile=CopyStr(KeyFile, Pass+8); + Tempstr=MCatStr(Tempstr,"-i ",KeyFile," ",NULL); +} + +if (StrLen(Command)) +{ + if (strcmp(Command,"none")==0) Tempstr=CatStr(Tempstr, "-N "); + else Tempstr=MCatStr(Tempstr, "\"", Command, "\" ", NULL); +} +Tempstr=CatStr(Tempstr, " 2> /dev/null"); + +//Never use TTYFLAG_CANON here +S=STREAMSpawnCommand(Tempstr,COMMS_BY_PTY|TTYFLAG_CRLF|TTYFLAG_IGNSIG,""); + +printf("SSC: %d [%s]\n",S,Tempstr); + +if (StrLen(KeyFile)==0) +{ + Dialog=ListCreate(); + ExpectDialogAdd(Dialog, "Are you sure you want to continue connecting (yes/no)?", "yes\n", DIALOG_OPTIONAL); + ExpectDialogAdd(Dialog, "Permission denied", "", DIALOG_OPTIONAL | DIALOG_FAIL); + Tempstr=MCopyStr(Tempstr,User,"\n",NULL); + ExpectDialogAdd(Dialog, "ogin:", Tempstr, DIALOG_OPTIONAL); + Tempstr=MCopyStr(Tempstr,Pass,"\n",NULL); + ExpectDialogAdd(Dialog, "assword:", Tempstr, DIALOG_END); + STREAMExpectDialog(S, Dialog); + ListDestroy(Dialog,ExpectDialogDestroy); +} + +/* +STREAMSetTimeout(S,100); + +Tempstr=FormatStr(Tempstr,"okay %d %d\n",getpid(),time(NULL)); +STREAMWriteString("echo ",S); +STREAMWriteLine(Tempstr,S); +STREAMFlush(S); + +StripTrailingWhitespace(Tempstr); +for (i=0; i < 3; i++) +{ +Token=STREAMReadLine(Token,S); +StripTrailingWhitespace(Token); + +printf("SRL: [%s]\n",Token); +if ( StrLen(Token) && (strcmp(Tempstr,Token) ==0) ) break; +} + +if (i==3) +{ + printf("Mismatch! [%s] [%s]\n",Token,Tempstr); + STREAMClose(S); + S=NULL; +} +*/ + +DestroyString(Tempstr); +DestroyString(KeyFile); +DestroyString(Token); + +return(S); +} diff --git a/libUseful-2.6/ssh.h b/libUseful-2.6/ssh.h new file mode 100755 index 0000000..ef656e9 --- /dev/null +++ b/libUseful-2.6/ssh.h @@ -0,0 +1,8 @@ +#ifndef LIBUSEFUL_SSH +#define LIBUSEFUL_SSH + +#include "file.h" + +STREAM *SSHConnect(const char *Host, int Port, const char *User, const char *Pass, const char *Command); + +#endif diff --git a/libUseful-2.4/string.c b/libUseful-2.6/string.c old mode 100644 new mode 100755 similarity index 98% rename from libUseful-2.4/string.c rename to libUseful-2.6/string.c index c34795e..dd52a01 --- a/libUseful-2.4/string.c +++ b/libUseful-2.6/string.c @@ -228,12 +228,7 @@ Tempstr=InBuff; //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"); @@ -274,9 +269,7 @@ for (count=1; count < 100; count++) break; } -#ifndef USE_ALLOCA DestroyString(FmtStr); -#endif return(Tempstr); } @@ -577,7 +570,7 @@ return(-1); #define ESC 0x1B -char *DeQuoteStr(char *Buffer, const char *Line) +char *UnQuoteStr(char *Buffer, const char *Line) { char *out, *in; size_t olen=0; diff --git a/libUseful-2.4/string.h b/libUseful-2.6/string.h old mode 100644 new mode 100755 similarity index 97% rename from libUseful-2.4/string.h rename to libUseful-2.6/string.h index b624286..ca35f1a --- a/libUseful-2.4/string.h +++ b/libUseful-2.6/string.h @@ -47,7 +47,7 @@ void StripLeadingWhitespace(char *); void StripCRLF(char *); void StripQuotes(char *); char *QuoteCharsInStr(char *Buffer, const char *String,const char *QuoteChars); -char *DeQuoteStr(char *Buffer, const char *Line); +char *UnQuoteStr(char *Buffer, const char *Line); char *EnquoteStr(char *Out, const char *In); int MatchTokenFromList(const char *Token,const char **List, int Flags); int MatchLineStartFromList(const char *Token,char **List); diff --git a/libUseful-2.4/tar.c b/libUseful-2.6/tar.c old mode 100644 new mode 100755 similarity index 98% rename from libUseful-2.4/tar.c rename to libUseful-2.6/tar.c index 90c0ddf..94177ac --- a/libUseful-2.4/tar.c +++ b/libUseful-2.6/tar.c @@ -113,7 +113,7 @@ while (TarReadHeader(Tar, Vars)) else if (strcmp(ptr,"file")==0) { MakeDirPath(Path,0700); - S=STREAMOpenFile(Path,STREAM_WRONLY|STREAM_CREAT|STREAM_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")); @@ -262,7 +262,7 @@ for (i=0; i < Glob.gl_pathc; i++) } else { - S=STREAMOpenFile(Glob.gl_pathv[i],STREAM_RDONLY); + S=STREAMOpenFile(Glob.gl_pathv[i],SF_RDONLY); if (S) { TarWriteHeader(Tar, Glob.gl_pathv[i],&FStat); diff --git a/libUseful-2.4/tar.h b/libUseful-2.6/tar.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/tar.h rename to libUseful-2.6/tar.h diff --git a/libUseful-2.6/test.c b/libUseful-2.6/test.c new file mode 100755 index 0000000..335710b --- /dev/null +++ b/libUseful-2.6/test.c @@ -0,0 +1,76 @@ +#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); +} +*/ + + +void DumpVars(ListNode *Vars) +{ +ListNode *Curr; + +Curr=ListGetNext(Vars); +while (Curr) +{ +printf("%s = %s\n",Curr->Tag,Curr->Item); +Curr=ListGetNext(Curr); +} +} + + +int Tester(const char *Source, ListNode *Vars) +{ +char *Tempstr=NULL; + +Tempstr=FormatStr(Tempstr,"pid=%d&string=hello_back&val=%s",getpid(),GetVar(Vars,"integer")); +MessageBusWrite("parent", Tempstr); + +DestroyString(Tempstr); +return(TRUE); +} + + +main() +{ +char *Tempstr=NULL; +ListNode *Vars, *Streams; +STREAM *S; +int i; +char *IP[]={"217.33.140.70","8.8.8.8","4.2.2.1","88.198.48.36",NULL}; + +Vars=ListCreate(); +Streams=ListCreate(); +MessageBusRegister("proc:tester.test.func", 4, 10, Tester); +MessageBusRegister("http://freegeoip.net/xml/", 4, 10, NULL); + +printf("PARENT: %d\n",getpid()); +for (i=0; i < 4; i++) +{ +Tempstr=FormatStr(Tempstr,"string=hello&integer=%d",i); +MessageBusWrite("proc:tester.test.func", Tempstr); +MessageBusWrite("http://freegeoip.net/xml/", IP[i]); + +MessageQueueAddToSelect(Streams); +S=STREAMSelect(Streams, NULL); +if (S) +{ + MessageBusRecv(S, &Tempstr, Vars); + DumpVars(Vars); +} +else printf("NO ACTIVITY!\n"); +sleep(1); +} + + +} diff --git a/libUseful-2.6/test.exe b/libUseful-2.6/test.exe new file mode 100755 index 0000000..7b3339e Binary files /dev/null and b/libUseful-2.6/test.exe differ diff --git a/libUseful-2.4/unix_socket.c b/libUseful-2.6/unix_socket.c old mode 100644 new mode 100755 similarity index 62% rename from libUseful-2.4/unix_socket.c rename to libUseful-2.6/unix_socket.c index 1a1b087..976e8f1 --- a/libUseful-2.4/unix_socket.c +++ b/libUseful-2.6/unix_socket.c @@ -3,6 +3,40 @@ #include #include +// crazyshit function because different implementations treat +// sun_path differently, so we have to derive a safe length for it! +void sun_set_path(struct sockaddr_un *sa, const char *Path) +{ +int len, val; +char *ptr1, *ptr2; +off_t pos; + +memset(sa,0,sizeof(struct sockaddr_un)); +sa->sun_family=AF_UNIX; +ptr1=sa->sun_path; +ptr2=(char *) sa; //sa is already a pointer, so we don't need & + +len=sizeof(struct sockaddr_un) - (ptr1-ptr2); + +if (len > 0) +{ + len--; //force room for terminating \0 + + //all hail strlcpy, makes life easier + #ifdef strlcpy + strlcpy(sa.sun_path,Path,len); + + //else grrrr + #else + val=strlen(Path); + if (val < len) len=val; + strncpy(sa->sun_path,Path,len); + sa->sun_path[len]='\0'; + #endif +} + +} + int OpenUnixSocket(const char *Path, int Type) { @@ -15,9 +49,7 @@ 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); +sun_set_path(&sa, Path); val=sizeof(sa); if (connect(sock,(struct sockaddr *) &sa,val)==0) return(sock); @@ -54,10 +86,7 @@ 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; +sun_set_path(&sa, Path); salen=sizeof(struct sockaddr_un); result=bind(sock,(struct sockaddr *) &sa, salen); diff --git a/libUseful-2.4/unix_socket.h b/libUseful-2.6/unix_socket.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/unix_socket.h rename to libUseful-2.6/unix_socket.h diff --git a/libUseful-2.4/whirlpool.c b/libUseful-2.6/whirlpool.c old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/whirlpool.c rename to libUseful-2.6/whirlpool.c diff --git a/libUseful-2.4/whirlpool.h b/libUseful-2.6/whirlpool.h old mode 100644 new mode 100755 similarity index 100% rename from libUseful-2.4/whirlpool.h rename to libUseful-2.6/whirlpool.h diff --git a/main.c b/main.c old mode 100644 new mode 100755 diff --git a/outputfiles.c b/outputfiles.c old mode 100644 new mode 100755 index 58807ef..d983e8c --- a/outputfiles.c +++ b/outputfiles.c @@ -122,7 +122,7 @@ if (strcmp(Path,"-")==0) } else { - S=STREAMOpenFile(Path, STREAM_CREAT | STREAM_RDWR); + S=STREAMOpenFile(Path, SF_CREAT | SF_RDWR); if (S) { if (! STREAMLock(S,LOCK_EX|LOCK_NB)) @@ -160,7 +160,7 @@ glob(Tempstr,0,0,&Glob); if (Glob.gl_pathc > 0) { -S=STREAMOpenFile(Glob.gl_pathv[0],STREAM_RDONLY); +S=STREAMOpenFile(Glob.gl_pathv[0],SF_RDONLY); } globfree(&Glob); diff --git a/outputfiles.h b/outputfiles.h old mode 100644 new mode 100755 diff --git a/servicetypes.c b/servicetypes.c old mode 100644 new mode 100755 index d716a83..4820812 --- a/servicetypes.c +++ b/servicetypes.c @@ -1045,7 +1045,7 @@ case TYPE_DAILYMOTION: if (strstr(Tempstr,DAILYMOTION_ITEM)) { - Token=DeQuoteStr(Token,Tempstr); + Token=UnQuoteStr(Token,Tempstr); ExtractDailyMotion(Token, DAILYMOTION_ITEM, DAILYMOTION_ITEM_END, Vars); } break; diff --git a/servicetypes.h b/servicetypes.h old mode 100644 new mode 100755 diff --git a/youtube.c b/youtube.c old mode 100644 new mode 100755 diff --git a/youtube.h b/youtube.h old mode 100644 new mode 100755