This commit is contained in:
Graeme Walker 2003-11-06 12:00:00 +00:00
parent 6798a91d8b
commit def9081f44
105 changed files with 5265 additions and 2802 deletions

View File

@ -4,7 +4,7 @@ Graeme Walker <graeme_walker@users.sourceforge.net>
Credits
-------
The source in "glib/gmd5.cpp" is "derived from the RSA Data
The source in "glib/md5c.c" and "glib/md5.h" is "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" by incorporating
the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" which
is "Copyright (C) 1991, RSA Data Security, Inc. All rights reserved".

View File

@ -1,10 +1,14 @@
E-MailRelay Change Log
======================
1.1.2 -> 1.1.3
--------------
* Fix for dangling reference bug, seen after "quit" command on Windows.
1.1.2 -> 1.2
------------
* The "--filter" and "--verifier" arguments interpreted as command-lines; spaces in executable paths now need escaping.
* The "--interface" switch applies to outgoing connections too.
* New "--client-filter" switch to do synchronous message processing before sending.
* Keeps authentication after a "rset" command.
* Fix for dangling reference bug, seen after "quit" command on Windows.
* JavaScript examples in the documentation.
1.1.1 -> 1.1.2
--------------

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -13,74 +13,94 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -88,7 +108,22 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
#
#
@ -105,13 +140,15 @@ DIST_SOURCES =
DATA = $(e_doc_DATA)
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
uninstall-info-recursive all-recursive install-data-recursive \
install-exec-recursive installdirs-recursive install-recursive \
uninstall-recursive check-recursive installcheck-recursive
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
Makefile.in NEWS acinclude.m4 aclocal.m4 config.h.in configure \
configure.ac depcomp install-sh missing mkinstalldirs
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure AUTHORS \
COPYING ChangeLog INSTALL Makefile.am NEWS acinclude.m4 \
aclocal.m4 config.h.in configure configure.ac depcomp \
install-sh missing mkinstalldirs
DIST_SUBDIRS = $(SUBDIRS)
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@ -224,10 +261,17 @@ tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@ -243,9 +287,15 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if (etags --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
else \
include_option=--include; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
test -f $$subdir/TAGS && \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
@ -258,13 +308,28 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = .
@ -276,12 +341,19 @@ am__remove_distdir = \
&& rm -fr $(distdir); }; }
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -334,12 +406,13 @@ distcheck: dist
$(am__remove_distdir)
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
&& cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
@ -347,23 +420,39 @@ distcheck: dist
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
find $$dc_install_base -type f -print ; \
exit 1; } >&2 ) \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
&& rm -f $(distdir).tar.gz \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
if test '$(srcdir)' = . ; then \
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after distclean:" ; \
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
@ -393,7 +482,7 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -404,6 +493,7 @@ clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
dvi: dvi-recursive
@ -426,22 +516,32 @@ installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf autom4te.cache
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-e_docDATA uninstall-info-am uninstall-local
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
clean-generic clean-recursive dist dist-all dist-gzip distcheck \
distclean distclean-generic distclean-hdr distclean-recursive \
distclean-tags distcleancheck distdir dvi dvi-am dvi-recursive \
info info-am info-recursive install install-am install-data \
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-recursive ctags ctags-recursive dist \
dist-all dist-gzip distcheck distclean distclean-generic \
distclean-hdr distclean-recursive distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am dvi-recursive info \
info-am info-recursive install install-am install-data \
install-data-am install-data-recursive install-e_docDATA \
install-exec install-exec-am install-exec-recursive \
install-info install-info-am install-info-recursive install-man \
@ -449,9 +549,10 @@ uninstall-info: uninstall-info-recursive
installdirs installdirs-am installdirs-recursive \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-recursive tags tags-recursive uninstall \
uninstall-am uninstall-e_docDATA uninstall-info-am \
uninstall-info-recursive uninstall-local uninstall-recursive
mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \
ps-recursive tags tags-recursive uninstall uninstall-am \
uninstall-e_docDATA uninstall-info-am uninstall-info-recursive \
uninstall-local uninstall-recursive
changelog.gz: ChangeLog
if test -n "$(GZIP)" ; then $(GZIP) -c $(top_srcdir)/ChangeLog > changelog.tmp && mv changelog.tmp changelog.gz ; fi

229
aclocal.m4 vendored
View File

@ -1,6 +1,6 @@
# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*-
# generated automatically by aclocal 1.7.8 -*- Autoconf -*-
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -214,7 +214,7 @@ AC_DEFUN([FHS_COMPLIANCE],
# This macro actually does too much some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@ -232,16 +232,9 @@ AC_DEFUN([FHS_COMPLIANCE],
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# serial 8
# serial 10
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
AC_PREREQ([2.52])
AC_PREREQ([2.54])
# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
# the ones we care about.
@ -267,6 +260,16 @@ if test "`cd $srcdir && pwd`" != "`pwd`" &&
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
@ -274,8 +277,8 @@ m4_ifval([$2],
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl
AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
@ -296,19 +299,41 @@ AM_PROG_INSTALL_STRIP
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_][CC],
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_][CC],
defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_][CXX],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_][CXX],
defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Copyright 2002 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@ -329,14 +354,14 @@ AC_PROVIDE_IFELSE([AC_PROG_][CXX],
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"])
AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.6.3])])
[AM_AUTOMAKE_VERSION([1.7.8])])
# Helper functions for option handling. -*- Autoconf -*-
@ -622,9 +647,42 @@ fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# serial 4 -*- Autoconf -*-
# -*- Autoconf -*-
# Copyright (C) 2003 Free Software Foundation, Inc.
# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
# This program 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, or (at your option)
# any later version.
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# serial 1
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# serial 5 -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -685,18 +743,32 @@ AC_CACHE_CHECK([dependency style of $depcc],
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
echo '#include "conftest.h"' > conftest.c
echo 'int i;' > conftest.h
echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
: > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
@ -714,14 +786,21 @@ AC_CACHE_CHECK([dependency style of $depcc],
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=conftest.c object=conftest.o \
depfile=conftest.Po tmpdepfile=conftest.TPo \
$SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
grep conftest.h conftest.Po > /dev/null 2>&1 &&
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# (even with -Werror). So we grep stderr for any message
# that says an option was ignored.
if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
@ -731,6 +810,9 @@ else
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
@ -739,16 +821,8 @@ AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[rm -f .deps 2>/dev/null
mkdir .deps 2>/dev/null
if test -d .deps; then
DEPDIR=.deps
else
# MS-DOS does not allow filenames that begin with a dot.
DEPDIR=_deps
fi
rmdir .deps 2>/dev/null
AC_SUBST([DEPDIR])
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
@ -850,7 +924,9 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*-
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -875,8 +951,9 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
doit:
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
@ -890,7 +967,7 @@ echo "include confinc" > confmf
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
@ -904,9 +981,9 @@ if test "$am__include" = "#"; then
_am_result=BSD
fi
fi
AC_SUBST(am__include)
AC_SUBST(am__quote)
AC_MSG_RESULT($_am_result)
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
@ -950,7 +1027,7 @@ else
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([conditional \"$1\" was never defined.
AC_MSG_ERROR([conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.])
fi])])
@ -977,58 +1054,6 @@ AC_PREREQ([2.52])
# serial 6
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. We must strip everything past the first ":",
# and everything past the last "/".
# _AM_DIRNAME(PATH)
# -----------------
# Like AS_DIRNAME, only do it during macro expansion
AC_DEFUN([_AM_DIRNAME],
[m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
m4_if(regexp([$1], [^//\([^/]\|$\)]), -1,
m4_if(regexp([$1], [^/.*]), -1,
[.],
patsubst([$1], [^\(/\).*], [\1])),
patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl
])# _AM_DIRNAME
# The stamp files are numbered to have different names.
# We could number them on a directory basis, but that's additional
# complications, let's have a unique counter.
m4_define([_AM_STAMP_Count], [0])
# _AM_STAMP(HEADER)
# -----------------
# The name of the stamp file for HEADER.
AC_DEFUN([_AM_STAMP],
[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl
AS_ESCAPE(_AM_DIRNAME(patsubst([$1],
[:.*])))/stamp-h[]_AM_STAMP_Count])
# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS)
# ------------------------------------------------------------
# We used to try to get a real timestamp in stamp-h. But the fear is that
# that will cause unnecessary cvs conflicts.
AC_DEFUN([_AM_CONFIG_HEADER],
[# Add the stamp file to the list of files AC keeps track of,
# along with our hook.
AC_CONFIG_HEADERS([$1],
[# update the timestamp
echo 'timestamp for $1' >"_AM_STAMP([$1])"
$2],
[$3])
])# _AM_CONFIG_HEADER
# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS)
# --------------------------------------------------------------
AC_DEFUN([AM_CONFIG_HEADER],
[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])])
])# AM_CONFIG_HEADER
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])

View File

