diff --git a/AUTHORS b/AUTHORS index b317b67..7d90c37 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,2 +1,5 @@ +-*- text -*- -$Id: AUTHORS,v 1.2 2002/01/28 23:43:34 dspiljar Exp $ +mboxgrep is written and maintained by Daniel Spiljar. + +$Id: AUTHORS,v 1.3 2005-11-16 01:37:18 dspiljar Exp $ diff --git a/ChangeLog b/ChangeLog index 5a84240..a51eb49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,133 @@ +Mon Oct 23 01:29:07 CEST 2006 Daniel Spiljar + + * src/mboxgrep.h, src/main.c, src/mbox.c, src/mbox.h, src/scan.c: + temporary mbox file (used for deleting messages) is now created + by tmpmbox_create(), tmpp global pointer is killed; portions of + code in scan.c are replaced by single call of mbox_write_message(); + scan.c no longer includes zlib.h and bzlib.h + +Thu Oct 19 03:50:38 CEST 2006 Daniel Spiljar + + * src/mboxgrep.h, src/main.c, src/maildir.c, src/scan.c: + got rid off tmpp and maildir_count global variables (code + cleanup) + +Thu Oct 19 03:38:24 CEST 2006 Daniel Spiljar + + * src/mboxgrep.h, src/main.c, src/scan.c: + introduction of the global runtime_t structure; mailbox counter, + MD5 hash and other global variables are now part of it (code + cleanup) + +Fri Jul 7 06:10:51 CEST 2006 Daniel Spiljar + + * src/mboxgrep.h, src/re.c, src/re.h, src/scan.c: + portions of scan_mailbox() have been moved to new functions, + pcre_match() and regex_match() (code cleanup) + +Thu Jul 6 13:54:23 CEST 2006 Daniel Spiljar + + * src/main.c, src/mboxgrep.h, src/re.c, src/re.h, src/scan.c: + main() has been partially uncluttered by moving portions of the + code to functions pcre_init() and regex_init() + +Thu Jul 6 12:49:59 CEST 2006 Daniel Spiljar + + * src/main.c, src/mboxgrep.h, src/misc.c, src/misc.h: + variables regex_s and haveregex are now part of the option_t + structure (code cleanup) + +Thu Jul 6 10:26:57 CEST 2006 Daniel Spiljar + + * src/main.c, src/misc.c, src/misc.h: + parts of main() have been moved to set_default_options() and + get_runtime_options() (code cleanup) + +Sat Jul 1 13:06:37 CEST 2006 Daniel Spiljar + + * src/mbox.c, src/mbox.h: + file mode and ownership-altering code has been moved to a separate + function, tmpfile_mod_own (code cleanup) + +Tue Jun 27 18:48:00 CEST 2006 Daniel Spiljar + + * src/mbox.c, src/mbox.h: + portions of the code from tmpfile_open moved to a new function, + tmpfile_name (code cleanup) + +Mon Feb 20 18:09:59 CET 2006 Daniel Spiljar + + * src/maildir.c, src/mh.c: + removed some unused variables (have_return_path) + +Mon Jan 30 01:35:30 CET 2006 Daniel Spiljar + + * src/mboxgrep.h, src/maildir.c, src/mh.c, src/mbox.c, src/scan.c, src/main.c: + boxname, outboxname, pipecmd and tmpfilename are now a part of + the config_t structure and no longer global variables + +Sat Jan 21 08:18:29 CET 2006 Daniel Spiljar + + * src/scan.c, src/misc.c, src/misc.h: + created postmark_print() to unclutter scan_mailbox() + +Fri Jan 20 05:36:44 CET 2006 Daniel Spiljar + + * src/misc.c, src/misc.h, src/mbox.c, src/maildir.c, src/mh.c: + some repetitive code moved to malloc_message() + +Fri Jan 20 05:13:06 CET 2006 Daniel Spiljar + + * src/mbox.c: + cleanup of mbox_write_message(); use of gzwrite_loop() and + bzwrite_loop() + +Fri Jan 20 03:57:28 CET 2006 Daniel Spiljar + + * src/scan.c, src/wrap.h, src/wrap.c: + wrote gzwrite_loop() and bzwrite_loop() to remove some repetitive + code from scan.c + +Fri Jan 20 02:11:50 CET 2006 Daniel Spiljar + + * src/scan.c: + md5_check_message(): array b and cast in strncmp are no longer + unsigned + +Wed Jan 18 01:48:56 CET 2006 Daniel Spiljar + + * src/info.c, src/mboxgrep.h: + updated copyright information, changed author's email address + to the one at Panix + +Mon Apr 12 19:30:52 CEST 2004 Daniel Spiljar + + * src/info.c: + updated copyright information + +Sun Apr 11 23:45:08 CEST 2004 Daniel Spiljar + + * src/mbox.h, src/mbox.c, src/scan.c, src/main.c: + mbox_write_message(); further fixes of message deletion code + +Thu Sep 18 00:10:13 CEST 2003 Daniel Spiljar + + * src/scan.c: + fixed deleting messages from mbox folders compressed with + bzip2 + +Thu Sep 18 00:08:36 CEST 2003 Daniel Spiljar + + * src/main.c, src/mbox.c: + moved James P. Dugal's ownership-preserving code from main() + to tmpfile_open() + +Sat Aug 30 23:13:01 CEST 2003 Vid Strpic + + * src/info.c: + If bzip2 support is compiled in, `--help' command should list + `bz2mbox' as a valid option to `--mailbox-format='. + Sun Aug 24 21:49:52 CEST 2003 Daniel Spiljar * doc/mboxgrep.1, doc/mboxgrep.texi: @@ -251,4 +381,4 @@ Tue Mar 27 01:26:22 CEST 2001 Daniel Spiljar -$Id: ChangeLog,v 1.37 2003/08/24 19:51:12 dspiljar Exp $ +$Id: ChangeLog,v 1.59 2006-10-22 23:34:47 dspiljar Exp $ diff --git a/INSTALL b/INSTALL new file mode 100755 index 0000000..e69de29 diff --git a/Makefile.in b/Makefile.in index 6a9c1c2..df7ee2e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -15,7 +15,7 @@ # along with mboxgrep; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# $Id: Makefile.in,v 1.1 2001/10/26 13:07:28 dspiljar Exp $ +# $Id: Makefile.in,v 1.1 2001-10-26 13:07:28 dspiljar Exp $ SHELL = /bin/sh diff --git a/NEWS b/NEWS index 10c2450..6b5f19b 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ Changes of mboxgrep =================== +Changes since 0.7.9 +- fixed compile bug on FreeBSD and other systems +- fixed deleting messages mbox folders compressed with bzip2 + Changes since 0.7.8 - implemented support for mbox folders compressed with bzip2 algorithm - improved detection of PCRE library; this also fixes a compilation bug @@ -103,4 +107,4 @@ Changes since 0.1.0 - added support for mailboxes generated by Gnus -$Id: NEWS,v 1.21 2003/08/24 19:23:48 dspiljar Exp $ +$Id: NEWS,v 1.23 2004-04-11 21:48:53 dspiljar Exp $ diff --git a/README b/README index 266bfab..b57bd97 100644 --- a/README +++ b/README @@ -7,7 +7,7 @@ which is provided both in manpage and texinfo format, to satisfy believers of both religions. The author of mboxgrep is Daniel Spiljar, who can be reached via email -at . Bug reports, feature requests and flames +at . Bug reports, feature requests and flames are welcome. If you intend to bundle mboxgrep with an operating system (such as a @@ -16,4 +16,4 @@ GNU/Linux distrubution, for example), please drop me a line about it. For build instructions, read the file `INSTALL', and run `./configure --help' -$Id: README,v 1.2 2002/12/02 20:53:07 dspiljar Exp $ +$Id: README,v 1.3 2006-01-18 00:09:56 dspiljar Exp $ diff --git a/TODO b/TODO index e297df2..c53fc78 100644 --- a/TODO +++ b/TODO @@ -23,4 +23,4 @@ - add support for mail folder conversion [ ] -$Id: TODO,v 1.16 2003/04/06 21:48:23 dspiljar Exp $ +$Id: TODO,v 1.16 2003-04-06 21:48:23 dspiljar Exp $ diff --git a/configure b/configure index e8599ec..45ad8fd 100755 --- a/configure +++ b/configure @@ -1,9 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57. +# Generated by GNU Autoconf 2.59. # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -20,9 +19,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -41,7 +41,7 @@ for as_var in \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -218,16 +218,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -629,7 +630,7 @@ done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir + localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in @@ -669,10 +670,10 @@ if test -z "$srcdir"; then # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -764,9 +765,9 @@ _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -852,12 +853,45 @@ case $srcdir in ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. @@ -868,13 +902,13 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then + test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi - cd $ac_popdir + cd "$ac_popdir" done fi @@ -882,8 +916,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -895,7 +928,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -972,19 +1005,19 @@ do 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. + ac_must_keep_next=false # Got value, back to normal. else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. @@ -1018,12 +1051,12 @@ _ASBOX case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } @@ -1052,7 +1085,7 @@ _ASBOX for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi @@ -1071,7 +1104,7 @@ _ASBOX echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core core.* *.core && + rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 @@ -1151,7 +1184,7 @@ fi # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" @@ -1168,13 +1201,13 @@ echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. @@ -1568,7 +1601,6 @@ ac_compiler=`set X $ac_compile; echo $2` (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1588,8 +1620,8 @@ ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 @@ -1609,23 +1641,23 @@ do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; + ;; conftest.$ac_ext ) - # This is the source file. - ;; + # This is the source file. + ;; [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; + # We found the default executable, but exeext='' is most + # certainly right. + break;; *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; * ) - break;; + break;; esac done else @@ -1699,8 +1731,8 @@ for ac_file in conftest.exe conftest conftest.*; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; + export ac_cv_exeext + break;; * ) break;; esac done @@ -1725,7 +1757,6 @@ if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1776,7 +1807,6 @@ if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1796,11 +1826,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1813,7 +1852,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi @@ -1829,7 +1868,6 @@ if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1846,11 +1884,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1863,7 +1910,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 @@ -1890,7 +1937,6 @@ else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1918,6 +1964,16 @@ static char *f (char * (*g) (char **, int), char **p, ...) va_end (v); return s; } + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -1944,11 +2000,20 @@ do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1961,7 +2026,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC @@ -1989,19 +2054,27 @@ cat >conftest.$ac_ext <<_ACEOF _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ - ''\ - '#include ' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -2009,14 +2082,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include $ac_declaration +#include int main () { @@ -2027,11 +2099,20 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2044,9 +2125,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2063,11 +2143,20 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2079,7 +2168,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -2093,7 +2182,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2136,6 +2225,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 @@ -2152,6 +2242,7 @@ do case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -2159,20 +2250,20 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi done done ;; @@ -2233,7 +2324,6 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2244,7 +2334,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2256,6 +2346,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2276,7 +2367,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2294,6 +2384,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2340,7 +2431,6 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2351,7 +2441,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2363,6 +2453,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2383,7 +2474,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2401,6 +2491,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2461,7 +2552,6 @@ if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2482,11 +2572,20 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2499,12 +2598,11 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2526,7 +2624,6 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2551,7 +2648,6 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2563,9 +2659,9 @@ cat >>conftest.$ac_ext <<_ACEOF # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -2576,7 +2672,7 @@ main () int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -2601,7 +2697,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -2629,7 +2725,6 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2649,11 +2744,20 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2666,7 +2770,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -2689,7 +2793,6 @@ else ac_func_search_save_LIBS=$LIBS ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2713,11 +2816,20 @@ opendir (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2729,12 +2841,12 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_opendir" = no; then for ac_lib in dir; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2758,11 +2870,20 @@ opendir (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2775,7 +2896,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS @@ -2796,7 +2918,6 @@ else ac_func_search_save_LIBS=$LIBS ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2820,11 +2941,20 @@ opendir (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2836,12 +2966,12 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_opendir" = no; then for ac_lib in x; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2865,11 +2995,20 @@ opendir (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2882,7 +3021,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS @@ -2963,11 +3103,20 @@ int main () _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2992,7 +3141,8 @@ See \`config.log' for more details." >&2;} fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext else { echo "$as_me:$LINENO: pcre-config not found" >&5 echo "$as_me: pcre-config not found" >&6;} @@ -3007,7 +3157,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lpcre $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3025,11 +3174,20 @@ main (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3042,7 +3200,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pcre_main=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pcre_main" >&5 @@ -3077,7 +3236,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3101,11 +3259,20 @@ gzopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3118,7 +3285,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_z_gzopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzopen" >&5 @@ -3150,7 +3318,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lbz2 $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3174,11 +3341,20 @@ BZ2_bzopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3191,7 +3367,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bz2_BZ2_bzopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bz2_BZ2_bzopen" >&5 @@ -3221,7 +3398,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3239,11 +3415,20 @@ main (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3256,7 +3441,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dmalloc_main=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dmalloc_main" >&5 @@ -3288,7 +3474,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lgarfield $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3312,11 +3497,20 @@ like_monday (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3329,7 +3523,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_garfield_like_monday=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_garfield_like_monday" >&5 @@ -3358,21 +3553,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -3403,11 +3605,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3420,7 +3631,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -3442,21 +3654,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -3487,11 +3706,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3504,7 +3732,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -3526,21 +3755,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -3571,11 +3807,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3588,7 +3833,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -3610,21 +3856,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -3655,11 +3908,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3672,7 +3934,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -3694,21 +3957,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -3739,11 +4009,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3756,7 +4035,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -3778,21 +4058,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -3823,11 +4110,20 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3840,7 +4136,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -3883,13 +4180,13 @@ _ACEOF # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -3919,13 +4216,13 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ + ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; +s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; -s/^[^=]*=[ ]*$//; +s/^[^=]*=[ ]*$//; }' fi @@ -3936,7 +4233,7 @@ ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' @@ -3980,9 +4277,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -4001,7 +4299,7 @@ for as_var in \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -4180,16 +4478,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -4216,7 +4515,7 @@ _ASBOX cat >&5 <<_CSEOF This file was extended by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4260,9 +4559,9 @@ Usage: $0 [OPTIONS] [FILE]... -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 + instantiate the configuration file FILE --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + instantiate the configuration header FILE Configuration files: $config_files @@ -4276,11 +4575,10 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.57, +configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir @@ -4511,9 +4809,9 @@ _ACEOF (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end @@ -4531,21 +4829,21 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4561,10 +4859,10 @@ echo X"$ac_file" | as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4602,12 +4900,45 @@ case $srcdir in ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac case $INSTALL in @@ -4615,11 +4946,6 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi # 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. */ @@ -4629,7 +4955,7 @@ echo "$as_me: creating $ac_file" >&6;} configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." + sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. @@ -4638,26 +4964,32 @@ echo "$as_me: creating $ac_file" >&6;} case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub @@ -4697,12 +5029,12 @@ cat >>$CONFIG_STATUS <<\_ACEOF # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' @@ -4711,11 +5043,11 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac @@ -4729,28 +5061,29 @@ echo "$as_me: creating $ac_file" >&6;} case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF @@ -4773,9 +5106,9 @@ s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times @@ -4789,13 +5122,13 @@ rm -f confdef2sed.sed # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail @@ -4804,7 +5137,7 @@ do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -4831,7 +5164,7 @@ do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -4865,10 +5198,10 @@ echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4884,10 +5217,10 @@ echo X"$ac_file" | as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } diff --git a/configure.ac b/configure.ac index b75b955..288736e 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ # along with mboxgrep; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# $Id: configure.ac,v 1.13 2003/08/10 22:45:45 dspiljar Exp $ +# $Id: configure.ac,v 1.13 2003-08-10 22:45:45 dspiljar Exp $ # Process this file with autoconf to produce a configure script. diff --git a/doc/Makefile.in b/doc/Makefile.in index 737e3fe..cf31019 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# $Id: Makefile.in,v 1.1 2001/10/26 13:07:55 dspiljar Exp $ +# $Id: Makefile.in,v 1.1 2001-10-26 13:07:55 dspiljar Exp $ MANPAGE = mboxgrep.1 INSTALL = @INSTALL@ diff --git a/doc/mboxgrep.1 b/doc/mboxgrep.1 index be0ca5c..6084ebe 100644 --- a/doc/mboxgrep.1 +++ b/doc/mboxgrep.1 @@ -1,4 +1,4 @@ -.Id $Id: mboxgrep.1,v 1.15 2003/08/24 19:51:14 dspiljar Exp $ +.Id $Id: mboxgrep.1,v 1.16 2006-01-18 00:09:58 dspiljar Exp $ .TH MBOXGREP 1 "24 Aug 2003" .SH NAME mboxgrep \- displays email messages matching a pattern @@ -119,4 +119,4 @@ well, little friend. .SH URL http://www.mboxgrep.org/ .SH AUTHOR -Daniel Spiljar +Daniel Spiljar diff --git a/doc/mboxgrep.info b/doc/mboxgrep.info index 3a9a5ac..333b9c6 100644 --- a/doc/mboxgrep.info +++ b/doc/mboxgrep.info @@ -1,4 +1,4 @@ -This is mboxgrep.info, produced by makeinfo version 4.3 from +This is mboxgrep.info, produced by makeinfo version 4.6 from mboxgrep.texi. INFO-DIR-SECTION Mail @@ -29,8 +29,8 @@ File: mboxgrep.info, Node: Introduction, Next: Invoking, Up: Top Introduction ************ - `mboxgrep' is a small, non-interactive utility that scans mail -folders for messages matching regular expressions. +`mboxgrep' is a small, non-interactive utility that scans mail folders +for messages matching regular expressions. It supports basic and extended POSIX regular expressions. `Perl'-style regular expressions are supported as well, if `mboxgrep' @@ -59,7 +59,7 @@ File: mboxgrep.info, Node: Invoking, Next: Examples, Prev: Introduction, Up: Command-Line Arguments ********************** - The syntax of `mboxgrep' invocation is: +The syntax of `mboxgrep' invocation is: mboxgrep [OPTIONS] PATTERN [MAILBOX] @@ -87,6 +87,7 @@ File: mboxgrep.info, Node: Miscellaneous, Next: File locking, Up: Invoking `-r' Descend into directories recursively. +  File: mboxgrep.info, Node: File locking, Next: Regexp selection, Prev: Miscellaneous, Up: Invoking @@ -105,6 +106,7 @@ without locking. `-nl' Do not attempt to lock mbox folder files. +  File: mboxgrep.info, Node: Regexp selection, Next: Output control, Prev: File locking, Up: Invoking @@ -133,6 +135,7 @@ File: mboxgrep.info, Node: Regexp selection, Next: Output control, Prev: File Invert the sense of matching, i.e. select only non-matching messages. +  File: mboxgrep.info, Node: Output control, Next: Search scope selection, Prev: Regexp selection, Up: Invoking @@ -172,6 +175,7 @@ The options below change such behavior. `-s' Suppress error messages. +  File: mboxgrep.info, Node: Search scope selection, Next: Mailbox type selection, Prev: Output control, Up: Invoking @@ -183,22 +187,24 @@ File: mboxgrep.info, Node: Search scope selection, Next: Mailbox type selectio `-B' Match PATTERN against message body. +  File: mboxgrep.info, Node: Mailbox type selection, Prev: Search scope selection, Up: Invoking `--mailbox-format=FORMAT' `-m FORMAT' Specify mailbox FORMAT. Supported formats are `mbox' (default), - `zmbox' (gzip compressed mbox), `bzmbox' (bzip2 compressed mbox) + `zmbox' (gzip compressed mbox), `bz2mbox' (bzip2 compressed mbox) `mh', `nnml', `nnmh', and `maildir'. +  File: mboxgrep.info, Node: Examples, Next: Bugs, Prev: Invoking, Up: Top Examples ******** - Scan `$MAIL' for messages from Dirty Harry: +Scan `$MAIL' for messages from Dirty Harry: mboxgrep -H '^From:.*callahan@homicide\.SFPD\.gov' $MAIL @@ -226,10 +232,10 @@ File: mboxgrep.info, Node: Bugs, Next: To Vicky, Prev: Examples, Up: Top Detecting Vermin **************** - Shortly, if `mboxgrep' crashes and/or works differently than -described in this manual, you've found a bug. +Shortly, if `mboxgrep' crashes and/or works differently than described +in this manual, you've found a bug. - Please report bugs to . Instructions how to + Please report bugs to . Instructions how to reproduce the bug or output from a debugger would be highly appreciated. Don't, however, send any coredumps. @@ -239,8 +245,8 @@ File: mboxgrep.info, Node: To Vicky, Prev: Bugs, Up: Top Author's Dedication ******************* - `Mboxgrep' is dedicated in loving memory of Vicky, my cat who died -of tumor on Sep 12, 2002. +`Mboxgrep' is dedicated in loving memory of Vicky, my cat who died of +tumor on Sep 12, 2002. You haven't been long with us, but you gave us a lot of joy and all your big heart that stopped ticking too early. I will never forget you. @@ -251,15 +257,15 @@ Sleep well, little friend. Tag Table: Node: Top197 Node: Introduction598 -Node: Invoking1469 -Node: Miscellaneous1830 -Node: File locking2115 -Node: Regexp selection2756 -Node: Output control3307 -Node: Search scope selection4300 -Node: Mailbox type selection4541 -Node: Examples4862 -Node: Bugs5681 -Node: To Vicky6089 +Node: Invoking1466 +Node: Miscellaneous1824 +Node: File locking2110 +Node: Regexp selection2752 +Node: Output control3304 +Node: Search scope selection4298 +Node: Mailbox type selection4540 +Node: Examples4863 +Node: Bugs5679 +Node: To Vicky6080  End Tag Table diff --git a/doc/mboxgrep.texi b/doc/mboxgrep.texi index d8c5846..e62a4d0 100644 --- a/doc/mboxgrep.texi +++ b/doc/mboxgrep.texi @@ -1,5 +1,5 @@ \input texinfo @c -*-texinfo-*- -@c $Id: mboxgrep.texi,v 1.19 2003/08/24 19:51:14 dspiljar Exp $ +@c $Id: mboxgrep.texi,v 1.20 2006-01-18 00:09:58 dspiljar Exp $ @setfilename mboxgrep.info @settitle Grep through mailboxes @finalout @@ -260,7 +260,7 @@ mboxgrep -nd -c . spam Shortly, if @code{mboxgrep} crashes and/or works differently than described in this manual, you've found a bug. -Please report bugs to @email{dspiljar@@world.std.com}. +Please report bugs to @email{dspiljar@@panix.com}. Instructions how to reproduce the bug or output from a debugger would be highly appreciated. Don't, however, send any coredumps. diff --git a/mboxgrep.lsm b/mboxgrep.lsm index 4a4898d..8e13bce 100644 --- a/mboxgrep.lsm +++ b/mboxgrep.lsm @@ -10,8 +10,8 @@ Description: mboxgrep is a small utility that scans a mailbox for messages It supports mbox (both plain and compressed), MH, nnmh, nnml and maildir folders. Keywords: mail, mail-tools, mbox, MH, nnmh, nnml, maildir, regex -Author: dspiljar@world.std.com (Daniel Spiljar) -Maintained-by: dspiljar@world.std.com (Daniel Spiljar) +Author: dspiljar@panix.com (Daniel Spiljar) +Maintained-by: dspiljar@panix.com (Daniel Spiljar) Primary-site: http://www.mboxgrep.org/ 75k mboxgrep-0.7.9.tar.gz Alternate-site: diff --git a/src/Makefile.in b/src/Makefile.in index fc5ac74..c4ec13b 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,5 +1,5 @@ # mboxgrep - scan mailbox for messages matching a regular expression -# Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar +# Copyright (C) 2000, 2001, 2002, 2003, 2006 Daniel Spiljar # # Mboxgrep is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,15 +15,15 @@ # along with mboxgrep; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# $Id: Makefile.in,v 1.9 2003/03/30 23:07:10 dspiljar Exp $ +# $Id: Makefile.in,v 1.12 2006-07-07 04:38:53 dspiljar Exp $ srcdir = @srcdir@ CC = @CC@ OBJS = info.o main.o mh.o scan.o maildir.o mbox.o misc.o \ - wrap.o getopt.o getopt1.o md5.o + wrap.o getopt.o getopt1.o md5.o re.o SRCS = info.c main.c mh.c scan.c maildir.c mbox.c misc.c \ - wrap.c getopt.c getopt1.c md5.c + wrap.c getopt.c getopt1.c md5.c re.c TARGET = mboxgrep CFLAGS = @CFLAGS@ LIBS = @LIBS@ diff --git a/src/info.c b/src/info.c index 02abdff..22a0808 100644 --- a/src/info.c +++ b/src/info.c @@ -1,6 +1,6 @@ /* -*- C -*- mboxgrep - scan mailbox for messages matching a regular expression - Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar + Copyright (C) 2000 - 2004, 2006, 2010 Daniel Spiljar Mboxgrep is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: info.c,v 1.19 2003/04/13 19:15:58 dspiljar Exp $ */ + $Id: info.c,v 1.22 2006-01-18 00:44:36 dspiljar Exp $ */ #include @@ -48,7 +48,7 @@ version (void) int n = 0; fprintf (stdout, "%s %s\n\n" - "Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar\n" + "Copyright (C) 2000 - 2004, 2006, 2010 Daniel Spiljar\n" "This program is free software; you can redistribute it and/or " "modify\nit under the terms of the GNU General Public License " "as published by\nthe Free Software Foundation; either version " @@ -147,9 +147,12 @@ help (void) #ifdef HAVE_LIBZ fprintf(stdout, "`zmbox', "); #endif /* HAVE_LIBZ */ +#ifdef HAVE_LIBBZ2 + fprintf(stdout, "`bz2mbox', "); +#endif /* HAVE_LIBBZ2 */ fprintf(stdout, - "`mh', `nnml',\n" - "\t\t\t\t`nnmh', or `maildir'.\n\n" + "`mh',\n" + "\t\t\t\t`nnml', `nnmh', or `maildir'.\n\n" "Mail bug reports and flames to <%s>.\n", BUGREPORT_ADDR); exit(0); diff --git a/src/info.h b/src/info.h index 0427d9a..02bc0bf 100644 --- a/src/info.h +++ b/src/info.h @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: info.h,v 1.5 2003/04/13 19:15:58 dspiljar Exp $ */ + $Id: info.h,v 1.5 2003-04-13 19:15:58 dspiljar Exp $ */ #ifndef INFO_H #define INFO_H diff --git a/src/maildir.c b/src/maildir.c index b2bc71f..74d25ee 100644 --- a/src/maildir.c +++ b/src/maildir.c @@ -1,6 +1,6 @@ /* -*- C -*- mboxgrep - scan mailbox for messages matching a regular expression - Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar + Copyright (C) 2000, 2001, 2002, 2003, 2006 Daniel Spiljar Mboxgrep is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: maildir.c,v 1.21 2003/03/30 23:07:10 dspiljar Exp $ */ + $Id: maildir.c,v 1.25 2006-10-19 01:53:43 dspiljar Exp $ */ #include @@ -115,26 +115,15 @@ message_t * maildir_read_message (maildir_t *mdp) { int isheaders = 1; - int have_from = 0, have_to = 0, have_message_id = 0, have_return_path = 0, - have_sender = 0, have_date = 0; + int have_from = 0, have_to = 0, have_message_id = 0, have_sender = 0, + have_date = 0; static message_t *message; static struct dirent *d_content; char *filename, buffer[BUFSIZ]; - extern char *boxname; static FILE *fp; static int s; - message = (message_t *) xmalloc (sizeof (message_t)); - - message->headers = (char *) xmalloc (sizeof (char)); - message->headers[0] = '\0'; - message->hbytes = 0; - - message->body = (char *) xmalloc (sizeof (char)); - message->body[0] = '\0'; - message->bbytes = 0; - - message->from = NULL; + message = malloc_message (); for(;;) { @@ -169,17 +158,17 @@ maildir_read_message (maildir_t *mdp) filename = (char *) xmalloc ((sizeof (char)*((strlen (d_content->d_name)) - + (strlen (boxname)) + 6))); + + (strlen (config.boxname)) + 6))); /* filename = (char *) alloca((sizeof(char)*((strlen(d_content->d_name)) - + (strlen(boxname)) + 2))); + + (strlen(config.boxname)) + 2))); */ if (mdp->new != NULL) - sprintf (filename, "%s/new/%s", boxname, d_content->d_name); + sprintf (filename, "%s/new/%s", config.boxname, d_content->d_name); else - sprintf (filename, "%s/cur/%s", boxname, d_content->d_name); + sprintf (filename, "%s/cur/%s", config.boxname, d_content->d_name); message->filename = (char *) xstrdup (filename); free (filename); @@ -210,10 +199,7 @@ maildir_read_message (maildir_t *mdp) if (0 == strncasecmp ("Message-ID: ", buffer, 12)) have_message_id = 1; if (0 == strncasecmp ("Return-Path: ", buffer, 13)) - { - have_return_path = 1; message->from = parse_return_path(buffer); - } message->headers = (char *) xrealloc (message->headers, @@ -248,15 +234,15 @@ maildir_read_message (maildir_t *mdp) void maildir_write_message (message_t *m, const char *path) { - extern int maildir_count; char bla[BUFSIZ], *s1, *s2; int t; static FILE *f1; - maildir_count++; + runtime.maildir_count++; t = (int) time (NULL); - sprintf (bla, "%i.%i_%i.%s", t, config.pid, maildir_count, config.hostname); + sprintf (bla, "%i.%i_%i.%s", + t, config.pid, runtime.maildir_count, config.hostname); s1 = (char *) xmalloc ((strlen (path) + strlen (bla) + 6) * sizeof (char)); sprintf(s1, "%s/tmp/%s", path, bla); s2 = (char *) xmalloc ((strlen (path) + strlen (bla) + 6) * sizeof (char)); diff --git a/src/maildir.h b/src/maildir.h index 4ec13d8..44e6ae2 100644 --- a/src/maildir.h +++ b/src/maildir.h @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: maildir.h,v 1.6 2003/03/30 23:07:10 dspiljar Exp $ */ + $Id: maildir.h,v 1.6 2003-03-30 23:07:10 dspiljar Exp $ */ #ifndef MAILDIR_H #define MAILDIR_H diff --git a/src/main.c b/src/main.c index 7a3af54..3e7a04e 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ /* -*- C -*- mboxgrep - scan mailbox for messages matching a regular expression - Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006 Daniel Spiljar Mboxgrep is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: main.c,v 1.32 2003/08/24 19:23:50 dspiljar Exp $ */ + $Id: main.c,v 1.41 2006-10-22 23:34:49 dspiljar Exp $ */ #include @@ -24,12 +24,8 @@ #include #include #include -#include #include #include -#ifdef HAVE_LIBPCRE -#include -#endif /* HAVE_LIBPCRE */ #ifdef HAVE_LIBZ #include #endif /* HAVE_LIBZ */ @@ -42,39 +38,21 @@ #include "mh.h" #include "scan.h" #include "wrap.h" /* xcalloc() et cetera */ +#include "re.h" #ifdef HAVE_LIBDMALLOC #include #endif /* HAVE_LIBDMALLOC */ -regex_t posix_pattern; -#ifdef HAVE_LIBPCRE -pcre *pcre_pattern; -pcre_extra *hints; -#endif /* HAVE_LIBPCRE */ -char *boxname, *outboxname, *pipecmd, *tmpfilename; -int maildir_count = 0; -int count = 0; -void *tmpp; -checksum_t *cs; - int main (int argc, char **argv) /* {{{ */ { - int option_index = 0; - int c; -#ifdef HAVE_LIBPCRE - int errptr; - const char *error; -#endif /* HAVE_LIBPCRE */ - int haveregex = 0, havemailbox = 0; - static char *regex_s; + int havemailbox = 0; int singlefile = 0; - - int errcode = 0; - char errbuf[BUFSIZ]; + runtime.count = 0; + runtime.maildir_count = 0; static struct option long_options[] = /* {{{ */ @@ -107,124 +85,9 @@ main (int argc, char **argv) /* }}} */ - config.perl = 0; - config.extended = 1; - config.invert = 0; - config.headers = 0; - config.body = 0; - config.action = DISPLAY; - config.dedup = 0; - config.recursive = 0; - config.ignorecase = 0; - config.format = MBOX; /* default mailbox format */ - config.lock = FCNTL; /* default file locking method */ - config.merr = 1; /* report errors by default */ + set_default_options (); - while (1) - { - c = getopt_long (argc, argv, "BcdEe:GHhil:m:n:o:Pp:rsVv", long_options, - &option_index); - - if (c == -1) - break; - - switch (c) - /* {{{ */ - - { - case '?': - usage(); - case 'c': - config.action = COUNT; - break; - case 'd': - config.action = DELETE; - break; - case 'e': - regex_s = xstrdup (optarg); - haveregex = 1; - break; - case 'o': - outboxname = xstrdup (optarg); - config.action = WRITE; - break; - case 'E': - config.extended = 1; - break; - case 'G': - config.extended = 0; - break; - case 'P': -#ifdef HAVE_LIBPCRE - config.extended = 0; - config.perl = 1; -#else - fprintf(stderr, - "%s: Support for Perl regular expressions not " - "compiled in\n"); - exit(2); -#endif /* HAVE_LIBPCRE */ - break; - case 'h': - help (); - break; - case 'i': - config.ignorecase = 1; - break; - case 'm': - config.format = folder_format (optarg); - break; - case 'l': - config.lock = lock_method (optarg); - break; - case 'p': - config.action = PIPE; - pipecmd = xstrdup (optarg); - break; - case 'V': - version (); - break; - case 'v': - config.invert = 1; - break; - case 'H': - config.headers = 1; - break; - case 'B': - config.body = 1; - break; - case 's': - config.merr = 0; - break; - case 201: - config.lock = 0; - break; - case 'r': - config.recursive = 1; - break; - case 200: - config.dedup = 1; - break; - case 'n': - { - switch (optarg[0]) - { - case 'd': - config.dedup = 1; - break; - case 'l': - config.lock = 0; - break; - default: - fprintf(stderr, "%s: invalid option -- n%c\n", - APPNAME, optarg[0]); - exit(2); - } - } - } /* switch */ - - /* }}} */ - } /* while */ + get_runtime_options (&argc, argv, long_options); if ((config.body == 0) && (config.headers == 0)) { @@ -238,62 +101,25 @@ main (int argc, char **argv) config.pid = (int) getpid (); } - cs = (checksum_t *) xmalloc (sizeof (checksum_t)); - cs->md5 = (char **) xcalloc (1, sizeof (char **)); - cs->n = 0; + runtime.cs = (checksum_t *) xmalloc (sizeof (checksum_t)); + runtime.cs->md5 = (char **) xcalloc (1, sizeof (char **)); + runtime.cs->n = 0; - if (optind < argc && ! haveregex) + if (optind < argc && ! config.haveregex) { - regex_s = xstrdup (argv[optind]); - haveregex = 1; + config.regex_s = xstrdup (argv[optind]); + config.haveregex = 1; ++optind; } /* if */ - if (haveregex) + if (config.haveregex) { #ifdef HAVE_LIBPCRE if (config.perl) - /* {{{ */ - - { - pcre_pattern = pcre_compile (regex_s, - (config.ignorecase ? PCRE_CASELESS : 0), - &error, &errptr, NULL); - if (pcre_pattern == NULL) - { - if (config.merr) - fprintf (stderr, "%s: %s: %s\n", APPNAME, regex_s, error); - exit(2); - } - } - - /* }}} */ + pcre_init (); else #endif /* HAVE_LIBPCRE */ - /* {{{ */ - - { - int flag1 = 0, flag2 = 0; - - if (config.ignorecase) - flag1 = REG_ICASE; - if (config.extended) - flag2 = REG_EXTENDED; - - errcode = regcomp (&posix_pattern, regex_s, - (flag1 | flag2 | REG_NEWLINE )); - if (0 != errcode) - { - if (config.merr) - { - regerror (errcode, &posix_pattern, errbuf, BUFSIZ); - fprintf (stderr, "%s: %s: %s\n", APPNAME, regex_s, errbuf); - } - exit (2); - } /* if */ - } /* if */ - - /* }}} */ + regex_init (); } /* if */ else usage (); @@ -306,24 +132,11 @@ main (int argc, char **argv) { if (config.action == DELETE) { - tmpp = tmpfile_open (argv[optind]); - - /* If we're root, copy {owner, group, perms} of mailbox to the tmpfile - * so rename() will thus retain the original's ownership & permissions. - */ - if (geteuid() == 0) { - struct stat s; - if (stat(argv[optind], &s) != -1) { - if (fchown(fileno(tmpp), s.st_uid, s.st_gid) == -1) - if (config.merr) perror(tmpfilename); - if (fchmod(fileno(tmpp), s.st_mode) == -1) - if (config.merr) perror(tmpfilename); - } - else if (config.merr) perror(argv[optind]); - } + tmpmbox_create (argv[optind]); + runtime.tmp_mbox = mbox_open (config.tmpfilename, "w"); } - boxname = xstrdup (argv[optind]); + config.boxname = xstrdup (argv[optind]); if (config.recursive) recursive_scan (argv[optind]); @@ -333,24 +146,19 @@ main (int argc, char **argv) if (config.action == COUNT) { if (singlefile) - fprintf (stdout, "%i\n", count); + fprintf (stdout, "%i\n", runtime.count); else { if (0 == strcmp ("-", argv[optind])) - fprintf (stdout, "(standard input):%i\n", count); + fprintf (stdout, "(standard input):%i\n", runtime.count); else - fprintf (stdout, "%s:%i\n", argv[optind], count); + fprintf (stdout, "%s:%i\n", argv[optind], runtime.count); } } if (config.action == DELETE) { -#ifdef HAVE_LIBZ - if (config.format == ZMBOX) - gzclose (tmpp); -#endif /* HAVE_LIBZ */ - if (config.format == MBOX) - fclose (tmpp); - rename (tmpfilename, argv[optind]); + mbox_close (runtime.tmp_mbox); + rename (config.tmpfilename, argv[optind]); } ++optind; } /* while */ @@ -364,7 +172,7 @@ main (int argc, char **argv) config.format = MBOX; scan_mailbox ("-"); if (config.action == COUNT) - fprintf (stdout, "%i\n", count); + fprintf (stdout, "%i\n", runtime.count); } /* }}} */ diff --git a/src/mbox.c b/src/mbox.c index 55e29bb..445901a 100644 --- a/src/mbox.c +++ b/src/mbox.c @@ -1,6 +1,6 @@ /* -*- C -*- mboxgrep - scan mailbox for messages matching a regular expression - Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006 Daniel Spiljar Mboxgrep is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: mbox.c,v 1.26 2003/08/24 19:23:50 dspiljar Exp $ */ + $Id: mbox.c,v 1.34 2006-10-22 23:34:49 dspiljar Exp $ */ #include @@ -39,6 +39,7 @@ #ifdef HAVE_LIBBZ2 #include #endif /* HAVE_LIBBZ2 */ +#define BUFLEN 16384 #include "mboxgrep.h" #include "mbox.h" @@ -243,17 +244,7 @@ mbox_read_message (mbox_t * mp) char buffer[BUFSIZ]; message_t *message; - message = (message_t *) xmalloc (sizeof (message_t)); - - message->headers = (char *) xmalloc (sizeof (char)); - message->headers[0] = '\0'; - message->hbytes = 0; - - message->body = (char *) xmalloc (sizeof (char)); - message->body[0] = '\0'; - message->bbytes = 0; - - message->from = NULL; + message = malloc_message (); s = strlen (mp->postmark_cache); message->headers = @@ -348,53 +339,112 @@ mbox_read_message (mbox_t * mp) /* }}} */ -void * -tmpfile_open (const char *path) +void +tmpmbox_create (const char *path) /* {{{ */ { - extern char *tmpfilename; - char *fname; - char *tmpdir; int foo; - if (path == NULL) { /* no path prefix given, use /tmp or TMPDIR */ - tmpdir = getenv ("TMPDIR"); - if (tmpdir == NULL) - tmpdir = xstrdup ("/tmp"); - fname = xstrdup ("/mboxgrepXXXXXX"); - } - else { - tmpdir = (char *)path; - fname = xstrdup (".XXXXXX"); - } + tmpfile_name (path); + foo = tmpfile_create (); + tmpfile_mod_own (foo, path); +} - tmpfilename = (char *) xmalloc ((strlen (tmpdir) + (strlen (fname) + 1)) - * sizeof (char)); - sprintf (tmpfilename, "%s%s", tmpdir, fname); - foo = mkstemp (tmpfilename); - if (-1 == foo) +/* }}} */ + +void +tmpfile_name (const char *path) + /* {{{ */ +{ + char *fname, *tmpdir; + + if (path == NULL) /* no path prefix given, use /tmp or TMPDIR */ + { + tmpdir = getenv ("TMPDIR"); + if (tmpdir == NULL) + tmpdir = xstrdup ("/tmp"); + fname = xstrdup ("/mboxgrepXXXXXX"); + } + else + { + tmpdir = xstrdup (path); + fname = xstrdup (".XXXXXX"); + } + + config.tmpfilename = + (char *) xmalloc ((strlen (tmpdir) + (strlen (fname) + 1)) + * sizeof (char)); + sprintf (config.tmpfilename, "%s%s", tmpdir, fname); +} +/* }}} */ + + +void +mbox_write_message (message_t *msg, mbox_t *mbox) + /* {{{ */ + +{ + if (config.format == MBOX) + fprintf (mbox->fp, "%s\n%s", msg->headers, msg->body); +#ifdef HAVE_LIBZ + else if (config.format == ZMBOX) + { + gzwrite_loop (mbox->fp, msg->headers); + gzwrite(mbox->fp, "\n", 1); + gzwrite_loop (mbox->fp, msg->body); + } +#endif /* HAVE_LIBZ */ +#ifdef HAVE_LIBBZ2 + else if (config.format == BZ2MBOX) + { + bzwrite_loop (mbox->fp, msg->headers); + BZ2_bzwrite (mbox->fp, "\n", 1); + bzwrite_loop (mbox->fp, msg->body); + } +#endif /* HAVE_LIBBZ2 */ +} +/* }}} */ + +void +tmpfile_mod_own (const int fd, const char *path) + /* {{{ */ +{ + /* If we're root, copy {owner, group, perms} of mailbox to the tmpfile + * so rename() will thus retain the original's ownership & permissions. + */ + if (geteuid () == 0) + { + struct stat s; + + if (stat (path, &s) != -1) + { + if (fchown (fd, s.st_uid, s.st_gid) == -1) + if (config.merr) perror (config.tmpfilename); + if (fchmod (fd, s.st_mode) == -1) + if (config.merr) perror (config.tmpfilename); + } + else if (config.merr) perror (path); + } +} +/* }}} */ + +int +tmpfile_create (void) + /* {{{ */ +{ + int fd; + + fd = mkstemp (config.tmpfilename); + if (-1 == fd) { if (config.merr) { - fprintf (stderr, "%s: %s: ", APPNAME, tmpfilename); + fprintf (stderr, "%s: %s: ", APPNAME, config.tmpfilename); perror (NULL); } exit (2); } - - if (config.format == MBOX) - return (m_fdopen (foo, "w")); -#ifdef HAVE_LIBZ - else if (config.format == ZMBOX) - return (m_gzdopen (foo, "wb")); -#endif /* HAVE_LIBZ */ -#ifdef HAVE_LIBBZ2 - else if (config.format == BZ2MBOX) - return (BZ2_bzdopen (foo, "wb")); -#endif /* HAVE_LIBZ */ - - return NULL; /* not reached */ + return fd; } - -/* }}} */ +/* }}} */ diff --git a/src/mbox.h b/src/mbox.h index c0781f0..26fb30b 100644 --- a/src/mbox.h +++ b/src/mbox.h @@ -1,6 +1,6 @@ /* -*- C -*- mboxgrep - scan mailbox for messages matching a regular expression - Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar + Copyright (C) 2000, 2001, 2002, 2003, 2004 Daniel Spiljar Mboxgrep is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: mbox.h,v 1.9 2003/08/24 19:23:50 dspiljar Exp $ */ + $Id: mbox.h,v 1.13 2006-10-22 23:34:49 dspiljar Exp $ */ #ifndef MBOX_H #define MBOX_H 1 @@ -34,8 +34,14 @@ typedef struct mbox_t *mbox_open (const char *path, const char *mode); -void *tmpfile_open (const char *path); +void tmpmbox_create (const char *path); +void tmpfile_name (const char *path); +void tmpfile_mod_own (const int fd, const char *path); +int tmpfile_create (void); void mbox_close (mbox_t * mbp); -message_t *mbox_read_message (mbox_t * mbp); +/* FIXME -- it doesn't compile with this portion uncommented +message_t *mbox_read_message (mbox_t * mp); +void mbox_write_message (message_t *m, mbox_t *mbox); +*/ #endif /* MBOX_H */ diff --git a/src/mboxgrep.h b/src/mboxgrep.h index ed46888..4d88626 100644 --- a/src/mboxgrep.h +++ b/src/mboxgrep.h @@ -1,6 +1,6 @@ /* -*- C -*- mboxgrep - scan mailbox for messages matching a regular expression - Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar + Copyright (C) 2000, 2001, 2002, 2003, 2006 Daniel Spiljar Mboxgrep is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,14 +16,14 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: mboxgrep.h,v 1.21 2003/04/06 21:01:49 dspiljar Exp $ */ + $Id: mboxgrep.h,v 1.31 2006-10-22 23:34:49 dspiljar Exp $ */ #ifndef MBOXGREP_H #define MBOXGREP_H #define APPNAME "mboxgrep" -#define VERSION "0.7.9" -#define BUGREPORT_ADDR "dspiljar@world.std.com" +#define VERSION "0.7.10" +#define BUGREPORT_ADDR "dspiljar@panix.com" #define HOST_NAME_SIZE 256 @@ -45,6 +45,7 @@ # endif /* HAVE_NDIR_H */ #endif /* HAVE_DIRENT_H */ +#include "mbox.h" typedef enum { @@ -120,15 +121,30 @@ typedef struct int ignorecase; int merr; int pid; + int haveregex; char hostname[HOST_NAME_SIZE]; + char *boxname, *outboxname, *pipecmd, *tmpfilename, *regex_s; + + void *pcre_pattern, *pcre_hints, *posix_pattern; + int res1, res2; action_t action; format_t format; lockmethod_t lock; } -option_t; + option_t; + +typedef struct +{ + int count; + int maildir_count; + checksum_t *cs; + mbox_t *tmp_mbox; +} + runtime_t; option_t config; +runtime_t runtime; #endif /* MBOXGREP_H */ diff --git a/src/mh.c b/src/mh.c index cb65f3b..c5f4143 100644 --- a/src/mh.c +++ b/src/mh.c @@ -1,6 +1,6 @@ /* -*- C -*- mboxgrep - scan mailbox for messages matching a regular expression - Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar + Copyright (C) 2000, 2001, 2002, 2003, 2006 Daniel Spiljar Mboxgrep is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: mh.c,v 1.15 2003/03/30 23:07:10 dspiljar Exp $ */ + $Id: mh.c,v 1.18 2006-02-20 17:12:22 dspiljar Exp $ */ #include #include @@ -80,24 +80,14 @@ void mh_close (DIR *dp) message_t *mh_read_message (DIR *dp) { int isheaders = 1; - int have_from = 0, have_return_path = 0, - have_date = 0, have_sender = 0; + int have_from = 0, have_date = 0, have_sender = 0; static int s; message_t *message; struct dirent *d_content; char buffer[BUFSIZ], *filename; FILE *fp; - extern char *boxname; - message = (message_t *) xmalloc (sizeof (message_t)); - - message->headers = NULL; - message->hbytes = 0; - - message->body = NULL; - message->bbytes = 0; - - message->from = NULL; + message = malloc_message (); filename = NULL; @@ -110,7 +100,7 @@ message_t *mh_read_message (DIR *dp) filename = (char *) xrealloc (filename, ((strlen (d_content->d_name)) + - (strlen (boxname)) + 2)); + (strlen (config.boxname)) + 2)); /* message->headers = (char *) xrealloc (message->headers, 0); */ /* message->hbytes = 0; */ @@ -118,7 +108,7 @@ message_t *mh_read_message (DIR *dp) /* message->bbytes = 0; */ filename[0] = '\0'; - sprintf (filename, "%s/%s", boxname, d_content->d_name); + sprintf (filename, "%s/%s", config.boxname, d_content->d_name); fp = m_fopen (filename, "r"); isheaders = 1; if (fp == NULL) @@ -167,10 +157,7 @@ message_t *mh_read_message (DIR *dp) if (0 == strncasecmp ("Date: ", buffer, 6)) have_date = 1; if (0 == strncasecmp ("Return-Path: ", buffer, 13)) - { - have_return_path = 1; message->from = parse_return_path (buffer); - } message->headers = (char *) realloc (message->headers, diff --git a/src/mh.h b/src/mh.h index 4758503..b1fa10d 100644 --- a/src/mh.h +++ b/src/mh.h @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: mh.h,v 1.6 2003/03/30 23:07:10 dspiljar Exp $ */ + $Id: mh.h,v 1.6 2003-03-30 23:07:10 dspiljar Exp $ */ #ifndef MH_H #define MH_H 1 diff --git a/src/misc.c b/src/misc.c index 76a1704..2c5c596 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1,6 +1,6 @@ /* -*- C -*- mboxgrep - scan mailbox for messages matching a regular expression - Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar + Copyright (C) 2000, 2001, 2002, 2003, 2006 Daniel Spiljar Mboxgrep is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: misc.c,v 1.13 2003/04/06 21:01:49 dspiljar Exp $ */ + $Id: misc.c,v 1.17 2006-07-06 10:53:49 dspiljar Exp $ */ #define _XOPEN_SOURCE /* Pull in strptime(3) from time.h */ #define _BSD_SOURCE /* Compensate for _XOPEN_SOURCE to pull in strdup(3) @@ -32,6 +32,7 @@ #include "mboxgrep.h" #include "wrap.h" +#include "getopt.h" format_t folder_format (const char *name) @@ -135,3 +136,166 @@ char * parse_return_path(char *rpath) return blah1; } /* }}} */ + +void * malloc_message (void) +{ + message_t *message; + + message = (message_t *) xmalloc (sizeof (message_t)); + + message->headers = (char *) xmalloc (sizeof (char)); + message->headers[0] = '\0'; + message->hbytes = 0; + + message->body = (char *) xmalloc (sizeof (char)); + message->body[0] = '\0'; + message->bbytes = 0; + + message->from = NULL; + + return message; +} + +void postmark_print (message_t *msg) +{ + time_t tt; + struct tm *ct; + char date_str[80]; + + tt = time (NULL); + ct = localtime (&tt); + strftime (date_str, 80, "%a %b %d %H:%M:%S %Y", ct); + if (msg->from) + fprintf (stdout, "From %s %s\n", msg->from, date_str); + else + fprintf (stdout, "From nobody %s\n", date_str); +} + +void +set_default_options (void) +{ + config.perl = 0; + config.extended = 1; + config.invert = 0; + config.headers = 0; + config.body = 0; + config.action = DISPLAY; + config.dedup = 0; + config.recursive = 0; + config.ignorecase = 0; + config.format = MBOX; /* default mailbox format */ + config.lock = FCNTL; /* default file locking method */ + config.merr = 1; /* report errors by default */ +} + +void +get_runtime_options (int *argc, char **argv, struct option *long_options) +{ + int option_index = 0, c; + + while (1) + { + c = getopt_long (*argc, argv, "BcdEe:GHhil:m:n:o:Pp:rsVv", long_options, + &option_index); + + if (c == -1) + break; + + switch (c) + /* {{{ */ + + { + case '?': + usage(); + case 'c': + config.action = COUNT; + break; + case 'd': + config.action = DELETE; + break; + case 'e': + config.regex_s = xstrdup (optarg); + config.haveregex = 1; + break; + case 'o': + config.outboxname = xstrdup (optarg); + config.action = WRITE; + break; + case 'E': + config.extended = 1; + break; + case 'G': + config.extended = 0; + break; + case 'P': +#ifdef HAVE_LIBPCRE + config.extended = 0; + config.perl = 1; +#else + fprintf(stderr, + "%s: Support for Perl regular expressions not " + "compiled in\n"); + exit(2); +#endif /* HAVE_LIBPCRE */ + break; + case 'h': + help (); + break; + case 'i': + config.ignorecase = 1; + break; + case 'm': + config.format = folder_format (optarg); + break; + case 'l': + config.lock = lock_method (optarg); + break; + case 'p': + config.action = PIPE; + config.pipecmd = xstrdup (optarg); + break; + case 'V': + version (); + break; + case 'v': + config.invert = 1; + break; + case 'H': + config.headers = 1; + break; + case 'B': + config.body = 1; + break; + case 's': + config.merr = 0; + break; + case 201: + config.lock = 0; + break; + case 'r': + config.recursive = 1; + break; + case 200: + config.dedup = 1; + break; + case 'n': + { + switch (optarg[0]) + { + case 'd': + config.dedup = 1; + break; + case 'l': + config.lock = 0; + break; + default: + fprintf(stderr, "%s: invalid option -- n%c\n", + APPNAME, optarg[0]); + exit(2); + } + } + } /* switch */ + + /* }}} */ + } /* while */ +} diff --git a/src/misc.h b/src/misc.h index b2284f9..2a397a8 100644 --- a/src/misc.h +++ b/src/misc.h @@ -1,6 +1,6 @@ /* -*- C -*- mboxgrep - scan mailbox for messages matching a regular expression - Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar + Copyright (C) 2000, 2001, 2002, 2003, 2006 Daniel Spiljar Mboxgrep is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,17 +16,22 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: misc.h,v 1.5 2003/03/30 23:07:10 dspiljar Exp $ */ + $Id: misc.h,v 1.9 2006-07-06 10:53:49 dspiljar Exp $ */ #ifndef MISC_H #define MISC_H 1 #include "mboxgrep.h" -#include +#include "getopt.h" +/* #include */ format_t folder_format (const char *name); lockmethod_t lock_method (const char *name); -time_t parse_date(char *datestr); +/* time_t parse_date(char *datestr); */ char * parse_return_path(char *rpath); +void * malloc_message (void); +void postmark_print (message_t *msg); +void set_default_options (void); +void get_runtime_options (int *argc, char **argv, struct option *long_options); #endif /* MISC_H */ diff --git a/src/re.c b/src/re.c new file mode 100755 index 0000000..a82fc1c --- /dev/null +++ b/src/re.c @@ -0,0 +1,108 @@ +/* -*- C -*- + mboxgrep - scan mailbox for messages matching a regular expression + Copyright (C) 2006 Daniel Spiljar + + Mboxgrep is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Mboxgrep is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with mboxgrep; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + $Id: re.c,v 1.3 2006-07-07 04:15:44 dspiljar Exp $ */ + +#include +#include +#include +#include +#ifdef HAVE_LIBPCRE +#include +#endif /* HAVE_LIBPCRE */ +#include "mboxgrep.h" + +#ifdef HAVE_LIBPCRE +void +pcre_init (void) +{ + int errptr; + const char *error; + + config.pcre_pattern = + (pcre *) pcre_compile (config.regex_s, + (config.ignorecase ? PCRE_CASELESS : 0), + &error, &errptr, NULL); + if (config.pcre_pattern == NULL) + { + if (config.merr) + fprintf (stderr, "%s: %s: %s\n", APPNAME, config.regex_s, + error); + exit(2); + } +} + +void +pcre_match (message_t *msg) +{ + int of[BUFSIZ]; + + if (config.headers) + config.res1 = + pcre_exec ((pcre *) config.pcre_pattern, + (pcre_extra *) config.pcre_hints, + msg->headers, + (int) strlen (msg->headers), 0, 0, of, BUFSIZ); + if (config.body) + config.res2 = + pcre_exec ((pcre *) config.pcre_pattern, + (pcre_extra *) config.pcre_hints, + msg->body, + (int) strlen (msg->body), 0, 0, of, BUFSIZ); + + config.res1 = config.res1 ^ 1; + config.res2 = config.res2 ^ 1; +} +#endif /* HAVE_LIBPCRE */ + +void +regex_init (void) +{ + int flag1 = 0, flag2 = 0; + int errcode = 0; + char errbuf[BUFSIZ]; + + if (config.ignorecase) + flag1 = REG_ICASE; + if (config.extended) + flag2 = REG_EXTENDED; + + errcode = regcomp ((regex_t *) config.posix_pattern, config.regex_s, + (flag1 | flag2 | REG_NEWLINE )); + if (0 != errcode) + { + if (config.merr) + { + regerror (errcode, (regex_t *) config.posix_pattern, errbuf, BUFSIZ); + fprintf (stderr, "%s: %s: %s\n", APPNAME, config.regex_s, + errbuf); + } + exit (2); + } +} + +void +regex_match (message_t *msg) +{ + if (config.headers) + config.res1 = regexec ((regex_t *) config.posix_pattern, + msg->headers, 0, NULL, 0); + if (config.body) + config.res2 = regexec ((regex_t *) config.posix_pattern, + msg->body, 0, NULL, 0); +} diff --git a/src/re.h b/src/re.h new file mode 100755 index 0000000..efc38fe --- /dev/null +++ b/src/re.h @@ -0,0 +1,28 @@ +/* -*- C -*- + mboxgrep - scan mailbox for messages matching a regular expression + Copyright (C) 2006 Daniel Spiljar + + Mboxgrep is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Mboxgrep is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with mboxgrep; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + $Id: re.h,v 1.3 2006-07-07 04:15:44 dspiljar Exp $ */ + +#include "mboxgrep.h" + +#ifdef HAVE_LIBPCRE +void pcre_init (void); +void pcre_match (message_t *msg); +#endif /* HAVE_LIBPCRE */ +void regex_init (void); +void regex_match (message_t *msg); diff --git a/src/scan.c b/src/scan.c index 78e9111..0a66978 100644 --- a/src/scan.c +++ b/src/scan.c @@ -1,6 +1,6 @@ /* -*- C -*- mboxgrep - scan mailbox for messages matching a regular expression - Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006 Daniel Spiljar Mboxgrep is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,13 +16,12 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: scan.c,v 1.21 2003/04/06 21:01:49 dspiljar Exp $ */ + $Id: scan.c,v 1.32 2006-10-22 23:34:49 dspiljar Exp $ */ #include #include #include -#include #include #include @@ -46,20 +45,17 @@ #include #include #include -#ifdef HAVE_LIBZ -# include #define BUFLEN 16384 -#endif /* HAVE_LIBZ */ -#ifdef HAVE_LIBPCRE -# include -#endif /* HAVE_LIBPCRE */ +#include "mboxgrep.h" #include "scan.h" #include "mbox.h" #include "mh.h" #include "maildir.h" #include "wrap.h" #include "md5.h" +#include "misc.h" +#include "re.h" #ifdef HAVE_FTS_OPEN # include # include @@ -77,46 +73,30 @@ void scan_mailbox (char path[]) /* {{{ */ { static FILE *outf; - extern FILE *tmpp; static mbox_t *mbox, *out; -#ifdef HAVE_LIBPCRE - extern pcre *pcre_pattern; - extern pcre_extra *hints; - int of[BUFSIZ]; -#endif /* HAVE_LIBPCRE */ static DIR *boxd, *foo; static maildir_t *maildird; static message_t *msg; - extern regex_t posix_pattern; - extern char *pipecmd, *outboxname; - extern int count; int delete = 0; - char date_str[80]; int isdup = 0; - time_t tt; - struct tm *ct; - extern checksum_t *cs; - - extern option_t config; - if (config.format == MAILDIR && config.action == WRITE) { - foo = opendir (outboxname); /* do NOT change this to m_opendir! */ + foo = opendir (config.outboxname); /* do NOT change this to m_opendir! */ if (foo == NULL && errno == ENOENT) - maildir_create (outboxname); + maildir_create (config.outboxname); else closedir (foo); - if (-1 == maildir_check (outboxname)) + if (-1 == maildir_check (config.outboxname)) { if (config.merr) fprintf (stderr, "%s: %s: Not a maildir folder\n", APPNAME, - outboxname); + config.outboxname); exit (2); } } - count = 0; + runtime.count = 0; if (config.action == DELETE) delete = 1; @@ -140,7 +120,8 @@ void scan_mailbox (char path[]) for (;;) { - int res1 = 1, res2 = 1; + config.res1 = 1; + config.res2 = 1; if ((config.format == MBOX) || (config.format == ZMBOX) || (config.format == BZ2MBOX)) @@ -157,30 +138,16 @@ void scan_mailbox (char path[]) #ifdef HAVE_LIBPCRE if (config.perl) - { - if (config.headers) - res1 = pcre_exec (pcre_pattern, hints, msg->headers, - (int) strlen (msg->headers), 0, 0, of, BUFSIZ); - if (config.body) - res2 = pcre_exec (pcre_pattern, hints, msg->body, - (int) strlen (msg->body), 0, 0, of, BUFSIZ); - - res1 = res1 ^ 1; - res2 = res2 ^ 1; - } + pcre_match (msg); else #endif /* HAVE_LIBPCRE */ - { - if (config.headers) - res1 = regexec (&posix_pattern, msg->headers, 0, NULL, 0); - if (config.body) - res2 = regexec (&posix_pattern, msg->body, 0, NULL, 0); - } + regex_match (msg); if (config.dedup) - isdup = md5_check_message (msg->body, cs); + isdup = md5_check_message (msg->body, runtime.cs); - if (((res1 == 0) | (res2 == 0)) ^ ((config.invert ^ delete)) && + if (((config.res1 == 0) | (config.res2 == 0)) ^ + ((config.invert ^ delete)) && ((config.dedup && !isdup) || !config.dedup)) { if (config.action == DISPLAY) @@ -188,39 +155,33 @@ void scan_mailbox (char path[]) if (config.format != MBOX && config.format != ZMBOX && config.format != BZ2MBOX && 0 != strncmp ("From ", msg->headers, 5)) - { - tt = time (NULL); - ct = localtime (&tt); - strftime (date_str, 80, "%a %b %d %H:%M:%S %Y", ct); - if (msg->from) - fprintf (stdout, "From %s %s\n", msg->from, date_str); - else - fprintf (stdout, "From nobody %s\n", date_str); - } + postmark_print (msg); fprintf (stdout, "%s\n%s", msg->headers, msg->body); } else if (config.action == WRITE) { if (config.format == MAILDIR) - maildir_write_message (msg, outboxname); + maildir_write_message (msg, config.outboxname); else if (config.format == MH || config.format == NNMH || config.format == NNML) - mh_write_message (msg, outboxname); - else if (config.format == MBOX) + mh_write_message (msg, config.outboxname); + else if ((config.format == MBOX) || (config.format == ZMBOX) || + (config.format == BZ2MBOX)) { - out = mbox_open (outboxname, "w"); - fprintf (out->fp, "%s\n%s", msg->headers, msg->body); + out = mbox_open (config.outboxname, "w"); + /* fprintf (out->fp, "%s\n%s", msg->headers, msg->body); */ + mbox_write_message (msg, out); mbox_close (out); } } else if (config.action == PIPE) { - outf = popen (pipecmd, "w"); + outf = popen (config.pipecmd, "w"); if (outf == NULL) { if (config.merr) { - fprintf (stderr, "%s: %s: ", APPNAME, pipecmd); + fprintf (stderr, "%s: %s: ", APPNAME, config.pipecmd); perror (NULL); } exit (2); @@ -229,41 +190,15 @@ void scan_mailbox (char path[]) pclose (outf); } else if (config.action == COUNT) - ++count; - else if (config.action == DELETE && config.format == MBOX) - fprintf (tmpp, "%s\n%s", msg->headers, msg->body); -#ifdef HAVE_LIBZ - else if (config.action == DELETE && config.format == ZMBOX) - { - int quux, len, baz; + runtime.count++; + else if (config.action == DELETE && + ((config.format == MBOX) || (config.format == ZMBOX) || + (config.format == BZ2MBOX))) + mbox_write_message (msg, runtime.tmp_mbox); + } - quux = 0; - baz = strlen (msg->headers); - for (;;) - { - len = gzwrite (tmpp, (msg->headers+quux), - (((quux + BUFLEN) < baz) ? BUFLEN : - (baz - quux))); - quux += len; - if (quux == baz) - break; - } - gzwrite(tmpp, "\n", 1); - quux = 0; - baz = strlen(msg->body); - for (;;) - { - len = gzwrite(tmpp, (msg->body+quux), - (((quux + BUFLEN) < baz) ? BUFLEN : - (baz - quux))); - quux += len; - if (quux == baz) - break; - } - } -#endif /* HAVE_LIBZ */ - } /* if */ - else if (((((res1 == 0) | (res2 == 0)) ^ config.invert) && delete) && + else if (((((config.res1 == 0) | (config.res2 == 0)) ^ + config.invert) && delete) && ((config.format == MH) || (config.format == NNMH) || (config.format == NNML) || (config.format == MAILDIR))) m_unlink(msg->filename); @@ -322,7 +257,7 @@ int md5_check_message (char *body, checksum_t *chksum) /* {{{ */ { struct md5_ctx a; - unsigned char b[16]; + char b[16]; int i; md5_init_ctx (&a); @@ -334,7 +269,7 @@ int md5_check_message (char *body, checksum_t *chksum) for (i = 0; i < chksum->n; i++) { - if (0 == strncmp (chksum->md5[i], b, 16)) + if (0 == strncmp ((char *)chksum->md5[i], b, 16)) return 1; } diff --git a/src/scan.h b/src/scan.h index 3016ccc..2e67d70 100644 --- a/src/scan.h +++ b/src/scan.h @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: scan.h,v 1.7 2003/03/30 23:07:10 dspiljar Exp $ */ + $Id: scan.h,v 1.7 2003-03-30 23:07:10 dspiljar Exp $ */ #ifndef SCAN_H #define SCAN_H 1 diff --git a/src/wrap.c b/src/wrap.c index 05e79fc..465589b 100644 --- a/src/wrap.c +++ b/src/wrap.c @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: wrap.c,v 1.12 2003/04/06 23:24:04 dspiljar Exp $ */ + $Id: wrap.c,v 1.13 2006-01-20 03:00:39 dspiljar Exp $ */ #include #include @@ -55,6 +55,8 @@ #define APPNAME "mboxgrep" #endif +#define BUFLEN 16384 + int m_open (const char *pathname, int flags, mode_t mode) { int blah; @@ -214,3 +216,42 @@ int m_unlink (const char *pathname) return baz; } +#ifdef HAVE_LIBZ + +void gzwrite_loop (void *fp, char *str) +{ + int quux, len, baz; + + quux = 0; + baz = strlen (str); + for (;;) + { + len = gzwrite (fp, (str+quux), + (((quux + BUFLEN) < baz) ? BUFLEN : (baz - quux))); + quux += len; + if (quux == baz) + break; + } +} + +#endif /* HAVE_LIBZ */ + +#ifdef HAVE_LIBBZ2 + +void bzwrite_loop (void *fp, char *str) +{ + int quux, len, baz; + + quux = 0; + baz = strlen (str); + for (;;) + { + len = BZ2_bzwrite (fp, (str+quux), + (((quux + BUFLEN) < baz) ? BUFLEN : (baz - quux))); + quux += len; + if (quux == baz) + break; + } +} + +#endif /* HAVE_LIBBZ2 */ diff --git a/src/wrap.h b/src/wrap.h index 7bd6f41..756cef1 100644 --- a/src/wrap.h +++ b/src/wrap.h @@ -16,7 +16,7 @@ along with mboxgrep; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: wrap.h,v 1.11 2003/04/06 23:24:04 dspiljar Exp $ */ + $Id: wrap.h,v 1.12 2006-01-20 03:00:39 dspiljar Exp $ */ /* This file is part of mboxgrep. */ @@ -58,7 +58,11 @@ FILE *m_fopen (const char *path, const char *mode); FILE *m_fdopen (int fildes, const char *mode); #ifdef HAVE_LIBZ gzFile *m_gzdopen (int fildes, const char *mode); +void gzwrite_loop (void *fp, char *str); #endif /* HAVE_LIBZ */ +#ifdef HAVE_LIBBZ2 +void bzwrite_loop (void *fp, char *str); +#endif /* HAVE_LIBBZ2 */ DIR *m_opendir (const char *name);