nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e6da7ebd1c0d2e51127556fff49ddacf6b930f65
parent ad0c6057f058b3e9cb67cc12cc3d2dc8a82d9900
Author: Ellenor Malik <ellenor@umbrellix.net>
Date:   Fri,  3 Sep 2021 13:38:57 -0700

rearrangement appears to be basically complete, although some things still continue to be a bit skew-wiff

Diffstat:
M.gitignore | 566++++++++++++++++++++++++++++++++++++++++----------------------------------------
MMakefile | 2716++++++++++++++++++++++++++++++++++++++++----------------------------------------
MTARGETS | 566++++++++++++++++++++++++++++++++++++++++----------------------------------------
Achkbiofl.o | 0
Mconf-cc | 2+-
Mconf-ld | 2+-
RBLURB.md -> doc/BLURB.md | 0
RBLURB2.md -> doc/BLURB2.md | 0
RBLURB3.md -> doc/BLURB3.md | 0
RBLURB4.md -> doc/BLURB4.md | 0
RCHANGES.md -> doc/CHANGES.md | 0
RFAQ.md -> doc/FAQ.md | 0
RINSTALL.alias.md -> doc/INSTALL.alias.md | 0
RINSTALL.ctl.md -> doc/INSTALL.ctl.md | 0
RINSTALL.ids.md -> doc/INSTALL.ids.md | 0
RINSTALL.maildir.md -> doc/INSTALL.maildir.md | 0
RINSTALL.mbox.md -> doc/INSTALL.mbox.md | 0
RINSTALL.md -> doc/INSTALL.md | 0
RINSTALL.vsm.md -> doc/INSTALL.vsm.md | 0
RINTERNALS.md -> doc/INTERNALS.md | 0
RREADME.md -> doc/README.md | 0
RREMOVE.binmail.md -> doc/REMOVE.binmail.md | 0
RREMOVE.sendmail.md -> doc/REMOVE.sendmail.md | 0
RSECURITY.md -> doc/SECURITY.md | 0
RSENDMAIL.md -> doc/SENDMAIL.md | 0
RTEST.deliver.md -> doc/TEST.deliver.md | 0
RTEST.receive.md -> doc/TEST.receive.md | 0
RTHANKS.md -> doc/THANKS.md | 0
RTHOUGHTS.md -> doc/THOUGHTS.md | 0
RUNITTESTS.md -> doc/UNITTESTS.md | 0
RUPGRADE.md -> doc/UPGRADE.md | 0
RVERSION.md -> doc/VERSION.md | 0
Dhier.c | 251-------------------------------------------------------------------------------
Ralloc.h -> include/alloc.h | 0
Rauto_break.h -> include/auto_break.h | 0
Rauto_patrn.h -> include/auto_patrn.h | 0
Rauto_qmail.h -> include/auto_qmail.h | 0
Rauto_spawn.h -> include/auto_spawn.h | 0
Rauto_split.h -> include/auto_split.h | 0
Rauto_uids.h -> include/auto_uids.h | 0
Rauto_users.h -> include/auto_users.h | 0
Rbyte.h -> include/byte.h | 0
Rcase.h -> include/case.h | 0
Rcdb.h -> include/cdb.h | 0
Rcdbmake.h -> include/cdbmake.h | 0
Rcdbmss.h -> include/cdbmss.h | 0
Rcoe.h -> include/coe.h | 0
Rcommands.h -> include/commands.h | 0
Rconstmap.h -> include/constmap.h | 0
Rcontrol.h -> include/control.h | 0
Rdate822fmt.h -> include/date822fmt.h | 0
Rdatetime.h -> include/datetime.h | 0
Rdeprecated.h -> include/deprecated.h | 0
Rdirentry.h1 -> include/direntry.h1 | 0
Rdirentry.h2 -> include/direntry.h2 | 0
Rdns.h -> include/dns.h | 0
Rdnsdoe.h -> include/dnsdoe.h | 0
Renv.h -> include/env.h | 0
Rerror.h -> include/error.h | 0
Rexit.h -> include/exit.h | 0
Rextra.h -> include/extra.h | 0
Rfd.h -> include/fd.h | 0
Rfifo.h -> include/fifo.h | 0
Rfmt.h -> include/fmt.h | 0
Rfmtqfn.h -> include/fmtqfn.h | 0
Rfork.h -> include/fork.h | 0
Rgen_alloc.h -> include/gen_alloc.h | 0
Rgen_allocdefs.h -> include/gen_allocdefs.h | 0
Rgetln.h -> include/getln.h | 0
Rgfrom.h -> include/gfrom.h | 0
Rheaderbody.h -> include/headerbody.h | 0
Rhfield.h -> include/hfield.h | 0
Rhier.h -> include/hier.h | 0
Rip.h -> include/ip.h | 0
Ripalloc.h -> include/ipalloc.h | 0
Ripme.h -> include/ipme.h | 0
Rlock.h -> include/lock.h | 0
Rmaildir.h -> include/maildir.h | 0
Rmyctime.h -> include/myctime.h | 0
Rndelay.h -> include/ndelay.h | 0
Rnewfield.h -> include/newfield.h | 0
Rnoreturn.h -> include/noreturn.h | 0
Rnow.h -> include/now.h | 0
Roflops_bi.h -> include/oflops_bi.h | 0
Roflops_compat.h -> include/oflops_compat.h | 0
Ropen.h -> include/open.h | 0
Rprioq.h -> include/prioq.h | 0
Rprot.h -> include/prot.h | 0
Rqlx.h -> include/qlx.h | 0
Ainclude/qmail.h | 34++++++++++++++++++++++++++++++++++
Ainclude/qsutil.h | 22++++++++++++++++++++++
Ainclude/qtmp.h1 | 26++++++++++++++++++++++++++
Ainclude/qtmp.h2 | 11+++++++++++
Ainclude/quote.h | 8++++++++
Ainclude/rcpthosts.h | 7+++++++
Ainclude/readsubdir.h | 20++++++++++++++++++++
Ainclude/readwrite.h | 6++++++
Ainclude/received.h | 6++++++
Ainclude/remoteinfo.h | 6++++++
Ainclude/scan.h | 7+++++++
Ainclude/seek.h | 29+++++++++++++++++++++++++++++
Ainclude/select.h1 | 8++++++++
Ainclude/select.h2 | 8++++++++
Ainclude/sgetopt.h | 21+++++++++++++++++++++
Ainclude/sig.h | 43+++++++++++++++++++++++++++++++++++++++++++
Ainclude/slurpclose.h | 6++++++
Ainclude/spawn.h | 11+++++++++++
Ainclude/str.h | 16++++++++++++++++
Ainclude/stralloc.h | 21+++++++++++++++++++++
Ainclude/strerr.h | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ainclude/subfd.h | 15+++++++++++++++
Ainclude/subgetopt.h | 24++++++++++++++++++++++++
Ainclude/substdio.h | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Ainclude/tcpto.h | 8++++++++
Ainclude/timeoutconn.h | 6++++++
Ainclude/timeoutread.h | 17+++++++++++++++++
Ainclude/timeoutwrite.h | 17+++++++++++++++++
Ainclude/token822.h | 37+++++++++++++++++++++++++++++++++++++
Ainclude/trigger.h | 8++++++++
Ainclude/triggerpull.h | 6++++++
Ainclude/uidgid.h | 9+++++++++
Ainclude/uint32.h | 8++++++++
Ainclude/wait.h | 14++++++++++++++
Mmake-compile.sh | 2+-
Mmake-load.sh | 2+-
Dqmail.c | 158-------------------------------------------------------------------------------
Dqmail.h | 34----------------------------------
Dqreceipt.c | 130-------------------------------------------------------------------------------
Dqsutil.c | 47-----------------------------------------------
Dqsutil.h | 22----------------------
Dqtmp.h1 | 26--------------------------
Dqtmp.h2 | 11-----------
Dquote.c | 93-------------------------------------------------------------------------------
Dquote.h | 8--------
Drcpthosts.c | 62--------------------------------------------------------------
Drcpthosts.h | 7-------
Dreadsubdir.c | 50--------------------------------------------------
Dreadsubdir.h | 20--------------------
Dreadwrite.h | 6------
Dreceived.c | 74--------------------------------------------------------------------------
Dreceived.h | 6------
Dremoteinfo.c | 79-------------------------------------------------------------------------------
Dremoteinfo.h | 6------
Dscan.h | 7-------
Dscan_8long.c | 11-----------
Dscan_ulong.c | 11-----------
Dseek.h | 29-----------------------------
Dselect.h1 | 8--------
Dselect.h2 | 8--------
Dsendmail.c | 161-------------------------------------------------------------------------------
Dsgetopt.c | 55-------------------------------------------------------
Dsgetopt.h | 21---------------------
Dsig.h | 43-------------------------------------------
Dsig_alarm.c | 7-------
Dsig_block.c | 41-----------------------------------------
Dsig_bug.c | 17-----------------
Dsig_catch.c | 19-------------------
Dsig_child.c | 7-------
Dsig_hup.c | 7-------
Dsig_misc.c | 17-----------------
Dsig_pause.c | 14--------------
Dsig_pipe.c | 5-----
Dsig_term.c | 7-------
Dslurpclose.c | 20--------------------
Dslurpclose.h | 6------
Dspawn.c | 257-------------------------------------------------------------------------------
Dspawn.h | 11-----------
Dsplogger.c | 70----------------------------------------------------------------------
Rauto-int.c -> src/auto-int.c | 0
Rauto-int8.c -> src/auto-int8.c | 0
Rauto-str.c -> src/auto-str.c | 0
Rbouncesaying.c -> src/bouncesaying.c | 0
Rbyte_chr.c -> src/byte_chr.c | 0
Rbyte_copy.c -> src/byte_copy.c | 0
Rbyte_cr.c -> src/byte_cr.c | 0
Rbyte_rchr.c -> src/byte_rchr.c | 0
Rbyte_zero.c -> src/byte_zero.c | 0
Rcase_diffb.c -> src/case_diffb.c | 0
Rcase_diffs.c -> src/case_diffs.c | 0
Rcase_lowerb.c -> src/case_lowerb.c | 0
Rcase_lowers.c -> src/case_lowers.c | 0
Rcase_starts.c -> src/case_starts.c | 0
Rcdb_hash.c -> src/cdb_hash.c | 0
Rcdb_seek.c -> src/cdb_seek.c | 0
Rcdb_unpack.c -> src/cdb_unpack.c | 0
Rcdbmake_add.c -> src/cdbmake_add.c | 0
Rcdbmake_hash.c -> src/cdbmake_hash.c | 0
Rcdbmake_pack.c -> src/cdbmake_pack.c | 0
Rcdbmss.c -> src/cdbmss.c | 0
Rchkbiofl.c -> src/chkbiofl.c | 0
Rchkspawn.c -> src/chkspawn.c | 0
Rcoe.c -> src/coe.c | 0
Rcommands.c -> src/commands.c | 0
Rcondredirect.c -> src/condredirect.c | 0
Rconstmap.c -> src/constmap.c | 0
Rcontrol.c -> src/control.c | 0
Rdate822fmt.c -> src/date822fmt.c | 0
Rdatetime.c -> src/datetime.c | 0
Rdatetime_un.c -> src/datetime_un.c | 0
Rdns.c -> src/dns.c | 0
Rdnsdoe.c -> src/dnsdoe.c | 0
Rdnsfq.c -> src/dnsfq.c | 0
Rdnsip.c -> src/dnsip.c | 0
Rdnsptr.c -> src/dnsptr.c | 0
Renv.c -> src/env.c | 0
Renvread.c -> src/envread.c | 0
Rerror_str.c -> src/error_str.c | 0
Rerror_temp.c -> src/error_temp.c | 0
Rexcept.c -> src/except.c | 0
Rfd_copy.c -> src/fd_copy.c | 0
Rfd_move.c -> src/fd_move.c | 0
Rfifo.c -> src/fifo.c | 0
Rfmt_str.c -> src/fmt_str.c | 0
Rfmt_strn.c -> src/fmt_strn.c | 0
Rfmt_uint.c -> src/fmt_uint.c | 0
Rfmt_uint0.c -> src/fmt_uint0.c | 0
Rfmt_ulong.c -> src/fmt_ulong.c | 0
Rfmtqfn.c -> src/fmtqfn.c | 0
Rforward.c -> src/forward.c | 0
Rgetln.c -> src/getln.c | 0
Rgetln2.c -> src/getln2.c | 0
Rgfrom.c -> src/gfrom.c | 0
Rgid.c -> src/gid.c | 0
Rheaderbody.c -> src/headerbody.c | 0
Rhfield.c -> src/hfield.c | 0
Asrc/hier.c | 251+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rhostname.c -> src/hostname.c | 0
Rinstcheck.c -> src/instcheck.c | 0
Rinstchown.c -> src/instchown.c | 0
Rinstfiles.c -> src/instfiles.c | 0
Rinstpackage.c -> src/instpackage.c | 0
Rinstqueue.c -> src/instqueue.c | 0
Rinstuidgid.c -> src/instuidgid.c | 0
Rip.c -> src/ip.c | 0
Ripalloc.c -> src/ipalloc.c | 0
Ripme.c -> src/ipme.c | 0
Ripmeprint.c -> src/ipmeprint.c | 0
Rlock_ex.c -> src/lock_ex.c | 0
Rlock_exnb.c -> src/lock_exnb.c | 0
Rlock_un.c -> src/lock_un.c | 0
Rmaildir.c -> src/maildir.c | 0
Rmaildir2mbox.c -> src/maildir2mbox.c | 0
Rmaildirmake.c -> src/maildirmake.c | 0
Rmyctime.c -> src/myctime.c | 0
Rndelay.c -> src/ndelay.c | 0
Rndelay_off.c -> src/ndelay_off.c | 0
Rnewfield.c -> src/newfield.c | 0
Ropen_append.c -> src/open_append.c | 0
Ropen_excl.c -> src/open_excl.c | 0
Ropen_read.c -> src/open_read.c | 0
Ropen_trunc.c -> src/open_trunc.c | 0
Ropen_write.c -> src/open_write.c | 0
Rpredate.c -> src/predate.c | 0
Rpreline.c -> src/preline.c | 0
Rprioq.c -> src/prioq.c | 0
Rprot.c -> src/prot.c | 0
Rqbiff.c -> src/qbiff.c | 0
Rqmail-clean.c -> src/qmail-clean.c | 0
Rqmail-getpw.c -> src/qmail-getpw.c | 0
Rqmail-inject.c -> src/qmail-inject.c | 0
Rqmail-local.c -> src/qmail-local.c | 0
Rqmail-lspawn.c -> src/qmail-lspawn.c | 0
Rqmail-newmrh.c -> src/qmail-newmrh.c | 0
Rqmail-newu.c -> src/qmail-newu.c | 0
Rqmail-pop3d.c -> src/qmail-pop3d.c | 0
Rqmail-popup.c -> src/qmail-popup.c | 0
Rqmail-pw2u.c -> src/qmail-pw2u.c | 0
Rqmail-qmqpc.c -> src/qmail-qmqpc.c | 0
Rqmail-qmqpd.c -> src/qmail-qmqpd.c | 0
Rqmail-qmtpd.c -> src/qmail-qmtpd.c | 0
Rqmail-qread.c -> src/qmail-qread.c | 0
Rqmail-queue.c -> src/qmail-queue.c | 0
Rqmail-remote.c -> src/qmail-remote.c | 0
Rqmail-rspawn.c -> src/qmail-rspawn.c | 0
Rqmail-send.c -> src/qmail-send.c | 0
Rqmail-showctl.c -> src/qmail-showctl.c | 0
Rqmail-smtpd.c -> src/qmail-smtpd.c | 0
Rqmail-start.c -> src/qmail-start.c | 0
Rqmail-tcpok.c -> src/qmail-tcpok.c | 0
Rqmail-tcpto.c -> src/qmail-tcpto.c | 0
Asrc/qmail.c | 158+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/qreceipt.c | 130+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/qsutil.c | 47+++++++++++++++++++++++++++++++++++++++++++++++
Asrc/quote.c | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/rcpthosts.c | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/readsubdir.c | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/received.c | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/remoteinfo.c | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/scan_8long.c | 11+++++++++++
Asrc/scan_ulong.c | 11+++++++++++
Asrc/sendmail.c | 161+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/sgetopt.c | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/sig_alarm.c | 7+++++++
Asrc/sig_block.c | 41+++++++++++++++++++++++++++++++++++++++++
Asrc/sig_bug.c | 17+++++++++++++++++
Asrc/sig_catch.c | 19+++++++++++++++++++
Asrc/sig_child.c | 7+++++++
Asrc/sig_hup.c | 7+++++++
Asrc/sig_misc.c | 17+++++++++++++++++
Asrc/sig_pause.c | 14++++++++++++++
Asrc/sig_pipe.c | 5+++++
Asrc/sig_term.c | 7+++++++
Asrc/slurpclose.c | 20++++++++++++++++++++
Asrc/spawn.c | 257+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/splogger.c | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/str_chr.c | 17+++++++++++++++++
Asrc/str_rchr.c | 20++++++++++++++++++++
Asrc/str_start.c | 13+++++++++++++
Asrc/stralloc_arts.c | 12++++++++++++
Asrc/stralloc_cat.c | 9+++++++++
Asrc/stralloc_catb.c | 22++++++++++++++++++++++
Asrc/stralloc_cats.c | 10++++++++++
Asrc/stralloc_copy.c | 9+++++++++
Asrc/stralloc_eady.c | 5+++++
Asrc/stralloc_opyb.c | 21+++++++++++++++++++++
Asrc/stralloc_opys.c | 10++++++++++
Asrc/stralloc_pend.c | 4++++
Asrc/strerr_die.c | 37+++++++++++++++++++++++++++++++++++++
Asrc/strerr_sys.c | 13+++++++++++++
Asrc/subfderr.c | 7+++++++
Asrc/subfdin.c | 13+++++++++++++
Asrc/subfdins.c | 13+++++++++++++
Asrc/subfdout.c | 7+++++++
Asrc/subfdouts.c | 7+++++++
Asrc/subgetopt.c | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/substdi.c | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/substdio.c | 10++++++++++
Asrc/substdio_copy.c | 16++++++++++++++++
Asrc/substdo.c | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/tcp-env.c | 128+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/tcpto.c | 164+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/tcpto_clean.c | 20++++++++++++++++++++
Asrc/timeoutconn.c | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/timeoutread.c | 23+++++++++++++++++++++++
Asrc/timeoutwrite.c | 23+++++++++++++++++++++++
Asrc/token822.c | 513+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/trigger.c | 43+++++++++++++++++++++++++++++++++++++++++++
Asrc/triggerpull.c | 18++++++++++++++++++
Asrc/trydrent.c | 8++++++++
Asrc/tryflock.c | 8++++++++
Asrc/trylsock.c | 5+++++
Asrc/trymkffo.c | 7+++++++
Asrc/trynpbg1.c | 28++++++++++++++++++++++++++++
Asrc/tryrsolv.c | 5+++++
Asrc/trysalen.c | 11+++++++++++
Asrc/trysgact.c | 12++++++++++++
Asrc/trysgprm.c | 12++++++++++++
Asrc/trysysel.c | 9+++++++++
Asrc/trysyslog.c | 11+++++++++++
Asrc/tryutmpx.c | 8++++++++
Asrc/trywaitp.c | 8++++++++
Asrc/uid.c | 21+++++++++++++++++++++
Asrc/wait_nohang.c | 13+++++++++++++
Asrc/wait_pid.c | 39+++++++++++++++++++++++++++++++++++++++
Dstr.h | 16----------------
Dstr_chr.c | 17-----------------
Dstr_rchr.c | 20--------------------
Dstr_start.c | 13-------------
Dstralloc.h | 21---------------------
Dstralloc_arts.c | 12------------
Dstralloc_cat.c | 9---------
Dstralloc_catb.c | 22----------------------
Dstralloc_cats.c | 10----------
Dstralloc_copy.c | 9---------
Dstralloc_eady.c | 5-----
Dstralloc_opyb.c | 21---------------------
Dstralloc_opys.c | 10----------
Dstralloc_pend.c | 4----
Dstrerr.h | 82-------------------------------------------------------------------------------
Dstrerr_die.c | 37-------------------------------------
Dstrerr_sys.c | 13-------------
Dsubfd.h | 15---------------
Dsubfderr.c | 7-------
Dsubfdin.c | 13-------------
Dsubfdins.c | 13-------------
Dsubfdout.c | 7-------
Dsubfdouts.c | 7-------
Dsubgetopt.c | 79-------------------------------------------------------------------------------
Dsubgetopt.h | 24------------------------
Dsubstdi.c | 77-----------------------------------------------------------------------------
Dsubstdio.c | 10----------
Dsubstdio.h | 53-----------------------------------------------------
Dsubstdio_copy.c | 16----------------
Dsubstdo.c | 93-------------------------------------------------------------------------------
Dtcp-env.c | 128-------------------------------------------------------------------------------
Dtcpto.c | 164-------------------------------------------------------------------------------
Dtcpto.h | 8--------
Dtcpto_clean.c | 20--------------------
Dtimeoutconn.c | 60------------------------------------------------------------
Dtimeoutconn.h | 6------
Dtimeoutread.c | 23-----------------------
Dtimeoutread.h | 17-----------------
Dtimeoutwrite.c | 23-----------------------
Dtimeoutwrite.h | 17-----------------
Dtoken822.c | 513-------------------------------------------------------------------------------
Dtoken822.h | 37-------------------------------------
Dtrigger.c | 43-------------------------------------------
Dtrigger.h | 8--------
Dtriggerpull.c | 18------------------
Dtriggerpull.h | 6------
Dtrydrent.c | 8--------
Dtryflock.c | 8--------
Dtrylsock.c | 5-----
Dtrymkffo.c | 7-------
Dtrynpbg1.c | 28----------------------------
Dtryrsolv.c | 5-----
Dtrysalen.c | 11-----------
Dtrysgact.c | 12------------
Dtrysgprm.c | 12------------
Dtrysysel.c | 9---------
Dtrysyslog.c | 11-----------
Dtryutmpx.c | 8--------
Dtrywaitp.c | 8--------
Duid.c | 21---------------------
Duidgid.h | 9---------
Duint32.h | 8--------
Dwait.h | 14--------------
Dwait_nohang.c | 13-------------
Dwait_pid.c | 39---------------------------------------
419 files changed, 5939 insertions(+), 5939 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -4,304 +4,304 @@ make-load load make-compile compile -qmail-local.o -qmail.o -quote.o -gfrom.o -myctime.o -slurpclose.o +src/qmail-local.o +src/qmail.o +src/quote.o +src/gfrom.o +src/myctime.o +src/slurpclose.o make-makelib makelib -case_diffb.o -case_diffs.o -case_lowerb.o -case_lowers.o -case_starts.o -case.a -getln.o -getln2.o -getln.a -subgetopt.o -sgetopt.o -getopt.a -sig_alarm.o -oflops.h -hassgprm.h -sig_block.o -hassgact.h -sig_catch.o -sig_pause.o -sig_pipe.o -sig_child.o -sig_hup.o -sig_term.o -sig_bug.o -sig_misc.o -sig.a -open_append.o -open_excl.o -open_read.o -open_trunc.o -open_write.o -open.a -seek_cur.o -seek_end.o -seek_set.o -seek_trunc.o -seek.a -hasflock.h -lock_ex.o -lock_exnb.o -lock_un.o -lock.a -fd_copy.o -fd_move.o -fd.a -haswaitp.h -ids.a -wait_pid.o -wait_nohang.o -wait.a -env.o -envread.o -env.a -stralloc_eady.o -stralloc_pend.o -stralloc_copy.o -stralloc_opys.o -stralloc_opyb.o -stralloc_cat.o -stralloc_cats.o -stralloc_catb.o -stralloc_arts.o -stralloc.a -strerr_sys.o -strerr_die.o -strerr.a -substdio.o -substdi.o -substdo.o -subfderr.o -subfdout.o -subfdouts.o -subfdin.o -subfdins.o -substdio_copy.o -substdio.a -error_str.o -error_temp.o -error.a -str_chr.o -str_rchr.o -str_start.o -byte_chr.o -byte_rchr.o -byte_copy.o -byte_cr.o -byte_zero.o -str.a -fmt_str.o -fmt_strn.o -fmt_uint.o -fmt_uint0.o -fmt_ulong.o -scan_ulong.o -scan_8long.o -fs.a -datetime.o -datetime_un.o -datetime.a -auto-str.o +src/case_diffb.o +src/case_diffs.o +src/case_lowerb.o +src/case_lowers.o +src/case_starts.o +src/case.a +src/getln.o +src/getln2.o +src/getln.a +src/subgetopt.o +src/sgetopt.o +src/getopt.a +src/sig_alarm.o +include/oflops.h +include/hassgprm.h +src/sig_block.o +include/hassgact.h +src/sig_catch.o +src/sig_pause.o +src/sig_pipe.o +src/sig_child.o +src/sig_hup.o +src/sig_term.o +src/sig_bug.o +src/sig_misc.o +src/sig.a +src/open_append.o +src/open_excl.o +src/open_read.o +src/open_trunc.o +src/open_write.o +src/open.a +src/seek_cur.o +src/seek_end.o +src/seek_set.o +src/seek_trunc.o +src/seek.a +include/hasflock.h +src/lock_ex.o +src/lock_exnb.o +src/lock_un.o +src/lock.a +src/fd_copy.o +src/fd_move.o +src/fd.a +include/haswaitp.h +src/ids.a +src/wait_pid.o +src/wait_nohang.o +src/wait.a +src/env.o +src/envread.o +src/env.a +src/stralloc_eady.o +src/stralloc_pend.o +src/stralloc_copy.o +src/stralloc_opys.o +src/stralloc_opyb.o +src/stralloc_cat.o +src/stralloc_cats.o +src/stralloc_catb.o +src/stralloc_arts.o +src/stralloc.a +src/strerr_sys.o +src/strerr_die.o +src/strerr.a +src/substdio.o +src/substdi.o +src/substdo.o +src/subfderr.o +src/subfdout.o +src/subfdouts.o +src/subfdin.o +src/subfdins.o +src/substdio_copy.o +src/substdio.a +src/error_str.o +src/error_temp.o +src/error.a +src/str_chr.o +src/str_rchr.o +src/str_start.o +src/byte_chr.o +src/byte_rchr.o +src/byte_copy.o +src/byte_cr.o +src/byte_zero.o +src/str.a +src/fmt_str.o +src/fmt_strn.o +src/fmt_uint.o +src/fmt_uint0.o +src/fmt_ulong.o +src/scan_ulong.o +src/scan_8long.o +src/fs.a +src/datetime.o +src/datetime_un.o +src/datetime.a +src/auto-str.o auto-str auto_qmail.c -auto_qmail.o -auto-int8.o +src/auto_qmail.o +src/auto-int8.o auto-int8 auto_patrn.c -auto_patrn.o +src/auto_patrn.o socket.lib qmail-local -qmail-lspawn.o -select.h -chkspawn.o -auto-int.o +src/qmail-lspawn.o +include/select.h +src/chkspawn.o +src/auto-int.o auto-int auto_spawn.c -auto_spawn.o +src/auto_spawn.o chkspawn -spawn.o -prot.o -coe.o -cdb_hash.o -cdb_unpack.o -cdb_seek.o -cdb.a -uid.o -gid.o +src/spawn.o +src/prot.o +src/coe.o +src/cdb_hash.o +src/cdb_unpack.o +src/cdb_seek.o +src/cdb.a +src/uid.o +src/gid.o qmail-lspawn -qmail-getpw.o +src/qmail-getpw.o auto_break.c -auto_break.o +src/auto_break.o auto_usera.c -auto_usera.o +src/auto_usera.o auto_userd.c -auto_userd.o +src/auto_userd.o auto_userl.c -auto_userl.o +src/auto_userl.o auto_usero.c -auto_usero.o +src/auto_usero.o auto_userp.c -auto_userp.o +src/auto_userp.o auto_userq.c -auto_userq.o +src/auto_userq.o auto_userr.c -auto_userr.o +src/auto_userr.o auto_users.c -auto_users.o +src/auto_users.o auto_groupn.c -auto_groupn.o +src/auto_groupn.o auto_groupq.c -auto_groupq.o +src/auto_groupq.o qmail-getpw -qmail-remote.o -control.o -constmap.o -timeoutread.o -timeoutwrite.o -timeoutconn.o -tcpto.o -dns.o -ip.o -ipalloc.o -hassalen.h -ipme.o -ndelay.o -ndelay_off.o -ndelay.a +src/qmail-remote.o +src/control.o +src/constmap.o +src/timeoutread.o +src/timeoutwrite.o +src/timeoutconn.o +src/tcpto.o +src/dns.o +src/ip.o +src/ipalloc.o +include/hassalen.h +src/ipme.o +src/ndelay.o +src/ndelay_off.o +src/ndelay.a dns.lib qmail-remote -qmail-rspawn.o -tcpto_clean.o +src/qmail-rspawn.o +src/tcpto_clean.o qmail-rspawn -direntry.h -qmail-clean.o -fmtqfn.o +include/direntry.h +src/qmail-clean.o +src/fmtqfn.o auto_split.c -auto_split.o +src/auto_split.o qmail-clean -qmail-send.o -qsutil.o -newfield.o -prioq.o -hasmkffo.h -fifo.o -hasnpbg1.h -trigger.o -readsubdir.o -date822fmt.o +src/qmail-send.o +src/qsutil.o +src/newfield.o +src/prioq.o +include/hasmkffo.h +src/fifo.o +include/hasnpbg1.h +src/trigger.o +src/readsubdir.o +src/date822fmt.o qmail-send -qmail-start.o +src/qmail-start.o qmail-start -splogger.o +src/splogger.o syslog.lib splogger -qmail-queue.o -triggerpull.o +src/qmail-queue.o +src/triggerpull.o qmail-queue -qmail-inject.o -headerbody.o -hfield.o -token822.o +src/qmail-inject.o +src/headerbody.o +src/hfield.o +src/token822.o qmail-inject -predate.o +src/predate.o predate datemail mailsubj qmail-upq -qmail-showctl.o +src/qmail-showctl.o qmail-showctl -qmail-newu.o -cdbmss.o -cdbmake_pack.o -cdbmake_hash.o -cdbmake_add.o -cdbmake.a +src/qmail-newu.o +src/cdbmss.o +src/cdbmake_pack.o +src/cdbmake_hash.o +src/cdbmake_add.o +src/cdbmake.a qmail-newu -qmail-pw2u.o +src/qmail-pw2u.o qmail-pw2u -qmail-qread.o +src/qmail-qread.o qmail-qread qmail-qstat -qmail-tcpto.o +src/qmail-tcpto.o qmail-tcpto -qmail-tcpok.o +src/qmail-tcpok.o qmail-tcpok -qmail-pop3d.o -commands.o -maildir.o +src/qmail-pop3d.o +src/commands.o +src/maildir.o qmail-pop3d -qmail-popup.o +src/qmail-popup.o qmail-popup -qmail-qmqpc.o +src/qmail-qmqpc.o qmail-qmqpc -qmail-qmqpd.o -received.o +src/qmail-qmqpd.o +src/received.o qmail-qmqpd -qmail-qmtpd.o -rcpthosts.o +src/qmail-qmtpd.o +src/rcpthosts.o qmail-qmtpd -qmail-smtpd.o +src/qmail-smtpd.o qmail-smtpd -sendmail.o +src/sendmail.o sendmail -tcp-env.o -remoteinfo.o +src/tcp-env.o +src/remoteinfo.o tcp-env -qmail-newmrh.o +src/qmail-newmrh.o qmail-newmrh config config-fast -dnsdoe.o -dnsptr.o +src/dnsdoe.o +src/dnsptr.o dnsptr -dnsip.o +src/dnsip.o dnsip -dnsfq.o +src/dnsfq.o dnsfq -hostname.o +src/hostname.o hostname -ipmeprint.o +src/ipmeprint.o ipmeprint -qreceipt.o +src/qreceipt.o qreceipt -qbiff.o +src/qbiff.o qbiff -forward.o +src/forward.o forward -preline.o +src/preline.o preline -condredirect.o +src/condredirect.o condredirect -bouncesaying.o +src/bouncesaying.o bouncesaying -except.o +src/except.o except -maildirmake.o +src/maildirmake.o maildirmake -maildir2mbox.o +src/maildir2mbox.o maildir2mbox -hier.o +src/hier.o install -instcheck.o +src/instcheck.o instcheck -instchown.o +src/instchown.o instchown -instfiles.o -instpackage.o +src/instfiles.o +src/instpackage.o instpackage -instqueue.o +src/instqueue.o instqueue -instuidgid.o +src/instuidgid.o home home+df proc @@ -312,66 +312,66 @@ binm2 binm2+df binm3 binm3+df -qmail-local.0 -qmail-lspawn.0 -qmail-getpw.8 -qmail-getpw.0 -qmail-remote.0 -qmail-rspawn.0 -qmail-clean.0 -qmail-send.8 -qmail-send.0 -qmail-start.8 -qmail-start.0 -splogger.0 -qmail-queue.0 -qmail-inject.0 -mailsubj.0 -qmail-showctl.0 -qmail-newu.8 -qmail-newu.0 -qmail-pw2u.8 -qmail-pw2u.0 -qmail-qread.0 -qmail-qstat.0 -qmail-tcpto.0 -qmail-tcpok.0 -qmail-pop3d.0 -qmail-popup.0 -qmail-qmqpc.0 -qmail-qmqpd.0 -qmail-qmtpd.0 -qmail-smtpd.0 -tcp-env.0 -qmail-newmrh.8 -qmail-newmrh.0 -qreceipt.0 -qbiff.0 -forward.0 -preline.0 -condredirect.0 -bouncesaying.0 -except.0 -maildirmake.0 -maildir2mbox.0 -qmail.0 -qmail-limits.7 -qmail-limits.0 -qmail-log.0 -qmail-control.5 -qmail-control.0 -qmail-header.0 -qmail-users.5 -qmail-users.0 -dot-qmail.5 -dot-qmail.0 -qmail-command.0 -tcp-environ.0 -maildir.0 -mbox.0 -addresses.0 -envelopes.0 -forgeries.0 +doc/man/qmail-local.0 +doc/man/qmail-lspawn.0 +doc/man/qmail-getpw.8 +doc/man/qmail-getpw.0 +doc/man/qmail-remote.0 +doc/man/qmail-rspawn.0 +doc/man/qmail-clean.0 +doc/man/qmail-send.8 +doc/man/qmail-send.0 +doc/man/qmail-start.8 +doc/man/qmail-start.0 +doc/man/splogger.0 +doc/man/qmail-queue.0 +doc/man/qmail-inject.0 +doc/man/mailsubj.0 +doc/man/qmail-showctl.0 +doc/man/qmail-newu.8 +doc/man/qmail-newu.0 +doc/man/qmail-pw2u.8 +doc/man/qmail-pw2u.0 +doc/man/qmail-qread.0 +doc/man/qmail-qstat.0 +doc/man/qmail-tcpto.0 +doc/man/qmail-tcpok.0 +doc/man/qmail-pop3d.0 +doc/man/qmail-popup.0 +doc/man/qmail-qmqpc.0 +doc/man/qmail-qmqpd.0 +doc/man/qmail-qmtpd.0 +doc/man/qmail-smtpd.0 +doc/man/tcp-env.0 +doc/man/qmail-newmrh.8 +doc/man/qmail-newmrh.0 +doc/man/qreceipt.0 +doc/man/qbiff.0 +doc/man/forward.0 +doc/man/preline.0 +doc/man/condredirect.0 +doc/man/bouncesaying.0 +doc/man/except.0 +doc/man/maildirmake.0 +doc/man/maildir2mbox.0 +doc/man/qmail.0 +doc/man/qmail-limits.7 +doc/man/qmail-limits.0 +doc/man/qmail-log.0 +doc/man/qmail-control.5 +doc/man/qmail-control.0 +doc/man/qmail-header.0 +doc/man/qmail-users.5 +doc/man/qmail-users.0 +doc/man/dot-qmail.5 +doc/man/dot-qmail.0 +doc/man/qmail-command.0 +doc/man/tcp-environ.0 +doc/man/maildir.0 +doc/man/mbox.0 +doc/man/addresses.0 +doc/man/envelopes.0 +doc/man/forgeries.0 setup -qtmp.h +include/qtmp.h qmail-send.service diff --git a/Makefile b/Makefile @@ -21,8 +21,8 @@ default: it .8.0: $(NROFF) -man $< >$@ -addresses.0: \ -addresses.5 +doc/man/addresses.0: \ +doc/man/addresses.5 auto-ccld.sh: \ conf-cc conf-ld warn-auto.sh @@ -32,149 +32,149 @@ conf-cc conf-ld warn-auto.sh ) > auto-ccld.sh auto-int: \ -load auto-int.o substdio.a error.a str.a fs.a - ./load auto-int substdio.a error.a str.a fs.a +load src/auto-int.o src/substdio.a src/error.a src/str.a src/fs.a + ./load auto-int src/substdio.a src/error.a src/str.a src/fs.a -auto-int.o: \ -compile auto-int.c substdio.h readwrite.h exit.h scan.h fmt.h - ./compile auto-int.c +src/auto-int.o: \ +compile src/auto-int.c include/substdio.h include/readwrite.h include/exit.h include/scan.h include/fmt.h + ./compile src/auto-int.c auto-int8: \ -load auto-int8.o substdio.a error.a str.a fs.a - ./load auto-int8 substdio.a error.a str.a fs.a +load src/auto-int8.o src/substdio.a src/error.a src/str.a src/fs.a + ./load auto-int8 src/substdio.a src/error.a src/str.a src/fs.a -auto-int8.o: \ -compile auto-int8.c substdio.h readwrite.h exit.h scan.h fmt.h - ./compile auto-int8.c +src/auto-int8.o: \ +compile src/auto-int8.c include/substdio.h include/readwrite.h include/exit.h include/scan.h include/fmt.h + ./compile src/auto-int8.c auto-str: \ -load auto-str.o substdio.a error.a str.a - ./load auto-str substdio.a error.a str.a +load src/auto-str.o src/substdio.a src/error.a src/str.a + ./load auto-str src/substdio.a src/error.a src/str.a -auto-str.o: \ -compile auto-str.c substdio.h readwrite.h exit.h - ./compile auto-str.c +src/auto-str.o: \ +compile src/auto-str.c include/substdio.h include/readwrite.h include/exit.h + ./compile src/auto-str.c -auto_break.c: \ +src/auto_break.c: \ auto-str conf-break ./auto-str auto_break \ - "`head -n 1 conf-break`" > auto_break.c + "`head -n 1 conf-break`" > src/auto_break.c -auto_break.o: \ -compile auto_break.c - ./compile auto_break.c +src/auto_break.o: \ +compile src/auto_break.c + ./compile src/auto_break.c -auto_patrn.c: \ +src/auto_patrn.c: \ auto-int8 conf-patrn - ./auto-int8 auto_patrn `head -n 1 conf-patrn` > auto_patrn.c + ./auto-int8 auto_patrn `head -n 1 conf-patrn` > src/auto_patrn.c -auto_patrn.o: \ -compile auto_patrn.c - ./compile auto_patrn.c +src/auto_patrn.o: \ +compile src/auto_patrn.c + ./compile src/auto_patrn.c -auto_qmail.c: \ +src/auto_qmail.c: \ auto-str conf-qmail - ./auto-str auto_qmail `head -n 1 conf-qmail` > auto_qmail.c + ./auto-str auto_qmail `head -n 1 conf-qmail` > src/auto_qmail.c -auto_qmail.o: \ -compile auto_qmail.c - ./compile auto_qmail.c +src/auto_qmail.o: \ +compile src/auto_qmail.c + ./compile src/auto_qmail.c -auto_spawn.c: \ +src/auto_spawn.c: \ auto-int conf-spawn - ./auto-int auto_spawn `head -n 1 conf-spawn` > auto_spawn.c + ./auto-int auto_spawn `head -n 1 conf-spawn` > src/auto_spawn.c -auto_spawn.o: \ -compile auto_spawn.c - ./compile auto_spawn.c +src/auto_spawn.o: \ +compile src/auto_spawn.c + ./compile src/auto_spawn.c -auto_split.c: \ +src/auto_split.c: \ auto-int conf-split - ./auto-int auto_split `head -n 1 conf-split` > auto_split.c + ./auto-int auto_split `head -n 1 conf-split` > src/auto_split.c -auto_split.o: \ -compile auto_split.c - ./compile auto_split.c +src/auto_split.o: \ +compile src/auto_split.c + ./compile src/auto_split.c -auto_usera.c: \ +src/auto_usera.c: \ auto-str conf-users - ./auto-str auto_usera `head -n 1 conf-users` > auto_usera.c + ./auto-str auto_usera `head -n 1 conf-users` > src/auto_usera.c -auto_usera.o: \ -compile auto_usera.c - ./compile auto_usera.c +src/auto_usera.o: \ +compile src/auto_usera.c + ./compile src/auto_usera.c -auto_userd.c: \ +src/auto_userd.c: \ auto-str conf-users - ./auto-str auto_userd `head -n 2 conf-users | tail -1` > auto_userd.c + ./auto-str auto_userd `head -n 2 conf-users | tail -1` > src/auto_userd.c -auto_userd.o: \ -compile auto_userd.c - ./compile auto_userd.c +src/auto_userd.o: \ +compile src/auto_userd.c + ./compile src/auto_userd.c -auto_userl.c: \ +src/auto_userl.c: \ auto-str conf-users - ./auto-str auto_userl `head -n 3 conf-users | tail -1` > auto_userl.c + ./auto-str auto_userl `head -n 3 conf-users | tail -1` > src/auto_userl.c -auto_userl.o: \ -compile auto_userl.c - ./compile auto_userl.c +src/auto_userl.o: \ +compile src/auto_userl.c + ./compile src/auto_userl.c -auto_usero.c: \ +src/auto_usero.c: \ auto-str conf-users - ./auto-str auto_usero `head -n 4 conf-users | tail -1` > auto_usero.c + ./auto-str auto_usero `head -n 4 conf-users | tail -1` > src/auto_usero.c -auto_usero.o: \ -compile auto_usero.c - ./compile auto_usero.c +src/auto_usero.o: \ +compile src/auto_usero.c + ./compile src/auto_usero.c -auto_userp.c: \ +src/auto_userp.c: \ auto-str conf-users - ./auto-str auto_userp `head -n 5 conf-users | tail -1` > auto_userp.c + ./auto-str auto_userp `head -n 5 conf-users | tail -1` > src/auto_userp.c -auto_userp.o: \ -compile auto_userp.c - ./compile auto_userp.c +src/auto_userp.o: \ +compile src/auto_userp.c + ./compile src/auto_userp.c -auto_userq.c: \ +src/auto_userq.c: \ auto-str conf-users - ./auto-str auto_userq `head -n 6 conf-users | tail -1` > auto_userq.c + ./auto-str auto_userq `head -n 6 conf-users | tail -1` > src/auto_userq.c -auto_userq.o: \ -compile auto_userq.c - ./compile auto_userq.c +src/auto_userq.o: \ +compile src/auto_userq.c + ./compile src/auto_userq.c -auto_userr.c: \ +src/auto_userr.c: \ auto-str conf-users - ./auto-str auto_userr `head -n 7 conf-users | tail -1` > auto_userr.c + ./auto-str auto_userr `head -n 7 conf-users | tail -1` > src/auto_userr.c -auto_userr.o: \ -compile auto_userr.c - ./compile auto_userr.c +src/auto_userr.o: \ +compile src/auto_userr.c + ./compile src/auto_userr.c -auto_users.c: \ +src/auto_users.c: \ auto-str conf-users - ./auto-str auto_users `head -n 8 conf-users | tail -1` > auto_users.c + ./auto-str auto_users `head -n 8 conf-users | tail -1` > src/auto_users.c -auto_users.o: \ -compile auto_users.c - ./compile auto_users.c +src/auto_users.o: \ +compile src/auto_users.c + ./compile src/auto_users.c -auto_groupn.c: \ +src/auto_groupn.c: \ auto-str conf-groups - ./auto-str auto_groupn `head -n 2 conf-groups | tail -1` > auto_groupn.c + ./auto-str auto_groupn `head -n 2 conf-groups | tail -1` > src/auto_groupn.c -auto_groupn.o: \ -compile auto_groupn.c - ./compile auto_groupn.c +src/auto_groupn.o: \ +compile src/auto_groupn.c + ./compile src/auto_groupn.c -auto_groupq.c: \ +src/auto_groupq.c: \ auto-str conf-groups - ./auto-str auto_groupq `head -n 1 conf-groups` > auto_groupq.c + ./auto-str auto_groupq `head -n 1 conf-groups` > src/auto_groupq.c -auto_groupq.o: \ -compile auto_groupq.c - ./compile auto_groupq.c +src/auto_groupq.o: \ +compile src/auto_groupq.c + ./compile src/auto_groupq.c binm1: \ binm1.sh conf-qmail @@ -219,127 +219,127 @@ binm3+df.sh conf-qmail chmod 755 binm3+df bouncesaying: \ -load bouncesaying.o strerr.a error.a substdio.a str.a wait.a - ./load bouncesaying strerr.a error.a substdio.a str.a \ - wait.a +load src/bouncesaying.o src/strerr.a src/error.a src/substdio.a src/str.a src/wait.a + ./load bouncesaying src/strerr.a src/error.a src/substdio.a src/str.a \ + src/wait.a -bouncesaying.0: \ -bouncesaying.1 +doc/man/bouncesaying.0: \ +doc/man/bouncesaying.1 -bouncesaying.o: \ -compile bouncesaying.c fork.h strerr.h error.h wait.h sig.h exit.h - ./compile bouncesaying.c +src/bouncesaying.o: \ +compile src/bouncesaying.c include/fork.h include/strerr.h include/error.h include/wait.h include/sig.h include/exit.h + ./compile src/bouncesaying.c -byte_chr.o: \ -compile byte_chr.c byte.h - ./compile byte_chr.c +src/byte_chr.o: \ +compile src/byte_chr.c include/byte.h + ./compile src/byte_chr.c -byte_copy.o: \ -compile byte_copy.c byte.h - ./compile byte_copy.c +src/byte_copy.o: \ +compile src/byte_copy.c include/byte.h + ./compile src/byte_copy.c -byte_cr.o: \ -compile byte_cr.c byte.h - ./compile byte_cr.c +src/byte_cr.o: \ +compile src/byte_cr.c include/byte.h + ./compile src/byte_cr.c -byte_rchr.o: \ -compile byte_rchr.c byte.h - ./compile byte_rchr.c +src/byte_rchr.o: \ +compile src/byte_rchr.c include/byte.h + ./compile src/byte_rchr.c -byte_zero.o: \ -compile byte_zero.c byte.h - ./compile byte_zero.c +src/byte_zero.o: \ +compile src/byte_zero.c include/byte.h + ./compile src/byte_zero.c -case.a: \ -makelib case_diffb.o case_diffs.o case_lowerb.o case_lowers.o \ -case_starts.o - ./makelib case.a case_diffb.o case_diffs.o case_lowerb.o \ - case_lowers.o case_starts.o +src/case.a: \ +makelib src/case_diffb.o src/case_diffs.o src/case_lowerb.o src/case_lowers.o \ +src/case_starts.o + ./makelib src/case.a src/case_diffb.o src/case_diffs.o src/case_lowerb.o \ + src/case_lowers.o src/case_starts.o -case_diffb.o: \ -compile case_diffb.c case.h - ./compile case_diffb.c +src/case_diffb.o: \ +compile src/case_diffb.c include/case.h + ./compile src/case_diffb.c -case_diffs.o: \ -compile case_diffs.c case.h - ./compile case_diffs.c +src/case_diffs.o: \ +compile src/case_diffs.c include/case.h + ./compile src/case_diffs.c -case_lowerb.o: \ -compile case_lowerb.c case.h - ./compile case_lowerb.c +src/case_lowerb.o: \ +compile src/case_lowerb.c include/case.h + ./compile src/case_lowerb.c -case_lowers.o: \ -compile case_lowers.c case.h - ./compile case_lowers.c +src/case_lowers.o: \ +compile src/case_lowers.c include/case.h + ./compile src/case_lowers.c -case_starts.o: \ -compile case_starts.c case.h - ./compile case_starts.c +src/case_starts.o: \ +compile src/case_starts.c include/case.h + ./compile src/case_starts.c -cdb.a: \ -makelib cdb_hash.o cdb_unpack.o cdb_seek.o - ./makelib cdb.a cdb_hash.o cdb_unpack.o cdb_seek.o +src/cdb.a: \ +makelib src/cdb_hash.o src/cdb_unpack.o src/cdb_seek.o + ./makelib src/cdb.a src/cdb_hash.o src/cdb_unpack.o src/cdb_seek.o -cdb_hash.o: \ -compile cdb_hash.c cdb.h uint32.h - ./compile cdb_hash.c +src/cdb_hash.o: \ +compile src/cdb_hash.c include/cdb.h include/uint32.h + ./compile src/cdb_hash.c -cdb_seek.o: \ -compile cdb_seek.c cdb.h uint32.h - ./compile cdb_seek.c +src/cdb_seek.o: \ +compile src/cdb_seek.c include/cdb.h include/uint32.h + ./compile src/cdb_seek.c -cdb_unpack.o: \ -compile cdb_unpack.c cdb.h uint32.h - ./compile cdb_unpack.c +src/cdb_unpack.o: \ +compile src/cdb_unpack.c include/cdb.h include/uint32.h + ./compile src/cdb_unpack.c -cdbmake.a: \ -makelib cdbmake_pack.o cdbmake_hash.o cdbmake_add.o - ./makelib cdbmake.a cdbmake_pack.o cdbmake_hash.o \ - cdbmake_add.o +src/cdbmake.a: \ +makelib src/cdbmake_pack.o src/cdbmake_hash.o src/cdbmake_add.o + ./makelib src/cdbmake.a src/cdbmake_pack.o src/cdbmake_hash.o \ + src/cdbmake_add.o -cdbmake_add.o: \ -compile cdbmake_add.c cdbmake.h alloc.h uint32.h - ./compile cdbmake_add.c +src/cdbmake_add.o: \ +compile src/cdbmake_add.c include/cdbmake.h include/alloc.h include/uint32.h + ./compile src/cdbmake_add.c -cdbmake_hash.o: \ -compile cdbmake_hash.c cdbmake.h uint32.h - ./compile cdbmake_hash.c +src/cdbmake_hash.o: \ +compile src/cdbmake_hash.c include/cdbmake.h include/uint32.h + ./compile src/cdbmake_hash.c -cdbmake_pack.o: \ -compile cdbmake_pack.c cdbmake.h uint32.h - ./compile cdbmake_pack.c +src/cdbmake_pack.o: \ +compile src/cdbmake_pack.c include/cdbmake.h include/uint32.h + ./compile src/cdbmake_pack.c -cdbmss.o: \ -compile cdbmss.c readwrite.h seek.h alloc.h cdbmss.h cdbmake.h \ -uint32.h substdio.h - ./compile cdbmss.c +src/cdbmss.o: \ +compile src/cdbmss.c include/readwrite.h include/seek.h include/alloc.h include/cdbmss.h include/cdbmake.h \ +include/uint32.h include/substdio.h + ./compile src/cdbmss.c check: \ it man ./instcheck chkspawn: \ -load chkspawn.o substdio.a error.a str.a fs.a auto_spawn.o - ./load chkspawn substdio.a error.a str.a fs.a auto_spawn.o +load src/chkspawn.o src/substdio.a src/error.a src/str.a src/fs.a src/auto_spawn.o + ./load chkspawn src/substdio.a src/error.a src/str.a src/fs.a src/auto_spawn.o -chkspawn.o: \ -compile chkspawn.c substdio.h subfd.h substdio.h fmt.h select.h \ -auto_spawn.h - ./compile chkspawn.c +src/chkspawn.o: \ +compile src/chkspawn.c include/substdio.h include/subfd.h include/substdio.h include/fmt.h include/select.h \ +include/auto_spawn.h + ./compile src/chkspawn.c clean: \ TARGETS rm -f `grep -v '^#' TARGETS` $(MAKE) -C tests clean -coe.o: \ -compile coe.c coe.h - ./compile coe.c +src/coe.o: \ +compile src/coe.c include/coe.h + ./compile src/coe.c -commands.o: \ -compile commands.c commands.h substdio.h stralloc.h gen_alloc.h str.h \ -case.h - ./compile commands.c +src/commands.o: \ +compile src/commands.c include/commands.h include/substdio.h include/stralloc.h include/gen_alloc.h include/str.h \ +include/case.h + ./compile src/commands.c compile: \ make-compile warn-auto.sh @@ -347,18 +347,18 @@ make-compile warn-auto.sh chmod 755 compile condredirect: \ -load condredirect.o qmail.o strerr.a fd.a sig.a wait.a env.a \ -substdio.a error.a str.a fs.a auto_qmail.o - ./load condredirect qmail.o strerr.a fd.a sig.a wait.a \ - env.a substdio.a error.a str.a fs.a auto_qmail.o +load src/condredirect.o src/qmail.o src/strerr.a src/fd.a src/sig.a src/wait.a src/env.a \ +src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o + ./load condredirect src/qmail.o src/strerr.a src/fd.a src/sig.a src/wait.a \ + src/env.a src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o -condredirect.0: \ -condredirect.1 +doc/man/condredirect.0: \ +doc/man/condredirect.1 -condredirect.o: \ -compile condredirect.c sig.h readwrite.h exit.h env.h error.h fork.h \ -wait.h seek.h qmail.h substdio.h strerr.h substdio.h fmt.h - ./compile condredirect.c +src/condredirect.o: \ +compile src/condredirect.c include/sig.h include/readwrite.h include/exit.h include/env.h include/error.h include/fork.h \ +include/wait.h include/seek.h include/qmail.h include/substdio.h include/strerr.h include/substdio.h include/fmt.h + ./compile src/condredirect.c config: \ warn-auto.sh config.sh conf-qmail conf-break conf-split @@ -378,18 +378,18 @@ warn-auto.sh config-fast.sh conf-qmail conf-break conf-split > config-fast chmod 755 config-fast -constmap.o: \ -compile constmap.c constmap.h alloc.h case.h - ./compile constmap.c +src/constmap.o: \ +compile src/constmap.c include/constmap.h include/alloc.h include/case.h + ./compile src/constmap.c -control.o: \ -compile control.c readwrite.h open.h getln.h stralloc.h gen_alloc.h \ -substdio.h error.h control.h alloc.h scan.h - ./compile control.c +src/control.o: \ +compile src/control.c include/readwrite.h include/open.h include/getln.h include/stralloc.h include/gen_alloc.h \ +include/substdio.h include/error.h include/control.h include/alloc.h include/scan.h + ./compile src/control.c -date822fmt.o: \ -compile date822fmt.c datetime.h fmt.h date822fmt.h - ./compile date822fmt.c +src/date822fmt.o: \ +compile src/date822fmt.c include/datetime.h include/fmt.h include/date822fmt.h + ./compile src/date822fmt.c datemail: \ warn-auto.sh datemail.sh conf-qmail conf-break conf-split @@ -400,273 +400,273 @@ warn-auto.sh datemail.sh conf-qmail conf-break conf-split > datemail chmod 755 datemail -datetime.a: \ -makelib datetime.o datetime_un.o - ./makelib datetime.a datetime.o datetime_un.o +src/datetime.a: \ +makelib src/datetime.o src/datetime_un.o + ./makelib src/datetime.a src/datetime.o src/datetime_un.o -datetime.o: \ -compile datetime.c datetime.h - ./compile datetime.c +src/datetime.o: \ +compile src/datetime.c include/datetime.h + ./compile src/datetime.c -datetime_un.o: \ -compile datetime_un.c datetime.h - ./compile datetime_un.c +src/datetime_un.o: \ +compile src/datetime_un.c include/datetime.h + ./compile src/datetime_un.c -direntry.h: \ -compile trydrent.c direntry.h1 direntry.h2 - ( ./compile trydrent.c >/dev/null 2>&1 \ - && cat direntry.h2 || cat direntry.h1 ) > direntry.h - rm -f trydrent.o +include/direntry.h: \ +compile src/trydrent.c include/direntry.h1 include/direntry.h2 + ( ./compile src/trydrent.c >/dev/null 2>&1 \ + && cat include/direntry.h2 || cat include/direntry.h1 ) > include/direntry.h + rm -f src/trydrent.o dns.lib: \ -tryrsolv.c compile load socket.lib dns.o ipalloc.o ip.o stralloc.a \ -error.a fs.a str.a - ( ( ./compile tryrsolv.c && ./load tryrsolv dns.o \ - ipalloc.o ip.o stralloc.a error.a fs.a str.a \ +src/tryrsolv.c compile load socket.lib src/dns.o src/ipalloc.o src/ip.o src/stralloc.a \ +src/error.a src/fs.a src/str.a + ( ( ./compile src/tryrsolv.c && ./load tryrsolv src/dns.o \ + src/ipalloc.o src/ip.o src/stralloc.a src/error.a src/fs.a src/str.a \ -lresolv `cat socket.lib` ) >/dev/null 2>&1 \ && echo -lresolv || exit 0 ) > dns.lib - rm -f tryrsolv.o tryrsolv + rm -f src/tryrsolv.o tryrsolv -dns.o: \ -compile dns.c ip.h ipalloc.h ip.h gen_alloc.h fmt.h alloc.h str.h \ -stralloc.h gen_alloc.h dns.h case.h - ./compile dns.c +src/dns.o: \ +compile src/dns.c include/ip.h include/ipalloc.h include/ip.h include/gen_alloc.h include/fmt.h include/alloc.h include/str.h \ +include/stralloc.h include/gen_alloc.h include/dns.h include/case.h + ./compile src/dns.c -dnsdoe.o: \ -compile dnsdoe.c substdio.h subfd.h substdio.h exit.h dns.h dnsdoe.h - ./compile dnsdoe.c +src/dnsdoe.o: \ +compile src/dnsdoe.c include/substdio.h include/subfd.h include/substdio.h include/exit.h include/dns.h include/dnsdoe.h + ./compile src/dnsdoe.c dnsfq: \ -load dnsfq.o dns.o dnsdoe.o ip.o ipalloc.o stralloc.a \ -substdio.a error.a str.a fs.a dns.lib socket.lib - ./load dnsfq dns.o dnsdoe.o ip.o ipalloc.o stralloc.a \ - substdio.a error.a str.a fs.a `cat dns.lib` `cat socket.lib` +load src/dnsfq.o src/dns.o src/dnsdoe.o src/ip.o src/ipalloc.o src/stralloc.a \ +src/substdio.a src/error.a src/str.a src/fs.a dns.lib socket.lib + ./load dnsfq src/dns.o src/dnsdoe.o src/ip.o src/ipalloc.o src/stralloc.a \ + src/substdio.a src/error.a src/str.a src/fs.a `cat dns.lib` `cat socket.lib` -dnsfq.o: \ -compile dnsfq.c substdio.h subfd.h substdio.h stralloc.h gen_alloc.h \ -dns.h dnsdoe.h ip.h ipalloc.h ip.h gen_alloc.h - ./compile dnsfq.c +src/dnsfq.o: \ +compile src/dnsfq.c include/substdio.h include/subfd.h include/substdio.h include/stralloc.h include/gen_alloc.h \ +include/dns.h include/dnsdoe.h include/ip.h include/ipalloc.h include/ip.h include/gen_alloc.h + ./compile src/dnsfq.c dnsip: \ -load dnsip.o dns.o dnsdoe.o ip.o ipalloc.o stralloc.a \ -substdio.a error.a str.a fs.a dns.lib socket.lib - ./load dnsip dns.o dnsdoe.o ip.o ipalloc.o stralloc.a \ - substdio.a error.a str.a fs.a `cat dns.lib` `cat socket.lib` +load src/dnsip.o src/dns.o src/dnsdoe.o src/ip.o src/ipalloc.o src/stralloc.a \ +src/substdio.a src/error.a src/str.a src/fs.a dns.lib socket.lib + ./load dnsip src/dns.o src/dnsdoe.o src/ip.o src/ipalloc.o src/stralloc.a \ + src/substdio.a src/error.a src/str.a src/fs.a `cat dns.lib` `cat socket.lib` -dnsip.o: \ -compile dnsip.c substdio.h subfd.h substdio.h stralloc.h gen_alloc.h \ -dns.h dnsdoe.h ip.h ipalloc.h ip.h gen_alloc.h - ./compile dnsip.c +src/dnsip.o: \ +compile src/dnsip.c include/substdio.h include/subfd.h include/substdio.h include/stralloc.h include/gen_alloc.h \ +include/dns.h include/dnsdoe.h include/ip.h include/ipalloc.h include/ip.h include/gen_alloc.h + ./compile src/dnsip.c dnsptr: \ -load dnsptr.o dns.o dnsdoe.o ip.o ipalloc.o stralloc.a \ -substdio.a error.a str.a fs.a dns.lib socket.lib - ./load dnsptr dns.o dnsdoe.o ip.o ipalloc.o stralloc.a \ - substdio.a error.a str.a fs.a `cat dns.lib` `cat socket.lib` - -dnsptr.o: \ -compile dnsptr.c substdio.h subfd.h substdio.h stralloc.h gen_alloc.h \ -str.h scan.h dns.h dnsdoe.h ip.h - ./compile dnsptr.c - -dot-qmail.0: \ -dot-qmail.5 - -dot-qmail.5: \ -dot-qmail.9 conf-qmail conf-break conf-spawn - cat dot-qmail.9 \ +load src/dnsptr.o src/dns.o src/dnsdoe.o src/ip.o src/ipalloc.o src/stralloc.a \ +src/substdio.a src/error.a src/str.a src/fs.a dns.lib socket.lib + ./load dnsptr src/dns.o src/dnsdoe.o src/ip.o src/ipalloc.o src/stralloc.a \ + src/substdio.a src/error.a src/str.a src/fs.a `cat dns.lib` `cat socket.lib` + +src/dnsptr.o: \ +compile src/dnsptr.c include/substdio.h include/subfd.h include/substdio.h include/stralloc.h include/gen_alloc.h \ +include/str.h include/scan.h include/dns.h include/dnsdoe.h include/ip.h + ./compile src/dnsptr.c + +doc/man/dot-qmail.0: \ +doc/man/dot-qmail.5 + +doc/man/dot-qmail.5: \ +doc/man/dot-qmail.9 conf-qmail conf-break conf-spawn + cat doc/man/dot-qmail.9 \ | sed s}QMAILHOME}"`head -n 1 conf-qmail`"}g \ | sed s}BREAK}"`head -n 1 conf-break`"}g \ | sed s}SPAWN}"`head -n 1 conf-spawn`"}g \ - > dot-qmail.5 + > doc/man/dot-qmail.5 -env.a: \ -makelib env.o envread.o - ./makelib env.a env.o envread.o +src/env.a: \ +makelib src/env.o src/envread.o + ./makelib src/env.a src/env.o src/envread.o -env.o: \ -compile env.c str.h alloc.h env.h - ./compile env.c +src/env.o: \ +compile src/env.c include/str.h include/alloc.h include/env.h + ./compile src/env.c -envelopes.0: \ -envelopes.5 +doc/man/envelopes.0: \ +doc/man/envelopes.5 -envread.o: \ -compile envread.c env.h str.h - ./compile envread.c +src/envread.o: \ +compile src/envread.c include/env.h include/str.h + ./compile src/envread.c -error.a: \ -makelib error_str.o error_temp.o - ./makelib error.a error_str.o error_temp.o +src/error.a: \ +makelib src/error_str.o src/error_temp.o + ./makelib src/error.a src/error_str.o src/error_temp.o -error_str.o: \ -compile error_str.c error.h - ./compile error_str.c +src/error_str.o: \ +compile src/error_str.c include/error.h + ./compile src/error_str.c -error_temp.o: \ -compile error_temp.c error.h - ./compile error_temp.c +src/error_temp.o: \ +compile src/error_temp.c include/error.h + ./compile src/error_temp.c except: \ -load except.o strerr.a error.a substdio.a str.a wait.a - ./load except strerr.a error.a substdio.a str.a wait.a +load src/except.o src/strerr.a src/error.a src/substdio.a src/str.a src/wait.a + ./load except src/strerr.a src/error.a src/substdio.a src/str.a src/wait.a -except.0: \ -except.1 +doc/man/except.0: \ +doc/man/except.1 -except.o: \ -compile except.c fork.h strerr.h wait.h error.h exit.h - ./compile except.c +src/except.o: \ +compile src/except.c include/fork.h include/strerr.h include/wait.h include/error.h include/exit.h + ./compile src/except.c -fd.a: \ -makelib fd_copy.o fd_move.o - ./makelib fd.a fd_copy.o fd_move.o +src/fd.a: \ +makelib src/fd_copy.o src/fd_move.o + ./makelib src/fd.a src/fd_copy.o src/fd_move.o -fd_copy.o: \ -compile fd_copy.c fd.h - ./compile fd_copy.c +src/fd_copy.o: \ +compile src/fd_copy.c include/fd.h + ./compile src/fd_copy.c -fd_move.o: \ -compile fd_move.c fd.h - ./compile fd_move.c +src/fd_move.o: \ +compile src/fd_move.c include/fd.h + ./compile src/fd_move.c -fifo.o: \ -compile fifo.c hasmkffo.h fifo.h - ./compile fifo.c +src/fifo.o: \ +compile src/fifo.c include/hasmkffo.h include/fifo.h + ./compile src/fifo.c -fmt_str.o: \ -compile fmt_str.c fmt.h - ./compile fmt_str.c +src/fmt_str.o: \ +compile src/fmt_str.c include/fmt.h + ./compile src/fmt_str.c -fmt_strn.o: \ -compile fmt_strn.c fmt.h - ./compile fmt_strn.c +src/fmt_strn.o: \ +compile src/fmt_strn.c include/fmt.h + ./compile src/fmt_strn.c -fmt_uint.o: \ -compile fmt_uint.c fmt.h - ./compile fmt_uint.c +src/fmt_uint.o: \ +compile src/fmt_uint.c include/fmt.h + ./compile src/fmt_uint.c -fmt_uint0.o: \ -compile fmt_uint0.c fmt.h - ./compile fmt_uint0.c +src/fmt_uint0.o: \ +compile src/fmt_uint0.c include/fmt.h + ./compile src/fmt_uint0.c -fmt_ulong.o: \ -compile fmt_ulong.c fmt.h - ./compile fmt_ulong.c +src/fmt_ulong.o: \ +compile src/fmt_ulong.c include/fmt.h + ./compile src/fmt_ulong.c -fmtqfn.o: \ -compile fmtqfn.c fmtqfn.h fmt.h auto_split.h - ./compile fmtqfn.c +src/fmtqfn.o: \ +compile src/fmtqfn.c include/fmtqfn.h include/fmt.h include/auto_split.h + ./compile src/fmtqfn.c -forgeries.0: \ -forgeries.7 +doc/man/forgeries.0: \ +doc/man/forgeries.7 forward: \ -load forward.o qmail.o strerr.a fd.a wait.a sig.a env.a \ -substdio.a error.a str.a fs.a auto_qmail.o - ./load forward qmail.o strerr.a fd.a wait.a sig.a \ - env.a substdio.a error.a str.a fs.a auto_qmail.o - -forward.0: \ -forward.1 - -forward.o: \ -compile forward.c sig.h readwrite.h env.h qmail.h substdio.h \ -strerr.h substdio.h fmt.h - ./compile forward.c - -fs.a: \ -makelib fmt_str.o fmt_strn.o fmt_uint.o fmt_uint0.o fmt_ulong.o \ -scan_ulong.o scan_8long.o - ./makelib fs.a fmt_str.o fmt_strn.o fmt_uint.o fmt_uint0.o \ - fmt_ulong.o scan_ulong.o scan_8long.o - -getln.a: \ -makelib getln.o getln2.o - ./makelib getln.a getln.o getln2.o - -getln.o: \ -compile getln.c substdio.h byte.h stralloc.h gen_alloc.h getln.h - ./compile getln.c - -getln2.o: \ -compile getln2.c substdio.h stralloc.h gen_alloc.h byte.h getln.h - ./compile getln2.c - -getopt.a: \ -makelib subgetopt.o sgetopt.o - ./makelib getopt.a subgetopt.o sgetopt.o - -gfrom.o: \ -compile gfrom.c str.h gfrom.h - ./compile gfrom.c - -gid.o: \ -compile gid.c uidgid.h subfd.h substdio.h exit.h - ./compile gid.c - -hasflock.h: \ -tryflock.c compile load - ( ( ./compile tryflock.c && ./load tryflock ) >/dev/null \ +load src/forward.o src/qmail.o src/strerr.a src/fd.a src/wait.a src/sig.a src/env.a \ +src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o + ./load forward src/qmail.o src/strerr.a src/fd.a src/wait.a src/sig.a \ + src/env.a src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o + +doc/man/forward.0: \ +doc/man/forward.1 + +src/forward.o: \ +compile src/forward.c include/sig.h include/readwrite.h include/env.h include/qmail.h include/substdio.h \ +include/strerr.h include/substdio.h include/fmt.h + ./compile src/forward.c + +src/fs.a: \ +makelib src/fmt_str.o src/fmt_strn.o src/fmt_uint.o src/fmt_uint0.o src/fmt_ulong.o \ +src/scan_ulong.o src/scan_8long.o + ./makelib src/fs.a src/fmt_str.o src/fmt_strn.o src/fmt_uint.o src/fmt_uint0.o \ + src/fmt_ulong.o src/scan_ulong.o src/scan_8long.o + +src/getln.a: \ +makelib src/getln.o src/getln2.o + ./makelib src/getln.a src/getln.o src/getln2.o + +src/getln.o: \ +compile src/getln.c include/substdio.h include/byte.h include/stralloc.h include/gen_alloc.h include/getln.h + ./compile src/getln.c + +src/getln2.o: \ +compile src/getln2.c include/substdio.h include/stralloc.h include/gen_alloc.h include/byte.h include/getln.h + ./compile src/getln2.c + +src/getopt.a: \ +makelib src/subgetopt.o src/sgetopt.o + ./makelib src/getopt.a src/subgetopt.o src/sgetopt.o + +src/gfrom.o: \ +compile src/gfrom.c include/str.h include/gfrom.h + ./compile src/gfrom.c + +src/gid.o: \ +compile src/gid.c include/uidgid.h include/subfd.h include/substdio.h include/exit.h + ./compile src/gid.c + +include/hasflock.h: \ +src/tryflock.c compile load + ( ( ./compile src/tryflock.c && ./load tryflock ) >/dev/null \ 2>&1 \ - && echo \#define HASFLOCK 1 || exit 0 ) > hasflock.h - rm -f tryflock.o tryflock + && echo \#define HASFLOCK 1 || exit 0 ) > include/hasflock.h + rm -f src/tryflock.o tryflock -hasmkffo.h: \ -trymkffo.c compile load - ( ( ./compile trymkffo.c && ./load trymkffo ) >/dev/null \ +include/hasmkffo.h: \ +src/trymkffo.c compile load + ( ( ./compile src/trymkffo.c && ./load trymkffo ) >/dev/null \ 2>&1 \ - && echo \#define HASMKFIFO 1 || exit 0 ) > hasmkffo.h - rm -f trymkffo.o trymkffo + && echo \#define HASMKFIFO 1 || exit 0 ) > include/hasmkffo.h + rm -f src/trymkffo.o trymkffo -hasnpbg1.h: \ -trynpbg1.c compile load open.h open.a fifo.h fifo.o select.h - ( ( ./compile trynpbg1.c \ - && ./load trynpbg1 fifo.o open.a && ./trynpbg1 ) \ +include/hasnpbg1.h: \ +src/trynpbg1.c compile load include/open.h src/open.a include/fifo.h src/fifo.o include/select.h + ( ( ./compile src/trynpbg1.c \ + && ./load trynpbg1 src/fifo.o src/open.a && ./trynpbg1 ) \ >/dev/null 2>&1 \ && echo \#define HASNAMEDPIPEBUG1 1 || exit 0 ) > \ - hasnpbg1.h - rm -f trynpbg1.o trynpbg1 - -hassalen.h: \ -trysalen.c compile - ( ./compile trysalen.c >/dev/null 2>&1 \ - && echo \#define HASSALEN 1 || exit 0 ) > hassalen.h - rm -f trysalen.o - -hassgact.h: \ -trysgact.c compile load - ( ( ./compile trysgact.c && ./load trysgact ) >/dev/null \ + include/hasnpbg1.h + rm -f src/trynpbg1.o trynpbg1 + +include/hassalen.h: \ +src/trysalen.c compile + ( ./compile src/trysalen.c >/dev/null 2>&1 \ + && echo \#define HASSALEN 1 || exit 0 ) > include/hassalen.h + rm -f src/trysalen.o + +include/hassgact.h: \ +src/trysgact.c compile load + ( ( ./compile src/trysgact.c && ./load trysgact ) >/dev/null \ 2>&1 \ - && echo \#define HASSIGACTION 1 || exit 0 ) > hassgact.h - rm -f trysgact.o trysgact + && echo \#define HASSIGACTION 1 || exit 0 ) > include/hassgact.h + rm -f src/trysgact.o trysgact -hassgprm.h: \ -trysgprm.c compile load - ( ( ./compile trysgprm.c && ./load trysgprm ) >/dev/null \ +include/hassgprm.h: \ +src/trysgprm.c compile load + ( ( ./compile src/trysgprm.c && ./load trysgprm ) >/dev/null \ 2>&1 \ - && echo \#define HASSIGPROCMASK 1 || exit 0 ) > hassgprm.h - rm -f trysgprm.o trysgprm + && echo \#define HASSIGPROCMASK 1 || exit 0 ) > include/hassgprm.h + rm -f src/trysgprm.o trysgprm -haswaitp.h: \ -trywaitp.c compile load - ( ( ./compile trywaitp.c && ./load trywaitp ) >/dev/null \ +include/haswaitp.h: \ +src/trywaitp.c compile load + ( ( ./compile src/trywaitp.c && ./load trywaitp ) >/dev/null \ 2>&1 \ - && echo \#define HASWAITPID 1 || exit 0 ) > haswaitp.h - rm -f trywaitp.o trywaitp + && echo \#define HASWAITPID 1 || exit 0 ) > include/haswaitp.h + rm -f src/trywaitp.o trywaitp -headerbody.o: \ -compile headerbody.c stralloc.h gen_alloc.h substdio.h getln.h \ -hfield.h headerbody.h - ./compile headerbody.c +src/headerbody.o: \ +compile src/headerbody.c include/stralloc.h include/gen_alloc.h include/substdio.h include/getln.h \ +include/hfield.h include/headerbody.h + ./compile src/headerbody.c -hfield.o: \ -compile hfield.c hfield.h - ./compile hfield.c +src/hfield.o: \ +compile src/hfield.c include/hfield.h + ./compile src/hfield.c -hier.o: \ -compile hier.c auto_qmail.h auto_split.h auto_uids.h fmt.h fifo.h hier.h - ./compile hier.c +src/hier.o: \ +compile src/hier.c include/auto_qmail.h include/auto_split.h include/auto_uids.h include/fmt.h include/fifo.h include/hier.h + ./compile src/hier.c home: \ home.sh conf-qmail @@ -683,13 +683,13 @@ home+df.sh conf-qmail chmod 755 home+df hostname: \ -load hostname.o substdio.a error.a str.a dns.lib socket.lib - ./load hostname substdio.a error.a str.a `cat dns.lib` \ +load src/hostname.o src/substdio.a src/error.a src/str.a dns.lib socket.lib + ./load hostname src/substdio.a src/error.a src/str.a `cat dns.lib` \ `cat socket.lib` -hostname.o: \ -compile hostname.c substdio.h subfd.h substdio.h readwrite.h - ./compile hostname.c +src/hostname.o: \ +compile src/hostname.c include/substdio.h include/subfd.h include/substdio.h include/readwrite.h + ./compile src/hostname.c install: \ instpackage instchown warn-auto.sh @@ -697,78 +697,78 @@ instpackage instchown warn-auto.sh chmod 755 install instcheck: \ -load instcheck.o instuidgid.o fifo.o hier.o auto_qmail.o auto_split.o \ -ids.a strerr.a substdio.a error.a str.a fs.a - ./load instcheck instuidgid.o fifo.o hier.o auto_qmail.o auto_split.o \ - ids.a strerr.a substdio.a error.a str.a fs.a +load src/instcheck.o src/instuidgid.o src/fifo.o src/hier.o src/auto_qmail.o src/auto_split.o \ +src/ids.a src/strerr.a src/substdio.a src/error.a src/str.a src/fs.a + ./load instcheck src/instuidgid.o src/fifo.o src/hier.o src/auto_qmail.o src/auto_split.o \ + src/ids.a src/strerr.a src/substdio.a src/error.a src/str.a src/fs.a -instcheck.o: \ -compile instcheck.c strerr.h error.h readwrite.h hier.h - ./compile instcheck.c +src/instcheck.o: \ +compile src/instcheck.c include/strerr.h include/error.h include/readwrite.h include/hier.h + ./compile src/instcheck.c instchown: \ -load instchown.o instuidgid.o fifo.o hier.o auto_qmail.o auto_split.o \ -ids.a strerr.a substdio.a error.a str.a fs.a - ./load instchown instuidgid.o fifo.o hier.o auto_qmail.o auto_split.o \ - ids.a strerr.a substdio.a error.a str.a fs.a +load src/instchown.o src/instuidgid.o src/fifo.o src/hier.o src/auto_qmail.o src/auto_split.o \ +src/ids.a src/strerr.a src/substdio.a src/error.a src/str.a src/fs.a + ./load instchown src/instuidgid.o src/fifo.o src/hier.o src/auto_qmail.o src/auto_split.o \ + src/ids.a src/strerr.a src/substdio.a src/error.a src/str.a src/fs.a -instchown.o: \ -compile instchown.c strerr.h error.h exit.h hier.h - ./compile instchown.c +src/instchown.o: \ +compile src/instchown.c include/strerr.h include/error.h include/exit.h include/hier.h + ./compile src/instchown.c -instfiles.o: \ -compile instfiles.c substdio.h strerr.h env.h error.h fifo.h open.h \ -str.h stralloc.h - ./compile instfiles.c +src/instfiles.o: \ +compile src/instfiles.c include/substdio.h include/strerr.h include/env.h include/error.h include/fifo.h include/open.h \ +include/str.h include/stralloc.h + ./compile src/instfiles.c instpackage: \ -load instpackage.o instfiles.o fifo.o hier.o auto_qmail.o auto_split.o strerr.a \ -substdio.a open.a error.a env.a str.a fs.a stralloc.a - ./load instpackage instfiles.o fifo.o hier.o auto_qmail.o auto_split.o \ - strerr.a substdio.a open.a error.a env.a str.a fs.a stralloc.a +load src/instpackage.o src/instfiles.o src/fifo.o src/hier.o src/auto_qmail.o src/auto_split.o src/strerr.a \ +src/substdio.a src/open.a src/error.a src/env.a src/str.a src/fs.a src/stralloc.a + ./load instpackage src/instfiles.o src/fifo.o src/hier.o src/auto_qmail.o src/auto_split.o \ + src/strerr.a src/substdio.a src/open.a src/error.a src/env.a src/str.a src/fs.a src/stralloc.a -instpackage.o: \ -compile instpackage.c open.h strerr.h hier.h - ./compile instpackage.c +src/instpackage.o: \ +compile src/instpackage.c include/open.h include/strerr.h include/hier.h + ./compile src/instpackage.c instqueue: \ -load instqueue.o instfiles.o fifo.o hier.o auto_qmail.o auto_split.o strerr.a \ -substdio.a open.a error.a env.a str.a fs.a stralloc.a - ./load instqueue instfiles.o fifo.o hier.o auto_qmail.o auto_split.o \ - strerr.a substdio.a open.a error.a env.a str.a fs.a stralloc.a +load src/instqueue.o src/instfiles.o src/fifo.o src/hier.o src/auto_qmail.o src/auto_split.o src/strerr.a \ +src/substdio.a src/open.a src/error.a src/env.a src/str.a src/fs.a src/stralloc.a + ./load instqueue src/instfiles.o src/fifo.o src/hier.o src/auto_qmail.o src/auto_split.o \ + src/strerr.a src/substdio.a src/open.a src/error.a src/env.a src/str.a src/fs.a src/stralloc.a -instqueue.o: \ -compile instqueue.c open.h strerr.h hier.h - ./compile instqueue.c +src/instqueue.o: \ +compile src/instqueue.c include/open.h include/strerr.h include/hier.h + ./compile src/instqueue.c -instuidgid.o: \ -compile instuidgid.c uidgid.h auto_uids.h auto_users.h - ./compile instuidgid.c +src/instuidgid.o: \ +compile src/instuidgid.c include/uidgid.h include/auto_uids.h include/auto_users.h + ./compile src/instuidgid.c -ip.o: \ -compile ip.c fmt.h scan.h ip.h - ./compile ip.c +src/ip.o: \ +compile src/ip.c include/fmt.h include/scan.h include/ip.h + ./compile src/ip.c -ipalloc.o: \ -compile ipalloc.c alloc.h gen_allocdefs.h ip.h ipalloc.h ip.h \ -gen_alloc.h oflops.h error.h - ./compile ipalloc.c +src/ipalloc.o: \ +compile src/ipalloc.c include/alloc.h include/gen_allocdefs.h include/ip.h include/ipalloc.h include/ip.h \ +include/gen_alloc.h include/oflops.h include/error.h + ./compile src/ipalloc.c -ipme.o: \ -compile ipme.c hassalen.h byte.h ip.h ipalloc.h ip.h gen_alloc.h \ -stralloc.h gen_alloc.h ipme.h ip.h ipalloc.h - ./compile ipme.c +src/ipme.o: \ +compile src/ipme.c include/hassalen.h include/byte.h include/ip.h include/ipalloc.h include/ip.h include/gen_alloc.h \ +include/stralloc.h include/gen_alloc.h include/ipme.h include/ip.h include/ipalloc.h + ./compile src/ipme.c ipmeprint: \ -load ipmeprint.o ipme.o ip.o ipalloc.o stralloc.a substdio.a \ -error.a str.a fs.a socket.lib - ./load ipmeprint ipme.o ip.o ipalloc.o stralloc.a \ - substdio.a error.a str.a fs.a `cat socket.lib` +load src/ipmeprint.o src/ipme.o src/ip.o src/ipalloc.o src/stralloc.a src/substdio.a \ +src/error.a src/str.a src/fs.a socket.lib + ./load ipmeprint src/ipme.o src/ip.o src/ipalloc.o src/stralloc.a \ + src/substdio.a src/error.a src/str.a src/fs.a `cat socket.lib` -ipmeprint.o: \ -compile ipmeprint.c subfd.h substdio.h substdio.h ip.h ipme.h ip.h \ -ipalloc.h ip.h gen_alloc.h - ./compile ipmeprint.c +src/ipmeprint.o: \ +compile src/ipmeprint.c include/subfd.h include/substdio.h include/substdio.h include/ip.h include/ipme.h include/ip.h \ +include/ipalloc.h include/ip.h include/gen_alloc.h + ./compile src/ipmeprint.c it: \ qmail-local qmail-lspawn qmail-getpw qmail-remote qmail-rspawn \ @@ -788,59 +788,59 @@ make-load warn-auto.sh ( cat warn-auto.sh; ./make-load ) > load chmod 755 load -lock.a: \ -makelib lock_ex.o lock_exnb.o lock_un.o - ./makelib lock.a lock_ex.o lock_exnb.o lock_un.o +src/lock.a: \ +makelib src/lock_ex.o src/lock_exnb.o src/lock_un.o + ./makelib src/lock.a src/lock_ex.o src/lock_exnb.o src/lock_un.o -lock_ex.o: \ -compile lock_ex.c hasflock.h lock.h - ./compile lock_ex.c +src/lock_ex.o: \ +compile src/lock_ex.c include/hasflock.h include/lock.h + ./compile src/lock_ex.c -lock_exnb.o: \ -compile lock_exnb.c hasflock.h lock.h - ./compile lock_exnb.c +src/lock_exnb.o: \ +compile src/lock_exnb.c include/hasflock.h include/lock.h + ./compile src/lock_exnb.c -lock_un.o: \ -compile lock_un.c hasflock.h lock.h - ./compile lock_un.c +src/lock_un.o: \ +compile src/lock_un.c include/hasflock.h include/lock.h + ./compile src/lock_un.c -maildir.0: \ -maildir.5 +doc/man/maildir.0: \ +doc/man/maildir.5 -maildir.o: \ -compile maildir.c prioq.h datetime.h gen_alloc.h env.h stralloc.h \ -gen_alloc.h direntry.h datetime.h now.h datetime.h str.h maildir.h \ -strerr.h - ./compile maildir.c +src/maildir.o: \ +compile src/maildir.c include/prioq.h include/datetime.h include/gen_alloc.h include/env.h include/stralloc.h \ +include/gen_alloc.h include/direntry.h include/datetime.h include/now.h include/datetime.h include/str.h include/maildir.h \ +include/strerr.h + ./compile src/maildir.c maildir2mbox: \ -load maildir2mbox.o maildir.o prioq.o myctime.o gfrom.o lock.a \ -getln.a env.a open.a strerr.a stralloc.a substdio.a error.a \ -str.a fs.a datetime.a - ./load maildir2mbox maildir.o prioq.o myctime.o \ - gfrom.o lock.a getln.a env.a open.a strerr.a stralloc.a \ - substdio.a error.a str.a fs.a datetime.a - -maildir2mbox.0: \ -maildir2mbox.1 - -maildir2mbox.o: \ -compile maildir2mbox.c readwrite.h prioq.h datetime.h gen_alloc.h \ -env.h stralloc.h gen_alloc.h subfd.h substdio.h substdio.h getln.h \ -error.h open.h lock.h gfrom.h str.h myctime.h maildir.h \ -strerr.h - ./compile maildir2mbox.c +load src/maildir2mbox.o src/maildir.o src/prioq.o src/myctime.o src/gfrom.o src/lock.a \ +src/getln.a src/env.a src/open.a src/strerr.a src/stralloc.a src/substdio.a src/error.a \ +src/str.a src/fs.a src/datetime.a + ./load maildir2mbox src/maildir.o src/prioq.o src/myctime.o \ + src/gfrom.o src/lock.a src/getln.a src/env.a src/open.a src/strerr.a src/stralloc.a \ + src/substdio.a src/error.a src/str.a src/fs.a src/datetime.a + +doc/man/maildir2mbox.0: \ +doc/man/maildir2mbox.1 + +src/maildir2mbox.o: \ +compile src/maildir2mbox.c include/readwrite.h include/prioq.h include/datetime.h include/gen_alloc.h \ +include/env.h include/stralloc.h include/gen_alloc.h include/subfd.h include/substdio.h include/substdio.h include/getln.h \ +include/error.h include/open.h include/lock.h include/gfrom.h include/str.h include/myctime.h include/maildir.h \ +include/strerr.h + ./compile src/maildir2mbox.c maildirmake: \ -load maildirmake.o strerr.a substdio.a error.a str.a - ./load maildirmake strerr.a substdio.a error.a str.a +load src/maildirmake.o src/strerr.a src/substdio.a src/error.a src/str.a + ./load maildirmake src/strerr.a src/substdio.a src/error.a src/str.a -maildirmake.0: \ -maildirmake.1 +doc/man/maildirmake.0: \ +doc/man/maildirmake.1 -maildirmake.o: \ -compile maildirmake.c strerr.h - ./compile maildirmake.c +src/maildirmake.o: \ +compile src/maildirmake.c include/strerr.h + ./compile src/maildirmake.c mailsubj: \ warn-auto.sh mailsubj.sh conf-qmail conf-break conf-split @@ -851,8 +851,8 @@ warn-auto.sh mailsubj.sh conf-qmail conf-break conf-split > mailsubj chmod 755 mailsubj -mailsubj.0: \ -mailsubj.1 +doc/man/mailsubj.0: \ +doc/man/mailsubj.1 make-compile: \ make-compile.sh auto-ccld.sh @@ -876,108 +876,108 @@ make-makelib warn-auto.sh chmod 755 makelib man: \ -qmail-local.0 qmail-lspawn.0 qmail-getpw.0 qmail-remote.0 \ -qmail-rspawn.0 qmail-clean.0 qmail-send.0 qmail-start.0 splogger.0 \ -qmail-queue.0 qmail-inject.0 mailsubj.0 qmail-showctl.0 qmail-newu.0 \ -qmail-pw2u.0 qmail-qread.0 qmail-qstat.0 qmail-tcpto.0 qmail-tcpok.0 \ -qmail-pop3d.0 qmail-popup.0 qmail-qmqpc.0 qmail-qmqpd.0 qmail-qmtpd.0 \ -qmail-smtpd.0 tcp-env.0 qmail-newmrh.0 qreceipt.0 qbiff.0 forward.0 \ -preline.0 condredirect.0 bouncesaying.0 except.0 maildirmake.0 \ -maildir2mbox.0 qmail.0 qmail-limits.0 qmail-log.0 \ -qmail-control.0 qmail-header.0 qmail-users.0 dot-qmail.0 \ -qmail-command.0 tcp-environ.0 maildir.0 mbox.0 addresses.0 \ -envelopes.0 forgeries.0 - -mbox.0: \ -mbox.5 - -myctime.o: \ -compile myctime.c datetime.h fmt.h myctime.h - ./compile myctime.c - -ndelay.a: \ -makelib ndelay.o ndelay_off.o - ./makelib ndelay.a ndelay.o ndelay_off.o - -ndelay.o: \ -compile ndelay.c ndelay.h - ./compile ndelay.c - -ndelay_off.o: \ -compile ndelay_off.c ndelay.h - ./compile ndelay_off.c - -newfield.o: \ -compile newfield.c fmt.h datetime.h stralloc.h gen_alloc.h \ -date822fmt.h newfield.h stralloc.h - ./compile newfield.c - -oflops.h: \ -chkbiofl.c compile load oflops_bi.h oflops_compat.h - ( ( ./compile chkbiofl.c && ./load chkbiofl && \ +doc/man/qmail-local.0 doc/man/qmail-lspawn.0 doc/man/qmail-getpw.0 doc/man/qmail-remote.0 \ +doc/man/qmail-rspawn.0 doc/man/qmail-clean.0 doc/man/qmail-send.0 doc/man/qmail-start.0 doc/man/splogger.0 \ +doc/man/qmail-queue.0 doc/man/qmail-inject.0 doc/man/mailsubj.0 doc/man/qmail-showctl.0 doc/man/qmail-newu.0 \ +doc/man/qmail-pw2u.0 doc/man/qmail-qread.0 doc/man/qmail-qstat.0 doc/man/qmail-tcpto.0 doc/man/qmail-tcpok.0 \ +doc/man/qmail-pop3d.0 doc/man/qmail-popup.0 doc/man/qmail-qmqpc.0 doc/man/qmail-qmqpd.0 doc/man/qmail-qmtpd.0 \ +doc/man/qmail-smtpd.0 doc/man/tcp-env.0 doc/man/qmail-newmrh.0 doc/man/qreceipt.0 doc/man/qbiff.0 doc/man/forward.0 \ +doc/man/preline.0 doc/man/condredirect.0 doc/man/bouncesaying.0 doc/man/except.0 doc/man/maildirmake.0 \ +doc/man/maildir2mbox.0 doc/man/qmail.0 doc/man/qmail-limits.0 doc/man/qmail-log.0 \ +doc/man/qmail-control.0 doc/man/qmail-header.0 doc/man/qmail-users.0 doc/man/dot-qmail.0 \ +doc/man/qmail-command.0 doc/man/tcp-environ.0 doc/man/maildir.0 doc/man/mbox.0 doc/man/addresses.0 \ +doc/man/envelopes.0 doc/man/forgeries.0 + +doc/man/mbox.0: \ +doc/man/mbox.5 + +src/myctime.o: \ +compile src/myctime.c include/datetime.h include/fmt.h include/myctime.h + ./compile src/myctime.c + +src/ndelay.a: \ +makelib src/ndelay.o src/ndelay_off.o + ./makelib src/ndelay.a src/ndelay.o src/ndelay_off.o + +src/ndelay.o: \ +compile src/ndelay.c include/ndelay.h + ./compile src/ndelay.c + +src/ndelay_off.o: \ +compile src/ndelay_off.c include/ndelay.h + ./compile src/ndelay_off.c + +src/newfield.o: \ +compile src/newfield.c include/fmt.h include/datetime.h include/stralloc.h include/gen_alloc.h \ +include/date822fmt.h include/newfield.h include/stralloc.h + ./compile src/newfield.c + +include/oflops.h: \ +src/chkbiofl.c compile load include/oflops_bi.h include/oflops_compat.h + ( ( ./compile src/chkbiofl.c && ./load chkbiofl && \ ./chkbiofl ) >/dev/null 2>&1 \ - && cat oflops_bi.h || cat oflops_compat.h ) > oflops.h - rm -f chkbiofl.o chkbiofl + && cat include/oflops_bi.h || cat include/oflops_compat.h ) > include/oflops.h + rm -f src/chkbiofl.o chkbiofl -open.a: \ -makelib open_append.o open_excl.o open_read.o open_trunc.o \ -open_write.o - ./makelib open.a open_append.o open_excl.o open_read.o \ - open_trunc.o open_write.o +src/open.a: \ +makelib src/open_append.o src/open_excl.o src/open_read.o src/open_trunc.o \ +src/open_write.o + ./makelib src/open.a src/open_append.o src/open_excl.o src/open_read.o \ + src/open_trunc.o src/open_write.o -open_append.o: \ -compile open_append.c open.h - ./compile open_append.c +src/open_append.o: \ +compile src/open_append.c include/open.h + ./compile src/open_append.c -open_excl.o: \ -compile open_excl.c open.h - ./compile open_excl.c +src/open_excl.o: \ +compile src/open_excl.c include/open.h + ./compile src/open_excl.c -open_read.o: \ -compile open_read.c open.h - ./compile open_read.c +src/open_read.o: \ +compile src/open_read.c include/open.h + ./compile src/open_read.c -open_trunc.o: \ -compile open_trunc.c open.h - ./compile open_trunc.c +src/open_trunc.o: \ +compile src/open_trunc.c include/open.h + ./compile src/open_trunc.c -open_write.o: \ -compile open_write.c open.h - ./compile open_write.c +src/open_write.o: \ +compile src/open_write.c include/open.h + ./compile src/open_write.c package: \ it man ./instpackage predate: \ -load predate.o datetime.a strerr.a sig.a fd.a wait.a substdio.a \ -error.a str.a fs.a - ./load predate datetime.a strerr.a sig.a fd.a wait.a \ - substdio.a error.a str.a fs.a +load src/predate.o src/datetime.a src/strerr.a src/sig.a src/fd.a src/wait.a src/substdio.a \ +src/error.a src/str.a src/fs.a + ./load predate src/datetime.a src/strerr.a src/sig.a src/fd.a src/wait.a \ + src/substdio.a src/error.a src/str.a src/fs.a -predate.o: \ -compile predate.c datetime.h fork.h wait.h fd.h fmt.h strerr.h \ -substdio.h subfd.h substdio.h readwrite.h sig.h - ./compile predate.c +src/predate.o: \ +compile src/predate.c include/datetime.h include/fork.h include/wait.h include/fd.h include/fmt.h include/strerr.h \ +include/substdio.h include/subfd.h include/substdio.h include/readwrite.h include/sig.h + ./compile src/predate.c preline: \ -load preline.o strerr.a fd.a wait.a sig.a env.a getopt.a substdio.a \ -error.a str.a - ./load preline strerr.a fd.a wait.a sig.a env.a getopt.a \ - substdio.a error.a str.a +load src/preline.o src/strerr.a src/fd.a src/wait.a src/sig.a src/env.a src/getopt.a src/substdio.a \ +src/error.a src/str.a + ./load preline src/strerr.a src/fd.a src/wait.a src/sig.a src/env.a src/getopt.a \ + src/substdio.a src/error.a src/str.a -preline.0: \ -preline.1 +doc/man/preline.0: \ +doc/man/preline.1 -preline.o: \ -compile preline.c fd.h sgetopt.h subgetopt.h readwrite.h strerr.h \ -substdio.h fork.h wait.h env.h sig.h error.h - ./compile preline.c +src/preline.o: \ +compile src/preline.c include/fd.h include/sgetopt.h include/subgetopt.h include/readwrite.h include/strerr.h \ +include/substdio.h include/fork.h include/wait.h include/env.h include/sig.h include/error.h + ./compile src/preline.c -prioq.o: \ -compile prioq.c alloc.h gen_allocdefs.h prioq.h datetime.h \ -gen_alloc.h oflops.h error.h - ./compile prioq.c +src/prioq.o: \ +compile src/prioq.c include/alloc.h include/gen_allocdefs.h include/prioq.h include/datetime.h \ +include/gen_alloc.h include/oflops.h include/error.h + ./compile src/prioq.c proc: \ proc.sh conf-qmail @@ -993,335 +993,335 @@ proc+df.sh conf-qmail > proc+df chmod 755 proc+df -prot.o: \ -compile prot.c prot.h - ./compile prot.c +src/prot.o: \ +compile src/prot.c include/prot.h + ./compile src/prot.c qbiff: \ -load qbiff.o headerbody.o hfield.o getln.a env.a open.a stralloc.a \ -substdio.a error.a str.a - ./load qbiff headerbody.o hfield.o getln.a env.a open.a \ - stralloc.a substdio.a error.a str.a +load src/qbiff.o src/headerbody.o src/hfield.o src/getln.a src/env.a src/open.a src/stralloc.a \ +src/substdio.a src/error.a src/str.a + ./load qbiff src/headerbody.o src/hfield.o src/getln.a src/env.a src/open.a \ + src/stralloc.a src/substdio.a src/error.a src/str.a -qbiff.0: \ -qbiff.1 +doc/man/qbiff.0: \ +doc/man/qbiff.1 -qbiff.o: \ -compile qbiff.c readwrite.h stralloc.h gen_alloc.h substdio.h subfd.h \ -substdio.h open.h byte.h str.h headerbody.h hfield.h env.h exit.h qtmp.h - ./compile qbiff.c +src/qbiff.o: \ +compile src/qbiff.c include/readwrite.h include/stralloc.h include/gen_alloc.h include/substdio.h include/subfd.h \ +include/substdio.h include/open.h include/byte.h include/str.h include/headerbody.h include/hfield.h include/env.h include/exit.h include/qtmp.h + ./compile src/qbiff.c qmail-clean: \ -load qmail-clean.o fmtqfn.o getln.a sig.a stralloc.a \ -substdio.a error.a str.a fs.a auto_qmail.o auto_split.o - ./load qmail-clean fmtqfn.o getln.a sig.a stralloc.a \ - substdio.a error.a str.a fs.a auto_qmail.o \ - auto_split.o - -qmail-clean.0: \ -qmail-clean.8 - -qmail-clean.o: \ -compile qmail-clean.c readwrite.h sig.h now.h datetime.h str.h \ -direntry.h getln.h stralloc.h gen_alloc.h substdio.h subfd.h \ -substdio.h byte.h scan.h fmt.h error.h exit.h fmtqfn.h auto_qmail.h - ./compile qmail-clean.c - -qmail-command.0: \ -qmail-command.8 - -qmail-control.0: \ -qmail-control.5 - -qmail-control.5: \ -qmail-control.9 conf-qmail conf-break conf-spawn - cat qmail-control.9 \ +load src/qmail-clean.o src/fmtqfn.o src/getln.a src/sig.a src/stralloc.a \ +src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o src/auto_split.o + ./load qmail-clean src/fmtqfn.o src/getln.a src/sig.a src/stralloc.a \ + src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o \ + src/auto_split.o + +doc/man/qmail-clean.0: \ +doc/man/qmail-clean.8 + +src/qmail-clean.o: \ +compile src/qmail-clean.c include/readwrite.h include/sig.h include/now.h include/datetime.h include/str.h \ +include/direntry.h include/getln.h include/stralloc.h include/gen_alloc.h include/substdio.h include/subfd.h \ +include/substdio.h include/byte.h include/scan.h include/fmt.h include/error.h include/exit.h include/fmtqfn.h include/auto_qmail.h + ./compile src/qmail-clean.c + +doc/man/qmail-command.0: \ +doc/man/qmail-command.8 + +doc/man/qmail-control.0: \ +doc/man/qmail-control.5 + +doc/man/qmail-control.5: \ +doc/man/qmail-control.9 conf-qmail conf-break conf-spawn + cat doc/man/qmail-control.9 \ | sed s}QMAILHOME}"`head -n 1 conf-qmail`"}g \ | sed s}BREAK}"`head -n 1 conf-break`"}g \ | sed s}SPAWN}"`head -n 1 conf-spawn`"}g \ - > qmail-control.5 + > doc/man/qmail-control.5 qmail-getpw: \ -load qmail-getpw.o case.a substdio.a error.a str.a fs.a auto_break.o \ -ids.a - ./load qmail-getpw case.a substdio.a error.a str.a fs.a \ - auto_break.o ids.a +load src/qmail-getpw.o src/case.a src/substdio.a src/error.a src/str.a src/fs.a src/auto_break.o \ +src/ids.a + ./load qmail-getpw src/case.a src/substdio.a src/error.a src/str.a src/fs.a \ + src/auto_break.o src/ids.a -qmail-getpw.0: \ -qmail-getpw.8 +doc/man/qmail-getpw.0: \ +doc/man/qmail-getpw.8 -qmail-getpw.8: \ -qmail-getpw.9 conf-qmail conf-break conf-spawn - cat qmail-getpw.9 \ +doc/man/qmail-getpw.8: \ +doc/man/qmail-getpw.9 conf-qmail conf-break conf-spawn + cat doc/man/qmail-getpw.9 \ | sed s}QMAILHOME}"`head -n 1 conf-qmail`"}g \ | sed s}BREAK}"`head -n 1 conf-break`"}g \ | sed s}SPAWN}"`head -n 1 conf-spawn`"}g \ - > qmail-getpw.8 + > doc/man/qmail-getpw.8 -qmail-getpw.o: \ -compile qmail-getpw.c readwrite.h substdio.h subfd.h substdio.h \ -error.h exit.h byte.h str.h case.h fmt.h auto_users.h auto_break.h \ -qlx.h - ./compile qmail-getpw.c +src/qmail-getpw.o: \ +compile src/qmail-getpw.c include/readwrite.h include/substdio.h include/subfd.h include/substdio.h \ +include/error.h include/exit.h include/byte.h include/str.h include/case.h include/fmt.h include/auto_users.h include/auto_break.h \ +include/qlx.h + ./compile src/qmail-getpw.c -qmail-header.0: \ -qmail-header.5 +doc/man/qmail-header.0: \ +doc/man/qmail-header.5 qmail-inject: \ -load qmail-inject.o headerbody.o hfield.o newfield.o quote.o \ -control.o date822fmt.o constmap.o qmail.o case.a fd.a wait.a open.a \ -getln.a sig.a getopt.a datetime.a token822.o env.a stralloc.a \ -substdio.a error.a str.a fs.a auto_qmail.o - ./load qmail-inject headerbody.o hfield.o newfield.o \ - quote.o control.o date822fmt.o constmap.o qmail.o \ - case.a fd.a wait.a open.a getln.a sig.a getopt.a datetime.a \ - token822.o env.a stralloc.a substdio.a error.a \ - str.a fs.a auto_qmail.o - -qmail-inject.0: \ -qmail-inject.8 - -qmail-inject.o: \ -compile qmail-inject.c sig.h substdio.h stralloc.h gen_alloc.h \ -subfd.h substdio.h sgetopt.h subgetopt.h getln.h alloc.h str.h fmt.h \ -hfield.h token822.h gen_alloc.h control.h env.h gen_alloc.h \ -gen_allocdefs.h error.h qmail.h substdio.h now.h datetime.h error.h exit.h \ -quote.h headerbody.h auto_qmail.h newfield.h stralloc.h constmap.h oflops.h - ./compile qmail-inject.c - -qmail-limits.0: \ -qmail-limits.7 - -qmail-limits.7: \ -qmail-limits.9 conf-qmail conf-break conf-spawn - cat qmail-limits.9 \ +load src/qmail-inject.o src/headerbody.o src/hfield.o src/newfield.o src/quote.o \ +src/control.o src/date822fmt.o src/constmap.o src/qmail.o src/case.a src/fd.a src/wait.a src/open.a \ +src/getln.a src/sig.a src/getopt.a src/datetime.a src/token822.o src/env.a src/stralloc.a \ +src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o + ./load qmail-inject src/headerbody.o src/hfield.o src/newfield.o \ + src/quote.o src/control.o src/date822fmt.o src/constmap.o src/qmail.o \ + src/case.a src/fd.a src/wait.a src/open.a src/getln.a src/sig.a src/getopt.a src/datetime.a \ + src/token822.o src/env.a src/stralloc.a src/substdio.a src/error.a \ + src/str.a src/fs.a src/auto_qmail.o + +doc/man/qmail-inject.0: \ +doc/man/qmail-inject.8 + +src/qmail-inject.o: \ +compile src/qmail-inject.c include/sig.h include/substdio.h include/stralloc.h include/gen_alloc.h \ +include/subfd.h include/substdio.h include/sgetopt.h include/subgetopt.h include/getln.h include/alloc.h include/str.h include/fmt.h \ +include/hfield.h include/token822.h include/gen_alloc.h include/control.h include/env.h include/gen_alloc.h \ +include/gen_allocdefs.h include/error.h include/qmail.h include/substdio.h include/now.h include/datetime.h include/error.h include/exit.h \ +include/quote.h include/headerbody.h include/auto_qmail.h include/newfield.h include/stralloc.h include/constmap.h include/oflops.h + ./compile src/qmail-inject.c + +doc/man/qmail-limits.0: \ +doc/man/qmail-limits.7 + +doc/man/qmail-limits.7: \ +doc/man/qmail-limits.9 conf-qmail conf-break conf-spawn + cat doc/man/qmail-limits.9 \ | sed s}QMAILHOME}"`head -n 1 conf-qmail`"}g \ | sed s}BREAK}"`head -n 1 conf-break`"}g \ | sed s}SPAWN}"`head -n 1 conf-spawn`"}g \ - > qmail-limits.7 + > doc/man/qmail-limits.7 qmail-local: \ -load qmail-local.o qmail.o quote.o gfrom.o myctime.o \ -slurpclose.o case.a getln.a getopt.a sig.a open.a lock.a fd.a \ -wait.a env.a stralloc.a strerr.a substdio.a error.a str.a \ -fs.a datetime.a auto_qmail.o auto_patrn.o socket.lib - ./load qmail-local qmail.o quote.o gfrom.o myctime.o \ - slurpclose.o case.a getln.a getopt.a sig.a open.a \ - lock.a fd.a wait.a env.a stralloc.a strerr.a \ - substdio.a error.a str.a fs.a datetime.a auto_qmail.o \ - auto_patrn.o `cat socket.lib` - -qmail-local.0: \ -qmail-local.8 - -qmail-local.o: \ -compile qmail-local.c readwrite.h sig.h env.h byte.h exit.h fork.h \ -open.h wait.h lock.h seek.h substdio.h getln.h strerr.h subfd.h \ -substdio.h sgetopt.h subgetopt.h alloc.h error.h stralloc.h \ -gen_alloc.h fmt.h str.h now.h datetime.h case.h quote.h qmail.h \ -substdio.h slurpclose.h myctime.h gfrom.h auto_patrn.h - ./compile qmail-local.c - -qmail-log.0: \ -qmail-log.5 +load src/qmail-local.o src/qmail.o src/quote.o src/gfrom.o src/myctime.o \ +src/slurpclose.o src/case.a src/getln.a src/getopt.a src/sig.a src/open.a src/lock.a src/fd.a \ +src/wait.a src/env.a src/stralloc.a src/strerr.a src/substdio.a src/error.a src/str.a \ +src/fs.a src/datetime.a src/auto_qmail.o src/auto_patrn.o socket.lib + ./load qmail-local src/qmail.o src/quote.o src/gfrom.o src/myctime.o \ + src/slurpclose.o src/case.a src/getln.a src/getopt.a src/sig.a src/open.a \ + src/lock.a src/fd.a src/wait.a src/env.a src/stralloc.a src/strerr.a \ + src/substdio.a src/error.a src/str.a src/fs.a src/datetime.a src/auto_qmail.o \ + src/auto_patrn.o `cat socket.lib` + +doc/man/qmail-local.0: \ +doc/man/qmail-local.8 + +src/qmail-local.o: \ +compile src/qmail-local.c include/readwrite.h include/sig.h include/env.h include/byte.h include/exit.h include/fork.h \ +include/open.h include/wait.h include/lock.h include/seek.h include/substdio.h include/getln.h include/strerr.h include/subfd.h \ +include/substdio.h include/sgetopt.h include/subgetopt.h include/alloc.h include/error.h include/stralloc.h \ +include/gen_alloc.h include/fmt.h include/str.h include/now.h include/datetime.h include/case.h include/quote.h include/qmail.h \ +include/substdio.h include/slurpclose.h include/myctime.h include/gfrom.h include/auto_patrn.h + ./compile src/qmail-local.c + +doc/man/qmail-log.0: \ +doc/man/qmail-log.5 qmail-lspawn: \ -load qmail-lspawn.o spawn.o prot.o slurpclose.o coe.o sig.a wait.a \ -case.a cdb.a fd.a open.a stralloc.a ids.a substdio.a error.a str.a \ -fs.a auto_qmail.o auto_spawn.o - ./load qmail-lspawn spawn.o prot.o slurpclose.o coe.o sig.a wait.a \ - case.a cdb.a fd.a open.a stralloc.a auto_qmail.o \ - auto_spawn.o ids.a substdio.a error.a str.a fs.a - -qmail-lspawn.0: \ -qmail-lspawn.8 - -qmail-lspawn.o: \ -compile qmail-lspawn.c fd.h wait.h prot.h substdio.h stralloc.h \ -gen_alloc.h scan.h exit.h fork.h error.h cdb.h uint32.h case.h \ -slurpclose.h uidgid.h auto_qmail.h auto_uids.h auto_users.h qlx.h byte.h \ -open.h spawn.h - ./compile qmail-lspawn.c +load src/qmail-lspawn.o src/spawn.o src/prot.o src/slurpclose.o src/coe.o src/sig.a src/wait.a \ +src/case.a src/cdb.a src/fd.a src/open.a src/stralloc.a src/ids.a src/substdio.a src/error.a src/str.a \ +src/fs.a src/auto_qmail.o src/auto_spawn.o + ./load qmail-lspawn src/spawn.o src/prot.o src/slurpclose.o src/coe.o src/sig.a src/wait.a \ + src/case.a src/cdb.a src/fd.a src/open.a src/stralloc.a src/auto_qmail.o \ + src/auto_spawn.o src/ids.a src/substdio.a src/error.a src/str.a src/fs.a + +doc/man/qmail-lspawn.0: \ +doc/man/qmail-lspawn.8 + +src/qmail-lspawn.o: \ +compile src/qmail-lspawn.c include/fd.h include/wait.h include/prot.h include/substdio.h include/stralloc.h \ +include/gen_alloc.h include/scan.h include/exit.h include/fork.h include/error.h include/cdb.h include/uint32.h include/case.h \ +include/slurpclose.h include/uidgid.h include/auto_qmail.h include/auto_uids.h include/auto_users.h include/qlx.h include/byte.h \ +include/open.h include/spawn.h + ./compile src/qmail-lspawn.c qmail-newmrh: \ -load qmail-newmrh.o cdbmss.o getln.a open.a cdbmake.a case.a \ -stralloc.a strerr.a substdio.a error.a str.a auto_qmail.o - ./load qmail-newmrh cdbmss.o getln.a open.a cdbmake.a \ - case.a stralloc.a strerr.a substdio.a \ - error.a str.a auto_qmail.o - -qmail-newmrh.0: \ -qmail-newmrh.8 - -qmail-newmrh.8: \ -qmail-newmrh.9 conf-qmail conf-break conf-spawn - cat qmail-newmrh.9 \ +load src/qmail-newmrh.o src/cdbmss.o src/getln.a src/open.a src/cdbmake.a src/case.a \ +src/stralloc.a src/strerr.a src/substdio.a src/error.a src/str.a src/auto_qmail.o + ./load qmail-newmrh src/cdbmss.o src/getln.a src/open.a src/cdbmake.a \ + src/case.a src/stralloc.a src/strerr.a src/substdio.a \ + src/error.a src/str.a src/auto_qmail.o + +doc/man/qmail-newmrh.0: \ +doc/man/qmail-newmrh.8 + +doc/man/qmail-newmrh.8: \ +doc/man/qmail-newmrh.9 conf-qmail conf-break conf-spawn + cat doc/man/qmail-newmrh.9 \ | sed s}QMAILHOME}"`head -n 1 conf-qmail`"}g \ | sed s}BREAK}"`head -n 1 conf-break`"}g \ | sed s}SPAWN}"`head -n 1 conf-spawn`"}g \ - > qmail-newmrh.8 + > doc/man/qmail-newmrh.8 -qmail-newmrh.o: \ -compile qmail-newmrh.c strerr.h stralloc.h gen_alloc.h substdio.h \ -getln.h exit.h readwrite.h open.h auto_qmail.h cdbmss.h cdbmake.h \ -uint32.h substdio.h case.h - ./compile qmail-newmrh.c +src/qmail-newmrh.o: \ +compile src/qmail-newmrh.c include/strerr.h include/stralloc.h include/gen_alloc.h include/substdio.h \ +include/getln.h include/exit.h include/readwrite.h include/open.h include/auto_qmail.h include/cdbmss.h include/cdbmake.h \ +include/uint32.h include/substdio.h include/case.h + ./compile src/qmail-newmrh.c qmail-newu: \ -load qmail-newu.o cdbmss.o getln.a open.a cdbmake.a case.a \ -stralloc.a substdio.a error.a str.a auto_qmail.o - ./load qmail-newu cdbmss.o getln.a open.a cdbmake.a \ - case.a stralloc.a substdio.a error.a str.a \ - auto_qmail.o - -qmail-newu.0: \ -qmail-newu.8 - -qmail-newu.8: \ -qmail-newu.9 conf-qmail conf-break conf-spawn - cat qmail-newu.9 \ +load src/qmail-newu.o src/cdbmss.o src/getln.a src/open.a src/cdbmake.a src/case.a \ +src/stralloc.a src/substdio.a src/error.a src/str.a src/auto_qmail.o + ./load qmail-newu src/cdbmss.o src/getln.a src/open.a src/cdbmake.a \ + src/case.a src/stralloc.a src/substdio.a src/error.a src/str.a \ + src/auto_qmail.o + +doc/man/qmail-newu.0: \ +doc/man/qmail-newu.8 + +doc/man/qmail-newu.8: \ +doc/man/qmail-newu.9 conf-qmail conf-break conf-spawn + cat doc/man/qmail-newu.9 \ | sed s}QMAILHOME}"`head -n 1 conf-qmail`"}g \ | sed s}BREAK}"`head -n 1 conf-break`"}g \ | sed s}SPAWN}"`head -n 1 conf-spawn`"}g \ - > qmail-newu.8 + > doc/man/qmail-newu.8 -qmail-newu.o: \ -compile qmail-newu.c stralloc.h gen_alloc.h subfd.h substdio.h \ -getln.h substdio.h cdbmss.h cdbmake.h uint32.h substdio.h exit.h \ -readwrite.h open.h error.h case.h auto_qmail.h byte.h - ./compile qmail-newu.c +src/qmail-newu.o: \ +compile src/qmail-newu.c include/stralloc.h include/gen_alloc.h include/subfd.h include/substdio.h \ +include/getln.h include/substdio.h include/cdbmss.h include/cdbmake.h include/uint32.h include/substdio.h include/exit.h \ +include/readwrite.h include/open.h include/error.h include/case.h include/auto_qmail.h include/byte.h + ./compile src/qmail-newu.c qmail-pop3d: \ -load qmail-pop3d.o commands.o case.a timeoutread.o timeoutwrite.o \ -maildir.o prioq.o env.a strerr.a sig.a open.a getln.a \ -stralloc.a substdio.a error.a str.a fs.a socket.lib - ./load qmail-pop3d commands.o case.a timeoutread.o \ - timeoutwrite.o maildir.o prioq.o env.a strerr.a sig.a \ - open.a getln.a stralloc.a substdio.a error.a str.a \ - fs.a `cat socket.lib` - -qmail-pop3d.0: \ -qmail-pop3d.8 - -qmail-pop3d.o: \ -compile qmail-pop3d.c commands.h sig.h getln.h stralloc.h gen_alloc.h \ -substdio.h alloc.h open.h prioq.h datetime.h gen_alloc.h scan.h fmt.h \ -str.h exit.h maildir.h strerr.h readwrite.h timeoutread.h \ -timeoutwrite.h - ./compile qmail-pop3d.c +load src/qmail-pop3d.o src/commands.o src/case.a src/timeoutread.o src/timeoutwrite.o \ +src/maildir.o src/prioq.o src/env.a src/strerr.a src/sig.a src/open.a src/getln.a \ +src/stralloc.a src/substdio.a src/error.a src/str.a src/fs.a socket.lib + ./load qmail-pop3d src/commands.o src/case.a src/timeoutread.o \ + src/timeoutwrite.o src/maildir.o src/prioq.o src/env.a src/strerr.a src/sig.a \ + src/open.a src/getln.a src/stralloc.a src/substdio.a src/error.a src/str.a \ + src/fs.a `cat socket.lib` + +doc/man/qmail-pop3d.0: \ +doc/man/qmail-pop3d.8 + +src/qmail-pop3d.o: \ +compile src/qmail-pop3d.c include/commands.h include/sig.h include/getln.h include/stralloc.h include/gen_alloc.h \ +include/substdio.h include/alloc.h include/open.h include/prioq.h include/datetime.h include/gen_alloc.h include/scan.h include/fmt.h \ +include/str.h include/exit.h include/maildir.h include/strerr.h include/readwrite.h include/timeoutread.h \ +include/timeoutwrite.h + ./compile src/qmail-pop3d.c qmail-popup: \ -load qmail-popup.o commands.o timeoutread.o timeoutwrite.o \ -case.a fd.a sig.a wait.a stralloc.a substdio.a error.a str.a \ -fs.a socket.lib - ./load qmail-popup commands.o timeoutread.o timeoutwrite.o \ - case.a fd.a sig.a wait.a stralloc.a \ - substdio.a error.a str.a fs.a `cat socket.lib` - -qmail-popup.0: \ -qmail-popup.8 - -qmail-popup.o: \ -compile qmail-popup.c commands.h fd.h sig.h stralloc.h gen_alloc.h \ -substdio.h alloc.h wait.h str.h byte.h now.h datetime.h fmt.h exit.h \ -readwrite.h timeoutread.h timeoutwrite.h - ./compile qmail-popup.c +load src/qmail-popup.o src/commands.o src/timeoutread.o src/timeoutwrite.o \ +src/case.a src/fd.a src/sig.a src/wait.a src/stralloc.a src/substdio.a src/error.a src/str.a \ +src/fs.a socket.lib + ./load qmail-popup src/commands.o src/timeoutread.o src/timeoutwrite.o \ + src/case.a src/fd.a src/sig.a src/wait.a src/stralloc.a \ + src/substdio.a src/error.a src/str.a src/fs.a `cat socket.lib` + +doc/man/qmail-popup.0: \ +doc/man/qmail-popup.8 + +src/qmail-popup.o: \ +compile src/qmail-popup.c include/commands.h include/fd.h include/sig.h include/stralloc.h include/gen_alloc.h \ +include/substdio.h include/alloc.h include/wait.h include/str.h include/byte.h include/now.h include/datetime.h include/fmt.h include/exit.h \ +include/readwrite.h include/timeoutread.h include/timeoutwrite.h + ./compile src/qmail-popup.c qmail-pw2u: \ -load qmail-pw2u.o constmap.o control.o open.a getln.a case.a getopt.a \ -stralloc.a substdio.a error.a str.a fs.a ids.a \ -auto_break.o auto_qmail.o - ./load qmail-pw2u constmap.o control.o open.a getln.a \ - case.a getopt.a stralloc.a substdio.a error.a str.a \ - fs.a ids.a auto_break.o auto_qmail.o - -qmail-pw2u.0: \ -qmail-pw2u.8 - -qmail-pw2u.8: \ -qmail-pw2u.9 conf-qmail conf-break conf-spawn - cat qmail-pw2u.9 \ +load src/qmail-pw2u.o src/constmap.o src/control.o src/open.a src/getln.a src/case.a src/getopt.a \ +src/stralloc.a src/substdio.a src/error.a src/str.a src/fs.a src/ids.a \ +src/auto_break.o src/auto_qmail.o + ./load qmail-pw2u src/constmap.o src/control.o src/open.a src/getln.a \ + src/case.a src/getopt.a src/stralloc.a src/substdio.a src/error.a src/str.a \ + src/fs.a src/ids.a src/auto_break.o src/auto_qmail.o + +doc/man/qmail-pw2u.0: \ +doc/man/qmail-pw2u.8 + +doc/man/qmail-pw2u.8: \ +doc/man/qmail-pw2u.9 conf-qmail conf-break conf-spawn + cat doc/man/qmail-pw2u.9 \ | sed s}QMAILHOME}"`head -n 1 conf-qmail`"}g \ | sed s}BREAK}"`head -n 1 conf-break`"}g \ | sed s}SPAWN}"`head -n 1 conf-spawn`"}g \ - > qmail-pw2u.8 + > doc/man/qmail-pw2u.8 -qmail-pw2u.o: \ -compile qmail-pw2u.c substdio.h readwrite.h subfd.h substdio.h \ -sgetopt.h subgetopt.h control.h constmap.h stralloc.h gen_alloc.h \ -fmt.h str.h scan.h open.h error.h getln.h exit.h auto_break.h auto_qmail.h \ -auto_users.h byte.h - ./compile qmail-pw2u.c +src/qmail-pw2u.o: \ +compile src/qmail-pw2u.c include/substdio.h include/readwrite.h include/subfd.h include/substdio.h \ +include/sgetopt.h include/subgetopt.h include/control.h include/constmap.h include/stralloc.h include/gen_alloc.h \ +include/fmt.h include/str.h include/scan.h include/open.h include/error.h include/getln.h include/exit.h include/auto_break.h include/auto_qmail.h \ +include/auto_users.h include/byte.h + ./compile src/qmail-pw2u.c qmail-qmqpc: \ -load qmail-qmqpc.o slurpclose.o timeoutread.o timeoutwrite.o \ -timeoutconn.o ip.o control.o auto_qmail.o sig.a ndelay.a open.a \ -getln.a substdio.a stralloc.a error.a str.a fs.a socket.lib - ./load qmail-qmqpc slurpclose.o timeoutread.o \ - timeoutwrite.o timeoutconn.o ip.o control.o auto_qmail.o \ - sig.a ndelay.a open.a getln.a substdio.a stralloc.a \ - error.a str.a fs.a `cat socket.lib` - -qmail-qmqpc.0: \ -qmail-qmqpc.8 - -qmail-qmqpc.o: \ -compile qmail-qmqpc.c substdio.h getln.h readwrite.h exit.h \ -stralloc.h gen_alloc.h slurpclose.h error.h sig.h ip.h timeoutconn.h \ -timeoutread.h timeoutwrite.h auto_qmail.h control.h fmt.h - ./compile qmail-qmqpc.c +load src/qmail-qmqpc.o src/slurpclose.o src/timeoutread.o src/timeoutwrite.o \ +src/timeoutconn.o src/ip.o src/control.o src/auto_qmail.o src/sig.a src/ndelay.a src/open.a \ +src/getln.a src/substdio.a src/stralloc.a src/error.a src/str.a src/fs.a socket.lib + ./load qmail-qmqpc src/slurpclose.o src/timeoutread.o \ + src/timeoutwrite.o src/timeoutconn.o src/ip.o src/control.o src/auto_qmail.o \ + src/sig.a src/ndelay.a src/open.a src/getln.a src/substdio.a src/stralloc.a \ + src/error.a src/str.a src/fs.a `cat socket.lib` + +doc/man/qmail-qmqpc.0: \ +doc/man/qmail-qmqpc.8 + +src/qmail-qmqpc.o: \ +compile src/qmail-qmqpc.c include/substdio.h include/getln.h include/readwrite.h include/exit.h \ +include/stralloc.h include/gen_alloc.h include/slurpclose.h include/error.h include/sig.h include/ip.h include/timeoutconn.h \ +include/timeoutread.h include/timeoutwrite.h include/auto_qmail.h include/control.h include/fmt.h + ./compile src/qmail-qmqpc.c qmail-qmqpd: \ -load qmail-qmqpd.o received.o date822fmt.o qmail.o auto_qmail.o \ -env.a substdio.a sig.a error.a wait.a fd.a str.a datetime.a fs.a - ./load qmail-qmqpd received.o date822fmt.o qmail.o \ - auto_qmail.o env.a substdio.a sig.a error.a wait.a fd.a \ - str.a datetime.a fs.a +load src/qmail-qmqpd.o src/received.o src/date822fmt.o src/qmail.o src/auto_qmail.o \ +src/env.a src/substdio.a src/sig.a src/error.a src/wait.a src/fd.a src/str.a src/datetime.a src/fs.a + ./load qmail-qmqpd src/received.o src/date822fmt.o src/qmail.o \ + src/auto_qmail.o src/env.a src/substdio.a src/sig.a src/error.a src/wait.a src/fd.a \ + src/str.a src/datetime.a src/fs.a -qmail-qmqpd.0: \ -qmail-qmqpd.8 +doc/man/qmail-qmqpd.0: \ +doc/man/qmail-qmqpd.8 -qmail-qmqpd.o: \ -compile qmail-qmqpd.c auto_qmail.h qmail.h substdio.h received.h str.h \ -sig.h substdio.h readwrite.h exit.h now.h datetime.h fmt.h env.h byte.h - ./compile qmail-qmqpd.c +src/qmail-qmqpd.o: \ +compile src/qmail-qmqpd.c include/auto_qmail.h include/qmail.h include/substdio.h include/received.h include/str.h \ +include/sig.h include/substdio.h include/readwrite.h include/exit.h include/now.h include/datetime.h include/fmt.h include/env.h include/byte.h + ./compile src/qmail-qmqpd.c qmail-qmtpd: \ -load qmail-qmtpd.o rcpthosts.o control.o constmap.o received.o \ -date822fmt.o qmail.o cdb.a fd.a wait.a datetime.a open.a \ -getln.a sig.a case.a env.a stralloc.a substdio.a error.a \ -str.a fs.a auto_qmail.o - ./load qmail-qmtpd rcpthosts.o control.o constmap.o \ - received.o date822fmt.o qmail.o cdb.a fd.a wait.a \ - datetime.a open.a getln.a sig.a case.a env.a stralloc.a \ - substdio.a error.a str.a fs.a auto_qmail.o - -qmail-qmtpd.0: \ -qmail-qmtpd.8 - -qmail-qmtpd.o: \ -compile qmail-qmtpd.c stralloc.h gen_alloc.h substdio.h qmail.h \ -substdio.h now.h datetime.h str.h fmt.h env.h sig.h rcpthosts.h \ -auto_qmail.h readwrite.h control.h received.h exit.h - ./compile qmail-qmtpd.c +load src/qmail-qmtpd.o src/rcpthosts.o src/control.o src/constmap.o src/received.o \ +src/date822fmt.o src/qmail.o src/cdb.a src/fd.a src/wait.a src/datetime.a src/open.a \ +src/getln.a src/sig.a src/case.a src/env.a src/stralloc.a src/substdio.a src/error.a \ +src/str.a src/fs.a src/auto_qmail.o + ./load qmail-qmtpd src/rcpthosts.o src/control.o src/constmap.o \ + src/received.o src/date822fmt.o src/qmail.o src/cdb.a src/fd.a src/wait.a \ + src/datetime.a src/open.a src/getln.a src/sig.a src/case.a src/env.a src/stralloc.a \ + src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o + +doc/man/qmail-qmtpd.0: \ +doc/man/qmail-qmtpd.8 + +src/qmail-qmtpd.o: \ +compile src/qmail-qmtpd.c include/stralloc.h include/gen_alloc.h include/substdio.h include/qmail.h \ +include/substdio.h include/now.h include/datetime.h include/str.h include/fmt.h include/env.h include/sig.h include/rcpthosts.h \ +include/auto_qmail.h include/readwrite.h include/control.h include/received.h include/exit.h + ./compile src/qmail-qmtpd.c qmail-qread: \ -load qmail-qread.o fmtqfn.o readsubdir.o date822fmt.o datetime.a \ -open.a getln.a stralloc.a substdio.a error.a str.a fs.a \ -auto_qmail.o auto_split.o - ./load qmail-qread fmtqfn.o readsubdir.o date822fmt.o \ - datetime.a open.a getln.a stralloc.a substdio.a \ - error.a str.a fs.a auto_qmail.o auto_split.o - -qmail-qread.0: \ -qmail-qread.8 - -qmail-qread.o: \ -compile qmail-qread.c stralloc.h gen_alloc.h substdio.h subfd.h \ -substdio.h fmt.h str.h getln.h fmtqfn.h readsubdir.h direntry.h \ -auto_qmail.h open.h datetime.h date822fmt.h readwrite.h error.h \ -exit.h - ./compile qmail-qread.c +load src/qmail-qread.o src/fmtqfn.o src/readsubdir.o src/date822fmt.o src/datetime.a \ +src/open.a src/getln.a src/stralloc.a src/substdio.a src/error.a src/str.a src/fs.a \ +src/auto_qmail.o src/auto_split.o + ./load qmail-qread src/fmtqfn.o src/readsubdir.o src/date822fmt.o \ + src/datetime.a src/open.a src/getln.a src/stralloc.a src/substdio.a \ + src/error.a src/str.a src/fs.a src/auto_qmail.o src/auto_split.o + +doc/man/qmail-qread.0: \ +doc/man/qmail-qread.8 + +src/qmail-qread.o: \ +compile src/qmail-qread.c include/stralloc.h include/gen_alloc.h include/substdio.h include/subfd.h \ +include/substdio.h include/fmt.h include/str.h include/getln.h include/fmtqfn.h include/readsubdir.h include/direntry.h \ +include/auto_qmail.h include/open.h include/datetime.h include/date822fmt.h include/readwrite.h include/error.h \ +include/exit.h + ./compile src/qmail-qread.c qmail-qstat: \ warn-auto.sh qmail-qstat.sh conf-qmail conf-break conf-split @@ -1332,98 +1332,98 @@ warn-auto.sh qmail-qstat.sh conf-qmail conf-break conf-split > qmail-qstat chmod 755 qmail-qstat -qmail-qstat.0: \ -qmail-qstat.8 +doc/man/qmail-qstat.0: \ +doc/man/qmail-qstat.8 qmail-queue: \ -load qmail-queue.o triggerpull.o fmtqfn.o date822fmt.o \ -datetime.a ndelay.a open.a sig.a substdio.a error.a \ -str.a fs.a auto_qmail.o auto_split.o ids.a - ./load qmail-queue triggerpull.o fmtqfn.o \ - date822fmt.o datetime.a ndelay.a open.a sig.a \ - auto_qmail.o auto_split.o ids.a \ - substdio.a error.a str.a fs.a - -qmail-queue.0: \ -qmail-queue.8 - -qmail-queue.o: \ -compile qmail-queue.c readwrite.h sig.h exit.h open.h seek.h fmt.h \ -alloc.h substdio.h datetime.h now.h datetime.h triggerpull.h extra.h \ -uidgid.h auto_qmail.h auto_uids.h auto_users.h date822fmt.h fmtqfn.h - ./compile qmail-queue.c +load src/qmail-queue.o src/triggerpull.o src/fmtqfn.o src/date822fmt.o \ +src/datetime.a src/ndelay.a src/open.a src/sig.a src/substdio.a src/error.a \ +src/str.a src/fs.a src/auto_qmail.o src/auto_split.o src/ids.a + ./load qmail-queue src/triggerpull.o src/fmtqfn.o \ + src/date822fmt.o src/datetime.a src/ndelay.a src/open.a src/sig.a \ + src/auto_qmail.o src/auto_split.o src/ids.a \ + src/substdio.a src/error.a src/str.a src/fs.a + +doc/man/qmail-queue.0: \ +doc/man/qmail-queue.8 + +src/qmail-queue.o: \ +compile src/qmail-queue.c include/readwrite.h include/sig.h include/exit.h include/open.h include/seek.h include/fmt.h \ +include/alloc.h include/substdio.h include/datetime.h include/now.h include/datetime.h include/triggerpull.h include/extra.h \ +include/uidgid.h include/auto_qmail.h include/auto_uids.h include/auto_users.h include/date822fmt.h include/fmtqfn.h + ./compile src/qmail-queue.c qmail-remote: \ -load qmail-remote.o control.o constmap.o timeoutread.o timeoutwrite.o \ -timeoutconn.o tcpto.o dns.o ip.o ipalloc.o ipme.o quote.o \ -ndelay.a case.a sig.a open.a lock.a getln.a stralloc.a \ -substdio.a error.a str.a fs.a auto_qmail.o dns.lib socket.lib - ./load qmail-remote control.o constmap.o timeoutread.o \ - timeoutwrite.o timeoutconn.o tcpto.o dns.o ip.o \ - ipalloc.o ipme.o quote.o ndelay.a case.a sig.a open.a \ - lock.a getln.a stralloc.a substdio.a error.a \ - str.a fs.a auto_qmail.o `cat dns.lib` `cat socket.lib` - -qmail-remote.0: \ -qmail-remote.8 - -qmail-remote.o: \ -compile qmail-remote.c sig.h stralloc.h gen_alloc.h substdio.h \ -subfd.h substdio.h scan.h case.h error.h auto_qmail.h control.h dns.h \ -alloc.h quote.h ip.h ipalloc.h ip.h gen_alloc.h ipme.h ip.h ipalloc.h \ -gen_alloc.h gen_allocdefs.h str.h now.h datetime.h exit.h constmap.h \ -tcpto.h readwrite.h timeoutconn.h timeoutread.h timeoutwrite.h oflops.h \ -error.h - ./compile qmail-remote.c +load src/qmail-remote.o src/control.o src/constmap.o src/timeoutread.o src/timeoutwrite.o \ +src/timeoutconn.o src/tcpto.o src/dns.o src/ip.o src/ipalloc.o src/ipme.o src/quote.o \ +src/ndelay.a src/case.a src/sig.a src/open.a src/lock.a src/getln.a src/stralloc.a \ +src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o dns.lib socket.lib + ./load qmail-remote src/control.o src/constmap.o src/timeoutread.o \ + src/timeoutwrite.o src/timeoutconn.o src/tcpto.o src/dns.o src/ip.o \ + src/ipalloc.o src/ipme.o src/quote.o src/ndelay.a src/case.a src/sig.a src/open.a \ + src/lock.a src/getln.a src/stralloc.a src/substdio.a src/error.a \ + src/str.a src/fs.a src/auto_qmail.o `cat dns.lib` `cat socket.lib` + +doc/man/qmail-remote.0: \ +doc/man/qmail-remote.8 + +src/qmail-remote.o: \ +compile src/qmail-remote.c include/sig.h include/stralloc.h include/gen_alloc.h include/substdio.h \ +include/subfd.h include/substdio.h include/scan.h include/case.h include/error.h include/auto_qmail.h include/control.h include/dns.h \ +include/alloc.h include/quote.h include/ip.h include/ipalloc.h include/ip.h include/gen_alloc.h include/ipme.h include/ip.h include/ipalloc.h \ +include/gen_alloc.h include/gen_allocdefs.h include/str.h include/now.h include/datetime.h include/exit.h include/constmap.h \ +include/tcpto.h include/readwrite.h include/timeoutconn.h include/timeoutread.h include/timeoutwrite.h include/oflops.h \ +include/error.h + ./compile src/qmail-remote.c qmail-rspawn: \ -load qmail-rspawn.o spawn.o tcpto_clean.o coe.o sig.a open.a \ -lock.a wait.a fd.a stralloc.a substdio.a error.a env.a str.a \ -auto_qmail.o auto_spawn.o ids.a - ./load qmail-rspawn spawn.o tcpto_clean.o coe.o \ - sig.a open.a lock.a wait.a fd.a stralloc.a \ - auto_qmail.o ids.a substdio.a error.a env.a str.a \ - auto_spawn.o - -qmail-rspawn.0: \ -qmail-rspawn.8 - -qmail-rspawn.o: \ -compile qmail-rspawn.c fd.h wait.h substdio.h exit.h fork.h error.h env.h \ -tcpto.h spawn.h - ./compile qmail-rspawn.c +load src/qmail-rspawn.o src/spawn.o src/tcpto_clean.o src/coe.o src/sig.a src/open.a \ +src/lock.a src/wait.a src/fd.a src/stralloc.a src/substdio.a src/error.a src/env.a src/str.a \ +src/auto_qmail.o src/auto_spawn.o src/ids.a + ./load qmail-rspawn src/spawn.o src/tcpto_clean.o src/coe.o \ + src/sig.a src/open.a src/lock.a src/wait.a src/fd.a src/stralloc.a \ + src/auto_qmail.o src/ids.a src/substdio.a src/error.a src/env.a src/str.a \ + src/auto_spawn.o + +doc/man/qmail-rspawn.0: \ +doc/man/qmail-rspawn.8 + +src/qmail-rspawn.o: \ +compile src/qmail-rspawn.c include/fd.h include/wait.h include/substdio.h include/exit.h include/fork.h include/error.h include/env.h \ +include/tcpto.h include/spawn.h + ./compile src/qmail-rspawn.c qmail-send: \ -load qmail-send.o qsutil.o control.o constmap.o newfield.o prioq.o \ -trigger.o fmtqfn.o quote.o readsubdir.o qmail.o date822fmt.o \ -datetime.a case.a ndelay.a getln.a wait.a fd.a sig.a open.a \ -lock.a stralloc.a substdio.a error.a str.a fs.a auto_qmail.o \ -auto_split.o env.a - ./load qmail-send qsutil.o control.o constmap.o newfield.o \ - prioq.o trigger.o fmtqfn.o quote.o readsubdir.o \ - qmail.o date822fmt.o datetime.a case.a ndelay.a getln.a \ - wait.a fd.a sig.a open.a lock.a stralloc.a \ - substdio.a error.a str.a fs.a auto_qmail.o auto_split.o env.a - -qmail-send.0: \ -qmail-send.8 - -qmail-send.8: \ -qmail-send.9 conf-qmail conf-break conf-spawn - cat qmail-send.9 \ +load src/qmail-send.o src/qsutil.o src/control.o src/constmap.o src/newfield.o src/prioq.o \ +src/trigger.o src/fmtqfn.o src/quote.o src/readsubdir.o src/qmail.o src/date822fmt.o \ +src/datetime.a src/case.a src/ndelay.a src/getln.a src/wait.a src/fd.a src/sig.a src/open.a \ +src/lock.a src/stralloc.a src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o \ +src/auto_split.o src/env.a + ./load qmail-send src/qsutil.o src/control.o src/constmap.o src/newfield.o \ + src/prioq.o src/trigger.o src/fmtqfn.o src/quote.o src/readsubdir.o \ + src/qmail.o src/date822fmt.o src/datetime.a src/case.a src/ndelay.a src/getln.a \ + src/wait.a src/fd.a src/sig.a src/open.a src/lock.a src/stralloc.a \ + src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o src/auto_split.o src/env.a + +doc/man/qmail-send.0: \ +doc/man/qmail-send.8 + +doc/man/qmail-send.8: \ +doc/man/qmail-send.9 conf-qmail conf-break conf-spawn + cat doc/man/qmail-send.9 \ | sed s}QMAILHOME}"`head -n 1 conf-qmail`"}g \ | sed s}BREAK}"`head -n 1 conf-break`"}g \ | sed s}SPAWN}"`head -n 1 conf-spawn`"}g \ - > qmail-send.8 + > doc/man/qmail-send.8 -qmail-send.o: \ -compile qmail-send.c readwrite.h sig.h direntry.h control.h select.h \ -open.h seek.h exit.h lock.h ndelay.h now.h datetime.h getln.h \ -substdio.h alloc.h error.h stralloc.h gen_alloc.h str.h byte.h fmt.h \ -scan.h case.h auto_qmail.h trigger.h newfield.h stralloc.h quote.h \ -qmail.h substdio.h qsutil.h prioq.h datetime.h gen_alloc.h constmap.h \ -fmtqfn.h readsubdir.h direntry.h - ./compile qmail-send.c +src/qmail-send.o: \ +compile src/qmail-send.c include/readwrite.h include/sig.h include/direntry.h include/control.h include/select.h \ +include/open.h include/seek.h include/exit.h include/lock.h include/ndelay.h include/now.h include/datetime.h include/getln.h \ +include/substdio.h include/alloc.h include/error.h include/stralloc.h include/gen_alloc.h include/str.h include/byte.h include/fmt.h \ +include/scan.h include/case.h include/auto_qmail.h include/trigger.h include/newfield.h include/stralloc.h include/quote.h \ +include/qmail.h include/substdio.h include/qsutil.h include/prioq.h include/datetime.h include/gen_alloc.h include/constmap.h \ +include/fmtqfn.h include/readsubdir.h include/direntry.h + ./compile src/qmail-send.c qmail-send.service: \ qmail-send.service.in conf-qmail @@ -1432,93 +1432,93 @@ qmail-send.service.in conf-qmail > qmail-send.service qmail-showctl: \ -load qmail-showctl.o control.o open.a getln.a stralloc.a \ -substdio.a error.a ids.a str.a fs.a auto_qmail.o auto_break.o auto_patrn.o \ -auto_spawn.o auto_split.o - ./load qmail-showctl control.o open.a getln.a ids.a \ - stralloc.a substdio.a error.a str.a fs.a auto_qmail.o \ - auto_break.o auto_patrn.o auto_spawn.o auto_split.o - -qmail-showctl.0: \ -qmail-showctl.8 - -qmail-showctl.o: \ -compile qmail-showctl.c substdio.h subfd.h substdio.h exit.h fmt.h \ -str.h control.h constmap.h stralloc.h gen_alloc.h direntry.h uidgid.h \ -auto_uids.h auto_users.h auto_qmail.h auto_break.h auto_patrn.h \ -auto_spawn.h auto_split.h - ./compile qmail-showctl.c +load src/qmail-showctl.o src/control.o src/open.a src/getln.a src/stralloc.a \ +src/substdio.a src/error.a src/ids.a src/str.a src/fs.a src/auto_qmail.o src/auto_break.o src/auto_patrn.o \ +src/auto_spawn.o src/auto_split.o + ./load qmail-showctl src/control.o src/open.a src/getln.a src/ids.a \ + src/stralloc.a src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o \ + src/auto_break.o src/auto_patrn.o src/auto_spawn.o src/auto_split.o + +doc/man/qmail-showctl.0: \ +doc/man/qmail-showctl.8 + +src/qmail-showctl.o: \ +compile src/qmail-showctl.c include/substdio.h include/subfd.h include/substdio.h include/exit.h include/fmt.h \ +include/str.h include/control.h include/constmap.h include/stralloc.h include/gen_alloc.h include/direntry.h include/uidgid.h \ +include/auto_uids.h include/auto_users.h include/auto_qmail.h include/auto_break.h include/auto_patrn.h \ +include/auto_spawn.h include/auto_split.h + ./compile src/qmail-showctl.c qmail-smtpd: \ -load qmail-smtpd.o rcpthosts.o commands.o timeoutread.o \ -timeoutwrite.o ip.o ipme.o ipalloc.o control.o constmap.o received.o \ -date822fmt.o qmail.o cdb.a fd.a wait.a datetime.a getln.a \ -open.a sig.a case.a env.a stralloc.a substdio.a error.a str.a \ -fs.a auto_qmail.o socket.lib - ./load qmail-smtpd rcpthosts.o commands.o timeoutread.o \ - timeoutwrite.o ip.o ipme.o ipalloc.o control.o constmap.o \ - received.o date822fmt.o qmail.o cdb.a fd.a wait.a \ - datetime.a getln.a open.a sig.a case.a env.a stralloc.a \ - substdio.a error.a str.a fs.a auto_qmail.o `cat \ +load src/qmail-smtpd.o src/rcpthosts.o src/commands.o src/timeoutread.o \ +src/timeoutwrite.o src/ip.o src/ipme.o src/ipalloc.o src/control.o src/constmap.o src/received.o \ +src/date822fmt.o src/qmail.o src/cdb.a src/fd.a src/wait.a src/datetime.a src/getln.a \ +src/open.a src/sig.a src/case.a src/env.a src/stralloc.a src/substdio.a src/error.a src/str.a \ +src/fs.a src/auto_qmail.o socket.lib + ./load qmail-smtpd src/rcpthosts.o src/commands.o src/timeoutread.o \ + src/timeoutwrite.o src/ip.o src/ipme.o src/ipalloc.o src/control.o src/constmap.o \ + src/received.o src/date822fmt.o src/qmail.o src/cdb.a src/fd.a src/wait.a \ + src/datetime.a src/getln.a src/open.a src/sig.a src/case.a src/env.a src/stralloc.a \ + src/substdio.a src/error.a src/str.a src/fs.a src/auto_qmail.o `cat \ socket.lib` -qmail-smtpd.0: \ -qmail-smtpd.8 +doc/man/qmail-smtpd.0: \ +doc/man/qmail-smtpd.8 -qmail-smtpd.o: \ -compile qmail-smtpd.c sig.h readwrite.h stralloc.h gen_alloc.h \ -substdio.h alloc.h auto_qmail.h control.h received.h constmap.h \ -error.h ipme.h ip.h ipalloc.h ip.h gen_alloc.h ip.h qmail.h \ -substdio.h str.h fmt.h scan.h byte.h case.h env.h now.h datetime.h \ -exit.h rcpthosts.h timeoutread.h timeoutwrite.h commands.h - ./compile qmail-smtpd.c +src/qmail-smtpd.o: \ +compile src/qmail-smtpd.c include/sig.h include/readwrite.h include/stralloc.h include/gen_alloc.h \ +include/substdio.h include/alloc.h include/auto_qmail.h include/control.h include/received.h include/constmap.h \ +include/error.h include/ipme.h include/ip.h include/ipalloc.h include/ip.h include/gen_alloc.h include/ip.h include/qmail.h \ +include/substdio.h include/str.h include/fmt.h include/scan.h include/byte.h include/case.h include/env.h include/now.h include/datetime.h \ +include/exit.h include/rcpthosts.h include/timeoutread.h include/timeoutwrite.h include/commands.h + ./compile src/qmail-smtpd.c qmail-start: \ -load qmail-start.o prot.o fd.a ids.a substdio.a error.a str.a - ./load qmail-start prot.o fd.a ids.a substdio.a error.a str.a +load src/qmail-start.o src/prot.o src/fd.a src/ids.a src/substdio.a src/error.a src/str.a + ./load qmail-start src/prot.o src/fd.a src/ids.a src/substdio.a src/error.a src/str.a -qmail-start.0: \ -qmail-start.8 +doc/man/qmail-start.0: \ +doc/man/qmail-start.8 -qmail-start.8: \ -qmail-start.9 conf-qmail conf-break conf-spawn - cat qmail-start.9 \ +doc/man/qmail-start.8: \ +doc/man/qmail-start.9 conf-qmail conf-break conf-spawn + cat doc/man/qmail-start.9 \ | sed s}QMAILHOME}"`head -n 1 conf-qmail`"}g \ | sed s}BREAK}"`head -n 1 conf-break`"}g \ | sed s}SPAWN}"`head -n 1 conf-spawn`"}g \ - > qmail-start.8 + > doc/man/qmail-start.8 -qmail-start.o: \ -compile qmail-start.c fd.h prot.h exit.h fork.h uidgid.h auto_uids.h auto_users.h - ./compile qmail-start.c +src/qmail-start.o: \ +compile src/qmail-start.c include/fd.h include/prot.h include/exit.h include/fork.h include/uidgid.h include/auto_uids.h include/auto_users.h + ./compile src/qmail-start.c qmail-tcpok: \ -load qmail-tcpok.o open.a lock.a strerr.a substdio.a error.a str.a \ -auto_qmail.o - ./load qmail-tcpok open.a lock.a strerr.a substdio.a \ - error.a str.a auto_qmail.o +load src/qmail-tcpok.o src/open.a src/lock.a src/strerr.a src/substdio.a src/error.a src/str.a \ +src/auto_qmail.o + ./load qmail-tcpok src/open.a src/lock.a src/strerr.a src/substdio.a \ + src/error.a src/str.a src/auto_qmail.o -qmail-tcpok.0: \ -qmail-tcpok.8 +doc/man/qmail-tcpok.0: \ +doc/man/qmail-tcpok.8 -qmail-tcpok.o: \ -compile qmail-tcpok.c strerr.h substdio.h lock.h open.h readwrite.h \ -auto_qmail.h - ./compile qmail-tcpok.c +src/qmail-tcpok.o: \ +compile src/qmail-tcpok.c include/strerr.h include/substdio.h include/lock.h include/open.h include/readwrite.h \ +include/auto_qmail.h + ./compile src/qmail-tcpok.c qmail-tcpto: \ -load qmail-tcpto.o ip.o open.a lock.a substdio.a error.a str.a \ -fs.a auto_qmail.o - ./load qmail-tcpto ip.o open.a lock.a substdio.a \ - error.a str.a fs.a auto_qmail.o +load src/qmail-tcpto.o src/ip.o src/open.a src/lock.a src/substdio.a src/error.a src/str.a \ +src/fs.a src/auto_qmail.o + ./load qmail-tcpto src/ip.o src/open.a src/lock.a src/substdio.a \ + src/error.a src/str.a src/fs.a src/auto_qmail.o -qmail-tcpto.0: \ -qmail-tcpto.8 +doc/man/qmail-tcpto.0: \ +doc/man/qmail-tcpto.8 -qmail-tcpto.o: \ -compile qmail-tcpto.c substdio.h subfd.h substdio.h auto_qmail.h byte.h \ -fmt.h ip.h lock.h error.h exit.h datetime.h now.h datetime.h open.h - ./compile qmail-tcpto.c +src/qmail-tcpto.o: \ +compile src/qmail-tcpto.c include/substdio.h include/subfd.h include/substdio.h include/auto_qmail.h include/byte.h \ +include/fmt.h include/ip.h include/lock.h include/error.h include/exit.h include/datetime.h include/now.h include/datetime.h include/open.h + ./compile src/qmail-tcpto.c qmail-upq: \ warn-auto.sh qmail-upq.sh conf-qmail conf-break conf-split @@ -1529,402 +1529,402 @@ warn-auto.sh qmail-upq.sh conf-qmail conf-break conf-split > qmail-upq chmod 755 qmail-upq -qmail-users.0: \ -qmail-users.5 +doc/man/qmail-users.0: \ +doc/man/qmail-users.5 -qmail-users.5: \ -qmail-users.9 conf-qmail conf-break conf-spawn - cat qmail-users.9 \ +doc/man/qmail-users.5: \ +doc/man/qmail-users.9 conf-qmail conf-break conf-spawn + cat doc/man/qmail-users.9 \ | sed s}QMAILHOME}"`head -n 1 conf-qmail`"}g \ | sed s}BREAK}"`head -n 1 conf-break`"}g \ | sed s}SPAWN}"`head -n 1 conf-spawn`"}g \ - > qmail-users.5 + > doc/man/qmail-users.5 -qmail.0: \ -qmail.7 +doc/man/qmail.0: \ +doc/man/qmail.7 -qmail.o: \ -compile qmail.c substdio.h readwrite.h wait.h exit.h fork.h fd.h \ -qmail.h auto_qmail.h env.h - ./compile qmail.c +src/qmail.o: \ +compile src/qmail.c include/substdio.h include/readwrite.h include/wait.h include/exit.h include/fork.h include/fd.h \ +include/qmail.h include/auto_qmail.h include/env.h + ./compile src/qmail.c qreceipt: \ -load qreceipt.o headerbody.o hfield.o quote.o token822.o qmail.o \ -getln.a fd.a wait.a sig.a env.a stralloc.a substdio.a error.a \ -str.a auto_qmail.o - ./load qreceipt headerbody.o hfield.o quote.o token822.o \ - qmail.o getln.a fd.a wait.a sig.a env.a stralloc.a \ - substdio.a error.a str.a auto_qmail.o - -qreceipt.0: \ -qreceipt.1 - -qreceipt.o: \ -compile qreceipt.c sig.h env.h substdio.h stralloc.h gen_alloc.h \ -subfd.h substdio.h getln.h alloc.h str.h hfield.h token822.h \ -gen_alloc.h error.h gen_alloc.h gen_allocdefs.h headerbody.h exit.h \ -open.h quote.h qmail.h substdio.h oflops.h error.h - ./compile qreceipt.c - -qsutil.o: \ -compile qsutil.c stralloc.h gen_alloc.h readwrite.h substdio.h \ -qsutil.h - ./compile qsutil.c - -qtmp.h: \ -tryutmpx.c compile load qtmp.h1 qtmp.h2 - ( ( ./compile tryutmpx.c && ./load tryutmpx ) >/dev/null 2>&1 \ - && cat qtmp.h2 || cat qtmp.h1 ) > qtmp.h - rm -f tryutmpx.o tryutmpx - -quote.o: \ -compile quote.c stralloc.h gen_alloc.h str.h quote.h oflops.h error.h - ./compile quote.c - -rcpthosts.o: \ -compile rcpthosts.c cdb.h uint32.h byte.h open.h error.h control.h \ -constmap.h stralloc.h gen_alloc.h rcpthosts.h case.h - ./compile rcpthosts.c - -readsubdir.o: \ -compile readsubdir.c readsubdir.h direntry.h fmt.h scan.h str.h \ -auto_split.h - ./compile readsubdir.c - -received.o: \ -compile received.c fmt.h qmail.h substdio.h now.h datetime.h \ -datetime.h date822fmt.h received.h - ./compile received.c - -remoteinfo.o: \ -compile remoteinfo.c byte.h substdio.h ip.h fmt.h timeoutconn.h \ -timeoutread.h timeoutwrite.h remoteinfo.h - ./compile remoteinfo.c - -scan_8long.o: \ -compile scan_8long.c scan.h - ./compile scan_8long.c - -scan_ulong.o: \ -compile scan_ulong.c scan.h - ./compile scan_ulong.c - -select.h: \ -compile trysysel.c select.h1 select.h2 - ( ./compile trysysel.c >/dev/null 2>&1 \ - && cat select.h2 || cat select.h1 ) > select.h - rm -f trysysel.o trysysel +load src/qreceipt.o src/headerbody.o src/hfield.o src/quote.o src/token822.o src/qmail.o \ +src/getln.a src/fd.a src/wait.a src/sig.a src/env.a src/stralloc.a src/substdio.a src/error.a \ +src/str.a src/auto_qmail.o + ./load qreceipt src/headerbody.o src/hfield.o src/quote.o src/token822.o \ + src/qmail.o src/getln.a src/fd.a src/wait.a src/sig.a src/env.a src/stralloc.a \ + src/substdio.a src/error.a src/str.a src/auto_qmail.o + +doc/man/qreceipt.0: \ +doc/man/qreceipt.1 + +src/qreceipt.o: \ +compile src/qreceipt.c include/sig.h include/env.h include/substdio.h include/stralloc.h include/gen_alloc.h \ +include/subfd.h include/substdio.h include/getln.h include/alloc.h include/str.h include/hfield.h include/token822.h \ +include/gen_alloc.h include/error.h include/gen_alloc.h include/gen_allocdefs.h include/headerbody.h include/exit.h \ +include/open.h include/quote.h include/qmail.h include/substdio.h include/oflops.h include/error.h + ./compile src/qreceipt.c + +src/qsutil.o: \ +compile src/qsutil.c include/stralloc.h include/gen_alloc.h include/readwrite.h include/substdio.h \ +include/qsutil.h + ./compile src/qsutil.c + +include/qtmp.h: \ +src/tryutmpx.c compile load include/qtmp.h1 include/qtmp.h2 + ( ( ./compile src/tryutmpx.c && ./load tryutmpx ) >/dev/null 2>&1 \ + && cat include/qtmp.h2 || cat include/qtmp.h1 ) > include/qtmp.h + rm -f src/tryutmpx.o tryutmpx + +src/quote.o: \ +compile src/quote.c include/stralloc.h include/gen_alloc.h include/str.h include/quote.h include/oflops.h include/error.h + ./compile src/quote.c + +src/rcpthosts.o: \ +compile src/rcpthosts.c include/cdb.h include/uint32.h include/byte.h include/open.h include/error.h include/control.h \ +include/constmap.h include/stralloc.h include/gen_alloc.h include/rcpthosts.h include/case.h + ./compile src/rcpthosts.c + +src/readsubdir.o: \ +compile src/readsubdir.c include/readsubdir.h include/direntry.h include/fmt.h include/scan.h include/str.h \ +include/auto_split.h + ./compile src/readsubdir.c + +src/received.o: \ +compile src/received.c include/fmt.h include/qmail.h include/substdio.h include/now.h include/datetime.h \ +include/datetime.h include/date822fmt.h include/received.h + ./compile src/received.c + +src/remoteinfo.o: \ +compile src/remoteinfo.c include/byte.h include/substdio.h include/ip.h include/fmt.h include/timeoutconn.h \ +include/timeoutread.h include/timeoutwrite.h include/remoteinfo.h + ./compile src/remoteinfo.c + +src/scan_8long.o: \ +compile src/scan_8long.c include/scan.h + ./compile src/scan_8long.c + +src/scan_ulong.o: \ +compile src/scan_ulong.c include/scan.h + ./compile src/scan_ulong.c + +include/select.h: \ +compile src/trysysel.c include/select.h1 include/select.h2 + ( ./compile src/trysysel.c >/dev/null 2>&1 \ + && cat include/select.h2 || cat include/select.h1 ) > include/select.h + rm -f src/trysysel.o trysysel sendmail: \ -load sendmail.o env.a getopt.a substdio.a error.a str.a \ -auto_qmail.o - ./load sendmail env.a getopt.a substdio.a error.a \ - str.a auto_qmail.o +load src/sendmail.o src/env.a src/getopt.a src/substdio.a src/error.a src/str.a \ +src/auto_qmail.o + ./load sendmail src/env.a src/getopt.a src/substdio.a src/error.a \ + src/str.a src/auto_qmail.o -sendmail.o: \ -compile sendmail.c sgetopt.h subgetopt.h substdio.h subfd.h \ -substdio.h alloc.h auto_qmail.h exit.h env.h str.h - ./compile sendmail.c +src/sendmail.o: \ +compile src/sendmail.c include/sgetopt.h include/subgetopt.h include/substdio.h include/subfd.h \ +include/substdio.h include/alloc.h include/auto_qmail.h include/exit.h include/env.h include/str.h + ./compile src/sendmail.c setup: \ it man ./instpackage ./instchown -sgetopt.o: \ -compile sgetopt.c substdio.h subfd.h substdio.h sgetopt.h subgetopt.h \ -subgetopt.h - ./compile sgetopt.c +src/sgetopt.o: \ +compile src/sgetopt.c include/substdio.h include/subfd.h include/substdio.h include/sgetopt.h include/subgetopt.h \ +include/subgetopt.h + ./compile src/sgetopt.c -sig.a: \ -makelib sig_alarm.o sig_block.o sig_catch.o sig_pause.o sig_pipe.o \ -sig_child.o sig_hup.o sig_term.o sig_bug.o sig_misc.o - ./makelib sig.a sig_alarm.o sig_block.o sig_catch.o \ - sig_pause.o sig_pipe.o sig_child.o sig_hup.o sig_term.o \ - sig_bug.o sig_misc.o +src/sig.a: \ +makelib src/sig_alarm.o src/sig_block.o src/sig_catch.o src/sig_pause.o src/sig_pipe.o \ +src/sig_child.o src/sig_hup.o src/sig_term.o src/sig_bug.o src/sig_misc.o + ./makelib src/sig.a src/sig_alarm.o src/sig_block.o src/sig_catch.o \ + src/sig_pause.o src/sig_pipe.o src/sig_child.o src/sig_hup.o src/sig_term.o \ + src/sig_bug.o src/sig_misc.o -sig_alarm.o: \ -compile sig_alarm.c sig.h - ./compile sig_alarm.c +src/sig_alarm.o: \ +compile src/sig_alarm.c include/sig.h + ./compile src/sig_alarm.c -sig_block.o: \ -compile sig_block.c sig.h hassgprm.h - ./compile sig_block.c +src/sig_block.o: \ +compile src/sig_block.c include/sig.h include/hassgprm.h + ./compile src/sig_block.c -sig_bug.o: \ -compile sig_bug.c sig.h - ./compile sig_bug.c +src/sig_bug.o: \ +compile src/sig_bug.c include/sig.h + ./compile src/sig_bug.c -sig_catch.o: \ -compile sig_catch.c sig.h hassgact.h - ./compile sig_catch.c +src/sig_catch.o: \ +compile src/sig_catch.c include/sig.h include/hassgact.h + ./compile src/sig_catch.c -sig_child.o: \ -compile sig_child.c sig.h - ./compile sig_child.c +src/sig_child.o: \ +compile src/sig_child.c include/sig.h + ./compile src/sig_child.c -sig_hup.o: \ -compile sig_hup.c sig.h - ./compile sig_hup.c +src/sig_hup.o: \ +compile src/sig_hup.c include/sig.h + ./compile src/sig_hup.c -sig_misc.o: \ -compile sig_misc.c sig.h - ./compile sig_misc.c +src/sig_misc.o: \ +compile src/sig_misc.c include/sig.h + ./compile src/sig_misc.c -sig_pause.o: \ -compile sig_pause.c sig.h hassgprm.h - ./compile sig_pause.c +src/sig_pause.o: \ +compile src/sig_pause.c include/sig.h include/hassgprm.h + ./compile src/sig_pause.c -sig_pipe.o: \ -compile sig_pipe.c sig.h - ./compile sig_pipe.c +src/sig_pipe.o: \ +compile src/sig_pipe.c include/sig.h + ./compile src/sig_pipe.c -sig_term.o: \ -compile sig_term.c sig.h - ./compile sig_term.c +src/sig_term.o: \ +compile src/sig_term.c include/sig.h + ./compile src/sig_term.c -slurpclose.o: \ -compile slurpclose.c stralloc.h gen_alloc.h readwrite.h slurpclose.h \ -error.h - ./compile slurpclose.c +src/slurpclose.o: \ +compile src/slurpclose.c include/stralloc.h include/gen_alloc.h include/readwrite.h include/slurpclose.h \ +include/error.h + ./compile src/slurpclose.c socket.lib: \ -trylsock.c compile load - ( ( ./compile trylsock.c && \ +src/trylsock.c compile load + ( ( ./compile src/trylsock.c && \ ./load trylsock -lsocket -lnsl ) >/dev/null 2>&1 \ && echo -lsocket -lnsl || exit 0 ) > socket.lib - rm -f trylsock.o trylsock + rm -f src/trylsock.o trylsock -spawn.o: \ -compile chkspawn spawn.c sig.h wait.h substdio.h byte.h str.h \ -stralloc.h gen_alloc.h select.h exit.h alloc.h coe.h open.h error.h \ -auto_qmail.h auto_uids.h auto_spawn.h spawn.h +src/spawn.o: \ +compile chkspawn src/spawn.c include/sig.h include/wait.h include/substdio.h include/byte.h include/str.h \ +include/stralloc.h include/gen_alloc.h include/select.h include/exit.h include/alloc.h include/coe.h include/open.h include/error.h \ +include/auto_qmail.h include/auto_uids.h include/auto_spawn.h include/spawn.h ./chkspawn - ./compile spawn.c + ./compile src/spawn.c splogger: \ -load splogger.o substdio.a error.a str.a fs.a syslog.lib socket.lib - ./load splogger substdio.a error.a str.a fs.a `cat \ +load src/splogger.o src/substdio.a src/error.a src/str.a src/fs.a syslog.lib socket.lib + ./load splogger src/substdio.a src/error.a src/str.a src/fs.a `cat \ syslog.lib` `cat socket.lib` -splogger.0: \ -splogger.8 - -splogger.o: \ -compile splogger.c error.h substdio.h subfd.h substdio.h exit.h str.h \ -scan.h fmt.h - ./compile splogger.c - -str.a: \ -makelib str_chr.o \ -str_rchr.o str_start.o byte_chr.o byte_rchr.o byte_copy.o \ -byte_cr.o byte_zero.o - ./makelib str.a \ - str_chr.o str_rchr.o str_start.o byte_chr.o byte_rchr.o \ - byte_copy.o byte_cr.o byte_zero.o - -str_chr.o: \ -compile str_chr.c str.h - ./compile str_chr.c - -str_rchr.o: \ -compile str_rchr.c str.h - ./compile str_rchr.c - -str_start.o: \ -compile str_start.c str.h - ./compile str_start.c - -stralloc.a: \ -makelib stralloc_eady.o stralloc_pend.o stralloc_copy.o \ -stralloc_opys.o stralloc_opyb.o stralloc_cat.o stralloc_cats.o \ -stralloc_catb.o stralloc_arts.o - ./makelib stralloc.a stralloc_eady.o stralloc_pend.o \ - stralloc_copy.o stralloc_opys.o stralloc_opyb.o \ - stralloc_cat.o stralloc_cats.o stralloc_catb.o \ - stralloc_arts.o - -stralloc_arts.o: \ -compile stralloc_arts.c byte.h str.h stralloc.h gen_alloc.h - ./compile stralloc_arts.c - -stralloc_cat.o: \ -compile stralloc_cat.c byte.h stralloc.h gen_alloc.h - ./compile stralloc_cat.c - -stralloc_catb.o: \ -compile stralloc_catb.c stralloc.h gen_alloc.h byte.h error.h oflops.h - ./compile stralloc_catb.c - -stralloc_cats.o: \ -compile stralloc_cats.c byte.h str.h stralloc.h gen_alloc.h - ./compile stralloc_cats.c - -stralloc_copy.o: \ -compile stralloc_copy.c byte.h stralloc.h gen_alloc.h - ./compile stralloc_copy.c - -stralloc_eady.o: \ -compile stralloc_eady.c alloc.h stralloc.h gen_alloc.h \ -gen_allocdefs.h oflops.h error.h - ./compile stralloc_eady.c - -stralloc_opyb.o: \ -compile stralloc_opyb.c stralloc.h gen_alloc.h byte.h error.h oflops.h - ./compile stralloc_opyb.c - -stralloc_opys.o: \ -compile stralloc_opys.c byte.h str.h stralloc.h gen_alloc.h - ./compile stralloc_opys.c - -stralloc_pend.o: \ -compile stralloc_pend.c alloc.h stralloc.h gen_alloc.h \ -gen_allocdefs.h oflops.h error.h - ./compile stralloc_pend.c - -strerr.a: \ -makelib strerr_sys.o strerr_die.o - ./makelib strerr.a strerr_sys.o strerr_die.o - -strerr_die.o: \ -compile strerr_die.c substdio.h subfd.h substdio.h exit.h strerr.h - ./compile strerr_die.c - -strerr_sys.o: \ -compile strerr_sys.c error.h strerr.h - ./compile strerr_sys.c - -subfderr.o: \ -compile subfderr.c readwrite.h substdio.h subfd.h substdio.h - ./compile subfderr.c - -subfdin.o: \ -compile subfdin.c readwrite.h substdio.h subfd.h substdio.h - ./compile subfdin.c - -subfdins.o: \ -compile subfdins.c readwrite.h substdio.h subfd.h substdio.h - ./compile subfdins.c - -subfdout.o: \ -compile subfdout.c readwrite.h substdio.h subfd.h substdio.h - ./compile subfdout.c - -subfdouts.o: \ -compile subfdouts.c readwrite.h substdio.h subfd.h substdio.h - ./compile subfdouts.c - -subgetopt.o: \ -compile subgetopt.c subgetopt.h - ./compile subgetopt.c - -substdi.o: \ -compile substdi.c substdio.h byte.h error.h - ./compile substdi.c - -substdio.a: \ -makelib substdio.o substdi.o substdo.o subfderr.o subfdout.o \ -subfdouts.o subfdin.o subfdins.o substdio_copy.o - ./makelib substdio.a substdio.o substdi.o substdo.o \ - subfderr.o subfdout.o subfdouts.o subfdin.o subfdins.o \ - substdio_copy.o - -substdio.o: \ -compile substdio.c substdio.h - ./compile substdio.c - -substdio_copy.o: \ -compile substdio_copy.c substdio.h - ./compile substdio_copy.c - -substdo.o: \ -compile substdo.c substdio.h str.h byte.h error.h - ./compile substdo.c +doc/man/splogger.0: \ +doc/man/splogger.8 + +src/splogger.o: \ +compile src/splogger.c include/error.h include/substdio.h include/subfd.h include/substdio.h include/exit.h include/str.h \ +include/scan.h include/fmt.h + ./compile src/splogger.c + +src/str.a: \ +makelib src/str_chr.o \ +src/str_rchr.o src/str_start.o src/byte_chr.o src/byte_rchr.o src/byte_copy.o \ +src/byte_cr.o src/byte_zero.o + ./makelib src/str.a \ + src/str_chr.o src/str_rchr.o src/str_start.o src/byte_chr.o src/byte_rchr.o \ + src/byte_copy.o src/byte_cr.o src/byte_zero.o + +src/str_chr.o: \ +compile src/str_chr.c include/str.h + ./compile src/str_chr.c + +src/str_rchr.o: \ +compile src/str_rchr.c include/str.h + ./compile src/str_rchr.c + +src/str_start.o: \ +compile src/str_start.c include/str.h + ./compile src/str_start.c + +src/stralloc.a: \ +makelib src/stralloc_eady.o src/stralloc_pend.o src/stralloc_copy.o \ +src/stralloc_opys.o src/stralloc_opyb.o src/stralloc_cat.o src/stralloc_cats.o \ +src/stralloc_catb.o src/stralloc_arts.o + ./makelib src/stralloc.a src/stralloc_eady.o src/stralloc_pend.o \ + src/stralloc_copy.o src/stralloc_opys.o src/stralloc_opyb.o \ + src/stralloc_cat.o src/stralloc_cats.o src/stralloc_catb.o \ + src/stralloc_arts.o + +src/stralloc_arts.o: \ +compile src/stralloc_arts.c include/byte.h include/str.h include/stralloc.h include/gen_alloc.h + ./compile src/stralloc_arts.c + +src/stralloc_cat.o: \ +compile src/stralloc_cat.c include/byte.h include/stralloc.h include/gen_alloc.h + ./compile src/stralloc_cat.c + +src/stralloc_catb.o: \ +compile src/stralloc_catb.c include/stralloc.h include/gen_alloc.h include/byte.h include/error.h include/oflops.h + ./compile src/stralloc_catb.c + +src/stralloc_cats.o: \ +compile src/stralloc_cats.c include/byte.h include/str.h include/stralloc.h include/gen_alloc.h + ./compile src/stralloc_cats.c + +src/stralloc_copy.o: \ +compile src/stralloc_copy.c include/byte.h include/stralloc.h include/gen_alloc.h + ./compile src/stralloc_copy.c + +src/stralloc_eady.o: \ +compile src/stralloc_eady.c include/alloc.h include/stralloc.h include/gen_alloc.h \ +include/gen_allocdefs.h include/oflops.h include/error.h + ./compile src/stralloc_eady.c + +src/stralloc_opyb.o: \ +compile src/stralloc_opyb.c include/stralloc.h include/gen_alloc.h include/byte.h include/error.h include/oflops.h + ./compile src/stralloc_opyb.c + +src/stralloc_opys.o: \ +compile src/stralloc_opys.c include/byte.h include/str.h include/stralloc.h include/gen_alloc.h + ./compile src/stralloc_opys.c + +src/stralloc_pend.o: \ +compile src/stralloc_pend.c include/alloc.h include/stralloc.h include/gen_alloc.h \ +include/gen_allocdefs.h include/oflops.h include/error.h + ./compile src/stralloc_pend.c + +src/strerr.a: \ +makelib src/strerr_sys.o src/strerr_die.o + ./makelib src/strerr.a src/strerr_sys.o src/strerr_die.o + +src/strerr_die.o: \ +compile src/strerr_die.c include/substdio.h include/subfd.h include/substdio.h include/exit.h include/strerr.h + ./compile src/strerr_die.c + +src/strerr_sys.o: \ +compile src/strerr_sys.c include/error.h include/strerr.h + ./compile src/strerr_sys.c + +src/subfderr.o: \ +compile src/subfderr.c include/readwrite.h include/substdio.h include/subfd.h include/substdio.h + ./compile src/subfderr.c + +src/subfdin.o: \ +compile src/subfdin.c include/readwrite.h include/substdio.h include/subfd.h include/substdio.h + ./compile src/subfdin.c + +src/subfdins.o: \ +compile src/subfdins.c include/readwrite.h include/substdio.h include/subfd.h include/substdio.h + ./compile src/subfdins.c + +src/subfdout.o: \ +compile src/subfdout.c include/readwrite.h include/substdio.h include/subfd.h include/substdio.h + ./compile src/subfdout.c + +src/subfdouts.o: \ +compile src/subfdouts.c include/readwrite.h include/substdio.h include/subfd.h include/substdio.h + ./compile src/subfdouts.c + +src/subgetopt.o: \ +compile src/subgetopt.c include/subgetopt.h + ./compile src/subgetopt.c + +src/substdi.o: \ +compile src/substdi.c include/substdio.h include/byte.h include/error.h + ./compile src/substdi.c + +src/substdio.a: \ +makelib src/substdio.o src/substdi.o src/substdo.o src/subfderr.o src/subfdout.o \ +src/subfdouts.o src/subfdin.o src/subfdins.o src/substdio_copy.o + ./makelib src/substdio.a src/substdio.o src/substdi.o src/substdo.o \ + src/subfderr.o src/subfdout.o src/subfdouts.o src/subfdin.o src/subfdins.o \ + src/substdio_copy.o + +src/substdio.o: \ +compile src/substdio.c include/substdio.h + ./compile src/substdio.c + +src/substdio_copy.o: \ +compile src/substdio_copy.c include/substdio.h + ./compile src/substdio_copy.c + +src/substdo.o: \ +compile src/substdo.c include/substdio.h include/str.h include/byte.h include/error.h + ./compile src/substdo.c syslog.lib: \ -trysyslog.c compile load - ( ( ./compile trysyslog.c && \ +src/trysyslog.c compile load + ( ( ./compile src/trysyslog.c && \ ./load trysyslog -lgen ) >/dev/null 2>&1 \ && echo -lgen || exit 0 ) > syslog.lib - rm -f trysyslog.o trysyslog + rm -f src/trysyslog.o trysyslog tcp-env: \ -load tcp-env.o dns.o remoteinfo.o timeoutread.o timeoutwrite.o \ -timeoutconn.o ip.o ipalloc.o case.a ndelay.a sig.a env.a getopt.a \ -stralloc.a substdio.a error.a str.a fs.a dns.lib socket.lib - ./load tcp-env dns.o remoteinfo.o timeoutread.o \ - timeoutwrite.o timeoutconn.o ip.o ipalloc.o case.a ndelay.a \ - sig.a env.a getopt.a stralloc.a substdio.a error.a \ - str.a fs.a `cat dns.lib` `cat socket.lib` - -tcp-env.0: \ -tcp-env.1 - -tcp-env.o: \ -compile tcp-env.c sig.h stralloc.h gen_alloc.h str.h env.h fmt.h \ -scan.h subgetopt.h ip.h dns.h byte.h remoteinfo.h exit.h case.h - ./compile tcp-env.c - -tcp-environ.0: \ -tcp-environ.5 - -tcpto.o: \ -compile tcpto.c tcpto.h open.h lock.h seek.h now.h datetime.h ip.h \ -byte.h datetime.h readwrite.h - ./compile tcpto.c - -tcpto_clean.o: \ -compile tcpto_clean.c tcpto.h open.h substdio.h readwrite.h - ./compile tcpto_clean.c +load src/tcp-env.o src/dns.o src/remoteinfo.o src/timeoutread.o src/timeoutwrite.o \ +src/timeoutconn.o src/ip.o src/ipalloc.o src/case.a src/ndelay.a src/sig.a src/env.a src/getopt.a \ +src/stralloc.a src/substdio.a src/error.a src/str.a src/fs.a dns.lib socket.lib + ./load tcp-env src/dns.o src/remoteinfo.o src/timeoutread.o \ + src/timeoutwrite.o src/timeoutconn.o src/ip.o src/ipalloc.o src/case.a src/ndelay.a \ + src/sig.a src/env.a src/getopt.a src/stralloc.a src/substdio.a src/error.a \ + src/str.a src/fs.a `cat dns.lib` `cat socket.lib` + +doc/man/tcp-env.0: \ +doc/man/tcp-env.1 + +src/tcp-env.o: \ +compile src/tcp-env.c include/sig.h include/stralloc.h include/gen_alloc.h include/str.h include/env.h include/fmt.h \ +include/scan.h include/subgetopt.h include/ip.h include/dns.h include/byte.h include/remoteinfo.h include/exit.h include/case.h + ./compile src/tcp-env.c + +doc/man/tcp-environ.0: \ +doc/man/tcp-environ.5 + +src/tcpto.o: \ +compile src/tcpto.c include/tcpto.h include/open.h include/lock.h include/seek.h include/now.h include/datetime.h include/ip.h \ +include/byte.h include/datetime.h include/readwrite.h + ./compile src/tcpto.c + +src/tcpto_clean.o: \ +compile src/tcpto_clean.c include/tcpto.h include/open.h include/substdio.h include/readwrite.h + ./compile src/tcpto_clean.c test: it @$(MAKE) -C tests test -timeoutconn.o: \ -compile timeoutconn.c ndelay.h select.h error.h readwrite.h ip.h \ -byte.h timeoutconn.h - ./compile timeoutconn.c - -timeoutread.o: \ -compile timeoutread.c timeoutread.h select.h error.h readwrite.h - ./compile timeoutread.c - -timeoutwrite.o: \ -compile timeoutwrite.c timeoutwrite.h select.h error.h readwrite.h - ./compile timeoutwrite.c - -token822.o: \ -compile token822.c stralloc.h gen_alloc.h alloc.h str.h token822.h \ -gen_alloc.h gen_allocdefs.h oflops.h error.h - ./compile token822.c - -trigger.o: \ -compile trigger.c select.h open.h trigger.h hasnpbg1.h - ./compile trigger.c - -triggerpull.o: \ -compile triggerpull.c ndelay.h open.h triggerpull.h - ./compile triggerpull.c - -uid.o: \ -compile uid.c uidgid.h subfd.h substdio.h exit.h - ./compile uid.c - -ids.a: \ -makelib auto_usera.o auto_userd.o auto_userl.o auto_usero.o auto_userp.o \ -auto_userq.o auto_userr.o auto_users.o auto_groupn.o auto_groupq.o gid.o uid.o - ./makelib ids.a auto_usera.o auto_userd.o auto_userl.o auto_usero.o \ - auto_userp.o auto_userq.o auto_userr.o auto_users.o auto_groupn.o \ - auto_groupq.o gid.o uid.o - -wait.a: \ -makelib wait_pid.o wait_nohang.o - ./makelib wait.a wait_pid.o wait_nohang.o - -wait_nohang.o: \ -compile wait_nohang.c haswaitp.h - ./compile wait_nohang.c - -wait_pid.o: \ -compile wait_pid.c error.h haswaitp.h - ./compile wait_pid.c +src/timeoutconn.o: \ +compile src/timeoutconn.c include/ndelay.h include/select.h include/error.h include/readwrite.h include/ip.h \ +include/byte.h include/timeoutconn.h + ./compile src/timeoutconn.c + +src/timeoutread.o: \ +compile src/timeoutread.c include/timeoutread.h include/select.h include/error.h include/readwrite.h + ./compile src/timeoutread.c + +src/timeoutwrite.o: \ +compile src/timeoutwrite.c include/timeoutwrite.h include/select.h include/error.h include/readwrite.h + ./compile src/timeoutwrite.c + +src/token822.o: \ +compile src/token822.c include/stralloc.h include/gen_alloc.h include/alloc.h include/str.h include/token822.h \ +include/gen_alloc.h include/gen_allocdefs.h include/oflops.h include/error.h + ./compile src/token822.c + +src/trigger.o: \ +compile src/trigger.c include/select.h include/open.h include/trigger.h include/hasnpbg1.h + ./compile src/trigger.c + +src/triggerpull.o: \ +compile src/triggerpull.c include/ndelay.h include/open.h include/triggerpull.h + ./compile src/triggerpull.c + +src/uid.o: \ +compile src/uid.c include/uidgid.h include/subfd.h include/substdio.h include/exit.h + ./compile src/uid.c + +src/ids.a: \ +makelib src/auto_usera.o src/auto_userd.o src/auto_userl.o src/auto_usero.o src/auto_userp.o \ +src/auto_userq.o src/auto_userr.o src/auto_users.o src/auto_groupn.o src/auto_groupq.o src/gid.o src/uid.o + ./makelib src/ids.a src/auto_usera.o src/auto_userd.o src/auto_userl.o src/auto_usero.o \ + src/auto_userp.o src/auto_userq.o src/auto_userr.o src/auto_users.o src/auto_groupn.o \ + src/auto_groupq.o src/gid.o src/uid.o + +src/wait.a: \ +makelib src/wait_pid.o src/wait_nohang.o + ./makelib src/wait.a src/wait_pid.o src/wait_nohang.o + +src/wait_nohang.o: \ +compile src/wait_nohang.c include/haswaitp.h + ./compile src/wait_nohang.c + +src/wait_pid.o: \ +compile src/wait_pid.c include/error.h include/haswaitp.h + ./compile src/wait_pid.c diff --git a/TARGETS b/TARGETS @@ -4,304 +4,304 @@ make-load load make-compile compile -qmail-local.o -qmail.o -quote.o -gfrom.o -myctime.o -slurpclose.o +src/qmail-local.o +src/qmail.o +src/quote.o +src/gfrom.o +src/myctime.o +src/slurpclose.o make-makelib makelib -case_diffb.o -case_diffs.o -case_lowerb.o -case_lowers.o -case_starts.o -case.a -getln.o -getln2.o -getln.a -subgetopt.o -sgetopt.o -getopt.a -sig_alarm.o -oflops.h -hassgprm.h -sig_block.o -hassgact.h -sig_catch.o -sig_pause.o -sig_pipe.o -sig_child.o -sig_hup.o -sig_term.o -sig_bug.o -sig_misc.o -sig.a -open_append.o -open_excl.o -open_read.o -open_trunc.o -open_write.o -open.a -seek_cur.o -seek_end.o -seek_set.o -seek_trunc.o -seek.a -hasflock.h -lock_ex.o -lock_exnb.o -lock_un.o -lock.a -fd_copy.o -fd_move.o -fd.a -haswaitp.h -ids.a -wait_pid.o -wait_nohang.o -wait.a -env.o -envread.o -env.a -stralloc_eady.o -stralloc_pend.o -stralloc_copy.o -stralloc_opys.o -stralloc_opyb.o -stralloc_cat.o -stralloc_cats.o -stralloc_catb.o -stralloc_arts.o -stralloc.a -strerr_sys.o -strerr_die.o -strerr.a -substdio.o -substdi.o -substdo.o -subfderr.o -subfdout.o -subfdouts.o -subfdin.o -subfdins.o -substdio_copy.o -substdio.a -error_str.o -error_temp.o -error.a -str_chr.o -str_rchr.o -str_start.o -byte_chr.o -byte_rchr.o -byte_copy.o -byte_cr.o -byte_zero.o -str.a -fmt_str.o -fmt_strn.o -fmt_uint.o -fmt_uint0.o -fmt_ulong.o -scan_ulong.o -scan_8long.o -fs.a -datetime.o -datetime_un.o -datetime.a -auto-str.o +src/case_diffb.o +src/case_diffs.o +src/case_lowerb.o +src/case_lowers.o +src/case_starts.o +src/case.a +src/getln.o +src/getln2.o +src/getln.a +src/subgetopt.o +src/sgetopt.o +src/getopt.a +src/sig_alarm.o +include/oflops.h +include/hassgprm.h +src/sig_block.o +include/hassgact.h +src/sig_catch.o +src/sig_pause.o +src/sig_pipe.o +src/sig_child.o +src/sig_hup.o +src/sig_term.o +src/sig_bug.o +src/sig_misc.o +src/sig.a +src/open_append.o +src/open_excl.o +src/open_read.o +src/open_trunc.o +src/open_write.o +src/open.a +src/seek_cur.o +src/seek_end.o +src/seek_set.o +src/seek_trunc.o +src/seek.a +include/hasflock.h +src/lock_ex.o +src/lock_exnb.o +src/lock_un.o +src/lock.a +src/fd_copy.o +src/fd_move.o +src/fd.a +include/haswaitp.h +src/ids.a +src/wait_pid.o +src/wait_nohang.o +src/wait.a +src/env.o +src/envread.o +src/env.a +src/stralloc_eady.o +src/stralloc_pend.o +src/stralloc_copy.o +src/stralloc_opys.o +src/stralloc_opyb.o +src/stralloc_cat.o +src/stralloc_cats.o +src/stralloc_catb.o +src/stralloc_arts.o +src/stralloc.a +src/strerr_sys.o +src/strerr_die.o +src/strerr.a +src/substdio.o +src/substdi.o +src/substdo.o +src/subfderr.o +src/subfdout.o +src/subfdouts.o +src/subfdin.o +src/subfdins.o +src/substdio_copy.o +src/substdio.a +src/error_str.o +src/error_temp.o +src/error.a +src/str_chr.o +src/str_rchr.o +src/str_start.o +src/byte_chr.o +src/byte_rchr.o +src/byte_copy.o +src/byte_cr.o +src/byte_zero.o +src/str.a +src/fmt_str.o +src/fmt_strn.o +src/fmt_uint.o +src/fmt_uint0.o +src/fmt_ulong.o +src/scan_ulong.o +src/scan_8long.o +src/fs.a +src/datetime.o +src/datetime_un.o +src/datetime.a +src/auto-str.o auto-str auto_qmail.c -auto_qmail.o -auto-int8.o +src/auto_qmail.o +src/auto-int8.o auto-int8 auto_patrn.c -auto_patrn.o +src/auto_patrn.o socket.lib qmail-local -qmail-lspawn.o -select.h -chkspawn.o -auto-int.o +src/qmail-lspawn.o +include/select.h +src/chkspawn.o +src/auto-int.o auto-int auto_spawn.c -auto_spawn.o +src/auto_spawn.o chkspawn -spawn.o -prot.o -coe.o -cdb_hash.o -cdb_unpack.o -cdb_seek.o -cdb.a -uid.o -gid.o +src/spawn.o +src/prot.o +src/coe.o +src/cdb_hash.o +src/cdb_unpack.o +src/cdb_seek.o +src/cdb.a +src/uid.o +src/gid.o qmail-lspawn -qmail-getpw.o +src/qmail-getpw.o auto_break.c -auto_break.o +src/auto_break.o auto_usera.c -auto_usera.o +src/auto_usera.o auto_userd.c -auto_userd.o +src/auto_userd.o auto_userl.c -auto_userl.o +src/auto_userl.o auto_usero.c -auto_usero.o +src/auto_usero.o auto_userp.c -auto_userp.o +src/auto_userp.o auto_userq.c -auto_userq.o +src/auto_userq.o auto_userr.c -auto_userr.o +src/auto_userr.o auto_users.c -auto_users.o +src/auto_users.o auto_groupn.c -auto_groupn.o +src/auto_groupn.o auto_groupq.c -auto_groupq.o +src/auto_groupq.o qmail-getpw -qmail-remote.o -control.o -constmap.o -timeoutread.o -timeoutwrite.o -timeoutconn.o -tcpto.o -dns.o -ip.o -ipalloc.o -hassalen.h -ipme.o -ndelay.o -ndelay_off.o -ndelay.a +src/qmail-remote.o +src/control.o +src/constmap.o +src/timeoutread.o +src/timeoutwrite.o +src/timeoutconn.o +src/tcpto.o +src/dns.o +src/ip.o +src/ipalloc.o +include/hassalen.h +src/ipme.o +src/ndelay.o +src/ndelay_off.o +src/ndelay.a dns.lib qmail-remote -qmail-rspawn.o -tcpto_clean.o +src/qmail-rspawn.o +src/tcpto_clean.o qmail-rspawn -direntry.h -qmail-clean.o -fmtqfn.o +include/direntry.h +src/qmail-clean.o +src/fmtqfn.o auto_split.c -auto_split.o +src/auto_split.o qmail-clean -qmail-send.o -qsutil.o -newfield.o -prioq.o -hasmkffo.h -fifo.o -hasnpbg1.h -trigger.o -readsubdir.o -date822fmt.o +src/qmail-send.o +src/qsutil.o +src/newfield.o +src/prioq.o +include/hasmkffo.h +src/fifo.o +include/hasnpbg1.h +src/trigger.o +src/readsubdir.o +src/date822fmt.o qmail-send -qmail-start.o +src/qmail-start.o qmail-start -splogger.o +src/splogger.o syslog.lib splogger -qmail-queue.o -triggerpull.o +src/qmail-queue.o +src/triggerpull.o qmail-queue -qmail-inject.o -headerbody.o -hfield.o -token822.o +src/qmail-inject.o +src/headerbody.o +src/hfield.o +src/token822.o qmail-inject -predate.o +src/predate.o predate datemail mailsubj qmail-upq -qmail-showctl.o +src/qmail-showctl.o qmail-showctl -qmail-newu.o -cdbmss.o -cdbmake_pack.o -cdbmake_hash.o -cdbmake_add.o -cdbmake.a +src/qmail-newu.o +src/cdbmss.o +src/cdbmake_pack.o +src/cdbmake_hash.o +src/cdbmake_add.o +src/cdbmake.a qmail-newu -qmail-pw2u.o +src/qmail-pw2u.o qmail-pw2u -qmail-qread.o +src/qmail-qread.o qmail-qread qmail-qstat -qmail-tcpto.o +src/qmail-tcpto.o qmail-tcpto -qmail-tcpok.o +src/qmail-tcpok.o qmail-tcpok -qmail-pop3d.o -commands.o -maildir.o +src/qmail-pop3d.o +src/commands.o +src/maildir.o qmail-pop3d -qmail-popup.o +src/qmail-popup.o qmail-popup -qmail-qmqpc.o +src/qmail-qmqpc.o qmail-qmqpc -qmail-qmqpd.o -received.o +src/qmail-qmqpd.o +src/received.o qmail-qmqpd -qmail-qmtpd.o -rcpthosts.o +src/qmail-qmtpd.o +src/rcpthosts.o qmail-qmtpd -qmail-smtpd.o +src/qmail-smtpd.o qmail-smtpd -sendmail.o +src/sendmail.o sendmail -tcp-env.o -remoteinfo.o +src/tcp-env.o +src/remoteinfo.o tcp-env -qmail-newmrh.o +src/qmail-newmrh.o qmail-newmrh config config-fast -dnsdoe.o -dnsptr.o +src/dnsdoe.o +src/dnsptr.o dnsptr -dnsip.o +src/dnsip.o dnsip -dnsfq.o +src/dnsfq.o dnsfq -hostname.o +src/hostname.o hostname -ipmeprint.o +src/ipmeprint.o ipmeprint -qreceipt.o +src/qreceipt.o qreceipt -qbiff.o +src/qbiff.o qbiff -forward.o +src/forward.o forward -preline.o +src/preline.o preline -condredirect.o +src/condredirect.o condredirect -bouncesaying.o +src/bouncesaying.o bouncesaying -except.o +src/except.o except -maildirmake.o +src/maildirmake.o maildirmake -maildir2mbox.o +src/maildir2mbox.o maildir2mbox -hier.o +src/hier.o install -instcheck.o +src/instcheck.o instcheck -instchown.o +src/instchown.o instchown -instfiles.o -instpackage.o +src/instfiles.o +src/instpackage.o instpackage -instqueue.o +src/instqueue.o instqueue -instuidgid.o +src/instuidgid.o home home+df proc @@ -312,66 +312,66 @@ binm2 binm2+df binm3 binm3+df -qmail-local.0 -qmail-lspawn.0 -qmail-getpw.8 -qmail-getpw.0 -qmail-remote.0 -qmail-rspawn.0 -qmail-clean.0 -qmail-send.8 -qmail-send.0 -qmail-start.8 -qmail-start.0 -splogger.0 -qmail-queue.0 -qmail-inject.0 -mailsubj.0 -qmail-showctl.0 -qmail-newu.8 -qmail-newu.0 -qmail-pw2u.8 -qmail-pw2u.0 -qmail-qread.0 -qmail-qstat.0 -qmail-tcpto.0 -qmail-tcpok.0 -qmail-pop3d.0 -qmail-popup.0 -qmail-qmqpc.0 -qmail-qmqpd.0 -qmail-qmtpd.0 -qmail-smtpd.0 -tcp-env.0 -qmail-newmrh.8 -qmail-newmrh.0 -qreceipt.0 -qbiff.0 -forward.0 -preline.0 -condredirect.0 -bouncesaying.0 -except.0 -maildirmake.0 -maildir2mbox.0 -qmail.0 -qmail-limits.7 -qmail-limits.0 -qmail-log.0 -qmail-control.5 -qmail-control.0 -qmail-header.0 -qmail-users.5 -qmail-users.0 -dot-qmail.5 -dot-qmail.0 -qmail-command.0 -tcp-environ.0 -maildir.0 -mbox.0 -addresses.0 -envelopes.0 -forgeries.0 +doc/man/qmail-local.0 +doc/man/qmail-lspawn.0 +doc/man/qmail-getpw.8 +doc/man/qmail-getpw.0 +doc/man/qmail-remote.0 +doc/man/qmail-rspawn.0 +doc/man/qmail-clean.0 +doc/man/qmail-send.8 +doc/man/qmail-send.0 +doc/man/qmail-start.8 +doc/man/qmail-start.0 +doc/man/splogger.0 +doc/man/qmail-queue.0 +doc/man/qmail-inject.0 +doc/man/mailsubj.0 +doc/man/qmail-showctl.0 +doc/man/qmail-newu.8 +doc/man/qmail-newu.0 +doc/man/qmail-pw2u.8 +doc/man/qmail-pw2u.0 +doc/man/qmail-qread.0 +doc/man/qmail-qstat.0 +doc/man/qmail-tcpto.0 +doc/man/qmail-tcpok.0 +doc/man/qmail-pop3d.0 +doc/man/qmail-popup.0 +doc/man/qmail-qmqpc.0 +doc/man/qmail-qmqpd.0 +doc/man/qmail-qmtpd.0 +doc/man/qmail-smtpd.0 +doc/man/tcp-env.0 +doc/man/qmail-newmrh.8 +doc/man/qmail-newmrh.0 +doc/man/qreceipt.0 +doc/man/qbiff.0 +doc/man/forward.0 +doc/man/preline.0 +doc/man/condredirect.0 +doc/man/bouncesaying.0 +doc/man/except.0 +doc/man/maildirmake.0 +doc/man/maildir2mbox.0 +doc/man/qmail.0 +doc/man/qmail-limits.7 +doc/man/qmail-limits.0 +doc/man/qmail-log.0 +doc/man/qmail-control.5 +doc/man/qmail-control.0 +doc/man/qmail-header.0 +doc/man/qmail-users.5 +doc/man/qmail-users.0 +doc/man/dot-qmail.5 +doc/man/dot-qmail.0 +doc/man/qmail-command.0 +doc/man/tcp-environ.0 +doc/man/maildir.0 +doc/man/mbox.0 +doc/man/addresses.0 +doc/man/envelopes.0 +doc/man/forgeries.0 setup -qtmp.h +include/qtmp.h qmail-send.service diff --git a/chkbiofl.o b/chkbiofl.o Binary files differ. diff --git a/conf-cc b/conf-cc @@ -1,3 +1,3 @@ -cc -O2 +cc -O3 -Iinclude/ -Iinclude/fmxs This will be used to compile .c files. diff --git a/conf-ld b/conf-ld @@ -1,3 +1,3 @@ -cc -s +cc This will be used to link .o files into an executable. diff --git a/BLURB.md b/doc/BLURB.md diff --git a/BLURB2.md b/doc/BLURB2.md diff --git a/BLURB3.md b/doc/BLURB3.md diff --git a/BLURB4.md b/doc/BLURB4.md diff --git a/CHANGES.md b/doc/CHANGES.md diff --git a/FAQ.md b/doc/FAQ.md diff --git a/INSTALL.alias.md b/doc/INSTALL.alias.md diff --git a/INSTALL.ctl.md b/doc/INSTALL.ctl.md diff --git a/INSTALL.ids.md b/doc/INSTALL.ids.md diff --git a/INSTALL.maildir.md b/doc/INSTALL.maildir.md diff --git a/INSTALL.mbox.md b/doc/INSTALL.mbox.md diff --git a/INSTALL.md b/doc/INSTALL.md diff --git a/INSTALL.vsm.md b/doc/INSTALL.vsm.md diff --git a/INTERNALS.md b/doc/INTERNALS.md diff --git a/README.md b/doc/README.md diff --git a/REMOVE.binmail.md b/doc/REMOVE.binmail.md diff --git a/REMOVE.sendmail.md b/doc/REMOVE.sendmail.md diff --git a/SECURITY.md b/doc/SECURITY.md diff --git a/SENDMAIL.md b/doc/SENDMAIL.md diff --git a/TEST.deliver.md b/doc/TEST.deliver.md diff --git a/TEST.receive.md b/doc/TEST.receive.md diff --git a/THANKS.md b/doc/THANKS.md diff --git a/THOUGHTS.md b/doc/THOUGHTS.md diff --git a/UNITTESTS.md b/doc/UNITTESTS.md diff --git a/UPGRADE.md b/doc/UPGRADE.md diff --git a/VERSION.md b/doc/VERSION.md diff --git a/hier.c b/hier.c @@ -1,251 +0,0 @@ -#include "hier.h" - -#include <sys/types.h> -#include "auto_qmail.h" -#include "auto_split.h" -#include "auto_uids.h" -#include "fmt.h" -#include "fifo.h" - -char buf[100 + FMT_ULONG]; - -void dsplit(char *base, /* must be under 100 bytes */ - uid_t uid, int mode) -{ - char *x; - unsigned long i; - - d(auto_qmail,base,uid,auto_gidq,mode); - - for (i = 0;i < auto_split;++i) { - x = buf; - x += fmt_str(x,base); - x += fmt_str(x,"/"); - x += fmt_ulong(x,i); - *x = 0; - - d(auto_qmail,buf,uid,auto_gidq,mode); - } -} - -void hier_queue() -{ - d(auto_qmail,"queue",auto_uidq,auto_gidq,0750); - d(auto_qmail,"queue/pid",auto_uidq,auto_gidq,0700); - d(auto_qmail,"queue/intd",auto_uidq,auto_gidq,0700); - d(auto_qmail,"queue/todo",auto_uidq,auto_gidq,0750); - d(auto_qmail,"queue/bounce",auto_uids,auto_gidq,0700); - - dsplit("queue/mess",auto_uidq,0750); - dsplit("queue/info",auto_uids,0700); - dsplit("queue/local",auto_uids,0700); - dsplit("queue/remote",auto_uids,0700); - - d(auto_qmail,"queue/lock",auto_uidq,auto_gidq,0750); - z(auto_qmail,"queue/lock/tcpto",1024,auto_uidr,auto_gidq,0644); - z(auto_qmail,"queue/lock/sendmutex",0,auto_uids,auto_gidq,0600); - p(auto_qmail,"queue/lock/trigger",auto_uids,auto_gidq,0622); -} - -void hier() -{ - h(auto_qmail,auto_uido,auto_gidq,0755); - - d(auto_qmail,"control",auto_uido,auto_gidq,0755); - d(auto_qmail,"users",auto_uido,auto_gidq,0755); - d(auto_qmail,"bin",auto_uido,auto_gidq,0755); - d(auto_qmail,"boot",auto_uido,auto_gidq,0755); - d(auto_qmail,"doc",auto_uido,auto_gidq,0755); - d(auto_qmail,"man",auto_uido,auto_gidq,0755); - d(auto_qmail,"man/cat1",auto_uido,auto_gidq,0755); - d(auto_qmail,"man/cat5",auto_uido,auto_gidq,0755); - d(auto_qmail,"man/cat7",auto_uido,auto_gidq,0755); - d(auto_qmail,"man/cat8",auto_uido,auto_gidq,0755); - d(auto_qmail,"man/man1",auto_uido,auto_gidq,0755); - d(auto_qmail,"man/man5",auto_uido,auto_gidq,0755); - d(auto_qmail,"man/man7",auto_uido,auto_gidq,0755); - d(auto_qmail,"man/man8",auto_uido,auto_gidq,0755); - - d(auto_qmail,"alias",auto_uida,auto_gidq,02755); - - hier_queue(); - - c(auto_qmail,"boot","boot","home",auto_uido,auto_gidq,0755); - c(auto_qmail,"boot","boot","home+df",auto_uido,auto_gidq,0755); - c(auto_qmail,"boot","boot","proc",auto_uido,auto_gidq,0755); - c(auto_qmail,"boot","boot","proc+df",auto_uido,auto_gidq,0755); - c(auto_qmail,"boot","boot","binm1",auto_uido,auto_gidq,0755); - c(auto_qmail,"boot","boot","binm1+df",auto_uido,auto_gidq,0755); - c(auto_qmail,"boot","boot","binm2",auto_uido,auto_gidq,0755); - c(auto_qmail,"boot","boot","binm2+df",auto_uido,auto_gidq,0755); - c(auto_qmail,"boot","boot","binm3",auto_uido,auto_gidq,0755); - c(auto_qmail,"boot","boot","binm3+df",auto_uido,auto_gidq,0755); - - c(auto_qmail,"doc","doc","FAQ.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","UPGRADE.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","SENDMAIL.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","INSTALL.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","INSTALL.alias.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","INSTALL.ctl.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","INSTALL.ids.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","INSTALL.maildir.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","INSTALL.mbox.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","INSTALL.vsm.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","TEST.deliver.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","TEST.receive.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","REMOVE.sendmail.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","REMOVE.binmail.md",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","PIC.local2alias",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","PIC.local2ext",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","PIC.local2local",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","PIC.local2rem",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","PIC.local2virt",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","PIC.nullclient",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","PIC.relaybad",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","PIC.relaygood",auto_uido,auto_gidq,0644); - c(auto_qmail,"doc","doc","PIC.rem2local",auto_uido,auto_gidq,0644); - - c(auto_qmail,"bin","src","qmail-queue",auto_uidq,auto_gidq,04711); - c(auto_qmail,"bin","src","qmail-lspawn",auto_uido,auto_gidq,0700); - c(auto_qmail,"bin","src","qmail-start",auto_uido,auto_gidq,0700); - c(auto_qmail,"bin","src","qmail-getpw",auto_uido,auto_gidq,0711); - c(auto_qmail,"bin","src","qmail-local",auto_uido,auto_gidq,0711); - c(auto_qmail,"bin","src","qmail-remote",auto_uido,auto_gidq,0711); - c(auto_qmail,"bin","src","qmail-rspawn",auto_uido,auto_gidq,0711); - c(auto_qmail,"bin","src","qmail-clean",auto_uido,auto_gidq,0711); - c(auto_qmail,"bin","src","qmail-send",auto_uido,auto_gidq,0711); - c(auto_qmail,"bin","src","splogger",auto_uido,auto_gidq,0711); - c(auto_qmail,"bin","src","qmail-newu",auto_uido,auto_gidq,0700); - c(auto_qmail,"bin","src","qmail-newmrh",auto_uido,auto_gidq,0700); - c(auto_qmail,"bin","src","qmail-pw2u",auto_uido,auto_gidq,0711); - c(auto_qmail,"bin","src","qmail-inject",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","predate",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","datemail",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","mailsubj",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qmail-showctl",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qmail-qread",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qmail-qstat",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qmail-tcpto",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qmail-tcpok",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qmail-pop3d",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qmail-popup",auto_uido,auto_gidq,0711); - c(auto_qmail,"bin","src","qmail-qmqpc",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qmail-qmqpd",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qmail-qmtpd",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qmail-smtpd",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","sendmail",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","tcp-env",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qreceipt",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","qbiff",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","forward",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","preline",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","condredirect",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","bouncesaying",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","except",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","maildirmake",auto_uido,auto_gidq,0755); - c(auto_qmail,"bin","src","maildir2mbox",auto_uido,auto_gidq,0755); - - c(auto_qmail,"man/man5","doc/man","addresses.5",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat5","doc/man","addresses.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man5","doc/man","envelopes.5",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat5","doc/man","envelopes.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man5","doc/man","maildir.5",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat5","doc/man","maildir.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man5","doc/man","mbox.5",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat5","doc/man","mbox.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man5","doc/man","dot-qmail.5",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat5","doc/man","dot-qmail.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man5","doc/man","qmail-control.5",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat5","doc/man","qmail-control.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man5","doc/man","qmail-header.5",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat5","doc/man","qmail-header.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man5","doc/man","qmail-log.5",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat5","doc/man","qmail-log.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man5","doc/man","qmail-users.5",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat5","doc/man","qmail-users.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man5","doc/man","tcp-environ.5",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat5","doc/man","tcp-environ.0",auto_uido,auto_gidq,0644); - - c(auto_qmail,"man/man7","doc/man","forgeries.7",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat7","doc/man","forgeries.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man7","doc/man","qmail-limits.7",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat7","doc/man","qmail-limits.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man7","doc/man","qmail.7",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat7","doc/man","qmail.0",auto_uido,auto_gidq,0644); - - c(auto_qmail,"man/man1","doc/man","forward.1",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat1","doc/man","forward.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man1","doc/man","condredirect.1",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat1","doc/man","condredirect.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man1","doc/man","bouncesaying.1",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat1","doc/man","bouncesaying.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man1","doc/man","except.1",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat1","doc/man","except.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man1","doc/man","maildirmake.1",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat1","doc/man","maildirmake.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man1","doc/man","maildir2mbox.1",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat1","doc/man","maildir2mbox.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man1","doc/man","mailsubj.1",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat1","doc/man","mailsubj.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man1","doc/man","qreceipt.1",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat1","doc/man","qreceipt.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man1","doc/man","qbiff.1",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat1","doc/man","qbiff.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man1","doc/man","preline.1",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat1","doc/man","preline.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man1","doc/man","tcp-env.1",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat1","doc/man","tcp-env.0",auto_uido,auto_gidq,0644); - - c(auto_qmail,"man/man8","doc/man","qmail-local.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-local.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-lspawn.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-lspawn.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-getpw.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-getpw.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-remote.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-remote.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-rspawn.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-rspawn.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-clean.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-clean.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-send.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-send.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-start.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-start.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","splogger.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","splogger.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-queue.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-queue.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-inject.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-inject.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-showctl.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-showctl.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-newmrh.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-newmrh.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-newu.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-newu.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-pw2u.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-pw2u.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-qread.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-qread.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-qstat.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-qstat.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-tcpok.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-tcpok.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-tcpto.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-tcpto.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-pop3d.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-pop3d.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-popup.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-popup.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-qmqpc.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-qmqpc.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-qmqpd.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-qmqpd.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-qmtpd.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-qmtpd.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-smtpd.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-smtpd.0",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/man8","doc/man","qmail-command.8",auto_uido,auto_gidq,0644); - c(auto_qmail,"man/cat8","doc/man","qmail-command.0",auto_uido,auto_gidq,0644); -} diff --git a/alloc.h b/include/alloc.h diff --git a/auto_break.h b/include/auto_break.h diff --git a/auto_patrn.h b/include/auto_patrn.h diff --git a/auto_qmail.h b/include/auto_qmail.h diff --git a/auto_spawn.h b/include/auto_spawn.h diff --git a/auto_split.h b/include/auto_split.h diff --git a/auto_uids.h b/include/auto_uids.h diff --git a/auto_users.h b/include/auto_users.h diff --git a/byte.h b/include/byte.h diff --git a/case.h b/include/case.h diff --git a/cdb.h b/include/cdb.h diff --git a/cdbmake.h b/include/cdbmake.h diff --git a/cdbmss.h b/include/cdbmss.h diff --git a/coe.h b/include/coe.h diff --git a/commands.h b/include/commands.h diff --git a/constmap.h b/include/constmap.h diff --git a/control.h b/include/control.h diff --git a/date822fmt.h b/include/date822fmt.h diff --git a/datetime.h b/include/datetime.h diff --git a/deprecated.h b/include/deprecated.h diff --git a/direntry.h1 b/include/direntry.h1 diff --git a/direntry.h2 b/include/direntry.h2 diff --git a/dns.h b/include/dns.h diff --git a/dnsdoe.h b/include/dnsdoe.h diff --git a/env.h b/include/env.h diff --git a/error.h b/include/error.h diff --git a/exit.h b/include/exit.h diff --git a/extra.h b/include/extra.h diff --git a/fd.h b/include/fd.h diff --git a/fifo.h b/include/fifo.h diff --git a/fmt.h b/include/fmt.h diff --git a/fmtqfn.h b/include/fmtqfn.h diff --git a/fork.h b/include/fork.h diff --git a/gen_alloc.h b/include/gen_alloc.h diff --git a/gen_allocdefs.h b/include/gen_allocdefs.h diff --git a/getln.h b/include/getln.h diff --git a/gfrom.h b/include/gfrom.h diff --git a/headerbody.h b/include/headerbody.h diff --git a/hfield.h b/include/hfield.h diff --git a/hier.h b/include/hier.h diff --git a/ip.h b/include/ip.h diff --git a/ipalloc.h b/include/ipalloc.h diff --git a/ipme.h b/include/ipme.h diff --git a/lock.h b/include/lock.h diff --git a/maildir.h b/include/maildir.h diff --git a/myctime.h b/include/myctime.h diff --git a/ndelay.h b/include/ndelay.h diff --git a/newfield.h b/include/newfield.h diff --git a/noreturn.h b/include/noreturn.h diff --git a/now.h b/include/now.h diff --git a/oflops_bi.h b/include/oflops_bi.h diff --git a/oflops_compat.h b/include/oflops_compat.h diff --git a/open.h b/include/open.h diff --git a/prioq.h b/include/prioq.h diff --git a/prot.h b/include/prot.h diff --git a/qlx.h b/include/qlx.h diff --git a/include/qmail.h b/include/qmail.h @@ -0,0 +1,34 @@ +#ifndef QMAIL_H +#define QMAIL_H + +#include "substdio.h" + +#include <string.h> + +struct qmail { + int flagerr; + unsigned long pid; + int fdm; + int fde; + int fderr; + substdio ss; + char buf[1024]; +} ; + +extern int qmail_open(); +extern void qmail_put(); +#define qmail_puts(qq,s) qmail_put(qq,s,strlen(s)) +extern void qmail_from(); +extern void qmail_to(); +extern void qmail_fail(); +extern char *qmail_close(); +extern unsigned long qmail_qp(); + +#define GEN_QMAILPUT_WRITE(qq) \ +ssize_t qmail_put_write(int fd, const void *buf, size_t len) \ +{ \ + qmail_put(qq,buf,len); \ + return len; \ +} + +#endif diff --git a/include/qsutil.h b/include/qsutil.h @@ -0,0 +1,22 @@ +#ifndef QSUTIL_H +#define QSUTIL_H + +#include "deprecated.h" + +extern void log1(); +extern void qslog2(char *, char *); + +#ifdef DEPRECATED_FUNCTIONS_AVAILABLE +static inline void _deprecated_ log2(char *s1, char *s2) +{ + qslog2(s1,s2); +} +#endif + +extern void log3(); +extern void logsa(); +extern void nomem(); +extern void pausedir(); +extern void logsafe(); + +#endif diff --git a/include/qtmp.h1 b/include/qtmp.h1 @@ -0,0 +1,26 @@ +#ifndef QTMP_H +#define QTMP_H + +#include <utmp.h> +#ifndef UTMP_FILE +#ifdef _PATH_UTMP +#define UTMP_FILE _PATH_UTMP +#else +#define UTMP_FILE "/etc/utmp" +#endif +#endif +#define UTMP_INIT \ + struct utmp utm; \ + struct utmp *ut = &utm; \ + substdio ssutmp; \ + char bufutmp[sizeof(struct utmp) * 16]; \ + int fdutmp +#define UTMP_USER ut_name +#define UTMP_OPEN \ + fdutmp = open_read(UTMP_FILE); \ + if (fdutmp == -1) _exit(0); \ + substdio_fdbuf(&ssutmp,read,fdutmp,bufutmp,sizeof(bufutmp)) +#define UTMP_READ_MORE (substdio_get(&ssutmp,ut,sizeof(utm)) == sizeof(utm)) +#define UTMP_TYPE_MATCHES 1 + +#endif diff --git a/include/qtmp.h2 b/include/qtmp.h2 @@ -0,0 +1,11 @@ +#ifndef QTMP_H +#define QTMP_H + +#include <utmpx.h> +#define UTMP_INIT struct utmpx *ut +#define UTMP_USER ut_user +#define UTMP_OPEN +#define UTMP_READ_MORE (ut = getutxent()) +#define UTMP_TYPE_MATCHES (ut->ut_type == USER_PROCESS) + +#endif diff --git a/include/quote.h b/include/quote.h @@ -0,0 +1,8 @@ +#ifndef QUOTE_H +#define QUOTE_H + +extern int quote_need(); +extern int quote(); +extern int quote2(); + +#endif diff --git a/include/rcpthosts.h b/include/rcpthosts.h @@ -0,0 +1,7 @@ +#ifndef RCPTHOSTS_H +#define RCPTHOSTS_H + +extern int rcpthosts_init(); +extern int rcpthosts(); + +#endif diff --git a/include/readsubdir.h b/include/readsubdir.h @@ -0,0 +1,20 @@ +#ifndef READSUBDIR_H +#define READSUBDIR_H + +#include "direntry.h" + +typedef struct readsubdir + { + DIR *dir; + int pos; + char *name; + void (*pause)(); + } +readsubdir; + +extern void readsubdir_init(); +extern int readsubdir_next(); + +#define READSUBDIR_NAMELEN 10 + +#endif diff --git a/include/readwrite.h b/include/readwrite.h @@ -0,0 +1,6 @@ +#ifndef READWRITE_H +#define READWRITE_H + +#include <unistd.h> + +#endif diff --git a/include/received.h b/include/received.h @@ -0,0 +1,6 @@ +#ifndef RECEIVED_H +#define RECEIVED_H + +extern void received(); + +#endif diff --git a/include/remoteinfo.h b/include/remoteinfo.h @@ -0,0 +1,6 @@ +#ifndef REMOTEINFO_H +#define REMOTEINFO_H + +extern char *remoteinfo_get(); + +#endif diff --git a/include/scan.h b/include/scan.h @@ -0,0 +1,7 @@ +#ifndef SCAN_H +#define SCAN_H + +extern unsigned int scan_ulong(char *, unsigned long *); +extern unsigned int scan_8long(char *, unsigned long *); + +#endif diff --git a/include/seek.h b/include/seek.h @@ -0,0 +1,29 @@ +#ifndef SEEK_H +#define SEEK_H + +#include <sys/types.h> +#include <unistd.h> + +typedef off_t seek_pos; + +#define seek_cur(fd) (lseek((fd), 0, SEEK_CUR)) + +static inline int seek_set(int fd, seek_pos pos) +{ + if (lseek(fd, pos, SEEK_SET) == -1) + return -1; + return 0; +} + + +static inline int seek_end(int fd) +{ + if (lseek(fd, 0, SEEK_END) == -1) + return -1; + return 0; +} + +#define seek_trunc(fd, pos) (ftruncate((fd),(pos))) +#define seek_begin(fd) (seek_set((fd),(seek_pos) 0)) + +#endif diff --git a/include/select.h1 b/include/select.h1 @@ -0,0 +1,8 @@ +#ifndef SELECT_H +#define SELECT_H + +#include <sys/types.h> +#include <sys/time.h> +extern int select(); + +#endif diff --git a/include/select.h2 b/include/select.h2 @@ -0,0 +1,8 @@ +#ifndef SELECT_H +#define SELECT_H + +#include <sys/types.h> +#include <sys/time.h> +#include <sys/select.h> + +#endif diff --git a/include/sgetopt.h b/include/sgetopt.h @@ -0,0 +1,21 @@ +#ifndef SGETOPT_H +#define SGETOPT_H + +#ifndef SGETOPTNOSHORT +#define getopt sgetoptmine +#define optarg subgetoptarg +#define optind subgetoptind +#define optpos subgetoptpos +#define opterr sgetopterr +#define optproblem subgetoptproblem +#define optprogname sgetoptprogname +#define opteof subgetoptdone +#endif + +#include "subgetopt.h" + +extern int sgetoptmine(); +extern int sgetopterr; +extern char *sgetoptprogname; + +#endif diff --git a/include/sig.h b/include/sig.h @@ -0,0 +1,43 @@ +#ifndef SIG_H +#define SIG_H + +extern void sig_catch(); +extern void sig_block(); +extern void sig_unblock(); +extern void sig_blocknone(); +extern void sig_pause(); + +extern void sig_dfl(); + +extern void sig_miscignore(); +extern void sig_bugcatch(); + +extern void sig_pipeignore(); +extern void sig_pipedefault(); + +extern void sig_contblock(); +extern void sig_contunblock(); +extern void sig_contcatch(); +extern void sig_contdefault(); + +extern void sig_termblock(); +extern void sig_termunblock(); +extern void sig_termcatch(); +extern void sig_termdefault(); + +extern void sig_alarmblock(); +extern void sig_alarmunblock(); +extern void sig_alarmcatch(); +extern void sig_alarmdefault(); + +extern void sig_childblock(); +extern void sig_childunblock(); +extern void sig_childcatch(); +extern void sig_childdefault(); + +extern void sig_hangupblock(); +extern void sig_hangupunblock(); +extern void sig_hangupcatch(); +extern void sig_hangupdefault(); + +#endif diff --git a/include/slurpclose.h b/include/slurpclose.h @@ -0,0 +1,6 @@ +#ifndef SLURPCLOSE_H +#define SLURPCLOSE_H + +extern int slurpclose(); + +#endif diff --git a/include/spawn.h b/include/spawn.h @@ -0,0 +1,11 @@ +#ifndef SPAWN_H +#define SPAWN_H + +#include "substdio.h" + +extern int truncreport; +extern int spawn(int fdmess, int fdout, char *s, char *r, int at); +extern void report(substdio *ss, int wstat, char *s, int len); +extern void initialize(int argc, char **argv); + +#endif diff --git a/include/str.h b/include/str.h @@ -0,0 +1,16 @@ +#ifndef STR_H +#define STR_H + +#include <string.h> + +#define str_copy(s,t) strcpy((s),(t)) +#define str_diff(s,t) strcmp((s),(t)) +#define str_diffn(s,t,len) strncmp((s),(t),(len)) +#define str_len(s) strlen((s)) +extern unsigned int str_chr(); +extern unsigned int str_rchr(); +extern int str_start(); + +#define str_equal(s,t) (strcmp((s),(t)) == 0) + +#endif diff --git a/include/stralloc.h b/include/stralloc.h @@ -0,0 +1,21 @@ +#ifndef STRALLOC_H +#define STRALLOC_H + +#include "gen_alloc.h" + +GEN_ALLOC_typedef(stralloc,char,s,len,a) + +extern int stralloc_ready(); +extern int stralloc_readyplus(); +extern int stralloc_copy(); +extern int stralloc_cat(); +extern int stralloc_copys(); +extern int stralloc_cats(); +extern int stralloc_copyb(); +extern int stralloc_catb(); +extern int stralloc_append(); /* beware: this takes a pointer to 1 char */ +extern int stralloc_starts(); + +#define stralloc_0(sa) stralloc_append(sa,"") + +#endif diff --git a/include/strerr.h b/include/strerr.h @@ -0,0 +1,82 @@ +#ifndef STRERR_H +#define STRERR_H + +#include "noreturn.h" + +struct strerr + { + struct strerr *who; + char *x; + char *y; + char *z; + } +; + +extern struct strerr strerr_sys; +extern void strerr_sysinit(); + +extern char *strerr(); +extern void strerr_warn(); +extern void _noreturn_ strerr_die(); + +#define STRERR(r,se,a) \ +{ se.who = 0; se.x = a; se.y = 0; se.z = 0; return r; } + +#define STRERR_SYS(r,se,a) \ +{ se.who = &strerr_sys; se.x = a; se.y = 0; se.z = 0; return r; } +#define STRERR_SYS3(r,se,a,b,c) \ +{ se.who = &strerr_sys; se.x = a; se.y = b; se.z = c; return r; } + +#define strerr_warn6(x1,x2,x3,x4,x5,x6,se) \ +strerr_warn((x1),(x2),(x3),(x4),(x5),(x6),(struct strerr *) (se)) +#define strerr_warn5(x1,x2,x3,x4,x5,se) \ +strerr_warn((x1),(x2),(x3),(x4),(x5),NULL,(struct strerr *) (se)) +#define strerr_warn4(x1,x2,x3,x4,se) \ +strerr_warn((x1),(x2),(x3),(x4),NULL,NULL,(struct strerr *) (se)) +#define strerr_warn3(x1,x2,x3,se) \ +strerr_warn((x1),(x2),(x3),NULL,NULL,NULL,(struct strerr *) (se)) +#define strerr_warn2(x1,x2,se) \ +strerr_warn((x1),(x2),NULL,NULL,NULL,NULL,(struct strerr *) (se)) +#define strerr_warn1(x1,se) \ +strerr_warn((x1),NULL,NULL,NULL,NULL,NULL,(struct strerr *) (se)) + +#define strerr_die6(e,x1,x2,x3,x4,x5,x6,se) \ +strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),(struct strerr *) (se)) +#define strerr_die5(e,x1,x2,x3,x4,x5,se) \ +strerr_die((e),(x1),(x2),(x3),(x4),(x5),NULL,(struct strerr *) (se)) +#define strerr_die4(e,x1,x2,x3,x4,se) \ +strerr_die((e),(x1),(x2),(x3),(x4),NULL,NULL,(struct strerr *) (se)) +#define strerr_die3(e,x1,x2,x3,se) \ +strerr_die((e),(x1),(x2),(x3),NULL,NULL,NULL,(struct strerr *) (se)) +#define strerr_die2(e,x1,x2,se) \ +strerr_die((e),(x1),(x2),NULL,NULL,NULL,NULL,(struct strerr *) (se)) +#define strerr_die1(e,x1,se) \ +strerr_die((e),(x1),NULL,NULL,NULL,NULL,NULL,(struct strerr *) (se)) + +#define strerr_die6sys(e,x1,x2,x3,x4,x5,x6) \ +strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),&strerr_sys) +#define strerr_die5sys(e,x1,x2,x3,x4,x5) \ +strerr_die((e),(x1),(x2),(x3),(x4),(x5),NULL,&strerr_sys) +#define strerr_die4sys(e,x1,x2,x3,x4) \ +strerr_die((e),(x1),(x2),(x3),(x4),NULL,NULL,&strerr_sys) +#define strerr_die3sys(e,x1,x2,x3) \ +strerr_die((e),(x1),(x2),(x3),NULL,NULL,NULL,&strerr_sys) +#define strerr_die2sys(e,x1,x2) \ +strerr_die((e),(x1),(x2),NULL,NULL,NULL,NULL,&strerr_sys) +#define strerr_die1sys(e,x1) \ +strerr_die((e),(x1),NULL,NULL,NULL,NULL,NULL,&strerr_sys) + +#define strerr_die6x(e,x1,x2,x3,x4,x5,x6) \ +strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),NULL) +#define strerr_die5x(e,x1,x2,x3,x4,x5) \ +strerr_die((e),(x1),(x2),(x3),(x4),(x5),NULL,NULL) +#define strerr_die4x(e,x1,x2,x3,x4) \ +strerr_die((e),(x1),(x2),(x3),(x4),NULL,NULL,NULL) +#define strerr_die3x(e,x1,x2,x3) \ +strerr_die((e),(x1),(x2),(x3),NULL,NULL,NULL,NULL) +#define strerr_die2x(e,x1,x2) \ +strerr_die((e),(x1),(x2),NULL,NULL,NULL,NULL,NULL) +#define strerr_die1x(e,x1) \ +strerr_die((e),(x1),NULL,NULL,NULL,NULL,NULL,NULL) + +#endif diff --git a/include/subfd.h b/include/subfd.h @@ -0,0 +1,15 @@ +#ifndef SUBFD_H +#define SUBFD_H + +#include "substdio.h" + +extern substdio *subfdin; +extern substdio *subfdinsmall; +extern substdio *subfdout; +extern substdio *subfdoutsmall; +extern substdio *subfderr; + +extern ssize_t subfd_read(int fd, void *buf, size_t len); +extern ssize_t subfd_readsmall(int fd, void *buf, size_t len); + +#endif diff --git a/include/subgetopt.h b/include/subgetopt.h @@ -0,0 +1,24 @@ +#ifndef SUBGETOPT_H +#define SUBGETOPT_H + +#ifndef SUBGETOPTNOSHORT +#define sgopt subgetopt +#define sgoptarg subgetoptarg +#define sgoptind subgetoptind +#define sgoptpos subgetoptpos +#define sgoptproblem subgetoptproblem +#define sgoptprogname subgetoptprogname +#define sgoptdone subgetoptdone +#endif + +#define SUBGETOPTDONE -1 + +extern int subgetopt(); +extern char *subgetoptarg; +extern int subgetoptind; +extern int subgetoptpos; +extern int subgetoptproblem; +extern char *subgetoptprogname; +extern int subgetoptdone; + +#endif diff --git a/include/substdio.h b/include/substdio.h @@ -0,0 +1,53 @@ +#ifndef SUBSTDIO_H +#define SUBSTDIO_H + +#include <sys/types.h> + +#include "deprecated.h" + +typedef struct substdio { + char *x; + int p; + int n; + int fd; + ssize_t (*op)(); +} substdio; + +#define SUBSTDIO_FDBUF(o,f,buf,len) { (buf), 0, (len), (f), (o) } + +extern void substdio_fdbuf(substdio *s, ssize_t (*op)(), int fd, char *buf, int len); + +extern int substdio_flush(); +extern int substdio_put(substdio *s, char *buf, size_t len); +extern int substdio_bput(substdio *s, char *buf, size_t len); +extern int substdio_putflush(substdio *s, char *buf, size_t len); +extern int substdio_puts(); +extern int substdio_bputs(); +extern int substdio_putsflush(); + +extern ssize_t substdio_get(substdio *s, char *buf, size_t len); +#ifdef DEPRECATED_FUNCTIONS_AVAILABLE +extern ssize_t substdio_bget(substdio *s, char *buf, size_t len); +#endif +extern ssize_t substdio_feed(substdio *s); + +extern char *substdio_peek(); +extern void substdio_seek(); + +#define substdio_fileno(s) ((s)->fd) + +#define SUBSTDIO_INSIZE 8192 +#define SUBSTDIO_OUTSIZE 8192 + +#define substdio_PEEK(s) ( (s)->x + (s)->n ) +#define substdio_SEEK(s,len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) ) + +#define substdio_BPUTC(s,c) \ + ( ((s)->n != (s)->p) \ + ? ( (s)->x[(s)->p++] = (c), 0 ) \ + : substdio_bput((s),&(c),1) \ + ) + +extern int substdio_copy(); + +#endif diff --git a/include/tcpto.h b/include/tcpto.h @@ -0,0 +1,8 @@ +#ifndef TCPTO_H +#define TCPTO_H + +extern int tcpto(); +extern void tcpto_err(); +extern void tcpto_clean(); + +#endif diff --git a/include/timeoutconn.h b/include/timeoutconn.h @@ -0,0 +1,6 @@ +#ifndef TIMEOUTCONN_H +#define TIMEOUTCONN_H + +extern int timeoutconn(); + +#endif diff --git a/include/timeoutread.h b/include/timeoutread.h @@ -0,0 +1,17 @@ +#ifndef TIMEOUTREAD_H +#define TIMEOUTREAD_H + +#include <sys/types.h> + +extern ssize_t timeoutread(int t, int fd, char *buf, size_t len); + +#define GEN_SAFE_TIMEOUTREAD(funcname,tout,readfd,doexit) \ +ssize_t funcname(int fd, void *buf, size_t len) \ +{ \ + ssize_t r; \ + r = timeoutread(tout,readfd,buf,len); \ + if (r == 0 || r == -1) doexit; \ + return r; \ +} + +#endif diff --git a/include/timeoutwrite.h b/include/timeoutwrite.h @@ -0,0 +1,17 @@ +#ifndef TIMEOUTWRITE_H +#define TIMEOUTWRITE_H + +#include <sys/types.h> + +extern ssize_t timeoutwrite(int t, int fd, const void *buf, size_t len); + +#define GEN_SAFE_TIMEOUTWRITE(funcname,tout,writefd,doexit) \ +ssize_t funcname(int fd, const void *buf, size_t len) \ +{ \ + ssize_t r; \ + r = timeoutwrite(tout,writefd,buf,len); \ + if (r == 0 || r == -1) doexit; \ + return r; \ +} + +#endif diff --git a/include/token822.h b/include/token822.h @@ -0,0 +1,37 @@ +#ifndef TOKEN822_H +#define TOKEN822_H + +struct token822 + { + int type; + char *s; + int slen; + } +; + +#include "gen_alloc.h" +GEN_ALLOC_typedef(token822_alloc,struct token822,t,len,a) + +extern int token822_parse(); +extern int token822_addrlist(); +extern int token822_unquote(); +extern int token822_unparse(); +extern void token822_free(); +extern void token822_reverse(); +extern int token822_ready(); +extern int token822_readyplus(); +extern int token822_append(); + +#define TOKEN822_ATOM 1 +#define TOKEN822_QUOTE 2 +#define TOKEN822_LITERAL 3 +#define TOKEN822_COMMENT 4 +#define TOKEN822_LEFT 5 +#define TOKEN822_RIGHT 6 +#define TOKEN822_AT 7 +#define TOKEN822_COMMA 8 +#define TOKEN822_SEMI 9 +#define TOKEN822_COLON 10 +#define TOKEN822_DOT 11 + +#endif diff --git a/include/trigger.h b/include/trigger.h @@ -0,0 +1,8 @@ +#ifndef TRIGGER_H +#define TRIGGER_H + +extern void trigger_set(); +extern void trigger_selprep(); +extern int trigger_pulled(); + +#endif diff --git a/include/triggerpull.h b/include/triggerpull.h @@ -0,0 +1,6 @@ +#ifndef TRIGGERPULL_H +#define TRIGGERPULL_H + +extern void triggerpull(); + +#endif diff --git a/include/uidgid.h b/include/uidgid.h @@ -0,0 +1,9 @@ +#ifndef UIDGID_H +#define UIDGID_H + +#include <sys/types.h> + +extern uid_t inituid(char *uid); +extern gid_t initgid(char *gid); + +#endif diff --git a/include/uint32.h b/include/uint32.h @@ -0,0 +1,8 @@ +#ifndef UINT32_H +#define UINT32_H + +#include <stdint.h> + +typedef uint32_t uint32; + +#endif diff --git a/include/wait.h b/include/wait.h @@ -0,0 +1,14 @@ +#ifndef WAIT_H +#define WAIT_H + +extern int wait_pid(); +extern int wait_nohang(); +extern int wait_stop(); +extern int wait_stopnohang(); + +#define wait_crashed(w) ((w) & 127) +#define wait_exitcode(w) ((w) >> 8) +#define wait_stopsig(w) ((w) >> 8) +#define wait_stopped(w) (((w) & 127) == 127) + +#endif diff --git a/make-compile.sh b/make-compile.sh @@ -1 +1 @@ -echo exec "$CC" -c '${1+"$@"}' +echo exec "$CC" -o '"${1%.?}.o"' -c '${1+"$@"}' diff --git a/make-load.sh b/make-load.sh @@ -1,2 +1,2 @@ echo 'main="$1"; shift' -echo exec "$LD" '-o "$main" "$main".o ${1+"$@"}' +echo exec "$LD" '-o "$main" "src/$main".o ${1+"$@"}' diff --git a/qmail.c b/qmail.c @@ -1,158 +0,0 @@ -#include "qmail.h" - -#include "substdio.h" -#include "readwrite.h" -#include "wait.h" -#include "exit.h" -#include "fork.h" -#include "fd.h" -#include "auto_qmail.h" -#include "env.h" - -static char *binqqargs[2] = { 0, 0 } ; - -static void setup_qqargs() -{ - if(!binqqargs[0]) - binqqargs[0] = env_get("QMAILQUEUE"); - if(!binqqargs[0]) - binqqargs[0] = "bin/qmail-queue"; -} - -int qmail_open(qq) -struct qmail *qq; -{ - int pim[2]; - int pie[2]; - int pierr[2]; - - setup_qqargs(); - - if (pipe(pim) == -1) return -1; - if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; } - if (pipe(pierr) == -1) { - close(pim[0]); close(pim[1]); - close(pie[0]); close(pie[1]); - return -1; - } - - switch(qq->pid = fork()) { - case -1: - close(pim[0]); close(pim[1]); - close(pie[0]); close(pie[1]); - close(pierr[0]); close(pierr[1]); - return -1; - case 0: - close(pim[1]); - close(pie[1]); - close(pierr[0]); /* we want to receive data */ - if (fd_move(0,pim[0]) == -1) _exit(120); - if (fd_move(1,pie[0]) == -1) _exit(120); - if (fd_move(6,pierr[1]) == -1) _exit(120); - if (chdir(auto_qmail) == -1) _exit(61); - execv(*binqqargs,binqqargs); - _exit(120); - } - - qq->fdm = pim[1]; close(pim[0]); - qq->fde = pie[1]; close(pie[0]); - qq->fderr = pierr[0]; close(pierr[1]); - substdio_fdbuf(&qq->ss,write,qq->fdm,qq->buf,sizeof(qq->buf)); - qq->flagerr = 0; - return 0; -} - -unsigned long qmail_qp(qq) struct qmail *qq; -{ - return qq->pid; -} - -void qmail_fail(qq) struct qmail *qq; -{ - qq->flagerr = 1; -} - -void qmail_put(struct qmail *qq, char *s, size_t len) -{ - if (!qq->flagerr) if (substdio_put(&qq->ss,s,len) == -1) qq->flagerr = 1; -} - -void qmail_from(qq,s) struct qmail *qq; char *s; -{ - if (substdio_flush(&qq->ss) == -1) qq->flagerr = 1; - close(qq->fdm); - substdio_fdbuf(&qq->ss,write,qq->fde,qq->buf,sizeof(qq->buf)); - qmail_put(qq,"F",1); - qmail_puts(qq,s); - qmail_put(qq,"",1); -} - -void qmail_to(qq,s) struct qmail *qq; char *s; -{ - qmail_put(qq,"T",1); - qmail_puts(qq,s); - qmail_put(qq,"",1); -} - -static size_t qmail_errstr(struct qmail *qq, char *s) { - size_t len = 0; - substdio_fdbuf(&qq->ss,read,qq->fderr,qq->buf,sizeof(qq->buf)); - while (substdio_get(&qq->ss,s+len,1) > 0 && len < 255) { - len++; - } - s[len] = '\0'; - return len; -} - -char *qmail_close(qq) -struct qmail *qq; -{ - int wstat; - int exitcode; - static char errstr[256]; - size_t errlen; - - qmail_put(qq,"",1); - if (!qq->flagerr) if (substdio_flush(&qq->ss) == -1) qq->flagerr = 1; - close(qq->fde); - errlen = qmail_errstr(qq, errstr); - close(qq->fderr); - - if (wait_pid(&wstat,qq->pid) != qq->pid) - return "Zqq waitpid surprise (#4.3.0)"; - if (wait_crashed(wstat)) - return "Zqq crashed (#4.3.0)"; - exitcode = wait_exitcode(wstat); - - switch(exitcode) { - case 115: /* compatibility */ - case 11: return "Denvelope address too long for qq (#5.1.3)"; - case 31: return "Dmail server permanently rejected message (#5.3.0)"; - case 51: return "Zqq out of memory (#4.3.0)"; - case 52: return "Zqq timeout (#4.3.0)"; - case 53: return "Zqq write error or disk full (#4.3.0)"; - case 0: if (!qq->flagerr) return ""; /* fall through */ - case 54: return "Zqq read error (#4.3.0)"; - case 55: return "Zqq unable to read configuration (#4.3.0)"; - case 56: return "Zqq trouble making network connection (#4.3.0)"; - case 61: return "Zqq trouble in home directory (#4.3.0)"; - case 63: - case 64: - case 65: - case 66: - case 62: return "Zqq trouble creating files in queue (#4.3.0)"; - case 71: return "Zmail server temporarily rejected message (#4.3.0)"; - case 72: return "Zconnection to mail server timed out (#4.4.1)"; - case 73: return "Zconnection to mail server rejected (#4.4.1)"; - case 74: return "Zcommunication with mail server failed (#4.4.2)"; - case 91: /* fall through */ - case 81: return "Zqq internal bug (#4.3.0)"; - case 120: return "Zunable to exec qq (#4.3.0)"; - default: - if (exitcode == 82 && errlen > 2) - return errstr; - if ((exitcode >= 11) && (exitcode <= 40)) - return "Dqq permanent problem (#5.3.0)"; - return "Zqq temporary problem (#4.3.0)"; - } -} diff --git a/qmail.h b/qmail.h @@ -1,34 +0,0 @@ -#ifndef QMAIL_H -#define QMAIL_H - -#include "substdio.h" - -#include <string.h> - -struct qmail { - int flagerr; - unsigned long pid; - int fdm; - int fde; - int fderr; - substdio ss; - char buf[1024]; -} ; - -extern int qmail_open(); -extern void qmail_put(); -#define qmail_puts(qq,s) qmail_put(qq,s,strlen(s)) -extern void qmail_from(); -extern void qmail_to(); -extern void qmail_fail(); -extern char *qmail_close(); -extern unsigned long qmail_qp(); - -#define GEN_QMAILPUT_WRITE(qq) \ -ssize_t qmail_put_write(int fd, const void *buf, size_t len) \ -{ \ - qmail_put(qq,buf,len); \ - return len; \ -} - -#endif diff --git a/qreceipt.c b/qreceipt.c @@ -1,130 +0,0 @@ -#include "sig.h" -#include "env.h" -#include "substdio.h" -#include "stralloc.h" -#include "subfd.h" -#include "getln.h" -#include "str.h" -#include "hfield.h" -#include "token822.h" -#include "error.h" -#include "gen_alloc.h" -#include "gen_allocdefs.h" -#include "headerbody.h" -#include "exit.h" -#include "open.h" -#include "quote.h" -#include "qmail.h" - -void die_noreceipt() { _exit(0); } -void die() { _exit(100); } -void die_temp() { _exit(111); } -void die_nomem() { - substdio_putsflush(subfderr,"qreceipt: fatal: out of memory\n"); die_temp(); } -void die_fork() { - substdio_putsflush(subfderr,"qreceipt: fatal: unable to fork\n"); die_temp(); } -void die_qqperm() { - substdio_putsflush(subfderr,"qreceipt: fatal: permanent qmail-queue error\n"); die(); } -void die_qqtemp() { - substdio_putsflush(subfderr,"qreceipt: fatal: temporary qmail-queue error\n"); die_temp(); } -void die_usage() { - substdio_putsflush(subfderr, - "qreceipt: usage: qreceipt deliveryaddress\n"); die(); } -void die_read() { - if (errno == error_nomem) die_nomem(); - substdio_putsflush(subfderr,"qreceipt: fatal: read error\n"); die_temp(); } -void doordie(sa,r) stralloc *sa; int r; { - if (r == 1) return; if (r == -1) die_nomem(); - substdio_putsflush(subfderr,"qreceipt: fatal: unable to parse this: "); - substdio_putflush(subfderr,sa->s,sa->len); die(); } - -char *target; - -int flagreceipt = 0; - -char *returnpath; -stralloc messageid = {0}; -stralloc sanotice = {0}; - -int rwnotice(addr) token822_alloc *addr; { token822_reverse(addr); - if (token822_unquote(&sanotice,addr) != 1) die_nomem(); - if (sanotice.len == str_len(target)) - if (!str_diffn(sanotice.s,target,sanotice.len)) - flagreceipt = 1; - token822_reverse(addr); return 1; } - -struct qmail qqt; - -stralloc quoted = {0}; - -void finishheader() -{ - char *qqx; - - if (!flagreceipt) die_noreceipt(); - if (str_equal(returnpath,"")) die_noreceipt(); - if (str_equal(returnpath,"#@[]")) die_noreceipt(); - - if (!quote2(&quoted,returnpath)) die_nomem(); - - if (qmail_open(&qqt) == -1) die_fork(); - - qmail_puts(&qqt,"From: DELIVERY NOTICE SYSTEM <"); - qmail_put(&qqt,quoted.s,quoted.len); - qmail_puts(&qqt,">\n"); - qmail_puts(&qqt,"To: <"); - qmail_put(&qqt,quoted.s,quoted.len); - qmail_puts(&qqt,">\n"); - qmail_puts(&qqt,"Subject: success notice\n\ -\n\ -Hi! This is the qreceipt program. Your message was delivered to the\n\ -following address: "); - qmail_puts(&qqt,target); - qmail_puts(&qqt,". Thanks for asking.\n"); - if (messageid.s) - { - qmail_puts(&qqt,"Your "); - qmail_put(&qqt,messageid.s,messageid.len); - } - - qmail_from(&qqt,""); - qmail_to(&qqt,returnpath); - qqx = qmail_close(&qqt); - - if (*qqx) { - if (*qqx == 'D') die_qqperm(); - else die_qqtemp(); - } -} - -stralloc hfbuf = {0}; -token822_alloc hfin = {0}; -token822_alloc hfrewrite = {0}; -token822_alloc hfaddr = {0}; - -void doheaderfield(h) -stralloc *h; -{ - switch(hfield_known(h->s,h->len)) - { - case H_MESSAGEID: - if (!stralloc_copy(&messageid,h)) die_nomem(); - break; - case H_NOTICEREQUESTEDUPONDELIVERYTO: - doordie(h,token822_parse(&hfin,h,&hfbuf)); - doordie(h,token822_addrlist(&hfrewrite,&hfaddr,&hfin,rwnotice)); - break; - } -} - -void dobody(h) stralloc *h; { ; } - -int main(int argc, char **argv) -{ - sig_pipeignore(); - if (argc == 1) die_usage(); - target = argv[1]; - if (!(returnpath = env_get("SENDER"))) die_usage(); - if (headerbody(subfdin,doheaderfield,finishheader,dobody) == -1) die_read(); - die_noreceipt(); -} diff --git a/qsutil.c b/qsutil.c @@ -1,47 +0,0 @@ -#include "qsutil.h" - -#include "stralloc.h" -#include "readwrite.h" -#include "substdio.h" - -static stralloc foo = {0}; - -static char errbuf[1]; -static struct substdio sserr = SUBSTDIO_FDBUF(write,0,errbuf,1); - -void logsa(sa) stralloc *sa; { - substdio_putflush(&sserr,sa->s,sa->len); } -void log1(s1) char *s1; { - substdio_putsflush(&sserr,s1); } -void qslog2(char *s1, char *s2) { - substdio_putsflush(&sserr,s1); - substdio_putsflush(&sserr,s2); } -void log3(s1,s2,s3) char *s1; char *s2; char *s3; { - substdio_putsflush(&sserr,s1); - substdio_putsflush(&sserr,s2); - substdio_putsflush(&sserr,s3); } -void nomem() { log1("alert: out of memory, sleeping...\n"); sleep(10); } - -void pausedir(dir) char *dir; -{ log3("alert: unable to opendir ",dir,", sleeping...\n"); sleep(10); } - -static int issafe(ch) char ch; -{ - if (ch == '%') return 0; /* general principle: allman's code is crap */ - if (ch < 33) return 0; - if (ch > 126) return 0; - return 1; -} - -void logsafe(s) char *s; -{ - int i; - while (!stralloc_copys(&foo,s)) nomem(); - for (i = 0;i < foo.len;++i) - if (foo.s[i] == '\n') - foo.s[i] = '/'; - else - if (!issafe(foo.s[i])) - foo.s[i] = '_'; - logsa(&foo); -} diff --git a/qsutil.h b/qsutil.h @@ -1,22 +0,0 @@ -#ifndef QSUTIL_H -#define QSUTIL_H - -#include "deprecated.h" - -extern void log1(); -extern void qslog2(char *, char *); - -#ifdef DEPRECATED_FUNCTIONS_AVAILABLE -static inline void _deprecated_ log2(char *s1, char *s2) -{ - qslog2(s1,s2); -} -#endif - -extern void log3(); -extern void logsa(); -extern void nomem(); -extern void pausedir(); -extern void logsafe(); - -#endif diff --git a/qtmp.h1 b/qtmp.h1 @@ -1,26 +0,0 @@ -#ifndef QTMP_H -#define QTMP_H - -#include <utmp.h> -#ifndef UTMP_FILE -#ifdef _PATH_UTMP -#define UTMP_FILE _PATH_UTMP -#else -#define UTMP_FILE "/etc/utmp" -#endif -#endif -#define UTMP_INIT \ - struct utmp utm; \ - struct utmp *ut = &utm; \ - substdio ssutmp; \ - char bufutmp[sizeof(struct utmp) * 16]; \ - int fdutmp -#define UTMP_USER ut_name -#define UTMP_OPEN \ - fdutmp = open_read(UTMP_FILE); \ - if (fdutmp == -1) _exit(0); \ - substdio_fdbuf(&ssutmp,read,fdutmp,bufutmp,sizeof(bufutmp)) -#define UTMP_READ_MORE (substdio_get(&ssutmp,ut,sizeof(utm)) == sizeof(utm)) -#define UTMP_TYPE_MATCHES 1 - -#endif diff --git a/qtmp.h2 b/qtmp.h2 @@ -1,11 +0,0 @@ -#ifndef QTMP_H -#define QTMP_H - -#include <utmpx.h> -#define UTMP_INIT struct utmpx *ut -#define UTMP_USER ut_user -#define UTMP_OPEN -#define UTMP_READ_MORE (ut = getutxent()) -#define UTMP_TYPE_MATCHES (ut->ut_type == USER_PROCESS) - -#endif diff --git a/quote.c b/quote.c @@ -1,93 +0,0 @@ -#include "quote.h" - -#include "error.h" -#include "oflops.h" -#include "stralloc.h" -#include "str.h" - -/* -quote() encodes a box as per rfc 821 and rfc 822, -while trying to do as little quoting as possible. -no, 821 and 822 don't have the same encoding. they're not even close. -no special encoding here for bytes above 127. -*/ - -static char ok[128] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -,0,7,0,7,7,7,7,7,0,0,7,7,0,7,7,7 ,7,7,7,7,7,7,7,7,7,7,0,0,0,7,0,7 -,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 ,7,7,7,7,7,7,7,7,7,7,7,0,0,0,7,7 -,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 ,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0 -} ; - -static int doit(saout,sain) -stralloc *saout; -stralloc *sain; -{ - char ch; - int i; - int j; - unsigned int nlen; - - /* make sure the size calculation below does not overflow */ - if (__builtin_mul_overflow(sain->len, 2, &nlen) || - __builtin_add_overflow(nlen, 2, &nlen)) { - errno = error_nomem; - return 0; - } - if (!stralloc_ready(saout,nlen)) return 0; - j = 0; - saout->s[j++] = '"'; - for (i = 0;i < sain->len;++i) - { - ch = sain->s[i]; - if ((ch == '\r') || (ch == '\n') || (ch == '"') || (ch == '\\')) - saout->s[j++] = '\\'; - saout->s[j++] = ch; - } - saout->s[j++] = '"'; - saout->len = j; - return 1; -} - -int quote_need(s,n) -char *s; -unsigned int n; -{ - unsigned char uch; - int i; - if (!n) return 1; - for (i = 0;i < n;++i) - { - uch = s[i]; - if (uch >= 128) return 1; - if (!ok[uch]) return 1; - } - if (s[0] == '.') return 1; - if (s[n - 1] == '.') return 1; - for (i = 0;i < n - 1;++i) if (s[i] == '.') if (s[i + 1] == '.') return 1; - return 0; -} - -int quote(saout,sain) -stralloc *saout; -stralloc *sain; -{ - if (quote_need(sain->s,sain->len)) return doit(saout,sain); - return stralloc_copy(saout,sain); -} - -static stralloc foo = {0}; - -int quote2(sa,s) -stralloc *sa; -char *s; -{ - int j; - if (!*s) return stralloc_copys(sa,s); - j = str_rchr(s,'@'); - if (!stralloc_copys(&foo,s)) return 0; - if (!s[j]) return quote(sa,&foo); - foo.len = j; - if (!quote(sa,&foo)) return 0; - return stralloc_cats(sa,s + j); -} diff --git a/quote.h b/quote.h @@ -1,8 +0,0 @@ -#ifndef QUOTE_H -#define QUOTE_H - -extern int quote_need(); -extern int quote(); -extern int quote2(); - -#endif diff --git a/rcpthosts.c b/rcpthosts.c @@ -1,62 +0,0 @@ -#include "rcpthosts.h" - -#include "case.h" -#include "cdb.h" -#include "byte.h" -#include "open.h" -#include "error.h" -#include "control.h" -#include "constmap.h" -#include "stralloc.h" - -static int flagrh = 0; -static stralloc rh = {0}; -static struct constmap maprh; -static int fdmrh; - -int rcpthosts_init() -{ - flagrh = control_readfile(&rh,"control/rcpthosts",0); - if (flagrh != 1) return flagrh; - if (!constmap_init(&maprh,rh.s,rh.len,0)) return flagrh = -1; - fdmrh = open_read("control/morercpthosts.cdb"); - if (fdmrh == -1) if (errno != error_noent) return flagrh = -1; - return 0; -} - -static stralloc host = {0}; - -int rcpthosts(buf,len) -char *buf; -int len; -{ - int j; - - if (flagrh != 1) return 1; - - j = byte_rchr(buf,len,'@'); - if (j >= len) return 1; /* presumably envnoathost is acceptable */ - - ++j; buf += j; len -= j; - - if (!stralloc_copyb(&host,buf,len)) return -1; - buf = host.s; - case_lowerb(buf,len); - - for (j = 0;j < len;++j) - if (!j || (buf[j] == '.')) - if (constmap(&maprh,buf + j,len - j)) return 1; - - if (fdmrh != -1) { - uint32 dlen; - int r; - - for (j = 0;j < len;++j) - if (!j || (buf[j] == '.')) { - r = cdb_seek(fdmrh,buf + j,len - j,&dlen); - if (r) return r; - } - } - - return 0; -} diff --git a/rcpthosts.h b/rcpthosts.h @@ -1,7 +0,0 @@ -#ifndef RCPTHOSTS_H -#define RCPTHOSTS_H - -extern int rcpthosts_init(); -extern int rcpthosts(); - -#endif diff --git a/readsubdir.c b/readsubdir.c @@ -1,50 +0,0 @@ -#include "readsubdir.h" - -#include "fmt.h" -#include "scan.h" -#include "str.h" -#include "auto_split.h" - -void readsubdir_init(rs,name,pause) -readsubdir *rs; -char *name; -void (*pause)(); -{ - rs->name = name; - rs->pause = pause; - rs->dir = 0; - rs->pos = 0; -} - -static char namepos[FMT_ULONG + 4 + READSUBDIR_NAMELEN]; - -int readsubdir_next(rs,id) -readsubdir *rs; -unsigned long *id; -{ - direntry *d; - unsigned int len; - - if (!rs->dir) - { - if (rs->pos >= auto_split) return 0; - if (str_len(rs->name) > READSUBDIR_NAMELEN) { rs->pos++; return -1; } - len = 0; - len += fmt_str(namepos + len,rs->name); - namepos[len++] = '/'; - len += fmt_ulong(namepos + len,(unsigned long) rs->pos); - namepos[len] = 0; - while (!(rs->dir = opendir(namepos))) rs->pause(namepos); - rs->pos++; - return -1; - } - - d = readdir(rs->dir); - if (!d) { closedir(rs->dir); rs->dir = 0; return -1; } - - if (str_equal(d->d_name,".")) return -1; - if (str_equal(d->d_name,"..")) return -1; - len = scan_ulong(d->d_name,id); - if (!len || d->d_name[len]) return -2; - return 1; -} diff --git a/readsubdir.h b/readsubdir.h @@ -1,20 +0,0 @@ -#ifndef READSUBDIR_H -#define READSUBDIR_H - -#include "direntry.h" - -typedef struct readsubdir - { - DIR *dir; - int pos; - char *name; - void (*pause)(); - } -readsubdir; - -extern void readsubdir_init(); -extern int readsubdir_next(); - -#define READSUBDIR_NAMELEN 10 - -#endif diff --git a/readwrite.h b/readwrite.h @@ -1,6 +0,0 @@ -#ifndef READWRITE_H -#define READWRITE_H - -#include <unistd.h> - -#endif diff --git a/received.c b/received.c @@ -1,74 +0,0 @@ -#include "received.h" - -#include "fmt.h" -#include "qmail.h" -#include "now.h" -#include "datetime.h" -#include "date822fmt.h" - -static int issafe(ch) char ch; -{ - if (ch == '.') return 1; - if (ch == '@') return 1; - if (ch == '%') return 1; - if (ch == '+') return 1; - if (ch == '/') return 1; - if (ch == '=') return 1; - if (ch == ':') return 1; - if (ch == '-') return 1; - if ((ch >= 'a') && (ch <= 'z')) return 1; - if ((ch >= 'A') && (ch <= 'Z')) return 1; - if ((ch >= '0') && (ch <= '9')) return 1; - if (ch == '[') return 1; - if (ch == ']') return 1; - return 0; -} - -void safeput(qqt,s) -struct qmail *qqt; -char *s; -{ - char ch; - while ((ch = *s++)) { - if (!issafe(ch)) ch = '?'; - qmail_put(qqt,&ch,1); - } -} - -static char buf[DATE822FMT]; - -/* "Received: from relay1.uu.net (HELO uunet.uu.net) (7@192.48.96.5)\n" */ -/* " by silverton.berkeley.edu with SMTP; 26 Sep 1995 04:46:54 -0000\n" */ - -void received(qqt,protocol,local,remoteip,remotehost,remoteinfo,helo) -struct qmail *qqt; -char *protocol; -char *local; -char *remoteip; -char *remotehost; -char *remoteinfo; -char *helo; -{ - struct datetime dt; - - qmail_puts(qqt,"Received: from "); - safeput(qqt,remotehost); - if (helo) { - qmail_puts(qqt," (HELO "); - safeput(qqt,helo); - qmail_puts(qqt,")"); - } - qmail_puts(qqt," ("); - if (remoteinfo) { - safeput(qqt,remoteinfo); - qmail_puts(qqt,"@"); - } - safeput(qqt,remoteip); - qmail_puts(qqt,")\n by "); - safeput(qqt,local); - qmail_puts(qqt," with "); - qmail_puts(qqt,protocol); - qmail_puts(qqt,"; "); - datetime_tai(&dt,now()); - qmail_put(qqt,buf,date822fmt(buf,&dt)); -} diff --git a/received.h b/received.h @@ -1,6 +0,0 @@ -#ifndef RECEIVED_H -#define RECEIVED_H - -extern void received(); - -#endif diff --git a/remoteinfo.c b/remoteinfo.c @@ -1,79 +0,0 @@ -#include "remoteinfo.h" - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <fcntl.h> -#include <unistd.h> -#include "byte.h" -#include "substdio.h" -#include "ip.h" -#include "fmt.h" -#include "timeoutconn.h" -#include "timeoutread.h" -#include "timeoutwrite.h" - -static char line[999]; -static int t; - -static ssize_t mywrite(int fd, const void *buf, size_t len) -{ - return timeoutwrite(t,fd,buf,len); -} -static ssize_t myread(int fd, void *buf, size_t len) -{ - return timeoutread(t,fd,buf,len); -} - -char *remoteinfo_get(ipr,rp,ipl,lp,timeout) -struct ip_address *ipr; -unsigned long rp; -struct ip_address *ipl; -unsigned long lp; -int timeout; -{ - char *x; - int s; - struct sockaddr_in sin; - substdio ss; - char buf[32]; - unsigned int len; - int numcolons; - char ch; - - t = timeout; - - s = socket(AF_INET,SOCK_STREAM,0); - if (s == -1) return 0; - - byte_zero(&sin,sizeof(sin)); - sin.sin_family = AF_INET; - byte_copy(&sin.sin_addr,4,ipl); - sin.sin_port = 0; - if (bind(s,(struct sockaddr *) &sin,sizeof(sin)) == -1) { close(s); return 0; } - if (timeoutconn(s,ipr,113,timeout) == -1) { close(s); return 0; } - fcntl(s,F_SETFL,fcntl(s,F_GETFL,0) & ~O_NDELAY); - - len = 0; - len += fmt_ulong(line + len,rp); - len += fmt_str(line + len," , "); - len += fmt_ulong(line + len,lp); - len += fmt_str(line + len,"\r\n"); - - substdio_fdbuf(&ss,mywrite,s,buf,sizeof(buf)); - if (substdio_putflush(&ss,line,len) == -1) { close(s); return 0; } - - substdio_fdbuf(&ss,myread,s,buf,sizeof(buf)); - x = line; - numcolons = 0; - for (;;) { - if (substdio_get(&ss,&ch,1) != 1) { close(s); return 0; } - if ((ch == ' ') || (ch == '\t') || (ch == '\r')) continue; - if (ch == '\n') break; - if (numcolons < 3) { if (ch == ':') ++numcolons; } - else { *x++ = ch; if (x == line + sizeof(line) - 1) break; } - } - *x = 0; - close(s); - return line; -} diff --git a/remoteinfo.h b/remoteinfo.h @@ -1,6 +0,0 @@ -#ifndef REMOTEINFO_H -#define REMOTEINFO_H - -extern char *remoteinfo_get(); - -#endif diff --git a/scan.h b/scan.h @@ -1,7 +0,0 @@ -#ifndef SCAN_H -#define SCAN_H - -extern unsigned int scan_ulong(char *, unsigned long *); -extern unsigned int scan_8long(char *, unsigned long *); - -#endif diff --git a/scan_8long.c b/scan_8long.c @@ -1,11 +0,0 @@ -#include "scan.h" - -unsigned int scan_8long(char *s, unsigned long *u) -{ - unsigned int pos; unsigned long result; - unsigned long c; - pos = 0; result = 0; - while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 8) - { result = result * 8 + c; ++pos; } - *u = result; return pos; -} diff --git a/scan_ulong.c b/scan_ulong.c @@ -1,11 +0,0 @@ -#include "scan.h" - -unsigned int scan_ulong(char *s, unsigned long *u) -{ - unsigned int pos; unsigned long result; - unsigned long c; - pos = 0; result = 0; - while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 10) - { result = result * 10 + c; ++pos; } - *u = result; return pos; -} diff --git a/seek.h b/seek.h @@ -1,29 +0,0 @@ -#ifndef SEEK_H -#define SEEK_H - -#include <sys/types.h> -#include <unistd.h> - -typedef off_t seek_pos; - -#define seek_cur(fd) (lseek((fd), 0, SEEK_CUR)) - -static inline int seek_set(int fd, seek_pos pos) -{ - if (lseek(fd, pos, SEEK_SET) == -1) - return -1; - return 0; -} - - -static inline int seek_end(int fd) -{ - if (lseek(fd, 0, SEEK_END) == -1) - return -1; - return 0; -} - -#define seek_trunc(fd, pos) (ftruncate((fd),(pos))) -#define seek_begin(fd) (seek_set((fd),(seek_pos) 0)) - -#endif diff --git a/select.h1 b/select.h1 @@ -1,8 +0,0 @@ -#ifndef SELECT_H -#define SELECT_H - -#include <sys/types.h> -#include <sys/time.h> -extern int select(); - -#endif diff --git a/select.h2 b/select.h2 @@ -1,8 +0,0 @@ -#ifndef SELECT_H -#define SELECT_H - -#include <sys/types.h> -#include <sys/time.h> -#include <sys/select.h> - -#endif diff --git a/sendmail.c b/sendmail.c @@ -1,161 +0,0 @@ -#include "sgetopt.h" -#include "substdio.h" -#include "subfd.h" -#include "alloc.h" -#include "auto_qmail.h" -#include "exit.h" -#include "env.h" -#include "noreturn.h" -#include "str.h" - -void _noreturn_ nomem() -{ - substdio_putsflush(subfderr,"sendmail: fatal: out of memory\n"); - _exit(111); -} - -void _noreturn_ die_usage() -{ - substdio_putsflush(subfderr,"sendmail: usage: sendmail [ -t ] [ -fsender ] [ -Fname ] [ -bp ] [ -bs ] [ arg ... ]\n"); - _exit(100); -} - -char *smtpdarg[] = { "bin/qmail-smtpd", 0 }; -void _noreturn_ smtpd() -{ - if (!env_get("PROTO")) { - if (!env_put("RELAYCLIENT=")) nomem(); - if (!env_put("DATABYTES=0")) nomem(); - if (!env_put("PROTO=TCP")) nomem(); - if (!env_put("TCPLOCALIP=127.0.0.1")) nomem(); - if (!env_put("TCPLOCALHOST=localhost")) nomem(); - if (!env_put("TCPREMOTEIP=127.0.0.1")) nomem(); - if (!env_put("TCPREMOTEHOST=localhost")) nomem(); - if (!env_put("TCPREMOTEINFO=sendmail-bs")) nomem(); - } - execv(*smtpdarg,smtpdarg); - substdio_putsflush(subfderr,"sendmail: fatal: unable to run qmail-smtpd\n"); - _exit(111); -} - -char *qreadarg[] = { "bin/qmail-qread", 0 }; -void _noreturn_ mailq() -{ - execv(*qreadarg,qreadarg); - substdio_putsflush(subfderr,"sendmail: fatal: unable to run qmail-qread\n"); - _exit(111); -} - -void do_sender(s) -const char *s; -{ - char *x; - unsigned int n; - unsigned int a; - unsigned int i; - - env_unset("QMAILNAME"); - env_unset("MAILNAME"); - env_unset("NAME"); - env_unset("QMAILHOST"); - env_unset("MAILHOST"); - - n = str_len(s); - a = str_rchr(s, '@'); - if (a == n) - { - env_put2("QMAILUSER", s); - return; - } - env_put2("QMAILHOST", s + a + 1); - - x = (char *) alloc((a + 1) * sizeof(char)); - if (!x) nomem(); - for (i = 0; i < a; i++) - x[i] = s[i]; - x[i] = 0; - env_put2("QMAILUSER", x); - alloc_free(x); -} - -int flagh; -char *sender; - -int main(int argc, char **argv) -{ - int opt; - char **qiargv; - char **arg; - int i; - - if (chdir(auto_qmail) == -1) { - substdio_putsflush(subfderr,"sendmail: fatal: unable to switch to qmail home directory\n"); - return 111; - } - - flagh = 0; - sender = 0; - while ((opt = getopt(argc,argv,"vimte:f:p:o:B:F:EJxb:")) != opteof) - switch(opt) { - case 'B': break; - case 't': flagh = 1; break; - case 'f': sender = optarg; break; - case 'F': if (!env_put2("MAILNAME",optarg)) nomem(); break; - case 'p': break; /* could generate a Received line from optarg */ - case 'v': break; - case 'i': break; /* what an absurd concept */ - case 'x': break; /* SVR4 stupidity */ - case 'm': break; /* twisted-paper-path blindness, incompetent design */ - case 'e': break; /* qmail has only one error mode */ - case 'o': - switch(optarg[0]) { - case 'd': break; /* qmail has only one delivery mode */ - case 'e': break; /* see 'e' above */ - case 'i': break; /* see 'i' above */ - case 'm': break; /* see 'm' above */ - } - break; - case 'E': case 'J': /* Sony NEWS-OS */ - while (argv[optind][optpos]) ++optpos; /* skip optional argument */ - break; - case 'b': - switch(optarg[0]) { - case 'm': break; - case 'p': mailq(); - case 's': smtpd(); - default: die_usage(); - } - break; - default: - die_usage(); - } - argc -= optind; - argv += optind; - - if (str_equal(optprogname,"mailq")) - mailq(); - - if (str_equal(optprogname,"newaliases")) { - substdio_putsflush(subfderr,"sendmail: fatal: please use fastforward/newaliases instead\n"); - return 100; - } - - qiargv = (char **) alloc((argc + 10) * sizeof(char *)); - if (!qiargv) nomem(); - - arg = qiargv; - *arg++ = "bin/qmail-inject"; - *arg++ = (flagh ? "-H" : "-a"); - if (sender) { - *arg++ = "-f"; - *arg++ = sender; - do_sender(sender); - } - *arg++ = "--"; - for (i = 0;i < argc;++i) *arg++ = argv[i]; - *arg = 0; - - execv(*qiargv,qiargv); - substdio_putsflush(subfderr,"sendmail: fatal: unable to run qmail-inject\n"); - return 111; -} diff --git a/sgetopt.c b/sgetopt.c @@ -1,55 +0,0 @@ -/* sgetopt.c, sgetopt.h: (yet another) improved getopt clone, outer layer -D. J. Bernstein, djb@pobox.com. -Depends on subgetopt.h, substdio.h, subfd.h. -No system requirements. -19970208: Cleanups. -931201: Baseline. -No known patent problems. - -Documentation in sgetopt.3. -*/ - -#define SGETOPTNOSHORT -#include "sgetopt.h" - -#include "substdio.h" -#include "subfd.h" -#define SUBGETOPTNOSHORT -#include "subgetopt.h" - -#define getopt sgetoptmine -#define optind subgetoptind -#define opterr sgetopterr -#define optproblem subgetoptproblem -#define optprogname sgetoptprogname - -int opterr = 1; -char *optprogname = 0; - -int getopt(argc,argv,opts) -int argc; -char **argv; -char *opts; -{ - int c; - char *s; - - if (!optprogname) { - optprogname = *argv; - if (!optprogname) optprogname = ""; - for (s = optprogname;*s;++s) if (*s == '/') optprogname = s + 1; - } - c = subgetopt(argc,argv,opts); - if (opterr) - if (c == '?') { - char chp[2]; chp[0] = optproblem; chp[1] = '\n'; - substdio_puts(subfderr,optprogname); - if (argv[optind] && (optind < argc)) - substdio_puts(subfderr,": illegal option -- "); - else - substdio_puts(subfderr,": option requires an argument -- "); - substdio_put(subfderr,chp,2); - substdio_flush(subfderr); - } - return c; -} diff --git a/sgetopt.h b/sgetopt.h @@ -1,21 +0,0 @@ -#ifndef SGETOPT_H -#define SGETOPT_H - -#ifndef SGETOPTNOSHORT -#define getopt sgetoptmine -#define optarg subgetoptarg -#define optind subgetoptind -#define optpos subgetoptpos -#define opterr sgetopterr -#define optproblem subgetoptproblem -#define optprogname sgetoptprogname -#define opteof subgetoptdone -#endif - -#include "subgetopt.h" - -extern int sgetoptmine(); -extern int sgetopterr; -extern char *sgetoptprogname; - -#endif diff --git a/sig.h b/sig.h @@ -1,43 +0,0 @@ -#ifndef SIG_H -#define SIG_H - -extern void sig_catch(); -extern void sig_block(); -extern void sig_unblock(); -extern void sig_blocknone(); -extern void sig_pause(); - -extern void sig_dfl(); - -extern void sig_miscignore(); -extern void sig_bugcatch(); - -extern void sig_pipeignore(); -extern void sig_pipedefault(); - -extern void sig_contblock(); -extern void sig_contunblock(); -extern void sig_contcatch(); -extern void sig_contdefault(); - -extern void sig_termblock(); -extern void sig_termunblock(); -extern void sig_termcatch(); -extern void sig_termdefault(); - -extern void sig_alarmblock(); -extern void sig_alarmunblock(); -extern void sig_alarmcatch(); -extern void sig_alarmdefault(); - -extern void sig_childblock(); -extern void sig_childunblock(); -extern void sig_childcatch(); -extern void sig_childdefault(); - -extern void sig_hangupblock(); -extern void sig_hangupunblock(); -extern void sig_hangupcatch(); -extern void sig_hangupdefault(); - -#endif diff --git a/sig_alarm.c b/sig_alarm.c @@ -1,7 +0,0 @@ -#include <signal.h> -#include "sig.h" - -void sig_alarmblock() { sig_block(SIGALRM); } -void sig_alarmunblock() { sig_unblock(SIGALRM); } -void sig_alarmcatch(f) void (*f)(); { sig_catch(SIGALRM,f); } -void sig_alarmdefault() { sig_catch(SIGALRM,SIG_DFL); } diff --git a/sig_block.c b/sig_block.c @@ -1,41 +0,0 @@ -#include <signal.h> -#include <stddef.h> -#include "sig.h" -#include "hassgprm.h" - -void sig_block(sig) -int sig; -{ -#ifdef HASSIGPROCMASK - sigset_t ss; - sigemptyset(&ss); - sigaddset(&ss,sig); - sigprocmask(SIG_BLOCK,&ss,NULL); -#else - sigblock(1 << (sig - 1)); -#endif -} - -void sig_unblock(sig) -int sig; -{ -#ifdef HASSIGPROCMASK - sigset_t ss; - sigemptyset(&ss); - sigaddset(&ss,sig); - sigprocmask(SIG_UNBLOCK,&ss,NULL); -#else - sigsetmask(sigsetmask(~0) & ~(1 << (sig - 1))); -#endif -} - -void sig_blocknone() -{ -#ifdef HASSIGPROCMASK - sigset_t ss; - sigemptyset(&ss); - sigprocmask(SIG_SETMASK,&ss,NULL); -#else - sigsetmask(0); -#endif -} diff --git a/sig_bug.c b/sig_bug.c @@ -1,17 +0,0 @@ -#include <signal.h> -#include "sig.h" - -void sig_bugcatch(f) void (*f)(); -{ - sig_catch(SIGILL,f); - sig_catch(SIGABRT,f); - sig_catch(SIGFPE,f); - sig_catch(SIGBUS,f); - sig_catch(SIGSEGV,f); -#ifdef SIGSYS - sig_catch(SIGSYS,f); -#endif -#ifdef SIGEMT - sig_catch(SIGEMT,f); -#endif -} diff --git a/sig_catch.c b/sig_catch.c @@ -1,19 +0,0 @@ -#include <signal.h> -#include <stddef.h> -#include "sig.h" -#include "hassgact.h" - -void sig_catch(sig,f) -int sig; -void (*f)(); -{ -#ifdef HASSIGACTION - struct sigaction sa; - sa.sa_handler = f; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - sigaction(sig,&sa,NULL); -#else - signal(sig,f); /* won't work under System V, even nowadays---dorks */ -#endif -} diff --git a/sig_child.c b/sig_child.c @@ -1,7 +0,0 @@ -#include <signal.h> -#include "sig.h" - -void sig_childblock() { sig_block(SIGCHLD); } -void sig_childunblock() { sig_unblock(SIGCHLD); } -void sig_childcatch(f) void (*f)(); { sig_catch(SIGCHLD,f); } -void sig_childdefault() { sig_catch(SIGCHLD,SIG_DFL); } diff --git a/sig_hup.c b/sig_hup.c @@ -1,7 +0,0 @@ -#include <signal.h> -#include "sig.h" - -void sig_hangupblock() { sig_block(SIGHUP); } -void sig_hangupunblock() { sig_unblock(SIGHUP); } -void sig_hangupcatch(f) void (*f)(); { sig_catch(SIGHUP,f); } -void sig_hangupdefault() { sig_catch(SIGHUP,SIG_DFL); } diff --git a/sig_misc.c b/sig_misc.c @@ -1,17 +0,0 @@ -#include <signal.h> -#include "sig.h" - -void sig_miscignore() -{ - sig_catch(SIGVTALRM,SIG_IGN); - sig_catch(SIGPROF,SIG_IGN); - sig_catch(SIGQUIT,SIG_IGN); - sig_catch(SIGINT,SIG_IGN); - sig_catch(SIGHUP,SIG_IGN); -#ifdef SIGXCPU - sig_catch(SIGXCPU,SIG_IGN); -#endif -#ifdef SIGXFSZ - sig_catch(SIGXFSZ,SIG_IGN); -#endif -} diff --git a/sig_pause.c b/sig_pause.c @@ -1,14 +0,0 @@ -#include <signal.h> -#include "sig.h" -#include "hassgprm.h" - -void sig_pause() -{ -#ifdef HASSIGPROCMASK - sigset_t ss; - sigemptyset(&ss); - sigsuspend(&ss); -#else - sigpause(0); -#endif -} diff --git a/sig_pipe.c b/sig_pipe.c @@ -1,5 +0,0 @@ -#include <signal.h> -#include "sig.h" - -void sig_pipeignore() { sig_catch(SIGPIPE,SIG_IGN); } -void sig_pipedefault() { sig_catch(SIGPIPE,SIG_DFL); } diff --git a/sig_term.c b/sig_term.c @@ -1,7 +0,0 @@ -#include <signal.h> -#include "sig.h" - -void sig_termblock() { sig_block(SIGTERM); } -void sig_termunblock() { sig_unblock(SIGTERM); } -void sig_termcatch(f) void (*f)(); { sig_catch(SIGTERM,f); } -void sig_termdefault() { sig_catch(SIGTERM,SIG_DFL); } diff --git a/slurpclose.c b/slurpclose.c @@ -1,20 +0,0 @@ -#include "slurpclose.h" - -#include "stralloc.h" -#include "readwrite.h" -#include "error.h" - -int slurpclose(fd,sa,bufsize) -int fd; -stralloc *sa; -int bufsize; -{ - int r; - for (;;) { - if (!stralloc_readyplus(sa,bufsize)) { close(fd); return -1; } - r = read(fd,sa->s + sa->len,bufsize); - if (r == -1) if (errno == error_intr) continue; - if (r == 0 || r == -1) { close(fd); return r; } - sa->len += r; - } -} diff --git a/slurpclose.h b/slurpclose.h @@ -1,6 +0,0 @@ -#ifndef SLURPCLOSE_H -#define SLURPCLOSE_H - -extern int slurpclose(); - -#endif diff --git a/spawn.c b/spawn.c @@ -1,257 +0,0 @@ -#include "spawn.h" - -#include <sys/types.h> -#include <sys/stat.h> -#include "sig.h" -#include "wait.h" -#include "substdio.h" -#include "byte.h" -#include "str.h" -#include "alloc.h" -#include "stralloc.h" -#include "select.h" -#include "exit.h" -#include "coe.h" -#include "open.h" -#include "error.h" -#include "auto_qmail.h" -#include "auto_uids.h" -#include "auto_spawn.h" - -uid_t auto_uidq; - -struct delivery - { - int used; - int fdin; /* pipe input */ - int pid; /* zero if child is dead */ - int wstat; /* if !pid: status of child */ - int fdout; /* pipe output, -1 if !pid; delays eof until after death */ - stralloc output; - } -; - -struct delivery *d; - -void sigchld() -{ - int wstat; - int pid; - int i; - while ((pid = wait_nohang(&wstat)) > 0) - for (i = 0;i < auto_spawn;++i) if (d[i].used) - if (d[i].pid == pid) - { - close(d[i].fdout); d[i].fdout = -1; - d[i].wstat = wstat; d[i].pid = 0; - } -} - -int flagwriting = 1; - -ssize_t okwrite(int fd, const void *buf, size_t n) -{ - int w; - if (!flagwriting) return n; - w = write(fd,buf,n); - if (w != -1) return w; - if (errno == error_intr) return -1; - flagwriting = 0; close(fd); - return n; -} - -int flagreading = 1; -char outbuf[1024]; substdio ssout; - -int stage = 0; /* reading 0:delnum 1:messid 2:sender 3:recip */ -int flagabort = 0; /* if 1, everything except delnum is garbage */ -int delnum; -stralloc messid = {0}; -stralloc sender = {0}; -stralloc recip = {0}; - -void err(s) char *s; -{ - char ch; ch = delnum; substdio_put(&ssout,&ch,1); - substdio_puts(&ssout,s); substdio_putflush(&ssout,"",1); -} - -void docmd() -{ - int f; - int i; - int j; - int fdmess; - int pi[2]; - struct stat st; - - if (flagabort) { err("Zqmail-spawn out of memory. (#4.3.0)\n"); return; } - if (delnum < 0) { err("ZInternal error: delnum negative. (#4.3.5)\n"); return; } - if (delnum >= auto_spawn) { err("ZInternal error: delnum too big. (#4.3.5)\n"); return; } - if (d[delnum].used) { err("ZInternal error: delnum in use. (#4.3.5)\n"); return; } - for (i = 0;i < messid.len;++i) - if (messid.s[i]) - if (!i || (messid.s[i] != '/')) - if ((unsigned char) (messid.s[i] - '0') > 9) - { err("DInternal error: messid has nonnumerics. (#5.3.5)\n"); return; } - if (messid.len > 100) { err("DInternal error: messid too long. (#5.3.5)\n"); return; } - if (!messid.s[0]) { err("DInternal error: messid too short. (#5.3.5)\n"); return; } - - if (!stralloc_copys(&d[delnum].output,"")) - { err("Zqmail-spawn out of memory. (#4.3.0)\n"); return; } - - j = byte_rchr(recip.s,recip.len,'@'); - if (j >= recip.len) { err("DSorry, address must include host name. (#5.1.3)\n"); return; } - - fdmess = open_read(messid.s); - if (fdmess == -1) { err("Zqmail-spawn unable to open message. (#4.3.0)\n"); return; } - - if (fstat(fdmess,&st) == -1) - { close(fdmess); err("Zqmail-spawn unable to fstat message. (#4.3.0)\n"); return; } - if ((st.st_mode & S_IFMT) != S_IFREG) - { close(fdmess); err("ZSorry, message has wrong type. (#4.3.5)\n"); return; } - if (st.st_uid != auto_uidq) /* aaack! qmailq has to be trusted! */ - /* your security is already toast at this point. damage control... */ - { close(fdmess); err("ZSorry, message has wrong owner. (#4.3.5)\n"); return; } - - if (pipe(pi) == -1) - { close(fdmess); err("Zqmail-spawn unable to create pipe. (#4.3.0)\n"); return; } - - coe(pi[0]); - - f = spawn(fdmess,pi[1],sender.s,recip.s,j); - close(fdmess); - if (f == -1) - { close(pi[0]); close(pi[1]); err("Zqmail-spawn unable to fork. (#4.3.0)\n"); return; } - - d[delnum].fdin = pi[0]; - d[delnum].fdout = pi[1]; coe(pi[1]); - d[delnum].pid = f; - d[delnum].used = 1; -} - -char cmdbuf[1024]; - -void getcmd() -{ - int i; - int r; - char ch; - - r = read(0,cmdbuf,sizeof(cmdbuf)); - if (r == 0) - { flagreading = 0; return; } - if (r == -1) - { - if (errno != error_intr) - flagreading = 0; - return; - } - - for (i = 0;i < r;++i) - { - ch = cmdbuf[i]; - switch(stage) - { - case 0: - delnum = (unsigned int) (unsigned char) ch; - messid.len = 0; stage = 1; break; - case 1: - if (!stralloc_append(&messid,&ch)) flagabort = 1; - if (ch) break; - sender.len = 0; stage = 2; break; - case 2: - if (!stralloc_append(&sender,&ch)) flagabort = 1; - if (ch) break; - recip.len = 0; stage = 3; break; - case 3: - if (!stralloc_append(&recip,&ch)) flagabort = 1; - if (ch) break; - docmd(); - flagabort = 0; stage = 0; break; - } - } -} - -char inbuf[128]; - -int main(int argc, char **argv) -{ - char ch; - int i; - int r; - fd_set rfds; - int nfds; - - if (chdir(auto_qmail) == -1) _exit(111); - if (chdir("queue/mess") == -1) _exit(111); - if (!stralloc_copys(&messid,"")) _exit(111); - if (!stralloc_copys(&sender,"")) _exit(111); - if (!stralloc_copys(&recip,"")) _exit(111); - - d = (struct delivery *) alloc((auto_spawn + 10) * sizeof(struct delivery)); - if (!d) _exit(111); - - substdio_fdbuf(&ssout,okwrite,1,outbuf,sizeof(outbuf)); - - sig_pipeignore(); - sig_childcatch(sigchld); - - initialize(argc,argv); - - ch = auto_spawn; substdio_putflush(&ssout,&ch,1); - - for (i = 0;i < auto_spawn;++i) { d[i].used = 0; d[i].output.s = 0; } - - for (;;) - { - if (!flagreading) - { - for (i = 0;i < auto_spawn;++i) if (d[i].used) break; - if (i >= auto_spawn) _exit(0); - } - sig_childunblock(); - - FD_ZERO(&rfds); - if (flagreading) FD_SET(0,&rfds); - nfds = 1; - for (i = 0;i < auto_spawn;++i) if (d[i].used) - { FD_SET(d[i].fdin,&rfds); if (d[i].fdin >= nfds) nfds = d[i].fdin + 1; } - - r = select(nfds,&rfds,NULL,NULL,NULL); - sig_childblock(); - - if (r != -1) - { - if (flagreading) - if (FD_ISSET(0,&rfds)) - getcmd(); - for (i = 0;i < auto_spawn;++i) if (d[i].used) - if (FD_ISSET(d[i].fdin,&rfds)) - { - r = read(d[i].fdin,inbuf,128); - if (r == -1) - continue; /* read error on a readable pipe? be serious */ - if (r == 0) - { - ch = i; substdio_put(&ssout,&ch,1); - report(&ssout,d[i].wstat,d[i].output.s,d[i].output.len); - substdio_put(&ssout,"",1); - substdio_flush(&ssout); - close(d[i].fdin); d[i].used = 0; - continue; - } - while (!stralloc_readyplus(&d[i].output,r)) sleep(10); /*XXX*/ - byte_copy(d[i].output.s + d[i].output.len,r,inbuf); - d[i].output.len += r; - if (truncreport > 100) - if (d[i].output.len > truncreport) - { - char *truncmess = "\nError report too long, sorry.\n"; - d[i].output.len = truncreport - str_len(truncmess) - 3; - stralloc_cats(&d[i].output,truncmess); - } - } - } - } -} diff --git a/spawn.h b/spawn.h @@ -1,11 +0,0 @@ -#ifndef SPAWN_H -#define SPAWN_H - -#include "substdio.h" - -extern int truncreport; -extern int spawn(int fdmess, int fdout, char *s, char *r, int at); -extern void report(substdio *ss, int wstat, char *s, int len); -extern void initialize(int argc, char **argv); - -#endif diff --git a/splogger.c b/splogger.c @@ -1,70 +0,0 @@ -#include <sys/types.h> -#include <sys/time.h> -#include <syslog.h> -#include "error.h" -#include "substdio.h" -#include "subfd.h" -#include "exit.h" -#include "str.h" -#include "scan.h" -#include "fmt.h" - -char buf[800]; /* syslog truncates long lines (or crashes); GPACIC */ -int bufpos = 0; /* 0 <= bufpos < sizeof(buf) */ -int flagcont = 0; -int priority; /* defined if flagcont */ -char stamp[FMT_ULONG + FMT_ULONG + 3]; /* defined if flagcont */ - -void stamp_make() -{ - struct timeval tv; - char *s; - gettimeofday(&tv,NULL); - s = stamp; - s += fmt_ulong(s,(unsigned long) tv.tv_sec); - *s++ = '.'; - s += fmt_uint0(s,(unsigned int) tv.tv_usec,6); - *s = 0; -} - -void flush() -{ - if (bufpos) { - buf[bufpos] = 0; - if (flagcont) - syslog(priority,"%s+%s",stamp,buf); /* logger folds invisibly; GPACIC */ - else { - stamp_make(); - priority = LOG_INFO; - if (str_start(buf,"warning:")) priority = LOG_WARNING; - if (str_start(buf,"alert:")) priority = LOG_ALERT; - syslog(priority,"%s %s",stamp,buf); - flagcont = 1; - } - } - bufpos = 0; -} - -int main(int argc, char **argv) -{ - char ch; - - if (argc > 1) - if (argc > 2) { - unsigned long facility; - scan_ulong(argv[2],&facility); - openlog(argv[1],0,facility << 3); - } - else - openlog(argv[1],0,LOG_MAIL); - else - openlog("splogger",0,LOG_MAIL); - - for (;;) { - if (substdio_get(subfdin,&ch,1) < 1) _exit(0); - if (ch == '\n') { flush(); flagcont = 0; continue; } - if (bufpos == sizeof(buf) - 1) flush(); - if ((ch < 32) || (ch > 126)) ch = '?'; /* logger truncates at 0; GPACIC */ - buf[bufpos++] = ch; - } -} diff --git a/auto-int.c b/src/auto-int.c diff --git a/auto-int8.c b/src/auto-int8.c diff --git a/auto-str.c b/src/auto-str.c diff --git a/bouncesaying.c b/src/bouncesaying.c diff --git a/byte_chr.c b/src/byte_chr.c diff --git a/byte_copy.c b/src/byte_copy.c diff --git a/byte_cr.c b/src/byte_cr.c diff --git a/byte_rchr.c b/src/byte_rchr.c diff --git a/byte_zero.c b/src/byte_zero.c diff --git a/case_diffb.c b/src/case_diffb.c diff --git a/case_diffs.c b/src/case_diffs.c diff --git a/case_lowerb.c b/src/case_lowerb.c diff --git a/case_lowers.c b/src/case_lowers.c diff --git a/case_starts.c b/src/case_starts.c diff --git a/cdb_hash.c b/src/cdb_hash.c diff --git a/cdb_seek.c b/src/cdb_seek.c diff --git a/cdb_unpack.c b/src/cdb_unpack.c diff --git a/cdbmake_add.c b/src/cdbmake_add.c diff --git a/cdbmake_hash.c b/src/cdbmake_hash.c diff --git a/cdbmake_pack.c b/src/cdbmake_pack.c diff --git a/cdbmss.c b/src/cdbmss.c diff --git a/chkbiofl.c b/src/chkbiofl.c diff --git a/chkspawn.c b/src/chkspawn.c diff --git a/coe.c b/src/coe.c diff --git a/commands.c b/src/commands.c diff --git a/condredirect.c b/src/condredirect.c diff --git a/constmap.c b/src/constmap.c diff --git a/control.c b/src/control.c diff --git a/date822fmt.c b/src/date822fmt.c diff --git a/datetime.c b/src/datetime.c diff --git a/datetime_un.c b/src/datetime_un.c diff --git a/dns.c b/src/dns.c diff --git a/dnsdoe.c b/src/dnsdoe.c diff --git a/dnsfq.c b/src/dnsfq.c diff --git a/dnsip.c b/src/dnsip.c diff --git a/dnsptr.c b/src/dnsptr.c diff --git a/env.c b/src/env.c diff --git a/envread.c b/src/envread.c diff --git a/error_str.c b/src/error_str.c diff --git a/error_temp.c b/src/error_temp.c diff --git a/except.c b/src/except.c diff --git a/fd_copy.c b/src/fd_copy.c diff --git a/fd_move.c b/src/fd_move.c diff --git a/fifo.c b/src/fifo.c diff --git a/fmt_str.c b/src/fmt_str.c diff --git a/fmt_strn.c b/src/fmt_strn.c diff --git a/fmt_uint.c b/src/fmt_uint.c diff --git a/fmt_uint0.c b/src/fmt_uint0.c diff --git a/fmt_ulong.c b/src/fmt_ulong.c diff --git a/fmtqfn.c b/src/fmtqfn.c diff --git a/forward.c b/src/forward.c diff --git a/getln.c b/src/getln.c diff --git a/getln2.c b/src/getln2.c diff --git a/gfrom.c b/src/gfrom.c diff --git a/gid.c b/src/gid.c diff --git a/headerbody.c b/src/headerbody.c diff --git a/hfield.c b/src/hfield.c diff --git a/src/hier.c b/src/hier.c @@ -0,0 +1,251 @@ +#include "hier.h" + +#include <sys/types.h> +#include "auto_qmail.h" +#include "auto_split.h" +#include "auto_uids.h" +#include "fmt.h" +#include "fifo.h" + +char buf[100 + FMT_ULONG]; + +void dsplit(char *base, /* must be under 100 bytes */ + uid_t uid, int mode) +{ + char *x; + unsigned long i; + + d(auto_qmail,base,uid,auto_gidq,mode); + + for (i = 0;i < auto_split;++i) { + x = buf; + x += fmt_str(x,base); + x += fmt_str(x,"/"); + x += fmt_ulong(x,i); + *x = 0; + + d(auto_qmail,buf,uid,auto_gidq,mode); + } +} + +void hier_queue() +{ + d(auto_qmail,"queue",auto_uidq,auto_gidq,0750); + d(auto_qmail,"queue/pid",auto_uidq,auto_gidq,0700); + d(auto_qmail,"queue/intd",auto_uidq,auto_gidq,0700); + d(auto_qmail,"queue/todo",auto_uidq,auto_gidq,0750); + d(auto_qmail,"queue/bounce",auto_uids,auto_gidq,0700); + + dsplit("queue/mess",auto_uidq,0750); + dsplit("queue/info",auto_uids,0700); + dsplit("queue/local",auto_uids,0700); + dsplit("queue/remote",auto_uids,0700); + + d(auto_qmail,"queue/lock",auto_uidq,auto_gidq,0750); + z(auto_qmail,"queue/lock/tcpto",1024,auto_uidr,auto_gidq,0644); + z(auto_qmail,"queue/lock/sendmutex",0,auto_uids,auto_gidq,0600); + p(auto_qmail,"queue/lock/trigger",auto_uids,auto_gidq,0622); +} + +void hier() +{ + h(auto_qmail,auto_uido,auto_gidq,0755); + + d(auto_qmail,"control",auto_uido,auto_gidq,0755); + d(auto_qmail,"users",auto_uido,auto_gidq,0755); + d(auto_qmail,"bin",auto_uido,auto_gidq,0755); + d(auto_qmail,"boot",auto_uido,auto_gidq,0755); + d(auto_qmail,"doc",auto_uido,auto_gidq,0755); + d(auto_qmail,"man",auto_uido,auto_gidq,0755); + d(auto_qmail,"man/cat1",auto_uido,auto_gidq,0755); + d(auto_qmail,"man/cat5",auto_uido,auto_gidq,0755); + d(auto_qmail,"man/cat7",auto_uido,auto_gidq,0755); + d(auto_qmail,"man/cat8",auto_uido,auto_gidq,0755); + d(auto_qmail,"man/man1",auto_uido,auto_gidq,0755); + d(auto_qmail,"man/man5",auto_uido,auto_gidq,0755); + d(auto_qmail,"man/man7",auto_uido,auto_gidq,0755); + d(auto_qmail,"man/man8",auto_uido,auto_gidq,0755); + + d(auto_qmail,"alias",auto_uida,auto_gidq,02755); + + hier_queue(); + + c(auto_qmail,"boot",".","home",auto_uido,auto_gidq,0755); + c(auto_qmail,"boot",".","home+df",auto_uido,auto_gidq,0755); + c(auto_qmail,"boot",".","proc",auto_uido,auto_gidq,0755); + c(auto_qmail,"boot",".","proc+df",auto_uido,auto_gidq,0755); + c(auto_qmail,"boot",".","binm1",auto_uido,auto_gidq,0755); + c(auto_qmail,"boot",".","binm1+df",auto_uido,auto_gidq,0755); + c(auto_qmail,"boot",".","binm2",auto_uido,auto_gidq,0755); + c(auto_qmail,"boot",".","binm2+df",auto_uido,auto_gidq,0755); + c(auto_qmail,"boot",".","binm3",auto_uido,auto_gidq,0755); + c(auto_qmail,"boot",".","binm3+df",auto_uido,auto_gidq,0755); + + c(auto_qmail,"doc","doc","FAQ.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","UPGRADE.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","SENDMAIL.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","INSTALL.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","INSTALL.alias.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","INSTALL.ctl.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","INSTALL.ids.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","INSTALL.maildir.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","INSTALL.mbox.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","INSTALL.vsm.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","TEST.deliver.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","TEST.receive.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","REMOVE.sendmail.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","REMOVE.binmail.md",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","PIC.local2alias",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","PIC.local2ext",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","PIC.local2local",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","PIC.local2rem",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","PIC.local2virt",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","PIC.nullclient",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","PIC.relaybad",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","PIC.relaygood",auto_uido,auto_gidq,0644); + c(auto_qmail,"doc","doc","PIC.rem2local",auto_uido,auto_gidq,0644); + + c(auto_qmail,"bin",/*"src"*/".","qmail-queue",auto_uidq,auto_gidq,04711); + c(auto_qmail,"bin",/*"src"*/".","qmail-lspawn",auto_uido,auto_gidq,0700); + c(auto_qmail,"bin",/*"src"*/".","qmail-start",auto_uido,auto_gidq,0700); + c(auto_qmail,"bin",/*"src"*/".","qmail-getpw",auto_uido,auto_gidq,0711); + c(auto_qmail,"bin",/*"src"*/".","qmail-local",auto_uido,auto_gidq,0711); + c(auto_qmail,"bin",/*"src"*/".","qmail-remote",auto_uido,auto_gidq,0711); + c(auto_qmail,"bin",/*"src"*/".","qmail-rspawn",auto_uido,auto_gidq,0711); + c(auto_qmail,"bin",/*"src"*/".","qmail-clean",auto_uido,auto_gidq,0711); + c(auto_qmail,"bin",/*"src"*/".","qmail-send",auto_uido,auto_gidq,0711); + c(auto_qmail,"bin",/*"src"*/".","splogger",auto_uido,auto_gidq,0711); + c(auto_qmail,"bin",/*"src"*/".","qmail-newu",auto_uido,auto_gidq,0700); + c(auto_qmail,"bin",/*"src"*/".","qmail-newmrh",auto_uido,auto_gidq,0700); + c(auto_qmail,"bin",/*"src"*/".","qmail-pw2u",auto_uido,auto_gidq,0711); + c(auto_qmail,"bin",/*"src"*/".","qmail-inject",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","predate",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","datemail",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","mailsubj",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qmail-showctl",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qmail-qread",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qmail-qstat",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qmail-tcpto",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qmail-tcpok",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qmail-pop3d",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qmail-popup",auto_uido,auto_gidq,0711); + c(auto_qmail,"bin",/*"src"*/".","qmail-qmqpc",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qmail-qmqpd",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qmail-qmtpd",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qmail-smtpd",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","sendmail",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","tcp-env",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qreceipt",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","qbiff",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","forward",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","preline",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","condredirect",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","bouncesaying",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","except",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","maildirmake",auto_uido,auto_gidq,0755); + c(auto_qmail,"bin",/*"src"*/".","maildir2mbox",auto_uido,auto_gidq,0755); + + c(auto_qmail,"man/man5","doc/man","addresses.5",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat5","doc/man","addresses.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man5","doc/man","envelopes.5",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat5","doc/man","envelopes.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man5","doc/man","maildir.5",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat5","doc/man","maildir.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man5","doc/man","mbox.5",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat5","doc/man","mbox.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man5","doc/man","dot-qmail.5",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat5","doc/man","dot-qmail.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man5","doc/man","qmail-control.5",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat5","doc/man","qmail-control.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man5","doc/man","qmail-header.5",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat5","doc/man","qmail-header.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man5","doc/man","qmail-log.5",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat5","doc/man","qmail-log.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man5","doc/man","qmail-users.5",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat5","doc/man","qmail-users.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man5","doc/man","tcp-environ.5",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat5","doc/man","tcp-environ.0",auto_uido,auto_gidq,0644); + + c(auto_qmail,"man/man7","doc/man","forgeries.7",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat7","doc/man","forgeries.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man7","doc/man","qmail-limits.7",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat7","doc/man","qmail-limits.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man7","doc/man","qmail.7",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat7","doc/man","qmail.0",auto_uido,auto_gidq,0644); + + c(auto_qmail,"man/man1","doc/man","forward.1",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat1","doc/man","forward.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man1","doc/man","condredirect.1",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat1","doc/man","condredirect.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man1","doc/man","bouncesaying.1",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat1","doc/man","bouncesaying.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man1","doc/man","except.1",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat1","doc/man","except.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man1","doc/man","maildirmake.1",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat1","doc/man","maildirmake.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man1","doc/man","maildir2mbox.1",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat1","doc/man","maildir2mbox.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man1","doc/man","mailsubj.1",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat1","doc/man","mailsubj.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man1","doc/man","qreceipt.1",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat1","doc/man","qreceipt.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man1","doc/man","qbiff.1",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat1","doc/man","qbiff.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man1","doc/man","preline.1",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat1","doc/man","preline.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man1","doc/man","tcp-env.1",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat1","doc/man","tcp-env.0",auto_uido,auto_gidq,0644); + + c(auto_qmail,"man/man8","doc/man","qmail-local.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-local.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-lspawn.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-lspawn.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-getpw.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-getpw.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-remote.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-remote.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-rspawn.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-rspawn.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-clean.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-clean.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-send.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-send.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-start.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-start.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","splogger.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","splogger.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-queue.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-queue.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-inject.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-inject.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-showctl.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-showctl.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-newmrh.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-newmrh.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-newu.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-newu.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-pw2u.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-pw2u.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-qread.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-qread.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-qstat.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-qstat.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-tcpok.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-tcpok.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-tcpto.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-tcpto.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-pop3d.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-pop3d.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-popup.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-popup.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-qmqpc.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-qmqpc.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-qmqpd.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-qmqpd.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-qmtpd.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-qmtpd.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-smtpd.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-smtpd.0",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/man8","doc/man","qmail-command.8",auto_uido,auto_gidq,0644); + c(auto_qmail,"man/cat8","doc/man","qmail-command.0",auto_uido,auto_gidq,0644); +} diff --git a/hostname.c b/src/hostname.c diff --git a/instcheck.c b/src/instcheck.c diff --git a/instchown.c b/src/instchown.c diff --git a/instfiles.c b/src/instfiles.c diff --git a/instpackage.c b/src/instpackage.c diff --git a/instqueue.c b/src/instqueue.c diff --git a/instuidgid.c b/src/instuidgid.c diff --git a/ip.c b/src/ip.c diff --git a/ipalloc.c b/src/ipalloc.c diff --git a/ipme.c b/src/ipme.c diff --git a/ipmeprint.c b/src/ipmeprint.c diff --git a/lock_ex.c b/src/lock_ex.c diff --git a/lock_exnb.c b/src/lock_exnb.c diff --git a/lock_un.c b/src/lock_un.c diff --git a/maildir.c b/src/maildir.c diff --git a/maildir2mbox.c b/src/maildir2mbox.c diff --git a/maildirmake.c b/src/maildirmake.c diff --git a/myctime.c b/src/myctime.c diff --git a/ndelay.c b/src/ndelay.c diff --git a/ndelay_off.c b/src/ndelay_off.c diff --git a/newfield.c b/src/newfield.c diff --git a/open_append.c b/src/open_append.c diff --git a/open_excl.c b/src/open_excl.c diff --git a/open_read.c b/src/open_read.c diff --git a/open_trunc.c b/src/open_trunc.c diff --git a/open_write.c b/src/open_write.c diff --git a/predate.c b/src/predate.c diff --git a/preline.c b/src/preline.c diff --git a/prioq.c b/src/prioq.c diff --git a/prot.c b/src/prot.c diff --git a/qbiff.c b/src/qbiff.c diff --git a/qmail-clean.c b/src/qmail-clean.c diff --git a/qmail-getpw.c b/src/qmail-getpw.c diff --git a/qmail-inject.c b/src/qmail-inject.c diff --git a/qmail-local.c b/src/qmail-local.c diff --git a/qmail-lspawn.c b/src/qmail-lspawn.c diff --git a/qmail-newmrh.c b/src/qmail-newmrh.c diff --git a/qmail-newu.c b/src/qmail-newu.c diff --git a/qmail-pop3d.c b/src/qmail-pop3d.c diff --git a/qmail-popup.c b/src/qmail-popup.c diff --git a/qmail-pw2u.c b/src/qmail-pw2u.c diff --git a/qmail-qmqpc.c b/src/qmail-qmqpc.c diff --git a/qmail-qmqpd.c b/src/qmail-qmqpd.c diff --git a/qmail-qmtpd.c b/src/qmail-qmtpd.c diff --git a/qmail-qread.c b/src/qmail-qread.c diff --git a/qmail-queue.c b/src/qmail-queue.c diff --git a/qmail-remote.c b/src/qmail-remote.c diff --git a/qmail-rspawn.c b/src/qmail-rspawn.c diff --git a/qmail-send.c b/src/qmail-send.c diff --git a/qmail-showctl.c b/src/qmail-showctl.c diff --git a/qmail-smtpd.c b/src/qmail-smtpd.c diff --git a/qmail-start.c b/src/qmail-start.c diff --git a/qmail-tcpok.c b/src/qmail-tcpok.c diff --git a/qmail-tcpto.c b/src/qmail-tcpto.c diff --git a/src/qmail.c b/src/qmail.c @@ -0,0 +1,158 @@ +#include "qmail.h" + +#include "substdio.h" +#include "readwrite.h" +#include "wait.h" +#include "exit.h" +#include "fork.h" +#include "fd.h" +#include "auto_qmail.h" +#include "env.h" + +static char *binqqargs[2] = { 0, 0 } ; + +static void setup_qqargs() +{ + if(!binqqargs[0]) + binqqargs[0] = env_get("QMAILQUEUE"); + if(!binqqargs[0]) + binqqargs[0] = "bin/qmail-queue"; +} + +int qmail_open(qq) +struct qmail *qq; +{ + int pim[2]; + int pie[2]; + int pierr[2]; + + setup_qqargs(); + + if (pipe(pim) == -1) return -1; + if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; } + if (pipe(pierr) == -1) { + close(pim[0]); close(pim[1]); + close(pie[0]); close(pie[1]); + return -1; + } + + switch(qq->pid = fork()) { + case -1: + close(pim[0]); close(pim[1]); + close(pie[0]); close(pie[1]); + close(pierr[0]); close(pierr[1]); + return -1; + case 0: + close(pim[1]); + close(pie[1]); + close(pierr[0]); /* we want to receive data */ + if (fd_move(0,pim[0]) == -1) _exit(120); + if (fd_move(1,pie[0]) == -1) _exit(120); + if (fd_move(6,pierr[1]) == -1) _exit(120); + if (chdir(auto_qmail) == -1) _exit(61); + execv(*binqqargs,binqqargs); + _exit(120); + } + + qq->fdm = pim[1]; close(pim[0]); + qq->fde = pie[1]; close(pie[0]); + qq->fderr = pierr[0]; close(pierr[1]); + substdio_fdbuf(&qq->ss,write,qq->fdm,qq->buf,sizeof(qq->buf)); + qq->flagerr = 0; + return 0; +} + +unsigned long qmail_qp(qq) struct qmail *qq; +{ + return qq->pid; +} + +void qmail_fail(qq) struct qmail *qq; +{ + qq->flagerr = 1; +} + +void qmail_put(struct qmail *qq, char *s, size_t len) +{ + if (!qq->flagerr) if (substdio_put(&qq->ss,s,len) == -1) qq->flagerr = 1; +} + +void qmail_from(qq,s) struct qmail *qq; char *s; +{ + if (substdio_flush(&qq->ss) == -1) qq->flagerr = 1; + close(qq->fdm); + substdio_fdbuf(&qq->ss,write,qq->fde,qq->buf,sizeof(qq->buf)); + qmail_put(qq,"F",1); + qmail_puts(qq,s); + qmail_put(qq,"",1); +} + +void qmail_to(qq,s) struct qmail *qq; char *s; +{ + qmail_put(qq,"T",1); + qmail_puts(qq,s); + qmail_put(qq,"",1); +} + +static size_t qmail_errstr(struct qmail *qq, char *s) { + size_t len = 0; + substdio_fdbuf(&qq->ss,read,qq->fderr,qq->buf,sizeof(qq->buf)); + while (substdio_get(&qq->ss,s+len,1) > 0 && len < 255) { + len++; + } + s[len] = '\0'; + return len; +} + +char *qmail_close(qq) +struct qmail *qq; +{ + int wstat; + int exitcode; + static char errstr[256]; + size_t errlen; + + qmail_put(qq,"",1); + if (!qq->flagerr) if (substdio_flush(&qq->ss) == -1) qq->flagerr = 1; + close(qq->fde); + errlen = qmail_errstr(qq, errstr); + close(qq->fderr); + + if (wait_pid(&wstat,qq->pid) != qq->pid) + return "Zqq waitpid surprise (#4.3.0)"; + if (wait_crashed(wstat)) + return "Zqq crashed (#4.3.0)"; + exitcode = wait_exitcode(wstat); + + switch(exitcode) { + case 115: /* compatibility */ + case 11: return "Denvelope address too long for qq (#5.1.3)"; + case 31: return "Dmail server permanently rejected message (#5.3.0)"; + case 51: return "Zqq out of memory (#4.3.0)"; + case 52: return "Zqq timeout (#4.3.0)"; + case 53: return "Zqq write error or disk full (#4.3.0)"; + case 0: if (!qq->flagerr) return ""; /* fall through */ + case 54: return "Zqq read error (#4.3.0)"; + case 55: return "Zqq unable to read configuration (#4.3.0)"; + case 56: return "Zqq trouble making network connection (#4.3.0)"; + case 61: return "Zqq trouble in home directory (#4.3.0)"; + case 63: + case 64: + case 65: + case 66: + case 62: return "Zqq trouble creating files in queue (#4.3.0)"; + case 71: return "Zmail server temporarily rejected message (#4.3.0)"; + case 72: return "Zconnection to mail server timed out (#4.4.1)"; + case 73: return "Zconnection to mail server rejected (#4.4.1)"; + case 74: return "Zcommunication with mail server failed (#4.4.2)"; + case 91: /* fall through */ + case 81: return "Zqq internal bug (#4.3.0)"; + case 120: return "Zunable to exec qq (#4.3.0)"; + default: + if (exitcode == 82 && errlen > 2) + return errstr; + if ((exitcode >= 11) && (exitcode <= 40)) + return "Dqq permanent problem (#5.3.0)"; + return "Zqq temporary problem (#4.3.0)"; + } +} diff --git a/src/qreceipt.c b/src/qreceipt.c @@ -0,0 +1,130 @@ +#include "sig.h" +#include "env.h" +#include "substdio.h" +#include "stralloc.h" +#include "subfd.h" +#include "getln.h" +#include "str.h" +#include "hfield.h" +#include "token822.h" +#include "error.h" +#include "gen_alloc.h" +#include "gen_allocdefs.h" +#include "headerbody.h" +#include "exit.h" +#include "open.h" +#include "quote.h" +#include "qmail.h" + +void die_noreceipt() { _exit(0); } +void die() { _exit(100); } +void die_temp() { _exit(111); } +void die_nomem() { + substdio_putsflush(subfderr,"qreceipt: fatal: out of memory\n"); die_temp(); } +void die_fork() { + substdio_putsflush(subfderr,"qreceipt: fatal: unable to fork\n"); die_temp(); } +void die_qqperm() { + substdio_putsflush(subfderr,"qreceipt: fatal: permanent qmail-queue error\n"); die(); } +void die_qqtemp() { + substdio_putsflush(subfderr,"qreceipt: fatal: temporary qmail-queue error\n"); die_temp(); } +void die_usage() { + substdio_putsflush(subfderr, + "qreceipt: usage: qreceipt deliveryaddress\n"); die(); } +void die_read() { + if (errno == error_nomem) die_nomem(); + substdio_putsflush(subfderr,"qreceipt: fatal: read error\n"); die_temp(); } +void doordie(sa,r) stralloc *sa; int r; { + if (r == 1) return; if (r == -1) die_nomem(); + substdio_putsflush(subfderr,"qreceipt: fatal: unable to parse this: "); + substdio_putflush(subfderr,sa->s,sa->len); die(); } + +char *target; + +int flagreceipt = 0; + +char *returnpath; +stralloc messageid = {0}; +stralloc sanotice = {0}; + +int rwnotice(addr) token822_alloc *addr; { token822_reverse(addr); + if (token822_unquote(&sanotice,addr) != 1) die_nomem(); + if (sanotice.len == str_len(target)) + if (!str_diffn(sanotice.s,target,sanotice.len)) + flagreceipt = 1; + token822_reverse(addr); return 1; } + +struct qmail qqt; + +stralloc quoted = {0}; + +void finishheader() +{ + char *qqx; + + if (!flagreceipt) die_noreceipt(); + if (str_equal(returnpath,"")) die_noreceipt(); + if (str_equal(returnpath,"#@[]")) die_noreceipt(); + + if (!quote2(&quoted,returnpath)) die_nomem(); + + if (qmail_open(&qqt) == -1) die_fork(); + + qmail_puts(&qqt,"From: DELIVERY NOTICE SYSTEM <"); + qmail_put(&qqt,quoted.s,quoted.len); + qmail_puts(&qqt,">\n"); + qmail_puts(&qqt,"To: <"); + qmail_put(&qqt,quoted.s,quoted.len); + qmail_puts(&qqt,">\n"); + qmail_puts(&qqt,"Subject: success notice\n\ +\n\ +Hi! This is the qreceipt program. Your message was delivered to the\n\ +following address: "); + qmail_puts(&qqt,target); + qmail_puts(&qqt,". Thanks for asking.\n"); + if (messageid.s) + { + qmail_puts(&qqt,"Your "); + qmail_put(&qqt,messageid.s,messageid.len); + } + + qmail_from(&qqt,""); + qmail_to(&qqt,returnpath); + qqx = qmail_close(&qqt); + + if (*qqx) { + if (*qqx == 'D') die_qqperm(); + else die_qqtemp(); + } +} + +stralloc hfbuf = {0}; +token822_alloc hfin = {0}; +token822_alloc hfrewrite = {0}; +token822_alloc hfaddr = {0}; + +void doheaderfield(h) +stralloc *h; +{ + switch(hfield_known(h->s,h->len)) + { + case H_MESSAGEID: + if (!stralloc_copy(&messageid,h)) die_nomem(); + break; + case H_NOTICEREQUESTEDUPONDELIVERYTO: + doordie(h,token822_parse(&hfin,h,&hfbuf)); + doordie(h,token822_addrlist(&hfrewrite,&hfaddr,&hfin,rwnotice)); + break; + } +} + +void dobody(h) stralloc *h; { ; } + +int main(int argc, char **argv) +{ + sig_pipeignore(); + if (argc == 1) die_usage(); + target = argv[1]; + if (!(returnpath = env_get("SENDER"))) die_usage(); + if (headerbody(subfdin,doheaderfield,finishheader,dobody) == -1) die_read(); + die_noreceipt(); +} diff --git a/src/qsutil.c b/src/qsutil.c @@ -0,0 +1,47 @@ +#include "qsutil.h" + +#include "stralloc.h" +#include "readwrite.h" +#include "substdio.h" + +static stralloc foo = {0}; + +static char errbuf[1]; +static struct substdio sserr = SUBSTDIO_FDBUF(write,0,errbuf,1); + +void logsa(sa) stralloc *sa; { + substdio_putflush(&sserr,sa->s,sa->len); } +void log1(s1) char *s1; { + substdio_putsflush(&sserr,s1); } +void qslog2(char *s1, char *s2) { + substdio_putsflush(&sserr,s1); + substdio_putsflush(&sserr,s2); } +void log3(s1,s2,s3) char *s1; char *s2; char *s3; { + substdio_putsflush(&sserr,s1); + substdio_putsflush(&sserr,s2); + substdio_putsflush(&sserr,s3); } +void nomem() { log1("alert: out of memory, sleeping...\n"); sleep(10); } + +void pausedir(dir) char *dir; +{ log3("alert: unable to opendir ",dir,", sleeping...\n"); sleep(10); } + +static int issafe(ch) char ch; +{ + if (ch == '%') return 0; /* general principle: allman's code is crap */ + if (ch < 33) return 0; + if (ch > 126) return 0; + return 1; +} + +void logsafe(s) char *s; +{ + int i; + while (!stralloc_copys(&foo,s)) nomem(); + for (i = 0;i < foo.len;++i) + if (foo.s[i] == '\n') + foo.s[i] = '/'; + else + if (!issafe(foo.s[i])) + foo.s[i] = '_'; + logsa(&foo); +} diff --git a/src/quote.c b/src/quote.c @@ -0,0 +1,93 @@ +#include "quote.h" + +#include "error.h" +#include "oflops.h" +#include "stralloc.h" +#include "str.h" + +/* +quote() encodes a box as per rfc 821 and rfc 822, +while trying to do as little quoting as possible. +no, 821 and 822 don't have the same encoding. they're not even close. +no special encoding here for bytes above 127. +*/ + +static char ok[128] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +,0,7,0,7,7,7,7,7,0,0,7,7,0,7,7,7 ,7,7,7,7,7,7,7,7,7,7,0,0,0,7,0,7 +,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 ,7,7,7,7,7,7,7,7,7,7,7,0,0,0,7,7 +,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 ,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0 +} ; + +static int doit(saout,sain) +stralloc *saout; +stralloc *sain; +{ + char ch; + int i; + int j; + unsigned int nlen; + + /* make sure the size calculation below does not overflow */ + if (__builtin_mul_overflow(sain->len, 2, &nlen) || + __builtin_add_overflow(nlen, 2, &nlen)) { + errno = error_nomem; + return 0; + } + if (!stralloc_ready(saout,nlen)) return 0; + j = 0; + saout->s[j++] = '"'; + for (i = 0;i < sain->len;++i) + { + ch = sain->s[i]; + if ((ch == '\r') || (ch == '\n') || (ch == '"') || (ch == '\\')) + saout->s[j++] = '\\'; + saout->s[j++] = ch; + } + saout->s[j++] = '"'; + saout->len = j; + return 1; +} + +int quote_need(s,n) +char *s; +unsigned int n; +{ + unsigned char uch; + int i; + if (!n) return 1; + for (i = 0;i < n;++i) + { + uch = s[i]; + if (uch >= 128) return 1; + if (!ok[uch]) return 1; + } + if (s[0] == '.') return 1; + if (s[n - 1] == '.') return 1; + for (i = 0;i < n - 1;++i) if (s[i] == '.') if (s[i + 1] == '.') return 1; + return 0; +} + +int quote(saout,sain) +stralloc *saout; +stralloc *sain; +{ + if (quote_need(sain->s,sain->len)) return doit(saout,sain); + return stralloc_copy(saout,sain); +} + +static stralloc foo = {0}; + +int quote2(sa,s) +stralloc *sa; +char *s; +{ + int j; + if (!*s) return stralloc_copys(sa,s); + j = str_rchr(s,'@'); + if (!stralloc_copys(&foo,s)) return 0; + if (!s[j]) return quote(sa,&foo); + foo.len = j; + if (!quote(sa,&foo)) return 0; + return stralloc_cats(sa,s + j); +} diff --git a/src/rcpthosts.c b/src/rcpthosts.c @@ -0,0 +1,62 @@ +#include "rcpthosts.h" + +#include "case.h" +#include "cdb.h" +#include "byte.h" +#include "open.h" +#include "error.h" +#include "control.h" +#include "constmap.h" +#include "stralloc.h" + +static int flagrh = 0; +static stralloc rh = {0}; +static struct constmap maprh; +static int fdmrh; + +int rcpthosts_init() +{ + flagrh = control_readfile(&rh,"control/rcpthosts",0); + if (flagrh != 1) return flagrh; + if (!constmap_init(&maprh,rh.s,rh.len,0)) return flagrh = -1; + fdmrh = open_read("control/morercpthosts.cdb"); + if (fdmrh == -1) if (errno != error_noent) return flagrh = -1; + return 0; +} + +static stralloc host = {0}; + +int rcpthosts(buf,len) +char *buf; +int len; +{ + int j; + + if (flagrh != 1) return 1; + + j = byte_rchr(buf,len,'@'); + if (j >= len) return 1; /* presumably envnoathost is acceptable */ + + ++j; buf += j; len -= j; + + if (!stralloc_copyb(&host,buf,len)) return -1; + buf = host.s; + case_lowerb(buf,len); + + for (j = 0;j < len;++j) + if (!j || (buf[j] == '.')) + if (constmap(&maprh,buf + j,len - j)) return 1; + + if (fdmrh != -1) { + uint32 dlen; + int r; + + for (j = 0;j < len;++j) + if (!j || (buf[j] == '.')) { + r = cdb_seek(fdmrh,buf + j,len - j,&dlen); + if (r) return r; + } + } + + return 0; +} diff --git a/src/readsubdir.c b/src/readsubdir.c @@ -0,0 +1,50 @@ +#include "readsubdir.h" + +#include "fmt.h" +#include "scan.h" +#include "str.h" +#include "auto_split.h" + +void readsubdir_init(rs,name,pause) +readsubdir *rs; +char *name; +void (*pause)(); +{ + rs->name = name; + rs->pause = pause; + rs->dir = 0; + rs->pos = 0; +} + +static char namepos[FMT_ULONG + 4 + READSUBDIR_NAMELEN]; + +int readsubdir_next(rs,id) +readsubdir *rs; +unsigned long *id; +{ + direntry *d; + unsigned int len; + + if (!rs->dir) + { + if (rs->pos >= auto_split) return 0; + if (str_len(rs->name) > READSUBDIR_NAMELEN) { rs->pos++; return -1; } + len = 0; + len += fmt_str(namepos + len,rs->name); + namepos[len++] = '/'; + len += fmt_ulong(namepos + len,(unsigned long) rs->pos); + namepos[len] = 0; + while (!(rs->dir = opendir(namepos))) rs->pause(namepos); + rs->pos++; + return -1; + } + + d = readdir(rs->dir); + if (!d) { closedir(rs->dir); rs->dir = 0; return -1; } + + if (str_equal(d->d_name,".")) return -1; + if (str_equal(d->d_name,"..")) return -1; + len = scan_ulong(d->d_name,id); + if (!len || d->d_name[len]) return -2; + return 1; +} diff --git a/src/received.c b/src/received.c @@ -0,0 +1,74 @@ +#include "received.h" + +#include "fmt.h" +#include "qmail.h" +#include "now.h" +#include "datetime.h" +#include "date822fmt.h" + +static int issafe(ch) char ch; +{ + if (ch == '.') return 1; + if (ch == '@') return 1; + if (ch == '%') return 1; + if (ch == '+') return 1; + if (ch == '/') return 1; + if (ch == '=') return 1; + if (ch == ':') return 1; + if (ch == '-') return 1; + if ((ch >= 'a') && (ch <= 'z')) return 1; + if ((ch >= 'A') && (ch <= 'Z')) return 1; + if ((ch >= '0') && (ch <= '9')) return 1; + if (ch == '[') return 1; + if (ch == ']') return 1; + return 0; +} + +void safeput(qqt,s) +struct qmail *qqt; +char *s; +{ + char ch; + while ((ch = *s++)) { + if (!issafe(ch)) ch = '?'; + qmail_put(qqt,&ch,1); + } +} + +static char buf[DATE822FMT]; + +/* "Received: from relay1.uu.net (HELO uunet.uu.net) (7@192.48.96.5)\n" */ +/* " by silverton.berkeley.edu with SMTP; 26 Sep 1995 04:46:54 -0000\n" */ + +void received(qqt,protocol,local,remoteip,remotehost,remoteinfo,helo) +struct qmail *qqt; +char *protocol; +char *local; +char *remoteip; +char *remotehost; +char *remoteinfo; +char *helo; +{ + struct datetime dt; + + qmail_puts(qqt,"Received: from "); + safeput(qqt,remotehost); + if (helo) { + qmail_puts(qqt," (HELO "); + safeput(qqt,helo); + qmail_puts(qqt,")"); + } + qmail_puts(qqt," ("); + if (remoteinfo) { + safeput(qqt,remoteinfo); + qmail_puts(qqt,"@"); + } + safeput(qqt,remoteip); + qmail_puts(qqt,")\n by "); + safeput(qqt,local); + qmail_puts(qqt," with "); + qmail_puts(qqt,protocol); + qmail_puts(qqt,"; "); + datetime_tai(&dt,now()); + qmail_put(qqt,buf,date822fmt(buf,&dt)); +} diff --git a/src/remoteinfo.c b/src/remoteinfo.c @@ -0,0 +1,79 @@ +#include "remoteinfo.h" + +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <fcntl.h> +#include <unistd.h> +#include "byte.h" +#include "substdio.h" +#include "ip.h" +#include "fmt.h" +#include "timeoutconn.h" +#include "timeoutread.h" +#include "timeoutwrite.h" + +static char line[999]; +static int t; + +static ssize_t mywrite(int fd, const void *buf, size_t len) +{ + return timeoutwrite(t,fd,buf,len); +} +static ssize_t myread(int fd, void *buf, size_t len) +{ + return timeoutread(t,fd,buf,len); +} + +char *remoteinfo_get(ipr,rp,ipl,lp,timeout) +struct ip_address *ipr; +unsigned long rp; +struct ip_address *ipl; +unsigned long lp; +int timeout; +{ + char *x; + int s; + struct sockaddr_in sin; + substdio ss; + char buf[32]; + unsigned int len; + int numcolons; + char ch; + + t = timeout; + + s = socket(AF_INET,SOCK_STREAM,0); + if (s == -1) return 0; + + byte_zero(&sin,sizeof(sin)); + sin.sin_family = AF_INET; + byte_copy(&sin.sin_addr,4,ipl); + sin.sin_port = 0; + if (bind(s,(struct sockaddr *) &sin,sizeof(sin)) == -1) { close(s); return 0; } + if (timeoutconn(s,ipr,113,timeout) == -1) { close(s); return 0; } + fcntl(s,F_SETFL,fcntl(s,F_GETFL,0) & ~O_NDELAY); + + len = 0; + len += fmt_ulong(line + len,rp); + len += fmt_str(line + len," , "); + len += fmt_ulong(line + len,lp); + len += fmt_str(line + len,"\r\n"); + + substdio_fdbuf(&ss,mywrite,s,buf,sizeof(buf)); + if (substdio_putflush(&ss,line,len) == -1) { close(s); return 0; } + + substdio_fdbuf(&ss,myread,s,buf,sizeof(buf)); + x = line; + numcolons = 0; + for (;;) { + if (substdio_get(&ss,&ch,1) != 1) { close(s); return 0; } + if ((ch == ' ') || (ch == '\t') || (ch == '\r')) continue; + if (ch == '\n') break; + if (numcolons < 3) { if (ch == ':') ++numcolons; } + else { *x++ = ch; if (x == line + sizeof(line) - 1) break; } + } + *x = 0; + close(s); + return line; +} diff --git a/src/scan_8long.c b/src/scan_8long.c @@ -0,0 +1,11 @@ +#include "scan.h" + +unsigned int scan_8long(char *s, unsigned long *u) +{ + unsigned int pos; unsigned long result; + unsigned long c; + pos = 0; result = 0; + while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 8) + { result = result * 8 + c; ++pos; } + *u = result; return pos; +} diff --git a/src/scan_ulong.c b/src/scan_ulong.c @@ -0,0 +1,11 @@ +#include "scan.h" + +unsigned int scan_ulong(char *s, unsigned long *u) +{ + unsigned int pos; unsigned long result; + unsigned long c; + pos = 0; result = 0; + while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 10) + { result = result * 10 + c; ++pos; } + *u = result; return pos; +} diff --git a/src/sendmail.c b/src/sendmail.c @@ -0,0 +1,161 @@ +#include "sgetopt.h" +#include "substdio.h" +#include "subfd.h" +#include "alloc.h" +#include "auto_qmail.h" +#include "exit.h" +#include "env.h" +#include "noreturn.h" +#include "str.h" + +void _noreturn_ nomem() +{ + substdio_putsflush(subfderr,"sendmail: fatal: out of memory\n"); + _exit(111); +} + +void _noreturn_ die_usage() +{ + substdio_putsflush(subfderr,"sendmail: usage: sendmail [ -t ] [ -fsender ] [ -Fname ] [ -bp ] [ -bs ] [ arg ... ]\n"); + _exit(100); +} + +char *smtpdarg[] = { "bin/qmail-smtpd", 0 }; +void _noreturn_ smtpd() +{ + if (!env_get("PROTO")) { + if (!env_put("RELAYCLIENT=")) nomem(); + if (!env_put("DATABYTES=0")) nomem(); + if (!env_put("PROTO=TCP")) nomem(); + if (!env_put("TCPLOCALIP=127.0.0.1")) nomem(); + if (!env_put("TCPLOCALHOST=localhost")) nomem(); + if (!env_put("TCPREMOTEIP=127.0.0.1")) nomem(); + if (!env_put("TCPREMOTEHOST=localhost")) nomem(); + if (!env_put("TCPREMOTEINFO=sendmail-bs")) nomem(); + } + execv(*smtpdarg,smtpdarg); + substdio_putsflush(subfderr,"sendmail: fatal: unable to run qmail-smtpd\n"); + _exit(111); +} + +char *qreadarg[] = { "bin/qmail-qread", 0 }; +void _noreturn_ mailq() +{ + execv(*qreadarg,qreadarg); + substdio_putsflush(subfderr,"sendmail: fatal: unable to run qmail-qread\n"); + _exit(111); +} + +void do_sender(s) +const char *s; +{ + char *x; + unsigned int n; + unsigned int a; + unsigned int i; + + env_unset("QMAILNAME"); + env_unset("MAILNAME"); + env_unset("NAME"); + env_unset("QMAILHOST"); + env_unset("MAILHOST"); + + n = str_len(s); + a = str_rchr(s, '@'); + if (a == n) + { + env_put2("QMAILUSER", s); + return; + } + env_put2("QMAILHOST", s + a + 1); + + x = (char *) alloc((a + 1) * sizeof(char)); + if (!x) nomem(); + for (i = 0; i < a; i++) + x[i] = s[i]; + x[i] = 0; + env_put2("QMAILUSER", x); + alloc_free(x); +} + +int flagh; +char *sender; + +int main(int argc, char **argv) +{ + int opt; + char **qiargv; + char **arg; + int i; + + if (chdir(auto_qmail) == -1) { + substdio_putsflush(subfderr,"sendmail: fatal: unable to switch to qmail home directory\n"); + return 111; + } + + flagh = 0; + sender = 0; + while ((opt = getopt(argc,argv,"vimte:f:p:o:B:F:EJxb:")) != opteof) + switch(opt) { + case 'B': break; + case 't': flagh = 1; break; + case 'f': sender = optarg; break; + case 'F': if (!env_put2("MAILNAME",optarg)) nomem(); break; + case 'p': break; /* could generate a Received line from optarg */ + case 'v': break; + case 'i': break; /* what an absurd concept */ + case 'x': break; /* SVR4 stupidity */ + case 'm': break; /* twisted-paper-path blindness, incompetent design */ + case 'e': break; /* qmail has only one error mode */ + case 'o': + switch(optarg[0]) { + case 'd': break; /* qmail has only one delivery mode */ + case 'e': break; /* see 'e' above */ + case 'i': break; /* see 'i' above */ + case 'm': break; /* see 'm' above */ + } + break; + case 'E': case 'J': /* Sony NEWS-OS */ + while (argv[optind][optpos]) ++optpos; /* skip optional argument */ + break; + case 'b': + switch(optarg[0]) { + case 'm': break; + case 'p': mailq(); + case 's': smtpd(); + default: die_usage(); + } + break; + default: + die_usage(); + } + argc -= optind; + argv += optind; + + if (str_equal(optprogname,"mailq")) + mailq(); + + if (str_equal(optprogname,"newaliases")) { + substdio_putsflush(subfderr,"sendmail: fatal: please use fastforward/newaliases instead\n"); + return 100; + } + + qiargv = (char **) alloc((argc + 10) * sizeof(char *)); + if (!qiargv) nomem(); + + arg = qiargv; + *arg++ = "bin/qmail-inject"; + *arg++ = (flagh ? "-H" : "-a"); + if (sender) { + *arg++ = "-f"; + *arg++ = sender; + do_sender(sender); + } + *arg++ = "--"; + for (i = 0;i < argc;++i) *arg++ = argv[i]; + *arg = 0; + + execv(*qiargv,qiargv); + substdio_putsflush(subfderr,"sendmail: fatal: unable to run qmail-inject\n"); + return 111; +} diff --git a/src/sgetopt.c b/src/sgetopt.c @@ -0,0 +1,55 @@ +/* sgetopt.c, sgetopt.h: (yet another) improved getopt clone, outer layer +D. J. Bernstein, djb@pobox.com. +Depends on subgetopt.h, substdio.h, subfd.h. +No system requirements. +19970208: Cleanups. +931201: Baseline. +No known patent problems. + +Documentation in sgetopt.3. +*/ + +#define SGETOPTNOSHORT +#include "sgetopt.h" + +#include "substdio.h" +#include "subfd.h" +#define SUBGETOPTNOSHORT +#include "subgetopt.h" + +#define getopt sgetoptmine +#define optind subgetoptind +#define opterr sgetopterr +#define optproblem subgetoptproblem +#define optprogname sgetoptprogname + +int opterr = 1; +char *optprogname = 0; + +int getopt(argc,argv,opts) +int argc; +char **argv; +char *opts; +{ + int c; + char *s; + + if (!optprogname) { + optprogname = *argv; + if (!optprogname) optprogname = ""; + for (s = optprogname;*s;++s) if (*s == '/') optprogname = s + 1; + } + c = subgetopt(argc,argv,opts); + if (opterr) + if (c == '?') { + char chp[2]; chp[0] = optproblem; chp[1] = '\n'; + substdio_puts(subfderr,optprogname); + if (argv[optind] && (optind < argc)) + substdio_puts(subfderr,": illegal option -- "); + else + substdio_puts(subfderr,": option requires an argument -- "); + substdio_put(subfderr,chp,2); + substdio_flush(subfderr); + } + return c; +} diff --git a/src/sig_alarm.c b/src/sig_alarm.c @@ -0,0 +1,7 @@ +#include <signal.h> +#include "sig.h" + +void sig_alarmblock() { sig_block(SIGALRM); } +void sig_alarmunblock() { sig_unblock(SIGALRM); } +void sig_alarmcatch(f) void (*f)(); { sig_catch(SIGALRM,f); } +void sig_alarmdefault() { sig_catch(SIGALRM,SIG_DFL); } diff --git a/src/sig_block.c b/src/sig_block.c @@ -0,0 +1,41 @@ +#include <signal.h> +#include <stddef.h> +#include "sig.h" +#include "hassgprm.h" + +void sig_block(sig) +int sig; +{ +#ifdef HASSIGPROCMASK + sigset_t ss; + sigemptyset(&ss); + sigaddset(&ss,sig); + sigprocmask(SIG_BLOCK,&ss,NULL); +#else + sigblock(1 << (sig - 1)); +#endif +} + +void sig_unblock(sig) +int sig; +{ +#ifdef HASSIGPROCMASK + sigset_t ss; + sigemptyset(&ss); + sigaddset(&ss,sig); + sigprocmask(SIG_UNBLOCK,&ss,NULL); +#else + sigsetmask(sigsetmask(~0) & ~(1 << (sig - 1))); +#endif +} + +void sig_blocknone() +{ +#ifdef HASSIGPROCMASK + sigset_t ss; + sigemptyset(&ss); + sigprocmask(SIG_SETMASK,&ss,NULL); +#else + sigsetmask(0); +#endif +} diff --git a/src/sig_bug.c b/src/sig_bug.c @@ -0,0 +1,17 @@ +#include <signal.h> +#include "sig.h" + +void sig_bugcatch(f) void (*f)(); +{ + sig_catch(SIGILL,f); + sig_catch(SIGABRT,f); + sig_catch(SIGFPE,f); + sig_catch(SIGBUS,f); + sig_catch(SIGSEGV,f); +#ifdef SIGSYS + sig_catch(SIGSYS,f); +#endif +#ifdef SIGEMT + sig_catch(SIGEMT,f); +#endif +} diff --git a/src/sig_catch.c b/src/sig_catch.c @@ -0,0 +1,19 @@ +#include <signal.h> +#include <stddef.h> +#include "sig.h" +#include "hassgact.h" + +void sig_catch(sig,f) +int sig; +void (*f)(); +{ +#ifdef HASSIGACTION + struct sigaction sa; + sa.sa_handler = f; + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); + sigaction(sig,&sa,NULL); +#else + signal(sig,f); /* won't work under System V, even nowadays---dorks */ +#endif +} diff --git a/src/sig_child.c b/src/sig_child.c @@ -0,0 +1,7 @@ +#include <signal.h> +#include "sig.h" + +void sig_childblock() { sig_block(SIGCHLD); } +void sig_childunblock() { sig_unblock(SIGCHLD); } +void sig_childcatch(f) void (*f)(); { sig_catch(SIGCHLD,f); } +void sig_childdefault() { sig_catch(SIGCHLD,SIG_DFL); } diff --git a/src/sig_hup.c b/src/sig_hup.c @@ -0,0 +1,7 @@ +#include <signal.h> +#include "sig.h" + +void sig_hangupblock() { sig_block(SIGHUP); } +void sig_hangupunblock() { sig_unblock(SIGHUP); } +void sig_hangupcatch(f) void (*f)(); { sig_catch(SIGHUP,f); } +void sig_hangupdefault() { sig_catch(SIGHUP,SIG_DFL); } diff --git a/src/sig_misc.c b/src/sig_misc.c @@ -0,0 +1,17 @@ +#include <signal.h> +#include "sig.h" + +void sig_miscignore() +{ + sig_catch(SIGVTALRM,SIG_IGN); + sig_catch(SIGPROF,SIG_IGN); + sig_catch(SIGQUIT,SIG_IGN); + sig_catch(SIGINT,SIG_IGN); + sig_catch(SIGHUP,SIG_IGN); +#ifdef SIGXCPU + sig_catch(SIGXCPU,SIG_IGN); +#endif +#ifdef SIGXFSZ + sig_catch(SIGXFSZ,SIG_IGN); +#endif +} diff --git a/src/sig_pause.c b/src/sig_pause.c @@ -0,0 +1,14 @@ +#include <signal.h> +#include "sig.h" +#include "hassgprm.h" + +void sig_pause() +{ +#ifdef HASSIGPROCMASK + sigset_t ss; + sigemptyset(&ss); + sigsuspend(&ss); +#else + sigpause(0); +#endif +} diff --git a/src/sig_pipe.c b/src/sig_pipe.c @@ -0,0 +1,5 @@ +#include <signal.h> +#include "sig.h" + +void sig_pipeignore() { sig_catch(SIGPIPE,SIG_IGN); } +void sig_pipedefault() { sig_catch(SIGPIPE,SIG_DFL); } diff --git a/src/sig_term.c b/src/sig_term.c @@ -0,0 +1,7 @@ +#include <signal.h> +#include "sig.h" + +void sig_termblock() { sig_block(SIGTERM); } +void sig_termunblock() { sig_unblock(SIGTERM); } +void sig_termcatch(f) void (*f)(); { sig_catch(SIGTERM,f); } +void sig_termdefault() { sig_catch(SIGTERM,SIG_DFL); } diff --git a/src/slurpclose.c b/src/slurpclose.c @@ -0,0 +1,20 @@ +#include "slurpclose.h" + +#include "stralloc.h" +#include "readwrite.h" +#include "error.h" + +int slurpclose(fd,sa,bufsize) +int fd; +stralloc *sa; +int bufsize; +{ + int r; + for (;;) { + if (!stralloc_readyplus(sa,bufsize)) { close(fd); return -1; } + r = read(fd,sa->s + sa->len,bufsize); + if (r == -1) if (errno == error_intr) continue; + if (r == 0 || r == -1) { close(fd); return r; } + sa->len += r; + } +} diff --git a/src/spawn.c b/src/spawn.c @@ -0,0 +1,257 @@ +#include "spawn.h" + +#include <sys/types.h> +#include <sys/stat.h> +#include "sig.h" +#include "wait.h" +#include "substdio.h" +#include "byte.h" +#include "str.h" +#include "alloc.h" +#include "stralloc.h" +#include "select.h" +#include "exit.h" +#include "coe.h" +#include "open.h" +#include "error.h" +#include "auto_qmail.h" +#include "auto_uids.h" +#include "auto_spawn.h" + +uid_t auto_uidq; + +struct delivery + { + int used; + int fdin; /* pipe input */ + int pid; /* zero if child is dead */ + int wstat; /* if !pid: status of child */ + int fdout; /* pipe output, -1 if !pid; delays eof until after death */ + stralloc output; + } +; + +struct delivery *d; + +void sigchld() +{ + int wstat; + int pid; + int i; + while ((pid = wait_nohang(&wstat)) > 0) + for (i = 0;i < auto_spawn;++i) if (d[i].used) + if (d[i].pid == pid) + { + close(d[i].fdout); d[i].fdout = -1; + d[i].wstat = wstat; d[i].pid = 0; + } +} + +int flagwriting = 1; + +ssize_t okwrite(int fd, const void *buf, size_t n) +{ + int w; + if (!flagwriting) return n; + w = write(fd,buf,n); + if (w != -1) return w; + if (errno == error_intr) return -1; + flagwriting = 0; close(fd); + return n; +} + +int flagreading = 1; +char outbuf[1024]; substdio ssout; + +int stage = 0; /* reading 0:delnum 1:messid 2:sender 3:recip */ +int flagabort = 0; /* if 1, everything except delnum is garbage */ +int delnum; +stralloc messid = {0}; +stralloc sender = {0}; +stralloc recip = {0}; + +void err(s) char *s; +{ + char ch; ch = delnum; substdio_put(&ssout,&ch,1); + substdio_puts(&ssout,s); substdio_putflush(&ssout,"",1); +} + +void docmd() +{ + int f; + int i; + int j; + int fdmess; + int pi[2]; + struct stat st; + + if (flagabort) { err("Zqmail-spawn out of memory. (#4.3.0)\n"); return; } + if (delnum < 0) { err("ZInternal error: delnum negative. (#4.3.5)\n"); return; } + if (delnum >= auto_spawn) { err("ZInternal error: delnum too big. (#4.3.5)\n"); return; } + if (d[delnum].used) { err("ZInternal error: delnum in use. (#4.3.5)\n"); return; } + for (i = 0;i < messid.len;++i) + if (messid.s[i]) + if (!i || (messid.s[i] != '/')) + if ((unsigned char) (messid.s[i] - '0') > 9) + { err("DInternal error: messid has nonnumerics. (#5.3.5)\n"); return; } + if (messid.len > 100) { err("DInternal error: messid too long. (#5.3.5)\n"); return; } + if (!messid.s[0]) { err("DInternal error: messid too short. (#5.3.5)\n"); return; } + + if (!stralloc_copys(&d[delnum].output,"")) + { err("Zqmail-spawn out of memory. (#4.3.0)\n"); return; } + + j = byte_rchr(recip.s,recip.len,'@'); + if (j >= recip.len) { err("DSorry, address must include host name. (#5.1.3)\n"); return; } + + fdmess = open_read(messid.s); + if (fdmess == -1) { err("Zqmail-spawn unable to open message. (#4.3.0)\n"); return; } + + if (fstat(fdmess,&st) == -1) + { close(fdmess); err("Zqmail-spawn unable to fstat message. (#4.3.0)\n"); return; } + if ((st.st_mode & S_IFMT) != S_IFREG) + { close(fdmess); err("ZSorry, message has wrong type. (#4.3.5)\n"); return; } + if (st.st_uid != auto_uidq) /* aaack! qmailq has to be trusted! */ + /* your security is already toast at this point. damage control... */ + { close(fdmess); err("ZSorry, message has wrong owner. (#4.3.5)\n"); return; } + + if (pipe(pi) == -1) + { close(fdmess); err("Zqmail-spawn unable to create pipe. (#4.3.0)\n"); return; } + + coe(pi[0]); + + f = spawn(fdmess,pi[1],sender.s,recip.s,j); + close(fdmess); + if (f == -1) + { close(pi[0]); close(pi[1]); err("Zqmail-spawn unable to fork. (#4.3.0)\n"); return; } + + d[delnum].fdin = pi[0]; + d[delnum].fdout = pi[1]; coe(pi[1]); + d[delnum].pid = f; + d[delnum].used = 1; +} + +char cmdbuf[1024]; + +void getcmd() +{ + int i; + int r; + char ch; + + r = read(0,cmdbuf,sizeof(cmdbuf)); + if (r == 0) + { flagreading = 0; return; } + if (r == -1) + { + if (errno != error_intr) + flagreading = 0; + return; + } + + for (i = 0;i < r;++i) + { + ch = cmdbuf[i]; + switch(stage) + { + case 0: + delnum = (unsigned int) (unsigned char) ch; + messid.len = 0; stage = 1; break; + case 1: + if (!stralloc_append(&messid,&ch)) flagabort = 1; + if (ch) break; + sender.len = 0; stage = 2; break; + case 2: + if (!stralloc_append(&sender,&ch)) flagabort = 1; + if (ch) break; + recip.len = 0; stage = 3; break; + case 3: + if (!stralloc_append(&recip,&ch)) flagabort = 1; + if (ch) break; + docmd(); + flagabort = 0; stage = 0; break; + } + } +} + +char inbuf[128]; + +int main(int argc, char **argv) +{ + char ch; + int i; + int r; + fd_set rfds; + int nfds; + + if (chdir(auto_qmail) == -1) _exit(111); + if (chdir("queue/mess") == -1) _exit(111); + if (!stralloc_copys(&messid,"")) _exit(111); + if (!stralloc_copys(&sender,"")) _exit(111); + if (!stralloc_copys(&recip,"")) _exit(111); + + d = (struct delivery *) alloc((auto_spawn + 10) * sizeof(struct delivery)); + if (!d) _exit(111); + + substdio_fdbuf(&ssout,okwrite,1,outbuf,sizeof(outbuf)); + + sig_pipeignore(); + sig_childcatch(sigchld); + + initialize(argc,argv); + + ch = auto_spawn; substdio_putflush(&ssout,&ch,1); + + for (i = 0;i < auto_spawn;++i) { d[i].used = 0; d[i].output.s = 0; } + + for (;;) + { + if (!flagreading) + { + for (i = 0;i < auto_spawn;++i) if (d[i].used) break; + if (i >= auto_spawn) _exit(0); + } + sig_childunblock(); + + FD_ZERO(&rfds); + if (flagreading) FD_SET(0,&rfds); + nfds = 1; + for (i = 0;i < auto_spawn;++i) if (d[i].used) + { FD_SET(d[i].fdin,&rfds); if (d[i].fdin >= nfds) nfds = d[i].fdin + 1; } + + r = select(nfds,&rfds,NULL,NULL,NULL); + sig_childblock(); + + if (r != -1) + { + if (flagreading) + if (FD_ISSET(0,&rfds)) + getcmd(); + for (i = 0;i < auto_spawn;++i) if (d[i].used) + if (FD_ISSET(d[i].fdin,&rfds)) + { + r = read(d[i].fdin,inbuf,128); + if (r == -1) + continue; /* read error on a readable pipe? be serious */ + if (r == 0) + { + ch = i; substdio_put(&ssout,&ch,1); + report(&ssout,d[i].wstat,d[i].output.s,d[i].output.len); + substdio_put(&ssout,"",1); + substdio_flush(&ssout); + close(d[i].fdin); d[i].used = 0; + continue; + } + while (!stralloc_readyplus(&d[i].output,r)) sleep(10); /*XXX*/ + byte_copy(d[i].output.s + d[i].output.len,r,inbuf); + d[i].output.len += r; + if (truncreport > 100) + if (d[i].output.len > truncreport) + { + char *truncmess = "\nError report too long, sorry.\n"; + d[i].output.len = truncreport - str_len(truncmess) - 3; + stralloc_cats(&d[i].output,truncmess); + } + } + } + } +} diff --git a/src/splogger.c b/src/splogger.c @@ -0,0 +1,70 @@ +#include <sys/types.h> +#include <sys/time.h> +#include <syslog.h> +#include "error.h" +#include "substdio.h" +#include "subfd.h" +#include "exit.h" +#include "str.h" +#include "scan.h" +#include "fmt.h" + +char buf[800]; /* syslog truncates long lines (or crashes); GPACIC */ +int bufpos = 0; /* 0 <= bufpos < sizeof(buf) */ +int flagcont = 0; +int priority; /* defined if flagcont */ +char stamp[FMT_ULONG + FMT_ULONG + 3]; /* defined if flagcont */ + +void stamp_make() +{ + struct timeval tv; + char *s; + gettimeofday(&tv,NULL); + s = stamp; + s += fmt_ulong(s,(unsigned long) tv.tv_sec); + *s++ = '.'; + s += fmt_uint0(s,(unsigned int) tv.tv_usec,6); + *s = 0; +} + +void flush() +{ + if (bufpos) { + buf[bufpos] = 0; + if (flagcont) + syslog(priority,"%s+%s",stamp,buf); /* logger folds invisibly; GPACIC */ + else { + stamp_make(); + priority = LOG_INFO; + if (str_start(buf,"warning:")) priority = LOG_WARNING; + if (str_start(buf,"alert:")) priority = LOG_ALERT; + syslog(priority,"%s %s",stamp,buf); + flagcont = 1; + } + } + bufpos = 0; +} + +int main(int argc, char **argv) +{ + char ch; + + if (argc > 1) + if (argc > 2) { + unsigned long facility; + scan_ulong(argv[2],&facility); + openlog(argv[1],0,facility << 3); + } + else + openlog(argv[1],0,LOG_MAIL); + else + openlog("splogger",0,LOG_MAIL); + + for (;;) { + if (substdio_get(subfdin,&ch,1) < 1) _exit(0); + if (ch == '\n') { flush(); flagcont = 0; continue; } + if (bufpos == sizeof(buf) - 1) flush(); + if ((ch < 32) || (ch > 126)) ch = '?'; /* logger truncates at 0; GPACIC */ + buf[bufpos++] = ch; + } +} diff --git a/src/str_chr.c b/src/str_chr.c @@ -0,0 +1,17 @@ +#include "str.h" + +unsigned int str_chr(char *s, int c) +{ + char ch; + char *t; + + ch = c; + t = s; + for (;;) { + if (!*t) break; if (*t == ch) break; ++t; + if (!*t) break; if (*t == ch) break; ++t; + if (!*t) break; if (*t == ch) break; ++t; + if (!*t) break; if (*t == ch) break; ++t; + } + return t - s; +} diff --git a/src/str_rchr.c b/src/str_rchr.c @@ -0,0 +1,20 @@ +#include "str.h" + +unsigned int str_rchr(char *s, int c) +{ + char ch; + char *t; + char *u; + + ch = c; + t = s; + u = 0; + for (;;) { + if (!*t) break; if (*t == ch) u = t; ++t; + if (!*t) break; if (*t == ch) u = t; ++t; + if (!*t) break; if (*t == ch) u = t; ++t; + if (!*t) break; if (*t == ch) u = t; ++t; + } + if (!u) u = t; + return u - s; +} diff --git a/src/str_start.c b/src/str_start.c @@ -0,0 +1,13 @@ +#include "str.h" + +int str_start(char *s, char *t) +{ + char x; + + for (;;) { + x = *t++; if (!x) return 1; if (x != *s++) return 0; + x = *t++; if (!x) return 1; if (x != *s++) return 0; + x = *t++; if (!x) return 1; if (x != *s++) return 0; + x = *t++; if (!x) return 1; if (x != *s++) return 0; + } +} diff --git a/src/stralloc_arts.c b/src/stralloc_arts.c @@ -0,0 +1,12 @@ +#include "byte.h" +#include "str.h" +#include "stralloc.h" + +int stralloc_starts(sa,s) +stralloc *sa; +char *s; +{ + unsigned int len; + len = str_len(s); + return (sa->len >= len) && byte_equal(s,len,sa->s); +} diff --git a/src/stralloc_cat.c b/src/stralloc_cat.c @@ -0,0 +1,9 @@ +#include "byte.h" +#include "stralloc.h" + +int stralloc_cat(sato,safrom) +stralloc *sato; +stralloc *safrom; +{ + return stralloc_catb(sato,safrom->s,safrom->len); +} diff --git a/src/stralloc_catb.c b/src/stralloc_catb.c @@ -0,0 +1,22 @@ +#include "stralloc.h" +#include "byte.h" +#include "error.h" +#include "oflops.h" + +int stralloc_catb(sa,s,n) +stralloc *sa; +char *s; +unsigned int n; +{ + unsigned int i; + if (!sa->s) return stralloc_copyb(sa,s,n); + if (__builtin_add_overflow(n, 1, &i)) { + errno = error_nomem; + return 0; + } + if (!stralloc_readyplus(sa,i)) return 0; + byte_copy(sa->s + sa->len,n,s); + sa->len += n; + sa->s[sa->len] = 'Z'; /* ``offensive programming'' */ + return 1; +} diff --git a/src/stralloc_cats.c b/src/stralloc_cats.c @@ -0,0 +1,10 @@ +#include "byte.h" +#include "str.h" +#include "stralloc.h" + +int stralloc_cats(sa,s) +stralloc *sa; +char *s; +{ + return stralloc_catb(sa,s,str_len(s)); +} diff --git a/src/stralloc_copy.c b/src/stralloc_copy.c @@ -0,0 +1,9 @@ +#include "byte.h" +#include "stralloc.h" + +int stralloc_copy(sato,safrom) +stralloc *sato; +stralloc *safrom; +{ + return stralloc_copyb(sato,safrom->s,safrom->len); +} diff --git a/src/stralloc_eady.c b/src/stralloc_eady.c @@ -0,0 +1,5 @@ +#include "stralloc.h" +#include "gen_allocdefs.h" + +GEN_ALLOC_readyplus(stralloc,char,s,len,a,30,stralloc_readyplus) +GEN_ALLOC_ready(stralloc,char,s,len,a,30,stralloc_ready) diff --git a/src/stralloc_opyb.c b/src/stralloc_opyb.c @@ -0,0 +1,21 @@ +#include "stralloc.h" +#include "byte.h" +#include "error.h" +#include "oflops.h" + +int stralloc_copyb(sa,s,n) +stralloc *sa; +char *s; +unsigned int n; +{ + unsigned int i; + if (__builtin_add_overflow(n, 1, &i)) { + errno = error_nomem; + return 0; + } + if (!stralloc_ready(sa,i)) return 0; + byte_copy(sa->s,n,s); + sa->len = n; + sa->s[n] = 'Z'; /* ``offensive programming'' */ + return 1; +} diff --git a/src/stralloc_opys.c b/src/stralloc_opys.c @@ -0,0 +1,10 @@ +#include "byte.h" +#include "str.h" +#include "stralloc.h" + +int stralloc_copys(sa,s) +stralloc *sa; +char *s; +{ + return stralloc_copyb(sa,s,str_len(s)); +} diff --git a/src/stralloc_pend.c b/src/stralloc_pend.c @@ -0,0 +1,4 @@ +#include "stralloc.h" +#include "gen_allocdefs.h" + +GEN_ALLOC_append(stralloc,char,s,len,a,30,stralloc_readyplus,stralloc_append) diff --git a/src/strerr_die.c b/src/strerr_die.c @@ -0,0 +1,37 @@ +#include "substdio.h" +#include "subfd.h" +#include "exit.h" +#include "strerr.h" + +void strerr_warn(x1,x2,x3,x4,x5,x6,se) +char *x1; char *x2; char *x3; char *x4; char *x5; char *x6; +struct strerr *se; +{ + strerr_sysinit(); + + if (x1) substdio_puts(subfderr,x1); + if (x2) substdio_puts(subfderr,x2); + if (x3) substdio_puts(subfderr,x3); + if (x4) substdio_puts(subfderr,x4); + if (x5) substdio_puts(subfderr,x5); + if (x6) substdio_puts(subfderr,x6); + + while(se) { + if (se->x) substdio_puts(subfderr,se->x); + if (se->y) substdio_puts(subfderr,se->y); + if (se->z) substdio_puts(subfderr,se->z); + se = se->who; + } + + substdio_puts(subfderr,"\n"); + substdio_flush(subfderr); +} + +void strerr_die(e,x1,x2,x3,x4,x5,x6,se) +int e; +char *x1; char *x2; char *x3; char *x4; char *x5; char *x6; +struct strerr *se; +{ + strerr_warn(x1,x2,x3,x4,x5,x6,se); + _exit(e); +} diff --git a/src/strerr_sys.c b/src/strerr_sys.c @@ -0,0 +1,13 @@ +#include "error.h" +#include "strerr.h" + +/* explicit initialization due to linker error on Mac OS X. dorks. */ +struct strerr strerr_sys = {0,0,0,0}; + +void strerr_sysinit() +{ + strerr_sys.who = 0; + strerr_sys.x = error_str(errno); + strerr_sys.y = ""; + strerr_sys.z = ""; +} diff --git a/src/subfderr.c b/src/subfderr.c @@ -0,0 +1,7 @@ +#include "readwrite.h" +#include "substdio.h" +#include "subfd.h" + +char subfd_errbuf[256]; +static substdio it = SUBSTDIO_FDBUF(write,2,subfd_errbuf,256); +substdio *subfderr = &it; diff --git a/src/subfdin.c b/src/subfdin.c @@ -0,0 +1,13 @@ +#include "readwrite.h" +#include "substdio.h" +#include "subfd.h" + +ssize_t subfd_read(int fd, void *buf, size_t len) +{ + if (substdio_flush(subfdout) == -1) return -1; + return read(fd,buf,len); +} + +char subfd_inbuf[SUBSTDIO_INSIZE]; +static substdio it = SUBSTDIO_FDBUF(subfd_read,0,subfd_inbuf,SUBSTDIO_INSIZE); +substdio *subfdin = &it; diff --git a/src/subfdins.c b/src/subfdins.c @@ -0,0 +1,13 @@ +#include "readwrite.h" +#include "substdio.h" +#include "subfd.h" + +ssize_t subfd_readsmall(int fd, void *buf, size_t len) +{ + if (substdio_flush(subfdoutsmall) == -1) return -1; + return read(fd,buf,len); +} + +char subfd_inbufsmall[256]; +static substdio it = SUBSTDIO_FDBUF(subfd_readsmall,0,subfd_inbufsmall,256); +substdio *subfdinsmall = &it; diff --git a/src/subfdout.c b/src/subfdout.c @@ -0,0 +1,7 @@ +#include "readwrite.h" +#include "substdio.h" +#include "subfd.h" + +char subfd_outbuf[SUBSTDIO_OUTSIZE]; +static substdio it = SUBSTDIO_FDBUF(write,1,subfd_outbuf,SUBSTDIO_OUTSIZE); +substdio *subfdout = &it; diff --git a/src/subfdouts.c b/src/subfdouts.c @@ -0,0 +1,7 @@ +#include "readwrite.h" +#include "substdio.h" +#include "subfd.h" + +char subfd_outbufsmall[256]; +static substdio it = SUBSTDIO_FDBUF(write,1,subfd_outbufsmall,256); +substdio *subfdoutsmall = &it; diff --git a/src/subgetopt.c b/src/subgetopt.c @@ -0,0 +1,79 @@ +/* subgetopt.c, subgetopt.h: (yet another) improved getopt clone, inner layer +D. J. Bernstein, djb@pobox.com. +No dependencies. +No system requirements. +19970228: Cleanups. +931129: Adapted from getopt.c. +No known patent problems. + +Documentation in subgetopt.3. +*/ + +#define SUBGETOPTNOSHORT +#include "subgetopt.h" + +#define sgopt subgetopt +#define optind subgetoptind +#define optpos subgetoptpos +#define optarg subgetoptarg +#define optproblem subgetoptproblem +#define optdone subgetoptdone + +int optind = 1; +int optpos = 0; +char *optarg = 0; +int optproblem = 0; +int optdone = SUBGETOPTDONE; + +int sgopt(argc,argv,opts) +int argc; +char **argv; +char *opts; +{ + int c; + char *s; + + optarg = 0; + if (!argv || (optind >= argc) || !argv[optind]) return optdone; + if (optpos && !argv[optind][optpos]) { + ++optind; + optpos = 0; + if ((optind >= argc) || !argv[optind]) return optdone; + } + if (!optpos) { + if (argv[optind][0] != '-') return optdone; + ++optpos; + c = argv[optind][1]; + if ((c == '-') || (c == 0)) { + if (c) ++optind; + optpos = 0; + return optdone; + } + /* otherwise c is reassigned below */ + } + c = argv[optind][optpos]; + ++optpos; + s = opts; + while (*s) { + if (c == *s) { + if (s[1] == ':') { + optarg = argv[optind] + optpos; + ++optind; + optpos = 0; + if (!*optarg) { + optarg = argv[optind]; + if ((optind >= argc) || !optarg) { /* argument past end */ + optproblem = c; + return '?'; + } + ++optind; + } + } + return c; + } + ++s; + if (*s == ':') ++s; + } + optproblem = c; + return '?'; +} diff --git a/src/substdi.c b/src/substdi.c @@ -0,0 +1,77 @@ +#include "substdio.h" +#include "byte.h" +#include "error.h" + +static ssize_t oneread(ssize_t (*op)(), int fd, char *buf, size_t len) +{ + for (;;) { + ssize_t r = op(fd,buf,len); + if (r == -1) if (errno == error_intr) continue; + return r; + } +} + +static int getthis(substdio *s, char *buf, int len) +{ + int r; + int q; + + r = s->p; + q = r - len; + if (q > 0) { r = len; s->p = q; } else s->p = 0; + byte_copy(buf,r,s->x + s->n); + s->n += r; + return r; +} + +ssize_t substdio_feed(substdio *s) +{ + ssize_t r; + int q; + + if (s->p) return s->p; + q = s->n; + r = oneread(s->op,s->fd,s->x,q); + if (r == 0 || r == -1) return r; + s->p = r; + q -= r; + s->n = q; + if (q > 0) /* damn, gotta shift */ byte_copyr(s->x + q,r,s->x); + return r; +} + +#ifdef DEPRECATED_FUNCTIONS_AVAILABLE +// might read fewer bytes than _get(); otherwise identical +ssize_t substdio_bget(substdio *s, char *buf, size_t len) +{ + ssize_t r; + + if (s->p > 0) return getthis(s,buf,len); + r = s->n; if (r <= len) return oneread(s->op,s->fd,buf,r); + r = substdio_feed(s); + if (r == 0 || r == -1) return r; + return getthis(s,buf,len); +} +#endif + +ssize_t substdio_get(substdio *s, char *buf, size_t len) +{ + ssize_t r; + + if (s->p > 0) return getthis(s,buf,len); + r = s->n; if (r <= len) return oneread(s->op,s->fd,buf,len); + r = substdio_feed(s); + if (r == 0 || r == -1) return r; + return getthis(s,buf,len); +} + +char *substdio_peek(substdio *s) +{ + return s->x + s->n; +} + +void substdio_seek(substdio *s, int len) +{ + s->n += len; + s->p -= len; +} diff --git a/src/substdio.c b/src/substdio.c @@ -0,0 +1,10 @@ +#include "substdio.h" + +void substdio_fdbuf(substdio *s, ssize_t (*op)(), int fd, char *buf, int len) +{ + s->x = buf; + s->fd = fd; + s->op = op; + s->p = 0; + s->n = len; +} diff --git a/src/substdio_copy.c b/src/substdio_copy.c @@ -0,0 +1,16 @@ +#include "substdio.h" + +int substdio_copy(substdio *ssout, substdio *ssin) +{ + char *x; + + for (;;) { + ssize_t n; + n = substdio_feed(ssin); + if (n < 0) return -2; + if (!n) return 0; + x = substdio_PEEK(ssin); + if (substdio_put(ssout,x,n) == -1) return -3; + substdio_SEEK(ssin,n); + } +} diff --git a/src/substdo.c b/src/substdo.c @@ -0,0 +1,93 @@ +#include "substdio.h" +#include "str.h" +#include "byte.h" +#include "error.h" + +static int allwrite(ssize_t (*op)(), int fd, char *buf, size_t len) +{ + ssize_t w; + + while (len) { + w = op(fd,buf,len); + if (w == -1) { + if (errno == error_intr) continue; + return -1; /* note that some data may have been written */ + } + /* if (w == 0), luser's fault */ + buf += w; + len -= w; + } + return 0; +} + +int substdio_flush(substdio *s) +{ + int p; + + p = s->p; + if (!p) return 0; + s->p = 0; + return allwrite(s->op,s->fd,s->x,p); +} + +int substdio_bput(substdio *s, char *buf, size_t len) +{ + unsigned int n; + + while (len > (n = s->n - s->p)) { + byte_copy(s->x + s->p,n,buf); + s->p += n; + buf += n; + len -= n; + if (substdio_flush(s) == -1) return -1; + } + /* now len <= s->n - s->p */ + byte_copy(s->x + s->p,len,buf); + s->p += len; + return 0; +} + +int substdio_put(substdio *s, char *buf, size_t len) +{ + unsigned int n = s->n; /* how many bytes to write in next chunk */ + + /* check if the input would fit in the buffer without flushing */ + if (len > n - (unsigned int)s->p) { + if (substdio_flush(s) == -1) return -1; + /* now s->p == 0 */ + if (n < SUBSTDIO_OUTSIZE) n = SUBSTDIO_OUTSIZE; + /* as long as the remainder would not fit into s->x write it directly + * from buf to s->fd. */ + while (len > (unsigned int)s->n) { + if (n > len) n = len; + if (allwrite(s->op,s->fd,buf,n) == -1) return -1; + buf += n; + len -= n; + } + } + /* now len <= s->n - s->p */ + byte_copy(s->x + s->p,len,buf); + s->p += len; + return 0; +} + +int substdio_putflush(substdio *s, char *buf, size_t len) +{ + if (substdio_flush(s) == -1) return -1; + return allwrite(s->op,s->fd,buf,len); +} + +int substdio_bputs(substdio *s, char *buf) +{ + return substdio_bput(s,buf,str_len(buf)); +} + +int substdio_puts(substdio *s, char *buf) +{ + return substdio_put(s,buf,str_len(buf)); +} + +int substdio_putsflush(substdio *s, char *buf) +{ + return substdio_putflush(s,buf,str_len(buf)); +} diff --git a/src/tcp-env.c b/src/tcp-env.c @@ -0,0 +1,128 @@ +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/param.h> +#include <netinet/in.h> +#include "noreturn.h" +#include "sig.h" +#include "stralloc.h" +#include "str.h" +#include "env.h" +#include "fmt.h" +#include "scan.h" +#include "subgetopt.h" +#include "ip.h" +#include "dns.h" +#include "byte.h" +#include "remoteinfo.h" +#include "exit.h" +#include "case.h" + +void _noreturn_ die() { _exit(111); } + +struct sockaddr_in salocal; +unsigned long localport; +struct ip_address iplocal; +stralloc localname = {0}; + +struct sockaddr_in saremote; +unsigned long remoteport; +struct ip_address ipremote; +stralloc remotename = {0}; + +char temp[IPFMT + FMT_ULONG]; + +int main(int argc, char **argv) +{ + unsigned int dummy; + char *proto; + int opt; + int flagremoteinfo; + unsigned long timeout; + + sig_pipeignore(); + + flagremoteinfo = 1; + timeout = 30; + while ((opt = sgopt(argc,argv,"rRt:")) != sgoptdone) + switch(opt) + { + case 'r': flagremoteinfo = 1; break; + case 'R': flagremoteinfo = 0; break; + case 't': scan_ulong(sgoptarg,&timeout); break; + } + + argv += sgoptind; + argc -= sgoptind; + + if (argc < 1) die(); + if (!env_init()) die(); + + proto = env_get("PROTO"); + if (!proto || str_diff(proto,"TCP")) + { + if (!env_put("PROTO=TCP")) die(); + + dummy = sizeof(salocal); + if (getsockname(0,(struct sockaddr *) &salocal,&dummy) == -1) die(); + + localport = ntohs(salocal.sin_port); + temp[fmt_ulong(temp,localport)] = 0; + if (!env_put2("TCPLOCALPORT",temp)) die(); + + byte_copy(&iplocal,4,&salocal.sin_addr); + temp[ip_fmt(temp,&iplocal)] = 0; + if (!env_put2("TCPLOCALIP",temp)) die(); + + switch(dns_ptr(&localname,&iplocal)) + { + case DNS_MEM: die(); + case DNS_SOFT: + if (!stralloc_copys(&localname,"softdnserror")) die(); + case 0: + if (!stralloc_0(&localname)) die(); + case_lowers(localname.s); + if (!env_put2("TCPLOCALHOST",localname.s)) die(); + break; + default: + if (!env_unset("TCPLOCALHOST")) die(); + } + + dummy = sizeof(saremote); + if (getpeername(0,(struct sockaddr *) &saremote,&dummy) == -1) die(); + + remoteport = ntohs(saremote.sin_port); + temp[fmt_ulong(temp,remoteport)] = 0; + if (!env_put2("TCPREMOTEPORT",temp)) die(); + + byte_copy(&ipremote,4,&saremote.sin_addr); + temp[ip_fmt(temp,&ipremote)] = 0; + if (!env_put2("TCPREMOTEIP",temp)) die(); + + switch(dns_ptr(&remotename,&ipremote)) + { + case DNS_MEM: die(); + case DNS_SOFT: + if (!stralloc_copys(&remotename,"softdnserror")) die(); + case 0: + if (!stralloc_0(&remotename)) die(); + case_lowers(remotename.s); + if (!env_put2("TCPREMOTEHOST",remotename.s)) die(); + break; + default: + if (!env_unset("TCPREMOTEHOST")) die(); + } + + if (!env_unset("TCPREMOTEINFO")) die(); + if (flagremoteinfo) + { + char *rinfo; + rinfo = remoteinfo_get(&ipremote,remoteport,&iplocal,localport,(int) timeout); + if (rinfo) + if (!env_put2("TCPREMOTEINFO",rinfo)) die(); + } + } + + sig_pipedefault(); + execvp(*argv,argv); + die(); +} diff --git a/src/tcpto.c b/src/tcpto.c @@ -0,0 +1,164 @@ +#include "tcpto.h" + +#include "open.h" +#include "lock.h" +#include "seek.h" +#include "now.h" +#include "ip.h" +#include "byte.h" +#include "datetime.h" +#include "readwrite.h" + +char tcpto_buf[1024]; + +static int flagwasthere; +static int fdlock; + +static int getbuf() +{ + int r; + int fd; + + fdlock = open_write("queue/lock/tcpto"); + if (fdlock == -1) return 0; + fd = open_read("queue/lock/tcpto"); + if (fd == -1) { close(fdlock); return 0; } + if (lock_ex(fdlock) == -1) { close(fdlock); close(fd); return 0; } + r = read(fd,tcpto_buf,sizeof(tcpto_buf)); + close(fd); + if (r == -1) { close(fdlock); return 0; } + r >>= 4; + if (!r) close(fdlock); + return r; +} + +int tcpto(ip) struct ip_address *ip; +{ + int n; + int i; + char *record; + + flagwasthere = 0; + + n = getbuf(); + if (!n) return 0; + close(fdlock); + + record = tcpto_buf; + for (i = 0;i < n;++i) + { + if (byte_equal(ip->d,4,record)) + { + flagwasthere = 1; + if (record[4] >= 2) + { + datetime_sec when = (unsigned long) (unsigned char) record[11]; + when = (when << 8) + (unsigned long) (unsigned char) record[10]; + when = (when << 8) + (unsigned long) (unsigned char) record[9]; + when = (when << 8) + (unsigned long) (unsigned char) record[8]; + + if (now() - when < ((60 + (getpid() & 31)) << 6)) + return 1; + } + return 0; + } + record += 16; + } + return 0; +} + +void tcpto_err(ip,flagerr) struct ip_address *ip; int flagerr; +{ + int n; + int i; + char *record; + datetime_sec when; + datetime_sec lastwhen; + + if (!flagerr) + if (!flagwasthere) + return; /* could have been added, but not worth the effort to check */ + + n = getbuf(); + if (!n) return; + + record = tcpto_buf; + for (i = 0;i < n;++i) + { + if (byte_equal(ip->d,4,record)) + { + if (!flagerr) + record[4] = 0; + else + { + lastwhen = (unsigned long) (unsigned char) record[11]; + lastwhen = (lastwhen << 8) + (unsigned long) (unsigned char) record[10]; + lastwhen = (lastwhen << 8) + (unsigned long) (unsigned char) record[9]; + lastwhen = (lastwhen << 8) + (unsigned long) (unsigned char) record[8]; + when = now(); + + if (record[4] && (when < 120 + lastwhen)) { close(fdlock); return; } + + if (++record[4] > 10) record[4] = 10; + record[8] = when; when >>= 8; + record[9] = when; when >>= 8; + record[10] = when; when >>= 8; + record[11] = when; + } + if (seek_set(fdlock,i << 4) == 0) + if (write(fdlock,record,16) < 16) + ; /*XXX*/ + close(fdlock); + return; + } + record += 16; + } + + if (!flagerr) { close(fdlock); return; } + + record = tcpto_buf; + for (i = 0;i < n;++i) + { + if (!record[4]) break; + record += 16; + } + + if (i >= n) + { + int firstpos = -1; + datetime_sec firstwhen; + record = tcpto_buf; + for (i = 0;i < n;++i) + { + when = (unsigned long) (unsigned char) record[11]; + when = (when << 8) + (unsigned long) (unsigned char) record[10]; + when = (when << 8) + (unsigned long) (unsigned char) record[9]; + when = (when << 8) + (unsigned long) (unsigned char) record[8]; + when += (record[4] << 10); + if ((firstpos < 0) || (when < firstwhen)) + { + firstpos = i; + firstwhen = when; + } + record += 16; + } + i = firstpos; + } + + if (i >= 0) + { + record = tcpto_buf + (i << 4); + byte_copy(record,4,ip->d); + when = now(); + record[8] = when; when >>= 8; + record[9] = when; when >>= 8; + record[10] = when; when >>= 8; + record[11] = when; + record[4] = 1; + if (seek_set(fdlock,i << 4) == 0) + if (write(fdlock,record,16) < 16) + ; /*XXX*/ + } + + close(fdlock); +} diff --git a/src/tcpto_clean.c b/src/tcpto_clean.c @@ -0,0 +1,20 @@ +#include "tcpto.h" +#include "open.h" +#include "substdio.h" +#include "readwrite.h" + +char tcpto_cleanbuf[1024]; + +void tcpto_clean() /* running from queue/mess */ +{ + int fd; + int i; + substdio ss; + + fd = open_write("../lock/tcpto"); + if (fd == -1) return; + substdio_fdbuf(&ss,write,fd,tcpto_cleanbuf,sizeof(tcpto_cleanbuf)); + for (i = 0;i < sizeof(tcpto_cleanbuf);++i) substdio_put(&ss,"",1); + substdio_flush(&ss); /* if it fails, bummer */ + close(fd); +} diff --git a/src/timeoutconn.c b/src/timeoutconn.c @@ -0,0 +1,60 @@ +#include "timeoutconn.h" + +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include "ndelay.h" +#include "select.h" +#include "error.h" +#include "readwrite.h" +#include "ip.h" +#include "byte.h" + +int timeoutconn(s,ip,port,timeout) +int s; +struct ip_address *ip; +unsigned int port; +int timeout; +{ + char ch; + struct sockaddr_in sin; + char *x; + fd_set wfds; + struct timeval tv; + + byte_zero(&sin,sizeof(sin)); + byte_copy(&sin.sin_addr,4,ip); + x = (char *) &sin.sin_port; + x[1] = port; port >>= 8; x[0] = port; + sin.sin_family = AF_INET; + + if (ndelay_on(s) == -1) return -1; + + /* XXX: could bind s */ + + if (connect(s,(struct sockaddr *) &sin,sizeof(sin)) == 0) { + ndelay_off(s); + return 0; + } + if ((errno != error_inprogress) && (errno != error_wouldblock)) return -1; + + FD_ZERO(&wfds); + FD_SET(s,&wfds); + tv.tv_sec = timeout; tv.tv_usec = 0; + + if (select(s + 1,NULL,&wfds,NULL,&tv) == -1) return -1; + if (FD_ISSET(s,&wfds)) { + unsigned int dummy; + dummy = sizeof(sin); + if (getpeername(s,(struct sockaddr *) &sin,&dummy) == -1) { + read(s,&ch,1); + return -1; + } + ndelay_off(s); + return 0; + } + + errno = error_timeout; /* note that connect attempt is continuing */ + return -1; +} diff --git a/src/timeoutread.c b/src/timeoutread.c @@ -0,0 +1,23 @@ +#include "timeoutread.h" + +#include "select.h" +#include "error.h" +#include "readwrite.h" + +ssize_t timeoutread(int t, int fd, char *buf, size_t len) +{ + fd_set rfds; + struct timeval tv; + + tv.tv_sec = t; + tv.tv_usec = 0; + + FD_ZERO(&rfds); + FD_SET(fd,&rfds); + + if (select(fd + 1,&rfds,NULL,NULL,&tv) == -1) return -1; + if (FD_ISSET(fd,&rfds)) return read(fd,buf,len); + + errno = error_timeout; + return -1; +} diff --git a/src/timeoutwrite.c b/src/timeoutwrite.c @@ -0,0 +1,23 @@ +#include "timeoutwrite.h" + +#include "select.h" +#include "error.h" +#include "readwrite.h" + +ssize_t timeoutwrite(int t, int fd, const void *buf, size_t len) +{ + fd_set wfds; + struct timeval tv; + + tv.tv_sec = t; + tv.tv_usec = 0; + + FD_ZERO(&wfds); + FD_SET(fd,&wfds); + + if (select(fd + 1,NULL,&wfds,NULL,&tv) == -1) return -1; + if (FD_ISSET(fd,&wfds)) return write(fd,buf,len); + + errno = error_timeout; + return -1; +} diff --git a/src/token822.c b/src/token822.c @@ -0,0 +1,513 @@ +#include "token822.h" + +#include "stralloc.h" +#include "str.h" +#include "gen_allocdefs.h" + +static struct token822 comma = { TOKEN822_COMMA }; + +void token822_reverse(ta) +token822_alloc *ta; +{ + int i; + int n; + struct token822 temp; + + n = ta->len - 1; + for (i = 0;i + i < n;++i) + { + temp = ta->t[i]; + ta->t[i] = ta->t[n - i]; + ta->t[n - i] = temp; + } +} + +GEN_ALLOC_readyplus(token822_alloc,struct token822,t,len,a,30,token822_readyplus) +GEN_ALLOC_ready(token822_alloc,struct token822,t,len,a,30,token822_ready) +GEN_ALLOC_append(token822_alloc,struct token822,t,len,a,30,token822_readyplus,token822_append) + +static int needspace(t1,t2) +int t1; +int t2; +{ + if (!t1) return 0; + if (t1 == TOKEN822_COLON) return 1; + if (t1 == TOKEN822_COMMA) return 1; + if (t2 == TOKEN822_LEFT) return 1; + switch(t1) + { + case TOKEN822_ATOM: case TOKEN822_LITERAL: + case TOKEN822_QUOTE: case TOKEN822_COMMENT: + switch(t2) + { + case TOKEN822_ATOM: case TOKEN822_LITERAL: + case TOKEN822_QUOTE: case TOKEN822_COMMENT: + return 1; + } + } + return 0; +} + +static int atomok(ch) +char ch; +{ + switch(ch) + { + case ' ': case '\t': case '\r': case '\n': + case '(': case '[': case '"': + case '<': case '>': case ';': case ':': + case '@': case ',': case '.': + return 0; + } + return 1; +} + +static void atomcheck(t) +struct token822 *t; +{ + int i; + char ch; + for (i = 0;i < t->slen;++i) + { + ch = t->s[i]; + if ((ch < 32) || (ch > 126) || (ch == ')') || (ch == ']') || (ch == '\\')) + { + t->type = TOKEN822_QUOTE; + return; + } + } +} + +int token822_unparse(sa,ta,linelen) +stralloc *sa; +token822_alloc *ta; +unsigned int linelen; +{ + struct token822 *t; + int len; + int ch; + int i; + int j; + int lasttype; + int newtype; + char *s; + char *lineb; + char *linee; + + len = 0; + lasttype = 0; + for (i = 0;i < ta->len;++i) + { + t = ta->t + i; + newtype = t->type; + if (needspace(lasttype,newtype)) + ++len; + lasttype = newtype; + switch(newtype) + { + case TOKEN822_COMMA: + len += 3; break; + case TOKEN822_AT: case TOKEN822_DOT: case TOKEN822_LEFT: case TOKEN822_RIGHT: + case TOKEN822_SEMI: case TOKEN822_COLON: + ++len; break; + case TOKEN822_ATOM: case TOKEN822_QUOTE: case TOKEN822_LITERAL: case TOKEN822_COMMENT: + if (t->type != TOKEN822_ATOM) len += 2; + for (j = 0;j < t->slen;++j) + switch(ch = t->s[j]) + { + case '"': case '[': case ']': case '(': case ')': + case '\\': case '\r': case '\n': ++len; + default: ++len; + } + break; + } + } + len += 2; + + if (!stralloc_ready(sa,len)) + return -1; + + s = sa->s; + lineb = s; + linee = 0; + + lasttype = 0; + for (i = 0;i < ta->len;++i) + { + t = ta->t + i; + newtype = t->type; + if (needspace(lasttype,newtype)) + *s++ = ' '; + lasttype = newtype; + switch(newtype) + { + case TOKEN822_COMMA: + *s++ = ','; +#define NSUW \ + s[0] = '\n'; s[1] = ' '; \ + if (linee && (!linelen || (s - lineb <= linelen))) \ + { while (linee < s) { linee[0] = linee[2]; ++linee; } linee -= 2; } \ + else { if (linee) lineb = linee + 1; linee = s; s += 2; } + NSUW + break; + case TOKEN822_AT: *s++ = '@'; break; + case TOKEN822_DOT: *s++ = '.'; break; + case TOKEN822_LEFT: *s++ = '<'; break; + case TOKEN822_RIGHT: *s++ = '>'; break; + case TOKEN822_SEMI: *s++ = ';'; break; + case TOKEN822_COLON: *s++ = ':'; break; + case TOKEN822_ATOM: case TOKEN822_QUOTE: case TOKEN822_LITERAL: case TOKEN822_COMMENT: + if (t->type == TOKEN822_QUOTE) *s++ = '"'; + if (t->type == TOKEN822_LITERAL) *s++ = '['; + if (t->type == TOKEN822_COMMENT) *s++ = '('; + for (j = 0;j < t->slen;++j) + switch(ch = t->s[j]) + { + case '"': case '[': case ']': case '(': case ')': + case '\\': case '\r': case '\n': *s++ = '\\'; + default: *s++ = ch; + } + if (t->type == TOKEN822_QUOTE) *s++ = '"'; + if (t->type == TOKEN822_LITERAL) *s++ = ']'; + if (t->type == TOKEN822_COMMENT) *s++ = ')'; + break; + } + } + NSUW + --s; + sa->len = s - sa->s; + return 1; +} + +int token822_unquote(sa,ta) +stralloc *sa; +token822_alloc *ta; +{ + struct token822 *t; + int len; + int i; + int j; + char *s; + + len = 0; + for (i = 0;i < ta->len;++i) + { + t = ta->t + i; + switch(t->type) + { + case TOKEN822_COMMA: case TOKEN822_AT: case TOKEN822_DOT: case TOKEN822_LEFT: + case TOKEN822_RIGHT: case TOKEN822_SEMI: case TOKEN822_COLON: + ++len; break; + case TOKEN822_LITERAL: + len += 2; + case TOKEN822_ATOM: case TOKEN822_QUOTE: + len += t->slen; + } + } + + if (!stralloc_ready(sa,len)) + return -1; + + s = sa->s; + + for (i = 0;i < ta->len;++i) + { + t = ta->t + i; + switch(t->type) + { + case TOKEN822_COMMA: *s++ = ','; break; + case TOKEN822_AT: *s++ = '@'; break; + case TOKEN822_DOT: *s++ = '.'; break; + case TOKEN822_LEFT: *s++ = '<'; break; + case TOKEN822_RIGHT: *s++ = '>'; break; + case TOKEN822_SEMI: *s++ = ';'; break; + case TOKEN822_COLON: *s++ = ':'; break; + case TOKEN822_ATOM: case TOKEN822_QUOTE: case TOKEN822_LITERAL: + if (t->type == TOKEN822_LITERAL) *s++ = '['; + for (j = 0;j < t->slen;++j) + *s++ = t->s[j]; + if (t->type == TOKEN822_LITERAL) *s++ = ']'; + break; + case TOKEN822_COMMENT: break; + } + } + sa->len = s - sa->s; + return 1; +} + +int token822_parse(ta,sa,buf) +token822_alloc *ta; +stralloc *sa; +stralloc *buf; +{ + int i; + int salen; + int level; + struct token822 *t; + int numtoks; + int numchars; + char *cbuf; + + salen = sa->len; + + numchars = 0; + numtoks = 0; + for (i = 0;i < salen;++i) + switch(sa->s[i]) + { + case '.': case ',': case '@': case '<': case '>': case ':': case ';': + ++numtoks; break; + case ' ': case '\t': case '\r': case '\n': break; + case ')': case ']': return 0; + /* other control chars and non-ASCII chars are also bad, in theory */ + case '(': + level = 1; + while (level) + { + if (++i >= salen) return 0; + switch(sa->s[i]) + { + case '(': ++level; break; + case ')': --level; break; + case '\\': if (++i >= salen) return 0; + default: ++numchars; + } + } + ++numtoks; + break; + case '"': + level = 1; + while (level) + { + if (++i >= salen) return 0; + switch(sa->s[i]) + { + case '"': --level; break; + case '\\': if (++i >= salen) return 0; + default: ++numchars; + } + } + ++numtoks; + break; + case '[': + level = 1; + while (level) + { + if (++i >= salen) return 0; + switch(sa->s[i]) + { + case ']': --level; break; + case '\\': if (++i >= salen) return 0; + default: ++numchars; + } + } + ++numtoks; + break; + default: + do + { + if (sa->s[i] == '\\') if (++i >= salen) break; + ++numchars; + if (++i >= salen) + break; + } + while (atomok(sa->s[i])); + --i; + ++numtoks; + } + + if (!token822_ready(ta,numtoks)) + return -1; + if (!stralloc_ready(buf,numchars)) + return -1; + cbuf = buf->s; + ta->len = numtoks; + + t = ta->t; + for (i = 0;i < salen;++i) + switch(sa->s[i]) + { + case '.': t->type = TOKEN822_DOT; ++t; break; + case ',': t->type = TOKEN822_COMMA; ++t; break; + case '@': t->type = TOKEN822_AT; ++t; break; + case '<': t->type = TOKEN822_LEFT; ++t; break; + case '>': t->type = TOKEN822_RIGHT; ++t; break; + case ':': t->type = TOKEN822_COLON; ++t; break; + case ';': t->type = TOKEN822_SEMI; ++t; break; + case ' ': case '\t': case '\r': case '\n': break; + case '(': + t->type = TOKEN822_COMMENT; t->s = cbuf; t->slen = 0; + level = 1; + while (level) + { + ++i; /* assert: < salen */ + switch(sa->s[i]) + { + case '(': ++level; break; + case ')': --level; break; + case '\\': ++i; /* assert: < salen */ + default: *cbuf++ = sa->s[i]; ++t->slen; + } + } + ++t; + break; + case '"': + t->type = TOKEN822_QUOTE; t->s = cbuf; t->slen = 0; + level = 1; + while (level) + { + ++i; /* assert: < salen */ + switch(sa->s[i]) + { + case '"': --level; break; + case '\\': ++i; /* assert: < salen */ + default: *cbuf++ = sa->s[i]; ++t->slen; + } + } + ++t; + break; + case '[': + t->type = TOKEN822_LITERAL; t->s = cbuf; t->slen = 0; + level = 1; + while (level) + { + ++i; /* assert: < salen */ + switch(sa->s[i]) + { + case ']': --level; break; + case '\\': ++i; /* assert: < salen */ + default: *cbuf++ = sa->s[i]; ++t->slen; + } + } + ++t; + break; + default: + t->type = TOKEN822_ATOM; t->s = cbuf; t->slen = 0; + do + { + if (sa->s[i] == '\\') if (++i >= salen) break; + *cbuf++ = sa->s[i]; ++t->slen; + if (++i >= salen) + break; + } + while (atomok(sa->s[i])); + atomcheck(t); + --i; + ++t; + } + return 1; +} + +static int gotaddr(taout,taaddr,callback) +token822_alloc *taout; +token822_alloc *taaddr; +int (*callback)(); +{ + int i; + + if (callback(taaddr) != 1) + return 0; + + if (!token822_readyplus(taout,taaddr->len)) + return 0; + + for (i = 0;i < taaddr->len;++i) + taout->t[taout->len++] = taaddr->t[i]; + + taaddr->len = 0; + return 1; +} + +int token822_addrlist(taout,taaddr,ta,callback) +token822_alloc *taout; +token822_alloc *taaddr; +token822_alloc *ta; +int (*callback)(); +{ + struct token822 *t; + struct token822 *beginning; + int ingroup; + int wordok; + + taout->len = 0; + taaddr->len = 0; + + if (!token822_readyplus(taout,1)) return -1; + if (!token822_readyplus(taaddr,1)) return -1; + + ingroup = 0; + wordok = 1; + + beginning = ta->t + 2; + t = ta->t + ta->len - 1; + + /* rfc 822 address lists are easy to parse from right to left */ + +#define FLUSH if (taaddr->len) if (!gotaddr(taout,taaddr,callback)) return -1; +#define FLUSHCOMMA if (taaddr->len) { \ +if (!gotaddr(taout,taaddr,callback)) return -1; \ +if (!token822_append(taout,&comma)) return -1; } +#define ADDRLEFT if (!token822_append(taaddr,t--)) return -1; +#define OUTLEFT if (!token822_append(taout,t--)) return -1; + + while (t >= beginning) + { + switch(t->type) + { + case TOKEN822_SEMI: + FLUSHCOMMA + if (ingroup) return 0; + ingroup = 1; + wordok = 1; + break; + case TOKEN822_COLON: + FLUSH + if (!ingroup) return 0; + ingroup = 0; + while ((t >= beginning) && (t->type != TOKEN822_COMMA)) + OUTLEFT + if (t >= beginning) + OUTLEFT + wordok = 1; + continue; + case TOKEN822_RIGHT: + FLUSHCOMMA + OUTLEFT + while ((t >= beginning) && (t->type != TOKEN822_LEFT)) + ADDRLEFT + /* important to use address here even if it's empty: <> */ + if (!gotaddr(taout,taaddr,callback)) return -1; + if (t < beginning) return 0; + OUTLEFT + while ((t >= beginning) && ((t->type == TOKEN822_COMMENT) || (t->type == TOKEN822_ATOM) || (t->type == TOKEN822_QUOTE) || (t->type == TOKEN822_AT) || (t->type == TOKEN822_DOT))) + OUTLEFT + wordok = 0; + continue; + case TOKEN822_ATOM: case TOKEN822_QUOTE: case TOKEN822_LITERAL: + if (!wordok) + FLUSHCOMMA + wordok = 0; + ADDRLEFT + continue; + case TOKEN822_COMMENT: + /* comment is lexically a space; shouldn't affect wordok */ + break; + case TOKEN822_COMMA: + FLUSH + wordok = 1; + break; + default: + wordok = 1; + ADDRLEFT + continue; + } + OUTLEFT + } + FLUSH + ++t; + while (t > ta->t) + if (!token822_append(taout,--t)) return -1; + + token822_reverse(taout); + return 1; +} diff --git a/src/trigger.c b/src/trigger.c @@ -0,0 +1,43 @@ +#include "trigger.h" + +#include <unistd.h> +#include "select.h" +#include "open.h" +#include "hasnpbg1.h" + +static int fd = -1; +#ifdef HASNAMEDPIPEBUG1 +static int fdw = -1; +#endif + +void trigger_set() +{ + if (fd != -1) + close(fd); +#ifdef HASNAMEDPIPEBUG1 + if (fdw != -1) + close(fdw); +#endif + fd = open_read("lock/trigger"); +#ifdef HASNAMEDPIPEBUG1 + fdw = open_write("lock/trigger"); +#endif +} + +void trigger_selprep(nfds,rfds) +int *nfds; +fd_set *rfds; +{ + if (fd != -1) + { + FD_SET(fd,rfds); + if (*nfds < fd + 1) *nfds = fd + 1; + } +} + +int trigger_pulled(rfds) +fd_set *rfds; +{ + if (fd != -1) if (FD_ISSET(fd,rfds)) return 1; + return 0; +} diff --git a/src/triggerpull.c b/src/triggerpull.c @@ -0,0 +1,18 @@ +#include "triggerpull.h" + +#include <unistd.h> +#include "ndelay.h" +#include "open.h" + +void triggerpull() +{ + int fd; + + fd = open_write("lock/trigger"); + if (fd >= 0) + { + ndelay_on(fd); + write(fd,"",1); /* if it fails, bummer */ + close(fd); + } +} diff --git a/src/trydrent.c b/src/trydrent.c @@ -0,0 +1,8 @@ +#include <sys/types.h> +#include <dirent.h> + +void foo() +{ + DIR *dir; + struct dirent *d; +} diff --git a/src/tryflock.c b/src/tryflock.c @@ -0,0 +1,8 @@ +#include <sys/types.h> +#include <sys/file.h> +#include <fcntl.h> + +int main(void) +{ + return flock(0,LOCK_EX | LOCK_UN | LOCK_NB); +} diff --git a/src/trylsock.c b/src/trylsock.c @@ -0,0 +1,5 @@ +int +main() +{ + return 0; +} diff --git a/src/trymkffo.c b/src/trymkffo.c @@ -0,0 +1,7 @@ +#include <sys/types.h> +#include <sys/stat.h> + +int main(void) +{ + return mkfifo("temp-trymkffo",0); +} diff --git a/src/trynpbg1.c b/src/trynpbg1.c @@ -0,0 +1,28 @@ +#include <stddef.h> +#include <unistd.h> +#include "select.h" +#include "open.h" +#include "fifo.h" + +#define FN "temp-trynpbg1.fifo" + +int main(void) +{ + int flagbug; + struct timeval instant; + fd_set rfds; + + flagbug = 0; + if (fifo_make(FN,0600) != -1) { + close(0); + if (open_read(FN) == 0) { + FD_ZERO(&rfds); + FD_SET(0,&rfds); + instant.tv_sec = instant.tv_usec = 0; + if (select(1,&rfds,NULL,NULL,&instant) > 0) + flagbug = 1; + } + unlink(FN); + } + return !flagbug; +} diff --git a/src/tryrsolv.c b/src/tryrsolv.c @@ -0,0 +1,5 @@ +int +main() +{ + return 0; +} diff --git a/src/trysalen.c b/src/trysalen.c @@ -0,0 +1,11 @@ +#include <sys/types.h> +#include <sys/param.h> +#include <sys/time.h> +#include <sys/ioctl.h> +#include <sys/socket.h> + +void foo() +{ + struct sockaddr sa; + sa.sa_len = 0; +} diff --git a/src/trysgact.c b/src/trysgact.c @@ -0,0 +1,12 @@ +#include <signal.h> +#include <stddef.h> + +int main(void) +{ + struct sigaction sa; + sa.sa_handler = 0; + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); + sigaction(0,&sa,NULL); + return 0; +} diff --git a/src/trysgprm.c b/src/trysgprm.c @@ -0,0 +1,12 @@ +#include <signal.h> +#include <stddef.h> + +int main(void) +{ + sigset_t ss; + + sigemptyset(&ss); + sigaddset(&ss,SIGCHLD); + sigprocmask(SIG_SETMASK,&ss,NULL); + return 0; +} diff --git a/src/trysysel.c b/src/trysysel.c @@ -0,0 +1,9 @@ +#include <sys/types.h> +#include <sys/time.h> +#include <sys/select.h> /* SVR4 silliness */ +#include <stddef.h> + +int foo() +{ + return select(0, NULL, NULL, NULL, NULL); +} diff --git a/src/trysyslog.c b/src/trysyslog.c @@ -0,0 +1,11 @@ +#include <sys/types.h> +#include <sys/time.h> +#include <syslog.h> + +int +main() +{ + openlog("foo",0,LOG_MAIL); + syslog(0,"foo"); + return 0; +} diff --git a/src/tryutmpx.c b/src/tryutmpx.c @@ -0,0 +1,8 @@ +#include <utmpx.h> + +int main(void) +{ + struct utmpx ut; + ut.ut_type = sizeof(ut.ut_line) + sizeof(ut.ut_user); + return 0; +} diff --git a/src/trywaitp.c b/src/trywaitp.c @@ -0,0 +1,8 @@ +#include <sys/types.h> +#include <sys/wait.h> +#include <stddef.h> + +int main(void) +{ + return waitpid(0,NULL,0); +} diff --git a/src/uid.c b/src/uid.c @@ -0,0 +1,21 @@ +#include <sys/types.h> +#include <pwd.h> +#include <unistd.h> +#include "uidgid.h" +#include "subfd.h" +#include "substdio.h" + +uid_t +inituid(char *user) +{ + struct passwd *pw; + pw = getpwnam(user); + if (!pw) { + substdio_puts(subfderr,"fatal: unable to find user "); + substdio_puts(subfderr,user); + substdio_puts(subfderr,"\n"); + substdio_flush(subfderr); + _exit(111); + } + return pw->pw_uid; +} diff --git a/src/wait_nohang.c b/src/wait_nohang.c @@ -0,0 +1,13 @@ +#include <sys/types.h> +#include <sys/wait.h> +#include <stddef.h> +#include "haswaitp.h" + +int wait_nohang(wstat) int *wstat; +{ +#ifdef HASWAITPID + return waitpid(-1,wstat,WNOHANG); +#else + return wait3(wstat,WNOHANG,NULL); +#endif +} diff --git a/src/wait_pid.c b/src/wait_pid.c @@ -0,0 +1,39 @@ +#include <sys/types.h> +#include <sys/wait.h> +#include "error.h" +#include "haswaitp.h" + +#ifdef HASWAITPID + +int wait_pid(wstat,pid) int *wstat; int pid; +{ + int r; + + do + r = waitpid(pid,wstat,0); + while ((r == -1) && (errno == error_intr)); + return r; +} + +#else + +/* XXX untested */ +/* XXX breaks down with more than two children */ +static int oldpid = 0; +static int oldwstat; /* defined if(oldpid) */ + +int wait_pid(wstat,pid) int *wstat; int pid; +{ + int r; + + if (pid == oldpid) { *wstat = oldwstat; oldpid = 0; return pid; } + + do { + r = wait(wstat); + if ((r != pid) && (r != -1)) { oldwstat = *wstat; oldpid = r; continue; } + } + while ((r == -1) && (errno == error_intr)); + return r; +} + +#endif diff --git a/str.h b/str.h @@ -1,16 +0,0 @@ -#ifndef STR_H -#define STR_H - -#include <string.h> - -#define str_copy(s,t) strcpy((s),(t)) -#define str_diff(s,t) strcmp((s),(t)) -#define str_diffn(s,t,len) strncmp((s),(t),(len)) -#define str_len(s) strlen((s)) -extern unsigned int str_chr(); -extern unsigned int str_rchr(); -extern int str_start(); - -#define str_equal(s,t) (strcmp((s),(t)) == 0) - -#endif diff --git a/str_chr.c b/str_chr.c @@ -1,17 +0,0 @@ -#include "str.h" - -unsigned int str_chr(char *s, int c) -{ - char ch; - char *t; - - ch = c; - t = s; - for (;;) { - if (!*t) break; if (*t == ch) break; ++t; - if (!*t) break; if (*t == ch) break; ++t; - if (!*t) break; if (*t == ch) break; ++t; - if (!*t) break; if (*t == ch) break; ++t; - } - return t - s; -} diff --git a/str_rchr.c b/str_rchr.c @@ -1,20 +0,0 @@ -#include "str.h" - -unsigned int str_rchr(char *s, int c) -{ - char ch; - char *t; - char *u; - - ch = c; - t = s; - u = 0; - for (;;) { - if (!*t) break; if (*t == ch) u = t; ++t; - if (!*t) break; if (*t == ch) u = t; ++t; - if (!*t) break; if (*t == ch) u = t; ++t; - if (!*t) break; if (*t == ch) u = t; ++t; - } - if (!u) u = t; - return u - s; -} diff --git a/str_start.c b/str_start.c @@ -1,13 +0,0 @@ -#include "str.h" - -int str_start(char *s, char *t) -{ - char x; - - for (;;) { - x = *t++; if (!x) return 1; if (x != *s++) return 0; - x = *t++; if (!x) return 1; if (x != *s++) return 0; - x = *t++; if (!x) return 1; if (x != *s++) return 0; - x = *t++; if (!x) return 1; if (x != *s++) return 0; - } -} diff --git a/stralloc.h b/stralloc.h @@ -1,21 +0,0 @@ -#ifndef STRALLOC_H -#define STRALLOC_H - -#include "gen_alloc.h" - -GEN_ALLOC_typedef(stralloc,char,s,len,a) - -extern int stralloc_ready(); -extern int stralloc_readyplus(); -extern int stralloc_copy(); -extern int stralloc_cat(); -extern int stralloc_copys(); -extern int stralloc_cats(); -extern int stralloc_copyb(); -extern int stralloc_catb(); -extern int stralloc_append(); /* beware: this takes a pointer to 1 char */ -extern int stralloc_starts(); - -#define stralloc_0(sa) stralloc_append(sa,"") - -#endif diff --git a/stralloc_arts.c b/stralloc_arts.c @@ -1,12 +0,0 @@ -#include "byte.h" -#include "str.h" -#include "stralloc.h" - -int stralloc_starts(sa,s) -stralloc *sa; -char *s; -{ - unsigned int len; - len = str_len(s); - return (sa->len >= len) && byte_equal(s,len,sa->s); -} diff --git a/stralloc_cat.c b/stralloc_cat.c @@ -1,9 +0,0 @@ -#include "byte.h" -#include "stralloc.h" - -int stralloc_cat(sato,safrom) -stralloc *sato; -stralloc *safrom; -{ - return stralloc_catb(sato,safrom->s,safrom->len); -} diff --git a/stralloc_catb.c b/stralloc_catb.c @@ -1,22 +0,0 @@ -#include "stralloc.h" -#include "byte.h" -#include "error.h" -#include "oflops.h" - -int stralloc_catb(sa,s,n) -stralloc *sa; -char *s; -unsigned int n; -{ - unsigned int i; - if (!sa->s) return stralloc_copyb(sa,s,n); - if (__builtin_add_overflow(n, 1, &i)) { - errno = error_nomem; - return 0; - } - if (!stralloc_readyplus(sa,i)) return 0; - byte_copy(sa->s + sa->len,n,s); - sa->len += n; - sa->s[sa->len] = 'Z'; /* ``offensive programming'' */ - return 1; -} diff --git a/stralloc_cats.c b/stralloc_cats.c @@ -1,10 +0,0 @@ -#include "byte.h" -#include "str.h" -#include "stralloc.h" - -int stralloc_cats(sa,s) -stralloc *sa; -char *s; -{ - return stralloc_catb(sa,s,str_len(s)); -} diff --git a/stralloc_copy.c b/stralloc_copy.c @@ -1,9 +0,0 @@ -#include "byte.h" -#include "stralloc.h" - -int stralloc_copy(sato,safrom) -stralloc *sato; -stralloc *safrom; -{ - return stralloc_copyb(sato,safrom->s,safrom->len); -} diff --git a/stralloc_eady.c b/stralloc_eady.c @@ -1,5 +0,0 @@ -#include "stralloc.h" -#include "gen_allocdefs.h" - -GEN_ALLOC_readyplus(stralloc,char,s,len,a,30,stralloc_readyplus) -GEN_ALLOC_ready(stralloc,char,s,len,a,30,stralloc_ready) diff --git a/stralloc_opyb.c b/stralloc_opyb.c @@ -1,21 +0,0 @@ -#include "stralloc.h" -#include "byte.h" -#include "error.h" -#include "oflops.h" - -int stralloc_copyb(sa,s,n) -stralloc *sa; -char *s; -unsigned int n; -{ - unsigned int i; - if (__builtin_add_overflow(n, 1, &i)) { - errno = error_nomem; - return 0; - } - if (!stralloc_ready(sa,i)) return 0; - byte_copy(sa->s,n,s); - sa->len = n; - sa->s[n] = 'Z'; /* ``offensive programming'' */ - return 1; -} diff --git a/stralloc_opys.c b/stralloc_opys.c @@ -1,10 +0,0 @@ -#include "byte.h" -#include "str.h" -#include "stralloc.h" - -int stralloc_copys(sa,s) -stralloc *sa; -char *s; -{ - return stralloc_copyb(sa,s,str_len(s)); -} diff --git a/stralloc_pend.c b/stralloc_pend.c @@ -1,4 +0,0 @@ -#include "stralloc.h" -#include "gen_allocdefs.h" - -GEN_ALLOC_append(stralloc,char,s,len,a,30,stralloc_readyplus,stralloc_append) diff --git a/strerr.h b/strerr.h @@ -1,82 +0,0 @@ -#ifndef STRERR_H -#define STRERR_H - -#include "noreturn.h" - -struct strerr - { - struct strerr *who; - char *x; - char *y; - char *z; - } -; - -extern struct strerr strerr_sys; -extern void strerr_sysinit(); - -extern char *strerr(); -extern void strerr_warn(); -extern void _noreturn_ strerr_die(); - -#define STRERR(r,se,a) \ -{ se.who = 0; se.x = a; se.y = 0; se.z = 0; return r; } - -#define STRERR_SYS(r,se,a) \ -{ se.who = &strerr_sys; se.x = a; se.y = 0; se.z = 0; return r; } -#define STRERR_SYS3(r,se,a,b,c) \ -{ se.who = &strerr_sys; se.x = a; se.y = b; se.z = c; return r; } - -#define strerr_warn6(x1,x2,x3,x4,x5,x6,se) \ -strerr_warn((x1),(x2),(x3),(x4),(x5),(x6),(struct strerr *) (se)) -#define strerr_warn5(x1,x2,x3,x4,x5,se) \ -strerr_warn((x1),(x2),(x3),(x4),(x5),NULL,(struct strerr *) (se)) -#define strerr_warn4(x1,x2,x3,x4,se) \ -strerr_warn((x1),(x2),(x3),(x4),NULL,NULL,(struct strerr *) (se)) -#define strerr_warn3(x1,x2,x3,se) \ -strerr_warn((x1),(x2),(x3),NULL,NULL,NULL,(struct strerr *) (se)) -#define strerr_warn2(x1,x2,se) \ -strerr_warn((x1),(x2),NULL,NULL,NULL,NULL,(struct strerr *) (se)) -#define strerr_warn1(x1,se) \ -strerr_warn((x1),NULL,NULL,NULL,NULL,NULL,(struct strerr *) (se)) - -#define strerr_die6(e,x1,x2,x3,x4,x5,x6,se) \ -strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),(struct strerr *) (se)) -#define strerr_die5(e,x1,x2,x3,x4,x5,se) \ -strerr_die((e),(x1),(x2),(x3),(x4),(x5),NULL,(struct strerr *) (se)) -#define strerr_die4(e,x1,x2,x3,x4,se) \ -strerr_die((e),(x1),(x2),(x3),(x4),NULL,NULL,(struct strerr *) (se)) -#define strerr_die3(e,x1,x2,x3,se) \ -strerr_die((e),(x1),(x2),(x3),NULL,NULL,NULL,(struct strerr *) (se)) -#define strerr_die2(e,x1,x2,se) \ -strerr_die((e),(x1),(x2),NULL,NULL,NULL,NULL,(struct strerr *) (se)) -#define strerr_die1(e,x1,se) \ -strerr_die((e),(x1),NULL,NULL,NULL,NULL,NULL,(struct strerr *) (se)) - -#define strerr_die6sys(e,x1,x2,x3,x4,x5,x6) \ -strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),&strerr_sys) -#define strerr_die5sys(e,x1,x2,x3,x4,x5) \ -strerr_die((e),(x1),(x2),(x3),(x4),(x5),NULL,&strerr_sys) -#define strerr_die4sys(e,x1,x2,x3,x4) \ -strerr_die((e),(x1),(x2),(x3),(x4),NULL,NULL,&strerr_sys) -#define strerr_die3sys(e,x1,x2,x3) \ -strerr_die((e),(x1),(x2),(x3),NULL,NULL,NULL,&strerr_sys) -#define strerr_die2sys(e,x1,x2) \ -strerr_die((e),(x1),(x2),NULL,NULL,NULL,NULL,&strerr_sys) -#define strerr_die1sys(e,x1) \ -strerr_die((e),(x1),NULL,NULL,NULL,NULL,NULL,&strerr_sys) - -#define strerr_die6x(e,x1,x2,x3,x4,x5,x6) \ -strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),NULL) -#define strerr_die5x(e,x1,x2,x3,x4,x5) \ -strerr_die((e),(x1),(x2),(x3),(x4),(x5),NULL,NULL) -#define strerr_die4x(e,x1,x2,x3,x4) \ -strerr_die((e),(x1),(x2),(x3),(x4),NULL,NULL,NULL) -#define strerr_die3x(e,x1,x2,x3) \ -strerr_die((e),(x1),(x2),(x3),NULL,NULL,NULL,NULL) -#define strerr_die2x(e,x1,x2) \ -strerr_die((e),(x1),(x2),NULL,NULL,NULL,NULL,NULL) -#define strerr_die1x(e,x1) \ -strerr_die((e),(x1),NULL,NULL,NULL,NULL,NULL,NULL) - -#endif diff --git a/strerr_die.c b/strerr_die.c @@ -1,37 +0,0 @@ -#include "substdio.h" -#include "subfd.h" -#include "exit.h" -#include "strerr.h" - -void strerr_warn(x1,x2,x3,x4,x5,x6,se) -char *x1; char *x2; char *x3; char *x4; char *x5; char *x6; -struct strerr *se; -{ - strerr_sysinit(); - - if (x1) substdio_puts(subfderr,x1); - if (x2) substdio_puts(subfderr,x2); - if (x3) substdio_puts(subfderr,x3); - if (x4) substdio_puts(subfderr,x4); - if (x5) substdio_puts(subfderr,x5); - if (x6) substdio_puts(subfderr,x6); - - while(se) { - if (se->x) substdio_puts(subfderr,se->x); - if (se->y) substdio_puts(subfderr,se->y); - if (se->z) substdio_puts(subfderr,se->z); - se = se->who; - } - - substdio_puts(subfderr,"\n"); - substdio_flush(subfderr); -} - -void strerr_die(e,x1,x2,x3,x4,x5,x6,se) -int e; -char *x1; char *x2; char *x3; char *x4; char *x5; char *x6; -struct strerr *se; -{ - strerr_warn(x1,x2,x3,x4,x5,x6,se); - _exit(e); -} diff --git a/strerr_sys.c b/strerr_sys.c @@ -1,13 +0,0 @@ -#include "error.h" -#include "strerr.h" - -/* explicit initialization due to linker error on Mac OS X. dorks. */ -struct strerr strerr_sys = {0,0,0,0}; - -void strerr_sysinit() -{ - strerr_sys.who = 0; - strerr_sys.x = error_str(errno); - strerr_sys.y = ""; - strerr_sys.z = ""; -} diff --git a/subfd.h b/subfd.h @@ -1,15 +0,0 @@ -#ifndef SUBFD_H -#define SUBFD_H - -#include "substdio.h" - -extern substdio *subfdin; -extern substdio *subfdinsmall; -extern substdio *subfdout; -extern substdio *subfdoutsmall; -extern substdio *subfderr; - -extern ssize_t subfd_read(int fd, void *buf, size_t len); -extern ssize_t subfd_readsmall(int fd, void *buf, size_t len); - -#endif diff --git a/subfderr.c b/subfderr.c @@ -1,7 +0,0 @@ -#include "readwrite.h" -#include "substdio.h" -#include "subfd.h" - -char subfd_errbuf[256]; -static substdio it = SUBSTDIO_FDBUF(write,2,subfd_errbuf,256); -substdio *subfderr = &it; diff --git a/subfdin.c b/subfdin.c @@ -1,13 +0,0 @@ -#include "readwrite.h" -#include "substdio.h" -#include "subfd.h" - -ssize_t subfd_read(int fd, void *buf, size_t len) -{ - if (substdio_flush(subfdout) == -1) return -1; - return read(fd,buf,len); -} - -char subfd_inbuf[SUBSTDIO_INSIZE]; -static substdio it = SUBSTDIO_FDBUF(subfd_read,0,subfd_inbuf,SUBSTDIO_INSIZE); -substdio *subfdin = &it; diff --git a/subfdins.c b/subfdins.c @@ -1,13 +0,0 @@ -#include "readwrite.h" -#include "substdio.h" -#include "subfd.h" - -ssize_t subfd_readsmall(int fd, void *buf, size_t len) -{ - if (substdio_flush(subfdoutsmall) == -1) return -1; - return read(fd,buf,len); -} - -char subfd_inbufsmall[256]; -static substdio it = SUBSTDIO_FDBUF(subfd_readsmall,0,subfd_inbufsmall,256); -substdio *subfdinsmall = &it; diff --git a/subfdout.c b/subfdout.c @@ -1,7 +0,0 @@ -#include "readwrite.h" -#include "substdio.h" -#include "subfd.h" - -char subfd_outbuf[SUBSTDIO_OUTSIZE]; -static substdio it = SUBSTDIO_FDBUF(write,1,subfd_outbuf,SUBSTDIO_OUTSIZE); -substdio *subfdout = &it; diff --git a/subfdouts.c b/subfdouts.c @@ -1,7 +0,0 @@ -#include "readwrite.h" -#include "substdio.h" -#include "subfd.h" - -char subfd_outbufsmall[256]; -static substdio it = SUBSTDIO_FDBUF(write,1,subfd_outbufsmall,256); -substdio *subfdoutsmall = &it; diff --git a/subgetopt.c b/subgetopt.c @@ -1,79 +0,0 @@ -/* subgetopt.c, subgetopt.h: (yet another) improved getopt clone, inner layer -D. J. Bernstein, djb@pobox.com. -No dependencies. -No system requirements. -19970228: Cleanups. -931129: Adapted from getopt.c. -No known patent problems. - -Documentation in subgetopt.3. -*/ - -#define SUBGETOPTNOSHORT -#include "subgetopt.h" - -#define sgopt subgetopt -#define optind subgetoptind -#define optpos subgetoptpos -#define optarg subgetoptarg -#define optproblem subgetoptproblem -#define optdone subgetoptdone - -int optind = 1; -int optpos = 0; -char *optarg = 0; -int optproblem = 0; -int optdone = SUBGETOPTDONE; - -int sgopt(argc,argv,opts) -int argc; -char **argv; -char *opts; -{ - int c; - char *s; - - optarg = 0; - if (!argv || (optind >= argc) || !argv[optind]) return optdone; - if (optpos && !argv[optind][optpos]) { - ++optind; - optpos = 0; - if ((optind >= argc) || !argv[optind]) return optdone; - } - if (!optpos) { - if (argv[optind][0] != '-') return optdone; - ++optpos; - c = argv[optind][1]; - if ((c == '-') || (c == 0)) { - if (c) ++optind; - optpos = 0; - return optdone; - } - /* otherwise c is reassigned below */ - } - c = argv[optind][optpos]; - ++optpos; - s = opts; - while (*s) { - if (c == *s) { - if (s[1] == ':') { - optarg = argv[optind] + optpos; - ++optind; - optpos = 0; - if (!*optarg) { - optarg = argv[optind]; - if ((optind >= argc) || !optarg) { /* argument past end */ - optproblem = c; - return '?'; - } - ++optind; - } - } - return c; - } - ++s; - if (*s == ':') ++s; - } - optproblem = c; - return '?'; -} diff --git a/subgetopt.h b/subgetopt.h @@ -1,24 +0,0 @@ -#ifndef SUBGETOPT_H -#define SUBGETOPT_H - -#ifndef SUBGETOPTNOSHORT -#define sgopt subgetopt -#define sgoptarg subgetoptarg -#define sgoptind subgetoptind -#define sgoptpos subgetoptpos -#define sgoptproblem subgetoptproblem -#define sgoptprogname subgetoptprogname -#define sgoptdone subgetoptdone -#endif - -#define SUBGETOPTDONE -1 - -extern int subgetopt(); -extern char *subgetoptarg; -extern int subgetoptind; -extern int subgetoptpos; -extern int subgetoptproblem; -extern char *subgetoptprogname; -extern int subgetoptdone; - -#endif diff --git a/substdi.c b/substdi.c @@ -1,77 +0,0 @@ -#include "substdio.h" -#include "byte.h" -#include "error.h" - -static ssize_t oneread(ssize_t (*op)(), int fd, char *buf, size_t len) -{ - for (;;) { - ssize_t r = op(fd,buf,len); - if (r == -1) if (errno == error_intr) continue; - return r; - } -} - -static int getthis(substdio *s, char *buf, int len) -{ - int r; - int q; - - r = s->p; - q = r - len; - if (q > 0) { r = len; s->p = q; } else s->p = 0; - byte_copy(buf,r,s->x + s->n); - s->n += r; - return r; -} - -ssize_t substdio_feed(substdio *s) -{ - ssize_t r; - int q; - - if (s->p) return s->p; - q = s->n; - r = oneread(s->op,s->fd,s->x,q); - if (r == 0 || r == -1) return r; - s->p = r; - q -= r; - s->n = q; - if (q > 0) /* damn, gotta shift */ byte_copyr(s->x + q,r,s->x); - return r; -} - -#ifdef DEPRECATED_FUNCTIONS_AVAILABLE -// might read fewer bytes than _get(); otherwise identical -ssize_t substdio_bget(substdio *s, char *buf, size_t len) -{ - ssize_t r; - - if (s->p > 0) return getthis(s,buf,len); - r = s->n; if (r <= len) return oneread(s->op,s->fd,buf,r); - r = substdio_feed(s); - if (r == 0 || r == -1) return r; - return getthis(s,buf,len); -} -#endif - -ssize_t substdio_get(substdio *s, char *buf, size_t len) -{ - ssize_t r; - - if (s->p > 0) return getthis(s,buf,len); - r = s->n; if (r <= len) return oneread(s->op,s->fd,buf,len); - r = substdio_feed(s); - if (r == 0 || r == -1) return r; - return getthis(s,buf,len); -} - -char *substdio_peek(substdio *s) -{ - return s->x + s->n; -} - -void substdio_seek(substdio *s, int len) -{ - s->n += len; - s->p -= len; -} diff --git a/substdio.c b/substdio.c @@ -1,10 +0,0 @@ -#include "substdio.h" - -void substdio_fdbuf(substdio *s, ssize_t (*op)(), int fd, char *buf, int len) -{ - s->x = buf; - s->fd = fd; - s->op = op; - s->p = 0; - s->n = len; -} diff --git a/substdio.h b/substdio.h @@ -1,53 +0,0 @@ -#ifndef SUBSTDIO_H -#define SUBSTDIO_H - -#include <sys/types.h> - -#include "deprecated.h" - -typedef struct substdio { - char *x; - int p; - int n; - int fd; - ssize_t (*op)(); -} substdio; - -#define SUBSTDIO_FDBUF(o,f,buf,len) { (buf), 0, (len), (f), (o) } - -extern void substdio_fdbuf(substdio *s, ssize_t (*op)(), int fd, char *buf, int len); - -extern int substdio_flush(); -extern int substdio_put(substdio *s, char *buf, size_t len); -extern int substdio_bput(substdio *s, char *buf, size_t len); -extern int substdio_putflush(substdio *s, char *buf, size_t len); -extern int substdio_puts(); -extern int substdio_bputs(); -extern int substdio_putsflush(); - -extern ssize_t substdio_get(substdio *s, char *buf, size_t len); -#ifdef DEPRECATED_FUNCTIONS_AVAILABLE -extern ssize_t substdio_bget(substdio *s, char *buf, size_t len); -#endif -extern ssize_t substdio_feed(substdio *s); - -extern char *substdio_peek(); -extern void substdio_seek(); - -#define substdio_fileno(s) ((s)->fd) - -#define SUBSTDIO_INSIZE 8192 -#define SUBSTDIO_OUTSIZE 8192 - -#define substdio_PEEK(s) ( (s)->x + (s)->n ) -#define substdio_SEEK(s,len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) ) - -#define substdio_BPUTC(s,c) \ - ( ((s)->n != (s)->p) \ - ? ( (s)->x[(s)->p++] = (c), 0 ) \ - : substdio_bput((s),&(c),1) \ - ) - -extern int substdio_copy(); - -#endif diff --git a/substdio_copy.c b/substdio_copy.c @@ -1,16 +0,0 @@ -#include "substdio.h" - -int substdio_copy(substdio *ssout, substdio *ssin) -{ - char *x; - - for (;;) { - ssize_t n; - n = substdio_feed(ssin); - if (n < 0) return -2; - if (!n) return 0; - x = substdio_PEEK(ssin); - if (substdio_put(ssout,x,n) == -1) return -3; - substdio_SEEK(ssin,n); - } -} diff --git a/substdo.c b/substdo.c @@ -1,93 +0,0 @@ -#include "substdio.h" -#include "str.h" -#include "byte.h" -#include "error.h" - -static int allwrite(ssize_t (*op)(), int fd, char *buf, size_t len) -{ - ssize_t w; - - while (len) { - w = op(fd,buf,len); - if (w == -1) { - if (errno == error_intr) continue; - return -1; /* note that some data may have been written */ - } - /* if (w == 0), luser's fault */ - buf += w; - len -= w; - } - return 0; -} - -int substdio_flush(substdio *s) -{ - int p; - - p = s->p; - if (!p) return 0; - s->p = 0; - return allwrite(s->op,s->fd,s->x,p); -} - -int substdio_bput(substdio *s, char *buf, size_t len) -{ - unsigned int n; - - while (len > (n = s->n - s->p)) { - byte_copy(s->x + s->p,n,buf); - s->p += n; - buf += n; - len -= n; - if (substdio_flush(s) == -1) return -1; - } - /* now len <= s->n - s->p */ - byte_copy(s->x + s->p,len,buf); - s->p += len; - return 0; -} - -int substdio_put(substdio *s, char *buf, size_t len) -{ - unsigned int n = s->n; /* how many bytes to write in next chunk */ - - /* check if the input would fit in the buffer without flushing */ - if (len > n - (unsigned int)s->p) { - if (substdio_flush(s) == -1) return -1; - /* now s->p == 0 */ - if (n < SUBSTDIO_OUTSIZE) n = SUBSTDIO_OUTSIZE; - /* as long as the remainder would not fit into s->x write it directly - * from buf to s->fd. */ - while (len > (unsigned int)s->n) { - if (n > len) n = len; - if (allwrite(s->op,s->fd,buf,n) == -1) return -1; - buf += n; - len -= n; - } - } - /* now len <= s->n - s->p */ - byte_copy(s->x + s->p,len,buf); - s->p += len; - return 0; -} - -int substdio_putflush(substdio *s, char *buf, size_t len) -{ - if (substdio_flush(s) == -1) return -1; - return allwrite(s->op,s->fd,buf,len); -} - -int substdio_bputs(substdio *s, char *buf) -{ - return substdio_bput(s,buf,str_len(buf)); -} - -int substdio_puts(substdio *s, char *buf) -{ - return substdio_put(s,buf,str_len(buf)); -} - -int substdio_putsflush(substdio *s, char *buf) -{ - return substdio_putflush(s,buf,str_len(buf)); -} diff --git a/tcp-env.c b/tcp-env.c @@ -1,128 +0,0 @@ -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/param.h> -#include <netinet/in.h> -#include "noreturn.h" -#include "sig.h" -#include "stralloc.h" -#include "str.h" -#include "env.h" -#include "fmt.h" -#include "scan.h" -#include "subgetopt.h" -#include "ip.h" -#include "dns.h" -#include "byte.h" -#include "remoteinfo.h" -#include "exit.h" -#include "case.h" - -void _noreturn_ die() { _exit(111); } - -struct sockaddr_in salocal; -unsigned long localport; -struct ip_address iplocal; -stralloc localname = {0}; - -struct sockaddr_in saremote; -unsigned long remoteport; -struct ip_address ipremote; -stralloc remotename = {0}; - -char temp[IPFMT + FMT_ULONG]; - -int main(int argc, char **argv) -{ - unsigned int dummy; - char *proto; - int opt; - int flagremoteinfo; - unsigned long timeout; - - sig_pipeignore(); - - flagremoteinfo = 1; - timeout = 30; - while ((opt = sgopt(argc,argv,"rRt:")) != sgoptdone) - switch(opt) - { - case 'r': flagremoteinfo = 1; break; - case 'R': flagremoteinfo = 0; break; - case 't': scan_ulong(sgoptarg,&timeout); break; - } - - argv += sgoptind; - argc -= sgoptind; - - if (argc < 1) die(); - if (!env_init()) die(); - - proto = env_get("PROTO"); - if (!proto || str_diff(proto,"TCP")) - { - if (!env_put("PROTO=TCP")) die(); - - dummy = sizeof(salocal); - if (getsockname(0,(struct sockaddr *) &salocal,&dummy) == -1) die(); - - localport = ntohs(salocal.sin_port); - temp[fmt_ulong(temp,localport)] = 0; - if (!env_put2("TCPLOCALPORT",temp)) die(); - - byte_copy(&iplocal,4,&salocal.sin_addr); - temp[ip_fmt(temp,&iplocal)] = 0; - if (!env_put2("TCPLOCALIP",temp)) die(); - - switch(dns_ptr(&localname,&iplocal)) - { - case DNS_MEM: die(); - case DNS_SOFT: - if (!stralloc_copys(&localname,"softdnserror")) die(); - case 0: - if (!stralloc_0(&localname)) die(); - case_lowers(localname.s); - if (!env_put2("TCPLOCALHOST",localname.s)) die(); - break; - default: - if (!env_unset("TCPLOCALHOST")) die(); - } - - dummy = sizeof(saremote); - if (getpeername(0,(struct sockaddr *) &saremote,&dummy) == -1) die(); - - remoteport = ntohs(saremote.sin_port); - temp[fmt_ulong(temp,remoteport)] = 0; - if (!env_put2("TCPREMOTEPORT",temp)) die(); - - byte_copy(&ipremote,4,&saremote.sin_addr); - temp[ip_fmt(temp,&ipremote)] = 0; - if (!env_put2("TCPREMOTEIP",temp)) die(); - - switch(dns_ptr(&remotename,&ipremote)) - { - case DNS_MEM: die(); - case DNS_SOFT: - if (!stralloc_copys(&remotename,"softdnserror")) die(); - case 0: - if (!stralloc_0(&remotename)) die(); - case_lowers(remotename.s); - if (!env_put2("TCPREMOTEHOST",remotename.s)) die(); - break; - default: - if (!env_unset("TCPREMOTEHOST")) die(); - } - - if (!env_unset("TCPREMOTEINFO")) die(); - if (flagremoteinfo) - { - char *rinfo; - rinfo = remoteinfo_get(&ipremote,remoteport,&iplocal,localport,(int) timeout); - if (rinfo) - if (!env_put2("TCPREMOTEINFO",rinfo)) die(); - } - } - - sig_pipedefault(); - execvp(*argv,argv); - die(); -} diff --git a/tcpto.c b/tcpto.c @@ -1,164 +0,0 @@ -#include "tcpto.h" - -#include "open.h" -#include "lock.h" -#include "seek.h" -#include "now.h" -#include "ip.h" -#include "byte.h" -#include "datetime.h" -#include "readwrite.h" - -char tcpto_buf[1024]; - -static int flagwasthere; -static int fdlock; - -static int getbuf() -{ - int r; - int fd; - - fdlock = open_write("queue/lock/tcpto"); - if (fdlock == -1) return 0; - fd = open_read("queue/lock/tcpto"); - if (fd == -1) { close(fdlock); return 0; } - if (lock_ex(fdlock) == -1) { close(fdlock); close(fd); return 0; } - r = read(fd,tcpto_buf,sizeof(tcpto_buf)); - close(fd); - if (r == -1) { close(fdlock); return 0; } - r >>= 4; - if (!r) close(fdlock); - return r; -} - -int tcpto(ip) struct ip_address *ip; -{ - int n; - int i; - char *record; - - flagwasthere = 0; - - n = getbuf(); - if (!n) return 0; - close(fdlock); - - record = tcpto_buf; - for (i = 0;i < n;++i) - { - if (byte_equal(ip->d,4,record)) - { - flagwasthere = 1; - if (record[4] >= 2) - { - datetime_sec when = (unsigned long) (unsigned char) record[11]; - when = (when << 8) + (unsigned long) (unsigned char) record[10]; - when = (when << 8) + (unsigned long) (unsigned char) record[9]; - when = (when << 8) + (unsigned long) (unsigned char) record[8]; - - if (now() - when < ((60 + (getpid() & 31)) << 6)) - return 1; - } - return 0; - } - record += 16; - } - return 0; -} - -void tcpto_err(ip,flagerr) struct ip_address *ip; int flagerr; -{ - int n; - int i; - char *record; - datetime_sec when; - datetime_sec lastwhen; - - if (!flagerr) - if (!flagwasthere) - return; /* could have been added, but not worth the effort to check */ - - n = getbuf(); - if (!n) return; - - record = tcpto_buf; - for (i = 0;i < n;++i) - { - if (byte_equal(ip->d,4,record)) - { - if (!flagerr) - record[4] = 0; - else - { - lastwhen = (unsigned long) (unsigned char) record[11]; - lastwhen = (lastwhen << 8) + (unsigned long) (unsigned char) record[10]; - lastwhen = (lastwhen << 8) + (unsigned long) (unsigned char) record[9]; - lastwhen = (lastwhen << 8) + (unsigned long) (unsigned char) record[8]; - when = now(); - - if (record[4] && (when < 120 + lastwhen)) { close(fdlock); return; } - - if (++record[4] > 10) record[4] = 10; - record[8] = when; when >>= 8; - record[9] = when; when >>= 8; - record[10] = when; when >>= 8; - record[11] = when; - } - if (seek_set(fdlock,i << 4) == 0) - if (write(fdlock,record,16) < 16) - ; /*XXX*/ - close(fdlock); - return; - } - record += 16; - } - - if (!flagerr) { close(fdlock); return; } - - record = tcpto_buf; - for (i = 0;i < n;++i) - { - if (!record[4]) break; - record += 16; - } - - if (i >= n) - { - int firstpos = -1; - datetime_sec firstwhen; - record = tcpto_buf; - for (i = 0;i < n;++i) - { - when = (unsigned long) (unsigned char) record[11]; - when = (when << 8) + (unsigned long) (unsigned char) record[10]; - when = (when << 8) + (unsigned long) (unsigned char) record[9]; - when = (when << 8) + (unsigned long) (unsigned char) record[8]; - when += (record[4] << 10); - if ((firstpos < 0) || (when < firstwhen)) - { - firstpos = i; - firstwhen = when; - } - record += 16; - } - i = firstpos; - } - - if (i >= 0) - { - record = tcpto_buf + (i << 4); - byte_copy(record,4,ip->d); - when = now(); - record[8] = when; when >>= 8; - record[9] = when; when >>= 8; - record[10] = when; when >>= 8; - record[11] = when; - record[4] = 1; - if (seek_set(fdlock,i << 4) == 0) - if (write(fdlock,record,16) < 16) - ; /*XXX*/ - } - - close(fdlock); -} diff --git a/tcpto.h b/tcpto.h @@ -1,8 +0,0 @@ -#ifndef TCPTO_H -#define TCPTO_H - -extern int tcpto(); -extern void tcpto_err(); -extern void tcpto_clean(); - -#endif diff --git a/tcpto_clean.c b/tcpto_clean.c @@ -1,20 +0,0 @@ -#include "tcpto.h" -#include "open.h" -#include "substdio.h" -#include "readwrite.h" - -char tcpto_cleanbuf[1024]; - -void tcpto_clean() /* running from queue/mess */ -{ - int fd; - int i; - substdio ss; - - fd = open_write("../lock/tcpto"); - if (fd == -1) return; - substdio_fdbuf(&ss,write,fd,tcpto_cleanbuf,sizeof(tcpto_cleanbuf)); - for (i = 0;i < sizeof(tcpto_cleanbuf);++i) substdio_put(&ss,"",1); - substdio_flush(&ss); /* if it fails, bummer */ - close(fd); -} diff --git a/timeoutconn.c b/timeoutconn.c @@ -1,60 +0,0 @@ -#include "timeoutconn.h" - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include "ndelay.h" -#include "select.h" -#include "error.h" -#include "readwrite.h" -#include "ip.h" -#include "byte.h" - -int timeoutconn(s,ip,port,timeout) -int s; -struct ip_address *ip; -unsigned int port; -int timeout; -{ - char ch; - struct sockaddr_in sin; - char *x; - fd_set wfds; - struct timeval tv; - - byte_zero(&sin,sizeof(sin)); - byte_copy(&sin.sin_addr,4,ip); - x = (char *) &sin.sin_port; - x[1] = port; port >>= 8; x[0] = port; - sin.sin_family = AF_INET; - - if (ndelay_on(s) == -1) return -1; - - /* XXX: could bind s */ - - if (connect(s,(struct sockaddr *) &sin,sizeof(sin)) == 0) { - ndelay_off(s); - return 0; - } - if ((errno != error_inprogress) && (errno != error_wouldblock)) return -1; - - FD_ZERO(&wfds); - FD_SET(s,&wfds); - tv.tv_sec = timeout; tv.tv_usec = 0; - - if (select(s + 1,NULL,&wfds,NULL,&tv) == -1) return -1; - if (FD_ISSET(s,&wfds)) { - unsigned int dummy; - dummy = sizeof(sin); - if (getpeername(s,(struct sockaddr *) &sin,&dummy) == -1) { - read(s,&ch,1); - return -1; - } - ndelay_off(s); - return 0; - } - - errno = error_timeout; /* note that connect attempt is continuing */ - return -1; -} diff --git a/timeoutconn.h b/timeoutconn.h @@ -1,6 +0,0 @@ -#ifndef TIMEOUTCONN_H -#define TIMEOUTCONN_H - -extern int timeoutconn(); - -#endif diff --git a/timeoutread.c b/timeoutread.c @@ -1,23 +0,0 @@ -#include "timeoutread.h" - -#include "select.h" -#include "error.h" -#include "readwrite.h" - -ssize_t timeoutread(int t, int fd, char *buf, size_t len) -{ - fd_set rfds; - struct timeval tv; - - tv.tv_sec = t; - tv.tv_usec = 0; - - FD_ZERO(&rfds); - FD_SET(fd,&rfds); - - if (select(fd + 1,&rfds,NULL,NULL,&tv) == -1) return -1; - if (FD_ISSET(fd,&rfds)) return read(fd,buf,len); - - errno = error_timeout; - return -1; -} diff --git a/timeoutread.h b/timeoutread.h @@ -1,17 +0,0 @@ -#ifndef TIMEOUTREAD_H -#define TIMEOUTREAD_H - -#include <sys/types.h> - -extern ssize_t timeoutread(int t, int fd, char *buf, size_t len); - -#define GEN_SAFE_TIMEOUTREAD(funcname,tout,readfd,doexit) \ -ssize_t funcname(int fd, void *buf, size_t len) \ -{ \ - ssize_t r; \ - r = timeoutread(tout,readfd,buf,len); \ - if (r == 0 || r == -1) doexit; \ - return r; \ -} - -#endif diff --git a/timeoutwrite.c b/timeoutwrite.c @@ -1,23 +0,0 @@ -#include "timeoutwrite.h" - -#include "select.h" -#include "error.h" -#include "readwrite.h" - -ssize_t timeoutwrite(int t, int fd, const void *buf, size_t len) -{ - fd_set wfds; - struct timeval tv; - - tv.tv_sec = t; - tv.tv_usec = 0; - - FD_ZERO(&wfds); - FD_SET(fd,&wfds); - - if (select(fd + 1,NULL,&wfds,NULL,&tv) == -1) return -1; - if (FD_ISSET(fd,&wfds)) return write(fd,buf,len); - - errno = error_timeout; - return -1; -} diff --git a/timeoutwrite.h b/timeoutwrite.h @@ -1,17 +0,0 @@ -#ifndef TIMEOUTWRITE_H -#define TIMEOUTWRITE_H - -#include <sys/types.h> - -extern ssize_t timeoutwrite(int t, int fd, const void *buf, size_t len); - -#define GEN_SAFE_TIMEOUTWRITE(funcname,tout,writefd,doexit) \ -ssize_t funcname(int fd, const void *buf, size_t len) \ -{ \ - ssize_t r; \ - r = timeoutwrite(tout,writefd,buf,len); \ - if (r == 0 || r == -1) doexit; \ - return r; \ -} - -#endif diff --git a/token822.c b/token822.c @@ -1,513 +0,0 @@ -#include "token822.h" - -#include "stralloc.h" -#include "str.h" -#include "gen_allocdefs.h" - -static struct token822 comma = { TOKEN822_COMMA }; - -void token822_reverse(ta) -token822_alloc *ta; -{ - int i; - int n; - struct token822 temp; - - n = ta->len - 1; - for (i = 0;i + i < n;++i) - { - temp = ta->t[i]; - ta->t[i] = ta->t[n - i]; - ta->t[n - i] = temp; - } -} - -GEN_ALLOC_readyplus(token822_alloc,struct token822,t,len,a,30,token822_readyplus) -GEN_ALLOC_ready(token822_alloc,struct token822,t,len,a,30,token822_ready) -GEN_ALLOC_append(token822_alloc,struct token822,t,len,a,30,token822_readyplus,token822_append) - -static int needspace(t1,t2) -int t1; -int t2; -{ - if (!t1) return 0; - if (t1 == TOKEN822_COLON) return 1; - if (t1 == TOKEN822_COMMA) return 1; - if (t2 == TOKEN822_LEFT) return 1; - switch(t1) - { - case TOKEN822_ATOM: case TOKEN822_LITERAL: - case TOKEN822_QUOTE: case TOKEN822_COMMENT: - switch(t2) - { - case TOKEN822_ATOM: case TOKEN822_LITERAL: - case TOKEN822_QUOTE: case TOKEN822_COMMENT: - return 1; - } - } - return 0; -} - -static int atomok(ch) -char ch; -{ - switch(ch) - { - case ' ': case '\t': case '\r': case '\n': - case '(': case '[': case '"': - case '<': case '>': case ';': case ':': - case '@': case ',': case '.': - return 0; - } - return 1; -} - -static void atomcheck(t) -struct token822 *t; -{ - int i; - char ch; - for (i = 0;i < t->slen;++i) - { - ch = t->s[i]; - if ((ch < 32) || (ch > 126) || (ch == ')') || (ch == ']') || (ch == '\\')) - { - t->type = TOKEN822_QUOTE; - return; - } - } -} - -int token822_unparse(sa,ta,linelen) -stralloc *sa; -token822_alloc *ta; -unsigned int linelen; -{ - struct token822 *t; - int len; - int ch; - int i; - int j; - int lasttype; - int newtype; - char *s; - char *lineb; - char *linee; - - len = 0; - lasttype = 0; - for (i = 0;i < ta->len;++i) - { - t = ta->t + i; - newtype = t->type; - if (needspace(lasttype,newtype)) - ++len; - lasttype = newtype; - switch(newtype) - { - case TOKEN822_COMMA: - len += 3; break; - case TOKEN822_AT: case TOKEN822_DOT: case TOKEN822_LEFT: case TOKEN822_RIGHT: - case TOKEN822_SEMI: case TOKEN822_COLON: - ++len; break; - case TOKEN822_ATOM: case TOKEN822_QUOTE: case TOKEN822_LITERAL: case TOKEN822_COMMENT: - if (t->type != TOKEN822_ATOM) len += 2; - for (j = 0;j < t->slen;++j) - switch(ch = t->s[j]) - { - case '"': case '[': case ']': case '(': case ')': - case '\\': case '\r': case '\n': ++len; - default: ++len; - } - break; - } - } - len += 2; - - if (!stralloc_ready(sa,len)) - return -1; - - s = sa->s; - lineb = s; - linee = 0; - - lasttype = 0; - for (i = 0;i < ta->len;++i) - { - t = ta->t + i; - newtype = t->type; - if (needspace(lasttype,newtype)) - *s++ = ' '; - lasttype = newtype; - switch(newtype) - { - case TOKEN822_COMMA: - *s++ = ','; -#define NSUW \ - s[0] = '\n'; s[1] = ' '; \ - if (linee && (!linelen || (s - lineb <= linelen))) \ - { while (linee < s) { linee[0] = linee[2]; ++linee; } linee -= 2; } \ - else { if (linee) lineb = linee + 1; linee = s; s += 2; } - NSUW - break; - case TOKEN822_AT: *s++ = '@'; break; - case TOKEN822_DOT: *s++ = '.'; break; - case TOKEN822_LEFT: *s++ = '<'; break; - case TOKEN822_RIGHT: *s++ = '>'; break; - case TOKEN822_SEMI: *s++ = ';'; break; - case TOKEN822_COLON: *s++ = ':'; break; - case TOKEN822_ATOM: case TOKEN822_QUOTE: case TOKEN822_LITERAL: case TOKEN822_COMMENT: - if (t->type == TOKEN822_QUOTE) *s++ = '"'; - if (t->type == TOKEN822_LITERAL) *s++ = '['; - if (t->type == TOKEN822_COMMENT) *s++ = '('; - for (j = 0;j < t->slen;++j) - switch(ch = t->s[j]) - { - case '"': case '[': case ']': case '(': case ')': - case '\\': case '\r': case '\n': *s++ = '\\'; - default: *s++ = ch; - } - if (t->type == TOKEN822_QUOTE) *s++ = '"'; - if (t->type == TOKEN822_LITERAL) *s++ = ']'; - if (t->type == TOKEN822_COMMENT) *s++ = ')'; - break; - } - } - NSUW - --s; - sa->len = s - sa->s; - return 1; -} - -int token822_unquote(sa,ta) -stralloc *sa; -token822_alloc *ta; -{ - struct token822 *t; - int len; - int i; - int j; - char *s; - - len = 0; - for (i = 0;i < ta->len;++i) - { - t = ta->t + i; - switch(t->type) - { - case TOKEN822_COMMA: case TOKEN822_AT: case TOKEN822_DOT: case TOKEN822_LEFT: - case TOKEN822_RIGHT: case TOKEN822_SEMI: case TOKEN822_COLON: - ++len; break; - case TOKEN822_LITERAL: - len += 2; - case TOKEN822_ATOM: case TOKEN822_QUOTE: - len += t->slen; - } - } - - if (!stralloc_ready(sa,len)) - return -1; - - s = sa->s; - - for (i = 0;i < ta->len;++i) - { - t = ta->t + i; - switch(t->type) - { - case TOKEN822_COMMA: *s++ = ','; break; - case TOKEN822_AT: *s++ = '@'; break; - case TOKEN822_DOT: *s++ = '.'; break; - case TOKEN822_LEFT: *s++ = '<'; break; - case TOKEN822_RIGHT: *s++ = '>'; break; - case TOKEN822_SEMI: *s++ = ';'; break; - case TOKEN822_COLON: *s++ = ':'; break; - case TOKEN822_ATOM: case TOKEN822_QUOTE: case TOKEN822_LITERAL: - if (t->type == TOKEN822_LITERAL) *s++ = '['; - for (j = 0;j < t->slen;++j) - *s++ = t->s[j]; - if (t->type == TOKEN822_LITERAL) *s++ = ']'; - break; - case TOKEN822_COMMENT: break; - } - } - sa->len = s - sa->s; - return 1; -} - -int token822_parse(ta,sa,buf) -token822_alloc *ta; -stralloc *sa; -stralloc *buf; -{ - int i; - int salen; - int level; - struct token822 *t; - int numtoks; - int numchars; - char *cbuf; - - salen = sa->len; - - numchars = 0; - numtoks = 0; - for (i = 0;i < salen;++i) - switch(sa->s[i]) - { - case '.': case ',': case '@': case '<': case '>': case ':': case ';': - ++numtoks; break; - case ' ': case '\t': case '\r': case '\n': break; - case ')': case ']': return 0; - /* other control chars and non-ASCII chars are also bad, in theory */ - case '(': - level = 1; - while (level) - { - if (++i >= salen) return 0; - switch(sa->s[i]) - { - case '(': ++level; break; - case ')': --level; break; - case '\\': if (++i >= salen) return 0; - default: ++numchars; - } - } - ++numtoks; - break; - case '"': - level = 1; - while (level) - { - if (++i >= salen) return 0; - switch(sa->s[i]) - { - case '"': --level; break; - case '\\': if (++i >= salen) return 0; - default: ++numchars; - } - } - ++numtoks; - break; - case '[': - level = 1; - while (level) - { - if (++i >= salen) return 0; - switch(sa->s[i]) - { - case ']': --level; break; - case '\\': if (++i >= salen) return 0; - default: ++numchars; - } - } - ++numtoks; - break; - default: - do - { - if (sa->s[i] == '\\') if (++i >= salen) break; - ++numchars; - if (++i >= salen) - break; - } - while (atomok(sa->s[i])); - --i; - ++numtoks; - } - - if (!token822_ready(ta,numtoks)) - return -1; - if (!stralloc_ready(buf,numchars)) - return -1; - cbuf = buf->s; - ta->len = numtoks; - - t = ta->t; - for (i = 0;i < salen;++i) - switch(sa->s[i]) - { - case '.': t->type = TOKEN822_DOT; ++t; break; - case ',': t->type = TOKEN822_COMMA; ++t; break; - case '@': t->type = TOKEN822_AT; ++t; break; - case '<': t->type = TOKEN822_LEFT; ++t; break; - case '>': t->type = TOKEN822_RIGHT; ++t; break; - case ':': t->type = TOKEN822_COLON; ++t; break; - case ';': t->type = TOKEN822_SEMI; ++t; break; - case ' ': case '\t': case '\r': case '\n': break; - case '(': - t->type = TOKEN822_COMMENT; t->s = cbuf; t->slen = 0; - level = 1; - while (level) - { - ++i; /* assert: < salen */ - switch(sa->s[i]) - { - case '(': ++level; break; - case ')': --level; break; - case '\\': ++i; /* assert: < salen */ - default: *cbuf++ = sa->s[i]; ++t->slen; - } - } - ++t; - break; - case '"': - t->type = TOKEN822_QUOTE; t->s = cbuf; t->slen = 0; - level = 1; - while (level) - { - ++i; /* assert: < salen */ - switch(sa->s[i]) - { - case '"': --level; break; - case '\\': ++i; /* assert: < salen */ - default: *cbuf++ = sa->s[i]; ++t->slen; - } - } - ++t; - break; - case '[': - t->type = TOKEN822_LITERAL; t->s = cbuf; t->slen = 0; - level = 1; - while (level) - { - ++i; /* assert: < salen */ - switch(sa->s[i]) - { - case ']': --level; break; - case '\\': ++i; /* assert: < salen */ - default: *cbuf++ = sa->s[i]; ++t->slen; - } - } - ++t; - break; - default: - t->type = TOKEN822_ATOM; t->s = cbuf; t->slen = 0; - do - { - if (sa->s[i] == '\\') if (++i >= salen) break; - *cbuf++ = sa->s[i]; ++t->slen; - if (++i >= salen) - break; - } - while (atomok(sa->s[i])); - atomcheck(t); - --i; - ++t; - } - return 1; -} - -static int gotaddr(taout,taaddr,callback) -token822_alloc *taout; -token822_alloc *taaddr; -int (*callback)(); -{ - int i; - - if (callback(taaddr) != 1) - return 0; - - if (!token822_readyplus(taout,taaddr->len)) - return 0; - - for (i = 0;i < taaddr->len;++i) - taout->t[taout->len++] = taaddr->t[i]; - - taaddr->len = 0; - return 1; -} - -int token822_addrlist(taout,taaddr,ta,callback) -token822_alloc *taout; -token822_alloc *taaddr; -token822_alloc *ta; -int (*callback)(); -{ - struct token822 *t; - struct token822 *beginning; - int ingroup; - int wordok; - - taout->len = 0; - taaddr->len = 0; - - if (!token822_readyplus(taout,1)) return -1; - if (!token822_readyplus(taaddr,1)) return -1; - - ingroup = 0; - wordok = 1; - - beginning = ta->t + 2; - t = ta->t + ta->len - 1; - - /* rfc 822 address lists are easy to parse from right to left */ - -#define FLUSH if (taaddr->len) if (!gotaddr(taout,taaddr,callback)) return -1; -#define FLUSHCOMMA if (taaddr->len) { \ -if (!gotaddr(taout,taaddr,callback)) return -1; \ -if (!token822_append(taout,&comma)) return -1; } -#define ADDRLEFT if (!token822_append(taaddr,t--)) return -1; -#define OUTLEFT if (!token822_append(taout,t--)) return -1; - - while (t >= beginning) - { - switch(t->type) - { - case TOKEN822_SEMI: - FLUSHCOMMA - if (ingroup) return 0; - ingroup = 1; - wordok = 1; - break; - case TOKEN822_COLON: - FLUSH - if (!ingroup) return 0; - ingroup = 0; - while ((t >= beginning) && (t->type != TOKEN822_COMMA)) - OUTLEFT - if (t >= beginning) - OUTLEFT - wordok = 1; - continue; - case TOKEN822_RIGHT: - FLUSHCOMMA - OUTLEFT - while ((t >= beginning) && (t->type != TOKEN822_LEFT)) - ADDRLEFT - /* important to use address here even if it's empty: <> */ - if (!gotaddr(taout,taaddr,callback)) return -1; - if (t < beginning) return 0; - OUTLEFT - while ((t >= beginning) && ((t->type == TOKEN822_COMMENT) || (t->type == TOKEN822_ATOM) || (t->type == TOKEN822_QUOTE) || (t->type == TOKEN822_AT) || (t->type == TOKEN822_DOT))) - OUTLEFT - wordok = 0; - continue; - case TOKEN822_ATOM: case TOKEN822_QUOTE: case TOKEN822_LITERAL: - if (!wordok) - FLUSHCOMMA - wordok = 0; - ADDRLEFT - continue; - case TOKEN822_COMMENT: - /* comment is lexically a space; shouldn't affect wordok */ - break; - case TOKEN822_COMMA: - FLUSH - wordok = 1; - break; - default: - wordok = 1; - ADDRLEFT - continue; - } - OUTLEFT - } - FLUSH - ++t; - while (t > ta->t) - if (!token822_append(taout,--t)) return -1; - - token822_reverse(taout); - return 1; -} diff --git a/token822.h b/token822.h @@ -1,37 +0,0 @@ -#ifndef TOKEN822_H -#define TOKEN822_H - -struct token822 - { - int type; - char *s; - int slen; - } -; - -#include "gen_alloc.h" -GEN_ALLOC_typedef(token822_alloc,struct token822,t,len,a) - -extern int token822_parse(); -extern int token822_addrlist(); -extern int token822_unquote(); -extern int token822_unparse(); -extern void token822_free(); -extern void token822_reverse(); -extern int token822_ready(); -extern int token822_readyplus(); -extern int token822_append(); - -#define TOKEN822_ATOM 1 -#define TOKEN822_QUOTE 2 -#define TOKEN822_LITERAL 3 -#define TOKEN822_COMMENT 4 -#define TOKEN822_LEFT 5 -#define TOKEN822_RIGHT 6 -#define TOKEN822_AT 7 -#define TOKEN822_COMMA 8 -#define TOKEN822_SEMI 9 -#define TOKEN822_COLON 10 -#define TOKEN822_DOT 11 - -#endif diff --git a/trigger.c b/trigger.c @@ -1,43 +0,0 @@ -#include "trigger.h" - -#include <unistd.h> -#include "select.h" -#include "open.h" -#include "hasnpbg1.h" - -static int fd = -1; -#ifdef HASNAMEDPIPEBUG1 -static int fdw = -1; -#endif - -void trigger_set() -{ - if (fd != -1) - close(fd); -#ifdef HASNAMEDPIPEBUG1 - if (fdw != -1) - close(fdw); -#endif - fd = open_read("lock/trigger"); -#ifdef HASNAMEDPIPEBUG1 - fdw = open_write("lock/trigger"); -#endif -} - -void trigger_selprep(nfds,rfds) -int *nfds; -fd_set *rfds; -{ - if (fd != -1) - { - FD_SET(fd,rfds); - if (*nfds < fd + 1) *nfds = fd + 1; - } -} - -int trigger_pulled(rfds) -fd_set *rfds; -{ - if (fd != -1) if (FD_ISSET(fd,rfds)) return 1; - return 0; -} diff --git a/trigger.h b/trigger.h @@ -1,8 +0,0 @@ -#ifndef TRIGGER_H -#define TRIGGER_H - -extern void trigger_set(); -extern void trigger_selprep(); -extern int trigger_pulled(); - -#endif diff --git a/triggerpull.c b/triggerpull.c @@ -1,18 +0,0 @@ -#include "triggerpull.h" - -#include <unistd.h> -#include "ndelay.h" -#include "open.h" - -void triggerpull() -{ - int fd; - - fd = open_write("lock/trigger"); - if (fd >= 0) - { - ndelay_on(fd); - write(fd,"",1); /* if it fails, bummer */ - close(fd); - } -} diff --git a/triggerpull.h b/triggerpull.h @@ -1,6 +0,0 @@ -#ifndef TRIGGERPULL_H -#define TRIGGERPULL_H - -extern void triggerpull(); - -#endif diff --git a/trydrent.c b/trydrent.c @@ -1,8 +0,0 @@ -#include <sys/types.h> -#include <dirent.h> - -void foo() -{ - DIR *dir; - struct dirent *d; -} diff --git a/tryflock.c b/tryflock.c @@ -1,8 +0,0 @@ -#include <sys/types.h> -#include <sys/file.h> -#include <fcntl.h> - -int main(void) -{ - return flock(0,LOCK_EX | LOCK_UN | LOCK_NB); -} diff --git a/trylsock.c b/trylsock.c @@ -1,5 +0,0 @@ -int -main() -{ - return 0; -} diff --git a/trymkffo.c b/trymkffo.c @@ -1,7 +0,0 @@ -#include <sys/types.h> -#include <sys/stat.h> - -int main(void) -{ - return mkfifo("temp-trymkffo",0); -} diff --git a/trynpbg1.c b/trynpbg1.c @@ -1,28 +0,0 @@ -#include <stddef.h> -#include <unistd.h> -#include "select.h" -#include "open.h" -#include "fifo.h" - -#define FN "temp-trynpbg1.fifo" - -int main(void) -{ - int flagbug; - struct timeval instant; - fd_set rfds; - - flagbug = 0; - if (fifo_make(FN,0600) != -1) { - close(0); - if (open_read(FN) == 0) { - FD_ZERO(&rfds); - FD_SET(0,&rfds); - instant.tv_sec = instant.tv_usec = 0; - if (select(1,&rfds,NULL,NULL,&instant) > 0) - flagbug = 1; - } - unlink(FN); - } - return !flagbug; -} diff --git a/tryrsolv.c b/tryrsolv.c @@ -1,5 +0,0 @@ -int -main() -{ - return 0; -} diff --git a/trysalen.c b/trysalen.c @@ -1,11 +0,0 @@ -#include <sys/types.h> -#include <sys/param.h> -#include <sys/time.h> -#include <sys/ioctl.h> -#include <sys/socket.h> - -void foo() -{ - struct sockaddr sa; - sa.sa_len = 0; -} diff --git a/trysgact.c b/trysgact.c @@ -1,12 +0,0 @@ -#include <signal.h> -#include <stddef.h> - -int main(void) -{ - struct sigaction sa; - sa.sa_handler = 0; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - sigaction(0,&sa,NULL); - return 0; -} diff --git a/trysgprm.c b/trysgprm.c @@ -1,12 +0,0 @@ -#include <signal.h> -#include <stddef.h> - -int main(void) -{ - sigset_t ss; - - sigemptyset(&ss); - sigaddset(&ss,SIGCHLD); - sigprocmask(SIG_SETMASK,&ss,NULL); - return 0; -} diff --git a/trysysel.c b/trysysel.c @@ -1,9 +0,0 @@ -#include <sys/types.h> -#include <sys/time.h> -#include <sys/select.h> /* SVR4 silliness */ -#include <stddef.h> - -int foo() -{ - return select(0, NULL, NULL, NULL, NULL); -} diff --git a/trysyslog.c b/trysyslog.c @@ -1,11 +0,0 @@ -#include <sys/types.h> -#include <sys/time.h> -#include <syslog.h> - -int -main() -{ - openlog("foo",0,LOG_MAIL); - syslog(0,"foo"); - return 0; -} diff --git a/tryutmpx.c b/tryutmpx.c @@ -1,8 +0,0 @@ -#include <utmpx.h> - -int main(void) -{ - struct utmpx ut; - ut.ut_type = sizeof(ut.ut_line) + sizeof(ut.ut_user); - return 0; -} diff --git a/trywaitp.c b/trywaitp.c @@ -1,8 +0,0 @@ -#include <sys/types.h> -#include <sys/wait.h> -#include <stddef.h> - -int main(void) -{ - return waitpid(0,NULL,0); -} diff --git a/uid.c b/uid.c @@ -1,21 +0,0 @@ -#include <sys/types.h> -#include <pwd.h> -#include <unistd.h> -#include "uidgid.h" -#include "subfd.h" -#include "substdio.h" - -uid_t -inituid(char *user) -{ - struct passwd *pw; - pw = getpwnam(user); - if (!pw) { - substdio_puts(subfderr,"fatal: unable to find user "); - substdio_puts(subfderr,user); - substdio_puts(subfderr,"\n"); - substdio_flush(subfderr); - _exit(111); - } - return pw->pw_uid; -} diff --git a/uidgid.h b/uidgid.h @@ -1,9 +0,0 @@ -#ifndef UIDGID_H -#define UIDGID_H - -#include <sys/types.h> - -extern uid_t inituid(char *uid); -extern gid_t initgid(char *gid); - -#endif diff --git a/uint32.h b/uint32.h @@ -1,8 +0,0 @@ -#ifndef UINT32_H -#define UINT32_H - -#include <stdint.h> - -typedef uint32_t uint32; - -#endif diff --git a/wait.h b/wait.h @@ -1,14 +0,0 @@ -#ifndef WAIT_H -#define WAIT_H - -extern int wait_pid(); -extern int wait_nohang(); -extern int wait_stop(); -extern int wait_stopnohang(); - -#define wait_crashed(w) ((w) & 127) -#define wait_exitcode(w) ((w) >> 8) -#define wait_stopsig(w) ((w) >> 8) -#define wait_stopped(w) (((w) & 127) == 127) - -#endif diff --git a/wait_nohang.c b/wait_nohang.c @@ -1,13 +0,0 @@ -#include <sys/types.h> -#include <sys/wait.h> -#include <stddef.h> -#include "haswaitp.h" - -int wait_nohang(wstat) int *wstat; -{ -#ifdef HASWAITPID - return waitpid(-1,wstat,WNOHANG); -#else - return wait3(wstat,WNOHANG,NULL); -#endif -} diff --git a/wait_pid.c b/wait_pid.c @@ -1,39 +0,0 @@ -#include <sys/types.h> -#include <sys/wait.h> -#include "error.h" -#include "haswaitp.h" - -#ifdef HASWAITPID - -int wait_pid(wstat,pid) int *wstat; int pid; -{ - int r; - - do - r = waitpid(pid,wstat,0); - while ((r == -1) && (errno == error_intr)); - return r; -} - -#else - -/* XXX untested */ -/* XXX breaks down with more than two children */ -static int oldpid = 0; -static int oldwstat; /* defined if(oldpid) */ - -int wait_pid(wstat,pid) int *wstat; int pid; -{ - int r; - - if (pid == oldpid) { *wstat = oldwstat; oldpid = 0; return pid; } - - do { - r = wait(wstat); - if ((r != pid) && (r != -1)) { oldwstat = *wstat; oldpid = r; continue; } - } - while ((r == -1) && (errno == error_intr)); - return r; -} - -#endif