summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@users.sourceforge.net>2003-06-27 14:06:30 +0000
committerJosé Fonseca <jrfonseca@users.sourceforge.net>2003-06-27 14:06:30 +0000
commit2b266bab3687c078061c7b8bf3676ef3a61d53a7 (patch)
tree13914933d0c5d6225214160eea43dbc2fe49eca7
parentfb16b58b55d7d072a6666566c5526a271dbbb561 (diff)
Include the sendmail compatibility executables symlinks and the respective man
pages.
-rw-r--r--Makefile.am12
-rw-r--r--TODO1
-rw-r--r--configure.ac1
-rw-r--r--esmtp.19
-rw-r--r--main.c48
5 files changed, 60 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am
index 6d6d1ae..fd59cb0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,3 +7,15 @@ esmtp_SOURCES = esmtp.h main.c parser.y lexer.l
EXTRA_DIST = README.mutt sample.esmtprc
AM_YFLAGS = -d
+
+install-exec-hook:
+ $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(libdir)
+ $(LN_S) $(bindir)/esmtp $(DESTDIR)$(sbindir)/sendmail
+ $(LN_S) $(bindir)/esmtp $(DESTDIR)$(libdir)/sendmail
+ $(LN_S) $(bindir)/esmtp $(DESTDIR)$(bindir)/mailq
+ $(LN_S) $(bindir)/esmtp $(DESTDIR)$(bindir)/newaliases
+
+install-data-hook:
+ $(LN_S) esmtp.1 $(DESTDIR)$(man1dir)/sendmail.1
+ $(LN_S) esmtp.1 $(DESTDIR)$(man1dir)/mailq.1
+ $(LN_S) esmtp.1 $(DESTDIR)$(man1dir)/newaliases.1
diff --git a/TODO b/TODO
index 0b74cb8..eceb350 100644
--- a/TODO
+++ b/TODO
@@ -1,2 +1,3 @@
- handle the '-t' option
- safer memory allocation
+- local mail delivery
diff --git a/configure.ac b/configure.ac
index 1628432..0e01653 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,7 @@ dnl getopt needs this
AC_C_CONST
AM_PROG_LEX
+AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_YACC
diff --git a/esmtp.1 b/esmtp.1
index 713b878..995dd35 100644
--- a/esmtp.1
+++ b/esmtp.1
@@ -16,6 +16,13 @@ libESMTP to Sendmail compatibility interface
.SH SYNOPSIS
\fBesmtp\fR [\fIflags\fR] [\fIaddress ...\fR]
+\fBsendmail\fR [\fIflags\fR] [\fIaddress ...\fR]
+
+\fBmailq\fR
+\fBsendmail -bp\fR
+
+\fBnewaliases\fR
+\fBsendmail -I\fR
.SH DESCRIPTION
\fBEsmtp\fR is a send-only \fBsendmail\fR emulator for machines which normally
@@ -74,7 +81,7 @@ Initialize the alias database.
Deliver mail in the usual way.
.TP
-\fB\-bp\fR (unsupported)
+\fB\-bp\fR (ignored)
Print a listing of the queue(s).
.TP
diff --git a/main.c b/main.c
index f34a852..18672d1 100644
--- a/main.c
+++ b/main.c
@@ -190,14 +190,6 @@ void usage (void)
stderr);
}
-void version (void)
-{
- char buf[32];
-
- smtp_version (buf, sizeof buf, 0);
- printf ("libESMTP version %s\n", buf);
-}
-
/* Callback to request user/password info. Not thread safe. */
int authinteract (auth_client_request_t request, char **result, int fields,
void *arg)
@@ -267,6 +259,23 @@ int main (int argc, char **argv)
identity_t *identity = &default_identity;
char *from = NULL;
identity_list_t *p;
+
+ /* Modes of operation. */
+ enum {
+ ENQUEUE, /* delivery mode */
+ NEWALIAS, /* initialize alias database */
+ MAILQ, /* list mail queue */
+ FLUSHQ, /* flush the mail queue */
+ } mode;
+
+ /* Set the default mode of operation. */
+ if (strcmp(argv[0], "mailq") == 0) {
+ mode = MAILQ;
+ } else if (strcmp(argv[0], "newaliases") == 0) {
+ mode = NEWALIAS;
+ } else {
+ mode = ENQUEUE;
+ }
/* Parse the rc file. */
parse_rcfile();
@@ -303,6 +312,7 @@ int main (int argc, char **argv)
case 'I':
/* Initialize alias database */
+ mode = NEWALIAS;
break;
case 'L':
@@ -356,12 +366,19 @@ int main (int argc, char **argv)
{
case 'm':
/* Deliver mail in the usual way */
+ mode = ENQUEUE;
break;
case 'i':
/* Initialize the alias database */
+ mode = NEWALIAS;
break;
+ case 'p':
+ /* Print a listing of the queue(s) */
+ mode = MAILQ;
+ break;
+
case 'a':
/* Go into ARPANET mode */
case 'd':
@@ -373,8 +390,6 @@ int main (int argc, char **argv)
case 'H':
/* Purge expired entries from the persistent host
* status database */
- case 'p':
- /* Print a listing of the queue(s) */
case 'P':
/* Print number of entries in the queue(s) */
case 's':
@@ -450,6 +465,7 @@ int main (int argc, char **argv)
case 'q':
/* Run queue files at intervals */
+ mode = FLUSHQ;
if (optarg[0] == '!')
{
/* Negate the meaning of pattern match */
@@ -510,6 +526,18 @@ int main (int argc, char **argv)
exit (64);
}
+ switch (mode)
+ {
+ case ENQUEUE:
+ break;
+
+ case MAILQ:
+ printf ("Mail queue is empty\n");
+ case NEWALIAS:
+ case FLUSHQ:
+ exit (0);
+ }
+
/* At least one more argument is needed. */
if (optind > argc - 1)
{