@ -18,11 +18,11 @@
##
#
EXTRA_DIST = emailrelay-doxygen-filter.sh_ emailrelay-test.sh_ emailrelay-soak.sh_ emailrelay.sh_ txt2html.sh_ txt2mu.sh_ mu2html.sh_ expand.sh_ emailrelay-notify.sh_ emailrelay-resubmit.sh_ emailrelay-deliver.sh_ emailrelay-process.sh_
EXTRA_DIST = emailrelay-doxygen-filter.sh_ emailrelay-test.sh_ emailrelay-soak.sh_ emailrelay.sh_ txt2html.sh_ txt2mu.sh_ mu2html.sh_ expand.sh_ emailrelay-notify.sh_ emailrelay-resubmit.sh_ emailrelay-deliver.sh_ emailrelay-process.sh_ emailrelay-runperl.js
noinst_SCRIPTS = emailrelay-doxygen-filter.sh emailrelay-test.sh emailrelay-soak.sh
e_init_SCRIPTS = emailrelay
e_examples_DATA = emailrelay-process.sh emailrelay-notify.sh emailrelay-deliver.sh emailrelay-resubmit.sh
e_examples_DATA = emailrelay-process.sh emailrelay-notify.sh emailrelay-deliver.sh emailrelay-resubmit.sh emailrelay-runperl.js
work_scripts = txt2mu.sh mu2html.sh expand.sh txt2html.sh emailrelay.sh
CLEANFILES = $(noinst_SCRIPTS) $(e_init_SCRIPTS) $(e_examples_DATA) $(work_scripts)
@ -44,6 +44,7 @@ install-data-local: install-e_examplesDATA install-e_initSCRIPTS
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-resubmit.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-deliver.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-process.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-runperl.js
uninstall-local:
-rmdir $(DESTDIR)$(e_examplesdir) 2>/dev/null

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,74 +16,94 @@
#
#
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -91,13 +111,28 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
EXTRA_DIST = emailrelay-doxygen-filter.sh_ emailrelay-test.sh_ emailrelay-soak.sh_ emailrelay.sh_ txt2html.sh_ txt2mu.sh_ mu2html.sh_ expand.sh_ emailrelay-notify.sh_ emailrelay-resubmit.sh_ emailrelay-deliver.sh_ emailrelay-process.sh_
EXTRA_DIST = emailrelay-doxygen-filter.sh_ emailrelay-test.sh_ emailrelay-soak.sh_ emailrelay.sh_ txt2html.sh_ txt2mu.sh_ mu2html.sh_ expand.sh_ emailrelay-notify.sh_ emailrelay-resubmit.sh_ emailrelay-deliver.sh_ emailrelay-process.sh_ emailrelay-runperl.js
noinst_SCRIPTS = emailrelay-doxygen-filter.sh emailrelay-test.sh emailrelay-soak.sh
e_init_SCRIPTS = emailrelay
e_examples_DATA = emailrelay-process.sh emailrelay-notify.sh emailrelay-deliver.sh emailrelay-resubmit.sh
e_examples_DATA = emailrelay-process.sh emailrelay-notify.sh emailrelay-deliver.sh emailrelay-resubmit.sh emailrelay-runperl.js
work_scripts = txt2mu.sh mu2html.sh expand.sh txt2html.sh emailrelay.sh
CLEANFILES = $(noinst_SCRIPTS) $(e_init_SCRIPTS) $(e_examples_DATA) $(work_scripts)
@ -106,6 +141,7 @@ TESTS = emailrelay-test.sh
SUFFIXES = .sh_ .sh
subdir = bin
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -114,7 +150,7 @@ SCRIPTS = $(e_init_SCRIPTS) $(noinst_SCRIPTS)
DIST_SOURCES =
DATA = $(e_examples_DATA)
DIST_COMMON = Makefile.am Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
all: all-am
.SUFFIXES:
@ -166,9 +202,12 @@ uninstall-e_examplesDATA:
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
@ -200,6 +239,9 @@ check-TESTS: $(TESTS)
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
@ -215,9 +257,24 @@ check-TESTS: $(TESTS)
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes=`echo "$$banner" | sed s/./=/g`; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -n "$$skipped" && echo "$$skipped"; \
test -n "$$report" && echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
@ -227,7 +284,13 @@ top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -254,7 +317,6 @@ all-am: Makefile $(SCRIPTS) $(DATA)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(e_initdir) $(DESTDIR)$(e_examplesdir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -275,7 +337,7 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -285,7 +347,7 @@ clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
@ -308,13 +370,21 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-e_examplesDATA uninstall-e_initSCRIPTS \
uninstall-info-am uninstall-local
@ -325,8 +395,8 @@ uninstall-am: uninstall-e_examplesDATA uninstall-e_initSCRIPTS \
install-exec install-exec-am install-info install-info-am \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic uninstall uninstall-am \
uninstall-e_examplesDATA uninstall-e_initSCRIPTS \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
uninstall-am uninstall-e_examplesDATA uninstall-e_initSCRIPTS \
uninstall-info-am uninstall-local
@ -343,6 +413,7 @@ install-data-local: install-e_examplesDATA install-e_initSCRIPTS
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-resubmit.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-deliver.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-process.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-runperl.js
uninstall-local:
-rmdir $(DESTDIR)$(e_examplesdir) 2>/dev/null

85
bin/emailrelay-runperl.js Normal file
View File

@ -0,0 +1,85 @@
//
// Copyright (C) 2001-2003 Graeme Walker <graeme_walker@users.sourceforge.net>
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ===
//
// emailrelay-runperl.js
//
// An example JavaScript wrapper that runs a perl script
// for E-MailRelay. The perl script's standard input
// will the be the e-mail's content file. The perl script
// should process this to its standard output, and
// terminate with a zero exit code.
//
// Eg:
// emailrelay --as-server --filter "cscript.exe //nologo emailrelay-runperl.js"
//
// Uses CMD.EXE which may be not be available on some
// versions of Windows.
//
// Edit the next two lines as necessary, but avoid spaces in paths.
//
var cfg_perl="perl -S -T -w"
var cfg_perl_script="spamassassin"
// parse our command line
var args = WScript.Arguments
var filename = args(0)
// prepare a command using CMD.EXE to do file redirection
var cmd_in = "\"" + filename + "\""
var cmd_out = "\"" + filename + ".tmp\""
var cmd_err = "\"" + filename + ".err\""
var cmd_perl = "cmd /c " + cfg_perl + " " + cfg_perl_script
var cmd = cmd_perl + " < " + cmd_in + " > " + cmd_out + " 2> " + cmd_err
// run the command
var sh = WScript.CreateObject("WScript.Shell")
var rc = sh.Run( cmd , 0 , true )
// check the file redirection
var fs = WScript.CreateObject("Scripting.FileSystemObject")
if( !fs.FileExists(filename+".tmp") || !fs.FileExists(filename+".err") )
{
WScript.Echo("<<file redirection error>>")
WScript.Quit( 2 )
}
// success or failure
if( rc == 0 )
{
fs.DeleteFile( filename )
fs.MoveFile( filename + ".tmp" , filename )
fs.DeleteFile( filename + ".err" )
WScript.Quit( 0 )
}
else
{
fs.DeleteFile( filename + ".tmp" )
var error = fs.OpenTextFile( filename + ".err" , 1 )
if( ! error.AtEndOfStream )
{
var reason = error.ReadLine()
WScript.Echo( "<<" + reason + ">>" )
}
error.Close()
fs.DeleteFile( filename + ".err" )
WScript.Quit( rc )
}

View File

@ -33,13 +33,17 @@
#
# If this test takes more a minute then it has failed.
#
# usage: emailrelay-test.sh [-v] [-d] [<exe-dir>]
# usage: emailrelay-test.sh [-v] [-d] [-n] [<exe-dir>]
# -v use valgrind
# -d use --debug
# -n no cleanup
#
# configuration
#
use_valgrind="0" ; if test "${1}" = "-v" ; then use_valgrind="1" ; shift ; fi
debug="" ; if test "${1}" = "-d" ; then debug="--debug" ; shift ; fi
no_cleanup="0" ; if test "${1}" = "-n" ; then no_cleanup="1" ; shift ; fi
exe_dir="../src/main" ; if test "${1}" != "" ; then exe_dir="${1}" ; fi
exe="${exe_dir}/emailrelay"
poke="${exe_dir}/emailrelay-poke"
@ -84,9 +88,16 @@ Cleanup()
then
grep "MailRelay-Reason" ${base_dir}/*/*envelope*bad > "${summary_log}" 2>/dev/null
grep "." ${base_dir}/log-? >> "${summary_log}" 2>/dev/null
if test "${use_valgrind}" -eq 1
then
grep "." ${base_dir}/valgrind.* >> "${summary_log}" 2>/dev/null
fi
ls -lR ${base_dir} >> "${summary_log}" 2>/dev/null
if test "${no_cleanup}" -eq 0
then
rm -rf ${base_dir} 2>/dev/null
fi
fi
}
Trap()
@ -117,7 +128,7 @@ RunClient()
log_="${3}"
pidfile_="${4}"
${exe} --forward --no-daemon --dont-serve --log --no-syslog \
${exe} ${debug} --forward --no-daemon --dont-serve --log --verbose --no-syslog \
--pid-file ${base_dir}/${pidfile_} \
--forward-to ${to_} --spool-dir ${base_dir}/${spool_} 2> ${base_dir}/${log_}
}
@ -234,12 +245,13 @@ RunServer ${pp}05 ${pp}15 store-4 log-5 pid-5 "--poll 1 --forward-to localhost:$
RunServer ${pp}06 ${pp}16 store-6 log-6 pid-6 "--filter ${base_dir}/filter.sh"
CreateMessages
RunClient localhost:${pp}01 store-1 log-c pid-5
RunClient localhost:${pp}01 store-1 log-c pid-7
RunPoke ${pp}12 log-p
for i in 0 1 2 3 4 5 6 7 8 9
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
sleep 2
if test "${use_valgrind}" -eq 1 ; then sleep 50 ; fi
sleep 10
CheckResults store-6
if test $? -eq 0 ; then break ; fi
done

View File

@ -98,7 +98,7 @@ start_switches="--as-server --pid-file ${pid_file} `cat \"${cfg_file}\" 2>/dev/n
#
# <style>_reset() -- initialise
# <style>_cmd_stop() -- stop command
# <style>_cmd_start() -- stop command
# <style>_cmd_start() -- start command
# <style>_cmd_restarted() -- called after stop/start
# <style>_cmd_status() -- status command
# <style>_exit() -- exit with saved errno

1523
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(src/gsmtp/gsmtp.h)
AM_INIT_AUTOMAKE(emailrelay,1.1.3)
AM_INIT_AUTOMAKE(emailrelay,1.2)
AM_CONFIG_HEADER(config.h)
dnl ===

88
depcomp
View File

@ -1,7 +1,7 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -172,19 +172,25 @@ sgi)
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory.
# Also, the AIX compiler puts `$object:' at the start of each line;
# $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
outname="$stripped.o"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
@ -192,6 +198,7 @@ aix)
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
@ -206,6 +213,44 @@ aix)
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
@ -240,7 +285,7 @@ tru64)
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the [].
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
@ -254,7 +299,7 @@ tru64)
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o.
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
@ -265,9 +310,7 @@ dashmstdout)
shift
fi
# Remove `-o $object'. We will use -o /dev/null later,
# however we can't do the remplacement now because
# `-o $object' might simply not be used
# Remove `-o $object'.
IFS=" "
for arg
do
@ -287,7 +330,11 @@ dashmstdout)
done
test -z "$dashmflag" && dashmflag=-M
"$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
@ -306,6 +353,13 @@ dashXmstdout)
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
@ -318,7 +372,9 @@ makedepend)
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
-*)
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
@ -339,7 +395,7 @@ makedepend)
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout.
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
@ -381,7 +437,7 @@ cpp)
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "

View File

@ -25,7 +25,7 @@ man_files_out=emailrelay.1.gz emailrelay-passwd.1.gz emailrelay-poke.1.gz emailr
html_files_in=doxygen_header.html
html_files_thru=index.html emailrelay-man.html $(stylesheet)
html_files_out=readme.html developer.html reference.html userguide.html windows.html changelog.html
png_files=gsmtp-classes.png gnet-classes.png sequence-1.png sequence-2.png sequence-3.png sequence-4.png gnet-client.png gsmtp-serverprotocol.png gsmtp-scannerclient.png
png_files=gsmtp-classes.png gnet-classes.png sequence-1.png sequence-2.png sequence-3.png sequence-4.png gnet-client.png gsmtp-serverprotocol.png gsmtp-scannerclient.png auth.png
EXTRA_DIST = $(man_files_in) $(txt_files) $(html_files_in) $(html_files_thru) $(png_files)
noinst_SCRIPTS = .dox

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,74 +16,94 @@
#
#
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -91,7 +111,22 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
stylesheet = emailrelay.css
txt_files = developer.txt reference.txt userguide.txt windows.txt
@ -100,7 +135,7 @@ man_files_out = emailrelay.1.gz emailrelay-passwd.1.gz emailrelay-poke.1.gz emai
html_files_in = doxygen_header.html
html_files_thru = index.html emailrelay-man.html $(stylesheet)
html_files_out = readme.html developer.html reference.html userguide.html windows.html changelog.html
png_files = gsmtp-classes.png gnet-classes.png sequence-1.png sequence-2.png sequence-3.png sequence-4.png gnet-client.png gsmtp-serverprotocol.png gsmtp-scannerclient.png
png_files = gsmtp-classes.png gnet-classes.png sequence-1.png sequence-2.png sequence-3.png sequence-4.png gnet-client.png gsmtp-serverprotocol.png gsmtp-scannerclient.png auth.png
EXTRA_DIST = $(man_files_in) $(txt_files) $(html_files_in) $(html_files_thru) $(png_files)
noinst_SCRIPTS = .dox
@ -121,6 +156,7 @@ converter_helper2_src = $(top_srcdir)/bin/mu2html.sh_
converter_helper3 = $(top_builddir)/bin/expand.sh
converter_helper3_src = $(top_srcdir)/bin/expand.sh_
subdir = doc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -129,7 +165,7 @@ SCRIPTS = $(noinst_SCRIPTS)
DIST_SOURCES =
DATA = $(e_doc_DATA) $(e_man1_DATA)
DIST_COMMON = Makefile.am Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
all: all-am
.SUFFIXES:
@ -179,13 +215,22 @@ uninstall-e_man1DATA:
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -211,7 +256,6 @@ all-am: Makefile $(SCRIPTS) $(DATA)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(e_docdir) $(DESTDIR)$(e_man1dir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -232,7 +276,7 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -242,7 +286,7 @@ clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
@ -264,13 +308,21 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-e_docDATA uninstall-e_man1DATA uninstall-info-am \
uninstall-local
@ -281,8 +333,9 @@ uninstall-am: uninstall-e_docDATA uninstall-e_man1DATA uninstall-info-am \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic uninstall uninstall-am uninstall-e_docDATA \
uninstall-e_man1DATA uninstall-info-am uninstall-local
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-e_docDATA uninstall-e_man1DATA uninstall-info-am \
uninstall-local
.txt.html:

BIN
doc/auth.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -70,6 +70,10 @@ server.
<DD>
Enables the administration interface and specifies its listening port number.
<DT><B>-Q,--admin-terminate </B>
<DD>
Enables the terminate command on the admin interface.
<DT><B>-q,--as-client </B><I>host:port</I>
<DD>
@ -86,6 +90,10 @@ Runs as a server: equivalent to <I>--log</I> <I>--close-stderr</I> <I>--postmast
<DD>
Enables authentication with remote server, using the given secrets file.
<DT><B>-Y,--client-filter </B><I>program</I>
<DD>
Defines a mail processor program for when forwarding.
<DT><B>-e,--close-stderr </B>
<DD>
@ -113,7 +121,7 @@ Dont act as a server (usually used with <I>--forward</I>).
<DT><B>-z,--filter </B><I>program</I>
<DD>
Defines a mail processor program.
Defines a mail processor program for when storing.
<DT><B>-f,--forward </B>
<DD>
@ -428,7 +436,7 @@ Graeme Walker, mailto:<A HREF="mailto:graeme_walker@users.sourceforge.net">graem
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 14:14:01 GMT, September 07, 2003
Time: 21:06:55 GMT, November 06, 2003
</BODY>
</HTML>
<!-- Copyright (C) 2001-2003 Graeme Walker <graeme_walker@users.sourceforge.net>. All rights reserved. -->

View File

@ -56,6 +56,9 @@ server.
.B \-a,--admin \fIadmin-port\fR
Enables the administration interface and specifies its listening port number.
.TP
.B \-Q,--admin-terminate
Enables the terminate command on the admin interface.
.TP
.B \-q,--as-client \fIhost:port\fR
Runs as a client, forwarding spooled mail to <host>: equivalent to \fI--log\fR \fI--no-syslog\fR \fI--no-daemon\fR \fI--dont-serve\fR \fI--forward\fR \fI--forward-to\fR.
.TP
@ -68,6 +71,9 @@ Runs as a server: equivalent to \fI--log\fR \fI--close-stderr\fR \fI--postmaster
.B \-C,--client-auth \fIfile\fR
Enables authentication with remote server, using the given secrets file.
.TP
.B \-Y,--client-filter \fIprogram\fR
Defines a mail processor program for when forwarding.
.TP
.B \-e,--close-stderr
Closes the standard error stream after start-up.
.TP
@ -87,7 +93,7 @@ Dont listen for smtp connections (usually used with \fI--admin\fR).
Dont act as a server (usually used with \fI--forward\fR).
.TP
.B \-z,--filter \fIprogram\fR
Defines a mail processor program.
Defines a mail processor program for when storing.
.TP
.B \-f,--forward
Forwards stored mail on startup (requires \fI--forward-to\fR).

View File

@ -16,6 +16,9 @@ where <switch> is:
# --admin (-a)
Enables the administration interface and specifies its listening port number.
# --admin-terminate (-Q)
Enables the terminate command on the admin interface.
# --as-client (-q)
Runs as a client, forwarding spooled mail to <host>: equivalent to "--log --no-syslog --no-daemon --dont-serve --forward --forward-to".
@ -28,6 +31,9 @@ where <switch> is:
# --client-auth (-C)
Enables authentication with remote server, using the given secrets file.
# --client-filter (-Y)
Defines a mail processor program for when forwarding.
# --close-stderr (-e)
Closes the standard error stream after start-up.
@ -47,7 +53,7 @@ where <switch> is:
Dont act as a server (usually used with --forward).
# --filter (-z)
Defines a mail processor program.
Defines a mail processor program for when storing.
# --forward (-f)
Forwards stored mail on startup (requires --forward-to).
@ -233,17 +239,17 @@ Mail processing
---------------
The "--filter" command-line switch allows you to specify a mail pre-processor
program which operates on mail messages as they pass through the E-MailRelay
system. The mail pre-processor program is run as soon as the mail message has been
stored in the spool directory, with the full path of the content file specified
on the command line.
system. The mail pre-processor program is run as soon as the mail message has
been stored in the spool directory, with the full path of the content file added
onto the end of the given command line.
For example, the following command will start a proxy server on port 10025 which
processes mail using the specified filter program, and then forwards the mail on
to the system's default MTA (on port 25):
emailrelay --as-proxy localhost:smtp --port 10025 --no-syslog \
--filter ${HOME}/.emailrelay/filter \
--spool-dir ${HOME}/.emailrelay/spool
--filter $HOME/.emailrelay/filter \
--spool-dir $HOME/.emailrelay/spool
The pre-processor program should terminate with an exit code of zero to indicate
success, or a value between 1 and 99 to indicate failure. Exit codes between
@ -262,17 +268,18 @@ pre-processor is running, except the filename. But if the message is deleted
by the pre-processor then E-MailRelay will be upset, so to avoid the
error message use an exit code of 100.
If the pre-processor program creates new messages in the spool directory then
they may not be processed immediately, or they may be completely ignored. To get
E-MailRelay to pick up new messages in the spool directory use the "--poll"
switch, or run "emailrelay --as-client" from within the pre-processor program.
If the pre-processor program creates completely new messages in the spool
directory then they may not be processed immediately, or they may be completely
ignored. To get E-MailRelay to pick up new messages in the spool directory use
the "--poll" switch, or run "emailrelay --as-client" from within the
pre-processor program.
As an example, the following shell script examines the client's IP address and
conditionally dumps the message into "sendmail" (using the sendmail command-line
interface rather than SMTP):
As an example of a simple pre-processor this shell script examines the sending
client's IP address and conditionally passes the message into "sendmail" (using
the sendmail command-line interface rather than SMTP):
#!/bin/sh
#
# filter.sh
content="${1}"
envelope="`echo \"${content}\" | sed 's/content/envelope.new/'`"
ip="`awk '/MailRelay-Client:/ {print $2;exit}' \"${envelope}\"`"
@ -286,20 +293,53 @@ interface rather than SMTP):
The first thing this script does is convert the path of the content file which
it is given, into the corresponding envelope file. It then extracts the client's
IP address out of the envelope file using "awk". If this matches then it pipes the
message content into sendmail, deletes the message and exits with a value of 100.
The exit value of 100 tells E-MailRelay to forget the message, and not to
complain about the files disappearing.
IP address out of the envelope file using "awk". If this matches the fixed
address then it pipes the message content into sendmail, deletes the message and
exits with a value of 100. The exit value of 100 tells E-MailRelay to forget the
message, and not to complain about the files disappearing.
For Windows this example can be rewritten in JavaScript:
// filter.js
var content = WScript.Arguments(0) ;
var envelope = content.substr(0,content.length-7) + "envelope.new" ;
var fs = WScript.CreateObject( "Scripting.FileSystemObject" ) ;
var ts = fs.OpenTextFile( envelope , 1 , false ) ;
var e = ts.ReadAll() ;
ts.Close() ;
var re = new RegExp( "MailRelay-Client: \(.*\)" ) ;
var ip = e.match(re)[1] ;
if( ip == "192.168.0.2" )
{
var sh = WScript.CreateObject( "Wscript.Shell" ) ;
sh.Run( "sendmail " + content ) ; // bogus
fs.DeleteFile( content ) ;
fs.DeleteFile( envelope ) ;
WScript.Quit( 100 )
}
WScript.Quit( 0 ) ;
Pre-processor programs written in JavaScript can be run with "cscript", using an
E-MailRelay command line with a "--filter" switch something like this (V1.1.3
or later):
--filter "c:/winnt/system32/cscript.exe \\nologo c:/program\ files/emailrelay/filter.js"
A more complex example script which does rot-13 masking is also provided in the
distribution ("emailrelay-process.sh"). This does some simple MIME encoding, and
could be used as a template for more sophisticated message encryption.
There also a "--client-filter" switch that enables pre-processing of messages
just before they are forwarded, rather then when stored. But note that by then
it is too late to notify the SMTP client of any processing failures.
Some points to note when writing "--filter" programs:
* The standard input and output are not used; the content filename is passed on the command line.
* Programs run with a reduced set of environment variables.
* The E-MailRelay process is completely blocked while the "--filter" program runs.
* E-MailRelay files use CR-LF line terminators, as required by the RFCs.
* Windows JScript and VBScript programs must be run using "cscript".
* Windows Perl programs must be run from a batch file, or from a JScript/VBScript wrapper.
Address verification
--------------------
@ -318,9 +358,7 @@ local host's fully qualified domain name, (5) the current "MAIL" command's "FROM
address or the empty string for the "VRFY" command, (6) the IP address of the
client connection, (7) the authentication mechanism used by the client ("NONE"
if trusted), and (8) either the authentication name or the fourth field from
authentication secrets file if a trusted IP address. Under Windows there is an
additional command line argument: (1) is the file descriptor which must be
used instead of stdout, (2) is the full address, etc.
authentication secrets file if a trusted IP address.
For valid local mailbox addresses the verifier is expected to write two lines to
the standard output -- the full name associated with the mailbox, and the
@ -352,6 +390,7 @@ by connecting on a trusted IP address:
#!/bin/sh
# verifier.sh
address="${1}"
host="$3"
local_domain="$4"
auth_mechanism="$7"
@ -364,6 +403,22 @@ by connecting on a trusted IP address:
echo "${address}" # again
exit 1 # accept the recipient address
or in JavaScript:
// verifier.js
var address = WScript.Arguments(0) ;
var host = WScript.Arguments(2) ;
var local_domain = WScript.Arguments(3) ;
var auth_mechanism = WScript.Arguments(6) ;
if( auth_mechanism == "NONE" && host != local_domain )
{
WScript.Echo( "cannot relay without authentication" ) ;
WScript.Quit( 2 ) ;
}
WScript.Echo( address ) ;
WScript.Echo( address ) ;
WScript.Quit( 1 ) ;
If this verifier script is used with a suitable "--server-auth" file then it can
be used to prevent open relay without restricting authenticated clients.
@ -508,44 +563,6 @@ from a particular IP address is allowed. This type of POP-before-SMTP
authentication can be done outside the E-MailRelay system by POP/IMAP utilities
such as "fetchmail".
Application notes
-----------------
# *Mutt* [http://www.mutt.org]
Mutt can be configured to use the E-MailRelay 'submit' program rather than
"sendmail" with an entry in the ".muttrc" file like this:
set sendmail="/usr/local/libexec/emailrelay-submit"
or
set sendmail="/usr/sbin/emailrelay-submit"
This puts the messages in the E-MailRelay spool-directory, but note that in
proxy mode they will be ignored unless you use "--poll". Or you could use
"--admin" plus "flush"/"emailrelay-poke".
# *Spam Assassin* [http://spamassassin.taint.org]
The E-MailRelay server can use Spam Assassin to mark potential spam by having
a small shell script which calls spamassassin's "spamc" program installed
as the E-MailRelay mail pre-processor (using the "--filter" command-line switch).
Your "--filter" shell script would look something like this:
#!/bin/sh
tmp="/tmp/`basename $0`.$$.tmp"
pre="dos2unix"
post="unix2dos"
${pre} < ${1} | spamc > ${tmp}
if test $? -eq 0 ; then ${post} < ${tmp} > ${1} ; fi
rm -f ${tmp} 2>/dev/null
exit 0
This just pipes the content file into "spamc", using "dos2unix" to remove
carriage-returns. The output is saved in a temporary file, and then put back
into the content file using "unix2dos" to restore the carriage-returns.
Files and directories
---------------------
Following a normal build from source, a "make install" puts files in the

View File

@ -311,7 +311,7 @@ variable "GLOGOUTPUT_FILE" can be defined as the name of a log file.
Preventing open mail relay
--------------------------
If you are running E-MailRelay as a server with a permanent connection to the
Internet it is important to prevent open mail relay. By default public mail
Internet it is important to prevent open mail relay. By default open mail
relaying is not possible because E-MailRelay does not accept IP connections from
remote clients. However, if the "--remote-clients" switch is used then you need
to be more careful. One option is to require all clients to authenticate, by
@ -328,6 +328,53 @@ line in the secrets file. To complete the solution you must have an address
verifier script ("--verifier") which rejects remote addresses if the client has
not authenticated. Again, refer to the reference guide for further details.
SpamAssassin
------------
The E-MailRelay server can use *Spam Assassin* [http://spamassassin.org] to mark
potential spam by having a small shell script which calls "spamassassin"
installed as the E-MailRelay mail pre-processor using the "--filter" command-line
switch.
Your "--filter" shell script could look something like this:
#!/bin/sh
tmp="/tmp/`basename $0`.$$.tmp"
awk '{sub("\r$","");print}' "${1}" | spamassassin --local | awk '{print $0 "\r"}' > $tmp && mv $tmp "${1}"
rm -f $tmp 2>/dev/null
exit 0
This just pipes the message content file into "spamassassin", using "awk" to
remove carriage-returns. The output is saved in a temporary file, and then put
back into the content file, using "awk" again to restore carriage-returns.
To delete spam altogether, rather than just marking it, you could add
"--exit-code" to the spamassassin command line and deal with messages according
to the exit code:
#!/bin/sh
awk '{sub("\r$","");print}' "${1}" | spamassassin --local --exit-code > /dev/null
if test $? -ne 0
then
# spam...
content="${1}"
envelope="`echo \"${content}\" | sed 's/content/envelope.new/'`"
rm -f "${envelope}" "${content}"
exit 100 # <= tell E-MailRelay that the files are gone
fi
exit 0
On Windows there is less of a problem with carriage returns, but because
"spamassassin" is a perl script it takes a bit of work to call it correctly.
An example JavaScript wrapper called "emailrelay-runperl.js" is included in
the distribution that by default calls "spamassassin".
Try an E-MailRelay command line like this:
emailrelay --as-server --filter "cscript //nologo c:/program\ files/emailrelay/emailrelay-runperl.js"
But note that you may have to add explicit paths if perl or spamassassin are not
on your path.

View File

@ -1,10 +1,10 @@
Summary: Simple e-mail message transfer agent using SMTP
Name: emailrelay
Version: 1.1.3
Version: 1.2
Release: 1
Copyright: GPL
Group: System Environment/Daemons
Source: http://emailrelay.sourceforge.net/.../emailrelay-src-1.1.3.tar.gz
Source: http://emailrelay.sourceforge.net/.../emailrelay-src-1.2.tar.gz
BuildRoot: /tmp/emailrelay-install
%define prefix /usr

View File

@ -1,19 +1,37 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
@ -56,7 +74,7 @@ dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
-c) instcmd=$cpprog
shift
continue;;
@ -79,7 +97,7 @@ while [ x"$1" != x ]; do
shift
continue;;
-s) stripcmd="$stripprog"
-s) stripcmd=$stripprog
shift
continue;;
@ -106,7 +124,7 @@ done
if [ x"$src" = x ]
then
echo "install: no input file specified"
echo "$0: no input file specified" >&2
exit 1
else
:
@ -116,7 +134,7 @@ if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
if [ -d "$dst" ]; then
instcmd=:
chmodcmd=""
else
@ -132,13 +150,13 @@ else
then
:
else
echo "install: $src does not exist"
echo "$0: $src does not exist" >&2
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
echo "$0: no destination specified" >&2
exit 1
else
:
@ -147,16 +165,16 @@ else
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
if [ -d "$dst" ]
then
dst="$dst"/`basename $src`
dst=$dst/`basename "$src"`
else
:
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
@ -165,48 +183,48 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
IFS="${IFS-$defaultIFS}"
oIFS="${IFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
pathcomp=$pathcomp$1
shift
if [ ! -d "${pathcomp}" ] ;
if [ ! -d "$pathcomp" ] ;
then
$mkdirprog "${pathcomp}"
$mkdirprog "$pathcomp"
else
:
fi
pathcomp="${pathcomp}/"
pathcomp=$pathcomp/
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
$doit $instcmd "$dst" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
dstfile=`basename "$dst"`
else
dstfile=`basename $dst $transformbasename |
dstfile=`basename "$dst" $transformbasename |
sed $transformarg`$transformbasename
fi
@ -214,20 +232,24 @@ else
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
dstfile=`basename "$dst"`
else
:
fi
# Make a temp file name in the proper directory.
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/#inst.$$#
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
$doit $instcmd "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits
@ -235,17 +257,38 @@ else
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
# Now remove or move aside any old file at destination location. We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons. In this case, the final cleanup
# might fail but the new file should still install successfully.
{
if [ -f "$dstdir/$dstfile" ]
then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
{
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
exit 0
{
(exit 0); exit
}

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -13,74 +13,94 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -88,22 +108,39 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
#
#
SUBDIRS = gcc2.95 msvc6.0 sunpro5
subdir = lib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
uninstall-info-recursive all-recursive install-data-recursive \
install-exec-recursive installdirs-recursive install-recursive \
uninstall-recursive check-recursive installcheck-recursive
DIST_COMMON = Makefile.am Makefile.in
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
@ -169,10 +206,17 @@ tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@ -188,9 +232,15 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if (etags --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
else \
include_option=--include; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
test -f $$subdir/TAGS && \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@ -203,20 +253,41 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -274,7 +345,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -284,7 +355,7 @@ clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
@ -306,31 +377,39 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
clean-generic clean-recursive distclean distclean-generic \
distclean-recursive distclean-tags distdir dvi dvi-am \
dvi-recursive info info-am info-recursive install install-am \
install-data install-data-am install-data-recursive \
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-recursive ctags ctags-recursive distclean \
distclean-generic distclean-recursive distclean-tags distdir \
dvi dvi-am dvi-recursive info info-am info-recursive install \
install-am install-data install-data-am install-data-recursive \
install-exec install-exec-am install-exec-recursive \
install-info install-info-am install-info-recursive install-man \
install-recursive install-strip installcheck installcheck-am \
installdirs installdirs-am installdirs-recursive \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-recursive tags tags-recursive uninstall \
uninstall-am uninstall-info-am uninstall-info-recursive \
uninstall-recursive
mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \
ps-recursive tags tags-recursive uninstall uninstall-am \
uninstall-info-am uninstall-info-recursive uninstall-recursive
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,74 +16,94 @@
#
#
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -91,15 +111,31 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
EXTRA_DIST = iostream limits sstream xlocale
subdir = lib/gcc2.95
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DIST_COMMON = Makefile.am Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
all: all-am
.SUFFIXES:
@ -112,13 +148,22 @@ uninstall-info-am:
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -143,7 +188,6 @@ check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -163,7 +207,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -173,7 +217,7 @@ clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
@ -195,13 +239,21 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic distclean \
@ -210,7 +262,8 @@ uninstall-am: uninstall-info-am
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic uninstall uninstall-am uninstall-info-am
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,74 +16,94 @@
#
#
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -91,15 +111,31 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
EXTRA_DIST = cstdio cstdlib cstring ctime cmath
subdir = lib/msvc6.0
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DIST_COMMON = Makefile.am Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
all: all-am
.SUFFIXES:
@ -112,13 +148,22 @@ uninstall-info-am:
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -143,7 +188,6 @@ check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -163,7 +207,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -173,7 +217,7 @@ clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
@ -195,13 +239,21 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic distclean \
@ -210,7 +262,8 @@ uninstall-am: uninstall-info-am
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic uninstall uninstall-am uninstall-info-am
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -13,74 +13,94 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -88,17 +108,33 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
#
#
EXTRA_DIST = xar
subdir = lib/sunpro5
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DIST_COMMON = Makefile.am Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
all: all-am
.SUFFIXES:
@ -111,13 +147,22 @@ uninstall-info-am:
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -142,7 +187,6 @@ check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -162,7 +206,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -172,7 +216,7 @@ clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
@ -194,13 +238,21 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic distclean \
@ -209,7 +261,8 @@ uninstall-am: uninstall-info-am
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic uninstall uninstall-am uninstall-info-am
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -1,6 +1,6 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@ -165,7 +165,7 @@ WARNING: \`$1' is missing on your system. You should only need it if
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them.
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
@ -326,7 +326,7 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments.
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1

View File

@ -12,17 +12,28 @@ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments
while test $# -gt 0 ; do
case "${1}" in
-h | --help | --h* ) # -h for help
echo "${usage}" 1>&2; exit 0 ;;
-m ) # -m PERM arg
case $1 in
-h | --help | --h*) # -h for help
echo "$usage" 1>&2
exit 0
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
dirmode="${1}"
shift ;;
-- ) shift; break ;; # stop option processing
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
* ) break ;; # first non-opt arg
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
@ -36,20 +47,22 @@ do
done
case $# in
0) exit 0 ;;
0) exit 0 ;;
esac
case $dirmode in
'')
'')
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
fi ;;
*)
fi
;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
fi ;;
fi
;;
esac
for file
@ -61,8 +74,8 @@ do
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
@ -75,7 +88,6 @@ do
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
@ -94,6 +106,6 @@ exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 3
# sh-indentation: 2
# End:
# mkinstalldirs ends here

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -13,74 +13,94 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -88,23 +108,40 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
#
#
SUBDIRS = glib gnet gsmtp main win32
EXTRA_DIST = mingw.mak mingw-common.mak
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
uninstall-info-recursive all-recursive install-data-recursive \
install-exec-recursive installdirs-recursive install-recursive \
uninstall-recursive check-recursive installcheck-recursive
DIST_COMMON = Makefile.am Makefile.in
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
@ -170,10 +207,17 @@ tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@ -189,9 +233,15 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if (etags --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
else \
include_option=--include; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
test -f $$subdir/TAGS && \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@ -204,20 +254,41 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -275,7 +346,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -285,7 +356,7 @@ clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
@ -307,31 +378,39 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
clean-generic clean-recursive distclean distclean-generic \
distclean-recursive distclean-tags distdir dvi dvi-am \
dvi-recursive info info-am info-recursive install install-am \
install-data install-data-am install-data-recursive \
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-recursive ctags ctags-recursive distclean \
distclean-generic distclean-recursive distclean-tags distdir \
dvi dvi-am dvi-recursive info info-am info-recursive install \
install-am install-data install-data-am install-data-recursive \
install-exec install-exec-am install-exec-recursive \
install-info install-info-am install-info-recursive install-man \
install-recursive install-strip installcheck installcheck-am \
installdirs installdirs-am installdirs-recursive \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-recursive tags tags-recursive uninstall \
uninstall-am uninstall-info-am uninstall-info-recursive \
uninstall-recursive
mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \
ps-recursive tags tags-recursive uninstall uninstall-am \
uninstall-info-am uninstall-info-recursive uninstall-recursive
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -58,6 +58,8 @@ libglib_a_SOURCES = \
gdirectory_unix.cpp \
gexception.cpp \
gexception.h \
gexe.cpp \
gexe.h \
gfile.cpp \
gfile.h \
gfile_unix.cpp \

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -13,74 +13,94 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -88,7 +108,22 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
#
#
@ -134,6 +169,8 @@ libglib_a_SOURCES = \
gdirectory_unix.cpp \
gexception.cpp \
gexception.h \
gexe.cpp \
gexe.h \
gfile.cpp \
gfile.h \
gfile_unix.cpp \
@ -171,6 +208,7 @@ libglib_a_SOURCES = \
gtime.h
subdir = src/glib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -182,19 +220,15 @@ am_libglib_a_OBJECTS = garg.$(OBJEXT) garg_unix.$(OBJEXT) \
gcleanup_unix.$(OBJEXT) gdaemon_unix.$(OBJEXT) gdate.$(OBJEXT) \
gdatetime.$(OBJEXT) gdatetime_unix.$(OBJEXT) \
gdirectory.$(OBJEXT) gdirectory_unix.$(OBJEXT) \
gexception.$(OBJEXT) gfile.$(OBJEXT) gfile_unix.$(OBJEXT) \
gfs_unix.$(OBJEXT) ggetopt.$(OBJEXT) gidentity_unix.$(OBJEXT) \
glog.$(OBJEXT) glogoutput.$(OBJEXT) glogoutput_unix.$(OBJEXT) \
gmd5_rsa.$(OBJEXT) gpath.$(OBJEXT) gpidfile.$(OBJEXT) \
gprocess_unix.$(OBJEXT) groot.$(OBJEXT) gslot.$(OBJEXT) \
gstr.$(OBJEXT) gtime.$(OBJEXT)
gexception.$(OBJEXT) gexe.$(OBJEXT) gfile.$(OBJEXT) \
gfile_unix.$(OBJEXT) gfs_unix.$(OBJEXT) ggetopt.$(OBJEXT) \
gidentity_unix.$(OBJEXT) glog.$(OBJEXT) glogoutput.$(OBJEXT) \
glogoutput_unix.$(OBJEXT) gmd5_rsa.$(OBJEXT) gpath.$(OBJEXT) \
gpidfile.$(OBJEXT) gprocess_unix.$(OBJEXT) groot.$(OBJEXT) \
gslot.$(OBJEXT) gstr.$(OBJEXT) gtime.$(OBJEXT)
libglib_a_OBJECTS = $(am_libglib_a_OBJECTS)
DEFS = @DEFS@
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/garg.Po ./$(DEPDIR)/garg_unix.Po \
@ -204,9 +238,9 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/gdatetime_unix.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gdirectory.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gdirectory_unix.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gexception.Po ./$(DEPDIR)/gfile.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gfile_unix.Po ./$(DEPDIR)/gfs_unix.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ggetopt.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gexception.Po ./$(DEPDIR)/gexe.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gfile.Po ./$(DEPDIR)/gfile_unix.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gfs_unix.Po ./$(DEPDIR)/ggetopt.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gidentity_unix.Po ./$(DEPDIR)/glog.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/glogoutput.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/glogoutput_unix.Po \
@ -220,14 +254,12 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
CXXFLAGS = @CXXFLAGS@
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libglib_a_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(libglib_a_SOURCES)
all: all-am
@ -263,6 +295,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdirectory.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdirectory_unix.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gexception.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gexe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfile_unix.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfs_unix.Po@am__quote@
@ -280,26 +313,35 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtime.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.cpp.o:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
.cpp.obj:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CXXCOMPILE) -c -o $@ `cygpath -w $<`
CXXDEPMODE = @CXXDEPMODE@
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@ -325,20 +367,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -363,7 +426,6 @@ check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -383,7 +445,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -393,9 +455,10 @@ clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
@ -416,25 +479,33 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic tags uninstall uninstall-am \
uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am info \
info-am install install-am install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am tags uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -89,6 +89,7 @@ void G::Arg::parseCore( const std::string & command_line )
protect( s ) ;
G::Str::splitIntoTokens( s , m_array , " " ) ;
unprotect( m_array ) ;
dequote( m_array ) ;
}
void G::Arg::protect( std::string & s )
@ -120,6 +121,20 @@ void G::Arg::unprotect( StringArray & array )
}
}
void G::Arg::dequote( StringArray & array )
{
// remove quotes if first and last characters
char qq = '\"' ;
for( StringArray::iterator p = array.begin() ; p != array.end() ; ++p )
{
std::string & s = *p ;
if( s.length() > 1U && s.at(0U) == qq && s.at(s.length()-1U) == qq )
{
s = s.substr(1U,s.length()-2U) ;
}
}
}
bool G::Arg::contains( const std::string & sw , size_t sw_args , bool cs ) const
{
return find( cs , sw , sw_args , NULL ) ;

View File

@ -121,8 +121,9 @@ private:
void setPrefix() ;
static bool match( bool , const std::string & , const std::string & ) ;
void parseCore( const std::string & ) ;
void protect( std::string & ) ;
void unprotect( StringArray & ) ;
static void protect( std::string & ) ;
static void unprotect( StringArray & ) ;
static void dequote( StringArray & ) ;
private:
StringArray m_array ;

View File

@ -74,6 +74,7 @@ G::CleanupImp::Link * G::CleanupImp::m_tail = NULL ;
void G::Cleanup::add( void (*fn)(const char*) , const char * arg )
{
if( arg != NULL )
CleanupImp::add( fn , arg ) ;
}

66
src/glib/gexe.cpp Normal file
View File

@ -0,0 +1,66 @@
//
// Copyright (C) 2001-2003 Graeme Walker <graeme_walker@users.sourceforge.net>
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ===
//
// gexe.cpp
//
#include "gdef.h"
#include "gexe.h"
#include "gstr.h"
G::Executable::Executable( const G::Path & exe ) :
m_exe(exe)
{
}
G::Executable::Executable( const std::string & s )
{
if( s.find(' ') == std::string::npos ) // optimisation
{
m_exe = G::Path(s) ;
}
else
{
const std::string null( 1U , '\0' ) ;
std::string line( s ) ;
G::Str::replaceAll( line , "\\ " , null ) ;
G::Str::splitIntoTokens( line , m_args , " " ) ;
for( G::Strings::iterator p = m_args.begin() ; p != m_args.end() ; ++p )
{
G::Str::replaceAll( *p , null , " " ) ;
}
if( m_args.size() )
{
m_exe = G::Path( m_args.front() ) ;
m_args.pop_front() ;
}
}
}
G::Path G::Executable::exe() const
{
return m_exe ;
}
G::Strings G::Executable::args() const
{
return m_args ;
}

65
src/glib/gexe.h Normal file
View File

@ -0,0 +1,65 @@
//
// Copyright (C) 2001-2003 Graeme Walker <graeme_walker@users.sourceforge.net>
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ===
//
// gexe.h
//
#ifndef G_EXE_H
#define G_EXE_H
#include "gdef.h"
#include "gpath.h"
#include "gstrings.h"
#include <string>
namespace G
{
class Executable ;
}
// Class: G::Executable
// Description: A structure representing an external program,
// holding a path and a set of arguments.
// See also: G::Path, G::Args
//
class G::Executable
{
public:
explicit Executable( const std::string & command_line = std::string() ) ;
// Constructor taking a complete command-line.
// The command-line is split up on unescaped
// space characters.
explicit Executable( const G::Path & exe ) ;
// Constructor for an executable with no extra arguments.
Path exe() const ;
// Returns the executable.
Strings args() const ;
// Returns the command-line arguments.
private:
G::Path m_exe ;
G::Strings m_args ;
} ;
#endif

View File

@ -473,6 +473,7 @@ std::string G::GetOpt::value( char c ) const
std::string G::GetOpt::value( const std::string & name ) const
{
G_ASSERT( contains(name) ) ;
return value( key(name) ) ;
}

View File

@ -140,10 +140,14 @@ public:
std::string value( const std::string & switch_name ) const ;
// Returns the value related to the given
// value-based switch.
//
// Precondition: contains(switch_name)
std::string value( char switch_letter ) const ;
// Returns the value related to the given
// value-based switch.
//
// Precondition: contains(switch_letter)
private:
struct SwitchSpec // A private implementation structure used by G::GetOpt.

View File

@ -169,8 +169,8 @@ void G::LogOutput::addFileAndLine( char *buffer , size_t size , const char *file
add( buffer , size , basename ) ;
add( buffer , size , "(" ) ;
char b[15U] ;
add( buffer , sizeof(buffer) , itoa(b,sizeof(b),line) ) ;
add( buffer , sizeof(buffer) , "): " ) ;
add( buffer , size , itoa(b,sizeof(b),line) ) ;
add( buffer , size , "): " ) ;
}
}

View File

@ -38,8 +38,13 @@ namespace
char * strdup_( const char * p )
{
p = p ? p : "" ;
char * buffer = static_cast<char*>( std::malloc( std::strlen(p) + 1U ) ) ;
std::strcpy( buffer , p ) ;
const size_t n = std::strlen(p) ;
char * buffer = static_cast<char*>( std::malloc(n+1U) ) ;
if( buffer != NULL )
{
std::strncpy( buffer , p , n ) ;
buffer[n] = '\0' ;
}
return buffer ;
}
}

View File

@ -54,6 +54,7 @@ public:
G_EXCEPTION( Insecure , "refusing to exec() while the user-id is zero" ) ;
G_EXCEPTION( InvalidId , "invalid process-id string" ) ;
G_EXCEPTION( PipeError , "pipe error" ) ;
G_EXCEPTION( NoExtension , "refusing to CreateProcess() without a file extension such as .exe" ) ; // windows
enum Who { Parent , Child } ;
class IdImp ;

View File

@ -32,13 +32,18 @@
#include <io.h>
#include <fcntl.h>
namespace G
namespace
{
const int g_stderr_fileno = 2 ;
const int g_sc_open_max = 256 ; // 32 in limits.h !?
const HANDLE HNULL = INVALID_HANDLE_VALUE ;
}
namespace G
{
class Pipe ;
} ;
class ProcessImp ;
}
class G::Pipe
{
@ -63,6 +68,154 @@ public:
unsigned int m_pid ;
} ;
class G::ProcessImp
{
public:
static std::string commandLine( std::string exe , Strings args ) ;
static HANDLE createProcess( const std::string & exe , const std::string & command_line , HANDLE hstdout ) ;
static DWORD waitFor( HANDLE hprocess , DWORD default_exit_code ) ;
} ;
// ===
G::Process::Id::Id()
{
m_pid = static_cast<unsigned int>(::_getpid()) ; // or ::GetCurrentProcessId()
}
G::Process::Id::Id( const char * path ) :
m_pid(0)
{
std::ifstream file( path ? path : "" ) ;
file >> m_pid ;
if( !file.good() )
m_pid = 0 ;
}
G::Process::Id::Id( std::istream & stream )
{
stream >> m_pid ;
if( !stream.good() )
throw Process::InvalidId() ;
}
std::string G::Process::Id::str() const
{
std::ostringstream ss ;
ss << m_pid ;
return ss.str() ;
}
bool G::Process::Id::operator==( const Id & rhs ) const
{
return m_pid == rhs.m_pid ;
}
// not implemented...
//G::Process::Id::Id( const char * pid_file_path ) {}
// ===
void G::Process::closeFiles( bool keep_stderr )
{
const int n = g_sc_open_max ;
for( int fd = 0 ; fd < n ; fd++ )
{
if( !keep_stderr || fd != g_stderr_fileno )
::_close( fd ) ;
}
}
void G::Process::closeStderr()
{
int fd = g_stderr_fileno ;
::_close( fd ) ;
}
void G::Process::cd( const Path & dir )
{
if( !cd(dir,NoThrow()) )
throw CannotChangeDirectory( dir.str() ) ;
}
bool G::Process::cd( const Path & dir , NoThrow )
{
return 0 == ::_chdir( dir.str().c_str() ) ;
}
int G::Process::errno_()
{
return errno ;
}
int G::Process::spawn( Identity , const Path & exe_path , const Strings & args ,
std::string * pipe_result_p , int error_return )
{
G_DEBUG( "G::Process::spawn: [" << exe_path << "]: [" << Str::join(args,"],[") << "]" ) ;
// create a pipe
Pipe pipe( pipe_result_p != NULL ) ;
// create the process
std::string command_line = ProcessImp::commandLine( exe_path.str() , args ) ;
HANDLE hprocess = ProcessImp::createProcess( exe_path.str() , command_line , pipe.h() ) ;
if( hprocess == HNULL )
{
DWORD e = ::GetLastError() ;
G_ERROR( "G::Process::spawn: create-process error " << e << ": " << command_line ) ;
return error_return ;
}
// wait for the child process to exit
DWORD exit_code = ProcessImp::waitFor( hprocess , error_return ) ;
G_LOG( "G::Process::spawn: exit " << exit_code << " from \"" << exe_path << "\": " << exit_code ) ;
// return the contents of the pipe
if( pipe_result_p != NULL )
*pipe_result_p = pipe.read(false) ;
return exit_code ;
}
G::Identity G::Process::beOrdinary( Identity identity , bool )
{
// not implemented
return identity ;
}
void G::Process::beSpecial( Identity , bool )
{
// not implemented
}
void G::Process::revokeExtraGroups()
{
// not implemented
}
// not implemented...
// Who G::Process::fork() {}
// Who G::Process::fork( Id & child ) {}
// void G::Process::exec( const Path & exe , const std::string & arg ) {}
// int G::Process::wait( const Id & child ) {}
// int G::Process::wait( const Id & child , int error_return ) {}
// ===
G::Process::Umask::Umask( G::Process::Umask::Mode ) :
m_imp(0)
{
}
G::Process::Umask::~Umask()
{
}
void G::Process::Umask::set( G::Process::Umask::Mode )
{
// not implemented
}
// ===
G::Pipe::Pipe( bool active , bool do_throw ) :
@ -160,172 +313,66 @@ std::string G::Pipe::read( bool do_throw )
// ===
G::Process::Id::Id()
HANDLE G::ProcessImp::createProcess( const std::string & exe , const std::string & command_line , HANDLE hstdout )
{
m_pid = static_cast<unsigned int>(::_getpid()) ; // or ::GetCurrentProcessId()
}
G::Process::Id::Id( const char * path ) :
m_pid(0)
{
std::ifstream file( path ? path : "" ) ;
file >> m_pid ;
if( !file.good() )
m_pid = 0 ;
}
G::Process::Id::Id( std::istream & stream )
{
stream >> m_pid ;
if( !stream.good() )
throw Process::InvalidId() ;
}
std::string G::Process::Id::str() const
{
std::ostringstream ss ;
ss << m_pid ;
return ss.str() ;
}
bool G::Process::Id::operator==( const Id & rhs ) const
{
return m_pid == rhs.m_pid ;
}
// not implemented...
//G::Process::Id::Id( const char * pid_file_path ) {}
// ===
void G::Process::closeFiles( bool keep_stderr )
{
const int n = g_sc_open_max ;
for( int fd = 0 ; fd < n ; fd++ )
{
if( !keep_stderr || fd != g_stderr_fileno )
::_close( fd ) ;
}
}
void G::Process::closeStderr()
{
int fd = g_stderr_fileno ;
::_close( fd ) ;
}
void G::Process::cd( const Path & dir )
{
if( !cd(dir,NoThrow()) )
throw CannotChangeDirectory( dir.str() ) ;
}
bool G::Process::cd( const Path & dir , NoThrow )
{
return 0 == ::_chdir( dir.str().c_str() ) ;
}
int G::Process::errno_()
{
return errno ;
}
int G::Process::spawn( Identity , const Path & exe , const Strings & args ,
std::string * pipe_result_p , int error_return )
{
G_DEBUG( "G::Process::spawn: \"" << exe << "\": \"" << Str::join(args,"\",\"") << "\"" ) ;
std::string command_line = std::string("\"") + exe.str() + "\"" ;
for( Strings::const_iterator arg_p = args.begin() ; arg_p != args.end() ; ++arg_p )
{
std::string arg = *arg_p ;
if( arg.find(" ") != std::string::npos && arg.find("\"") != 0U )
arg = std::string("\"") + arg + "\"" ;
command_line += ( std::string(" ") + arg ) ;
}
Pipe pipe( pipe_result_p != NULL ) ;
SECURITY_ATTRIBUTES * process_attributes = NULL ;
SECURITY_ATTRIBUTES * thread_attributes = NULL ;
BOOL inherit = TRUE ;
DWORD flags = CREATE_NO_WINDOW ;
LPVOID env = NULL ;
LPCTSTR cwd = NULL ;
static STARTUPINFO zero_start ;
STARTUPINFO start(zero_start) ;
start.cb = sizeof(start) ;
start.dwFlags = STARTF_USESTDHANDLES ;
start.hStdInput = HNULL ;
start.hStdOutput = pipe.h() ;
start.hStdOutput = hstdout ;
start.hStdError = HNULL ;
BOOL inherit = TRUE ;
DWORD flags = CREATE_NO_WINDOW ;
LPVOID env = NULL ;
LPCTSTR cwd = NULL ;
PROCESS_INFORMATION info ;
SECURITY_ATTRIBUTES * process_attributes = NULL ;
SECURITY_ATTRIBUTES * thread_attributes = NULL ;
char * command_line_p = const_cast<char*>(command_line.c_str()) ;
BOOL rc = ::CreateProcess( exe.str().c_str() , command_line_p ,
BOOL rc = ::CreateProcess( exe.c_str() , command_line_p ,
process_attributes , thread_attributes , inherit ,
flags , env , cwd , &start , &info ) ;
bool ok = !!rc ;
DWORD exit_code = error_return ;
if( !ok )
return rc ? info.hProcess : HNULL ;
}
std::string G::ProcessImp::commandLine( std::string exe , Strings args )
{
// returns quoted exe followed by args -- args are quoted iff they have a
// space and no quotes
char q = '\"' ;
const std::string quote = std::string(1U,q) ;
const std::string space = std::string(" ") ;
bool exe_is_quoted = exe.length() > 1U && exe.at(0U) == q && exe.at(exe.length()-1U) == q ;
std::string command_line = exe_is_quoted ? exe : ( quote + exe + quote ) ;
for( Strings::const_iterator arg_p = args.begin() ; arg_p != args.end() ; ++arg_p )
{
DWORD e = ::GetLastError() ;
G_ERROR( "G::Process::spawn: create-process error " << e << ": " << command_line ) ;
std::string arg = *arg_p ;
if( arg.find(" ") != std::string::npos && arg.find("\"") != 0U )
arg = quote + arg + quote ;
command_line += ( space + arg ) ;
}
else
{
return command_line ;
}
DWORD G::ProcessImp::waitFor( HANDLE hprocess , DWORD default_exit_code )
{
DWORD timeout_ms = 30000UL ;
if( WAIT_TIMEOUT == ::WaitForSingleObject( info.hProcess , timeout_ms ) )
if( WAIT_TIMEOUT == ::WaitForSingleObject( hprocess , timeout_ms ) )
{
G_ERROR( "G::Process::spawn: child process has not terminated: still waiting" ) ;
::WaitForSingleObject( info.hProcess , INFINITE ) ;
::WaitForSingleObject( hprocess , INFINITE ) ;
}
::GetExitCodeProcess( info.hProcess , &exit_code ) ;
G_LOG( "G::Process::spawn: exit " << exit_code << " from \"" << exe << "\": " << exit_code ) ;
if( pipe_result_p != NULL )
*pipe_result_p = pipe.read(false) ;
}
DWORD exit_code = default_exit_code ;
BOOL rc = ::GetExitCodeProcess( hprocess , &exit_code ) ;
if( rc == 0 ) exit_code = default_exit_code ;
return exit_code ;
}
G::Identity G::Process::beOrdinary( Identity identity , bool )
{
// not implemented
return identity ;
}
void G::Process::beSpecial( Identity , bool )
{
// not implemented
}
void G::Process::revokeExtraGroups()
{
// not implemented
}
// not implemented...
// Who G::Process::fork() {}
// Who G::Process::fork( Id & child ) {}
// void G::Process::exec( const Path & exe , const std::string & arg ) {}
// int G::Process::wait( const Id & child ) {}
// int G::Process::wait( const Id & child , int error_return ) {}
// ===
G::Process::Umask::Umask( G::Process::Umask::Mode ) :
m_imp(0)
{
}
G::Process::Umask::~Umask()
{
}
void G::Process::Umask::set( G::Process::Umask::Mode )
{
// not implemented
}

View File

@ -26,6 +26,10 @@
// * not supporting global function callbacks
// * using only void returns
//
// Event-generating classes expose a "signal" object which
// client objects can connect() to in order to receive events.
// The client receives events through a "slot" member function.
//
// The key to the implementation is that SlotImp<> is
// templated on the callback parameter P and the callback
// sink class T, but Slot<> is templated only on P, so

View File

@ -309,16 +309,9 @@ std::string G::Str::toPrintableAscii( const std::string & in , char escape )
std::string G::Str::readLineFrom( std::istream & stream , char ignore )
{
std::string line ;
char c ;
while( stream.get(c) ) // ie. while(stream.good())
{
if( c == '\n' )
break ;
if( ignore != '\0' && c == ignore )
;
else
line.append(1U,c) ;
}
G_IGNORE std::getline( stream , line ) ;
if( ignore != '\0' )
replaceAll( line , std::string(1U,ignore) , std::string() ) ;
return line ;
}
@ -509,7 +502,7 @@ void G::Str::splitIntoFields( const std::string & in_in , void * out ,
}
}
std::string G::Str::join( const G::Strings & strings , const std::string & sep )
std::string G::Str::join( const Strings & strings , const std::string & sep )
{
std::string result ;
bool first = true ;
@ -533,3 +526,13 @@ std::string G::Str::join( const StringArray & strings , const std::string & sep
return result ;
}
G::Strings G::Str::keys( const StringMap & map )
{
Strings result ;
for( StringMap::const_iterator p = map.begin() ; p != map.end() ; ++p )
{
result.push_back( (*p).first ) ;
}
return result ;
}

View File

@ -212,6 +212,8 @@ public:
static std::string join( const StringArray & strings , const std::string & sep ) ;
// Concatenates a set of strings.
static Strings keys( const StringMap & string_map ) ;
// Extracts the keys from a map of strings.
private:
static void listPushBack( void * , const std::string & ) ;

View File

@ -28,6 +28,7 @@
#include <string>
#include <list>
#include <vector>
#include <map>
namespace G
{
@ -43,6 +44,11 @@ typedef std::list<std::string> Strings ;
//
typedef std::vector<std::string> StringArray ;
// Typedef: StringMap
// Description: A std::map of std::strings.
//
typedef std::map<std::string,std::string> StringMap ;
}
#endif

View File

@ -25,6 +25,7 @@ mk_sources=\
garg.cpp \
garg_win32.cpp \
gcleanup_win32.cpp \
gexe.cpp \
gdaemon_win32.cpp \
gdate.cpp \
gdatetime.cpp \

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,74 +16,94 @@
#
#
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -91,7 +111,22 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
EXTRA_DIST = \
gclient_win32.cpp \
@ -146,6 +181,7 @@ libgnet_a_SOURCES = gaddress_ipv4.cpp \
gtimer.h
subdir = src/gnet
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -164,11 +200,7 @@ am_libgnet_a_OBJECTS = gaddress_ipv4.$(OBJEXT) gclient.$(OBJEXT) \
gsocket_unix.$(OBJEXT) gtimer.$(OBJEXT)
libgnet_a_OBJECTS = $(am_libgnet_a_OBJECTS)
DEFS = @DEFS@
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/gaddress_ipv4.Po \
@ -191,14 +223,12 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
CXXFLAGS = @CXXFLAGS@
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libgnet_a_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(libgnet_a_SOURCES)
all: all-am
@ -245,26 +275,35 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsocket_unix.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtimer.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.cpp.o:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
.cpp.obj:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CXXCOMPILE) -c -o $@ `cygpath -w $<`
CXXDEPMODE = @CXXDEPMODE@
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@ -290,20 +329,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -328,7 +388,6 @@ check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -348,7 +407,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -358,9 +417,10 @@ clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
@ -381,25 +441,33 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic tags uninstall uninstall-am \
uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am info \
info-am install install-am install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am tags uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -55,10 +55,10 @@ public:
class Broadcast // An overload discriminator class for GNet::Address.
{} ;
Address( const Address &addr ) ;
Address( const Address & addr ) ;
// Copy constructor.
Address( const sockaddr *addr , int len ) ;
Address( const sockaddr * addr , int len ) ;
// Constructor using a given sockaddr.
//
// The given sockaddr address must be an Internet
@ -183,7 +183,7 @@ private:
private:
AddressImp * m_imp ;
};
} ;
#endif

View File

@ -78,29 +78,20 @@ GNet::ClientResolver::ClientResolver( ClientImp & imp ) :
//
class GNet::ClientImp : public GNet::EventHandler
{
private:
ClientResolver m_resolver ;
StreamSocket * m_s ;
Address m_address ;
std::string m_peer_name ;
Client & m_interface ;
bool m_priviledged ;
public:
enum Status { Success , Failure , Retry , ImmediateSuccess } ;
static bool m_first ;
enum State { Idle , Resolving , Connecting , Connected , Failed , Disconnected } ;
State m_state ;
bool m_quit_on_disconnect ;
public:
ClientImp( Client &intaface , bool priviledged , bool quit_on_disconnect ) ;
ClientImp( Client & intaface , const Address & local_address , bool priviledged , bool quit_on_disconnect ) ;
virtual ~ClientImp() ;
void resolveCon( bool ok , const Address & address , std::string reason ) ;
void readEvent() ;
void writeEvent() ;
void exceptionEvent() ;
bool connect( std::string host , std::string service , std::string *error , bool sync_dns ) ;
bool connect( std::string host , std::string service , std::string * error , bool sync_dns ) ;
std::string startConnecting( const Address & , const std::string & , bool & ) ;
Status connectCore( Address , std::string * , bool , unsigned int ) ;
Status connectCore( Address , Address , std::string * ) ;
void disconnect() ;
StreamSocket & s() ;
const StreamSocket & s() const ;
@ -117,15 +108,35 @@ private:
ClientImp( const ClientImp & ) ;
void operator=( const ClientImp & ) ;
static int getRandomPort() ;
private:
ClientResolver m_resolver ;
StreamSocket * m_s ;
Address m_local_address ;
Address m_remote_address ;
std::string m_peer_name ;
Client & m_interface ;
bool m_priviledged ;
static bool m_first ;
State m_state ;
bool m_quit_on_disconnect ;
} ;
// ===
GNet::Client::Client( const Address & local_address , bool priviledged , bool quit_on_disconnect ) :
m_imp(NULL)
{
G_DEBUG( "Client::ctor" ) ;
m_imp = new ClientImp( *this , local_address , priviledged , quit_on_disconnect ) ;
if( Monitor::instance() ) Monitor::instance()->add( *this ) ;
}
GNet::Client::Client( bool priviledged , bool quit_on_disconnect ) :
m_imp(NULL)
{
G_DEBUG( "Client::ctor" ) ;
m_imp = new ClientImp( *this , priviledged , quit_on_disconnect ) ;
m_imp = new ClientImp( *this , Address(0U) , priviledged , quit_on_disconnect ) ;
if( Monitor::instance() ) Monitor::instance()->add( *this ) ;
}
@ -185,10 +196,12 @@ bool GNet::Client::canRetry( const std::string & error )
bool GNet::ClientImp::m_first = true ;
GNet::ClientImp::ClientImp( Client &intaface , bool priviledged , bool quit_on_disconnect ) :
GNet::ClientImp::ClientImp( Client & intaface , const Address & local_address ,
bool priviledged , bool quit_on_disconnect ) :
m_resolver(*this) ,
m_s(NULL) ,
m_address(Address::invalidAddress()) ,
m_local_address(local_address) ,
m_remote_address(Address::invalidAddress()) ,
m_interface(intaface) ,
m_priviledged(priviledged) ,
m_state(Idle) ,
@ -330,11 +343,12 @@ void GNet::ClientImp::resolveCon( bool success , const Address &address ,
}
}
std::string GNet::ClientImp::startConnecting( const Address & address , const std::string & peer_name , bool & immediate )
std::string GNet::ClientImp::startConnecting( const Address & remote_address ,
const std::string & peer_name , bool & immediate )
{
// save the target address
G_DEBUG( "GNet::ClientImp::startConnecting: " << address.displayString() ) ;
m_address = address ;
G_DEBUG( "GNet::ClientImp::startConnecting: " << remote_address.displayString() ) ;
m_remote_address = remote_address ;
m_peer_name = peer_name ;
// create and open a socket
@ -350,6 +364,8 @@ std::string GNet::ClientImp::startConnecting( const Address & address , const st
//
s().addWriteHandler( *this ) ;
// bind a local address to the socket and connect
//
Status status = Failure ;
std::string error ;
if( m_priviledged )
@ -357,41 +373,44 @@ std::string GNet::ClientImp::startConnecting( const Address & address , const st
for( int i = 0 ; i < c_retries ; i++ )
{
int port = getRandomPort() ;
G_DEBUG( "GNet::ClientImp::resolveCon: trying to bind port " << port ) ;
status = connectCore( address, &error, true, port ) ;
m_local_address.setPort( port ) ;
G_DEBUG( "GNet::ClientImp::resolveCon: trying to bind " << m_local_address.displayString() ) ;
status = connectCore( m_local_address , remote_address , &error ) ;
if( status != Retry )
break ;
}
}
else
{
status = connectCore( address , &error , false , 0 ) ;
status = connectCore( m_local_address , remote_address , &error ) ;
}
// deal with immediate connection (typically if connecting locally)
//
immediate = status == ImmediateSuccess ;
if( status != Success )
s().dropWriteHandler() ;
if( status == Success ) error = std::string() ;
if( status == Success )
error = std::string() ;
return error ;
}
GNet::ClientImp::Status GNet::ClientImp::connectCore( Address remote_address ,
std::string *error_p , bool set_port , unsigned int port )
GNet::ClientImp::Status GNet::ClientImp::connectCore( Address local_address , Address remote_address ,
std::string *error_p )
{
G_ASSERT( error_p != NULL ) ;
std::string &error = *error_p ;
G::Root claim_root ;
Address local_address( set_port ? port : 0 ) ;
bool bound = s().bind(local_address) ;
if( !bound )
{
error = "cannot bind socket" ;
return Retry ;
}
G_DEBUG( "GNet::ClientImp::connectCore: bound local address "
<< local_address.displayString() ) ;
G_DEBUG( "GNet::ClientImp::connectCore: bound local address " << local_address.displayString() ) ;
// initiate the connection
//
@ -441,7 +460,7 @@ void GNet::ClientImp::writeEvent()
else if( m_state == Connecting )
{
std::string message( c_cannot_connect_to ) ;
message.append( m_address.displayString().c_str() ) ;
message.append( m_remote_address.displayString().c_str() ) ;
setState( Failed ) ;
close() ;
m_interface.onError( message ) ;

View File

@ -47,11 +47,15 @@ namespace GNet
class GNet::Client : public GNet::Connection
{
public:
explicit Client( bool priviledged = false , bool quit_on_disconnect = false ) ;
// Constructor. If the 'priviledged' parameter
// is true the the local endpoint of the
// outgoing connection is bound to a
// priviledged port number (ie. < 1024),
Client( const Address & local_interface , bool priviledged , bool quit_on_disconnect ) ;
// Constructor.
//
// The socket is bound with the given local address,
// but with an arbitrary port number. The local address
// may be the INADDR_ANY address.
//
// If the 'priviledged' parameter is true then socket
// is bound with priviledged port number (ie. < 1024),
// selected at random.
//
// If the 'quit' parameter is true then the client will
@ -60,6 +64,10 @@ public:
// should only be true if this client is the only thing
// using the event loop.
explicit Client( bool priviledged = false , bool quit_on_disconnect = false ) ;
// Constructor overload for a INADDR_ANY local
// interface.
bool connect( std::string host, std::string service,
std::string *error_string = NULL ,
bool sync_dns = synchronousDnsDefault() );

View File

@ -27,7 +27,44 @@
#include "geventloop.h"
#include "gdebug.h"
#include "gassert.h"
#include "gdescriptor.h"
#include "glog.h"
#include <algorithm> // std::find
namespace
{
struct Eq
{
GNet::Descriptor m_fd ;
explicit Eq( GNet::Descriptor fd ) : m_fd(fd) {}
bool operator()( const GNet::EventHandlerListItem & item ) const
{
return item.m_fd == m_fd ;
}
} ;
struct NotNull
{
GNet::Descriptor m_fd ;
explicit NotNull( GNet::Descriptor fd ) : m_fd(fd) {}
bool operator()( const GNet::EventHandlerListItem & item ) const
{
return item.m_fd == m_fd && item.m_handler != NULL ;
}
} ;
}
GNet::EventHandlerListItem::EventHandlerListItem( Descriptor fd , EventHandler * handler ) :
m_fd(fd) ,
m_handler(handler)
{
}
bool operator!=( const GNet::EventHandlerListItem & a , const GNet::EventHandlerListItem & b )
{
return a.m_fd != b.m_fd ;
}
// ===
GNet::EventHandler::~EventHandler()
{
@ -50,95 +87,66 @@ void GNet::EventHandler::exceptionEvent()
// ===
GNet::EventHandlerList::EventHandlerList( std::string type ) :
GNet::EventHandlerList::EventHandlerList( const std::string & type ) :
m_type(type) ,
m_lock(0U) ,
m_copied(false)
m_lock(0U)
{
}
//static
bool GNet::EventHandlerList::contains( const EventHandlerListImp & list , Descriptor fd )
GNet::EventHandlerList::Iterator GNet::EventHandlerList::begin() const
{
const List::const_iterator end = list.end() ;
for( List::const_iterator p = list.begin() ; p != end ; ++p )
{
if( (*p).m_fd == fd )
return true ;
}
return false ;
return m_list.begin() ;
}
GNet::EventHandlerList::Iterator GNet::EventHandlerList::end() const
{
return m_list.end() ;
}
bool GNet::EventHandlerList::contains( Descriptor fd ) const
{
return contains( m_list , fd ) ;
}
std::string GNet::EventHandlerList::asString() const
{
return asString( m_list ) ;
}
std::string GNet::EventHandlerList::asString( const EventHandlerListImp & list ) const
{
std::ostringstream ss ;
const char * sep = "" ;
for( List::const_iterator p = list.begin() ; p != list.end() ; ++p )
{
ss << sep << fd( p ) ;
sep = "," ;
}
return ss.str() ;
}
GNet::EventHandlerListImp & GNet::EventHandlerList::list()
{
// lazy copy
if( m_lock != 0U && !m_copied )
{
m_copy = m_list ;
m_copied = true ;
}
return m_lock == 0U ? m_list : m_copy ;
}
void GNet::EventHandlerList::add( Descriptor fd , EventHandler * handler )
{
G_ASSERT( handler != NULL ) ;
if( ! contains(list(),fd) )
{
G_DEBUG( "GNet::EventHandlerList::add: " << m_type << "-list: adding " << fd << (m_lock?" (deferred)":"") ) ;
list().push_back( EventHandlerListItem(fd,handler) ) ;
}
}
void GNet::EventHandlerList::remove( Descriptor fd )
{
G_DEBUG( "GNet::EventHandlerList::remove: " << m_type << "-list: removing " << fd << (m_lock?" (deferred)":"") ) ;
bool found = false ;
for( List::iterator p = list().begin() ; p != list().end() ; ++p )
{
if( (*p).m_fd == fd )
{
list().erase( p ) ;
found = true ;
break ;
}
}
//if( !found ) G_DEBUG( "GNet::EventHandlerList::remove: cannot find " << fd ) ;
const List::const_iterator end = m_list.end() ;
return std::find_if( m_list.begin() , end , NotNull(fd) ) != end ;
}
GNet::EventHandler * GNet::EventHandlerList::find( Descriptor fd )
{
const List::iterator end = m_list.end() ;
for( List::iterator p = m_list.begin() ; p != end ; ++p )
List::iterator p = std::find_if( m_list.begin() , end , NotNull(fd) ) ;
return p != end ? (*p).m_handler : NULL ;
}
void GNet::EventHandlerList::add( Descriptor fd , EventHandler * handler )
{
G_ASSERT( handler != NULL ) ;
G_DEBUG( "GNet::EventHandlerList::add: " << m_type << "-list: " << "adding " << fd ) ;
const List::iterator end = m_list.end() ;
List::iterator p = std::find_if( m_list.begin() , end , Eq(fd) ) ;
if( p != end )
{
if( (*p).m_fd == fd )
return (*p).m_handler ;
G_ASSERT( (*p).m_handler == NULL ) ;
(*p).m_handler = handler ;
}
else
{
m_list.push_back( EventHandlerListItem(fd,handler) ) ;
}
}
void GNet::EventHandlerList::remove( Descriptor fd )
{
G_DEBUG( "GNet::EventHandlerList::remove: " << m_type << "-list: " << "removing " << fd ) ;
const List::iterator end = m_list.end() ;
List::iterator p = std::find_if( m_list.begin() , end , Eq(fd) ) ;
if( p != end )
{
if( m_lock )
(*p).m_handler = NULL ;
else
m_list.erase( p ) ;
}
//G_DEBUG( "GNet::EventHandlerList::find: cannot find entry for " << fd ) ;
return NULL ;
}
void GNet::EventHandlerList::lock()
@ -149,11 +157,17 @@ void GNet::EventHandlerList::lock()
void GNet::EventHandlerList::unlock()
{
m_lock-- ;
if( m_lock == 0U && m_copied )
if( m_lock == 0U )
{
//G_DEBUG( "GNet::EventHandlerList::unlock: " << m_type << "-list: commiting: " << asString(m_copy) ) ;
m_list = m_copy ;
m_copied = false ;
// collect garbage
const List::iterator end = m_list.end() ;
for( List::iterator p = m_list.begin() ; p != end ; )
{
if( (*p).m_handler == NULL )
p = m_list.erase( p ) ;
else
++p ;
}
}
}

View File

@ -87,17 +87,9 @@ public:
EventHandler * handler = NULL ) ;
} ;
inline
GNet::EventHandlerListItem::EventHandlerListItem( Descriptor fd , EventHandler * handler ) :
m_fd(fd) ,
m_handler(handler)
{
}
namespace GNet
{
typedef std::list<EventHandlerListItem>
EventHandlerListImp ;
typedef std::list<EventHandlerListItem> EventHandlerListImp ;
}
// Class: GNet::EventHandlerList
@ -111,11 +103,11 @@ public:
typedef List::const_iterator Iterator ;
public:
explicit EventHandlerList( std::string type ) ;
explicit EventHandlerList( const std::string & type ) ;
// Constructor. The type parameter (eg. "read")
// is used only in debugging messages.
void add( Descriptor fd , EventHandler *handler ) ;
void add( Descriptor fd , EventHandler * handler ) ;
// Adds a file-descriptor/handler pair to
// the list.
@ -131,56 +123,36 @@ public:
// given file descriptor.
void lock() ;
// Locks the list so that add() and remove() are
// deferred until the matching unlock(). This
// is needed during iteration -- see begin()/end().
// Called at the start of an iteration which
// might change the list.
void unlock() ;
// Applies any deferred changes. See lock().
// Called at the end of an iteration.
Iterator begin() const ;
// Returns an iterator (using the STL model).
// Returns a forward iterator.
Iterator end() const ;
// Returns an end iterator (using the STL model).
// Returns an end iterator.
static Descriptor fd( Iterator i ) ;
// Returns the iterator's file descriptor.
static EventHandler & handler( Iterator i ) ;
// Returns the iterator's handler.
std::string asString() const ;
// Returns a descriptive string for the list. Used
// for debugging.
static EventHandler * handler( Iterator i ) ;
// Returns the iterator's handler. Returns null
// if the fd has been remove()d but the
// list is still lock()ed.
private:
EventHandlerList( const EventHandlerList & ) ;
void operator=( const EventHandlerList & ) ;
static bool contains( const EventHandlerListImp & , Descriptor fd ) ;
EventHandlerListImp & list() ;
std::string asString( const EventHandlerListImp & ) const ;
private:
std::string m_type ; // for debugging
std::string m_type ;
List m_list ;
List m_copy ;
unsigned int m_lock ;
bool m_copied ;
} ;
inline
GNet::EventHandlerList::Iterator GNet::EventHandlerList::begin() const
{
return m_list.begin() ;
}
inline
GNet::EventHandlerList::Iterator GNet::EventHandlerList::end() const
{
return m_list.end() ;
}
//static
inline
GNet::Descriptor GNet::EventHandlerList::fd( Iterator i )
@ -190,9 +162,9 @@ GNet::Descriptor GNet::EventHandlerList::fd( Iterator i )
//static
inline
GNet::EventHandler & GNet::EventHandlerList::handler( Iterator i )
GNet::EventHandler * GNet::EventHandlerList::handler( Iterator i )
{
return *((*i).m_handler) ;
return (*i).m_handler ;
}
#endif

View File

@ -123,13 +123,17 @@ public:
// from the list of exception sources.
// See also Socket::dropExceptionHandler().
virtual void setTimeout( G::DateTime::EpochTime t ) = 0 ;
virtual void setTimeout( G::DateTime::EpochTime t , bool & empty_implementation_hint ) = 0 ;
// Used by GNet::TimerList. Sets the time at which
// TimerList::doTimeouts() is to be called.
// A parameter of zero is used to cancel the
// timer. Some concrete implementations of this
// timer.
//
// Some concrete implementations of this
// interface may use TimerList::interval()
// rather than setTimeout()/doTimeouts().
// Empty implementations should set the
// hint value to true as an optimisation.
private:
static EventLoop * m_this ;

View File

@ -65,7 +65,7 @@ public:
private:
void runOnce() ;
virtual void setTimeout( G::DateTime::EpochTime t ) ;
virtual void setTimeout( G::DateTime::EpochTime t , bool & ) ;
private:
bool m_quit ;
@ -100,7 +100,7 @@ class GNet::FdSet
public:
static int init( int n , fd_set * set , const EventHandlerList & list ) ;
static void raiseEvents( fd_set * set , EventHandlerList & list ,
void (EventHandler::*method)() , const char * type ) ;
void (EventHandler::*method)() ) ;
private:
FdSet() ; // not implemented
} ;
@ -140,8 +140,7 @@ int GNet::FdSet::init( int n , fd_set * set , const EventHandlerList & list )
}
//static
void GNet::FdSet::raiseEvents( fd_set * set , EventHandlerList & list ,
void (EventHandler::*method)() , const char * /*type*/ )
void GNet::FdSet::raiseEvents( fd_set * set , EventHandlerList & list , void (EventHandler::*method)() )
{
// call the event-handler for fds in fd-set which are ISSET()
@ -153,8 +152,9 @@ void GNet::FdSet::raiseEvents( fd_set * set , EventHandlerList & list ,
if( FD_ISSET( fd , set ) )
{
//G_DEBUG( "raiseEvents: " << type << " event on fd " << fd ) ;
EventHandler & h = EventHandlerList::handler( p ) ;
(h.*method)() ;
EventHandler * h = EventHandlerList::handler( p ) ;
if( h != NULL )
(h->*method)() ;
}
}
}
@ -228,18 +228,6 @@ void GNet::Select::runOnce()
timeout_p = infinite ? NULL : &timeout ;
}
// debug
//
const bool debug = false ;
if( debug )
{
G_DEBUG( "GNet::Select::runOnce: selecting: fd(max) = " << (n-1) << ": "
<< "read-list=\"" << m_read_list.asString() << "\": "
<< "write-list=\"" << m_write_list.asString() << "\": "
<< "exception-list=\"" << m_exception_list.asString() << "\": "
<< "timeout=" << (timeout_p?G::Str::fromUInt(timeout_p->tv_sec):std::string("infinite")) ) ;
}
// do the select()
//
int rc = ::select( n , &r , &w , &e , timeout_p ) ;
@ -256,9 +244,9 @@ void GNet::Select::runOnce()
else // rc > 0
{
G_DEBUG( "GNet::Select::runOnce: detected event(s) on " << rc << " fd(s)" ) ;
FdSet::raiseEvents( &r , m_read_list , & EventHandler::readEvent , "read" ) ;
FdSet::raiseEvents( &w , m_write_list , & EventHandler::writeEvent , "write" ) ;
FdSet::raiseEvents( &e , m_exception_list , & EventHandler::exceptionEvent , "exception" ) ;
FdSet::raiseEvents( &r , m_read_list , & EventHandler::readEvent ) ;
FdSet::raiseEvents( &w , m_write_list , & EventHandler::writeEvent ) ;
FdSet::raiseEvents( &e , m_exception_list , & EventHandler::exceptionEvent ) ;
}
}
@ -292,8 +280,9 @@ void GNet::Select::dropException( Descriptor fd )
m_exception_list.remove( fd ) ;
}
void GNet::Select::setTimeout( G::DateTime::EpochTime )
void GNet::Select::setTimeout( G::DateTime::EpochTime , bool & empty_hint )
{
// not used -- interval() in runOnce() suffices
// does nothing -- interval() in runOnce() suffices
empty_hint = true ;
}

