summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@debian.org>2020-05-21 00:21:15 -0700
committerManoj Srivastava <srivasta@debian.org>2020-05-21 00:21:15 -0700
commit7e53de81db247d68acf5b4f2f23f5a328fcf9feb (patch)
treed441ef6fa0f2f01fe374187f5a3ac54ce00f2b1a
parent8854039b09b822a2f859e8ff70b9659ea007abf9 (diff)
parent9a14a1512556db68543bfeebac2138ce1be0b0fd (diff)
Merge branch 'upstream'
-rw-r--r--.gitignore40
-rwxr-xr-xConfigure2119
-rw-r--r--MANIFEST4
-rw-r--r--U/End.U2
-rw-r--r--U/Myinit.U2
-rw-r--r--U/Specific.U33
-rw-r--r--U/mboxlock.U2
-rw-r--r--U/utmp.U2
-rwxr-xr-xagent/edusers.SH2
-rwxr-xr-xagent/files/help/addauth.SH2
-rwxr-xr-xagent/files/help/approve.SH2
-rwxr-xr-xagent/files/help/delpower.SH2
-rwxr-xr-xagent/files/help/end.SH2
-rwxr-xr-xagent/files/help/getauth.SH2
-rwxr-xr-xagent/files/help/help.SH2
-rwxr-xr-xagent/files/help/newpower.SH2
-rwxr-xr-xagent/files/help/passwd.SH2
-rwxr-xr-xagent/files/help/password.SH2
-rwxr-xr-xagent/files/help/power.SH2
-rwxr-xr-xagent/files/help/release.SH2
-rwxr-xr-xagent/files/help/remauth.SH2
-rwxr-xr-xagent/files/help/set.SH2
-rwxr-xr-xagent/files/help/setauth.SH2
-rwxr-xr-xagent/files/help/user.SH2
-rw-r--r--agent/files/mailagent.cf1
-rw-r--r--agent/filter/dup2.c2
-rw-r--r--agent/filter/environ.c2
-rw-r--r--agent/filter/environ.h2
-rw-r--r--agent/filter/getopt.c2
-rw-r--r--agent/filter/hash.c4
-rw-r--r--agent/filter/hash.h2
-rw-r--r--agent/filter/io.c2
-rw-r--r--agent/filter/io.h2
-rw-r--r--agent/filter/lock.c2
-rw-r--r--agent/filter/lock.h2
-rw-r--r--agent/filter/logfile.c3
-rw-r--r--agent/filter/logfile.h2
-rw-r--r--agent/filter/main.c2
-rw-r--r--agent/filter/misc.c2
-rw-r--r--agent/filter/msg.c2
-rw-r--r--agent/filter/msg.h2
-rw-r--r--agent/filter/parser.c2
-rw-r--r--agent/filter/parser.h2
-rw-r--r--agent/filter/portable.h2
-rw-r--r--agent/filter/sysexits.h2
-rw-r--r--agent/filter/user.c2
-rwxr-xr-xagent/maildist.SH2
-rwxr-xr-xagent/mailhelp.SH2
-rwxr-xr-xagent/maillist.SH2
-rwxr-xr-xagent/mailpatch.SH2
-rwxr-xr-xagent/man/mailagent.SH423
-rwxr-xr-xagent/man/mailhelp.SH50
-rwxr-xr-xagent/package.SH2
-rw-r--r--agent/pl/acs_rqst.pl2
-rw-r--r--agent/pl/actions.pl30
-rw-r--r--agent/pl/add_log.pl2
-rw-r--r--agent/pl/addr.pl2
-rw-r--r--agent/pl/analyze.pl2
-rw-r--r--agent/pl/base64.pl2
-rw-r--r--agent/pl/biff.pl225
-rw-r--r--agent/pl/builtins.pl2
-rw-r--r--agent/pl/callout.pl2
-rw-r--r--agent/pl/cdir.pl2
-rw-r--r--agent/pl/checklock.pl2
-rw-r--r--agent/pl/cmdserv.pl2
-rw-r--r--agent/pl/compress.pl2
-rw-r--r--agent/pl/context.pl2
-rw-r--r--agent/pl/dbr.pl2
-rw-r--r--agent/pl/distribs.pl2
-rw-r--r--agent/pl/dynload.pl2
-rw-r--r--agent/pl/emergency.pl2
-rw-r--r--agent/pl/eval.pl2
-rw-r--r--agent/pl/extern.pl2
-rw-r--r--agent/pl/fatal.pl2
-rw-r--r--agent/pl/file_edit.pl2
-rw-r--r--agent/pl/filter.pl2
-rw-r--r--agent/pl/forward.pl2
-rw-r--r--agent/pl/free_file.pl2
-rw-r--r--agent/pl/gensym.pl2
-rw-r--r--agent/pl/getdate.pl2
-rw-r--r--agent/pl/header.pl98
-rw-r--r--agent/pl/history.pl2
-rw-r--r--agent/pl/hook.pl2
-rw-r--r--agent/pl/hostname.pl2
-rw-r--r--agent/pl/include.pl2
-rw-r--r--agent/pl/install.pl2
-rw-r--r--agent/pl/interface.pl2
-rw-r--r--agent/pl/jobnum.pl2
-rw-r--r--agent/pl/lexical.pl3
-rw-r--r--agent/pl/listqueue.pl2
-rw-r--r--agent/pl/locate.pl2
-rw-r--r--agent/pl/macros.pl2
-rw-r--r--agent/pl/mailhook.pl2
-rw-r--r--agent/pl/makedir.pl2
-rw-r--r--agent/pl/matching.pl2
-rw-r--r--agent/pl/mbox.pl2
-rw-r--r--agent/pl/mh.pl2
-rw-r--r--agent/pl/mmdf.pl2
-rw-r--r--agent/pl/newcmd.pl2
-rw-r--r--agent/pl/once.pl2
-rw-r--r--agent/pl/options.pl2
-rw-r--r--agent/pl/package.pl2
-rw-r--r--agent/pl/parse.pl2
-rw-r--r--agent/pl/period.pl2
-rw-r--r--agent/pl/plsave.pl2
-rw-r--r--agent/pl/plural.pl2
-rw-r--r--agent/pl/power.pl2
-rw-r--r--agent/pl/pqueue.pl2
-rw-r--r--agent/pl/q.pl2
-rw-r--r--agent/pl/qp.pl2
-rw-r--r--agent/pl/queue_mail.pl2
-rw-r--r--agent/pl/rangeargs.pl2
-rw-r--r--agent/pl/read_conf.pl19
-rw-r--r--agent/pl/rfc822.pl2
-rw-r--r--agent/pl/rulenv.pl2
-rw-r--r--agent/pl/rules.pl4
-rw-r--r--agent/pl/runcmd.pl2
-rw-r--r--agent/pl/secure.pl30
-rw-r--r--agent/pl/sendfile.pl2
-rw-r--r--agent/pl/signals.pl2
-rw-r--r--agent/pl/stats.pl2
-rw-r--r--agent/pl/termios/termios_ph.c2
-rw-r--r--agent/pl/tilde.pl2
-rw-r--r--agent/pl/unpack.pl2
-rw-r--r--agent/pl/usrmac.pl2
-rw-r--r--agent/pl/utmp/utmp_ph.c2
-rwxr-xr-xagent/test/TEST3
-rw-r--r--agent/test/actions6
-rw-r--r--agent/test/cmd/biff.t39
-rw-r--r--agent/test/cmd/post.t21
-rw-r--r--agent/test/cmd/save.t20
-rw-r--r--agent/test/filter/base64.t2
-rw-r--r--agent/test/filter/qp.t2
-rw-r--r--agent/test/getopt.pl2
-rw-r--r--agent/test/mail-long20
-rw-r--r--agent/test/mime4
-rw-r--r--agent/test/mime-recursive47
-rw-r--r--agent/test/option/U.t2
-rw-r--r--agent/test/pl/cmd.pl2
-rw-r--r--agent/test/pl/filter.pl2
-rw-r--r--agent/test/pl/init.pl2
-rw-r--r--agent/test/pl/logfile.pl2
-rw-r--r--agent/test/pl/mail.pl2
-rw-r--r--agent/test/pl/misc.pl18
-rw-r--r--agent/test/pl/mta.pl2
-rwxr-xr-xbin/svn-revision8
-rwxr-xr-xconfig_h.SH8
-rw-r--r--confmagic.h2
-rwxr-xr-xinstall.SH2
-rw-r--r--misc/fakesend/fakesend.pl2
-rw-r--r--misc/news/ml.map2
-rw-r--r--misc/news/newsgate2
-rw-r--r--misc/pbounce/patbounce.pl2
-rw-r--r--misc/unkit/unkit.pl2
-rw-r--r--revision.h7
155 files changed, 2154 insertions, 1387 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9d5f783
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,40 @@
+.package
+.config/
+*.bak
+*.o
+*.1
+Makefile
+Wanted
+agent/edusers
+agent/files/help/addauth
+agent/files/help/approve
+agent/files/help/delpower
+agent/files/help/end
+agent/files/help/getauth
+agent/files/help/help
+agent/files/help/newpower
+agent/files/help/passwd
+agent/files/help/password
+agent/files/help/power
+agent/files/help/release
+agent/files/help/remauth
+agent/files/help/set
+agent/files/help/setauth
+agent/files/help/user
+agent/filter/filter
+agent/magent
+agent/mailagent
+agent/maildist
+agent/mailhelp
+agent/maillist
+agent/mailpatch
+agent/package
+agent/pl/termios/termios.pl
+agent/pl/termios/termios_ph
+agent/pl/utmp/utmp.pl
+agent/pl/utmp/utmp_ph
+config.h
+config.sh
+install
+mkdep
+revision.h
diff --git a/Configure b/Configure
index 5bf2b97..9c0e851 100755
--- a/Configure
+++ b/Configure
@@ -13,12 +13,12 @@
#
# Note: this Configure script was generated automatically. Rather than
# working with this copy of Configure, you may wish to get metaconfig.
-# The dist package (which contains metaconfig) is available via SVN:
-# svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
+# The dist package (which contains metaconfig) is available via git:
+# git clone git@github.com:rmanfredi/dist.git
-# $Id: Head.U 25 2008-05-28 11:19:25Z rmanfredi $
+# $Id$
#
-# Generated on Wed Jun 25 19:17:28 CEST 2008 [metaconfig 3.5-25]
+# Generated on Tue Jun 5 15:27:29 CEST 2018 [metaconfig 3.5-241]
cat >c1$$ <<EOF
ARGGGHHHH!!!!!
@@ -63,7 +63,7 @@ if test -d c:/. ; then
OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
elif test -n "$DJGPP"; then
case "X${MACHTYPE:-nonesuchmach}" in
- *cygwin) ;;
+ *cygwin|*msys) ;;
*) p_=\; ;;
esac
fi
@@ -177,6 +177,7 @@ d_dos=''
d_eunice=''
d_linux=''
d_os2=''
+d_windows=''
d_xenix=''
_exe=''
eunicefix=''
@@ -202,7 +203,9 @@ emacs=''
expr=''
find=''
flex=''
+gcc=''
gmake=''
+gmsgfmt=''
grep=''
gzip=''
inews=''
@@ -219,7 +222,10 @@ mailx=''
make=''
mkdir=''
more=''
+msgfmt=''
+msgmerge=''
mv=''
+nawk=''
nm=''
nroff=''
perl=''
@@ -247,8 +253,12 @@ uname=''
uniq=''
uuname=''
vi=''
+wc=''
+xgettext=''
zcat=''
zip=''
+incpath=''
+mips_type=''
libswanted=''
hint=''
myuname=''
@@ -268,6 +278,7 @@ _a=''
_o=''
archobjs=''
firstmakefile=''
+rm_try=''
afs=''
afsroot=''
baserev=''
@@ -281,6 +292,7 @@ ldflags=''
lkflags=''
locincpth=''
optimize=''
+pthread=''
cf_email=''
cf_by=''
cf_time=''
@@ -332,6 +344,8 @@ d_voidsig=''
signal_t=''
d_wifstat=''
defeditor=''
+cppfilter=''
+fieldn=''
gccosandvers=''
gccversion=''
h_fcntl=''
@@ -460,8 +474,6 @@ nm_opt=''
nm_so_opt=''
runnm=''
usenm=''
-incpath=''
-mips_type=''
usrinc=''
utmp=''
defvoidused=''
@@ -507,8 +519,7 @@ ccversion=''
archobjs=''
: Possible local include directories to search.
: Set locincpth to "" in a hint file to defeat local include searches.
-locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
+locincpth=""
:
: no include file wanted by default
inclwanted=''
@@ -519,15 +530,14 @@ libnames=''
: change the next line if compiling for Xenix/286 on Xenix/386
xlibpth='/usr/lib/386 /lib/386'
: Possible local library directories to search.
-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
+loclibpth=""
: general looking path for locating libraries
glibpth="/lib /usr/lib $xlibpth"
glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
test -f /shlib/libc.so && glibpth="/shlib $glibpth"
-
+glibpth="$glibpth /lib32 /lib64 "`ls -1d /usr/lib/*-gnu 2>/dev/null`
: Private path used by Configure to find libraries. Its value
: is prepended to libpth. This variable takes care of special
: machines, like the mips. Usually, it should be empty.
@@ -566,10 +576,10 @@ case "$sh" in
sh="$xxx"
break
elif test -f "$xxx$_exe"; then
- sh="$xxx"
+ sh="$xxx$_exe"
break
elif test -f "$xxx.exe"; then
- sh="$xxx"
+ sh="$xxx.exe"
break
fi
done
@@ -852,7 +862,7 @@ while test $# -gt 0; do
esac
shift
;;
- -V) echo "$me generated by metaconfig 3.5-25." >&2
+ -V) echo "$me generated by metaconfig 3.5-241." >&2
exit 0;;
--) break;;
-*) echo "$me: unknown option $1" >&2; shift; error=true;;
@@ -918,8 +928,13 @@ case "$silent" in
true) exec 1>/dev/null;;
esac
-: run the defines and the undefines, if any, but leave the file out there...
touch optdef.sh
+if grep -q '\\' optdef.sh >/dev/null 2>&1; then
+ echo "Configure does not support \\ in -D or -U arguments" >&2
+ exit 1
+fi
+
+: run the defines and the undefines, if any, but leave the file out there...
. ./optdef.sh
: create the posthint manipulation script and leave the file out there...
touch posthint.sh
@@ -980,10 +995,14 @@ esac
: Find the path to the source tree
case "$src" in
'') case "$0" in
- */*)
- src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
- ;;
- *) src='.';;
+ */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
+ case "$src" in
+ /*) ;;
+ .) ;;
+ *) src=`cd ../$src && pwd` ;;
+ esac
+ ;;
+ *) src='.';;
esac;;
esac
case "$src" in
@@ -1029,6 +1048,7 @@ esac
cat >extract <<EOS
CONFIG=true
SRC="$src"
+TOP=`cd ..; pwd 2>/dev/null`
EOS
cat >>extract <<'EOS'
echo "Doing variable substitutions on .SH files..."
@@ -1175,7 +1195,6 @@ fi
rm -f missing x??
: Find the appropriate value for a newline for tr
-echo " "
if test -n "$DJGPP"; then
trnl='\012'
fi
@@ -1201,8 +1220,6 @@ $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
EOM
exit 1
-else
- echo "We'll use '$trnl' to transliterate a newline."
fi
: compute the number of columns on the terminal for proper question formatting
@@ -1480,6 +1497,7 @@ cp
echo
expr
grep
+make
mkdir
mv
rm
@@ -1499,7 +1517,6 @@ inews
line
ln
mail
-make
nm
nroff
perl
@@ -1509,10 +1526,11 @@ smail
test
uname
vi
+wc
zcat
"
pth=`echo $PATH | sed -e "s/$p_/ /g"`
-pth="$pth /lib /usr/lib"
+pth="$pth /sbin /usr/sbin /lib /usr/lib /etc"
for file in $loclist; do
eval xxx=\$$file
case "$xxx" in
@@ -1520,14 +1538,14 @@ for file in $loclist; do
if test -f "$xxx"; then
: ok
else
- ./warn "no $xxx -- ignoring your setting for $file."
+ ./warn "no $xxx -- ignoring your setting for $file." 4>&4
xxx=`./loc $file $file $pth`
fi
;;
'') xxx=`./loc $file $file $pth`;;
*) xxx=`./loc $xxx $xxx $pth`;;
esac
- eval $file=$xxx$_exe
+ eval $file=$xxx
eval _$file=$xxx
case "$xxx" in
/*)
@@ -1538,7 +1556,7 @@ for file in $loclist; do
;;
*)
echo "I don't know where '$file' is, and my life depends on it." >&4
- echo "Go find a public domain implementation or fix your PATH setting!" >&4
+ echo "Go find a public domain implementation or fix your PATH!" >&4
exit 1
;;
esac
@@ -1553,14 +1571,14 @@ for file in $trylist; do
if test -f "$xxx"; then
: ok
else
- ./warn "no $xxx -- ignoring your setting for $file."
+ ./warn "no $xxx -- ignoring your setting for $file." 4>&4
xxx=`./loc $file $file $pth`
fi
;;
'') xxx=`./loc $file $file $pth`;;
*) xxx=`./loc $xxx $xxx $pth`;;
esac
- eval $file=$xxx$_exe
+ eval $file=$xxx
eval _$file=$xxx
case "$xxx" in
/*)
@@ -1576,21 +1594,21 @@ for file in $trylist; do
esac
done
case "$egrep" in
-egrep)
+egrep$_exe|egrep)
echo "Substituting grep for egrep."
egrep=$grep
_egrep=$_grep
;;
esac
case "$ln" in
-ln)
+ln$_exe|ln)
echo "Substituting cp for ln."
ln=$cp
_ln=$_cp
;;
esac
case "$make" in
-make)
+make$_exe|make)
case "$gmake" in
gmake)
echo "I can't find make or gmake, and my life depends on it." >&4
@@ -1601,11 +1619,10 @@ make)
;;
esac
case "$gmake" in
-gmake) ;;
-*) # We can't have osname yet.
- if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
- # Assume that gmake, if found, is definitely GNU make
- # and prefer it over the system make.
+gmake$_exe|gmake) ;;
+*)
+ if test -f "/system/gnu_library/bin/ar.pm"; then
+ : Stratus VOS
echo "Substituting gmake for make."
make=$gmake
_make=$_gmake
@@ -1613,8 +1630,9 @@ gmake) ;;
;;
esac
case "$test" in
-test)
+test|test$_exe)
echo "Hopefully test is built into your sh."
+ test=test
;;
*)
if `sh -c "PATH= test true" >/dev/null 2>&1`; then
@@ -1625,13 +1643,14 @@ test)
;;
esac
case "$echo" in
-echo)
+echo|echo$_exe)
echo "Hopefully echo is built into your sh."
+ echo=echo
;;
'') ;;
*)
echo " "
-echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
+echo "Checking compatibility between $_echo and builtin echo (if any)..." >&4
$echo $n "hi there$c" >foo1
echo $n "hi there$c" >foo2
if cmp foo1 foo2 >/dev/null 2>&1; then
@@ -1702,7 +1721,7 @@ EOM
[yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
$cat *.cbu >checktmp 2>/dev/null
if $contains ccflags checktmp >/dev/null; then
- ./warn <<EOM
+ ./warn 4>&4 <<EOM
Any previous setting of the C compiler flags has been lost.
It may be necessary to pass -Dcc=gcc to Configure right away.
EOM
@@ -1752,8 +1771,8 @@ EOSC
: determine whether symbolic links are supported
echo " "
+$rm -f blurfl sym
$touch blurfl
-$rm -f sym
if $ln -s blurfl sym > /dev/null 2>&1 && $test -f sym; then
echo "Symbolic links are supported." >&4
lns="$ln -s"
@@ -1801,7 +1820,7 @@ case "$lns" in
;;
*) issymlink='' ;;
esac
- fi
+ fi
fi
if $test "X$issymlink" = X; then
if $test -L sym 2>/dev/null; then
@@ -1978,7 +1997,8 @@ $test -z "$myuname" && myuname=`hostname 2>/dev/null`
myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
newmyuname="$myuname"
-$test -f "$uname$_exe" && has_uname=y
+has_uname=
+$test -f "$uname" && has_uname=y
: Guessing of the OS name -- half the following guesses are probably wrong...
: If you have better tests or hints, please send them to the metaconfig
@@ -2039,7 +2059,8 @@ if $test "X$has_uname" != X; then
osvers=4
elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
osvers=3
- elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
+ elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1
+ then
osvers=2
fi
fi
@@ -2067,7 +2088,10 @@ if $test "X$has_uname" != X; then
osvers=`$uname -r`
;;
cygwin*) osname=cygwin
- osvers="$3"
+ osvers=`echo "$3" | sed -e 's/\(.*\)(.*/\1/'`
+ ;;
+ mingw*) osname=mingw
+ osvers=`echo "$3" | sed -e 's/\(.*\)(.*/\1/'`
;;
*dc.osx) osname=dcosx
osvers="$3"
@@ -2263,6 +2287,13 @@ case "$knowitall" in
*) dflt=y;;
esac
+saved_osname="$osname"
+saved_osvers="$osvers"
+saved_libswanted="$libswanted"
+tmp_n="$n"
+tmp_c="$c"
+tmp_sh="$sh"
+
: Get old answers from config file if it was generated on the same system
hint=default
if $test -f ../config.sh; then
@@ -2275,14 +2306,19 @@ if $test -f ../config.sh; then
myuname="$newmyuname"
;;
*) echo "Fetching default answers from your old config.sh file..." >&4
- tmp_n="$n"
- tmp_c="$c"
- tmp_sh="$sh"
. ../config.sh
cp ../config.sh .
- n="$tmp_n"
- c="$tmp_c"
hint=previous
+ case "$dflt" in
+ n)
+ echo " "
+ rp="Do you want further invocations to use these defaults?"
+ . ./myread
+ case "$ans" in
+ y*|Y*) myuname="$newmyuname";;
+ esac
+ ;;
+ esac
;;
esac
fi
@@ -2290,17 +2326,12 @@ fi
*)
echo " "
echo "Fetching default answers from $config_sh..." >&4
- tmp_n="$n"
- tmp_c="$c"
- tmp_sh="$sh"
cd ..
cp $config_sh config.sh 2>/dev/null
chmod +w config.sh
. ./config.sh
cd UU
cp ../config.sh .
- n="$tmp_n"
- c="$tmp_c"
hint=previous
;;
esac
@@ -2314,6 +2345,17 @@ for file in $loclist $trylist; do
eval $file="\$_$file"
done
+osname="$saved_osname"
+osvers="$saved_osvers"
+n="$tmp_n"
+c="$tmp_c"
+
+case "$libswanted" in
+"$saved_libswanted") ;;
+*) libs='';;
+esac
+libswanted="$saved_libswanted"
+
. ./checkcc
case "$targetarch" in
'') ;;
@@ -2374,12 +2416,15 @@ esac
: who configured the system
cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
-cf_by=`(logname) 2>/dev/null`
case "$cf_by" in
"")
- cf_by=`(whoami) 2>/dev/null`
+ cf_by=`(logname) 2>/dev/null`
case "$cf_by" in
- "") cf_by=unknown ;;
+ "")
+ cf_by=`(whoami) 2>/dev/null`
+ case "$cf_by" in
+ "") cf_by=unknown ;;
+ esac ;;
esac ;;
esac
@@ -2414,10 +2459,10 @@ cat >filexp <<EOSS
$startsh
: expand filename
case "\$1" in
- ~/*|~)
+ \~/*|\~)
echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
;;
- ~*)
+ \~*)
if $test -f /bin/csh; then
/bin/csh -f -c "glob \$1"
failed=\$?
@@ -2571,6 +2616,7 @@ while test "$type"; do
case "$ansexp" in
/*) value="$ansexp" ;;
[a-zA-Z]:/*) value="$ansexp" ;;
+ [a-zA-Z]:\\*) value="$ansexp" ;;
*)
redo=true
case "$already" in
@@ -3053,10 +3099,12 @@ echo exit 1 >os2
echo exit 1 >gnu
echo exit 1 >linux
echo exit 1 >dos
+echo exit 1 >windows
d_bsd="$undef"
d_linux="$undef"
d_dos="$undef"
d_os2="$undef"
+d_windows="$undef"
$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
then
@@ -3111,6 +3159,18 @@ EOI
d_eunice="$undef"
;;
esac
+if test -d c:/.; then
+ case "X${MACHTYPE:-nonesuchmach}" in
+ *cygwin) echo " "; echo "Hah!... you're running under Cygwin!";;
+ *msys) echo " "; echo "Hah!... you're running under MinGW!";;
+ esac
+ case "X${MACHTYPE:-nonesuchmach}" in
+ *cygwin|*msys)
+ echo exit 0 >windows
+ d_windows="$define"
+ ;;
+ esac
+fi
case "$p_" in
:) ;;
*)
@@ -3118,10 +3178,6 @@ case "$p_" in
I have the feeling something is not exactly right, however...don't tell me...
EOI
if test -n "$DJGPP"; then
- case "X${MACHTYPE:-nonesuchmach}" in
- cygwin) echo "hah!... you're running under Cygwin!";;
- *) echo "got it... you're running DOS with DJGPP!";;
- esac
echo exit 0 >dos
d_dos="$define"
else
@@ -3155,28 +3211,30 @@ else
echo "Nor is it Venix..."
fi
fi
-chmod +x bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux
-$eunicefix bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux
+chmod +x bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux windows
+$eunicefix bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux windows
$rm -f foo
: Check whether they have gcc in any guise.
echo " "
echo "Checking for GNU cc in disguise and/or its version number..." >&4
$cat >try.c <<EOM
-#include <stdio.h>
-int main() {
+int main(void) {
#ifdef __GNUC__
-#ifdef __VERSION__
- printf("%s\n", __VERSION__);
-#else
- printf("%s\n", "1");
+gcc_version_major __GNUC__
+#ifdef __GNUC_MINOR__
+gcc_version_minor __GNUC__
+#endif
+#ifdef __GNUC_PATCHLEVEL__
+gcc_version_patchlevel __GNUC_PATCHLEVEL__
#endif
#endif
- exit(0);
}
EOM
-if $cc -o try $ccflags $ldflags try.c >/dev/null 2>&1; then
- gccversion=`$run ./try`
+if $cc -E try.c > try 2>&1
+then
+ gccversion=`$grep gcc_version_major try |
+ sed 's/^.*gcc_version_major[\t ]*//'`
case "$gccversion" in
'') echo "You are not using GNU cc." ;;
*) echo "You are using GNU cc $gccversion."
@@ -3184,15 +3242,7 @@ if $cc -o try $ccflags $ldflags try.c >/dev/null 2>&1; then
;;
esac
else
- echo " "
- echo "*** WHOA THERE!!! ***" >&4
- echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
- case "$knowitall" in
- '')
- echo " You'd better start hunting for one and let me know about it." >&4
- exit 1
- ;;
- esac
+ gccversion=''
fi
$rm -f try try.*
case "$gccversion" in
@@ -3249,7 +3299,6 @@ esac
: What should the include directory be ?
echo " "
$echo $n "Hmm... $c"
-dflt='/usr/include'
incpath=''
mips_type=''
if $test -f /bin/mips && /bin/mips; then
@@ -3268,29 +3317,36 @@ EOCP
fi
$rm -f usr.c usr.out
echo "and you're compiling with the $mips_type compiler and libraries."
- xxx_prompt=y
echo "exit 0" >mips
else
echo "Doesn't look like a MIPS system."
- xxx_prompt=n
echo "exit 1" >mips
fi
chmod +x mips
$eunicefix mips
+
+: What should the include directory be ?
+echo " "
+dflt='/usr/include'
case "$usrinc" in
-'') ;;
+'') dflt="$incpath/usr/include";;
*) dflt="$usrinc";;
esac
-case "$xxx_prompt" in
-y) fn=d/
- echo " "
- rp='Where are the include files you want to use?'
- . ./getfile
- usrinc="$ans"
- ;;
-*) usrinc="$dflt"
- ;;
+fn=d/
+rp='Where are the include files you want to use?'
+. ./getfile
+usrinc="$ans"
+
+: Define several unixisms.
+: Hints files or command line option can be used to override them.
+case "$_a" in
+'') _a='.a';;
esac
+case "$_o" in
+'') _o='.o';;
+esac
+
+rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
: see how we invoke the C preprocessor
echo " "
@@ -3527,6 +3583,7 @@ case "$optimize" in
'none') optimize=" ";;
esac
+
dflt=''
: We will not override a previous value, but we might want to
: augment a hint file
@@ -3586,7 +3643,7 @@ else
fi
case "$hint" in
-default|recommended) dflt="$ccflags $dflt" ;;
+default|recommended) dflt="$dflt $ccflags" ;;
*) dflt="$ccflags";;
esac
@@ -3720,7 +3777,7 @@ rmlist="$rmlist pdp11"
: coherency check
echo " "
echo "Checking your choice of C compiler and flags for coherency..." >&4
-set X $cc $optimize $ccflags $ldflags -o try try.c
+set X $cc $optimize $pthread $ccflags $ldflags -o try try.c
shift
$cat >try.msg <<EOM
I've tried to compile and run a simple program with:
@@ -3732,8 +3789,7 @@ and I got the following output:
EOM
$cat > try.c <<'EOF'
-#include <stdio.h>
-int main() { exit(0); }
+int main() { return 0; }
EOF
dflt=y
if sh -c "$cc $optimize $ccflags $ldflags -o try try.c" >>try.msg 2>&1; then
@@ -3769,7 +3825,7 @@ y)
;;
n) echo "OK, that should do.";;
esac
-$rm -f try try.* core
+$rm_try
: Initialize h_fcntl
h_fcntl=false
@@ -3777,6 +3833,713 @@ h_fcntl=false
: Initialize h_sysfile
h_sysfile=false
+: set up the script used to warn in case of inconsistency
+cat <<EOS >whoa
+$startsh
+EOS
+cat <<'EOSC' >>whoa
+dflt=y
+echo " "
+echo "*** WHOA THERE!!! ***" >&4
+echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
+rp=" Keep the $hint value?"
+. ./myread
+case "$ans" in
+y) td=$was; tu=$was;;
+esac
+EOSC
+
+: function used to set '$1' to '$val'
+setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
+case "$val$was" in
+$define$undef) . ./whoa; eval "$var=\$td";;
+$undef$define) . ./whoa; eval "$var=\$tu";;
+*) eval "$var=$val";;
+esac'
+
+: see whether the try.c file compiles and links
+trylink='
+var=$1;
+shift;
+val=$undef;
+file=trylink.log;
+nparams=$#;
+case "$cyn" in
+"") msg="";;
+*" "*) msg="$cyn"; yes=yes; no=no;;
+*)
+ case "$var" in
+ d_*) msg="for $cyn()"; yes=found; no=missing;;
+ i_*) msg="for <$cyn>"; yes=found; no=missing;;
+ *) msg="$cyn"; yes=yes; no=no;;
+ esac
+ ;;
+esac;
+case "$cyn" in
+"") echo "--- $var ---" >> "$file";;
+*)
+ echo " "; $echo $n "Checking $msg...$c" >&4;
+ echo "--- $var --- ($msg)" >>"$file"
+ ;;
+esac;
+$cat try.c >> "$file";
+while :; do
+ $rm -f try$_exe;
+ if $cc $ccflags -o try try.c $ldflags $1 >> "$file" 2>&1; then
+ case "$nparams" in 0) ;; *) echo "==> OK with \"$1\"" >> "$file";; esac;
+ val=$define;
+ break;
+ fi;
+ if $test $# -lt 1; then
+ break;
+ fi;
+ echo "==> FAILED with \"$1\"" >> "$file";
+ shift;
+done;
+$rm -rf try try.*;
+echo "==> $var=$val" >> "$file";
+case "$cyn" in
+"") ;;
+*)
+ case "$val" in
+ "$define") echo " $yes." >&4;;
+ *) echo " $no." >&4;;
+ esac
+ ;;
+esac;
+set $var; eval $setvar;
+cyn=""
+'
+
+: determine filename position in cpp output
+echo " "
+echo "Computing filename position in cpp output for #include directives..." >&4
+echo '#include <stdio.h>' > foo.c
+case "$osname" in
+vos)
+ testaccess=-e
+ cppfilter="tr '\\\\>' '/' |"
+ ;;
+*)
+ testaccess=-r
+ cppfilter=''
+ ;;
+esac
+$cat >fieldn <<EOF
+$startsh
+$cppstdin $cppminus <foo.c 2>/dev/null | \
+$grep '^[ ]*#.*stdio\.h' | \
+while read cline; do
+ pos=1
+ set \$cline
+ while $test \$# -gt 0; do
+ if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
+ echo "\$pos"
+ exit 0
+ fi
+ shift
+ pos=\`expr \$pos + 1\`
+ done
+done
+EOF
+chmod +x fieldn
+fieldn=`./fieldn`
+$rm -f foo.c fieldn
+case $fieldn in
+'') pos='???';;
+1) pos=first;;
+2) pos=second;;
+3) pos=third;;
+*) pos="${fieldn}th";;
+esac
+echo "Your cpp writes the filename in the $pos field of the line."
+
+: locate header file
+$cat >findhdr <<EOF
+$startsh
+wanted=\$1
+name=''
+for usrincdir in $usrinc; do
+ if test -f \$usrincdir/\$wanted; then
+ echo "\$usrincdir/\$wanted"
+ exit 0
+ fi
+done
+awkprg='{ print \$$fieldn }'
+echo "#include <\$wanted>" > foo\$\$.c
+$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
+$cppfilter $grep "^[ ]*#.*\$wanted" | \
+while read cline; do
+ name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
+ case "\$name" in
+ *[/\\\\]\$wanted) echo "\$name"; exit 1;;
+ *[\\\\/]\$wanted) echo "\$name"; exit 1;;
+ *) exit 2;;
+ esac
+done
+status=\$?
+$rm -f foo\$\$.c
+if test \$status -eq 1; then
+ exit 0
+fi
+exit 1
+EOF
+chmod +x findhdr
+$eunicefix findhdr
+
+: define an alternate in-header-list? function
+inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
+cont=true; xxf="echo \"<\$1> found.\" >&4";
+case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
+*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
+esac;
+case $# in 4) instead=instead;; *) instead="at last";; esac;
+while $test "$cont"; do
+ xxx=`./findhdr $1`
+ var=$2; eval "was=\$$2";
+ if $test "$xxx" && $test -r "$xxx";
+ then eval $xxf;
+ eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
+ cont="";
+ else eval $xxnf;
+ eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
+ set $yyy; shift; shift; yyy=$@;
+ case $# in 0) cont="";;
+ 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
+ xxnf="echo \"and I did not find <\$1> either.\" >&4";;
+ *) xxf="echo \"but I found <\$1\> instead.\" >&4";
+ xxnf="echo \"there is no <\$1>, ...\" >&4";;
+ esac;
+done;
+while $test "$yyy";
+do set $yyy; var=$2; eval "was=\$$2";
+ eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
+ set $yyy; shift; shift; yyy=$@;
+done'
+
+: see if this is a unistd.h system
+set unistd.h i_unistd
+eval $inhdr
+
+: access call always available on UNIX
+$cat >try.c <<EOC
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+int main(void)
+{
+ static int ret;
+ ret |= access("path", 1);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=access
+set d_access
+eval $trylink
+
+: locate the flags for 'access()'
+case "$d_access" in
+"$define")
+ echo " "
+ $cat >access.c <<'EOCP'
+#include <sys/types.h>
+#ifdef I_FCNTL
+#include <fcntl.h>
+#endif
+#ifdef I_SYS_FILE
+#include <sys/file.h>
+#endif
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+int main(void) {
+ static int mode;
+ mode |= R_OK;
+ mode |= W_OK;
+ mode |= X_OK;
+ mode |= F_OK;
+ return mode ? 0 : 1;
+}
+EOCP
+ : check sys/file.h first, no particular reason here
+ if $test `./findhdr sys/file.h` && \
+ $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
+ h_sysfile=true;
+ echo "<sys/file.h> defines the *_OK access constants." >&4
+ elif $test `./findhdr fcntl.h` && \
+ $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
+ h_fcntl=true;
+ echo "<fcntl.h> defines the *_OK access constants." >&4
+ elif $test `./findhdr unistd.h` && \
+ $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
+ echo "<unistd.h> defines the *_OK access constants." >&4
+ else
+ echo "I can't find the four *_OK access constants--I'll use mine." >&4
+ fi
+ ;;
+esac
+$rm -f access*
+
+: see if bcopy exists
+$cat >try.c <<EOC
+#include <strings.h>
+static void
+init_data(char *a, unsigned len)
+{
+ unsigned i;
+ for (i = 0; i < len; i++)
+ a[i] = i * 2 + 1;
+}
+static void
+recopy_data(char *src, char *dst, unsigned len)
+{
+ bcopy(&src[3], &dst[0], len - 3);
+}
+int main(void)
+{
+ static char src[20], dst[20];
+ init_data(src, sizeof src);
+ recopy_data(src, dst, sizeof src);
+ return dst[0] + dst[1];
+}
+EOC
+cyn=bcopy
+set d_bcopy
+eval $trylink
+
+: see if setpgrp exists
+$cat >try.c <<EOC
+#include <sys/types.h>
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+int main(void)
+{
+ static pid_t ret, pid, pgrp;
+ ret |= setpgrp(pid, pgrp);
+ return ret ? 0 : 1;
+}
+EOC
+cyn="whether you have the BSD flavour of setpgrp()"
+set d_bsdsetpgrp
+eval $trylink
+
+case "$d_bsdsetpgrp" in
+$define)
+ val="$define"
+ set d_setpgrp
+ eval $setvar
+ ;;
+*)
+ $cat >try.c <<EOC
+#include <sys/types.h>
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+int main(void)
+{
+ static pid_t ret;
+ ret |= setpgrp();
+ if (ret)
+ return 1;
+ return 0;
+}
+EOC
+ cyn="whether you have the USG flavour of setpgrp() then"
+ set d_setpgrp
+ eval $trylink
+ ;;
+esac
+
+: see if dup2 exists
+$cat >try.c <<EOC
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+int main(void)
+{
+ static int fd1, fd2, ret;
+ ret |= dup2(fd1, fd2);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=dup2
+set d_dup2
+eval $trylink
+
+: see if this is an fcntl system
+$cat >try.c <<EOC
+#include <sys/types.h>
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+int main(void)
+{
+ static int fd, ret;
+ ret |= fcntl(fd, F_DUPFD, 1);
+ ret |= fcntl(fd, F_GETFD);
+ ret |= fcntl(fd, F_GETFL);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=fcntl
+set d_fcntl
+eval $trylink
+
+: see if we can have long filenames
+echo " "
+tmpdir="${TMPDIR:-/tmp}"
+rmlist="$rmlist $tmpdir/cf$$"
+$test -d "$tmpdir/cf$$" || mkdir "$tmpdir/cf$$"
+first=123456789abcdef
+second="$tmpdir/cf$$/$first"
+$rm -f $first $second
+if (echo hi >$first) 2>/dev/null; then
+ if $test -f 123456789abcde; then
+ echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
+ val="$undef"
+ else
+ if (echo hi >$second) 2>/dev/null; then
+ if $test -f "$tmpdir/cf$$/123456789abcde"; then
+ $cat <<'EOM'
+That's peculiar... You can have filenames longer than 14 characters, but only
+on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
+I shall consider your system cannot support long filenames at all.
+EOM
+ val="$undef"
+ else
+ echo 'You can have filenames longer than 14 characters.' >&4
+ val="$define"
+ fi
+ else
+ $cat <<'EOM'
+How confusing! Some of your filesystems are sane enough to allow filenames
+longer than 14 characters but some others like /tmp can't even think about them.
+So, for now on, I shall assume your kernel does not allow them at all.
+EOM
+ val="$undef"
+ fi
+ fi
+else
+ $cat <<'EOM'
+You can't have filenames longer than 14 chars. You can't even think about them!
+EOM
+ val="$undef"
+fi
+set d_flexfnam
+eval $setvar
+$rm -rf "$tmpdir/cf$$" 123456789abcde*
+
+: see if we have to deal with yellow pages, now NIS.
+if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
+ if $test -f /usr/etc/nibindd; then
+ echo " "
+ echo "I'm fairly confident you're on a NeXT."
+ echo " "
+ rp='Do you get the passwd file via NetInfo?'
+ dflt=y
+ case "$passcat" in
+ nidump*) ;;
+ '') ;;
+ *) dflt=n;;
+ esac
+ . ./myread
+ case "$ans" in
+ y*) passcat='nidump passwd .'
+ ;;
+ *) echo "You told me, so don't blame me."
+ case "$passcat" in
+ nidump*) passcat=''
+ esac
+ ;;
+ esac
+ echo " "
+ rp='Do you get the hosts file via NetInfo?'
+ dflt=y
+ case "$hostcat" in
+ nidump*) ;;
+ '') ;;
+ *) dflt=n;;
+ esac
+ . ./myread
+ case "$ans" in
+ y*) hostcat='nidump hosts .';;
+ *) case "$hostcat" in
+ nidump*) hostcat='';;
+ esac
+ ;;
+ esac
+ fi
+ case "$passcat" in
+ nidump*) ;;
+ *)
+ case "$passcat" in
+ *ypcat*) dflt=y;;
+ '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
+ dflt=y
+ else
+ dflt=n
+ fi;;
+ *) dflt=n;;
+ esac
+ echo " "
+ rp='Are you getting the passwd file via yellow pages?'
+ . ./myread
+ case "$ans" in
+ y*) passcat='ypcat passwd'
+ ;;
+ *) passcat='cat /etc/passwd'
+ ;;
+ esac
+ ;;
+ esac
+ case "$hostcat" in
+ nidump*) ;;
+ *)
+ case "$hostcat" in
+ *ypcat*) dflt=y;;
+ '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
+ dflt=y
+ else
+ dflt=n
+ fi;;
+ *) dflt=n;;
+ esac
+ echo " "
+ rp='Are you getting the hosts file via yellow pages?'
+ . ./myread
+ case "$ans" in
+ y*) hostcat='ypcat hosts';;
+ *) hostcat='cat /etc/hosts';;
+ esac
+ ;;
+ esac
+fi
+case "$hostcat" in
+'') hostcat=':'
+ $test -f /etc/hosts && hostcat='cat /etc/hosts';;
+esac
+case "$groupcat" in
+'') groupcat=':'
+ $test -f /etc/group && groupcat='cat /etc/group';;
+esac
+case "$passcat" in
+'') passcat=':'
+ $test -f /etc/passwd && passcat='cat /etc/passwd';;
+esac
+
+: now get the host name
+echo " "
+echo "Figuring out host name..." >&4
+case "$myhostname" in
+'') cont=true
+ echo 'Maybe "hostname" will work...'
+ if tans=`sh -c hostname 2>&1` ; then
+ myhostname=$tans
+ phostname=hostname
+ cont=''
+ fi
+ ;;
+*) cont='';;
+esac
+if $test "$cont"; then
+ if ./xenix; then
+ echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
+ if tans=`cat /etc/systemid 2>&1` ; then
+ myhostname=$tans
+ phostname='cat /etc/systemid'
+ echo "Whadyaknow. Xenix always was a bit strange..."
+ cont=''
+ fi
+ elif $test -r /etc/systemid; then
+ echo "(What is a non-Xenix system doing with /etc/systemid?)"
+ fi
+fi
+if $test "$cont"; then
+ echo 'No, maybe "uuname -l" will work...'
+ if tans=`sh -c 'uuname -l' 2>&1` ; then
+ myhostname=$tans
+ phostname='uuname -l'
+ else
+ echo 'Strange. Maybe "uname -n" will work...'
+ if tans=`sh -c 'uname -n' 2>&1` ; then
+ myhostname=$tans
+ phostname='uname -n'
+ else
+ echo 'Oh well, maybe I can mine it out of whoami.h...'
+ if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
+ myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
+ phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
+ else
+ case "$myhostname" in
+ '') echo "Does this machine have an identity crisis or something?"
+ phostname='';;
+ *)
+ echo "Well, you said $myhostname before..."
+ phostname='echo $myhostname';;
+ esac
+ fi
+ fi
+ fi
+fi
+case "$myhostname" in
+'') myhostname=noname ;;
+esac
+: you do not want to know about this
+set $myhostname
+myhostname=$1
+
+: verify guess
+if $test "$myhostname" ; then
+ dflt=y
+ rp='Your host name appears to be "'$myhostname'".'" Right?"
+ . ./myread
+ case "$ans" in
+ y*) ;;
+ *) myhostname='';;
+ esac
+fi
+
+: bad guess or no guess
+while $test "X$myhostname" = X ; do
+ dflt=''
+ rp="Please type the (one word) name of your host:"
+ . ./myread
+ myhostname="$ans"
+done
+
+: translate upper to lower if necessary
+case "$myhostname" in
+*[A-Z]*)
+ echo "(Normalizing case in your host name)"
+ myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
+ ;;
+esac
+
+case "$myhostname" in
+*.*)
+ dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
+ myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
+ echo "(Trimming domain name from host name--host name is now $myhostname)"
+ ;;
+*) case "$mydomain" in
+ '')
+ {
+ test "X$hostcat" = "Xypcat hosts" &&
+ ypmatch "$myhostname" hosts 2>/dev/null |\
+ $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
+ $test -s hosts
+ } || {
+ $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
+ /[ ]$myhostname[ . ]/p" > hosts
+ }
+ tmp_re="[ . ]"
+ $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
+ END { print sum }" hosts` = x1 || tmp_re="[ ]"
+ dflt=.`$awk \
+ "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
+ hosts | $sort | $uniq | \
+ $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
+ case `$echo X$dflt` in
+ X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
+ dflt=.
+ ;;
+ X.)
+ if $test -f /etc/hosts; then
+ echo "(You do not have fully-qualified names in /etc/hosts)"
+ else
+ echo "(I cannot locate a hosts database anywhere)"
+ fi
+ ;;
+ esac
+ case "$dflt" in
+ .)
+ tans=`./loc resolv.conf X /etc /usr/etc`
+ if $test -f "$tans"; then
+ echo "(Attempting domain name extraction from $tans)"
+ dflt=.`$sed -n -e 's/ / /g' \
+ -e 's/^search *\([^ ]*\).*/\1/p' $tans \
+ | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
+ case "$dflt" in
+ .) dflt=.`$sed -n -e 's/ / /g' \
+ -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
+ | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ case "$dflt" in
+ .) echo "(No help from resolv.conf either -- attempting clever guess)"
+ dflt=.`sh -c domainname 2>/dev/null`
+ case "$dflt" in
+ '') dflt='.';;
+ .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
+ esac
+ ;;
+ esac
+ case "$dflt$osname" in
+ .os390)
+ file="//'SYS1.TCPPARMS(TCPDATA)'"
+ echo "(Attempting domain name extraction from $file)"
+ dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "$file" 2>/dev/null`
+ ;;
+ esac
+ case "$dflt" in
+ .) echo "(Lost all hope -- silly guess then)"
+ dflt='.nonet'
+ ;;
+ esac
+ $rm -f hosts
+ ;;
+ *) dflt="$mydomain";;
+ esac;;
+esac
+echo " "
+rp="What is your domain name?"
+. ./myread
+tans="$ans"
+case "$ans" in
+'') ;;
+.*) ;;
+*) tans=".$tans";;
+esac
+mydomain="$tans"
+
+: translate upper to lower if necessary
+case "$mydomain" in
+*[A-Z]*)
+ echo "(Normalizing case in your domain name)"
+ mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
+ ;;
+esac
+
+: a little sanity check here
+case "$phostname" in
+'') ;;
+*)
+ case `$phostname | ./tr '[A-Z]' '[a-z]'` in
+ $myhostname$mydomain|$myhostname) ;;
+ *)
+ case "$phostname" in
+ sed*)
+ echo "(That doesn't agree with your whoami.h file, by the way.)"
+ ;;
+ *)
+ echo "(That doesn't agree with your $phostname command, by the way.)"
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+esac
+
: compute shared library extension
case "$so" in
'')
@@ -3799,15 +4562,6 @@ rp='What is the file extension used for shared libraries?'
. ./myread
so="$ans"
-: Define several unixisms.
-: Hints files or command line option can be used to override them.
-case "$_a" in
-'') _a='.a';;
-esac
-case "$_o" in
-'') _o='.o';;
-esac
-
: Looking for optional libraries
echo " "
echo "Checking for optional libraries..." >&4
@@ -3821,7 +4575,7 @@ esac
case "$usesocks" in
"$define") libswanted="$libswanted socks5 socks5_sh" ;;
esac
-echo "extern char printf(); int main() { printf(); return 0; }" > lt.c
+echo "extern void abort(void); int main(void) { abort(); return 0; }" > lt.c
libsfound=''
libsfiles=''
libsdirs=''
@@ -3897,7 +4651,16 @@ for thislib in $libswanted; do
fi
done
if $test ! -f "$xxx"; then
- echo "No -l$thislib."
+ if $cc -o lt $ccflags $ldflags lt.c -l$thislib >/dev/null 2>&1
+ then
+ echo "Found -l$thislib (via $cc)."
+ case " $dflt " in
+ *"-l$thislib "*) ;;
+ *) dflt="$dflt -l$thislib";;
+ esac
+ else
+ echo "No -l$thislib."
+ fi
fi
done
set X $dflt
@@ -3927,30 +4690,6 @@ none) libs=' ';;
*) libs="$ans";;
esac
-: set up the script used to warn in case of inconsistency
-cat <<EOS >whoa
-$startsh
-EOS
-cat <<'EOSC' >>whoa
-dflt=y
-echo " "
-echo "*** WHOA THERE!!! ***" >&4
-echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
-rp=" Keep the $hint value?"
-. ./myread
-case "$ans" in
-y) td=$was; tu=$was;;
-esac
-EOSC
-
-: function used to set '$1' to '$val'
-setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
-case "$val$was" in
-$define$undef) . ./whoa; eval "$var=\$td";;
-$undef$define) . ./whoa; eval "$var=\$tu";;
-*) eval "$var=$val";;
-esac'
-
: define a shorthand compile call
compile='
mc_file=$1;
@@ -4001,7 +4740,7 @@ else
gnulibc_version=''
echo "You are not using the GNU C Library"
fi
-$rm -f try try.* glibc.ver
+$rm_try glibc.ver
set d_gnulibc
eval $setvar
@@ -4388,6 +5127,7 @@ case "$3" in
-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
*) tlook="^$1\$"; tf=libc.list; tc=""; tdc="()";;
esac;
+file=csym.log;
tx=yes;
case "$reuseval-$4" in
true-) ;;
@@ -4402,8 +5142,10 @@ yes)
else tval=false;
fi;;
*)
- echo "extern char $1$tdc; int main() { return &$1$tc + 2; }" > t.c;
- if $cc $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
+ echo "--- $1$tdc ---" >> "$file";
+ echo "extern char $1$tdc; int main(void) { return (unsigned long) &$1$tc > 2; }" > t.c;
+ $cat t.c >> "$file";
+ if $cc $ccflags $ldflags -o t t.c $libs >>"$file" 2>&1;
then tval=true;
else tval=false;
fi;
@@ -4415,607 +5157,9 @@ yes)
*) tval=false;;
esac;;
esac;
+echo "==> HAS $1$tdc is $tval ($4)" >>"$file";
eval "$2=$tval"'
-: define an is-in-libc? function
-inlibc='echo " "; td=$define; tu=$undef;
-sym=$1; var=$2; eval "was=\$$2";
-tx=yes;
-case "$reuseval$was" in
-true) ;;
-true*) tx=no;;
-esac;
-case "$tx" in
-yes)
- set $sym tres -f;
- eval $csym;
- case "$tres" in
- true)
- echo "$sym() found." >&4;
- case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
- *)
- echo "$sym() NOT found." >&4;
- case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
- esac;;
-*)
- case "$was" in
- $define) echo "$sym() found." >&4;;
- *) echo "$sym() NOT found." >&4;;
- esac;;
-esac'
-
-: determine filename position in cpp output
-echo " "
-echo "Computing filename position in cpp output for #include directives..." >&4
-echo '#include <stdio.h>' > foo.c
-case "$osname" in
-vos)
- testaccess=-e
- cppfilter="tr '\\\\>' '/' |"
- ;;
-*)
- testaccess=-r
- cppfilter=''
- ;;
-esac
-$cat >fieldn <<EOF
-$startsh
-$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
-$grep '^[ ]*#.*stdio\.h' | \
-while read cline; do
- pos=1
- set \$cline
- while $test \$# -gt 0; do
- if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
- echo "\$pos"
- exit 0
- fi
- shift
- pos=\`expr \$pos + 1\`
- done
-done
-EOF
-chmod +x fieldn
-fieldn=`./fieldn`
-$rm -f foo.c fieldn
-case $fieldn in
-'') pos='???';;
-1) pos=first;;
-2) pos=second;;
-3) pos=third;;
-*) pos="${fieldn}th";;
-esac
-echo "Your cpp writes the filename in the $pos field of the line."
-
-: locate header file
-$cat >findhdr <<EOF
-$startsh
-wanted=\$1
-name=''
-for usrincdir in $usrinc; do
- if test -f \$usrincdir/\$wanted; then
- echo "\$usrincdir/\$wanted"
- exit 0
- fi
-done
-awkprg='{ print \$$fieldn }'
-echo "#include <\$wanted>" > foo\$\$.c
-$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
-$cppfilter $grep "^[ ]*#.*\$wanted" | \
-while read cline; do
- name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
- case "\$name" in
- *[/\\\\]\$wanted) echo "\$name"; exit 1;;
- *[\\\\/]\$wanted) echo "\$name"; exit 1;;
- *) exit 2;;
- esac
-done
-status=\$?
-$rm -f foo\$\$.c
-if test \$status -eq 1; then
- exit 0
-fi
-exit 1
-EOF
-chmod +x findhdr
-$eunicefix findhdr
-
-: access call always available on UNIX
-set access d_access
-eval $inlibc
-
-: locate the flags for 'access()'
-case "$d_access" in
-"$define")
- echo " "
- $cat >access.c <<'EOCP'
-#include <sys/types.h>
-#ifdef I_FCNTL
-#include <fcntl.h>
-#endif
-#ifdef I_SYS_FILE
-#include <sys/file.h>
-#endif
-#ifdef I_UNISTD
-#include <unistd.h>
-#endif
-int main() {
- exit(R_OK);
-}
-EOCP
- : check sys/file.h first, no particular reason here
- if $test `./findhdr sys/file.h` && \
- $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
- h_sysfile=true;
- echo "<sys/file.h> defines the *_OK access constants." >&4
- elif $test `./findhdr fcntl.h` && \
- $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
- h_fcntl=true;
- echo "<fcntl.h> defines the *_OK access constants." >&4
- elif $test `./findhdr unistd.h` && \
- $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
- echo "<unistd.h> defines the *_OK access constants." >&4
- else
- echo "I can't find the four *_OK access constants--I'll use mine." >&4
- fi
- ;;
-esac
-$rm -f access*
-
-: see if bcopy exists
-set bcopy d_bcopy
-eval $inlibc
-
-: define an alternate in-header-list? function
-inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
-cont=true; xxf="echo \"<\$1> found.\" >&4";
-case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
-*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
-esac;
-case $# in 4) instead=instead;; *) instead="at last";; esac;
-while $test "$cont"; do
- xxx=`./findhdr $1`
- var=$2; eval "was=\$$2";
- if $test "$xxx" && $test -r "$xxx";
- then eval $xxf;
- eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
- cont="";
- else eval $xxnf;
- eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
- set $yyy; shift; shift; yyy=$@;
- case $# in 0) cont="";;
- 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
- xxnf="echo \"and I did not find <\$1> either.\" >&4";;
- *) xxf="echo \"but I found <\$1\> instead.\" >&4";
- xxnf="echo \"there is no <\$1>, ...\" >&4";;
- esac;
-done;
-while $test "$yyy";
-do set $yyy; var=$2; eval "was=\$$2";
- eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
- set $yyy; shift; shift; yyy=$@;
-done'
-
-: see if this is a unistd.h system
-set unistd.h i_unistd
-eval $inhdr
-
-: see if setpgrp exists
-set setpgrp d_setpgrp
-eval $inlibc
-
-case "$d_setpgrp" in
-"$define")
- echo " "
- echo "Checking to see which flavor of setpgrp is in use..."
- $cat >set.c <<EOP
-#$i_unistd I_UNISTD
-#include <sys/types.h>
-#ifdef I_UNISTD
-# include <unistd.h>
-#endif
-int main()
-{
- if (getuid() == 0) {
- printf("(I see you are running Configure as super-user...)\n");
- setuid(1);
- }
-#ifdef TRY_BSD_PGRP
- if (-1 == setpgrp(1, 1))
- exit(0);
-#else
- if (setpgrp() != -1)
- exit(0);
-#endif
- exit(1);
-}
-EOP
- if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
- echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
- val="$define"
- elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
- echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
- val="$undef"
- else
- echo "(I can't seem to compile and run the test program.)"
- if ./usg; then
- xxx="a USG one, i.e. you use setpgrp()."
- else
- # SVR4 systems can appear rather BSD-ish.
- case "$i_unistd" in
- $undef)
- xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
- val="$define"
- ;;
- $define)
- xxx="probably a USG one, i.e. you use setpgrp()."
- val="$undef"
- ;;
- esac
- fi
- echo "Assuming your setpgrp is $xxx" >&4
- fi
- ;;
-*) val="$undef";;
-esac
-set d_bsdsetpgrp
-eval $setvar
-$rm -f set set.c
-: see if dup2 exists
-set dup2 d_dup2
-eval $inlibc
-
-: see if this is an fcntl system
-set fcntl d_fcntl
-eval $inlibc
-
-: see if we can have long filenames
-echo " "
-rmlist="$rmlist /tmp/cf$$"
-$test -d /tmp/cf$$ || mkdir /tmp/cf$$
-first=123456789abcdef
-second=/tmp/cf$$/$first
-$rm -f $first $second
-if (echo hi >$first) 2>/dev/null; then
- if $test -f 123456789abcde; then
- echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
- val="$undef"
- else
- if (echo hi >$second) 2>/dev/null; then
- if $test -f /tmp/cf$$/123456789abcde; then
- $cat <<'EOM'
-That's peculiar... You can have filenames longer than 14 characters, but only
-on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
-I shall consider your system cannot support long filenames at all.
-EOM
- val="$undef"
- else
- echo 'You can have filenames longer than 14 characters.' >&4
- val="$define"
- fi
- else
- $cat <<'EOM'
-How confusing! Some of your filesystems are sane enough to allow filenames
-longer than 14 characters but some others like /tmp can't even think about them.
-So, for now on, I shall assume your kernel does not allow them at all.
-EOM
- val="$undef"
- fi
- fi
-else
- $cat <<'EOM'
-You can't have filenames longer than 14 chars. You can't even think about them!
-EOM
- val="$undef"
-fi
-set d_flexfnam
-eval $setvar
-$rm -rf /tmp/cf$$ 123456789abcde*
-
-: see if we have to deal with yellow pages, now NIS.
-if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
- if $test -f /usr/etc/nibindd; then
- echo " "
- echo "I'm fairly confident you're on a NeXT."
- echo " "
- rp='Do you get the passwd file via NetInfo?'
- dflt=y
- case "$passcat" in
- nidump*) ;;
- '') ;;
- *) dflt=n;;
- esac
- . ./myread
- case "$ans" in
- y*) passcat='nidump passwd .'
- ;;
- *) echo "You told me, so don't blame me."
- case "$passcat" in
- nidump*) passcat=''
- esac
- ;;
- esac
- echo " "
- rp='Do you get the hosts file via NetInfo?'
- dflt=y
- case "$hostcat" in
- nidump*) ;;
- '') ;;
- *) dflt=n;;
- esac
- . ./myread
- case "$ans" in
- y*) hostcat='nidump hosts .';;
- *) case "$hostcat" in
- nidump*) hostcat='';;
- esac
- ;;
- esac
- fi
- case "$passcat" in
- nidump*) ;;
- *)
- case "$passcat" in
- *ypcat*) dflt=y;;
- '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
- dflt=y
- else
- dflt=n
- fi;;
- *) dflt=n;;
- esac
- echo " "
- rp='Are you getting the passwd file via yellow pages?'
- . ./myread
- case "$ans" in
- y*) passcat='ypcat passwd'
- ;;
- *) passcat='cat /etc/passwd'
- ;;
- esac
- ;;
- esac
- case "$hostcat" in
- nidump*) ;;
- *)
- case "$hostcat" in
- *ypcat*) dflt=y;;
- '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
- dflt=y
- else
- dflt=n
- fi;;
- *) dflt=n;;
- esac
- echo " "
- rp='Are you getting the hosts file via yellow pages?'
- . ./myread
- case "$ans" in
- y*) hostcat='ypcat hosts';;
- *) hostcat='cat /etc/hosts';;
- esac
- ;;
- esac
-fi
-case "$hostcat" in
-'') hostcat=':'
- $test -f /etc/hosts && hostcat='cat /etc/hosts';;
-esac
-case "$groupcat" in
-'') groupcat=':'
- $test -f /etc/group && groupcat='cat /etc/group';;
-esac
-case "$passcat" in
-'') passcat=':'
- $test -f /etc/passwd && passcat='cat /etc/passwd';;
-esac
-
-: now get the host name
-echo " "
-echo "Figuring out host name..." >&4
-case "$myhostname" in
-'') cont=true
- echo 'Maybe "hostname" will work...'
- if tans=`sh -c hostname 2>&1` ; then
- myhostname=$tans
- phostname=hostname
- cont=''
- fi
- ;;
-*) cont='';;
-esac
-if $test "$cont"; then
- if ./xenix; then
- echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
- if tans=`cat /etc/systemid 2>&1` ; then
- myhostname=$tans
- phostname='cat /etc/systemid'
- echo "Whadyaknow. Xenix always was a bit strange..."
- cont=''
- fi
- elif $test -r /etc/systemid; then
- echo "(What is a non-Xenix system doing with /etc/systemid?)"
- fi
-fi
-if $test "$cont"; then
- echo 'No, maybe "uuname -l" will work...'
- if tans=`sh -c 'uuname -l' 2>&1` ; then
- myhostname=$tans
- phostname='uuname -l'
- else
- echo 'Strange. Maybe "uname -n" will work...'
- if tans=`sh -c 'uname -n' 2>&1` ; then
- myhostname=$tans
- phostname='uname -n'
- else
- echo 'Oh well, maybe I can mine it out of whoami.h...'
- if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
- myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
- phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
- else
- case "$myhostname" in
- '') echo "Does this machine have an identity crisis or something?"
- phostname='';;
- *)
- echo "Well, you said $myhostname before..."
- phostname='echo $myhostname';;
- esac
- fi
- fi
- fi
-fi
-case "$myhostname" in
-'') myhostname=noname ;;
-esac
-: you do not want to know about this
-set $myhostname
-myhostname=$1
-
-: verify guess
-if $test "$myhostname" ; then
- dflt=y
- rp='Your host name appears to be "'$myhostname'".'" Right?"
- . ./myread
- case "$ans" in
- y*) ;;
- *) myhostname='';;
- esac
-fi
-
-: bad guess or no guess
-while $test "X$myhostname" = X ; do
- dflt=''
- rp="Please type the (one word) name of your host:"
- . ./myread
- myhostname="$ans"
-done
-
-: translate upper to lower if necessary
-case "$myhostname" in
-*[A-Z]*)
- echo "(Normalizing case in your host name)"
- myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
- ;;
-esac
-
-case "$myhostname" in
-*.*)
- dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
- myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
- echo "(Trimming domain name from host name--host name is now $myhostname)"
- ;;
-*) case "$mydomain" in
- '')
- {
- test "X$hostcat" = "Xypcat hosts" &&
- ypmatch "$myhostname" hosts 2>/dev/null |\
- $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
- $test -s hosts
- } || {
- $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
- /[ ]$myhostname[ . ]/p" > hosts
- }
- tmp_re="[ . ]"
- $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
- END { print sum }" hosts` = x1 || tmp_re="[ ]"
- dflt=.`$awk \
- "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
- hosts | $sort | $uniq | \
- $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
- case `$echo X$dflt` in
- X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
- dflt=.
- ;;
- X.)
- if $test -f /etc/hosts; then
- echo "(You do not have fully-qualified names in /etc/hosts)"
- else
- echo "(I cannot locate a hosts database anywhere)"
- fi
- ;;
- esac
- case "$dflt" in
- .)
- tans=`./loc resolv.conf X /etc /usr/etc`
- if $test -f "$tans"; then
- echo "(Attempting domain name extraction from $tans)"
- dflt=.`$sed -n -e 's/ / /g' \
- -e 's/^search *\([^ ]*\).*/\1/p' $tans \
- | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
- case "$dflt" in
- .) dflt=.`$sed -n -e 's/ / /g' \
- -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
- | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
- ;;
- esac
- fi
- ;;
- esac
- case "$dflt" in
- .) echo "(No help from resolv.conf either -- attempting clever guess)"
- dflt=.`sh -c domainname 2>/dev/null`
- case "$dflt" in
- '') dflt='.';;
- .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
- esac
- ;;
- esac
- case "$dflt$osname" in
- .os390)
- file="//'SYS1.TCPPARMS(TCPDATA)'"
- echo "(Attempting domain name extraction from $file)"
- dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "$file" 2>/dev/null`
- ;;
- esac
- case "$dflt" in
- .) echo "(Lost all hope -- silly guess then)"
- dflt='.nonet'
- ;;
- esac
- $rm -f hosts
- ;;
- *) dflt="$mydomain";;
- esac;;
-esac
-echo " "
-rp="What is your domain name?"
-. ./myread
-tans="$ans"
-case "$ans" in
-'') ;;
-.*) ;;
-*) tans=".$tans";;
-esac
-mydomain="$tans"
-
-: translate upper to lower if necessary
-case "$mydomain" in
-*[A-Z]*)
- echo "(Normalizing case in your domain name)"
- mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
- ;;
-esac
-
-: a little sanity check here
-case "$phostname" in
-'') ;;
-*)
- case `$phostname | ./tr '[A-Z]' '[a-z]'` in
- $myhostname$mydomain|$myhostname) ;;
- *)
- case "$phostname" in
- sed*)
- echo "(That doesn't agree with your whoami.h file, by the way.)"
- ;;
- *)
- echo "(That doesn't agree with your $phostname command, by the way.)"
- ;;
- esac
- ;;
- esac
- ;;
-esac
-
: see how we will look up host name
echo " "
if false; then
@@ -5133,63 +5277,52 @@ case "$d_phostname" in
esac
: see if getopt exists
-set getopt d_getopt
-eval $inlibc
-
-: see which of string.h or strings.h is needed
-echo " "
-strings=`./findhdr string.h`
-if $test "$strings" && $test -r "$strings"; then
- echo "Using <string.h> instead of <strings.h>." >&4
- val="$define"
-else
- val="$undef"
- strings=`./findhdr strings.h`
- if $test "$strings" && $test -r "$strings"; then
- echo "Using <strings.h> instead of <string.h>." >&4
- else
- ./warn "No string header found -- You'll surely have problems."
- fi
-fi
-set i_string
-eval $setvar
-case "$i_string" in
-"$undef") strings=`./findhdr strings.h`;;
-*) strings=`./findhdr string.h`;;
-esac
+$cat >try.c <<EOC
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+extern char *optarg;
+extern int optind, opterr, optopt;
+int main(int argc, char *argv[])
+{
+ static int ret;
+ ret |= getopt(argc, argv, "abc");
+ return ret ? 0 : 1;
+}
+EOC
+cyn=getopt
+set d_getopt
+eval $trylink
: index or strchr
-echo " "
-if set index val -f; eval $csym; $val; then
- if set strchr val -f d_strchr; eval $csym; $val; then
- if $contains strchr "$strings" >/dev/null 2>&1 ; then
- val="$define"
- vali="$undef"
- echo "strchr() found." >&4
- else
- val="$undef"
- vali="$define"
- echo "index() found." >&4
- fi
- else
- val="$undef"
- vali="$define"
- echo "index() found." >&4
- fi
-else
- if set strchr val -f d_strchr; eval $csym; $val; then
- val="$define"
- vali="$undef"
- echo "strchr() found." >&4
- else
- echo "No index() or strchr() found!" >&4
- val="$undef"
- vali="$undef"
- fi
-fi
-set d_strchr; eval $setvar
-val="$vali"
-set d_index; eval $setvar
+$cat >try.c <<EOC
+#include <string.h>
+int main(void)
+{
+ static char ret;
+ static int c;
+ ret |= *strchr("string", c);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=strchr
+set d_strchr
+eval $trylink
+
+$cat >try.c <<EOC
+#include <strings.h>
+int main(void)
+{
+ static char ret;
+ static int c;
+ ret |= *index("string", c);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=index
+set d_index
+eval $trylink
: Locate the flags for 'open()'
echo " "
@@ -5201,12 +5334,12 @@ $cat >open3.c <<'EOCP'
#ifdef I_SYS_FILE
#include <sys/file.h>
#endif
-int main() {
+int main(void) {
if(O_RDONLY);
#ifdef O_TRUNC
- exit(0);
+ return 0;
#else
- exit(1);
+ return 1;
#endif
}
EOCP
@@ -5235,35 +5368,115 @@ elif $test `./findhdr fcntl.h` && \
fi
else
val="$undef"
- ./warn "I can't find the O_* constant definitions! You got problems."
+ ./warn "I can't find the O_* constant definitions! You got problems." 4>&4
fi
set d_open3
eval $setvar
$rm -f open3*
: see if rename exists
-set rename d_rename
-eval $inlibc
+$cat >try.c <<EOC
+#include <stdio.h>
+int main(void)
+{
+ static int ret;
+ ret |= rename("old", "new");
+ return ret ? 0 : 1;
+}
+EOC
+cyn=rename
+set d_rename
+eval $trylink
: see if setpgid exists
-set setpgid d_setpgid
-eval $inlibc
+$cat >try.c <<EOC
+#include <sys/types.h>
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+int main(void)
+{
+ static pid_t pid, pgid;
+ static int ret;
+ ret |= setpgid(pid, pgid);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=setpgid
+set d_setpgid
+eval $trylink
: see if setrgid exists
-set setrgid d_setrgid
-eval $inlibc
+$cat >try.c <<EOC
+#include <sys/types.h>
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+int main(void)
+{
+ static int ret;
+ static gid_t gid;
+ ret |= setrgid(gid);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=setrgid
+set d_setrgid
+eval $trylink
: see if setruid exists
-set setruid d_setruid
-eval $inlibc
+$cat >try.c <<EOC
+#include <sys/types.h>
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+int main(void)
+{
+ static int ret;
+ static uid_t uid;
+ ret |= setruid(uid);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=setruid
+set d_setruid
+eval $trylink
: see if setsid exists
-set setsid d_setsid
-eval $inlibc
+$cat >try.c <<EOC
+#include <sys/types.h>
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+int main(void)
+{
+ static pid_t ret;
+ ret |= setsid();
+ return ret ? 0 : 1;
+}
+EOC
+cyn=setsid
+set d_setsid
+eval $trylink
: see if strcasecmp exists
-set strcasecmp d_strccmp
-eval $inlibc
+$cat >try.c <<EOC
+#include <strings.h>
+int
+main(void)
+{
+ static int ret;
+ ret |= strcasecmp("xxx", "XXX");
+ return ret ? 0 : 1;
+}
+EOC
+cyn=strcasecmp
+set d_strccmp
+eval $trylink
: see if strerror and/or sys_errlist[] exist
echo " "
@@ -5348,9 +5561,23 @@ eval $setvar
$rm -f wait.out
: see if there is a vfork
-val=''
-set vfork val
-eval $inlibc
+$cat >try.c <<EOC
+#include <sys/types.h>
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+int main(void)
+{
+ static pid_t ret;
+ ret |= vfork();
+ return ret ? 0 : 1;
+}
+EOC
+cyn=vfork
+set val
+eval $trylink
+
: Ok, but do we want to use it. vfork is reportedly unreliable in
: perl on Solaris 2.x, and probably elsewhere.
@@ -5582,11 +5809,21 @@ $rm -f Cppsym.know Cppsym.true
val="$undef"
val2="$undef"
val3="$undef"
-if $test `./findhdr termios.h`; then
- set tcsetattr i_termios
- eval $inlibc
- val3="$i_termios"
-fi
+$cat >try.c <<EOC
+#include <termios.h>
+int main(void)
+{
+ static struct termios t;
+ static int ret;
+ ret |= tcsetattr(1, 2, &t);
+ return ret ? 0 : 1;
+}
+EOC
+set i_termios
+eval $trylink
+set tcsetattr i_termios
+val3="$i_termios"
+
echo " "
case "$val3" in
"$define") echo "You have POSIX termios.h... good!" >&4;;
@@ -5597,14 +5834,14 @@ case "$val3" in
echo "<sgtty.h> found." >&4
else
echo "System is pyramid with BSD universe."
- ./warn "<sgtty.h> not found--you could have problems."
+ ./warn "<sgtty.h> not found--you could have problems." 4>&4
fi;;
*) if $test `./findhdr termio.h`; then
val="$define"
echo "<termio.h> found." >&4
else
echo "System is pyramid with USG universe."
- ./warn "<termio.h> not found--you could have problems."
+ ./warn "<termio.h> not found--you could have problems." 4>&4
fi;;
esac
elif ./usg; then
@@ -5615,7 +5852,7 @@ case "$val3" in
echo "<sgtty.h> found." >&4
val2="$define"
else
- ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
+ ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!" 4>&4
fi
else
if $test `./findhdr sgtty.h`; then
@@ -5625,7 +5862,7 @@ case "$val3" in
echo "<termio.h> found." >&4
val="$define"
else
- ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
+ ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!" 4>&4
fi
fi;;
esac
@@ -5769,7 +6006,7 @@ Hopefully, $package does not need this feature.
EOM
fi
else
- ./warn <<EOM
+ ./warn 4>&4 <<EOM
I can't seem to be able to catenate tokens with your cpp.
EOM
cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
@@ -5794,8 +6031,21 @@ rp="What is the default editor on your system?"
defeditor="$ans"
: see if flock exists
-set flock d_flock
-eval $inlibc
+$cat >try.c <<EOC
+#include <sys/file.h>
+#include <fcntl.h>
+int main(void)
+{
+ static int fd, ret;
+ ret |= flock(fd, LOCK_SH);
+ ret |= flock(fd, LOCK_EX);
+ ret |= flock(fd, LOCK_UN);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=flock
+set d_flock
+eval $trylink
: see which mailbox locking should be used
echo " "
@@ -5934,7 +6184,12 @@ EOS
creatdir="$prog -d"
fi
(ls -l d/try >try.ls; ls -l d/try.ns >tryno.ls) 2>/dev/null
- if (cmp -s d/try try && cmp -s d/try.ns try.ns && \
+ try_wc=`($wc -c try | $awk '{ print $1}') 2>/dev/null`
+ tryns_wc=`($wc -c try.ns | $awk '{ print $1}') 2>/dev/null`
+ d_try_wc=`($wc -c d/try | $awk '{ print $1}') 2>/dev/null`
+ d_tryns_wc=`($wc -c d/try.ns | $awk '{ print $1}') 2>/dev/null`
+ if ($test "X$try_wc" = "X$d_try_wc" && \
+ $test "X$tryns_wc" = "X$d_tryns_wc" && \
$contains 'rwxrw-r--' tryno.ls && \
$contains 'rw-r---w-' try.ls) >/dev/null 2>&1
then
@@ -6014,55 +6269,60 @@ case "$installdir" in
*) echo "As you already told me, '$installdir' should work.";;
esac
+: static assertion checking include file
+$cat >static_assert.h <<'EOC'
+#define STATIC_ASSERT(expr) \
+ do { switch (0) { case ((expr) ? 1 : 0): case 0: break; } } while(0)
+EOC
+
: check for lengths of integral types
echo " "
-case "$intsize" in
-'')
- echo "Checking to see how big your integers are..." >&4
- $cat >intsize.c <<'EOCP'
-#include <stdio.h>
+types=''
+types="$types int"
+for t in $types; do
+ $echo $n "Checking to see how big your ${t}s are...$c" >&4
+ for size in 2 4 8 16 error; do
+ $cat >try.c <<EOCP
+#include "static_assert.h"
+$t foo;
int main()
{
- printf("intsize=%d;\n", sizeof(int));
- fflush(stdout);
- exit(0);
+ STATIC_ASSERT($size == sizeof(foo));
+ return 0;
}
EOCP
-# If $libs contains -lsfio, and sfio is mis-configured, then it
-# sometimes (apparently) runs and exits with a 0 status, but with no
-# output!. Thus we check with test -s whether we actually got any
-# output. I think it has to do with sfio's use of _exit vs. exit,
-# but I don't know for sure. --Andy Dougherty 1/27/97.
- if $cc $optimize $ccflags $ldflags -o intsize intsize.c $libs >/dev/null 2>&1 &&
- ./intsize > intsize.out 2>/dev/null && test -s intsize.out ; then
- eval `$cat intsize.out`
- echo "Your integers are $intsize bytes long."
- else
- $cat >&4 <<EOM
-!
-Help! I can't compile and run the intsize test program: please enlighten me!
-(This is probably a misconfiguration in your system or libraries, and
-you really ought to fix it. Still, I'll try anyway.)
-!
-EOM
- dflt=4
- rp="What is the size of an integer (in bytes)?"
+ if $cc -c $ccflags try.c >/dev/null 2>&1; then break; fi
+ done
+ var=${t}size
+ case "$size" in
+ error)
+ echo " cannot compute it." >&4
+ case $t in
+ short) dflt=2;;
+ int) dflt=4;;
+ long) dflt=4;;
+ esac
+ rp="What is the size of the \"$t\" type (in bytes)?"
. ./myread
- intsize="$ans"
- fi
- ;;
-esac
-$rm -f intsize intsize.[co] intsize.out
+ eval $var="$ans"
+ ;;
+ *)
+ echo " $size bytes." >&4
+ eval $var=$size
+ ;;
+ esac
+done
+$rm_try
: see what memory models we can support
case "$models" in
'')
$cat >pdp11.c <<'EOP'
-int main() {
+int main(void) {
#ifdef pdp11
- exit(0);
+ return 0;
#else
- exit(1);
+ return 1;
#endif
}
EOP
@@ -6199,7 +6459,7 @@ none)
esac
;;
*)
- ./warn "Unrecognized memory models--you may have to edit Makefile.SH"
+ ./warn "Unrecognized memory models--you may have to edit Makefile.SH" 4>&4
;;
esac
$rm -f pdp11.* pdp11
@@ -6356,7 +6616,7 @@ EOM
chmod +x $mkdep
$eunicefix $mkdep
if $mkdep dep.c >dep.out 2>/dev/null &&
- $contains "dep$_o: dep.h" dep.out >/dev/null 2>&1
+ $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1
then
echo "Looks like we can use $cc -MM."
else
@@ -6419,7 +6679,8 @@ do
done
set X \$files
shift
-trap "$rm -f /tmp/mkdep\$\$; exit 1" 1 2 3 15
+tmpdir="${TMPDIR:-/tmp}"
+trap "$rm -f "$tmpdir/mkdep\$\$"; exit 1" 1 2 3 15
for srcfile
do
case "\$srcfile" in
@@ -6433,7 +6694,7 @@ do
$sed -n -e 's/#[ ]*include[ ]*//' \\
-e '/<\(.*\)>/ d' \\
-e 's/:[^"]*"\([^"]*\)".*/: \1/' \\
- -e "s/\\.c:/$_o:/p" > /tmp/mkdep\$\$
+ -e "s/\\.c:/$_o:/p" > "$tmpdir/mkdep\$\$"
IFS=': '
while read file dep; do
for dir in \$inc; do
@@ -6443,9 +6704,9 @@ do
fi
done
echo "\$file: \$dep" | $sed -e 's,: \./,: ,'
- done </tmp/mkdep\$\$
+ done <"$tmpdir/mkdep\$\$"
IFS=' '
- $rm -f /tmp/mkdep\$\$
+ $rm -f "$tmpdir/mkdep\$\$"
done
exit 0
EOS
@@ -6518,7 +6779,7 @@ while test "X$orgname" = "X"; do
done
: set the base revision
-baserev=3.0
+baserev=3.1
: get the patchlevel / revision
echo " "
@@ -6534,6 +6795,13 @@ if $test -r $rsrc/revision.h;then
revision=`awk \
'/^#[ ]*define[ ][ ]*REVISION/ {print $3}' \
< $rsrc/revision.h`
+ case "$revision" in
+ '"$Revision:')
+ revision=`awk \
+ '/^#[ ]*define[ ][ ]*REVISION/ {print $4}' \
+ < $rsrc/revision.h`
+ ;;
+ esac
else
revision=0
fi
@@ -6582,10 +6850,9 @@ pidtype="$ans"
echo " "
echo "Checking out function prototypes..." >&4
$cat >prototype.c <<'EOCP'
-int main(int argc, char *argv[]) {
- exit(0);}
+int main(int argc, char *argv[]) { (void) argc; (void) argv; return 0; }
EOCP
-if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
+if $cc $ccflags -c prototype.c; then
echo "Your C compiler appears to support function prototypes."
val="$define"
else
@@ -6792,6 +7059,7 @@ EOM
case "$voidflags" in
'')
$cat >try.c <<'EOCP'
+extern int doit();
#if TRY & 1
void sub() {
#else
@@ -6799,21 +7067,34 @@ sub() {
#endif
extern void moo(); /* function returning void */
void (*goo)(); /* ptr to func returning void */
+#if TRY & 2
+ static void (*foo[10])();
+#endif
#if TRY & 8
- void *hue; /* generic ptr */
+ void *hue; /* generic ptr */
+ char buf[] = "buf";
+ int *iptr;
#endif
+
#if TRY & 2
- void (*foo[10])();
+ if (doit()) {
+ foo[0] = moo;
+ (*foo[0])();
+ }
#endif
-
#if TRY & 4
- if(goo == moo) {
- exit(0);
- }
+ if (doit())
+ goo = moo;
+ if (goo == moo)
+ doit();
#endif
- exit(0);
+#if TRY & 8
+ hue = buf;
+ if (doit())
+ iptr = hue;
+#endif
+ doit();
}
-int main() { sub(); }
EOCP
if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
voidflags=$defvoidused
@@ -6864,9 +7145,7 @@ echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
fi
esac
case "$voidflags" in
-"$defvoidused")
- echo "Good. I already know it supports void to the level $package wants."
- ;;
+"$defvoidused") ;;
*)
dflt="$voidflags";
test -f flags && $cat flags
@@ -6875,7 +7154,7 @@ case "$voidflags" in
voidflags="$ans"
;;
esac
-$rm -f try.* .out flags
+$rm_try flags
: see if this is a sys/file.h system
val=''
@@ -6938,6 +7217,28 @@ eval $inhdr
set stdlib.h i_stdlib
eval $inhdr
+: see which of string.h or strings.h is needed
+echo " "
+strings=`./findhdr string.h`
+if $test "$strings" && $test -r "$strings"; then
+ echo "Using <string.h> instead of <strings.h>." >&4
+ val="$define"
+else
+ val="$undef"
+ strings=`./findhdr strings.h`
+ if $test "$strings" && $test -r "$strings"; then
+ echo "Using <strings.h> instead of <string.h>." >&4
+ else
+ ./warn "No string header found -- You'll surely have problems." 4>&4
+ fi
+fi
+set i_string
+eval $setvar
+case "$i_string" in
+"$undef") strings=`./findhdr strings.h`;;
+*) strings=`./findhdr string.h`;;
+esac
+
: see if this is a sys/param system
set sys/param.h i_sysparam
eval $inhdr
@@ -6960,7 +7261,7 @@ $cat >try.c <<'EOCP'
#ifdef I_SYSSELECT
#include <sys/select.h>
#endif
-int main()
+int main(void)
{
struct tm foo;
#ifdef S_TIMEVAL
@@ -6970,12 +7271,12 @@ int main()
struct timezone tzp;
#endif
if (foo.tm_sec == foo.tm_sec)
- exit(0);
+ return 0;
#ifdef S_TIMEVAL
if (bar.tv_sec == bar.tv_sec)
- exit(0);
+ return 0;
#endif
- exit(1);
+ return 1;
}
EOCP
flags=''
@@ -7023,7 +7324,7 @@ case "$flags" in
echo "We'll include <sys/time.h>." >&4;;
*) i_systime="$undef";;
esac
-$rm -f try.c try
+$rm_try
: see if sys/types.h has to be included
set sys/types.h i_systypes
@@ -7153,9 +7454,19 @@ your organization...
EOM
cont=x
while test "$cont"; do
+ case "$MAILDOMAIN" in
+ '')
+ if $test -s /etc/mailname; then
+ maildomain=`$cat /etc/mailname`
+ else
+ maildomain="$myhostname$mydomain"
+ fi
+ ;;
+ *) maildomain="$MAILDOMAIN";;
+ esac
case "$cf_email" in
- '') dflt="$cf_by@$myhostname$mydomain";;
- *) dflt="$cf_email";;
+ '') dflt="$cf_by@$maildomain";;
+ *) dflt="$cf_email";;
esac
rp='What is your e-mail address?'
. ./myread
@@ -7337,6 +7648,7 @@ cpp='$cpp'
cpp_quote='$cpp_quote'
cpp_stuff='$cpp_stuff'
cppccsymbols='$cppccsymbols'
+cppfilter='$cppfilter'
cppflags='$cppflags'
cpplast='$cpplast'
cppminus='$cppminus'
@@ -7389,6 +7701,7 @@ d_vfork='$d_vfork'
d_voidsig='$d_voidsig'
d_voidtty='$d_voidtty'
d_wifstat='$d_wifstat'
+d_windows='$d_windows'
d_xenix='$d_xenix'
date='$date'
defeditor='$defeditor'
@@ -7398,15 +7711,18 @@ egrep='$egrep'
emacs='$emacs'
eunicefix='$eunicefix'
expr='$expr'
+fieldn='$fieldn'
find='$find'
firstmakefile='$firstmakefile'
flex='$flex'
flock_only='$flock_only'
from='$from'
+gcc='$gcc'
gccosandvers='$gccosandvers'
gccversion='$gccversion'
glibpth='$glibpth'
gmake='$gmake'
+gmsgfmt='$gmsgfmt'
gnulibc_version='$gnulibc_version'
grep='$grep'
groupcat='$groupcat'
@@ -7489,12 +7805,15 @@ mkdep='$mkdep'
mkdir='$mkdir'
models='$models'
more='$more'
+msgfmt='$msgfmt'
+msgmerge='$msgmerge'
mv='$mv'
mydomain='$mydomain'
myhostname='$myhostname'
myuname='$myuname'
n='$n'
nametype='$nametype'
+nawk='$nawk'
nm='$nm'
nm_opt='$nm_opt'
nm_so_opt='$nm_so_opt'
@@ -7520,6 +7839,7 @@ prefixexp='$prefixexp'
privlib='$privlib'
privlibexp='$privlibexp'
prototype='$prototype'
+pthread='$pthread'
reg10='$reg10'
reg11='$reg11'
reg12='$reg12'
@@ -7539,6 +7859,7 @@ reg9='$reg9'
registers='$registers'
revision='$revision'
rm='$rm'
+rm_try='$rm_try'
rmail='$rmail'
rootid='$rootid'
run='$run'
@@ -7591,16 +7912,25 @@ utmp='$utmp'
uuname='$uuname'
vi='$vi'
voidflags='$voidflags'
+wc='$wc'
+xgettext='$xgettext'
xlibpth='$xlibpth'
zcat='$zcat'
zip='$zip'
EOT
+: project-specific code
+file=revision.h
+echo " "
+echo "Generating $file..." >&4
+bin/svn-revision . $file
+
: add special variables
$test -f $src/patchlevel.h && \
awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
$test -f $src/revision.h && \
-awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/revision.h >>config.sh
+sed -ne 's/^#define \([A-Za-z0-9_]*\) ".*: \([0-9]*\).*"/\1=\2/p' \
+ < $src/revision.h >>config.sh
echo "CONFIG=true" >>config.sh
: propagate old symbols
@@ -7631,8 +7961,7 @@ fi
: Finish up by extracting the .SH files
case "$alldone" in
exit)
- $rm -rf UU
- echo "Extraction done."
+ echo "Stopping at your request, leaving temporary files around."
exit 0
;;
cont)
diff --git a/MANIFEST b/MANIFEST
index 50c91bd..57ff147 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -11,6 +11,7 @@ README Basic instructions
U/ Specific metaconfig units
U/End.U
U/Myinit.U
+U/Specific.U Specific code for mailagent before .SH extraction
U/mboxlock.U
U/utmp.U
agent/ Where mailagent support files are located
@@ -272,7 +273,9 @@ agent/test/filter/range.t Selector range tests
agent/test/filter/status.t Action status updating tests
agent/test/level Default logging level for tests
agent/test/mail The mail used by testing routines
+agent/test/mail-long Used to test very long header words
agent/test/mime Sample MIME email with HTML and plain parts
+agent/test/mime-recursive Sample recursive mixed MIME email
agent/test/misc/ Directory for miscellaneous tests
agent/test/misc/compress.t Folder compression checks
agent/test/misc/mh.t MH-style folder checks
@@ -348,4 +351,3 @@ misc/unkit/newcmd.cf Configuration of the new command
misc/unkit/rules Rules to be added to handle kit messages
misc/unkit/unkit.pl Implementation of the user-defined UNKIT command
patchlevel.h Current version number and patch level
-revision.h The current SVN revision number for mailagent
diff --git a/U/End.U b/U/End.U
index 8c96751..0bdde72 100644
--- a/U/End.U
+++ b/U/End.U
@@ -1,4 +1,4 @@
-?RCS: $Id: End.U 1 2006-08-24 13:24:12Z rmanfredi $
+?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1991-1993, Raphael Manfredi
?RCS:
diff --git a/U/Myinit.U b/U/Myinit.U
index 7f3f3b3..c1d2104 100644
--- a/U/Myinit.U
+++ b/U/Myinit.U
@@ -1,4 +1,4 @@
-?RCS: $Id: Myinit.U 45 2008-06-14 20:58:05Z rmanfredi $
+?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1990-2006, Raphael Manfredi
?RCS:
diff --git a/U/Specific.U b/U/Specific.U
new file mode 100644
index 0000000..30babf8
--- /dev/null
+++ b/U/Specific.U
@@ -0,0 +1,33 @@
+?RCS:
+?RCS: Copyright (c) 2018, Raphael Manfredi
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic License,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic License; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS:
+?X:
+?X: This unit is intended to be a project-specific hook.
+?X: By default, it is therefore empty, meant to be copied to your private
+?X: unit directory (U) and seasoned to taste.
+?X:
+?X: If you need specific code generation to happen once the configuration
+?X: is finished and config.sh was generated, but before the extraction of
+?X: the .SH files begins, then this is the place to put these special
+?X: code that the .SH files will require to run properly.
+?X:
+?X: When this unit triggers, Configure is back to the top directory.
+?X:
+?MAKE:Specific: Config_sh
+?MAKE: -pick add $@ %<
+?T:file
+?X:
+?X: Keep the above ?MAKE: lines and then append your specific code here.
+?X:
+: project-specific code
+file=revision.h
+echo " "
+echo "Generating $file..." >&4
+bin/svn-revision . $file
+
diff --git a/U/mboxlock.U b/U/mboxlock.U
index c64f4f8..447aae1 100644
--- a/U/mboxlock.U
+++ b/U/mboxlock.U
@@ -1,4 +1,4 @@
-?RCS: $Id: mboxlock.U 45 2008-06-14 20:58:05Z rmanfredi $
+?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1991, Syd Weinstein
?RCS: Copyright (c) 1991, Raphael Manfredi
diff --git a/U/utmp.U b/U/utmp.U
index 9117a7d..9fd11c2 100644
--- a/U/utmp.U
+++ b/U/utmp.U
@@ -1,4 +1,4 @@
-?RCS: $Id: utmp.U 9 2008-05-28 14:51:41Z rmanfredi $
+?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1990-2006, Raphael Manfredi
?RCS:
diff --git a/agent/edusers.SH b/agent/edusers.SH
index d07df1e..907da63 100755
--- a/agent/edusers.SH
+++ b/agent/edusers.SH
@@ -23,7 +23,7 @@ $startperl
eval 'exec perl -S \$0 \${1+"\$@"}'
if \$running_under_some_shell;
-# $Id: edusers.SH 47 2008-06-26 19:18:00Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/addauth.SH b/agent/files/help/addauth.SH
index 549a966..1931a0b 100755
--- a/agent/files/help/addauth.SH
+++ b/agent/files/help/addauth.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/addauth (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: addauth.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/approve.SH b/agent/files/help/approve.SH
index c3c8f30..ef153dc 100755
--- a/agent/files/help/approve.SH
+++ b/agent/files/help/approve.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/approve (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: approve.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/delpower.SH b/agent/files/help/delpower.SH
index 46b07d5..225988c 100755
--- a/agent/files/help/delpower.SH
+++ b/agent/files/help/delpower.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/delpower (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: delpower.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/end.SH b/agent/files/help/end.SH
index 328076f..c51b775 100755
--- a/agent/files/help/end.SH
+++ b/agent/files/help/end.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/end (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: end.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/getauth.SH b/agent/files/help/getauth.SH
index 0129e2e..e17ee68 100755
--- a/agent/files/help/getauth.SH
+++ b/agent/files/help/getauth.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/getauth (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: getauth.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/help.SH b/agent/files/help/help.SH
index 04f218f..19cd3f6 100755
--- a/agent/files/help/help.SH
+++ b/agent/files/help/help.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/help (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: help.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/newpower.SH b/agent/files/help/newpower.SH
index 1034b8f..70072fa 100755
--- a/agent/files/help/newpower.SH
+++ b/agent/files/help/newpower.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/newpower (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: newpower.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/passwd.SH b/agent/files/help/passwd.SH
index d3607fe..df0f0c1 100755
--- a/agent/files/help/passwd.SH
+++ b/agent/files/help/passwd.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/passwd (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: passwd.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/password.SH b/agent/files/help/password.SH
index 6786420..88deb2a 100755
--- a/agent/files/help/password.SH
+++ b/agent/files/help/password.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/password (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: password.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/power.SH b/agent/files/help/power.SH
index 9896bcf..09c3f75 100755
--- a/agent/files/help/power.SH
+++ b/agent/files/help/power.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/power (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: power.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/release.SH b/agent/files/help/release.SH
index 614e956..2414d07 100755
--- a/agent/files/help/release.SH
+++ b/agent/files/help/release.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/release (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: release.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/remauth.SH b/agent/files/help/remauth.SH
index 9e9bb75..f8c4a2d 100755
--- a/agent/files/help/remauth.SH
+++ b/agent/files/help/remauth.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/remauth (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: remauth.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/set.SH b/agent/files/help/set.SH
index 84f8e9e..be234ee 100755
--- a/agent/files/help/set.SH
+++ b/agent/files/help/set.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/set (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: set.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/setauth.SH b/agent/files/help/setauth.SH
index 63740a7..a2fc5c9 100755
--- a/agent/files/help/setauth.SH
+++ b/agent/files/help/setauth.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/setauth (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: setauth.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/help/user.SH b/agent/files/help/user.SH
index 7b14e62..626764d 100755
--- a/agent/files/help/user.SH
+++ b/agent/files/help/user.SH
@@ -16,7 +16,7 @@ case "$0" in
esac
echo "Extracting agent/files/help/user (with variable substitutions)"
$spitshell >/dev/null <<!GROK!THIS!
-# $Id: user.SH 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/files/mailagent.cf b/agent/files/mailagent.cf
index d8adf33..3670dae 100644
--- a/agent/files/mailagent.cf
+++ b/agent/files/mailagent.cf
@@ -146,6 +146,7 @@ bifftrlen: 2 # Minimal trimming length, in lines
biffquote: ON # Whether the attribution line should be shown
biffmh : OFF # Compact biffing message ala MH
biffnice : OFF # Whether compacted body should be reformatted
+biifchars: iso-8859-1 # Charset to use on the terminal (or utf-8)
# MH-style folders
mhprofile: ~/.mh_profile # Name of the MH profile file (optional)
diff --git a/agent/filter/dup2.c b/agent/filter/dup2.c
index 2f6b222..5460644 100644
--- a/agent/filter/dup2.c
+++ b/agent/filter/dup2.c
@@ -3,7 +3,7 @@
*/
/*
- * $Id: dup2.c 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/environ.c b/agent/filter/environ.c
index d6562bf..e2c51b7 100644
--- a/agent/filter/environ.c
+++ b/agent/filter/environ.c
@@ -11,7 +11,7 @@
*/
/*
- * $Id: environ.c 58 2008-08-19 08:44:07Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/environ.h b/agent/filter/environ.h
index 3e76aa1..391f75d 100644
--- a/agent/filter/environ.h
+++ b/agent/filter/environ.h
@@ -11,7 +11,7 @@
*/
/*
- * $Id: environ.h 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/getopt.c b/agent/filter/getopt.c
index f16e412..8beeab8 100644
--- a/agent/filter/getopt.c
+++ b/agent/filter/getopt.c
@@ -3,7 +3,7 @@
*/
/*
- * $Id: getopt.c 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/hash.c b/agent/filter/hash.c
index 3fc7754..01c4ffd 100644
--- a/agent/filter/hash.c
+++ b/agent/filter/hash.c
@@ -11,7 +11,7 @@
*/
/*
- * $Id: hash.c 58 2008-08-19 08:44:07Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
@@ -52,7 +52,7 @@ extern char *malloc(); /* Memory allocation */
#ifndef lint
private char *rcsid =
- "$Id: hash.c 58 2008-08-19 08:44:07Z rmanfredi $";
+ "$Id$";
#endif
private uint32 hashcode(); /* The hahsing function */
diff --git a/agent/filter/hash.h b/agent/filter/hash.h
index d44f249..77b3591 100644
--- a/agent/filter/hash.h
+++ b/agent/filter/hash.h
@@ -11,7 +11,7 @@
*/
/*
- * $Id: hash.h 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/io.c b/agent/filter/io.c
index a49c6b3..6ed7250 100644
--- a/agent/filter/io.c
+++ b/agent/filter/io.c
@@ -11,7 +11,7 @@
*/
/*
- * $Id: io.c 58 2008-08-19 08:44:07Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/io.h b/agent/filter/io.h
index d8d2441..4efab2e 100644
--- a/agent/filter/io.h
+++ b/agent/filter/io.h
@@ -11,7 +11,7 @@
*/
/*
- * $Id: io.h 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/lock.c b/agent/filter/lock.c
index 1b47629..613cd88 100644
--- a/agent/filter/lock.c
+++ b/agent/filter/lock.c
@@ -11,7 +11,7 @@
*/
/*
- * $Id: lock.c 8 2008-05-28 09:27:26Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/lock.h b/agent/filter/lock.h
index d122cba..09ffb6b 100644
--- a/agent/filter/lock.h
+++ b/agent/filter/lock.h
@@ -11,7 +11,7 @@
*/
/*
- * $Id: lock.h 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/logfile.c b/agent/filter/logfile.c
index 78b4e66..7530b8a 100644
--- a/agent/filter/logfile.c
+++ b/agent/filter/logfile.c
@@ -11,7 +11,7 @@
*/
/*
- * $Id: logfile.c 58 2008-08-19 08:44:07Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
@@ -244,7 +244,6 @@ char *where;
#if !defined(HAS_STRERROR) && defined(HAS_SYS_ERRLIST)
extern int sys_nerr; /* Size of sys_errlist[] */
extern char *sys_errlist[]; /* Maps error code to string */
-
#endif
#ifdef HAS_STRERROR
diff --git a/agent/filter/logfile.h b/agent/filter/logfile.h
index 7c2313d..362254d 100644
--- a/agent/filter/logfile.h
+++ b/agent/filter/logfile.h
@@ -11,7 +11,7 @@
*/
/*
- * $Id: logfile.h 8 2008-05-28 09:27:26Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/main.c b/agent/filter/main.c
index 60868f7..1bd474c 100644
--- a/agent/filter/main.c
+++ b/agent/filter/main.c
@@ -11,7 +11,7 @@
*/
/*
- * $Id: main.c 23 2008-05-30 09:30:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/misc.c b/agent/filter/misc.c
index 59ce705..8fe67f6 100644
--- a/agent/filter/misc.c
+++ b/agent/filter/misc.c
@@ -11,7 +11,7 @@
*/
/*
- * $Id: misc.c 58 2008-08-19 08:44:07Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/msg.c b/agent/filter/msg.c
index 52d16fd..3c6ca65 100644
--- a/agent/filter/msg.c
+++ b/agent/filter/msg.c
@@ -11,7 +11,7 @@
*/
/*
- * $Id: msg.c 8 2008-05-28 09:27:26Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/msg.h b/agent/filter/msg.h
index 2573995..c80d8d3 100644
--- a/agent/filter/msg.h
+++ b/agent/filter/msg.h
@@ -11,7 +11,7 @@
*/
/*
- * $Id: msg.h 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/parser.c b/agent/filter/parser.c
index 3937b30..446f809 100644
--- a/agent/filter/parser.c
+++ b/agent/filter/parser.c
@@ -11,7 +11,7 @@
*/
/*
- * $Id: parser.c 8 2008-05-28 09:27:26Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/parser.h b/agent/filter/parser.h
index 9bf161d..1ac3176 100644
--- a/agent/filter/parser.h
+++ b/agent/filter/parser.h
@@ -11,7 +11,7 @@
*/
/*
- * $Id: parser.h 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/portable.h b/agent/filter/portable.h
index d0b01c9..edb89fb 100644
--- a/agent/filter/portable.h
+++ b/agent/filter/portable.h
@@ -11,7 +11,7 @@
*/
/*
- * $Id: portable.h 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/sysexits.h b/agent/filter/sysexits.h
index 5137a12..f46795b 100644
--- a/agent/filter/sysexits.h
+++ b/agent/filter/sysexits.h
@@ -12,7 +12,7 @@
*/
/*
- * $Id: sysexits.h 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/filter/user.c b/agent/filter/user.c
index e42fec2..296df43 100644
--- a/agent/filter/user.c
+++ b/agent/filter/user.c
@@ -11,7 +11,7 @@
*/
/*
- * $Id: user.c 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/maildist.SH b/agent/maildist.SH
index 4af6beb..722f647 100755
--- a/agent/maildist.SH
+++ b/agent/maildist.SH
@@ -23,7 +23,7 @@ $startperl
eval "exec perl -S \$0 \$*"
if \$running_under_some_shell;
-# $Id: maildist.SH 47 2008-06-26 19:18:00Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/mailhelp.SH b/agent/mailhelp.SH
index 55aedb4..2449a58 100755
--- a/agent/mailhelp.SH
+++ b/agent/mailhelp.SH
@@ -23,7 +23,7 @@ $startperl
eval 'exec perl -S \$0 \${1+"\$@"}'
if \$running_under_some_shell;
-# $Id: mailhelp.SH 75 2011-12-23 10:18:37Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/maillist.SH b/agent/maillist.SH
index 74c24db..2ce7c96 100755
--- a/agent/maillist.SH
+++ b/agent/maillist.SH
@@ -23,7 +23,7 @@ $startperl
eval 'exec perl -S \$0 \${1+"\$@"}'
if \$running_under_some_shell;
-# $Id: maillist.SH 75 2011-12-23 10:18:37Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/mailpatch.SH b/agent/mailpatch.SH
index e852b98..5616c65 100755
--- a/agent/mailpatch.SH
+++ b/agent/mailpatch.SH
@@ -23,7 +23,7 @@ $startperl
eval 'exec perl -S \$0 \${1+"\$@"}'
if \$running_under_some_shell;
-# $Id: mailpatch.SH 48 2008-06-26 19:18:44Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/man/mailagent.SH b/agent/man/mailagent.SH
index ef74b6c..0a5efe1 100755
--- a/agent/man/mailagent.SH
+++ b/agent/man/mailagent.SH
@@ -18,139 +18,139 @@ echo "Extracting agent/man/mailagent.$manext (with variable substitutions)"
$rm -f mailagent.$manext
$spitshell >mailagent.$manext <<!GROK!THIS!
.TH MAILAGENT $manext "Version $VERSION-$REVISION"
-.\" @(#) Manual page for mailagent's filter -- (c) ram February 1991
-.\"
-.\" $Id: mailagent.SH 75 2011-12-23 10:18:37Z rmanfredi $
-.\"
-.\" Copyright (c) 1990-2006, Raphael Manfredi
-.\"
-.\" You may redistribute only under the terms of the Artistic License,
-.\" as specified in the README file that comes with the distribution.
-.\" You may reuse parts of this distribution only within the terms of
-.\" that same Artistic License; a copy of which may be found at the root
-.\" of the source tree for mailagent 3.0.
-.\"
-.\" $Log: mailagent.SH,v $
-.\" Revision 3.0.1.26 2001/03/17 18:08:30 ram
-.\" patch72: documented new config vars: domain and hidenet
-.\" patch72: various fixes from bug reports on Debian
-.\"
-.\" Revision 3.0.1.25 2001/03/13 13:10:47 ram
-.\" patch71: documented SUBST/TR on header fields
-.\"
-.\" Revision 3.0.1.24 2001/01/10 16:51:38 ram
-.\" patch69: changed semantics of "tome"
-.\" patch69: updated POST to current practices
-.\" patch69: documented biffing macros for news article
-.\"
-.\" Revision 3.0.1.23 1999/07/12 13:46:20 ram
-.\" patch66: variables are now propagated back and forth through APPLY
-.\" patch66: updated my e-mail address
-.\"
-.\" Revision 3.0.1.22 1999/01/13 18:10:52 ram
-.\" patch64: added %Y macro for 4-digit year output
-.\" patch64: agent.wait file moved from Queue to Spool
-.\"
-.\" Revision 3.0.1.21 1998/07/28 16:59:10 ram
-.\" patch62: documented new "servshell" variable
-.\"
-.\" Revision 3.0.1.20 1998/03/31 14:40:01 ram
-.\" patch59: added "vacfixed" and "tofake" configuration parameters
-.\" patch59: new ON command to issue commands on certain days only
-.\" patch59: the SERVER "set" command can now list defined variables
-.\" patch59: added an example of alternate VACATION message selection
-.\"
-.\" Revision 3.0.1.19 1997/09/15 15:07:18 ram
-.\" patch57: new -t and -f options for BEGIN and NOP
-.\" patch57: all command options should now be output in bold
-.\" patch57: documented _CALLOUT_ working state for callout queue
-.\"
-.\" Revision 3.0.1.18 1997/02/20 11:40:44 ram
-.\" patch55: documents new execsafe, groupsafe and lockwarn variables
-.\" patch55: the C filter can now redirect output via -o
-.\" patch55: made it explicit that /pattern/i is legal
-.\"
-.\" Revision 3.0.1.17 1997/01/07 18:29:18 ram
-.\" patch52: documented new execsafe configuration variable
-.\"
-.\" Revision 3.0.1.16 1996/12/24 14:12:58 ram
-.\" patch45: examples are now shown in constant-width font if possible
-.\" patch45: big emphasis about security issues, for RUN commands & filter
-.\" patch45: new Relayed: pseudo header computations
-.\" patch45: documented the %-H biffing macro with more details
-.\" patch45: updated my e-mail address
-.\"
-.\" Revision 3.0.1.15 1995/09/15 13:56:30 ram
-.\" patch43: folder compression can now deal with various compressors
-.\" patch43: added locksafe, compspecs and comptag config variables
-.\" patch43: many typo fixes
-.\"
-.\" Revision 3.0.1.14 1995/08/31 16:27:44 ram
-.\" patch42: escaped various dollars to avoid shell substitution, grrr...
-.\"
-.\" Revision 3.0.1.13 1995/08/07 16:14:23 ram
-.\" patch37: new biffing features and configuration variables
-.\" patch37: new BIFF filtering command to dynamically configure biffing
-.\"
-.\" Revision 3.0.1.12 1995/03/21 12:56:05 ram
-.\" patch35: sample vacation message now contains a Precedence: header
-.\"
-.\" Revision 3.0.1.11 1995/02/16 14:28:45 ram
-.\" patch32: documents new -I switch and new fromfake config variable
-.\" patch32: random cleanup, mainly suppressing spurious "the" articles
-.\"
-.\" Revision 3.0.1.10 1995/01/25 15:17:42 ram
-.\" patch27: new option letter 't' for mailagent -s
-.\" patch27: new commands BEEP and PROTECT
-.\" patch27: new macro %a for biff messages
-.\"
-.\" Revision 3.0.1.9 1995/01/03 18:01:53 ram
-.\" patch24: new -u option for ANNOTATE documented
-.\" patch24: fixed example on the shell server command (power checking)
-.\" patch24: removed quotes for SERVER -d to accommodate new option parsing
-.\" patch24: added a -l switch to VACATION and extended its arguments
-.\" patch24: new section documenting Rule Environment variables
-.\"
-.\" Revision 3.0.1.8 1994/10/29 17:41:41 ram
-.\" patch20: documents the six new config variables for biffing
-.\" patch20: new section dedicated to built-in mail biffing
-.\"
-.\" Revision 3.0.1.7 1994/10/10 10:23:36 ram
-.\" patch19: typo fix
-.\"
-.\" Revision 3.0.1.6 1994/10/04 17:41:47 ram
-.\" patch17: documents new email and mboxlock config parameters
-.\" patch17: documents ~/agent.trace file and callout queue file name
-.\" patch17: new %e macro available to get user's e-mail address
-.\" patch17: mentions that the msgpath variable is read-only
-.\"
-.\" Revision 3.0.1.5 1994/09/22 13:57:09 ram
-.\" patch12: documents new config parameters callout and linkdirs
-.\" patch12: new filtering actions AFTER and DO
-.\" patch12: variable msgpath is now defined within a PERL escape
-.\" patch12: mention that PERL escape variables are available to new commands
-.\"
-.\" Revision 3.0.1.4 1994/07/01 14:56:20 ram
-.\" patch8: documents new eleven configuration variables
-.\" patch8: sub-section on timeouts has been expanded
-.\" patch8: emphasize .forward optimization danger with sendmail
-.\" patch8: new UMASK command
-.\"
-.\" Revision 3.0.1.3 1994/04/25 15:15:56 ram
-.\" patch7: documented new 'fromesc' config variable
-.\" patch7: forgot to insert the new -F option in the synopsis line
-.\"
-.\" Revision 3.0.1.2 1994/01/26 09:29:24 ram
-.\" patch5: documents new tag feature for UNIQUE and RECORD
-.\" patch5: documents new -F option
-.\" patch5: random typo fixes
-.\"
-.\" Revision 3.0.1.1 1993/12/15 09:03:44 ram
-.\" patch3: typo and minor fixes
-.\"
-.\" Revision 3.0 1993/11/29 13:48:27 ram
-.\" Baseline for mailagent 3.0 netwide release.
-.\"
+''' @(#) Manual page for mailagent's filter -- (c) ram February 1991
+'''
+''' $Id$
+'''
+''' Copyright (c) 1990-2006, Raphael Manfredi
+'''
+''' You may redistribute only under the terms of the Artistic License,
+''' as specified in the README file that comes with the distribution.
+''' You may reuse parts of this distribution only within the terms of
+''' that same Artistic License; a copy of which may be found at the root
+''' of the source tree for mailagent 3.0.
+'''
+''' $Log: mailagent.SH,v $
+''' Revision 3.0.1.26 2001/03/17 18:08:30 ram
+''' patch72: documented new config vars: domain and hidenet
+''' patch72: various fixes from bug reports on Debian
+'''
+''' Revision 3.0.1.25 2001/03/13 13:10:47 ram
+''' patch71: documented SUBST/TR on header fields
+'''
+''' Revision 3.0.1.24 2001/01/10 16:51:38 ram
+''' patch69: changed semantics of "tome"
+''' patch69: updated POST to current practices
+''' patch69: documented biffing macros for news article
+'''
+''' Revision 3.0.1.23 1999/07/12 13:46:20 ram
+''' patch66: variables are now propagated back and forth through APPLY
+''' patch66: updated my e-mail address
+'''
+''' Revision 3.0.1.22 1999/01/13 18:10:52 ram
+''' patch64: added %Y macro for 4-digit year output
+''' patch64: agent.wait file moved from Queue to Spool
+'''
+''' Revision 3.0.1.21 1998/07/28 16:59:10 ram
+''' patch62: documented new "servshell" variable
+'''
+''' Revision 3.0.1.20 1998/03/31 14:40:01 ram
+''' patch59: added "vacfixed" and "tofake" configuration parameters
+''' patch59: new ON command to issue commands on certain days only
+''' patch59: the SERVER "set" command can now list defined variables
+''' patch59: added an example of alternate VACATION message selection
+'''
+''' Revision 3.0.1.19 1997/09/15 15:07:18 ram
+''' patch57: new -t and -f options for BEGIN and NOP
+''' patch57: all command options should now be output in bold
+''' patch57: documented _CALLOUT_ working state for callout queue
+'''
+''' Revision 3.0.1.18 1997/02/20 11:40:44 ram
+''' patch55: documents new execsafe, groupsafe and lockwarn variables
+''' patch55: the C filter can now redirect output via -o
+''' patch55: made it explicit that /pattern/i is legal
+'''
+''' Revision 3.0.1.17 1997/01/07 18:29:18 ram
+''' patch52: documented new execsafe configuration variable
+'''
+''' Revision 3.0.1.16 1996/12/24 14:12:58 ram
+''' patch45: examples are now shown in constant-width font if possible
+''' patch45: big emphasis about security issues, for RUN commands & filter
+''' patch45: new Relayed: pseudo header computations
+''' patch45: documented the %-H biffing macro with more details
+''' patch45: updated my e-mail address
+'''
+''' Revision 3.0.1.15 1995/09/15 13:56:30 ram
+''' patch43: folder compression can now deal with various compressors
+''' patch43: added locksafe, compspecs and comptag config variables
+''' patch43: many typo fixes
+'''
+''' Revision 3.0.1.14 1995/08/31 16:27:44 ram
+''' patch42: escaped various dollars to avoid shell substitution, grrr...
+'''
+''' Revision 3.0.1.13 1995/08/07 16:14:23 ram
+''' patch37: new biffing features and configuration variables
+''' patch37: new BIFF filtering command to dynamically configure biffing
+'''
+''' Revision 3.0.1.12 1995/03/21 12:56:05 ram
+''' patch35: sample vacation message now contains a Precedence: header
+'''
+''' Revision 3.0.1.11 1995/02/16 14:28:45 ram
+''' patch32: documents new -I switch and new fromfake config variable
+''' patch32: random cleanup, mainly suppressing spurious "the" articles
+'''
+''' Revision 3.0.1.10 1995/01/25 15:17:42 ram
+''' patch27: new option letter 't' for mailagent -s
+''' patch27: new commands BEEP and PROTECT
+''' patch27: new macro %a for biff messages
+'''
+''' Revision 3.0.1.9 1995/01/03 18:01:53 ram
+''' patch24: new -u option for ANNOTATE documented
+''' patch24: fixed example on the shell server command (power checking)
+''' patch24: removed quotes for SERVER -d to accommodate new option parsing
+''' patch24: added a -l switch to VACATION and extended its arguments
+''' patch24: new section documenting Rule Environment variables
+'''
+''' Revision 3.0.1.8 1994/10/29 17:41:41 ram
+''' patch20: documents the six new config variables for biffing
+''' patch20: new section dedicated to built-in mail biffing
+'''
+''' Revision 3.0.1.7 1994/10/10 10:23:36 ram
+''' patch19: typo fix
+'''
+''' Revision 3.0.1.6 1994/10/04 17:41:47 ram
+''' patch17: documents new email and mboxlock config parameters
+''' patch17: documents ~/agent.trace file and callout queue file name
+''' patch17: new %e macro available to get user's e-mail address
+''' patch17: mentions that the msgpath variable is read-only
+'''
+''' Revision 3.0.1.5 1994/09/22 13:57:09 ram
+''' patch12: documents new config parameters callout and linkdirs
+''' patch12: new filtering actions AFTER and DO
+''' patch12: variable msgpath is now defined within a PERL escape
+''' patch12: mention that PERL escape variables are available to new commands
+'''
+''' Revision 3.0.1.4 1994/07/01 14:56:20 ram
+''' patch8: documents new eleven configuration variables
+''' patch8: sub-section on timeouts has been expanded
+''' patch8: emphasize .forward optimization danger with sendmail
+''' patch8: new UMASK command
+'''
+''' Revision 3.0.1.3 1994/04/25 15:15:56 ram
+''' patch7: documented new 'fromesc' config variable
+''' patch7: forgot to insert the new -F option in the synopsis line
+'''
+''' Revision 3.0.1.2 1994/01/26 09:29:24 ram
+''' patch5: documents new tag feature for UNIQUE and RECORD
+''' patch5: documents new -F option
+''' patch5: random typo fixes
+'''
+''' Revision 3.0.1.1 1993/12/15 09:03:44 ram
+''' patch3: typo and minor fixes
+'''
+''' Revision 3.0 1993/11/29 13:48:27 ram
+''' Baseline for mailagent 3.0 netwide release.
+'''
.de Ex \" Start of Example
.sp
.in +5
@@ -186,7 +186,7 @@ There is a set of options which may be used when you invoke
\fImailagent\fR yourself. Please refer to the \fBOPTIONS\fR section for
a complete description. You may use the \fB\-h\fR option to get a cryptic
usage reminder.
-.\"
+'''
.SS Product Overview
.PP
.I Mailagent
@@ -225,7 +225,7 @@ It is possible to extend the mailagent filtering commands by implementing
them in \fIperl\fR and then having them automagically loaded when used. Those
extended commands will behave exactly like built in ones, as documented
in the \fBEXTENDING FILTERING COMMANDS\fR section.
-.\"
+'''
.SS Learning From Examples
.PP
It is quite possible that you will find this manual page too complex for you.
@@ -234,9 +234,9 @@ material. If you wish, you may start by looking at the examples held in the
distribution source tree under \fIagent/examples\fR. This directory contains
two examples of rule files (look at the README file first) and are verbosely
commented.
-.\"
-.\" G e t t i n g S t a r t e d
-.\"
+'''
+''' G e t t i n g S t a r t e d
+'''
.SH "GETTING STARTED"
.PP
First, you need to install a minimum configuration and see how it works. It
@@ -245,7 +245,7 @@ not work as advertised...
.PP
To start the installation, you have to set up a \fI~/.mailagent\fR file which is
the main configuration file, and choose the right \fIfilter\fR program.
-.\"
+'''
.SS "Choosing The Filter Program"
.PP
The distribution comes with two filter programs. One written in shell and one
@@ -283,7 +283,7 @@ As of version 3.0 PL44, I advise you to prefer the C version if you are
concerned about security. If you are in a position where multiple architectures
can process your \fI.forward\fR, then a shell wrapper selecting the proper
executable based on the architecture will be required.
-.\"
+'''
.SS "Configuring Mailagent"
.PP
If \fImailagent\fR is in your path, you may automatically configure a default
@@ -338,6 +338,10 @@ Whether or not biffing is wanted when \fImailagent\fR delivers mail to
a folder. Set it to ON (case insensitively) to allow local biffing if you
are logged in. (optional, defaults to: OFF)
.TP
+.I biffchars
+The charset to use when biffing on the terminal. Set it to utf-8 if you are
+using UTF-8 terminals. (optional, defaults to: iso-8859-1).
+.TP
.I biffhead
When biffing is enabled, this variable lists which headers should be
printed out. Headers should be given in their normalized format and
@@ -847,7 +851,7 @@ force one unique message (optional, defaults to: OFF).
The minimum time elapsed between two vacation messages to a given address
(suggested: 1d).
.PD
-.\"
+'''
.SS "Available Logging Levels"
.PP
The following log levels can be used while running mailagent:
@@ -866,7 +870,7 @@ The following log levels can be used while running mailagent:
19 Verbose
20 Lot more verbose
.Ef
-.\"
+'''
.SS "Plugging Mailagent"
.PP
Once you have configured mailagent in a \fI~/.mailagent\fR (where \fI~\fR
@@ -1025,9 +1029,9 @@ for local processing, to avoid an excessive workload on the \fImailhost\fR
machine, especially if it is a dedicated NFS server. If you are a system
administrator installing \fImailagent\fR and expect many people to use it,
keep this in mind.
-.\"
-.\" O p t i o n s
-.\"
+'''
+''' O p t i o n s
+'''
.SH OPTIONS
There is a limited set of options which may be used when calling the
mailagent directly. Only one special option at a time may be specified.
@@ -1177,7 +1181,7 @@ should return a zero exit status).
.PP
If you do not want to use the default rules, you may skip the remaining of this
section.
-.\"
+'''
.SS "Configuring Help"
.PP
The help text mailagent will send to people must be copied from
@@ -1194,7 +1198,7 @@ files back (parameter \fImaxsize\fR in your \fI~/.mailagent\fR file\fR).
.PP
You may use the default help file or design one that will give even more
details to the poor user.
-.\"
+'''
.SS "Distribution Files"
.PP
The two files \fIproglist\fR and \fIdistribs\fR held in \fILib/mailagent\fR
@@ -1246,7 +1250,7 @@ directory.
.PP
You may include comments in both files: all lines starting with a leading
# will be ignored.
-.\"
+'''
.SS "Testing Your Mail Agent"
.PP
It is now time to make sure your mailagent works. Send yourself the following
@@ -1281,9 +1285,9 @@ your mailagent's configuration. Retry with a log level set to 20 and look
at the issued log messages in your Log directory. Make sure that the file
listed in the \fIplsave\fR entry of your \fI~/.mailagent\fR is correctly
updated after a \fImaillist\fR has been run.
-.\"
-.\" F i l t e r i n g R u l e s
-.\"
+'''
+''' F i l t e r i n g R u l e s
+'''
.SH "USING THE FILTER"
The \fImailagent\fR can also be used as a filter: mail is parsed and some
actions are taken based on simple \fIlex\fR-like rules. Actions range from
@@ -1313,7 +1317,8 @@ for instance, no '{' may be used as part of an address.
.PP
Comments are introduced by a leading '#' , which must be on the left margin.
Unlike shell comments, a '#' which is not left justified will not be understood
-as a comment. However, spaces or tabs are allowed in front of '#'.
+as a comment, unless there is a space following '#'.
+Spaces or tabs are allowed in front of '#'.
.PP
All the statements in the rule file must end with a ';'. There are mainly
four parts in each line. A list of comma separated modes, between '<' and '>',
@@ -1490,7 +1495,7 @@ From:
Note the use of the file inclusion: all the users listed in file \fIusers\fR
will have their mail left in the system mailbox. The usual rules apply for
these loaded patterns.
-.\"
+'''
.SS "Selector Combination"
.PP
A single rule may have a various set of selectors. For instance, in the
@@ -1587,7 +1592,7 @@ From: !ram, !root
# Matches if \fIram\fR is listed in the \fITo\fR OR the \fICc\fR line
To Cc: ram
.Ef
-.\"
+'''
.SS "Minimal Header"
.PP
A minimal set of selectors are guaranteed to be set, regardless of the
@@ -1636,7 +1641,7 @@ Where any reply should be sent. If no \fIReply-To:\fR field is present, then
the \fIReturn-Path\fR is used (with <> stripped out), or the \fIFrom:\fR
line is parsed to extract the e-mail address of the author.
.PD
-.\"
+'''
.SS "Variables"
.PP
The mailagent supports user-defined variables, which are globals. They are
@@ -1701,7 +1706,7 @@ There is currently no way for erasing a variable from the database. But if
you do not use the variable any more, it will be removed when its age
becomes greater than the maximum age specified by the \fIagemax\fR configuration
variable.
-.\"
+'''
.SS "Regular Expressions"
.PP
All the regular expressions follow the V8 syntax, as in \fIperl\fR, with all
@@ -1768,7 +1773,7 @@ then it might be worth knowing that all the set of matching selectors are
recorded within %&, each set terminated with a ';'. If a negated selector is
used, then %& will record all the fields which did not contain the pattern,
assuming the selection succeeded (otherwise nothing is recorded).
-.\"
+'''
.SS "Available Actions"
.PP
The following actions are available as filtering commands. Case is irrelevant
@@ -2430,7 +2435,7 @@ previous one. This is useful to store output of system commands ran by
\fIcron\fR. Don't try to use it with an MH folder or a directory folder or
it will behave like SAVE.
(Fails if message cannot be written)
-.\"
+'''
.SS "Execution Status"
.PP
Almost all the actions modify a variable which keeps track of the execution
@@ -2451,7 +2456,7 @@ It is unfortunate that ONCE or SELECT commands cannot make the difference
between a non-execution and a successful execution of the specified command.
There may be a change in the way this scheme works, but it should remain
backward compatible.
-.\"
+'''
.SS "Perl Escape"
.PP
By using the PERL command, you have the ability to perform filtering and other
@@ -2626,7 +2631,7 @@ mailagent and directly calling the routines you need. If it is not documented
in the manual page, it may be changed without notice by any further patch.
(And this does not say that documented features may not change also... It's
just more unlikely, and patches would clearly state that, of course.)
-.\"
+'''
.SS "Program Environment"
.PP
All the programs started by mailagent via RUN and friends inherit the
@@ -2639,7 +2644,7 @@ set PATH (if you are using the shell filter).
All the programs are executed from within the \fIhome\fR directory. This
includes scripts started via the PERL command and mail hooks. The latter will
be described in detail further down.
-.\"
+'''
.SS "File inclusion"
.PP
Some commands like FORWARD or KEEP allow you to specify a file name between
@@ -2653,7 +2658,7 @@ will be reported.
The file should list each parameter (be it an address, a header or a pattern)
on a line by itself. Shell-style comments (#) are allowed within that file and
leading white spaces are trimmed (but not trailing spaces).
-.\"
+'''
.SS "Macros Substitutions"
.PP
All the commands go through a macro substitution mechanism before being
@@ -2776,7 +2781,7 @@ Year (last two digits)
%[To]
Value of the header field (here To:)
.PD
-.\"
+'''
.SS "User-defined Macros"
.PP
The mailagent lets you define your own macros in two ways: at the filter
@@ -2856,7 +2861,7 @@ At the filter level, the MACRO command has three options. By default,
the command defines a new macro by using \fIpush\fR, and the other
options each let you access one of the other interface functions.
Note that macro definitions persist across APPLY commands.
-.\"
+'''
.SS "User-defined Logging"
.PP
Most of the time when writing a new mailagent filtering command or an
@@ -2893,7 +2898,7 @@ option will not be honored in that case. This may or may not be useful to you.
If you call \fI&main'usr_log\fR with a non-existent logfile name, logging
is redirected to the default system-wide logfile defined in your
\fI~/.mailagent\fR.
-.\"
+'''
.SS "Dynamically Loading New Code"
.PP
In you perl routines (user-defined commands, perl hooks, etc...), you may
@@ -2929,7 +2934,7 @@ The routine returns \fIundef\fR if the file cannot be loaded
(non-existent file, most probably), \fB0\fR if the file was loaded but
contained a syntax error or did not define the specified function, and \fB1\fR
for success.
-.\"
+'''
.SS "Using Once Commands"
.PP
The ONCE constructs lets you specify a given command to be run once every
@@ -2963,7 +2968,7 @@ but that would be likely to be less efficient, as the first hashing would be
done on a fixed word, hence all the timestamps would be located in the file
\fIHash/m/e\fR (where \fIHash\fR is the name of your hashing directory, which
is the \fIhash\fR parameter in the configuration file).
-.\"
+'''
.SS "Using Tags in Record and Unique"
.PP
Both the RECORD and UNIQUE commands let you specify a comma-separated tag list
@@ -3013,7 +3018,7 @@ To Cc: agent-users {
If you have some rule using UNIQUE without any
tags, it will match when at least one instance of the message has been
recorded, no matter what tag (if any at all) was used in the first place.
-.\"
+'''
.SS "Specifying A Period"
.PP
The period parameter of the ONCE commands or the \fIvacperiod\fR parameter
@@ -3046,7 +3051,7 @@ year (365 days)
All the periods are converted internally in seconds, although you do not
really care... Examples of valid periods range from "1m" to "136y" on a 32 bits
machine (why ?).
-.\"
+'''
.SS "Timeouts"
.PP
In order to avoid having a \fImailagent\fR waiting for a command forever, a
@@ -3085,7 +3090,7 @@ lock. If you want a secure locking policy, make sure
times
.I lockdelay
is greater than \fIlockhold\fR, that parameter being "large" enough.
-.\"
+'''
.SS "Avoiding Loops"
.PP
The \fImailagent\fR leaves an "X-Filter:" header on each filtered message,
@@ -3111,7 +3116,7 @@ do
add that header line. You can add one via ANNOTATE if you wish to prevent
loops, in case the program to which you are feeding the message might
return it to you in some strange way.
-.\"
+'''
.SS "Message Files"
.PP
The text of the message to be sent back (for MESSAGE or NOTIFY) is read from
@@ -3324,13 +3329,13 @@ concerned).
For those hooks which are finally ran by perl, the special @INC array has
mailagent's own private library path prepended to it, so that \fIrequire\fR
first looks in this place.
-.\"
-.\" F o l d e r s
-.\"
+'''
+''' F o l d e r s
+'''
.SH "FOLDERS"
A folder is a file or a directory which can be the target of a delivery by the
mailagent, that is to say the argument of SAVE-like commands.
-.\"
+'''
.SS "Folder Format"
.PP
By default, mails are written into folders according to the standard UNIX-style
@@ -3366,7 +3371,7 @@ line is used to specify the base name of the message, then a number is
appended to give the name of the message file to use. That is, if there is
no such file, the folder will look like an MH one, without any MH sequence
file though.
-.\"
+'''
.SS "Folder Compression"
.PP
If you have one or more of the widely available file compression
@@ -3463,9 +3468,9 @@ made automatically to the plain file.
.PP
On newly created folders the \fIcomptag\fR configuration variable is
referenced to determine the compression type to use for the folder.
-.\"
-.\" M a i l B i f f i n g
-.\"
+'''
+''' M a i l B i f f i n g
+'''
.SH MAIL BIFFING
If you are receiving and processing mail on your own machine, then you have
access to local mail biffing where \fImailagent\fR can warn you about new
@@ -3657,14 +3662,14 @@ randomly and this may make reading difficult. You may request an automatic
reformatting of the compacted body by turning \fIbiffnice\fR to ON and the
biff output will fit nicely within the terminal.
.PP
-Unfortunately, it is not possible to customize the amount of columns that
-should be used for formatting: since you may biff to any tty you are logged
-on, that would force \fImailagent\fR to probe the tty for its column size,
-for each possible tty where output may go, and there is no reliable portable
-way of doing that. Sorry.
-.\"
-.\" E x t e n d i n g F i l t e r i n g C o m m a n d s
-.\"
+To make \fIbiffnice\fR really nice, \fImailagent\fR probes each tty (those
+where biffing was turned on) for its size and uses that information to drive
+formatting of the output. Note that you can set \fIbiffnice\fR even
+when \fIbiffmh\fR is OFF. This really helps maximizing the amount of body
+text displayed.
+'''
+''' E x t e n d i n g F i l t e r i n g C o m m a n d s
+'''
.SH EXTENDING FILTERING COMMANDS
Once you've reached the \fIexpert\fR level, and provided you have a fair
knowledge of \fIperl\fR, you may feel the need for more advanced commands
@@ -3684,7 +3689,7 @@ in an interpreted language like \fIperl\fR. This of course once you have
convinced yourself that it is a Good Thing to customize and extend a program
in the same language as the one used for the core, meaning usually a fairly
low-level language with fewer user-friendly hooks.
-.\"
+'''
.SS Overview
.PP
In order to implement a new command, say FOLD, you will need to do the
@@ -3714,7 +3719,7 @@ you within the \fImailhook\fR package).
In the following sections, we're going to describe the syntax of the
\fInewcmd\fR file, and we'll then present some low-level internal variables
which may be used when implementing new commands.
-.\"
+'''
.SS New Command File Format
.PP
The \fInewcmd\fR file consists of a series of lines, each line describing
@@ -3751,7 +3756,7 @@ FOLD ~/mail/cmds/fold.pl fold no yes
.Ef
to allow FOLD even in _SEEN_ state and have it executed without modifying
the current value of the \fIlast-command-status\fR variable.
-.\"
+'''
.SS Writing An Implementation
.PP
Your perl function will be loaded when needed into the special package
@@ -3795,7 +3800,7 @@ safely use \fIdie\fR or call external library routines that use \fIdie\fR.
If you use \fIrequire\fR, be aware that mailagent is setting up a special
\fI@INC\fR array by putting its private library path first, so you may place
all your \fImailagent\fR-related library files in this place.
-.\"
+'''
.SS Special Variables
.PP
The following special variables (some of them marked read-only, meaning you
@@ -3855,7 +3860,7 @@ the suitable X-Filter line that should be appended in \fBall\fR the mail you
send via mailagent, in order to avoid loops. Also when you save mails
to a folder, it's wise adding this line in case a problem arises: you may
then identify the culprit.
-.\"
+'''
.SS Rule Environment
.PP
An action might have a legitimate desire of altering the environment for
@@ -3902,7 +3907,7 @@ its processing to initialize the \fIenv\fR package, and \fI&env'cleanup\fR
at the end before returning. Before running the actions specified on a rule
match, \fI&apply_rules\fR calls \fI&env'restore\fR to ensure a coherent
view of the environment while running the actions for that particular rule.
-.\"
+'''
.SS Altering Control Flow
.PP
When you want to alter control flow to perform a REJECT, a RESTART or an
@@ -3926,7 +3931,7 @@ The preferred way is to invoke the \fImailhook\fR interface functions,
\fI&mailhook'begin\fR, \fI&mailhook'reject\fR, etc..., and that will work
even if you redefine those functions yourself. Besides, that's the only
interface which is likely not to be changed by new versions.
-.\"
+'''
.SS General Purpose Routines
.PP
The following is a list of all the general routines you may wish to call when
@@ -4055,7 +4060,7 @@ once finished, and ABORT is perl's \fIdie\fR.
You may also use the three functions from the \fIextern\fR package which
manipulate persistent variables (already documented in the section dealing
with variables) as well as the user-defined macro routines.
-.\"
+'''
.SS Example
.PP
Writing your own commands is not easy, since it requires some basic knowledge
@@ -4114,7 +4119,7 @@ it has been bounced. Indeed, should the SENDBACK action be the only one
action to be run, we do not want mailagent to LEAVE the mail in the
mailbox because it has never been saved (this default behavior being
a precaution only -- better safe than sorry).
-.\"
+'''
.SS Conclusion
.PP
If along the way you imagine some useful commands which could be made
@@ -4134,9 +4139,9 @@ code, the mailagent providing a fixed and reliable frame and the external
program providing the service. One immediate extension would be mailing
list handling, using this mechanism to interface with some mailing list
management software written in perl.
-.\"
-.\" G e n e r i c M a i l S e r v e r
-.\"
+'''
+''' G e n e r i c M a i l S e r v e r
+'''
.SH GENERIC MAIL SERVER
.PP
One nice thing about mailagent is that it provides you with the basic tools to
@@ -4151,7 +4156,7 @@ equivalent. There is no notion of modes, with separate command sets for
each mode or limited name-space visibility, at least for now, so it is not
easy (albeit possible) to implement an ftpmail server, for instance, since
this implies the notion of mode.
-.\"
+'''
.SS Overview
In order to implement a mail server command (say send \fIfile\fR, which
would send an arbitrary file from the file system in a separate mail message),
@@ -4190,7 +4195,7 @@ Start using the command... which of course is the nicest part in this scheme!
In the following sections, we'll learn about the syntax of the \fIcomserver\fR
file, what \fIpowers\fR are, how the session transcript is built, what the
command environment is, etc...
-.\"
+'''
.SS Builtin Commands Overview
.PP
The mail server has a limited set of builtin commands, dealing with user
@@ -4251,7 +4256,7 @@ number of command that can be issued in one single message.
In case you think this \fImailagent\fR feature is dangerous for your account,
do not create the \fIroot\fR and \fIsecurity\fR powers, and do not write
any sensitive commands.
-.\"
+'''
.SS Builtin Commands Definition
.PP
Now let's have a look at those builtin commands. Passwords of sensitive
@@ -4360,7 +4365,7 @@ use of that information. If no command is specified, the new identity is
assumed until changed by another \fIuser\fR command and all the powers
currently held by the user are released. If no \fIe-mail\fR address
is given, the original user ID is restored.
-.\"
+'''
.SS Command Environment
.PP
There are six types of commands and variables that can be specified in server
@@ -4463,7 +4468,7 @@ clearance mechanism.
.I user
The effective user ID, originally the same as the uid, but may be changed
via the \fIuser\fR builtin command.
-.\"
+'''
.SS Session Transcript
.PP
A session transcript is mailed back automatically to the user who requested
@@ -4486,7 +4491,7 @@ commands, authentication based on that information is really weak. A more
"secure" authentication is provided by the server powers, which is
password-based. Unfortunately, the clear password has to be transmitted in the
message itself and could be eavesdropped.
-.\"
+'''
.SS Recording New Commands and Variables
.PP
Server commands and variables are defined in the \fIcomserver\fR file defined
@@ -4541,7 +4546,7 @@ function to call to execute the command; if none is specified, the name of
the command itself is called. Shell commands may use that field to supply
additional options, which will be inserted right after the command name and
before any other user-supplied arguments. Others should leave this alone.
-.\"
+'''
.SS Special Command Types
.PP
There are currently two special command types.
@@ -4560,7 +4565,7 @@ same name as the command itself. For example, assuming a command \fIshoot\fR,
its help file would be expected in \fIhelpdir/shoot\fR. If no file is found
there, mailagent looks in its public library ($privlibexp) for an help file.
Help is provided only when the help file exists and is not zero-sized.
-.\"
+'''
.SS Creating the Root Power
.PP
In order to bootstrap the server, you need to create the root power. All the
@@ -4653,7 +4658,7 @@ should be prohibited and access to \fIcron\fR forbidden in order to avoid
automatic mail processing (since it would be possible to have cron invoke
a \fImailagent\fR process \-or any other program for that matter\- to process
the incoming mail in a comparable way).
-.\"
+'''
.SS Example
.PP
Here is an example showing the steps involved in creating a \fIshell\fR
@@ -4797,7 +4802,7 @@ End of processing (.signature)
The first invocation of the \fIshell\fR command fails since we lack the
\fIshell\fR power. The string "Permission denied." is echoed by the
command itself into file descriptor #3 and makes it to the transcript.
-.\"
+'''
.SS Conclusion
.PP
The generic mail server implemented in mailagent can be used to
diff --git a/agent/man/mailhelp.SH b/agent/man/mailhelp.SH
index 1bd7f5b..5badf83 100755
--- a/agent/man/mailhelp.SH
+++ b/agent/man/mailhelp.SH
@@ -18,31 +18,31 @@ echo "Extracting agent/man/mailhelp.$manext (with variable substitutions)"
$rm -f mailhelp.$manext
$spitshell >mailhelp.$manext <<!GROK!THIS!
.TH MAILHELP $manext ram
-.\" @(#) Manual page for mailagent's commands -- (c) ram February 1991
-.\"
-.\" $Id: mailhelp.SH 75 2011-12-23 10:18:37Z rmanfredi $
-.\"
-.\" Copyright (c) 1990-2006, Raphael Manfredi
-.\"
-.\" You may redistribute only under the terms of the Artistic License,
-.\" as specified in the README file that comes with the distribution.
-.\" You may reuse parts of this distribution only within the terms of
-.\" that same Artistic License; a copy of which may be found at the root
-.\" of the source tree for mailagent 3.0.
-.\"
-.\" $Log: mailhelp.SH,v $
-.\" Revision 3.0.1.3 1999/07/12 13:46:52 ram
-.\" patch66: updated my e-mail address
-.\"
-.\" Revision 3.0.1.2 1996/12/24 14:41:59 ram
-.\" patch45: documented command forwarding
-.\"
-.\" Revision 3.0.1.1 1995/08/07 16:14:40 ram
-.\" patch37: updated my e-mail address
-.\"
-.\" Revision 3.0 1993/11/29 13:48:29 ram
-.\" Baseline for mailagent 3.0 netwide release.
-.\"
+''' @(#) Manual page for mailagent's commands -- (c) ram February 1991
+'''
+''' $Id$
+'''
+''' Copyright (c) 1990-2006, Raphael Manfredi
+'''
+''' You may redistribute only under the terms of the Artistic License,
+''' as specified in the README file that comes with the distribution.
+''' You may reuse parts of this distribution only within the terms of
+''' that same Artistic License; a copy of which may be found at the root
+''' of the source tree for mailagent 3.0.
+'''
+''' $Log: mailhelp.SH,v $
+''' Revision 3.0.1.3 1999/07/12 13:46:52 ram
+''' patch66: updated my e-mail address
+'''
+''' Revision 3.0.1.2 1996/12/24 14:41:59 ram
+''' patch45: documented command forwarding
+'''
+''' Revision 3.0.1.1 1995/08/07 16:14:40 ram
+''' patch37: updated my e-mail address
+'''
+''' Revision 3.0 1993/11/29 13:48:29 ram
+''' Baseline for mailagent 3.0 netwide release.
+'''
.SH NAME
maildist, mailhelp, maillist, mailpatch \- mailagent's commands
.SH SYNOPSIS
diff --git a/agent/package.SH b/agent/package.SH
index e2f3a9a..5746849 100755
--- a/agent/package.SH
+++ b/agent/package.SH
@@ -23,7 +23,7 @@ $startperl
eval 'exec perl -S \$0 \${1+"\$@"}'
if \$running_under_some_shell;
-# $Id: package.SH 47 2008-06-26 19:18:00Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/pl/acs_rqst.pl b/agent/pl/acs_rqst.pl
index 4b0f942..64dc61a 100644
--- a/agent/pl/acs_rqst.pl
+++ b/agent/pl/acs_rqst.pl
@@ -1,4 +1,4 @@
-;# $Id: acs_rqst.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/actions.pl b/agent/pl/actions.pl
index 3ea521a..b6357bc 100644
--- a/agent/pl/actions.pl
+++ b/agent/pl/actions.pl
@@ -1,4 +1,4 @@
-;# $Id: actions.pl 77 2012-01-08 23:55:16Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
@@ -766,7 +766,7 @@ sub post {
my ($faddr, $fcom) = &parse_address($Header{'From'});
$fcom = '"' . $fcom . '"' if $fcom =~ /[@.\(\)<>,:!\/=;]/;
if ($fcom ne '') {
- print NEWS header'news_fmt("From: $fcom <$faddr>\n");
+ print NEWS header::news_fmt("From: $fcom <$faddr>\n");
} else {
print NEWS "From: $faddr\n";
}
@@ -823,7 +823,7 @@ sub post {
} else {
my $subject = $Header{'Subject'};
$subject =~ tr/\n/ /; # Multiples instances collapsed
- print NEWS header'news_fmt("Subject: $subject\n");
+ print NEWS header::news_fmt("Subject: $subject\n");
}
# If no proper Message-ID is present, generate one
@@ -839,7 +839,7 @@ sub post {
# duplicate detection provided all feeds are done from mailagent
# But we also need to fix places using those message IDs, i.e.
# the References line, to preserve correct threading (see below).
- my $fixup = &header'msgid_cleanup(\$msgid);
+ my $fixup = header::msgid_cleanup(\$msgid);
&add_log("WARNING fixed Message-Id line for news")
if $loglvl > 5 && $fixup;
} else {
@@ -900,13 +900,11 @@ sub post {
$last_was_header = 1; # Mark we discarded the line
next; # Line is skipped
}
- s/^Sender:/Prev-Sender:/i;
- s/^(To|Cc):/X-$1:/i; # Keep distribution info
- s/^(Resent-\w+):/X-$1:/i;
# Skip any RFC-822 header that is not purely made up of [\w-]+
# as it is not possible it can be meaningful to the news system.
if (/^([!-9;-~\w-]+):/) {
my $header = $1;
+ $header = &header::normalize($header);
unless ($header =~ /^[\w-]+$/) {
&add_log("NOTICE droping RFC-822 header \"$header\" for news")
if $loglvl > 5;
@@ -914,7 +912,16 @@ sub post {
next; # Line is skipped
}
# All headers will now match /^[\w-]+:/
+ if ($Header{$header} =~ /^\s*$/) {
+ &add_log("NOTICE dropping empty header \"$header\" for news")
+ if $loglvl > 5;
+ $last_was_header = 1; # Mark we discarded the line
+ next; # Line is skipped
+ }
}
+ s/^Sender:/Prev-Sender:/i;
+ s/^(To|Cc):/X-$1:/i; # Keep distribution info
+ s/^(Resent-\w+):/X-$1:/i;
if (/^([\w-]+):/ && exists $single{"\L$1"}) {
my $field = lc($1);
if ($single{$field}++) {
@@ -936,7 +943,10 @@ sub post {
&add_log("NOTICE added space after \"$header:\", for news")
if $loglvl > 5;
}
- print NEWS header'news_fmt($_), "\n";
+ # We include the "\n" at the end of the string to let news_fmt()
+ # avoid emitting the line if it ends-up being a blank line: since
+ # we are emitting a header, that blank line would signal EOH.
+ print NEWS header::news_fmt("$_\n");
}
# For correct threading, we need a References: line.
@@ -964,14 +974,14 @@ sub post {
# INN does not like an empty References: line, even if properly
# followed by continuations. Therefore, cheat to force the message
# to have at least one ref on the line.
- print NEWS header'news_fmt("References: $refs\n");
+ print NEWS header::news_fmt("References: $refs\n");
}
# Any address included withing "" means addresses are stored in a file
$newsgroups = &complete_list($newsgroups, 'newsgroup');
$newsgroups =~ s/\s/,/g; # Cannot have spaces between them
$newsgroups =~ tr/,/,/s; # Squash down consecutive ','
- print NEWS header'news_fmt("Newsgroups: $newsgroups\n");
+ print NEWS header::news_fmt("Newsgroups: $newsgroups\n");
print NEWS "Distribution: local\n" if $localdist;
print NEWS $FILTER, "\n"; # Avoid loops: inews may forward to sendmail
print NEWS "\n";
diff --git a/agent/pl/add_log.pl b/agent/pl/add_log.pl
index a6690c0..a69b8d9 100644
--- a/agent/pl/add_log.pl
+++ b/agent/pl/add_log.pl
@@ -1,4 +1,4 @@
-;# $Id: add_log.pl 36 2008-06-11 10:42:08Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/addr.pl b/agent/pl/addr.pl
index 9b193d5..123cd4e 100644
--- a/agent/pl/addr.pl
+++ b/agent/pl/addr.pl
@@ -1,4 +1,4 @@
-;# $Id: addr.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/analyze.pl b/agent/pl/analyze.pl
index f9267b0..3604316 100644
--- a/agent/pl/analyze.pl
+++ b/agent/pl/analyze.pl
@@ -1,4 +1,4 @@
-;# $Id: analyze.pl 38 2008-06-13 09:32:24Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/base64.pl b/agent/pl/base64.pl
index ad8f2a8..c825fdf 100644
--- a/agent/pl/base64.pl
+++ b/agent/pl/base64.pl
@@ -1,4 +1,4 @@
-;# $Id: base64.pl 38 2008-06-13 09:32:24Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 2008, Raphael Manfredi
;#
diff --git a/agent/pl/biff.pl b/agent/pl/biff.pl
index 26eb37a..f48c971 100644
--- a/agent/pl/biff.pl
+++ b/agent/pl/biff.pl
@@ -1,4 +1,4 @@
-;# $Id: biff.pl 81 2015-02-12 18:10:21Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
@@ -40,6 +40,8 @@
# Local biff support
#
+use Encode;
+
# Perform biffing, given the folder where delivery was made print out a
# biff-like message on each of the user's terminal where a 'biff y' command
# was issued to effectively request biffing (i.e. on ttys where the 'x' bit
@@ -265,6 +267,16 @@ sub is_blank {
return $l =~ /^[\W_]*$/; # Contains only non-words and underscores
}
+# Keep only printable ASCII chars from biffable lines in specified body array
+# Control chars are swallowed, non-ASCII chars converted to '.'.
+sub to_ascii {
+ my ($aref, $lines) = @_; # Body as array ref, amount of lines to convert
+ my $n = $lines > @{$aref} ? @{$aref} : $lines;
+ for (my $i = 0; $i < $n; $i++) {
+ $aref->[$i] =~ s/(.)/mangle_ascii($1)/ge;
+ }
+}
+
# Print first $cf'bifflines lines or $cf'bifflen charaters, whichever
# comes first. Assumes TTY already opened correctly
# Also known as the %-B macro if called body(0), or %-T if called body(1).
@@ -280,14 +292,39 @@ sub body {
# Setting bifflen or bifflines to 0 means no body
return '' if $len == 0 || $lines == 0;
- my ($content, $entity);
+ my ($content, $entity, $enc, $biffenc);
($content, $entity) = unmime(\@body) if $'Header{'Mime-Version'};
- &'add_log("biffing $entity entity is $content")
- if length($content) && $'loglvl > 8;
+ my $convert_to_ascii = 0;
+ if (length($content)) {
+ &'add_log("biffing $entity entity is $content") if $'loglvl > 8;
+ my $charset;
+ $charset = $1 if $content =~ /\bcharset="?([-\w]+)/;
+ if (defined $charset) {
+ $enc = Encode::find_encoding($charset);
+ unless (ref $enc) {
+ &'add_log("WARNING unknown charset '$charset', handling as ASCII")
+ if $'loglvl > 1;
+ $convert_to_ascii = 1;
+ }
+
+ # If the encoding is the same as the one used in the terminal,
+ # we have no conversion to make. Reset $enc.
+ $biffenc = Encode::find_encoding($cf'biffchars);
+ $enc = undef if
+ !(ref $biffenc) ||
+ (ref $enc && $biffenc->name eq $enc->name);
+ }
+ }
+
+ if (ref $enc) {
+ &'add_log("biff converting " . $enc->name . " into " . $biffenc->name)
+ if $'loglvl > 8;
+ }
strip_html(\@body) if $content =~ /html\b/;
&trim(*body) if $trim; # Smart trim of leading reply text
+ to_ascii(\@body, $lines) if $convert_to_ascii;
&mh(*body, $len) if $cf'biffmh =~ /^on/i;
my $reformat = $cf'biffnice =~ /^on/i;
@@ -295,6 +332,10 @@ sub body {
my $tl = 8; # tab length
while ($len > 0 && $lines > 0 && defined ($_ = shift(@body))) {
+ if (ref $enc) {
+ my $data = $enc->decode($_);
+ $_ = $biffenc->encode($data);
+ }
next if $skipnl && is_blank($_);
my $line_length = 0;
1 while s|\t|' ' x ($tl - length($`) % $tl)|e; # Expand tabs
@@ -487,24 +528,139 @@ sub format {
push(@ary, $body); # Remaining information on one line
}
-# One-liner quoted-printable decoder
-# MUST be on one line to not be dataloaded (would mess $1 in the regexp)
-sub to_txt { my $l = shift; $l =~ s/=([\da-fA-F]{2})/pack('C', hex($1))/ge; $l }
+# Perload OFF
+
+# Mangle given character to ASCII, or swallow it if CTRL char
+# MUST NOT be dataloaded (would mess $1 in the regexp)
+sub mangle_ascii {
+ my ($x) = @_;
+ my $c = unpack("U", $x); # Read as Unicode
+ return '' if $c <= 8; # Invisible
+ # Chars 9 and 10 are \t and \n in ASCII
+ return '' if $c >= 11 && $c < 32; # Invisible
+ return '.' if $c >= 127; # Outside the ASCII range
+ return pack("C", $c); # Write as a byte (ASCII)
+}
+
+# Quoted-printable decoder
+# MUST NOT be dataloaded (would mess $1 in the regexp)
+sub to_txt {
+ my ($c, $l) = @_; # charset, line
+ $l =~ s/=([\da-fA-F]{2})/pack('C', hex($1))/ge;
+ my $enc = Encode::find_encoding($c);
+ my $biffenc = Encode::find_encoding($cf'biffchars);
+ if (ref $enc && ref $biffenc && $enc->name ne $biffenc->name) {
+ my $data = $enc->decode($l);
+ $data = $biffenc->encode($data);
+ $l = $data if length $data;
+ }
+ return $l;
+}
+
+# Base64 decoder
+# MUST NOT be dataloaded (would mess $1 in the regexp)
+sub b64_to_txt {
+ my ($c, $l) = @_; # charset, line
+ base64'reset(length $l);
+ base64'decode($l);
+ my $o = base64'output();
+ my $enc = Encode::find_encoding($c);
+ my $biffenc = Encode::find_encoding($cf'biffchars);
+ if (ref $enc && ref $biffenc && $enc->name ne $biffenc->name) {
+ my $data = $enc->decode($$o);
+ $data = $biffenc->encode($data);
+ $l = $data if length $data;
+ }
+ return $l;
+}
+
+# Perload ON
# Quick removal of quoted-printable escapes within the headers
-# We do not care about the charset and hope the tty will be able to display
-# the characters just fine.
+# We pay attention to the charset and recode data to the charset specified
+# as "biffchars" in the configuration.
sub unquote_printable {
my ($l) = @_;
# The to_txt() routine being used MUST NOT be dataloaded or $1 would be
# reset to '' on the first invocation. It's a perl bug (seen in 5.10)
- $l =~ s/=\?[\w-]+?\?Q\?(.*?)\?=\s*/to_txt($1)/sieg && $l =~ s/_/ /g;
+ # By precaution, we also do not dataload b64_to_txt().
+ $l =~ s/=\?([\w-]+)\?Q\?(.*?)\?=/to_txt($1,$2)/sieg && $l =~ s/_/ /g;
+ $l =~ s/=\?([\w-]+)\?B\?(.*?)\?=/b64_to_txt($1,$2)/sieg;
&'add_log("unquoted '$_[0]' to '$l'") if $'loglvl > 19 && $_[0] ne $l;
return $l;
}
-# Un-MIME the body by removing all the MIME headers and looking for the
-# first text entity in the message.
+# Recursive MIME parsing to extract the first text entity content
+#
+# Input is (aref, eref, boundary, n)
+# where:
+# aref is the array containing the body being parsed
+# eref is where we can stuff the entity content
+# boundary is the current MIME boundary
+# n is the running count of the entity number
+#
+# Returns (content_type, parsed_header, n)
+# where:
+# content_type is the retained entity content-type
+# parsed_header is a ref on the parsed header hashtable
+# n is the entity number
+sub unmime_recursive {
+ my ($aref, $eref, $boundary, $n) = @_;
+
+ &'add_log("searching text part for biffing, boundary=$boundary, n=$n")
+ if $'loglvl > 16;
+
+ my $entity_content;
+ my $header;
+ my $grabbed = 0;
+
+ for (;;) {
+ unless ($grabbed) {
+ last unless skip_past($aref, $boundary);
+ }
+ $grabbed = 0;
+ $header = parse_header($aref);
+ my $content = lc($header->{'Content-Type'});
+ $content =~ s/\(.*?\)\s*//g;
+ &'add_log("parsed entity header: content is $content") if $'loglvl > 19;
+ $n++;
+ if ($content =~ m|^text/|) {
+ # We found (another) text part, collect it...
+ &'add_log("collecing text n=$n") if $'loglvl > 19;
+ my @entity;
+ my $end = !skip_past($aref, $boundary, \@entity);
+ $grabbed = 1; # Avoid skipping at next loop iteration
+ if (
+ $end ||
+ $content =~ m|^text/plain\b| # Found the best one
+ ) {
+ @$eref = @entity;
+ $entity_content = $content;
+ &'add_log("done with n=$n, content=$content") if $'loglvl > 19;
+ last;
+ }
+ } elsif ($content =~ m|^multipart/|) {
+ my ($bound) = $content =~ /boundary=(\S+);/;
+ ($bound) = $content =~ /boundary=(\S+)/ unless length $bound;
+ $bound = $1 if $bound =~ /^"(.*)"/ || $bound =~ /^'(.*)'/;
+ &'add_log("collecing recursively n=$n, boundary=$bound")
+ if $'loglvl > 19;
+
+ ($entity_content, $header, $n) =
+ unmime_recursive($aref, $eref, $bound, $n);
+
+ if ($entity_content =~ m|^text/plain\b|) {
+ &'add_log("done with n=$n, content=$content") if $'loglvl > 19;
+ last;
+ }
+ }
+ }
+
+ return ($entity_content, $header, $n);
+}
+
+# Un-MIME the body by removing all the embedded MIME part stuff and looking
+# for the first text entity in the message.
# The supplied array is updated in-place and will contain on return the
# lines of the MIME entity that was retained.
# Returns the type of the retained MIME entity and the number of the entity
@@ -522,38 +678,14 @@ sub unmime {
($boundary) = $content =~ /boundary=(\S+)/ unless length $boundary;
$boundary = $1 if $boundary =~ /^"(.*)"/ || $boundary =~ /^'(.*)'/;
- # We do not perform a recursive MIME parsing here
-
- my $entity_content;
- my $header;
-
- &'add_log("searching text part for biffing, boundary=$boundary")
- if $'loglvl > 16;
+ # We perform a recursive MIME parsing here because the first part of
+ # the message could be a multipart/alternative, with sub MIME sections
+ # containing the text entity we're looking for.
+ # --RAM, 2016-09-14
my @entity;
- my $grabbed = 0;
- my $n = 0;
-
- for (;;) {
- unless ($grabbed) {
- return undef unless skip_past($aref, $boundary);
- }
- $grabbed = 0;
- $header = parse_header($aref);
- $entity_content = lc($header->{'Content-Type'});
- $entity_content =~ s/\(.*?\)\s*//g;
- &'add_log("parsed entity header: content is $entity_content")
- if $'loglvl > 19;
- $n++;
- if ($entity_content =~ m|^text/|) {
- # We found (another) text part, collect it...
- @entity = ();
- my $end = !skip_past($aref, $boundary, \@entity);
- $grabbed = 1; # Avoid skipping at next loop iteration
- last if $entity_content =~ m|^text/plain\b|; # Found the best one
- last if $end;
- }
- }
+ my ($entity_content, $header, $n) =
+ unmime_recursive($aref, \@entity, $boundary, 0);
my $entity = "${n}th";
$entity =~ s/1th$/1st/;
@@ -570,16 +702,21 @@ sub unmime {
# XXX code duplication with body_check(), factorize some day...
my $output;
my $error;
+ my $len = 0;
+
+ foreach my $x (@entity) {
+ $len += length $x;
+ }
if ($entity_encoding =~ /^base64\s*$/i) {
- base64'reset(length $'Header{'Body'});
+ base64'reset($len);
foreach my $d (@entity) {
base64'decode($d);
}
$error = base64'error_msg();
$output = base64'output();
} elsif ($entity_encoding =~ /^quoted-printable\s*$/i) {
- qp'reset(length $'Header{'Body'});
+ qp'reset($len);
foreach my $d (@entity) {
qp'decode($d);
}
diff --git a/agent/pl/builtins.pl b/agent/pl/builtins.pl
index 69e6a97..e5dd16d 100644
--- a/agent/pl/builtins.pl
+++ b/agent/pl/builtins.pl
@@ -1,4 +1,4 @@
-;# $Id: builtins.pl 38 2008-06-13 09:32:24Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/callout.pl b/agent/pl/callout.pl
index 1eab612..20fc0f7 100644
--- a/agent/pl/callout.pl
+++ b/agent/pl/callout.pl
@@ -1,4 +1,4 @@
-;# $Id: callout.pl 73 2011-12-22 22:44:07Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/cdir.pl b/agent/pl/cdir.pl
index 6a95b82..e0af886 100644
--- a/agent/pl/cdir.pl
+++ b/agent/pl/cdir.pl
@@ -1,4 +1,4 @@
-;# $Id: cdir.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/checklock.pl b/agent/pl/checklock.pl
index b1b1b6d..c619ee4 100644
--- a/agent/pl/checklock.pl
+++ b/agent/pl/checklock.pl
@@ -1,4 +1,4 @@
-;# $Id: checklock.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/cmdserv.pl b/agent/pl/cmdserv.pl
index f2f9e93..4df2197 100644
--- a/agent/pl/cmdserv.pl
+++ b/agent/pl/cmdserv.pl
@@ -1,4 +1,4 @@
-;# $Id: cmdserv.pl 69 2011-05-18 12:28:03Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/compress.pl b/agent/pl/compress.pl
index e7fb981..77981f9 100644
--- a/agent/pl/compress.pl
+++ b/agent/pl/compress.pl
@@ -1,4 +1,4 @@
-;# $Id: compress.pl 15 2008-05-29 22:13:02Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/context.pl b/agent/pl/context.pl
index 5c7034e..469124c 100644
--- a/agent/pl/context.pl
+++ b/agent/pl/context.pl
@@ -1,4 +1,4 @@
-;# $Id: context.pl 73 2011-12-22 22:44:07Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/dbr.pl b/agent/pl/dbr.pl
index 31ea59d..0ae916a 100644
--- a/agent/pl/dbr.pl
+++ b/agent/pl/dbr.pl
@@ -1,4 +1,4 @@
-;# $Id: dbr.pl 80 2015-02-12 18:06:16Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/distribs.pl b/agent/pl/distribs.pl
index 09d89fb..e7983da 100644
--- a/agent/pl/distribs.pl
+++ b/agent/pl/distribs.pl
@@ -1,4 +1,4 @@
-;# $Id: distribs.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/dynload.pl b/agent/pl/dynload.pl
index 3799ce7..7028665 100644
--- a/agent/pl/dynload.pl
+++ b/agent/pl/dynload.pl
@@ -1,4 +1,4 @@
-;# $Id: dynload.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/emergency.pl b/agent/pl/emergency.pl
index e42a7fd..d256ece 100644
--- a/agent/pl/emergency.pl
+++ b/agent/pl/emergency.pl
@@ -1,4 +1,4 @@
-;# $Id: emergency.pl 36 2008-06-11 10:42:08Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/eval.pl b/agent/pl/eval.pl
index be072e1..a421ebf 100644
--- a/agent/pl/eval.pl
+++ b/agent/pl/eval.pl
@@ -1,4 +1,4 @@
-;# $Id: eval.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/extern.pl b/agent/pl/extern.pl
index a80feae..1d4ebed 100644
--- a/agent/pl/extern.pl
+++ b/agent/pl/extern.pl
@@ -1,4 +1,4 @@
-;# $Id: extern.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/fatal.pl b/agent/pl/fatal.pl
index 0f26fba..f24c5d8 100644
--- a/agent/pl/fatal.pl
+++ b/agent/pl/fatal.pl
@@ -1,4 +1,4 @@
-;# $Id: fatal.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/file_edit.pl b/agent/pl/file_edit.pl
index 284e11d..24c960d 100644
--- a/agent/pl/file_edit.pl
+++ b/agent/pl/file_edit.pl
@@ -1,4 +1,4 @@
-;# $Id: file_edit.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/filter.pl b/agent/pl/filter.pl
index 2fd1e0e..0d0cb00 100644
--- a/agent/pl/filter.pl
+++ b/agent/pl/filter.pl
@@ -1,4 +1,4 @@
-;# $Id: filter.pl 46 2008-06-25 16:35:05Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/forward.pl b/agent/pl/forward.pl
index d75884c..9641915 100644
--- a/agent/pl/forward.pl
+++ b/agent/pl/forward.pl
@@ -1,4 +1,4 @@
-;# $Id: forward.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/free_file.pl b/agent/pl/free_file.pl
index 5560de7..da066a9 100644
--- a/agent/pl/free_file.pl
+++ b/agent/pl/free_file.pl
@@ -1,4 +1,4 @@
-;# $Id: free_file.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/gensym.pl b/agent/pl/gensym.pl
index f8e2280..106cd85 100644
--- a/agent/pl/gensym.pl
+++ b/agent/pl/gensym.pl
@@ -1,4 +1,4 @@
-;# $Id: gensym.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/getdate.pl b/agent/pl/getdate.pl
index efae8b7..091eea6 100644
--- a/agent/pl/getdate.pl
+++ b/agent/pl/getdate.pl
@@ -47,7 +47,7 @@
;# Below are logging information for this package as included in the
;# mailagent program.
;#
-;# $Id: getdate.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/header.pl b/agent/pl/header.pl
index 8befe81..bc51765 100644
--- a/agent/pl/header.pl
+++ b/agent/pl/header.pl
@@ -1,4 +1,4 @@
-;# $Id: header.pl 79 2013-05-17 20:49:33Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
@@ -225,27 +225,50 @@ sub parsedate {
}
# Format header field to fit into 78 columns, each continuation line being
-# indented by 8 chars. Returns the new formatted header string.
+# indented by 4 chars. Returns the new formatted header string.
sub format {
- local($field) = @_; # Field to be formatted
- local($tmp); # Buffer for temporary formatting
- local($new) = ''; # Constructed formatted header
- local($kept); # Length of current line
- local($len) = 78; # Amount of characters kept
- local($cont) = ' ' x 8; # Continuation lines starts with 8 spaces
+ my ($field) = @_; # Field to be formatted
+ my $tmp; # Buffer for temporary formatting
+ my $new = ''; # Constructed formatted header
+ my $kept; # Length of current line
+ my $len = 78; # Amount of characters kept
+ my $cont = ' ' x 4; # Continuation lines starts with 4 spaces
+ # No need to format if length already fits the line
+ if (length($field) <= $len) {
+ # Normalize continuations
+ return $cont . $field if $field =~ s/^\s+//;
+ return $field;
+ }
+ # Adjust length down if we're just formatting a continuation line
+ # This can happen when we're called from news_fmt().
+ $len = 74 if $field =~ /^\s/;
# Format header field, separating lines on ',' or space.
while (length($field) > $len) {
$tmp = substr($field, 0, $len); # Keep first $len chars
$tmp =~ s/^(.*)([,\s]).*/$1$2/; # Cut at last space or ,
$kept = length($tmp); # Amount of chars we kept
+ # We must ensure our hard split at $len chars does not fall within
+ # a word: we can only split on ',' or space!
+ if ($kept == $len) {
+ for (;;) {
+ my $s = substr($field, $kept, 1);
+ last unless length $s; # Reached end of string
+ $kept++;
+ $tmp .= $s;
+ last if $s =~ /^[,\s]/;
+ }
+ }
$tmp =~ s/\s+$//; # Remove trailing spaces
$tmp =~ s/^\s+//; # Remove leading spaces
- $new .= $cont if $new; # Continuation starts with 8 spaces
- $len = 70; # Account continuation for next line
- $new .= "$tmp\n";
- $field = substr($field, $kept, length $field);
+ if (length $tmp) { # Avoid empty line within header!
+ $len = 74; # Account continuation for next line
+ $new .= $cont if $new; # Continuation starts with 8 spaces
+ $new .= $tmp;
+ $new .= "\n";
+ }
+ $field = substr($field, $kept);
}
- unless ($field =~ /^\s+$/) { # Not only spaces
+ unless ($field =~ /^\s*$/) { # Not only spaces and not empty
$new .= $cont if $new; # Add 8 chars if continuation
$new .= $field; # Remaining information on one line
}
@@ -257,17 +280,52 @@ sub format {
# after the field name.
# Also, this routine must work when called to format a continuation (field
# stating with spaces).
+# Finally, this routine ensures that the first line is not just the header
+# name (even if there are continuation lines), so the first line can be
+# longer than 80 chars to fulfill this constraint.
sub news_fmt {
my ($field) = @_; # Field to be formatted
- my $continuation = 0;
- $continuation++ if $field =~ s/^\s+//;
- my $res = &format($field);
- if ($continuation) {
- $res = (' ' x 8) . $res; # Can be larger than 80 chars, but it's OK
+ my $len = 78; # Amount of characters kept
+ my $cont = ' ' x 4; # Continuation lines starts with 4 spaces
+ $field =~ s/^([\w-]+):(\S)/$1: $2/s; # Ensure name is followed by space
+ return $field if length $field <= $len; # Nothing to change
+ # The first line needs to be handled specially to not be split on the
+ # first space, even if it becomes longer than our targeted length limit.
+ my $new;
+ if ($field =~ /^[\w-]+:/) {
+ return $field unless $field =~ /^([\w-]+:\s+.+?[\s,])/;
+ $new = $1;
} else {
- $res =~ s/^([\w-]+):(\S)/$1: $2/s || $res =~ s/^([\w-]+):\n/$1: \n/s;
+ unless ($field =~ /^(\s+.+?[\s,])/) {
+ # No space to break-up the header line
+ $field =~ s/^\s+//;
+ # Do not emit line if it ends-up being empty...
+ # Indeed, we're supposed to be emitting header-lines, and an
+ # empty line would signal an EOH (End Of Header) condition!
+ return '' if $field eq "\n";
+ return $cont . $field; # Normalize continuations
+ }
+ $new = $1
+ }
+ # Maybe we can fit more?
+ while (length $new < $len) {
+ my $tmp = substr($field, length $new);
+ last unless $tmp =~ /^(.+?[\s,])/;
+ my $extra = $1;
+ last if length($new) + length($extra) > $len;
+ $new .= $extra;
}
- return $res;
+ $field = substr($field, length $new);
+ $new =~ s/\s+$//; # Remove trailing spaces
+ # Normalize continuation to 8 spaces
+ $new = $cont . $new if $new =~ s/^\s+//;
+ # Format the remaining normally now that we special-cased the first line
+ # We add a leading space because we're formatting a continuation line.
+ my $remaining;
+ $field =~ s/^\s+//;
+ $remaining = &format(" " . $field) unless $field =~ /^\s*$/;
+ $remaining = $cont . $remaining if length $remaining;
+ return $new . "\n" . $remaining;
}
# Scan the head of a file and try to determine whether there is a mail
diff --git a/agent/pl/history.pl b/agent/pl/history.pl
index dce7510..244c6a9 100644
--- a/agent/pl/history.pl
+++ b/agent/pl/history.pl
@@ -1,4 +1,4 @@
-;# $Id: history.pl 11 2008-05-28 15:10:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/hook.pl b/agent/pl/hook.pl
index 2f3f6fc..430b4b6 100644
--- a/agent/pl/hook.pl
+++ b/agent/pl/hook.pl
@@ -1,4 +1,4 @@
-;# $Id: hook.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/hostname.pl b/agent/pl/hostname.pl
index 86086ef..815242f 100644
--- a/agent/pl/hostname.pl
+++ b/agent/pl/hostname.pl
@@ -1,4 +1,4 @@
-;# $Id: hostname.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/include.pl b/agent/pl/include.pl
index 9e2f687..8adc03a 100644
--- a/agent/pl/include.pl
+++ b/agent/pl/include.pl
@@ -1,4 +1,4 @@
-;# $Id: include.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/install.pl b/agent/pl/install.pl
index 9f17bd5..fefa929 100644
--- a/agent/pl/install.pl
+++ b/agent/pl/install.pl
@@ -1,4 +1,4 @@
-;# $Id: install.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/interface.pl b/agent/pl/interface.pl
index 61bd59a..5210ab4 100644
--- a/agent/pl/interface.pl
+++ b/agent/pl/interface.pl
@@ -1,4 +1,4 @@
-;# $Id: interface.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/jobnum.pl b/agent/pl/jobnum.pl
index abcb76d..f2e684b 100644
--- a/agent/pl/jobnum.pl
+++ b/agent/pl/jobnum.pl
@@ -1,4 +1,4 @@
-;# $Id: jobnum.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/lexical.pl b/agent/pl/lexical.pl
index adb8238..2d6345a 100644
--- a/agent/pl/lexical.pl
+++ b/agent/pl/lexical.pl
@@ -1,4 +1,4 @@
-;# $Id: lexical.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
@@ -57,6 +57,7 @@ sub get_line {
next if /^\s*#/; # skip comments
next if /^\s*$/; # skip empty lines
s/\s\s+/ /; # reduce white spaces
+ s/#\s.*$//; # trailing comments skipped (need space after #)
$result .= $_;
# Very simple braces handling
$in_braces += tr/{/{/ - tr/}/}/;
diff --git a/agent/pl/listqueue.pl b/agent/pl/listqueue.pl
index 2cb7fbf..61a9200 100644
--- a/agent/pl/listqueue.pl
+++ b/agent/pl/listqueue.pl
@@ -1,4 +1,4 @@
-;# $Id: listqueue.pl 69 2011-05-18 12:28:03Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/locate.pl b/agent/pl/locate.pl
index 8ce37fb..4e0f99f 100644
--- a/agent/pl/locate.pl
+++ b/agent/pl/locate.pl
@@ -1,4 +1,4 @@
-;# $Id: locate.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/macros.pl b/agent/pl/macros.pl
index 18c6e49..c43e3a4 100644
--- a/agent/pl/macros.pl
+++ b/agent/pl/macros.pl
@@ -1,4 +1,4 @@
-;# $Id: macros.pl 46 2008-06-25 16:35:05Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/mailhook.pl b/agent/pl/mailhook.pl
index 1f192e8..92cc2a5 100644
--- a/agent/pl/mailhook.pl
+++ b/agent/pl/mailhook.pl
@@ -1,4 +1,4 @@
-;# $Id: mailhook.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/makedir.pl b/agent/pl/makedir.pl
index 4399bd3..028d2c3 100644
--- a/agent/pl/makedir.pl
+++ b/agent/pl/makedir.pl
@@ -1,4 +1,4 @@
-;# $Id: makedir.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/matching.pl b/agent/pl/matching.pl
index 11278e4..ca15974 100644
--- a/agent/pl/matching.pl
+++ b/agent/pl/matching.pl
@@ -1,4 +1,4 @@
-;# $Id: matching.pl 38 2008-06-13 09:32:24Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/mbox.pl b/agent/pl/mbox.pl
index 26196f9..3e96462 100644
--- a/agent/pl/mbox.pl
+++ b/agent/pl/mbox.pl
@@ -1,4 +1,4 @@
-;# $Id: mbox.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/mh.pl b/agent/pl/mh.pl
index 38364ef..ba4d989 100644
--- a/agent/pl/mh.pl
+++ b/agent/pl/mh.pl
@@ -1,4 +1,4 @@
-;# $Id: mh.pl 69 2011-05-18 12:28:03Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/mmdf.pl b/agent/pl/mmdf.pl
index 1d84a58..e23b3d0 100644
--- a/agent/pl/mmdf.pl
+++ b/agent/pl/mmdf.pl
@@ -1,4 +1,4 @@
-;# $Id: mmdf.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/newcmd.pl b/agent/pl/newcmd.pl
index 1c0791a..c9d6473 100644
--- a/agent/pl/newcmd.pl
+++ b/agent/pl/newcmd.pl
@@ -1,4 +1,4 @@
-;# $Id: newcmd.pl 77 2012-01-08 23:55:16Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/once.pl b/agent/pl/once.pl
index 278f13b..68f310d 100644
--- a/agent/pl/once.pl
+++ b/agent/pl/once.pl
@@ -1,4 +1,4 @@
-;# $Id: once.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/options.pl b/agent/pl/options.pl
index be9c779..8775f3b 100644
--- a/agent/pl/options.pl
+++ b/agent/pl/options.pl
@@ -1,4 +1,4 @@
-;# $Id: options.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/package.pl b/agent/pl/package.pl
index 4356c08..a560613 100644
--- a/agent/pl/package.pl
+++ b/agent/pl/package.pl
@@ -1,4 +1,4 @@
-;# $Id: package.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/parse.pl b/agent/pl/parse.pl
index 93c6c74..70af62d 100644
--- a/agent/pl/parse.pl
+++ b/agent/pl/parse.pl
@@ -1,4 +1,4 @@
-;# $Id: parse.pl 67 2010-09-16 11:43:06Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/period.pl b/agent/pl/period.pl
index f17e4d5..1ccf260 100644
--- a/agent/pl/period.pl
+++ b/agent/pl/period.pl
@@ -1,4 +1,4 @@
-;# $Id: period.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/plsave.pl b/agent/pl/plsave.pl
index 28ee91a..ec214a4 100644
--- a/agent/pl/plsave.pl
+++ b/agent/pl/plsave.pl
@@ -1,4 +1,4 @@
-;# $Id: plsave.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/plural.pl b/agent/pl/plural.pl
index fbcadf8..390df6f 100644
--- a/agent/pl/plural.pl
+++ b/agent/pl/plural.pl
@@ -1,4 +1,4 @@
-;# $Id: plural.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/power.pl b/agent/pl/power.pl
index 983ee15..97ca575 100644
--- a/agent/pl/power.pl
+++ b/agent/pl/power.pl
@@ -1,4 +1,4 @@
-;# $Id: power.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/pqueue.pl b/agent/pl/pqueue.pl
index a478616..b9271ed 100644
--- a/agent/pl/pqueue.pl
+++ b/agent/pl/pqueue.pl
@@ -1,4 +1,4 @@
-;# $Id: pqueue.pl 39 2008-06-13 09:43:39Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/q.pl b/agent/pl/q.pl
index 32a83cf..c74b5a8 100644
--- a/agent/pl/q.pl
+++ b/agent/pl/q.pl
@@ -1,4 +1,4 @@
-;# $Id: q.pl 3 2008-01-17 09:58:33Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/qp.pl b/agent/pl/qp.pl
index 59968a6..6492e0f 100644
--- a/agent/pl/qp.pl
+++ b/agent/pl/qp.pl
@@ -1,4 +1,4 @@
-;# $Id: qp.pl 38 2008-06-13 09:32:24Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 2008, Raphael Manfredi
;#
diff --git a/agent/pl/queue_mail.pl b/agent/pl/queue_mail.pl
index b098047..208bbeb 100644
--- a/agent/pl/queue_mail.pl
+++ b/agent/pl/queue_mail.pl
@@ -1,4 +1,4 @@
-;# $Id: queue_mail.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/rangeargs.pl b/agent/pl/rangeargs.pl
index c501555..9be64c7 100644
--- a/agent/pl/rangeargs.pl
+++ b/agent/pl/rangeargs.pl
@@ -1,4 +1,4 @@
-;# $Id: rangeargs.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/read_conf.pl b/agent/pl/read_conf.pl
index d7c44bc..1dd5d2a 100644
--- a/agent/pl/read_conf.pl
+++ b/agent/pl/read_conf.pl
@@ -1,4 +1,4 @@
-;# $Id: read_conf.pl 70 2011-05-20 19:44:55Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
@@ -48,6 +48,8 @@
;# Baseline for mailagent 3.0 netwide release.
;#
;#
+use Encode;
+
package cf;
# This package is responsible for keeping track of the configuration variables.
@@ -175,6 +177,10 @@ EOM
$umask = oct($umask) if $umask =~ /^0/; # Translate umask into decimal
$domain =~ s/^\.*//; # Strip leading '.'
+ # Backward compatibility -- RAM, 2016-09-13
+
+ $biffchars = 'iso-8859-1' unless defined $biffchars;
+
# Update @INC perlib search path with the perlib variable. Paths not
# starting by a '/' are supposed to be under the mailagent private lib
# directory.
@@ -191,6 +197,17 @@ EOM
}
}
+ # Make sure the "biffchars" encoding is known if biff is set.
+
+ if ($biff =~ /^on/i) {
+ my $enc = Encode::find_encoding($biffchars);
+ unless (ref $enc) {
+ &'add_log("WARNING unknown biff charset '$biffchars', using latin1")
+ if $'loglvl > 1;
+ $biffchars = 'iso-8859-1';
+ }
+ }
+
1; # Ok
}
diff --git a/agent/pl/rfc822.pl b/agent/pl/rfc822.pl
index c4e9a84..d9cf2ed 100644
--- a/agent/pl/rfc822.pl
+++ b/agent/pl/rfc822.pl
@@ -1,4 +1,4 @@
-;# $Id: rfc822.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/rulenv.pl b/agent/pl/rulenv.pl
index 22bc5d4..dc9144a 100644
--- a/agent/pl/rulenv.pl
+++ b/agent/pl/rulenv.pl
@@ -1,4 +1,4 @@
-;# $Id: rulenv.pl 69 2011-05-18 12:28:03Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/rules.pl b/agent/pl/rules.pl
index 0360959..f3af51b 100644
--- a/agent/pl/rules.pl
+++ b/agent/pl/rules.pl
@@ -1,4 +1,4 @@
-;# $Id: rules.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
@@ -204,7 +204,7 @@ sub dump_rules {
# Print the environement variable which differ from the original
# environment, i.e. those variable which were set by the user.
$lines = 0;
- foreach (keys(%XENV)) {
+ foreach (sort keys(%XENV)) {
unless ("$XENV{$_}" eq "$ENV{$_}") {
print "$_ = ", $XENV{$_}, ";\n";
$lines++;
diff --git a/agent/pl/runcmd.pl b/agent/pl/runcmd.pl
index 35806c8..1cf8ec1 100644
--- a/agent/pl/runcmd.pl
+++ b/agent/pl/runcmd.pl
@@ -1,4 +1,4 @@
-;# $Id: runcmd.pl 46 2008-06-25 16:35:05Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/secure.pl b/agent/pl/secure.pl
index 9d9bb4b..79d880c 100644
--- a/agent/pl/secure.pl
+++ b/agent/pl/secure.pl
@@ -1,4 +1,4 @@
-;# $Id: secure.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
@@ -46,23 +46,29 @@
# Return true if the file is secure or missing, false otherwise.
# Note the extra parameter $exec which is set by exec_secure() only.
sub file_secure {
- local($file, $type, $exec) = @_;
+ my ($file, $type, $exec) = @_;
return 1 unless -e $file; # Missing file considered secure
- # If we're trying to execute a symbolic link, try to resolve it recursively
- # Otherwise, symlinks are not considered secure by file_secure().
+ # We're resolving symlinks recursively
+ # NB: Race condition between our checks and the perusal of the file!
+ # --RAM, 2016-09-13
+
if (-l $file) { # File is a symbolic link
+ my $target = &symfile_secure($file, $type);
+ unless (defined $target) {
+ # Symbolic link is not secure
+ unless ($exec) {
+ &add_log(
+ "WARNING sensitive $type file $file is an " .
+ "unsecure symbolic link"
+ ) if $loglvl > 5;
+ }
+ return 0; # Unsecure file
+ }
+ $file = $target;
if ($exec) {
- local($target);
- $target = &symfile_secure($file, $type);
- return 0 unless defined $target;
&add_log("NOTICE running $type $file actually runs $target")
if $loglvl > 6;
- $file = $target;
- } else {
- &add_log("WARNING sensitive $type file $file is a symbolic link")
- if $loglvl > 5;
- return 0; # Unsecure file
}
}
diff --git a/agent/pl/sendfile.pl b/agent/pl/sendfile.pl
index 285bfc2..6b69c89 100644
--- a/agent/pl/sendfile.pl
+++ b/agent/pl/sendfile.pl
@@ -1,4 +1,4 @@
-;# $Id: sendfile.pl 23 2008-05-30 09:30:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/signals.pl b/agent/pl/signals.pl
index 3b5b457..794d84d 100644
--- a/agent/pl/signals.pl
+++ b/agent/pl/signals.pl
@@ -1,4 +1,4 @@
-;# $Id: signals.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/stats.pl b/agent/pl/stats.pl
index ad54236..355a3da 100644
--- a/agent/pl/stats.pl
+++ b/agent/pl/stats.pl
@@ -1,4 +1,4 @@
-;# $Id: stats.pl 74 2011-12-23 09:46:48Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/termios/termios_ph.c b/agent/pl/termios/termios_ph.c
index dfb5e1e..c281589 100644
--- a/agent/pl/termios/termios_ph.c
+++ b/agent/pl/termios/termios_ph.c
@@ -3,7 +3,7 @@
*/
/*
- * $Id: termios_ph.c 53 2008-06-27 17:02:06Z rmanfredi $
+ * $Id$
*
* Copyright (c) 2008, Raphael Manfredi
*
diff --git a/agent/pl/tilde.pl b/agent/pl/tilde.pl
index 9aadf00..43e0453 100644
--- a/agent/pl/tilde.pl
+++ b/agent/pl/tilde.pl
@@ -1,4 +1,4 @@
-;# $Id: tilde.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/unpack.pl b/agent/pl/unpack.pl
index 72843b2..c8f6f21 100644
--- a/agent/pl/unpack.pl
+++ b/agent/pl/unpack.pl
@@ -1,4 +1,4 @@
-;# $Id: unpack.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/usrmac.pl b/agent/pl/usrmac.pl
index 044e831..6b598f9 100644
--- a/agent/pl/usrmac.pl
+++ b/agent/pl/usrmac.pl
@@ -1,4 +1,4 @@
-;# $Id: usrmac.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/pl/utmp/utmp_ph.c b/agent/pl/utmp/utmp_ph.c
index 98dc9bb..f5830a6 100644
--- a/agent/pl/utmp/utmp_ph.c
+++ b/agent/pl/utmp/utmp_ph.c
@@ -3,7 +3,7 @@
*/
/*
- * $Id: utmp_ph.c 8 2008-05-28 09:27:26Z rmanfredi $
+ * $Id$
*
* Copyright (c) 1990-2006, Raphael Manfredi
*
diff --git a/agent/test/TEST b/agent/test/TEST
index 6977049..41c588f 100755
--- a/agent/test/TEST
+++ b/agent/test/TEST
@@ -58,6 +58,7 @@ $how_many = 0;
require './getopt.pl';
&Getopt;
+
$mailagent = 'mailagent'; # Default program (dataloaded version)
$mailagent = 'magent' if $opt_n; # Use non-dataloaded version
$ENV{'MAILAGENT'} = $mailagent;
@@ -67,7 +68,6 @@ $ENV{'PATH'} = "$pwd/..:.:" . $ENV{'PATH'};
-f '../filter/filter' && -x _ || die "No filter.\n";
$> || die "Cannot run tests as super-user. [$<,$>]\n";
-
&load_ok; # Don't rerun successful tests if up to date
# A level file indicates default loglvl
@@ -115,7 +115,6 @@ select(OK);
$| = 1; # We may safely interrupt
select(STDOUT);
-
foreach $dir (@tests) {
next unless -d $dir;
&run($dir);
diff --git a/agent/test/actions b/agent/test/actions
index 0a99d4d..695bee2 100644
--- a/agent/test/actions
+++ b/agent/test/actions
@@ -67,13 +67,13 @@
maildir = ~;
-X-Tag: /abort/
+X-Tag: /abort/ # trailing comment (space required after the '#')
{
ABORT -f;
- SAVE always;
+ SAVE always; # trailing comment
ABORT;
SAVE %u.1;
-}
+} # trailing comment
X-Tag: /annotate/
{
diff --git a/agent/test/cmd/biff.t b/agent/test/cmd/biff.t
index c1890f9..fbd687b 100644
--- a/agent/test/cmd/biff.t
+++ b/agent/test/cmd/biff.t
@@ -82,29 +82,42 @@ cp_mail("../mime");
&add_header('X-Tag: biff 3');
&make_tty(0, 0777, 40); # 40 & 41
`$cmd`;
-$? == 0 || print "41\n";
--f 'ok' || print "42\n";
--s 'tty0' || print "43\n";
-&get_log(44, 'tty0');
-&not_log('--foo', 45);
-&check_log('^Got mail in ~/ok', 46) == 1 || print "47\n";
-&check_log('successfully decoded', 48) == 1 || print "49\n";
+$? == 0 || print "42\n";
+-f 'ok' || print "43\n";
+-s 'tty0' || print "44\n";
+&get_log(45, 'tty0');
+&not_log('--foo', 46);
+&check_log('^Got mail in ~/ok', 47) == 1 || print "48\n";
+&check_log('successfully decoded', 49) == 1 || print "50\n";
&cleanup;
cp_mail("../qp");
my $subject = <<EOM;
-Subject: =?Cp1252?Q?Perl:_La_haute_tec?=
- =?Cp1252?Q?hnicit=E9_au_service_des_professionnels?=
+Subject: =?latin1?Q?Perl:_La_haute_technicit=E9_au_service_des_professionnels?=
EOM
chop $subject;
&replace_header($subject);
&add_header('X-Tag: biff 3');
-&make_tty(0, 0777, 50); # 50 & 51
+&make_tty(0, 0777, 50); # 51 & 52
`$cmd`;
-$? == 0 || print "52\n";
-&get_log(53, 'tty0');
+$? == 0 || print "53\n";
+&get_log(54, 'tty0');
&check_log(
- 'Subject: Perl: La haute technicité au service des professionnels', 54);
+ 'Subject: Perl: La haute technicité au service des professionnels', 55);
+&cleanup;
+
+cp_mail("../mime-recursive");
+&add_header('X-Tag: biff 3');
+&make_tty(0, 0777, 40); # 56 & 57
+`$cmd`;
+$? == 0 || print "58\n";
+-f 'ok' || print "59\n";
+-s 'tty0' || print "60\n";
+&get_log(61, 'tty0');
+&not_log('--foo', 62);
+&not_log('--bar', 63);
+&check_log('^Got mail in ~/ok', 64) == 1 || print "65\n";
+&check_log('successfully decoded', 66) == 1 || print "67\n";
&cleanup;
unlink 'mail';
diff --git a/agent/test/cmd/post.t b/agent/test/cmd/post.t
index 9c0d705..a216d51 100644
--- a/agent/test/cmd/post.t
+++ b/agent/test/cmd/post.t
@@ -17,6 +17,7 @@
do '../pl/cmd.pl';
do '../pl/mta.pl';
+do '../pl/misc.pl';
&add_header('X-Tag: post 1');
`$cmd`;
@@ -60,6 +61,24 @@ $? == 0 || print "15\n";
# 1 EOH + 3 paragraphs in mail
&check_log('^$', 17) == 4 or print "18\n";
+unlink 'mail', 'list', 'send.news';
+
+&cp_mail("../mail-long");
+&add_header('X-Tag: post 1');
+`$cmd`;
+$? == 0 || print "19\n";
+-f "$user" && print "20\n"; # Mail not saved
+-f 'send.news' || print "21\n"; # Mail processed
+
+# These strings must not be cut (this is around the 78 character limit)
+my @long = (
+ "character_limit_and_must_therefore",
+ "9207030043.AA04311\@iecc.cambridge.ma.us"
+);
+for (my $i = 0; $i < @long; $i++) {
+ &contains_string('send.news', $long[$i]) || print 22 + $i, "\n";
+}
+
+unlink 'mail';
&clear_mta;
-unlink 'mail', 'list';
print "0\n";
diff --git a/agent/test/cmd/save.t b/agent/test/cmd/save.t
index 738bd31..c35208e 100644
--- a/agent/test/cmd/save.t
+++ b/agent/test/cmd/save.t
@@ -71,11 +71,29 @@ $? == 0 || print "15\n";
-f 'ok' || print "16\n";
$size = -s 'ok';
-&add_option('-o fromfake: OFF');
+&add_option('-o "fromfake: OFF"');
`$cmd`;
$? == 0 || print "17\n";
&get_log(18, 'ok');
&check_log('^From: ', 19) == 1 || print "20\n";
unlink "$mbox", "$user", 'mail', 'ok';
+
+cp_mail("../mail-long");
+&add_header('X-Tag: save #1');
+`$cmd`;
+$? == 0 || print "21\n";
+-f "$mbox" || print "22\n"; # Mail saved here
+-f "$user" && print "23\n"; # Must not exist!
+
+# These strings must not be cut (this is around the 78 character limit)
+my @long = (
+ "character_limit_and_must_therefore",
+ "9207030043.AA04311\@iecc.cambridge.ma.us"
+);
+for (my $i = 0; $i < @long; $i++) {
+ &contains_string('mbox', $long[$i]) || print 24 + $i, "\n";
+}
+
+unlink "$mbox", "$user", 'mail', 'ok';
print "0\n";
diff --git a/agent/test/filter/base64.t b/agent/test/filter/base64.t
index 2faf229..48832a5 100644
--- a/agent/test/filter/base64.t
+++ b/agent/test/filter/base64.t
@@ -1,6 +1,6 @@
# Check base64 body decoding for matching
-# $Id: base64.t 38 2008-06-13 09:32:24Z rmanfredi $
+# $Id$
#
# Copyright (c) 2008, Raphael Manfredi
#
diff --git a/agent/test/filter/qp.t b/agent/test/filter/qp.t
index dde74a5..65fcd92 100644
--- a/agent/test/filter/qp.t
+++ b/agent/test/filter/qp.t
@@ -1,6 +1,6 @@
# Check quoted-printable body decoding for matching
-# $Id: qp.t 38 2008-06-13 09:32:24Z rmanfredi $
+# $Id$
#
# Copyright (c) 2008, Raphael Manfredi
#
diff --git a/agent/test/getopt.pl b/agent/test/getopt.pl
index cba4ede..6b92cb5 100644
--- a/agent/test/getopt.pl
+++ b/agent/test/getopt.pl
@@ -1,4 +1,4 @@
-;# $RCSfile: getopt.pl,v $$Revision: 77 $$Date: 2012-01-08 15:55:16 -0800 (Sun, 08 Jan 2012) $
+;# $RCSfile: getopt.pl,v $$Revision$$Date$
#
# This library is no longer being maintained, and is included for backward
# compatibility with Perl 4 programs which may require it.
diff --git a/agent/test/mail-long b/agent/test/mail-long
new file mode 100644
index 0000000..e219ff1
--- /dev/null
+++ b/agent/test/mail-long
@@ -0,0 +1,20 @@
+From compilers-request@iecc.cambridge.ma.us Sun Jul 12 14:45:54 PDT 1992
+Received: from eiffel.eiffel.com by lyon.eiffel.com (5.61/1.34)
+ id AA13012; Thu, 2 Jul 92 22:34:10 -0700
+Received: from uunet.UUCP by eiffel.eiffel.com (4.0/SMI-4.0)
+ id AA09695; Thu, 2 Jul 92 22:31:36 PDT
+Received: from ursa-major.spdcc.com by relay2.UU.NET with SMTP
+ (5.61/UUNET-internet-primary) id AA21794; Fri, 3 Jul 92 01:17:38 -0400
+Received: by ursa-major.spdcc.com with sendmail-5.65/4.7
+ id <AA13205@ursa-major.spdcc.com>; Fri, 3 Jul 92 01:17:34 -0400
+Received: by iecc.cambridge.ma.us (smail2.5+)
+ id AA04311; 3 Jul 92 00:43:22 EDT (Fri)
+To: ram@eiffel.com, foo@bar.com, anonymous@example-domain.com,
+ root@another-domain.com, bar@another-long-domain-name.com, another_user@example.com
+Long-Header: this_is_too_long_to_be_cut_shorter_than_our_about_eighty_character_limit_and_must_therefore_be_atomically_emitted
+From: compilers-request@iecc.cambridge.ma.us
+Subject: Re: melting ice technology?
+Date: 3 Jul 92 00:43:22 EDT (Fri)
+Message-Id: <making_this_intentionally_longer_than_it_should_be.9207030043.AA04311@iecc.cambridge.ma.us>
+
+Text body
diff --git a/agent/test/mime b/agent/test/mime
index 8e05599..0b41848 100644
--- a/agent/test/mime
+++ b/agent/test/mime
@@ -10,8 +10,8 @@ Message-ID: <D42E3A26BC29C94DB4CC3DA3569AE82B0157AE42DE@GVW1088EXB.pobox.com>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="foo"
Status: RO
-Content-Length: 609
-Lines: 22
+Content-Length: 610
+Lines: 23
--foo
Content-Type: text/html; charset="iso8859-1"
diff --git a/agent/test/mime-recursive b/agent/test/mime-recursive
new file mode 100644
index 0000000..a560289
--- /dev/null
+++ b/agent/test/mime-recursive
@@ -0,0 +1,47 @@
+From raphael_manfredi@pobox.com Tue Jun 10 17:44:12 2008
+Received: from tours.ram.loc (fetchmail@localhost [127.0.0.1])
+ by tours.ram.loc (8.14.3/8.13.8/Debian-3) with ESMTP id m5AFiCJq002957
+ for <ram@localhost>; Tue, 10 Jun 2008 17:44:12 +0200
+From: "Raphael Manfredi" <Raphael_Manfredi@pobox.com>
+To: "Raphael Manfredi" <Raphael_Manfredi@pobox.com>
+Date: Tue, 10 Jun 2008 15:35:21 +0000
+Subject: Sample recursive MIME message
+Message-ID: <D42E3A26BC29C94DB4CC3DA3569AE82B0157AE42DE@GVW1088EXB.pobox.com>
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="bar"
+Status: RO
+Content-Length: 748
+Lines: 32
+
+--bar
+Content-Type: multipart/mixed; boundary="foo"
+
+--foo
+Content-Type: text/html; charset="iso8859-1"
+
+<html>
+<head>
+ <title>Sample HTML part</title>
+</head>
+<body>
+ <p>Sole paragraph</p>
+</body>
+</html>
+
+--foo
+Content-Type: text/html; charset="utf-8"
+
+<p>Sample HTML fragment</p>
+
+--foo--
+--bar
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: base64
+Content-Length: 346
+
+VGhpcyBtZXNzYWdlIGlzIG9uZSBiaWcgTUlNRSBwYXJ0IHRoYXQgaGFzIGJlZW4gYmFzZTY0LWVu
+Y29kZWQuDQoNClRoZSBtYWlsYWdlbnQgdGVzdCBzdWl0ZSBpcyBnb2luZyB0byBsb29rIGZvciB0
+aGUgZm9sbG93aW5nIGxpbmU6DQoNCiAgICAgICAgKioqIFlFUywgc3VjY2Vzc2Z1bGx5IGRlY29k
+ZWQgKioqDQoNCmluIHRoZSBkZWNvZGVkIGJvZHkgYXMgcHJvb2YgdGhhdCB0aGUgYmFzZTY0IGRl
+Y29kaW5nIGxvZ2ljIGlzIHdvcmtpbmcuDQo=
+--bar--
diff --git a/agent/test/option/U.t b/agent/test/option/U.t
index 8a3beca..c6eaa8c 100644
--- a/agent/test/option/U.t
+++ b/agent/test/option/U.t
@@ -1,6 +1,6 @@
# -U : disable reject / abort of first UNIQUE and REJECT.
-# $Id: U.t 11 2008-05-28 15:10:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/agent/test/pl/cmd.pl b/agent/test/pl/cmd.pl
index e291996..5fc2b82 100644
--- a/agent/test/pl/cmd.pl
+++ b/agent/test/pl/cmd.pl
@@ -1,6 +1,6 @@
# Common actions at the top of each command test
-;# $Id: cmd.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/test/pl/filter.pl b/agent/test/pl/filter.pl
index fd2bed3..4c720c1 100644
--- a/agent/test/pl/filter.pl
+++ b/agent/test/pl/filter.pl
@@ -1,6 +1,6 @@
# Common actions at the top of each filtering test
-;# $Id: filter.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/test/pl/init.pl b/agent/test/pl/init.pl
index c2f8f11..d8596ea 100644
--- a/agent/test/pl/init.pl
+++ b/agent/test/pl/init.pl
@@ -1,6 +1,6 @@
# Set up mailagent and filter paths
-;# $Id: init.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/test/pl/logfile.pl b/agent/test/pl/logfile.pl
index 67ec46c..90ed307 100644
--- a/agent/test/pl/logfile.pl
+++ b/agent/test/pl/logfile.pl
@@ -1,6 +1,6 @@
# Get log file (by default) or any other file into @log
-;# $Id: logfile.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/test/pl/mail.pl b/agent/test/pl/mail.pl
index 1651399..b596279 100644
--- a/agent/test/pl/mail.pl
+++ b/agent/test/pl/mail.pl
@@ -1,6 +1,6 @@
# Utilities to twinkle default mail message
-;# $Id: mail.pl 38 2008-06-13 09:32:24Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
diff --git a/agent/test/pl/misc.pl b/agent/test/pl/misc.pl
index ad9b2df..304d5bd 100644
--- a/agent/test/pl/misc.pl
+++ b/agent/test/pl/misc.pl
@@ -1,6 +1,6 @@
# Common actions at the top of each misc test
-;# $Id: misc.pl 1 2006-08-24 13:24:12Z rmanfredi $
+;# $Id$
;#
;# Copyright (c) 1990-2006, Raphael Manfredi
;#
@@ -27,3 +27,19 @@ sub add_option {
$cmd = join(' ', $cmd[0], $opt, @cmd[1..$#cmd]);
}
+# Check that file contains a given string
+sub contains_string {
+ my ($file, $string) = @_;
+ local *FILE, $_;
+ open(FILE, $file) || return 0;
+ my $matched = 0;
+ while (<FILE>) {
+ if (/\Q$string/) {
+ $matched = 1;
+ last;
+ }
+ }
+ close FILE;
+ return $matched;
+}
+
diff --git a/agent/test/pl/mta.pl b/agent/test/pl/mta.pl
index 4a2af35..10ccbee 100644
--- a/agent/test/pl/mta.pl
+++ b/agent/test/pl/mta.pl
@@ -1,6 +1,6 @@
# Basic MTA/NTA for tests
-# $Id: mta.pl 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/bin/svn-revision b/bin/svn-revision
index 0d88b3b..ec97f0d 100755
--- a/bin/svn-revision
+++ b/bin/svn-revision
@@ -14,6 +14,10 @@
# Computes SVN current revision number, if possible, emitting it in
# the form of a #define for C perusal.
#
+# On 2016-04-01, we switched to git so until we come up with a more elaborate
+# scheme, the current version number is computed by counting the amount of
+# commits made on the "master" branch.
+#
LC_ALL=C
export LC_ALL
@@ -28,8 +32,8 @@ else
oldrev=`grep REVISION "$FILE" 2>/dev/null | head -n1 | cut -d' ' -f3`
fi
-if test -d "$TOP/.svn"; then
- revnum=`svn info "$TOP" 2>/dev/null | grep '^Revision' | head -n1 | cut -d' ' -f2`
+if test -d "$TOP/.git"; then
+ revnum=`git log --oneline master | wc -l`
else
revnum="$oldrev" # keep as is
fi
diff --git a/config_h.SH b/config_h.SH
index 96fe394..0035a29 100755
--- a/config_h.SH
+++ b/config_h.SH
@@ -31,7 +31,7 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
* that running config_h.SH again will wipe out any changes you've made.
* For a more permanent change edit $CONFIG_SH and rerun config_h.SH.
*
- * \$Id: config_h.SH 53 2008-06-27 17:02:06Z rmanfredi $
+ * \$Id$
*/
/*
@@ -114,7 +114,7 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
#$d_getopt HAS_GETOPT /**/
/* HAS_GNULIBC:
- * This symbol, if defined, indicates to the C program that
+ * This symbol, if defined, indicates to the C program that
* the GNU C library is being used. A better check is to use
* the __GLIBC__ and __GLIBC_MINOR__ symbols supplied with glibc.
*/
@@ -335,7 +335,7 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
* This symbol contains the value of sizeof(int) so that the C
* preprocessor can make decisions based on it.
*/
-#define INTSIZE $intsize /**/
+#define INTSIZE $intsize
/* MYHOSTNAME:
* This symbol contains name of the host the program is going to run on.
@@ -347,7 +347,7 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
#define MYHOSTNAME "$myhostname" /**/
/* PERLPATH:
- * This symbol contains the absolute location of the perl interpeter.
+ * This symbol contains the absolute location of the perl interpreter.
*/
#define PERLPATH "$perlpath" /**/
diff --git a/confmagic.h b/confmagic.h
index 8844445..4526122 100644
--- a/confmagic.h
+++ b/confmagic.h
@@ -6,7 +6,7 @@
* If you wish to get rid of this magic, remove this file and rerun metaconfig
* without the -M option.
*
- * $Id: confmagic.h 1 2006-08-24 13:24:12Z rmanfredi $
+ * $Id$
*/
#ifndef _confmagic_h_
diff --git a/install.SH b/install.SH
index 8b5cb13..3bbc5f4 100755
--- a/install.SH
+++ b/install.SH
@@ -19,7 +19,7 @@ $spitshell >install <<!GROK!THIS!
$startsh
# @(#) Installing script accepting bsd-style arguments
-# $Id: install.SH 5 2008-05-28 08:00:09Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/misc/fakesend/fakesend.pl b/misc/fakesend/fakesend.pl
index d1674d6..4e3dc15 100644
--- a/misc/fakesend/fakesend.pl
+++ b/misc/fakesend/fakesend.pl
@@ -1,4 +1,4 @@
-# $Id: fakesend.pl 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/misc/news/ml.map b/misc/news/ml.map
index dacbe30..1375f65 100644
--- a/misc/news/ml.map
+++ b/misc/news/ml.map
@@ -1,5 +1,5 @@
#
-# $Id: ml.map 2 2006-11-04 11:46:52Z rmanfredi $
+# $Id$
#
# $Log: ml.map,v $
# Revision 3.0.1.2 2001/03/13 13:16:30 ram
diff --git a/misc/news/newsgate b/misc/news/newsgate
index 60e74d5..96080f5 100644
--- a/misc/news/newsgate
+++ b/misc/news/newsgate
@@ -3,7 +3,7 @@
if $running_under_some_shell;
#
-# $Id: newsgate 2 2006-11-04 11:46:52Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/misc/pbounce/patbounce.pl b/misc/pbounce/patbounce.pl
index c1526d0..bbe97e2 100644
--- a/misc/pbounce/patbounce.pl
+++ b/misc/pbounce/patbounce.pl
@@ -1,4 +1,4 @@
-# $Id: patbounce.pl 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/misc/unkit/unkit.pl b/misc/unkit/unkit.pl
index 90d12fa..fdcf880 100644
--- a/misc/unkit/unkit.pl
+++ b/misc/unkit/unkit.pl
@@ -1,4 +1,4 @@
-# $Id: unkit.pl 1 2006-08-24 13:24:12Z rmanfredi $
+# $Id$
#
# Copyright (c) 1990-2006, Raphael Manfredi
#
diff --git a/revision.h b/revision.h
deleted file mode 100644
index ad595bf..0000000
--- a/revision.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
- *
- * Generated by ./bin/svn-revision.
- */
-
-#define REVISION 81