From 2b266bab3687c078061c7b8bf3676ef3a61d53a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 27 Jun 2003 14:06:30 +0000 Subject: Include the sendmail compatibility executables symlinks and the respective man pages. --- main.c | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) (limited to 'main.c') 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) { -- cgit v1.2.3-2-g168b