View File

@ -121,7 +121,7 @@ protected:
virtual void dropRead( Descriptor fd ) ;
virtual void dropWrite( Descriptor fd ) ;
virtual void dropException( Descriptor fd ) ;
virtual void setTimeout( G::DateTime::EpochTime ) ;
virtual void setTimeout( G::DateTime::EpochTime , bool & ) ;
private:
Winsock( const Winsock & other ) ;
@ -380,7 +380,7 @@ void GNet::Winsock::onTimer()
TimerList::instance().doTimeouts() ;
}
void GNet::Winsock::setTimeout( G::DateTime::EpochTime t )
void GNet::Winsock::setTimeout( G::DateTime::EpochTime t , bool & )
{
G_DEBUG( "GNet::Winsock::setTimeout: " << t ) ;
if( t != 0U )

View File

@ -30,7 +30,8 @@ bool GNet::Resolver::resolveHost( const std::string & host_name , HostInfo & hos
hostent * host = ::gethostbyname( host_name.c_str() ) ;
if( host != NULL )
{
host_info.canonical_name = std::string(host->h_name) ;
const char * h_name = host->h_name ;
host_info.canonical_name = std::string(h_name?h_name:"") ;
host_info.address = Address( *host , 0U ) ;
}
return host != NULL ;

View File

@ -39,7 +39,8 @@ bool GNet::Resolver::resolveHost( const std::string & host_name , HostInfo & hos
host = ::getipnodebyname( host_name.c_str() , AF_INET6 , AI_DEFAULT , &error ) ;
if( host != NULL )
{
host_info.canonical_name = std::string(host->h_name) ;
const char * h_name = host->h_name ;
host_info.canonical_name = std::string(h_name?h_name:"") ;
host_info.address = Address( *host , 0U ) ;
::freehostent( host ) ;
}

View File

@ -66,7 +66,7 @@ void GNet::ServerPeer::readEvent()
{
//G_DEBUG( "GNet::ServerPeer::readEvent: peer=" << this ) ;
char buffer[500] ;
char buffer[c_buffer_size] ;
buffer[0] = '\0' ;
size_t buffer_size = sizeof(buffer) ;
ssize_t rc = m_socket->read( buffer , buffer_size ) ;

View File

@ -224,6 +224,7 @@ private:
void operator=( const ServerPeer & ) ; // not implemented
private:
enum { c_buffer_size = 1500 } ;
Address m_address ;
std::auto_ptr<StreamSocket> m_socket ;
ServerPeerHandle * m_handle ;

View File

@ -38,15 +38,13 @@ namespace GNet
class GNet::TimerUpdate
{
public:
TimerUpdate( Timer & , const std::string & ) ;
TimerUpdate() ;
~TimerUpdate() ;
private:
TimerUpdate( const TimerUpdate & ) ; // not implemented
void operator=( const TimerUpdate & ) ; // not implemented
private:
Timer & m_timer ;
std::string m_type ;
G::DateTime::EpochTime m_soonest ;
G::DateTime::EpochTime m_old_soonest ;
} ;
// ===
@ -63,8 +61,8 @@ GNet::Timer::Timer( TimeoutHandler & handler ) :
{
G_ASSERT( TimerList::instance(TimerList::NoThrow()) != NULL ) ;
G_ASSERT( EventLoop::exists() ) ;
TimerUpdate update( *this , "ctor" ) ;
TimerList::instance().add( *this ) ;
// no List::update() here since this timer has not started
}
GNet::Timer::Timer() :
@ -73,8 +71,8 @@ GNet::Timer::Timer() :
{
G_ASSERT( TimerList::instance(TimerList::NoThrow()) != NULL ) ;
G_ASSERT( EventLoop::exists() ) ;
TimerUpdate update( *this , "ctor" ) ;
TimerList::instance().add( *this ) ;
// no List::update() here since this timer has not started
}
GNet::Timer::~Timer()
@ -83,8 +81,9 @@ GNet::Timer::~Timer()
{
if( TimerList::instance(TimerList::NoThrow()) != NULL )
{
TimerUpdate update( *this , "dtor" ) ;
TimerUpdate update ;
TimerList::instance().remove( *this ) ;
// List::update() here
}
}
catch(...)
@ -94,26 +93,26 @@ GNet::Timer::~Timer()
void GNet::Timer::startTimer( unsigned int time )
{
TimerUpdate update( *this , "start" ) ;
TimerUpdate update ;
m_time = G::DateTime::now() + time ;
// List::update() here
}
void GNet::Timer::cancelTimer()
{
TimerUpdate update( *this , "cancel" ) ;
TimerUpdate update ;
m_time = 0U ;
// List::update() here
}
void GNet::Timer::doTimeout()
{
if( m_time != 0U )
{
G_ASSERT( m_time != 0U ) ;
m_time = 0U ;
G_DEBUG( "GNet::Timer::doTimeout" ) ;
onTimeout() ;
if( m_handler != NULL )
m_handler->onTimeout(*this) ;
}
}
void GNet::Timer::onTimeout()
@ -131,7 +130,10 @@ G::DateTime::EpochTime GNet::Timer::t() const
GNet::TimerList * GNet::TimerList::m_this = NULL ;
GNet::TimerList::TimerList() :
m_changed(false)
m_list_changed(false) ,
m_empty_set_timeout_hint(false) ,
m_soonest_changed(true) ,
m_soonest(99U)
{
if( m_this == NULL )
m_this = this ;
@ -145,7 +147,7 @@ GNet::TimerList::~TimerList()
void GNet::TimerList::add( Timer & t )
{
m_changed = true ;
m_list_changed = true ;
m_list.push_back( &t ) ;
}
@ -156,21 +158,38 @@ void GNet::TimerList::remove( Timer & t )
if( *p == &t )
{
m_list.erase( p ) ;
m_changed = true ;
m_list_changed = true ;
break ;
}
}
}
void GNet::TimerList::update( G::DateTime::EpochTime t_old ,
const std::string & op )
void GNet::TimerList::update( G::DateTime::EpochTime t_old )
{
// after any change in the soonest() time notify the event loop
G::DateTime::EpochTime t_new = soonest() ;
//G_DEBUG( "GNet::TimerList::update: " << op << ": " << t_old << " -> " << t_new ) ;
G_IGNORE op.length() ; // pacify the compiler
if( t_old != t_new && EventLoop::exists() )
if( t_old != t_new )
{
EventLoop::instance().setTimeout( t_new ) ;
m_soonest_changed = true ;
if( EventLoop::exists() )
{
G_DEBUG( "GNet::TimerList::update: " << t_old << " -> " << t_new ) ;
EventLoop::instance().setTimeout( t_new , m_empty_set_timeout_hint ) ;
}
}
}
void GNet::TimerList::update()
{
// this overload just assumes that the soonest() time has probably changed
m_soonest_changed = true ;
if( EventLoop::exists() )
{
G::DateTime::EpochTime t_new = soonest() ;
G_DEBUG( "GNet::TimerList::update: ? -> " << t_new ) ;
EventLoop::instance().setTimeout( t_new , m_empty_set_timeout_hint ) ;
}
}
@ -186,9 +205,34 @@ G::DateTime::EpochTime GNet::TimerList::soonest() const
return result ;
}
G::DateTime::EpochTime GNet::TimerList::soonest( int ) const
{
// this optimised overload is for interval() which
// gets called on _every_ fd event
if( m_soonest_changed )
{
TimerList * This = const_cast<TimerList*>(this) ;
This->m_soonest = soonest() ;
This->m_soonest_changed = false ;
}
//G_ASSERT( valid() ) ; // optimisation lost if this is active
return m_soonest ;
}
bool GNet::TimerList::valid() const
{
if( soonest() != m_soonest )
{
G_ERROR( "GNet::TimerList::valid: soonest()=" << soonest() << ", m_soonest=" << m_soonest ) ;
return false ;
}
return true ;
}
unsigned int GNet::TimerList::interval( bool & infinite ) const
{
G::DateTime::EpochTime then = soonest() ;
G::DateTime::EpochTime then = soonest(0) ; // fast
infinite = then == 0U ;
if( infinite )
{
@ -219,30 +263,30 @@ void GNet::TimerList::doTimeouts()
G_DEBUG( "GNet::TimerList::doTimeouts" ) ;
G::DateTime::EpochTime now = G::DateTime::now() ;
// if the list changes break the loop and start again
do
{
m_changed = false ;
m_list_changed = false ;
for( List::iterator p = m_list.begin() ; p != m_list.end() ; ++p )
{
if( now >= (*p)->t() )
G::DateTime::EpochTime t = (*p)->t() ;
if( t != 0U && now >= t )
{
(*p)->doTimeout() ;
if( m_changed ) break ;
if( m_list_changed ) break ;
}
}
} while( m_changed ) ;
} while( m_list_changed ) ;
if( EventLoop::exists() )
EventLoop::instance().setTimeout( soonest() ) ;
// deal with any change in the soonest() time
update() ;
}
// ===
GNet::TimerUpdate::TimerUpdate( Timer & timer , const std::string & type ) :
m_timer(timer) ,
m_type(type)
GNet::TimerUpdate::TimerUpdate()
{
m_soonest = TimerList::instance().soonest() ;
m_old_soonest = TimerList::instance().soonest() ;
}
GNet::TimerUpdate::~TimerUpdate()
@ -250,7 +294,7 @@ GNet::TimerUpdate::~TimerUpdate()
try
{
if( TimerList::instance(TimerList::NoThrow()) != NULL )
TimerList::instance().update( m_soonest , m_type ) ;
TimerList::instance().update( m_old_soonest ) ;
}
catch(...)
{

View File

@ -117,8 +117,7 @@ public:
// Removes a timer from the list.
// Used by Timer::~Timer().
void update( G::DateTime::EpochTime previous_soonest ,
const std::string & why ) ;
void update( G::DateTime::EpochTime previous_soonest ) ;
// Called when one of the list's timers
// has changed.
@ -145,12 +144,18 @@ public:
private:
TimerList( const TimerList & ) ; // not implemented
void operator=( const TimerList & ) ; // not implemented
G::DateTime::EpochTime soonest( int ) const ; // fast overload
void update() ;
bool valid() const ;
private:
static TimerList * m_this ;
typedef std::list<Timer*> List ;
List m_list ;
bool m_changed ;
bool m_list_changed ;
bool m_empty_set_timeout_hint ;
bool m_soonest_changed ; // mutable
G::DateTime::EpochTime m_soonest ;
} ;

View File

@ -43,6 +43,8 @@ libgsmtp_a_SOURCES = \
gnewfile.h \
gnewmessage.cpp \
gnewmessage.h \
gprocessor.cpp \
gprocessor.h \
gprotocolmessage.cpp \
gprotocolmessage.h \
gprotocolmessageforward.cpp \

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,74 +16,94 @@
#
#
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -91,7 +111,22 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
EXTRA_DIST = \
gmessagestore_win32.cpp \
@ -119,6 +154,8 @@ libgsmtp_a_SOURCES = \
gnewfile.h \
gnewmessage.cpp \
gnewmessage.h \
gprocessor.cpp \
gprocessor.h \
gprotocolmessage.cpp \
gprotocolmessage.h \
gprotocolmessageforward.cpp \
@ -150,6 +187,7 @@ libgsmtp_a_SOURCES = \
gxtext.h
subdir = src/gsmtp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -160,7 +198,7 @@ libgsmtp_a_LIBADD =
am_libgsmtp_a_OBJECTS = gadminserver.$(OBJEXT) gbase64.$(OBJEXT) \
gclientprotocol.$(OBJEXT) gfilestore.$(OBJEXT) \
gmessagestore.$(OBJEXT) gmessagestore_unix.$(OBJEXT) \
gnewfile.$(OBJEXT) gnewmessage.$(OBJEXT) \
gnewfile.$(OBJEXT) gnewmessage.$(OBJEXT) gprocessor.$(OBJEXT) \
gprotocolmessage.$(OBJEXT) gprotocolmessageforward.$(OBJEXT) \
gprotocolmessagescanner.$(OBJEXT) \
gprotocolmessagestore.$(OBJEXT) gsasl_native.$(OBJEXT) \
@ -170,11 +208,7 @@ am_libgsmtp_a_OBJECTS = gadminserver.$(OBJEXT) gbase64.$(OBJEXT) \
gstoredmessage.$(OBJEXT) gverifier.$(OBJEXT) gxtext.$(OBJEXT)
libgsmtp_a_OBJECTS = $(am_libgsmtp_a_OBJECTS)
DEFS = @DEFS@
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/gadminserver.Po \
@ -184,6 +218,7 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/gmessagestore.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gmessagestore_unix.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gnewfile.Po ./$(DEPDIR)/gnewmessage.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gprocessor.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gprotocolmessage.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gprotocolmessageforward.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/gprotocolmessagescanner.Po \
@ -202,14 +237,12 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
CXXFLAGS = @CXXFLAGS@
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libgsmtp_a_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(libgsmtp_a_SOURCES)
all: all-am
@ -243,6 +276,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gmessagestore_unix.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnewfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnewmessage.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gprocessor.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gprotocolmessage.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gprotocolmessageforward.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gprotocolmessagescanner.Po@am__quote@
@ -258,26 +292,35 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gverifier.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gxtext.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.cpp.o:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
.cpp.obj:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CXXCOMPILE) -c -o $@ `cygpath -w $<`
CXXDEPMODE = @CXXDEPMODE@
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@ -303,20 +346,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -341,7 +405,6 @@ check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -361,7 +424,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -371,9 +434,10 @@ clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
@ -394,25 +458,33 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic tags uninstall uninstall-am \
uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am info \
info-am install install-am install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am tags uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -35,12 +35,15 @@
#include <algorithm> // std::find()
GSmtp::AdminPeer::AdminPeer( GNet::Server::PeerInfo peer_info , AdminServer & server ,
const std::string & server_address , bool with_terminate ) :
const GNet::Address & local_address , const std::string & remote_address ,
const G::StringMap & extra_commands , bool with_terminate ) :
GNet::ServerPeer(peer_info) ,
m_buffer(crlf()) ,
m_buffer(std::string(1U,'\n')) ,
m_server(server) ,
m_server_address(server_address) ,
m_local_address(local_address) ,
m_remote_address(remote_address) ,
m_notifying(false) ,
m_extra_commands(extra_commands) ,
m_with_terminate(with_terminate)
{
G_LOG_S( "GSmtp::AdminPeer: admin connection from " << peer_info.m_address.displayString() ) ;
@ -49,8 +52,10 @@ GSmtp::AdminPeer::AdminPeer( GNet::Server::PeerInfo peer_info , AdminServer & se
GSmtp::AdminPeer::~AdminPeer()
{
// only safe because AdminServer::dtor calls serverCleanup() -- otherwise
// the derived part of the server may already be destroyed
// AdminPeer objects are destroyed from within the AdminServer::dtor body
// via the GNet::Server::serverCleanup() mechanism -- this allows this
// AdminPeer dtor to call the AdminServer safely
m_server.unregister( this ) ;
if( m_client.get() ) m_client->doneSignal().disconnect() ;
}
@ -82,40 +87,45 @@ void GSmtp::AdminPeer::onData( const char * data , size_t n )
bool GSmtp::AdminPeer::processLine( const std::string & line )
{
if( is(line,"FLUSH") )
if( is(line,"flush") )
{
flush( m_server_address ) ;
flush() ;
}
else if( is(line,"HELP") )
else if( is(line,"help") )
{
help() ;
prompt() ;
}
else if( is(line,"INFO") )
else if( is(line,"info") )
{
info() ;
prompt() ;
}
else if( is(line,"NOTIFY") )
else if( is(line,"notify") )
{
m_notifying = true ;
prompt() ;
}
else if( is(line,"LIST") )
else if( is(line,"list") )
{
list() ;
prompt() ;
}
else if( is(line,"QUIT") )
else if( is(line,"quit") )
{
doDelete() ;
return false ;
}
else if( is(line,"TERMINATE") && m_with_terminate )
else if( is(line,"terminate") && m_with_terminate )
{
if( GNet::EventLoop::exists() )
GNet::EventLoop::instance().quit() ;
}
else if( find(line,m_extra_commands).first )
{
send( find(line,m_extra_commands).second ) ;
prompt() ;
}
else if( line.find_first_not_of(" \r\n\t") != std::string::npos )
{
send( "error: unrecognised command" ) ;
@ -135,38 +145,60 @@ std::string GSmtp::AdminPeer::crlf()
}
//static
bool GSmtp::AdminPeer::is( const std::string & line_in , const char * key )
bool GSmtp::AdminPeer::is( const std::string & line_in , const std::string & key )
{
std::string line( line_in ) ;
G::Str::trim( line , " \t" ) ;
G::Str::toUpper( line ) ;
G::Str::toLower( line ) ;
return line.find(key) == 0U ;
}
//static
std::pair<bool,std::string> GSmtp::AdminPeer::find( const std::string & line , const G::StringMap & map )
{
for( G::StringMap::const_iterator p = map.begin() ; p != map.end() ; ++p )
{
if( is(line,(*p).first) )
return std::make_pair(true,(*p).second) ;
}
return std::make_pair(false,std::string()) ;
}
void GSmtp::AdminPeer::help()
{
send( "commands: flush, help, info, list, notify, quit" ) ;
G::Strings commands ;
commands.push_back( "flush" ) ;
commands.push_back( "help" ) ;
commands.push_back( "info" ) ;
commands.push_back( "list" ) ;
commands.push_back( "notify" ) ;
commands.push_back( "quit" ) ;
if( m_with_terminate ) commands.push_back( "terminate" ) ;
G::Strings extras = G::Str::keys( m_extra_commands ) ;
commands.splice( commands.end() , extras ) ;
commands.sort() ;
send( std::string("commands: ") + G::Str::join(commands,", ") ) ;
}
void GSmtp::AdminPeer::flush( const std::string & address )
void GSmtp::AdminPeer::flush()
{
G_DEBUG( "GSmtp::AdminPeer: flush: \"" << address << "\"" ) ;
G_DEBUG( "GSmtp::AdminPeer: flush: \"" << m_remote_address << "\"" ) ;
if( m_client.get() != NULL && m_client->busy() )
{
send( "error: still working" ) ;
}
else if( address.empty() )
else if( m_remote_address.empty() )
{
send( "error: no remote server configured: use --forward-to" ) ;
}
else
{
const bool quit_on_disconnect = false ;
m_client <<= new Client( m_server.store() , m_server.secrets() ,
m_client <<= new Client( m_server.store() , m_server.secrets() , m_local_address ,
quit_on_disconnect , m_server.responseTimeout() ) ;
m_client->doneSignal().connect( G::slot(*this,&AdminPeer::clientDone) ) ;
std::string rc = m_client->startSending( address , m_server.connectionTimeout() ) ;
std::string rc = m_client->startSending( m_remote_address , m_server.connectionTimeout() ) ;
if( rc.length() != 0U )
{
send( std::string("error: ") + rc ) ;
@ -184,7 +216,8 @@ void GSmtp::AdminPeer::prompt()
void GSmtp::AdminPeer::send( std::string line )
{
line.append( crlf() ) ;
line.append( "\n" ) ;
G::Str::replaceAll( line , "\n" , crlf() ) ;
ssize_t rc = socket().write( line.data() , line.length() ) ;
if( rc < 0 || static_cast<size_t>(rc) < line.length() )
doDelete() ; // onDelete() and "delete this"
@ -193,7 +226,7 @@ void GSmtp::AdminPeer::send( std::string line )
void GSmtp::AdminPeer::notify( const std::string & s0 , const std::string & s1 , const std::string & s2 )
{
if( m_notifying )
send( crlf() + "EVENT: " + s0 + ": " + s1 + ": " + s2 ) ;
send( std::string(1U,'\n') + "EVENT: " + s0 + ": " + s1 + ": " + s2 ) ;
}
void GSmtp::AdminPeer::info()
@ -201,7 +234,7 @@ void GSmtp::AdminPeer::info()
std::ostringstream ss ;
if( GNet::Monitor::instance() )
{
GNet::Monitor::instance()->report( ss , "" , crlf() ) ;
GNet::Monitor::instance()->report( ss , "" , std::string(1U,'\n') ) ;
send( ss.str() ) ;
}
else
@ -218,7 +251,7 @@ void GSmtp::AdminPeer::list()
{
std::auto_ptr<StoredMessage> message( iter.next() ) ;
if( message.get() == NULL ) break ;
ss << message->name() << crlf() ;
ss << message->name() << "\n" ;
}
std::string result = ss.str() ;
@ -232,16 +265,19 @@ void GSmtp::AdminPeer::list()
GSmtp::AdminServer::AdminServer( MessageStore & store , const Secrets & secrets ,
const GNet::Address & listening_address , bool allow_remote ,
const std::string & address , unsigned int response_timeout ,
unsigned int connection_timeout , bool with_terminate ) :
GNet::Server( listening_address ) ,
m_store( store ) ,
m_secrets( secrets ) ,
m_allow_remote( allow_remote ) ,
m_server_address( address ) ,
m_response_timeout( response_timeout ) ,
m_connection_timeout( connection_timeout ) ,
m_with_terminate( with_terminate )
const GNet::Address & local_address , const std::string & remote_address ,
unsigned int response_timeout , unsigned int connection_timeout ,
const G::StringMap & extra_commands , bool with_terminate ) :
GNet::Server(listening_address) ,
m_store(store) ,
m_secrets(secrets) ,
m_local_address(local_address) ,
m_allow_remote(allow_remote) ,
m_remote_address(remote_address) ,
m_response_timeout(response_timeout) ,
m_connection_timeout(connection_timeout) ,
m_extra_commands(extra_commands) ,
m_with_terminate(with_terminate)
{
G_DEBUG( "GSmtp::AdminServer: administrative interface listening on " << listening_address.displayString() ) ;
}
@ -254,7 +290,8 @@ GSmtp::AdminServer::~AdminServer()
GNet::ServerPeer * GSmtp::AdminServer::newPeer( GNet::Server::PeerInfo peer_info )
{
AdminPeer * peer = new AdminPeer( peer_info , *this , m_server_address , m_with_terminate ) ;
AdminPeer * peer = new AdminPeer( peer_info , *this , m_local_address , m_remote_address ,
m_extra_commands , m_with_terminate ) ;
m_peers.push_back( peer ) ;
return peer ;
}

View File

@ -27,12 +27,14 @@
#include "gdef.h"
#include "gsmtp.h"
#include "gserver.h"
#include "gstr.h"
#include "glinebuffer.h"
#include "gserverprotocol.h"
#include "gsmtpclient.h"
#include <string>
#include <list>
#include <sstream>
#include <utility>
namespace GSmtp
{
@ -47,7 +49,8 @@ namespace GSmtp
class GSmtp::AdminPeer : public GNet::ServerPeer
{
public:
AdminPeer( GNet::Server::PeerInfo , AdminServer & server , const std::string & , bool ) ;
AdminPeer( GNet::Server::PeerInfo , AdminServer & , const GNet::Address & local ,
const std::string & remote , const G::StringMap & extra_commands , bool with_terminate ) ;
// Constructor.
virtual ~AdminPeer() ;
@ -63,21 +66,27 @@ private:
virtual void onData( const char * , size_t ) ; // from GNet::ServerPeer
virtual void clientDone( std::string ) ; // Client::doneSignal()
bool processLine( const std::string & line ) ;
static bool is( const std::string & , const char * ) ;
void flush( const std::string & ) ;
static bool is( const std::string & , const std::string & ) ;
static std::pair<bool,std::string> find( const std::string & line , const G::StringMap & map ) ;
void flush() ;
void help() ;
void info() ;
void list() ;
void send( std::string ) ;
void warranty() ;
void version() ;
void copyright() ;
static std::string crlf() ;
void prompt() ;
private:
GNet::LineBuffer m_buffer ;
AdminServer & m_server ;
GNet::Address m_local_address ;
std::string m_remote_address ;
std::auto_ptr<GSmtp::Client> m_client ;
std::string m_server_address ;
bool m_notifying ;
G::StringMap m_extra_commands ;
bool m_with_terminate ;
} ;
@ -89,9 +98,9 @@ class GSmtp::AdminServer : public GNet::Server
public:
AdminServer( MessageStore & store , const Secrets & client_secrets ,
const GNet::Address & listening_address , bool allow_remote ,
const std::string & server_address ,
const GNet::Address & local_address , const std::string & remote_address ,
unsigned int response_timeout , unsigned int connection_timeout ,
bool with_terminate ) ;
const G::StringMap & extra_commands , bool with_terminate ) ;
// Constructor. The 'store' and 'client-secrets' references
// are kept.
@ -136,10 +145,12 @@ private:
PeerList m_peers ;
MessageStore & m_store ;
const Secrets & m_secrets ;
GNet::Address m_local_address ;
bool m_allow_remote ;
std::string m_server_address ;
std::string m_remote_address ;
unsigned int m_response_timeout ;
unsigned int m_connection_timeout ;
G::StringMap m_extra_commands ;
bool m_with_terminate ;
} ;

View File

@ -52,18 +52,21 @@ namespace GSmtp
class GSmtp::FileIterator : public GSmtp::MessageStore::IteratorImp , public G::noncopyable
{
public:
FileIterator( FileStore & store , const G::Directory & dir , bool lock ) ;
FileIterator( FileStore & store , Processor & store_preprocessor , const G::Directory & dir , bool lock ) ;
virtual std::auto_ptr<GSmtp::StoredMessage> next() ;
private:
FileStore & m_store ;
Processor & m_store_preprocessor ;
G::DirectoryIterator m_iter ;
bool m_lock ;
} ;
// ===
GSmtp::FileIterator::FileIterator( FileStore & store , const G::Directory & dir , bool lock ) :
GSmtp::FileIterator::FileIterator( FileStore & store , Processor & store_preprocessor ,
const G::Directory & dir , bool lock ) :
m_store(store) ,
m_store_preprocessor(store_preprocessor) ,
m_iter(dir,"*.envelope") ,
m_lock(lock)
{
@ -73,7 +76,7 @@ std::auto_ptr<GSmtp::StoredMessage> GSmtp::FileIterator::next()
{
while( !m_iter.error() && m_iter.more() )
{
std::auto_ptr<StoredFile> m( new StoredFile(m_store,m_iter.filePath()) ) ;
std::auto_ptr<StoredFile> m( new StoredFile(m_store,m_store_preprocessor,m_iter.filePath()) ) ;
if( m_lock && !m->lock() )
{
G_WARNING( "GSmtp::MessageStore: cannot lock file: \"" << m_iter.filePath() << "\"" ) ;
@ -96,11 +99,14 @@ std::auto_ptr<GSmtp::StoredMessage> GSmtp::FileIterator::next()
// ===
GSmtp::FileStore::FileStore( const G::Path & dir , bool optimise ) :
GSmtp::FileStore::FileStore( const G::Path & dir , const G::Executable & newfile_preprocessor_exe ,
const G::Executable & storedfile_preprocessor_exe , bool optimise ) :
m_seq(1UL) ,
m_dir(dir) ,
m_optimise(optimise) ,
m_empty(false)
m_empty(false) ,
m_newfile_preprocessor(newfile_preprocessor_exe) ,
m_storedfile_preprocessor(storedfile_preprocessor_exe)
{
m_pid_modifier = static_cast<unsigned long>(G::DateTime::now()) % 1000000UL ;
checkPath( dir ) ;
@ -215,14 +221,14 @@ bool GSmtp::FileStore::emptyCore() const
GSmtp::MessageStore::Iterator GSmtp::FileStore::iterator( bool lock )
{
FileReader claim_reader ;
return MessageStore::Iterator( new FileIterator(*this,G::Directory(m_dir),lock) ) ;
return MessageStore::Iterator( new FileIterator(*this,m_storedfile_preprocessor,G::Directory(m_dir),lock) ) ;
}
std::auto_ptr<GSmtp::StoredMessage> GSmtp::FileStore::get( unsigned long id )
{
G::Path path = envelopePath( id ) ;
std::auto_ptr<StoredFile> message( new StoredFile(*this,path) ) ;
std::auto_ptr<StoredFile> message( new StoredFile(*this,m_storedfile_preprocessor,path) ) ;
if( ! message->lock() )
throw GetError( path.str() + ": cannot lock the file" ) ;
@ -242,11 +248,12 @@ std::auto_ptr<GSmtp::StoredMessage> GSmtp::FileStore::get( unsigned long id )
std::auto_ptr<GSmtp::NewMessage> GSmtp::FileStore::newMessage( const std::string & from )
{
m_empty = false ;
return std::auto_ptr<NewMessage>( new NewFile(from,*this) ) ;
return std::auto_ptr<NewMessage>( new NewFile(from,*this,m_newfile_preprocessor) ) ;
}
void GSmtp::FileStore::updated( bool action )
{
G_DEBUG( "GSmtp::FileStore::updated" ) ;
m_signal.emit( action ) ;
}
@ -277,3 +284,4 @@ GSmtp::FileWriter::~FileWriter()
{
}

View File

@ -30,10 +30,12 @@
#include "gdatetime.h"
#include "gexception.h"
#include "gprocess.h"
#include "gprocessor.h"
#include "gnoncopyable.h"
#include "gslot.h"
#include "groot.h"
#include "gpath.h"
#include "gexe.h"
#include <memory>
#include <string>
@ -46,7 +48,9 @@ namespace GSmtp
// Class: GSmtp::FileStore
// Description: A concrete implementation of the MessageStore
// interface, dealing in paired flat files.
// interface dealing in paired flat files and with an optional
// external preprocessor program which is used to process files
// once they have been stored.
//
// The implementation puts separate envelope and content files
// in the spool directory. The content file is written first.
@ -63,16 +67,23 @@ public:
G_EXCEPTION( InvalidDirectory , "invalid spool directory" ) ;
G_EXCEPTION( GetError , "error reading specific message" ) ;
explicit FileStore( const G::Path & dir , bool optimise = false ) ;
// Constructor. Throws an exception if the
// storage directory is invalid.
explicit FileStore( const G::Path & dir , const G::Executable & newfile_preprocessor ,
const G::Executable & storedfile_preprocessor , bool optimise = false ) ;
// Constructor. Throws an exception if the storage directory
// is invalid.
//
// If the optimise flag is set then the implementation
// of empty() will be efficient for an empty file
// store (ignoring failed and local-delivery messages).
// This might be useful for applications in which the
// main event loop is used to check for pending jobs.
// The disadvantage is that this process will not be
// Files are pre-processed after they have been stored
// if the newfile_preprocessor exe() path is not empty.
//
// Files are pre-processed after they have been extracted
// if the storedfile_preprocessor exe() path is not empty.
//
// If the optimise flag is set then the implementation of
// empty() will be efficient for an empty filestore
// (ignoring failed and local-delivery messages). This
// might be useful for applications in which the main
// event loop is used to check for pending jobs. The
// disadvantage is that this process will not be
// sensititive to messages deposited into its spool
// directory by other processes.
@ -138,6 +149,8 @@ private:
bool m_empty ; // mutable
unsigned long m_pid_modifier ;
G::Signal1<bool> m_signal ;
Processor m_newfile_preprocessor ;
Processor m_storedfile_preprocessor ;
} ;
// Class: GSmtp::FileReader

View File

@ -27,7 +27,7 @@
#include "gnewfile.h"
#include "gmemory.h"
#include "gprocess.h"
#include "gstr.h"
#include "gstrings.h"
#include "groot.h"
#include "gfile.h"
#include "gxtext.h"
@ -36,11 +36,9 @@
#include <iostream>
#include <fstream>
bool GSmtp::NewFile::m_preprocess = false ;
G::Path GSmtp::NewFile::m_preprocessor ;
GSmtp::NewFile::NewFile( const std::string & from , FileStore & store ) :
GSmtp::NewFile::NewFile( const std::string & from , FileStore & store , Processor & store_preprocessor ) :
m_store(store),
m_store_preprocessor(store_preprocessor) ,
m_from(from) ,
m_eight_bit(false),
m_saved(false) ,
@ -59,6 +57,7 @@ GSmtp::NewFile::~NewFile()
{
try
{
G_DEBUG( "GSmtp::NewFile::dtor: " << m_content_path ) ;
cleanup() ;
m_store.updated( m_repoll ) ;
}
@ -120,10 +119,11 @@ bool GSmtp::NewFile::store( const std::string & auth_id , const std::string & cl
bool cancelled = false ;
if( ok )
{
std::string output ;
ok = preprocess( m_content_path , cancelled , output ) ;
ok = m_store_preprocessor.process( m_content_path ) ;
cancelled = m_store_preprocessor.cancelled() ;
m_repoll = m_store_preprocessor.repoll() ;
if( !ok )
reason = output.empty() ? std::string("pre-processing failed") : output ;
reason = m_store_preprocessor.text("pre-processing failed") ;
}
G_ASSERT( !(ok&&cancelled) ) ;
@ -167,77 +167,6 @@ void GSmtp::NewFile::cleanup()
}
}
bool GSmtp::NewFile::preprocess( const G::Path & path , bool & cancelled , std::string & output )
{
if( ! m_preprocess ) return true ;
int exit_code = preprocessCore( path , output ) ;
bool is_ok = exit_code == 0 ;
bool is_special = exit_code >= 100 && exit_code <= 107 ;
bool is_failure = !is_ok && !is_special ;
if( is_special && ((exit_code-100)&2) != 0 )
{
m_repoll = true ;
}
// ok, fail or cancel
//
if( is_special && ((exit_code-100)&1) == 0 )
{
cancelled = true ;
G_LOG( "GSmtp::NewFile: message processing cancelled by preprocessor" ) ;
return false ;
}
else if( is_failure )
{
G_WARNING( "GSmtp::NewFile::preprocess: pre-processing failed: exit code " << exit_code ) ;
return false ;
}
else
{
return true ;
}
}
int GSmtp::NewFile::preprocessCore( const G::Path & path , std::string & output )
{
G_LOG( "GSmtp::NewFile::preprocess: " << m_preprocessor << " " << path ) ;
G::Strings args ;
args.push_back( path.str() ) ;
std::string raw_output ;
int exit_code = G::Process::spawn( G::Root::nobody() , m_preprocessor , args , &raw_output ) ;
output = parseOutput( raw_output ) ;
G_LOG( "GSmtp::NewFile::preprocess: exit status " << exit_code << " (\"" << output << "\")" ) ;
return exit_code ;
}
std::string GSmtp::NewFile::parseOutput( std::string s ) const
{
G_DEBUG( "GSmtp::NewFile::parseOutput: in: \"" << G::Str::toPrintableAscii(s) << "\"" ) ;
const std::string start("<<") ;
const std::string end(">>") ;
std::string result ;
G::Str::replaceAll( s , "\r\n" , "\n" ) ;
G::Str::replaceAll( s , "\r" , "\n" ) ;
G::Strings lines ;
G::Str::splitIntoFields( s , lines , "\n" ) ;
for( G::Strings::iterator p = lines.begin() ; p != lines.end() ; ++p )
{
std::string line = *p ;
size_t pos_start = line.find(start) ;
size_t pos_end = line.find(end) ;
if( pos_start == 0U && pos_end != std::string::npos )
{
result = G::Str::toPrintableAscii(line.substr(start.length(),pos_end-start.length())) ;
}
}
G_DEBUG( "GSmtp::NewFile::parseOutput: in: \"" << G::Str::toPrintableAscii(result) << "\"" ) ;
return result ;
}
void GSmtp::NewFile::deliver( const G::Strings & /*to*/ ,
const G::Path & content_path , const G::Path & envelope_path_now ,
const G::Path & envelope_path_later )
@ -297,12 +226,3 @@ G::Path GSmtp::NewFile::contentPath() const
return m_content_path ;
}
void GSmtp::NewFile::setPreprocessor( const G::Path & exe )
{
if( exe.isRelative() )
throw InvalidPath( exe.str() ) ;
m_preprocess = true ;
m_preprocessor = exe ;
}

View File

@ -27,7 +27,9 @@
#include "gdef.h"
#include "gsmtp.h"
#include "gfilestore.h"
#include "gstrings.h"
#include "gnewmessage.h"
#include "gprocessor.h"
#include "gexception.h"
#include <iostream>
@ -46,8 +48,9 @@ class GSmtp::NewFile : public GSmtp::NewMessage
public:
G_EXCEPTION( InvalidPath , "invalid path -- must be absolute" ) ;
NewFile( const std::string & from , FileStore & store ) ;
// Constructor.
NewFile( const std::string & from , FileStore & store , Processor & store_preprocessor ) ;
// Constructor. The preprocessor is ignored if
// its exe() path is empty.
virtual ~NewFile() ;
// Destructor.
@ -66,7 +69,7 @@ public:
virtual unsigned long id() const ;
// Returns the message's unique non-zero identifier.
static void setPreprocessor( const G::Path & exe ) ;
static void setPreprocessor( const G::Path & exe , const G::Strings & exe_args ) ;
// Defines a program which is used for pre-processing
// messages before they are stored.
@ -75,6 +78,7 @@ public:
private:
FileStore & m_store ;
Processor & m_store_preprocessor ;
unsigned long m_seq ;
std::string m_from ;
G::Strings m_to_local ;
@ -84,8 +88,6 @@ private:
bool m_eight_bit ;
bool m_saved ;
bool m_repoll ;
static bool m_preprocess ;
static G::Path m_preprocessor ;
private:
bool saveEnvelope( std::ostream & , const std::string & where ,

124
src/gsmtp/gprocessor.cpp Normal file
View File

@ -0,0 +1,124 @@
//
// Copyright (C) 2001-2003 Graeme Walker <graeme_walker@users.sourceforge.net>
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ===
//
// gprocessor.cpp
//
#include "gdef.h"
#include "gsmtp.h"
#include "gprocess.h"
#include "gprocessor.h"
#include "gstr.h"
#include "groot.h"
#include "glog.h"
GSmtp::Processor::Processor( const G::Executable & exe ) :
m_exe(exe) ,
m_cancelled(false) ,
m_repoll(false)
{
}
bool GSmtp::Processor::cancelled() const
{
return m_cancelled ;
}
bool GSmtp::Processor::repoll() const
{
return m_repoll ;
}
std::string GSmtp::Processor::text( const std::string & default_ ) const
{
return m_text.empty() ? default_ : m_text ;
}
bool GSmtp::Processor::process( const G::Path & path )
{
if( m_exe.exe() == G::Path() )
return true ;
int exit_code = preprocessCore( path ) ;
bool is_ok = exit_code == 0 ;
bool is_special = exit_code >= 100 && exit_code <= 107 ;
bool is_failure = !is_ok && !is_special ;
if( is_special && ((exit_code-100)&2) != 0 )
{
m_repoll = true ;
}
// ok, fail or cancel
//
if( is_special && ((exit_code-100)&1) == 0 )
{
m_cancelled = true ;
G_LOG( "GSmtp::Processor: message processing cancelled by preprocessor" ) ;
return false ;
}
else if( is_failure )
{
G_WARNING( "GSmtp::Processor::preprocess: pre-processing failed: exit code " << exit_code ) ;
return false ;
}
else
{
return true ;
}
}
int GSmtp::Processor::preprocessCore( const G::Path & path )
{
G_LOG( "GSmtp::Processor::preprocess: " << m_exe.exe() << " " << path ) ;
G::Strings args( m_exe.args() ) ;
args.push_back( path.str() ) ;
std::string raw_output ;
int exit_code = G::Process::spawn( G::Root::nobody() , m_exe.exe() , args , &raw_output ) ;
m_text = parseOutput( raw_output ) ;
G_LOG( "GSmtp::Processor::preprocess: exit status " << exit_code << " (\"" << m_text << "\")" ) ;
return exit_code ;
}
std::string GSmtp::Processor::parseOutput( std::string s ) const
{
G_DEBUG( "GSmtp::Processor::parseOutput: in: \"" << G::Str::toPrintableAscii(s) << "\"" ) ;
const std::string start("<<") ;
const std::string end(">>") ;
std::string result ;
G::Str::replaceAll( s , "\r\n" , "\n" ) ;
G::Str::replaceAll( s , "\r" , "\n" ) ;
G::Strings lines ;
G::Str::splitIntoFields( s , lines , "\n" ) ;
for( G::Strings::iterator p = lines.begin() ; p != lines.end() ; ++p )
{
std::string line = *p ;
size_t pos_start = line.find(start) ;
size_t pos_end = line.find(end) ;
if( pos_start == 0U && pos_end != std::string::npos )
{
result = G::Str::toPrintableAscii(line.substr(start.length(),pos_end-start.length())) ;
}
}
G_DEBUG( "GSmtp::Processor::parseOutput: in: \"" << G::Str::toPrintableAscii(result) << "\"" ) ;
return result ;
}

81
src/gsmtp/gprocessor.h Normal file
View File

@ -0,0 +1,81 @@
//
// Copyright (C) 2001-2003 Graeme Walker <graeme_walker@users.sourceforge.net>
//
// This program 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.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ===
//
// gprocessor.h
//
#ifndef G_SMTP_PROCESSOR_H
#define G_SMTP_PROCESSOR_H
#include "gdef.h"
#include "gsmtp.h"
#include "gexe.h"
namespace GSmtp
{
class Processor ;
}
// Class: GSmtp::Processor
// Description: Processes message files using an external preprocessor
// program.
//
class GSmtp::Processor
{
public:
explicit Processor( const G::Executable & preprocessor ) ;
// Constructor.
bool process( const G::Path & message_file ) ;
// Runs the processor. Returns false on error.
// Does nothing, returning true if the exe
// path is empty.
//
// If the program's standard output contains
// a line like "<<text>>" then the text string
// is returned by text().
std::string text( const std::string & default_ = std::string() ) const ;
// Returns text output by the processor program,
// or the default text if no diagnostic output was
// received.
bool cancelled() const ;
// Returns true if further message processesing
// is to be cancelled.
bool repoll() const ;
// Returns true if the message store should be
// repolled immediately.
private:
Processor( const Processor & ) ; // not implemented
void operator=( const Processor & ) ; // not implemented
int preprocessCore( const G::Path & ) ;
std::string parseOutput( std::string ) const ;
private:
G::Executable m_exe ;
std::string m_text ;
bool m_cancelled ;
bool m_repoll ;
} ;
#endif

View File

@ -147,7 +147,8 @@ bool GSmtp::ProtocolMessageForward::forward( unsigned long id , bool & nothing_t
}
else
{
m_client <<= new GSmtp::Client( message , m_client_secrets , m_response_timeout ) ;
GNet::Address local_address( 0U ) ;
m_client <<= new GSmtp::Client( message, m_client_secrets, local_address, m_response_timeout ) ;
m_client->doneSignal().connect( G::slot(*this,&ProtocolMessageForward::clientDone) ) ;
std::string reason = m_client->startSending( m_server , m_connection_timeout ) ;

View File

@ -46,8 +46,10 @@ GSmtp::ProtocolMessageScanner::ProtocolMessageScanner( MessageStore & store ,
{
G_DEBUG( "GSmtp::ProtocolMessageScanner::ctor" ) ;
scannerInit() ;
ProtocolMessageForward::storageDoneSignal().disconnect() ;
ProtocolMessageForward::storageDoneSignal().connect( G::slot(*this,&ProtocolMessageScanner::storageDone) ) ;
// rewire the base class slot/signal
storageDoneSignal().disconnect() ;
storageDoneSignal().connect( G::slot(*this,&ProtocolMessageScanner::storageDone) ) ;
}
void GSmtp::ProtocolMessageScanner::scannerInit()

View File

@ -234,8 +234,7 @@ std::string GSmtp::ScannerClient::servicePart( const std::string & s )
std::string GSmtp::ScannerClient::request( const G::Path & path ) const
{
std::string prefix = "AREA: " ;
return prefix + path.str() + "\n" ;
return path.str() + "\n" ;
}
bool GSmtp::ScannerClient::isDone() const

View File

@ -29,7 +29,66 @@
#include "gstr.h"
#include <fstream>
GSmtp::Secrets::Secrets( const G::Path & path , const std::string & debug_name ) :
// Class: GSmtp::SecretsImp
// Description: A private pimple-pattern implemtation class used by GSmtp::Secrets.
//
class GSmtp::SecretsImp
{
public:
SecretsImp( const G::Path & path , const std::string & name ) ;
~SecretsImp() ;
bool valid() const ;
std::string id( const std::string & mechanism ) const ;
std::string secret( const std::string & mechanism ) const ;
std::string secret( const std::string & mechanism , const std::string & id ) const ;
private:
void process( std::string mechanism , std::string side , std::string id , std::string secret ) ;
void read( std::istream & ) ;
private:
typedef std::map<std::string,std::string> Map ;
G::Path m_path ;
std::string m_debug_name ;
bool m_valid ;
Map m_map ;
} ;
// ===
GSmtp::Secrets::Secrets( const std::string & path , const std::string & name ) :
m_imp( new SecretsImp(G::Path(path),name) )
{
}
GSmtp::Secrets::~Secrets()
{
delete m_imp ;
}
bool GSmtp::Secrets::valid() const
{
return m_imp->valid() ;
}
std::string GSmtp::Secrets::id( const std::string & mechanism ) const
{
return m_imp->id( mechanism ) ;
}
std::string GSmtp::Secrets::secret( const std::string & mechanism ) const
{
return m_imp->secret( mechanism ) ;
}
std::string GSmtp::Secrets::secret( const std::string & mechanism , const std::string & id ) const
{
return m_imp->secret( mechanism , id ) ;
}
// ===
GSmtp::SecretsImp::SecretsImp( const G::Path & path , const std::string & debug_name ) :
m_path(path) ,
m_debug_name(debug_name)
{
@ -44,7 +103,7 @@ GSmtp::Secrets::Secrets( const G::Path & path , const std::string & debug_name )
G::Root claim_root ;
std::ifstream file( path.str().c_str() ) ;
if( !file.good() )
throw OpenError( path.str() ) ;
throw Secrets::OpenError( path.str() ) ;
read( file ) ;
m_valid = m_map.size() != 0U ;
@ -58,7 +117,7 @@ GSmtp::Secrets::Secrets( const G::Path & path , const std::string & debug_name )
}
}
void GSmtp::Secrets::read( std::istream & file )
void GSmtp::SecretsImp::read( std::istream & file )
{
while( file.good() )
{
@ -75,7 +134,7 @@ void GSmtp::Secrets::read( std::istream & file )
}
}
void GSmtp::Secrets::process( std::string mechanism , std::string side , std::string id , std::string secret )
void GSmtp::SecretsImp::process( std::string mechanism , std::string side , std::string id , std::string secret )
{
G::Str::toUpper( mechanism ) ;
const bool client = side.at(0U) == 'c' || side.at(0U) == 'C' ;
@ -94,16 +153,16 @@ void GSmtp::Secrets::process( std::string mechanism , std::string side , std::st
m_map.insert( std::make_pair(key,value) ) ;
}
GSmtp::Secrets::~Secrets()
GSmtp::SecretsImp::~SecretsImp()
{
}
bool GSmtp::Secrets::valid() const
bool GSmtp::SecretsImp::valid() const
{
return m_valid ;
}
std::string GSmtp::Secrets::id( const std::string & mechanism ) const
std::string GSmtp::SecretsImp::id( const std::string & mechanism ) const
{
Map::const_iterator p = m_map.find( mechanism+" client" ) ;
std::string result ;
@ -113,7 +172,7 @@ std::string GSmtp::Secrets::id( const std::string & mechanism ) const
return result ;
}
std::string GSmtp::Secrets::secret( const std::string & mechanism ) const
std::string GSmtp::SecretsImp::secret( const std::string & mechanism ) const
{
Map::const_iterator p = m_map.find( mechanism+" client" ) ;
if( p == m_map.end() || (*p).second.find(" ") == std::string::npos )
@ -122,7 +181,7 @@ std::string GSmtp::Secrets::secret( const std::string & mechanism ) const
return Xtext::decode( (*p).second.substr((*p).second.find(" ")+1U) ) ;
}
std::string GSmtp::Secrets::secret( const std::string & mechanism , const std::string & id ) const
std::string GSmtp::SecretsImp::secret( const std::string & mechanism , const std::string & id ) const
{
Map::const_iterator p = m_map.find( mechanism+" server "+Xtext::encode(id) ) ;
if( p == m_map.end() )

View File

@ -34,11 +34,13 @@
namespace GSmtp
{
class Secrets ;
class SecretsImp ;
}
// Class: GSmtp::Secrets
// Description: A simple interface to a store of secrets as used in
// authentication.
// authentication. The default implementation uses a flat file.
//
// See also: GSmtp::SaslClient, GSmtp::SaslServer
//
class GSmtp::Secrets
@ -46,8 +48,10 @@ class GSmtp::Secrets
public:
G_EXCEPTION( OpenError , "cannot read secrets file" ) ;
explicit Secrets( const G::Path & path , const std::string & debug_name = std::string() ) ;
// Constructor.
explicit Secrets( const std::string & storage_path , const std::string & debug_name = std::string() ) ;
// Constructor. In principle the storage_path can
// be a path to a file, a database connection
// string, etc.
~Secrets() ;
// Destructor.
@ -68,17 +72,11 @@ public:
// empty string if not a valid id.
private:
void read( std::istream & ) ;
void process( std::string , std::string , std::string , std::string ) ;
Secrets( const Secrets & ) ; // not implemented
void operator=( const Secrets & ) ; // not implemented
private:
typedef std::map<std::string,std::string> Map ;
G::Path m_path ;
std::string m_debug_name ;
bool m_valid ;
Map m_map ;
SecretsImp * m_imp ;
} ;
#endif

View File

@ -20,6 +20,9 @@
//
// gserverprotocol.cpp
//
// The "now deleted" comments indicate that the Sender::protocolSend()
// may have done a "delete this" if it could not stuff the string
// down the wire. Sender::protocolDone() can also do "delete this".
#include "gdef.h"
#include "gsmtp.h"
@ -75,6 +78,13 @@ GSmtp::ServerProtocol::ServerProtocol( Sender & sender , Verifier & verifier , P
void GSmtp::ServerProtocol::init( const std::string & ident )
{
sendGreeting( m_thishost , ident ) ;
// now deleted
}
GSmtp::ServerProtocol::~ServerProtocol()
{
m_pmessage.doneSignal().disconnect() ;
m_pmessage.preparedSignal().disconnect() ;
}
void GSmtp::ServerProtocol::sendGreeting( const std::string & thishost , const std::string & ident )
@ -124,6 +134,7 @@ bool GSmtp::ServerProtocol::apply( const std::string & line )
const bool protocol_error = new_state == s_Any ;
if( protocol_error )
sendOutOfSequence( line ) ;
// now deleted
return new_state == sEnd ;
}
}
@ -136,19 +147,21 @@ void GSmtp::ServerProtocol::processDone( bool success , unsigned long , std::str
{
m_fsm.reset( sIdle ) ;
sendCompletionReply( success , reason ) ;
// now deleted
}
}
void GSmtp::ServerProtocol::doQuit( const std::string & , bool & )
{
// (could call sendClosing() here, but if it fails it does "delete this".
sendClosing() ;
m_sender.protocolDone() ;
// do nothing more -- this object may have been deleted in protocolDone()
// now deleted
}
void GSmtp::ServerProtocol::doNoop( const std::string & , bool & )
{
sendOk() ;
// now deleted
}
void GSmtp::ServerProtocol::doVrfy( const std::string & line , bool & )
@ -158,10 +171,13 @@ void GSmtp::ServerProtocol::doVrfy( const std::string & line , bool & )
bool local = rc.is_local ;
if( local && rc.full_name.length() )
sendVerified( rc.full_name ) ;
// now deleted
else if( local )
sendNotVerified( mbox ) ;
// now deleted
else
sendWillAccept( mbox ) ;
// now deleted
}
GSmtp::Verifier::Status GSmtp::ServerProtocol::verify( const std::string & to , const std::string & from ) const
@ -191,12 +207,14 @@ void GSmtp::ServerProtocol::doEhlo( const std::string & line , bool & predicate
{
predicate = false ;
sendMissingParameter() ;
// now deleted
}
else
{
m_peer_name = peer_name ;
m_pmessage.clear() ;
sendEhloReply( m_thishost ) ;
// now deleted
}
}
@ -207,12 +225,14 @@ void GSmtp::ServerProtocol::doHelo( const std::string & line , bool & predicate
{
predicate = false ;
sendMissingParameter() ;
// now deleted
}
else
{
m_peer_name = peer_name ;
m_pmessage.clear() ;
sendHeloReply( m_thishost ) ;
// now deleted
}
}
@ -233,23 +253,27 @@ void GSmtp::ServerProtocol::doAuth( const std::string & line , bool & predicate
G_WARNING( "GSmtp::ServerProtocol: too many AUTHs" ) ;
predicate = false ; // => idle
sendOutOfSequence(line) ; // see RFC2554 "Restrictions"
// now deleted
}
else if( ! m_sasl.init(mechanism) )
{
G_WARNING( "GSmtp::ServerProtocol: request for unsupported AUTH mechanism: " << mechanism ) ;
predicate = false ; // => idle
send( "504 Unsupported authentication mechanism" ) ;
// now deleted
}
else if( got_initial_response && ! Base64::valid(initial_response) )
{
G_WARNING( "GSmtp::ServerProtocol: invalid base64 encoding of AUTH parameter" ) ;
predicate = false ; // => idle
send( "501 Invalid argument" ) ;
// now deleted
}
else if( got_initial_response && m_sasl.mustChallenge() )
{
predicate = false ; // => idle
sendAuthDone( false ) ;
// now deleted
}
else if( got_initial_response )
{
@ -261,15 +285,18 @@ void GSmtp::ServerProtocol::doAuth( const std::string & line , bool & predicate
predicate = false ; // => idle
m_authenticated = m_sasl.authenticated() ;
sendAuthDone( m_sasl.authenticated() ) ;
// now deleted
}
else
{
sendChallenge( next_challenge ) ;
// now deleted
}
}
else
{
sendChallenge( m_sasl.initialChallenge() ) ;
// now deleted
}
}
@ -279,6 +306,7 @@ void GSmtp::ServerProtocol::sendAuthDone( bool ok )
send( "235 Authentication sucessful" ) ;
else
send( "535 Authentication failed" ) ;
// now deleted
}
void GSmtp::ServerProtocol::doAuthData( const std::string & line , bool & predicate )
@ -287,12 +315,14 @@ void GSmtp::ServerProtocol::doAuthData( const std::string & line , bool & predic
{
predicate = false ; // => idle
send( "501 authentication cancelled" ) ;
// now deleted
}
else if( ! Base64::valid(line) )
{
G_WARNING( "GSmtp::ServerProtocol: invalid base64 encoding of authentication response" ) ;
predicate = false ; // => idle
sendAuthDone( false ) ;
// now deleted
}
else
{
@ -303,10 +333,12 @@ void GSmtp::ServerProtocol::doAuthData( const std::string & line , bool & predic
predicate = false ; // => idle
m_authenticated = m_sasl.authenticated() ;
sendAuthDone( m_sasl.authenticated() ) ;
// now deleted
}
else
{
sendChallenge( next_challenge ) ;
// now deleted
}
}
}
@ -322,6 +354,7 @@ void GSmtp::ServerProtocol::doMailPrepare( const std::string & line , bool & pre
{
predicate = false ;
sendAuthRequired() ;
// now deleted
}
else
{
@ -338,6 +371,7 @@ void GSmtp::ServerProtocol::doMailPrepare( const std::string & line , bool & pre
else
{
sendBadFrom( from ) ;
// now deleted
}
}
}
@ -361,12 +395,14 @@ void GSmtp::ServerProtocol::doMail( const std::string & line , bool & predicate
if( line.empty() )
{
sendMailReply() ;
// now deleted
}
else
{
predicate = false ;
bool temporary = line.at(0U) == ' ' ;
sendMailError( line.substr(temporary?1U:0U) , temporary ) ;
// now deleted
}
}
@ -378,41 +414,48 @@ void GSmtp::ServerProtocol::doRcpt( const std::string & line , bool & predicate
predicate = ok ;
if( ok )
sendRcptReply() ;
// now deleted
else
sendBadTo( G::Str::toPrintableAscii(status.reason) ) ;
// now deleted
}
void GSmtp::ServerProtocol::doUnknown( const std::string & line , bool & )
{
sendUnrecognised( line ) ;
// now deleted
}
void GSmtp::ServerProtocol::doRset( const std::string & , bool & )
{
m_pmessage.clear() ;
// (could also reset authentication here)
sendRsetReply() ;
// now deleted
}
void GSmtp::ServerProtocol::doNoRecipients( const std::string & , bool & )
{
sendNoRecipients() ;
// now deleted
}
void GSmtp::ServerProtocol::doData( const std::string & , bool & )
{
m_pmessage.addReceived( receivedLine() ) ;
sendDataReply() ;
// now deleted
}
void GSmtp::ServerProtocol::sendOutOfSequence( const std::string & )
{
send( "503 command out of sequence -- use RSET to resynchronise" ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendMissingParameter()
{
send( "501 parameter required" ) ;
// now deleted
}
bool GSmtp::ServerProtocol::isEndOfText( const std::string & line ) const
@ -462,81 +505,98 @@ GSmtp::ServerProtocol::Event GSmtp::ServerProtocol::commandEvent( const std::str
void GSmtp::ServerProtocol::sendClosing()
{
send( "221 closing connection" ) ;
bool allow_delete_this = false ;
send( "221 closing connection" , allow_delete_this ) ;
// now deleted -- NOT
}
void GSmtp::ServerProtocol::sendVerified( const std::string & user )
{
send( std::string("250 ") + user ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendNotVerified( const std::string & user )
{
send( std::string("550 no such mailbox: ") + user ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendWillAccept( const std::string & user )
{
send( std::string("252 cannot verify but will accept: ") + user ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendUnrecognised( const std::string & line )
{
send( "500 command unrecognized: \"" + line + std::string("\"") ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendAuthRequired()
{
send( "530 authentication required" ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendNoRecipients()
{
send( "554 no valid recipients" ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendDataReply()
{
send( "354 start mail input -- end with <CRLF>.<CRLF>" ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendRsetReply()
{
send( "250 state reset" ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendMailReply()
{
sendOk() ;
// now deleted
}
void GSmtp::ServerProtocol::sendMailError( const std::string & reason , bool temporary )
{
std::string number( temporary ? "452" : "550" ) ;
send( number + " " + reason ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendCompletionReply( bool ok , const std::string & reason )
{
if( ok )
sendOk() ;
// now deleted
else
send( std::string("452 message processing failed: ") + reason ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendRcptReply()
{
sendOk() ;
// now deleted
}
void GSmtp::ServerProtocol::sendBadFrom( const std::string & /*from*/ )
{
send( "553 mailbox name not allowed" ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendBadTo( const std::string & text )
{
send( std::string("550 mailbox unavailable: ") + text ) ;
// now deleted
}
void GSmtp::ServerProtocol::sendEhloReply( const std::string & domain )
@ -552,11 +612,13 @@ void GSmtp::ServerProtocol::sendEhloReply( const std::string & domain )
void GSmtp::ServerProtocol::sendHeloReply( const std::string & /*domain*/ )
{
sendOk() ;
// now deleted
}
void GSmtp::ServerProtocol::sendOk()
{
send( "250 OK" ) ;
// now deleted
}
//static
@ -565,17 +627,12 @@ std::string GSmtp::ServerProtocol::crlf()
return std::string( "\015\012" ) ;
}
void GSmtp::ServerProtocol::send( std::string line )
void GSmtp::ServerProtocol::send( std::string line , bool allow_delete_this )
{
G_LOG( "GSmtp::ServerProtocol: tx>>: \"" << line << "\"" ) ;
line.append( crlf() ) ;
m_sender.protocolSend( line ) ;
}
GSmtp::ServerProtocol::~ServerProtocol()
{
m_pmessage.doneSignal().disconnect() ;
m_pmessage.preparedSignal().disconnect() ;
m_sender.protocolSend( line , allow_delete_this ) ;
// now deleted
}
std::string GSmtp::ServerProtocol::parseFrom( const std::string & line ) const

View File

@ -65,7 +65,7 @@ class GSmtp::ServerProtocol
public:
class Sender // An interface used by ServerProtocol to send protocol replies.
{
public: virtual void protocolSend( const std::string & s ) = 0 ;
public: virtual void protocolSend( const std::string & s , bool allow_delete_this ) = 0 ;
public: virtual void protocolDone() = 0 ;
public: virtual ~Sender() ;
private: void operator=( const Sender & ) ; // not implemented
@ -139,7 +139,7 @@ private:
private:
ServerProtocol( const ServerProtocol & ) ; // not implemented
void operator=( const ServerProtocol & ) ; // not implemented
void send( std::string ) ;
void send( std::string , bool = true ) ;
Event commandEvent( const std::string & ) const ;
std::string commandWord( const std::string & line ) const ;
std::string commandLine( const std::string & line ) const ;

View File

@ -45,14 +45,15 @@ std::string GSmtp::Client::crlf()
return std::string("\015\012") ;
}
GSmtp::Client::Client( MessageStore & store , const Secrets & secrets ,
GSmtp::Client::Client( MessageStore & store , const Secrets & secrets , const GNet::Address & local_address ,
bool quit_on_disconnect , unsigned int response_timeout ) :
GNet::Client(false,quit_on_disconnect) ,
GNet::Client(local_address,false,quit_on_disconnect) ,
m_store(&store) ,
m_buffer(crlf()) ,
m_protocol(*this,secrets,GNet::Local::fqdn(),response_timeout,must_authenticate) ,
m_socket(NULL) ,
m_connect_timer(*this) ,
m_preprocess_timer(*this) ,
m_message_index(0U) ,
m_busy(true) ,
m_force_message_fail(false)
@ -61,14 +62,15 @@ GSmtp::Client::Client( MessageStore & store , const Secrets & secrets ,
}
GSmtp::Client::Client( std::auto_ptr<StoredMessage> message , const Secrets & secrets ,
unsigned int response_timeout ) :
GNet::Client(false,false) ,
const GNet::Address & local_address , unsigned int response_timeout ) :
GNet::Client(local_address,false,false) ,
m_store(NULL) ,
m_message(message) ,
m_buffer(crlf()) ,
m_protocol(*this,secrets,GNet::Local::fqdn(),response_timeout,must_authenticate) ,
m_socket(NULL) ,
m_connect_timer(*this) ,
m_preprocess_timer(*this) ,
m_message_index(0U) ,
m_busy(true) ,
m_force_message_fail(false)
@ -215,6 +217,16 @@ void GSmtp::Client::start( StoredMessage & message )
if( server_name.empty() )
server_name = m_host ;
// synchronous, client-side preprocessing -- treat errors
// asynchronously with a zero-length timer
//
if( ! message.preprocess() )
{
G_DEBUG( "GSmtp::Client::start: client-side pre-processing failed" ) ;
m_preprocess_timer.startTimer( 0U ) ;
return ;
}
std::auto_ptr<std::istream> content_stream( message.extractContentStream() ) ;
m_protocol.start( message.from() , message.to() , message.eightBit() ,
message.authentication() , server_name , content_stream ) ;
@ -264,14 +276,24 @@ void GSmtp::Client::onDisconnect()
finish( reason , false ) ;
}
void GSmtp::Client::onTimeout( GNet::Timer & )
void GSmtp::Client::onTimeout( GNet::Timer & timer )
{
G_DEBUG( "GSmtp::Client::onTimeout" ) ;
if( &timer == &m_connect_timer )
{
G_DEBUG( "GSmtp::Client::onTimeout: connection timeout" ) ;
std::string reason = "connection timeout" ;
if( m_force_message_fail )
messageFail( reason ) ;
finish( reason ) ;
}
else
{
G_DEBUG( "GSmtp::Client::onTimeout: preprocessing failure timeout" ) ;
G_ASSERT( &timer == &m_preprocess_timer ) ;
messageFail( "pre-processing failed" ) ; // could do better
if( m_store == NULL || !sendNext() )
finish() ;
}
}
GNet::Socket & GSmtp::Client::socket()

View File

@ -57,7 +57,8 @@ class GSmtp::Client : private GNet::Client , private GNet::TimeoutHandler , priv
public:
G_EXCEPTION( NotConnected , "not connected" ) ;
Client( MessageStore & store , const Secrets & secrets ,
Client( MessageStore & store ,
const Secrets & secrets , const GNet::Address & local_address ,
bool quit_on_disconnect , unsigned int response_timeout ) ;
// Constructor. The 'store' and 'secrets'
// references are kept.
@ -67,7 +68,8 @@ public:
// or that the server connection has
// been lost.
Client( std::auto_ptr<StoredMessage> message , const Secrets & secrets ,
Client( std::auto_ptr<StoredMessage> message ,
const Secrets & secrets , const GNet::Address & local_address ,
unsigned int response_timeout ) ;
// Constructor for sending a single message.
// The 'secrets' reference is kept.
@ -153,6 +155,7 @@ private:
G::Signal2<std::string,std::string> m_event_signal ;
std::string m_host ;
GNet::Timer m_connect_timer ;
GNet::Timer m_preprocess_timer ;
unsigned int m_message_index ;
bool m_busy ;
bool m_force_message_fail ;

View File

@ -81,7 +81,7 @@ bool GSmtp::ServerPeer::processLine( const std::string & line )
return m_protocol.apply( line ) ;
}
void GSmtp::ServerPeer::protocolSend( const std::string & line )
void GSmtp::ServerPeer::protocolSend( const std::string & line , bool allow_delete_this )
{
if( line.length() == 0U )
return ;
@ -89,6 +89,7 @@ void GSmtp::ServerPeer::protocolSend( const std::string & line )
ssize_t rc = socket().write( line.data() , line.length() ) ;
if( rc < 0 && ! socket().eWouldBlock() )
{
if( allow_delete_this )
doDelete() ; // onDelete() and "delete this"
}
else if( rc < 0 || static_cast<size_t>(rc) < line.length() )

View File

@ -62,7 +62,7 @@ public:
private:
ServerPeer( const ServerPeer & ) ;
void operator=( const ServerPeer & ) ;
virtual void protocolSend( const std::string & line ) ; // from ServerProtocol::Sender
virtual void protocolSend( const std::string & line , bool ) ; // from ServerProtocol::Sender
virtual void protocolDone() ; // from ServerProtocol::Sender
virtual void onDelete() ; // from GNet::ServerPeer
virtual void onData( const char * , size_t ) ; // from GNet::ServerPeer

View File

@ -33,8 +33,9 @@
#include "gassert.h"
#include <fstream>
GSmtp::StoredFile::StoredFile( FileStore & store , const G::Path & path ) :
GSmtp::StoredFile::StoredFile( FileStore & store , Processor & store_preprocessor , const G::Path & path ) :
m_store(store) ,
m_store_preprocessor(store_preprocessor) ,
m_envelope_path(path) ,
m_eight_bit(false) ,
m_errors(0U) ,
@ -321,6 +322,11 @@ const G::Strings & GSmtp::StoredFile::to() const
return m_to_remote ;
}
bool GSmtp::StoredFile::preprocess()
{
return m_store_preprocessor.process( contentPath().str() ) ;
}
std::auto_ptr<std::istream> GSmtp::StoredFile::extractContentStream()
{
G_ASSERT( m_content.get() != NULL ) ;

View File

@ -27,6 +27,8 @@
#include "gdef.h"
#include "gsmtp.h"
#include "gmessagestore.h"
#include "gexe.h"
#include "gprocessor.h"
#include "gstoredmessage.h"
#include "gexception.h"
#include "gpath.h"
@ -54,7 +56,7 @@ public:
G_EXCEPTION( StreamError , "envelope reading/parsing error" ) ;
G_EXCEPTION( InvalidFilename , "invalid filename" ) ;
StoredFile( FileStore & store , const G::Path & envelope_path ) ;
StoredFile( FileStore & store , Processor & store_preprocessor , const G::Path & envelope_path ) ;
// Constructor.
virtual ~StoredFile() ;
@ -88,6 +90,9 @@ public:
virtual std::string authentication() const ;
// From StoredMessage.
virtual bool preprocess() ;
// From StoredMessage.
virtual void destroy() ;
// From StoredMessage.
@ -123,6 +128,7 @@ private:
private:
FileStore & m_store ;
Processor & m_store_preprocessor ;
G::Strings m_to_local ;
G::Strings m_to_remote ;
std::string m_from ;

View File

@ -51,6 +51,10 @@ public:
virtual const G::Strings & to() const = 0 ;
// Returns the envelope 'to' fields.
virtual bool preprocess() = 0 ;
// Does synchronous pre-processing. Returns false
// on error.
virtual std::auto_ptr<std::istream> extractContentStream() = 0 ;
// Extracts the content stream.
// Can only be called once.

View File

@ -33,8 +33,8 @@
#include "gassert.h"
#include "glog.h"
GSmtp::Verifier::Verifier( const G::Path & path , bool deliver_to_postmaster , bool reject_local ) :
m_path(path) ,
GSmtp::Verifier::Verifier( const G::Executable & external , bool deliver_to_postmaster , bool reject_local ) :
m_external(external) ,
m_deliver_to_postmaster(deliver_to_postmaster) ,
m_reject_local(reject_local)
{
@ -62,7 +62,7 @@ GSmtp::Verifier::Status GSmtp::Verifier::verify( const std::string & address ,
G::Str::toUpper( user ) ;
Status status =
m_path == G::Path() ?
m_external.exe() == G::Path() ?
verifyInternal( address , user , host , fqdn ) :
verifyExternal( address , user , host , fqdn , from , ip , mechanism , extra ) ;
@ -104,7 +104,7 @@ GSmtp::Verifier::Status GSmtp::Verifier::verifyExternal( const std::string & add
const std::string & host , const std::string & fqdn , const std::string & from ,
const GNet::Address & ip , const std::string & mechanism , const std::string & extra ) const
{
G::Strings args ;
G::Strings args( m_external.args() ) ;
args.push_back( address ) ;
args.push_back( user ) ;
args.push_back( host ) ;
@ -113,12 +113,12 @@ GSmtp::Verifier::Status GSmtp::Verifier::verifyExternal( const std::string & add
args.push_back( ip.displayString(false) ) ;
args.push_back( mechanism ) ;
args.push_back( extra ) ;
G_LOG( "GSmtp::Verifier: executing " << m_path << " " << address << " " << user << " "
G_LOG( "GSmtp::Verifier: executing " << m_external.exe() << " " << address << " " << user << " "
<< host << " " << fqdn << " " << from << " " << ip.displayString(false) << " "
<< "\"" << mechanism << "\" \"" << extra << "\"" ) ;
std::string response ;
int rc = G::Process::spawn( G::Root::nobody() , m_path , args , &response ) ;
int rc = G::Process::spawn( G::Root::nobody() , m_external.exe() , args , &response ) ;
G_LOG( "GSmtp::Verifier: " << rc << ": \"" << G::Str::toPrintableAscii(response) << "\"" ) ;
G::Str::trimRight( response , " \n\t" ) ;

View File

@ -28,6 +28,7 @@
#include "gsmtp.h"
#include "gaddress.h"
#include "gpath.h"
#include "gexe.h"
#include <string>
namespace GSmtp
@ -53,7 +54,7 @@ public:
std::string reason ;
} ;
Verifier( const G::Path & exe , bool deliver_to_postmaster , bool reject_local ) ;
Verifier( const G::Executable & exe , bool deliver_to_postmaster , bool reject_local ) ;
// Constructor. If an executable path is given (ie. not
// G::Path()) then it is used for external verification.
// Otherwise the internal verifier is used, controlled
@ -99,7 +100,7 @@ private:
const std::string & , const std::string & ) const ;
private:
G::Path m_path ;
G::Executable m_external ;
bool m_deliver_to_postmaster ;
bool m_reject_local ;
} ;

View File

@ -30,6 +30,7 @@ mk_sources=\
gmessagestore_win32.cpp \
gnewfile.cpp \
gnewmessage.cpp \
gprocessor.cpp \
gprotocolmessage.cpp \
gprotocolmessageforward.cpp \
gprotocolmessagestore.cpp \

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,74 +16,94 @@
#
#
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -91,7 +111,22 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
# force symbol stripping on 'make install' -- see also make 'install-strip'
AM_INSTALL_PROGRAM_FLAGS = -s
@ -161,6 +196,7 @@ emailrelay_submit_LDADD = \
$(top_builddir)/src/gnet/libgnet.a
subdir = src/main
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -191,11 +227,7 @@ emailrelay_submit_DEPENDENCIES = $(top_builddir)/src/gsmtp/libgsmtp.a \
$(top_builddir)/src/gnet/libgnet.a
emailrelay_submit_LDFLAGS =
DEFS = @DEFS@
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/commandline.Po \
@ -207,18 +239,16 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
CXXFLAGS = @CXXFLAGS@
DIST_SOURCES = $(emailrelay_SOURCES) $(emailrelay_passwd_SOURCES) \
$(emailrelay_poke_SOURCES) $(emailrelay_submit_SOURCES)
DATA = $(e_spool_DATA)
DIST_COMMON = Makefile.am Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(emailrelay_SOURCES) $(emailrelay_passwd_SOURCES) $(emailrelay_poke_SOURCES) $(emailrelay_submit_SOURCES)
all: all-am
@ -240,7 +270,7 @@ install-e_libexecPROGRAMS: $(e_libexec_PROGRAMS)
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(e_libexecPROGRAMS_INSTALL) $$p $(DESTDIR)$(e_libexecdir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(e_libexecPROGRAMS_INSTALL) $$p $(DESTDIR)$(e_libexecdir)/$$f; \
$(INSTALL_PROGRAM_ENV) $(e_libexecPROGRAMS_INSTALL) $$p $(DESTDIR)$(e_libexecdir)/$$f || exit 1; \
else :; fi; \
done
@ -264,7 +294,7 @@ install-e_sbinPROGRAMS: $(e_sbin_PROGRAMS)
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(e_sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(e_sbindir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(e_sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(e_sbindir)/$$f; \
$(INSTALL_PROGRAM_ENV) $(e_sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(e_sbindir)/$$f || exit 1; \
else :; fi; \
done
@ -307,34 +337,49 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/submit.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.c.o:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c `cygpath -w $<`
CCDEPMODE = @CCDEPMODE@
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
.cpp.o:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
.cpp.obj:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CXXCOMPILE) -c -o $@ `cygpath -w $<`
CXXDEPMODE = @CXXDEPMODE@
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am:
e_spoolDATA_INSTALL = $(INSTALL_DATA)
install-e_spoolDATA: $(e_spool_DATA)
@ -358,6 +403,9 @@ uninstall-e_spoolDATA:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@ -383,20 +431,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -422,7 +491,6 @@ all-am: Makefile $(PROGRAMS) $(DATA)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(e_libexecdir) $(DESTDIR)$(e_sbindir) $(DESTDIR)$(e_spooldir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -442,7 +510,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -453,9 +521,10 @@ clean-am: clean-e_libexecPROGRAMS clean-e_sbinPROGRAMS clean-generic \
mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-tags
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
@ -477,27 +546,37 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-e_libexecPROGRAMS uninstall-e_sbinPROGRAMS \
uninstall-e_spoolDATA uninstall-info-am uninstall-local
.PHONY: GTAGS all all-am check check-am clean clean-e_libexecPROGRAMS \
clean-e_sbinPROGRAMS clean-generic distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-data-local install-e_libexecPROGRAMS \
install-e_sbinPROGRAMS install-e_spoolDATA install-exec \
install-exec-am install-exec-local install-info install-info-am \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic tags \
uninstall uninstall-am uninstall-e_libexecPROGRAMS \
.PHONY: CTAGS GTAGS all all-am check check-am clean \
clean-e_libexecPROGRAMS clean-e_sbinPROGRAMS clean-generic \
ctags distclean distclean-compile distclean-generic \
distclean-tags distdir dvi dvi-am info info-am install \
install-am install-data install-data-am install-data-local \
install-e_libexecPROGRAMS install-e_sbinPROGRAMS \
install-e_spoolDATA install-exec install-exec-am \
install-exec-local install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-e_libexecPROGRAMS \
uninstall-e_sbinPROGRAMS uninstall-e_spoolDATA \
uninstall-info-am uninstall-local

View File

@ -61,7 +61,7 @@ std::string Main::CommandLine::switchSpec( bool is_windows )
<< "1!admin-port!3|"
<< "x!dont-serve!dont act as a server (usually used with --forward)!0!!3|"
<< "X!dont-listen!dont listen for smtp connections (usually used with --admin)!0!!3|"
<< "z!filter!defines a mail processor program!1!program!3|"
<< "z!filter!defines a mail processor program for when storing!1!program!3|"
<< "D!domain!sets an override for the host's fully qualified domain name!1!fqdn!3|"
<< "f!forward!forwards stored mail on startup (requires --forward-to)!0!!3|"
<< "o!forward-to!specifies the remote smtp server (required by --forward and --admin)!1!host:port!3|"
@ -75,7 +75,8 @@ std::string Main::CommandLine::switchSpec( bool is_windows )
<< "O!poll!enables polling with the specified period (requires --forward-to)!1!period!3|"
<< "P!postmaster!deliver to postmaster and reject all other local mailbox addresses!0!!3|"
<< "Z!verifier!defines an external address verifier program!1!program!3|"
<< "Q!admin-terminate!!0!!0|"
<< "Y!client-filter!defines a mail processor program for when forwarding!1!program!3|"
<< "Q!admin-terminate!enables the terminate command on the admin interface!0!!3|"
<< "R!scanner!!1!host:port!0|"
;
return ss.str() ;
@ -167,6 +168,11 @@ std::string Main::CommandLine::semanticError() const
"admin listening port must be different" ;
}
if( cfg().withTerminate() && !cfg().doAdmin() )
{
return "the --admin-terminate switch requires --admin" ;
}
if( cfg().daemon() && cfg().spoolDir().isRelative() )
{
return "in daemon mode the spool-dir must "
@ -182,8 +188,8 @@ std::string Main::CommandLine::semanticError() const
}
const bool forward_to =
m_getopt.contains("as-proxy") ||
m_getopt.contains("as-client") ||
m_getopt.contains("as-proxy") || // => forward-to
m_getopt.contains("as-client") || // => forward-to
m_getopt.contains("forward-to") ;
if( ! forward_to && (
@ -194,28 +200,50 @@ std::string Main::CommandLine::semanticError() const
return "the --forward, --immediate and --poll switches require --forward-to" ;
}
if( m_getopt.contains("scanner") && ! ( m_getopt.contains("as-proxy") || m_getopt.contains("immediate") ) )
const bool forwarding =
m_getopt.contains("as-proxy") || // => immediate
m_getopt.contains("as-client") || // => forward
m_getopt.contains("forward") ||
m_getopt.contains("immediate") ||
m_getopt.contains("poll") ;
if( m_getopt.contains("client-filter") && ! forwarding )
{
return "the --client-filter switch requires --as-proxy, --as-client, --poll, --immediate or --forward" ;
}
const bool not_serving = m_getopt.contains("dont-serve") || m_getopt.contains("as-client") ;
if( m_getopt.contains("filter") && not_serving )
{
return "the --filter switch cannot be used with --as-client or --dont-serve" ;
}
const bool immediate =
m_getopt.contains("as-proxy") || // => immediate
m_getopt.contains("immediate") ;
if( m_getopt.contains("scanner") && ! immediate )
{
return "the --scanner switch requires --as-proxy or --immediate" ;
}
const bool log =
m_getopt.contains("log") ||
m_getopt.contains("as-server") ||
m_getopt.contains("as-client") ||
m_getopt.contains("as-proxy") ;
m_getopt.contains("as-server") || // => log
m_getopt.contains("as-client") || // => log
m_getopt.contains("as-proxy") ; // => log
if( m_getopt.contains("verbose") && ! ( m_getopt.contains("help") || log ) )
{
return "the --verbose switch must be used with --log, --help, --as-client, --as-server or --as-proxy" ;
}
if( m_getopt.contains("interface") && ( m_getopt.contains("dont-serve") || m_getopt.contains("as-client") ) )
{
return "the --interface switch cannot be used with --as-client or --dont-serve" ;
}
const bool no_daemon =
m_getopt.contains("as-client") || // => no-daemon
m_getopt.contains("no-daemon") ;
if( cfg().daemon() && m_getopt.contains("hidden") ) // (win32)
if( m_getopt.contains("hidden") && ! no_daemon ) // (win32)
{
return "the --hidden switch requires --no-daemon or --as-client" ;
}

View File

@ -193,6 +193,10 @@ SOURCE=..\gnet\geventserver.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gexe.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gexception.cpp
# End Source File
# Begin Source File
@ -281,6 +285,10 @@ SOURCE=..\glib\gprocess_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\gsmtp\gprocessor.cpp
# End Source File
# Begin Source File
SOURCE=..\gsmtp\gprotocolmessage.cpp
# End Source File
# Begin Source File

View File

@ -62,8 +62,8 @@ std::string Main::Configuration::str( const std::string & p , const std::string
std::ostringstream ss ;
ss
<< p << "listening port: " << (doServing()?G::Str::fromUInt(port()):na()) << eol
<< p << "listening interface: " << (doServing()?any(interface_()):na()) << eol
<< p << "next server address: " << ((doForwarding()||doPolling())?serverAddress():na()) << eol
<< p << "listening interface: " << (doServing()?any(listeningInterface()):na()) << eol
<< p << "next server address: " << (serverAddress().length()?serverAddress():na()) << eol
<< p << "spool directory: " << spoolDir() << eol
<< p << "immediate forwarding? " << yn(immediate()) << eol
<< p << "mail processor: " << (useFilter()?filter():na()) << eol
@ -122,15 +122,48 @@ unsigned int Main::Configuration::port() const
G::Str::toUInt(m_cl.value("port")) : 25U ;
}
std::string Main::Configuration::interface_() const
std::string Main::Configuration::listeningInterface() const
{
return m_cl.contains("interface") ? m_cl.value("interface") : std::string() ;
}
std::string Main::Configuration::clientInterface() const
{
return listeningInterface() ; // or a separate switch?
}
G::Path Main::Configuration::adminAddressFile() const
{
if( ! m_cl.contains("admin") )
return G::Path() ;
const std::string s = m_cl.value("admin") ;
if( s.find("tcp://") == 0U && s.length() > 6U && s.find("/",6U) != std::string::npos )
{
return G::Path(s.substr(s.find("/",6U))) ;
}
else
{
return G::Path() ;
}
}
unsigned int Main::Configuration::adminPort() const
{
return m_cl.contains("admin") ?
G::Str::toUInt(m_cl.value("admin")) : 10025U ;
std::string s = m_cl.contains("admin") ? m_cl.value("admin") : std::string() ;
if( s.find("tcp://") == 0U )
{
s = 6U >= s.length() ? std::string() : s.substr(6U) ;
size_t p = s.find("/") ;
if( p != std::string::npos )
s = s.substr(0U,p) ;
p = s.find_last_of( ':' ) ;
if( p != std::string::npos )
s = (p+1U) >= s.length() ? std::string() : s.substr(p+1U) ;
}
return s.empty() ? 0U : G::Str::toUInt(s) ;
}
bool Main::Configuration::closeStderr() const
@ -222,7 +255,12 @@ bool Main::Configuration::useFilter() const
std::string Main::Configuration::filter() const
{
return m_cl.value("filter") ;
return m_cl.contains("filter") ? m_cl.value("filter") : std::string() ;
}
std::string Main::Configuration::clientFilter() const
{
return m_cl.contains("client-filter") ? m_cl.value("client-filter") : std::string() ;
}
unsigned int Main::Configuration::icon() const

View File

@ -56,11 +56,11 @@ public:
unsigned int port() const ;
// Returns the main listening port number.
std::string interface_() const ;
std::string listeningInterface() const ;
// Returns the listening interface.
unsigned int adminPort() const ;
// Returns the admin port number.
std::string clientInterface() const ;
// Returns the sending interface.
bool closeStderr() const ;
// Returns true if stderr should be closed.
@ -98,6 +98,12 @@ public:
bool doAdmin() const ;
// Returns true if listening for admin connections.
G::Path adminAddressFile() const ;
// Returns the admin address file path.
unsigned int adminPort() const ;
// Returns the admin port number.
bool allowRemoteClients() const ;
// Returns true if allowing remote clients to connect.
@ -117,7 +123,10 @@ public:
// Returns true if pre-processing.
std::string filter() const ;
// Returns the pre-processor's path.
// Returns the path to a server-side pre-processor.
std::string clientFilter() const ;
// Returns the path to a client-side pre-processor.
unsigned int icon() const ;
// Returns the icon selector (win32).

View File

@ -3,7 +3,7 @@
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = E-MailRelay
PROJECT_NUMBER = 1.1.3
PROJECT_NUMBER = 1.2
OUTPUT_DIRECTORY =
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES

View File

@ -39,6 +39,7 @@ of the code structure, and there are a number of supporting diagrams:
<li><a href="../gnet-client.png">GNet::Client state transition diagram</a></li>
<li><a href="../gsmtp-scannerclient.png">GNet::ScannerClient state transition diagram</a></li>
<li><a href="../gsmtp-serverprotocol.png">GSmtp::ServerProtocol state transition diagram</a></li>
<li><a href="../auth.png">Authentication usage</a></li>
</ul>
*/

View File

@ -76,6 +76,17 @@
#define BOOL int
#endif
#include <stdio.h>
static void init( void )
{
#ifdef G_WIN32
static WSADATA info ;
if( 0 != WSAStartup( MAKEWORD(1,1) , &info ) )
; /* error */
#endif
}
static void detach( void )
{
#ifndef G_WIN32
@ -132,7 +143,9 @@ static BOOL poke( int argc , char * argv [] )
/* open the socket */
fd = socket( AF_INET , SOCK_STREAM , 0 ) ;
if( fd < 0 )
{
return FALSE ;
}
/* prepare the address */
memset( &address , 0 , sizeof(address) ) ;
@ -186,6 +199,7 @@ int main( int argc , char * argv [] )
}
/* run once, or in a loop */
init() ;
if( daemon )
{
detach() ;

View File

@ -44,13 +44,15 @@
#include "gmemory.h"
#include "glogoutput.h"
#include "gdebug.h"
#include "legal.h"
#include <iostream>
#include <exception>
#include <utility>
//static
std::string Main::Run::versionNumber()
{
return "1.1.3" ;
return "1.2" ;
}
Main::Run::Run( Main::Output & output , const G::Arg & arg , const std::string & switch_spec ) :
@ -162,10 +164,10 @@ void Main::Run::checkPort( const std::string & interface_ , unsigned int port )
void Main::Run::checkPorts() const
{
if( cfg().doServing() && cfg().doSmtp() )
checkPort( cfg().interface_() , cfg().port() ) ;
checkPort( cfg().listeningInterface() , cfg().port() ) ;
if( cfg().doServing() && cfg().doAdmin() )
checkPort( cfg().interface_() , cfg().adminPort() ) ;
checkPort( cfg().listeningInterface() , cfg().adminPort() ) ;
}
void Main::Run::runCore()
@ -206,10 +208,9 @@ void Main::Run::runCore()
// message store singleton
//
m_store <<= new GSmtp::FileStore( cfg().spoolDir() ) ;
m_store <<= new GSmtp::FileStore( cfg().spoolDir() ,
G::Executable(cfg().filter()) , G::Executable(cfg().clientFilter()) ) ;
m_store->signal().connect( G::slot(*this,&Run::raiseStoreEvent) ) ;
if( cfg().useFilter() )
GSmtp::NewFile::setPreprocessor( G::Path(cfg().filter()) ) ;
// authentication secrets
//
@ -247,13 +248,14 @@ void Main::Run::doServing( GSmtp::MessageStore & store , const GSmtp::Secrets &
if( cfg().doSmtp() )
{
GSmtp::Server::AddressList interfaces ;
if( cfg().interface_().length() )
interfaces.push_back( GNet::Address(cfg().interface_(),cfg().port()) ) ;
if( cfg().listeningInterface().length() )
interfaces.push_back( GNet::Address(cfg().listeningInterface(),cfg().port()) ) ;
smtp_server <<= new GSmtp::Server(
store ,
server_secrets ,
GSmtp::Verifier(cfg().verifier(),cfg().deliverToPostmaster(),cfg().rejectLocalMailboxes()) ,
GSmtp::Verifier(G::Executable(cfg().verifier()),cfg().deliverToPostmaster(),
cfg().rejectLocalMailboxes()) ,
smtpIdent() ,
cfg().allowRemoteClients() ,
cfg().port() ,
@ -269,20 +271,43 @@ void Main::Run::doServing( GSmtp::MessageStore & store , const GSmtp::Secrets &
if( cfg().doAdmin() )
{
GNet::Address address =
cfg().interface_().length() ?
GNet::Address(cfg().interface_(),cfg().adminPort()) :
GNet::Address listening_address =
cfg().listeningInterface().length() ?
GNet::Address(cfg().listeningInterface(),cfg().adminPort()) :
GNet::Address(cfg().adminPort()) ;
GNet::Address local_address =
cfg().clientInterface().length() ?
GNet::Address(cfg().clientInterface(),0U) :
GNet::Address(0U) ;
G::StringMap extra_commands_map ;
extra_commands_map.insert( std::make_pair(std::string("version"),versionNumber()) ) ;
extra_commands_map.insert( std::make_pair(std::string("warranty"),
Legal::warranty(std::string(),std::string(1U,'\n'))) ) ;
extra_commands_map.insert( std::make_pair(std::string("copyright"),Legal::copyright()) ) ;
m_admin_server <<= new GSmtp::AdminServer(
store ,
client_secrets ,
address ,
listening_address ,
cfg().allowRemoteClients() ,
local_address ,
cfg().serverAddress() ,
cfg().responseTimeout() ,
cfg().connectionTimeout() ,
extra_commands_map ,
cfg().withTerminate() ) ;
// undocumented forwards-compatibility feature, tcp://[<ip>[:<port>]][/<addressfile>], eg.
// "--admin tcp:///tmp/emailrelay_admin_address"
if( cfg().adminAddressFile() != G::Path() )
{
G::Root claim_root ;
std::ofstream address_file( cfg().adminAddressFile().str().c_str() ) ;
if( !address_file.good() ) throw G::Exception( "cannot create --admin address file" ) ;
address_file << m_admin_server->address().second.displayString() << std::endl ;
}
}
if( cfg().doPolling() )
@ -307,8 +332,11 @@ void Main::Run::doForwarding( GSmtp::MessageStore & store , const GSmtp::Secrets
GNet::EventLoop & event_loop )
{
const bool quit_on_disconnect = true ;
GSmtp::Client client( store , secrets , quit_on_disconnect ,
cfg().responseTimeout() ) ;
GNet::Address local_address = cfg().clientInterface().length() ?
GNet::Address(cfg().clientInterface(),0U ) : GNet::Address( 0U ) ;
GSmtp::Client client( store , secrets , local_address , quit_on_disconnect , cfg().responseTimeout() ) ;
client.doneSignal().connect( G::slot(*this,&Run::clientDone) ) ;
client.eventSignal().connect( G::slot(*this,&Run::clientEvent) ) ;
@ -347,8 +375,12 @@ std::string Main::Run::doPoll()
G_LOG( "Main::Run::doPoll: polling" ) ;
const bool quit_on_disconnect = false ;
m_client <<= new GSmtp::Client( *m_store.get() , *m_client_secrets.get() , quit_on_disconnect ,
cfg().responseTimeout() ) ;
GNet::Address local_address = cfg().clientInterface().length() ?
GNet::Address(cfg().clientInterface(),0U ) : GNet::Address( 0U ) ;
m_client <<= new GSmtp::Client( *m_store.get() , *m_client_secrets.get() ,
local_address , quit_on_disconnect , cfg().responseTimeout() ) ;
m_client->doneSignal().connect( G::slot(*this,&Run::clientDone) ) ;
m_client->eventSignal().connect( G::slot(*this,&Run::clientEvent) ) ;

View File

@ -48,6 +48,7 @@
#include "gfilestore.h"
#include "gnewmessage.h"
#include "gexception.h"
#include "gexe.h"
#include "legal.h"
#include <exception>
#include <iostream>
@ -81,13 +82,13 @@ static void process( const G::Path & path , std::istream & stream ,
// create the output file
//
GSmtp::FileStore store( path ) ;
GSmtp::FileStore store( path , G::Executable() , G::Executable() ) ;
std::auto_ptr<GSmtp::NewMessage> msg = store.newMessage( envelope_from ) ;
// add "To:" lines to the envelope
//
G::Path verifier_exe ;
GSmtp::Verifier verifier( verifier_exe , false , false ) ;
G::Executable no_exe ;
GSmtp::Verifier verifier( no_exe , false , false ) ;
for( G::Strings::const_iterator to_p = to_list.begin() ; to_p != to_list.end() ; ++to_p )
{
std::string to = *to_p ;

View File

@ -18,5 +18,5 @@
##
#
include mingw-common.mak
all: all_
clean: clean_
all: all_
clean:: clean_

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,74 +16,94 @@
#
#
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_VERSION = @COMPILER_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
@ -91,7 +111,22 @@ e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
EXTRA_DIST = \
gappinst.cpp \
@ -123,11 +158,12 @@ EXTRA_DIST = \
mingw.mak
subdir = src/win32
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DIST_COMMON = Makefile.am Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
all: all-am
.SUFFIXES:
@ -140,13 +176,22 @@ uninstall-info-am:
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
@ -171,7 +216,6 @@ check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -191,7 +235,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -201,7 +245,7 @@ clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
@ -223,13 +267,21 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic distclean \
@ -238,7 +290,8 @@ uninstall-am: uninstall-info-am
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic uninstall uninstall-am uninstall-info-am
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.