Removed msgchk(1) as it is hardly useful without POP support.
authormarkus schnalke <meillo@marmaro.de>
Tue, 1 May 2012 13:30:39 +0000 (15:30 +0200)
committermarkus schnalke <meillo@marmaro.de>
Tue, 1 May 2012 13:30:39 +0000 (15:30 +0200)
It is questionable if msgchk(1) provides more information than:
ls -l /var/mail/meillo
It does separate between old and new mail, but that's not very useful
and can be found out with stat(1) too. A very small shell script should
be equally useful, if there's someone who really uses msgchk(1) and not
simply `inc's.
Concerning the administrative uses of msgchk(1), i.e. querying a set of
users, that's no MUA's task and thus a reason to remove the tool. But
eventually, the question remains the same: What does it provide more than
`ls -l' and `ls -lu'? Is it worth to keep it around? IMO, no.

INSTALL
docs/COMPLETION-BASH
man/Makefile.in
man/mmh-intro.man7
man/msgchk.man1 [deleted file]
uip/Makefile.in
uip/msgchk.c [deleted file]

diff --git a/INSTALL b/INSTALL
index 14ae90f..8f3b7d3 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -132,12 +132,11 @@ Options for configure
      Enable debugging support.
 
 --with-locking=LOCKTYPE    (DEFAULT is dot)
      Enable debugging support.
 
 --with-locking=LOCKTYPE    (DEFAULT is dot)
-     Specify the locking mechanism when attempting to "inc" or
-     "msgchk" a local mail spool. Valid options are "dot",
-     "fcntl", "flock", and "lockf". Of the four, dot-locking
-     requires no special kernel or filesystem support, and simply
-     creates a file called "FILE.lock" to indicate that "FILE" is
-     locked.
+     Specify the locking mechanism when attempting to "inc"
+     a local mail spool. Valid options are "dot", "fcntl", "flock",
+     and "lockf". Of the four, dot-locking requires no special kernel
+     or filesystem support, and simply creates a file called
+     "FILE.lock" to indicate that "FILE" is locked.
 
      In order to be effective, you should contact the site
      administrator to find out what locking mechanisms other
 
      In order to be effective, you should contact the site
      administrator to find out what locking mechanisms other
index da20671..35cdf9f 100644 (file)
@@ -149,4 +149,4 @@ _nmh()
     COMPREPLY=( $( compgen -W "${options[*]}" -- $current ) )
     return 0
 }
     COMPREPLY=( $( compgen -W "${options[*]}" -- $current ) )
     return 0
 }
-[ "$have" ] && complete -F _nmh ali anno burst comp dist flist flists folder folders forw inc mark mhbuild mhl mhlist mhmail mhparam mhpath mhstore msgchk next packf pick prev prompter rcvdist rcvpack rcvstore refile repl rmf rmm scan send sendfiles show slocal sortm whatnow
+[ "$have" ] && complete -F _nmh ali anno burst comp dist flist flists folder folders forw inc mark mhbuild mhl mhlist mhmail mhparam mhpath mhstore next packf pick prev prompter rcvdist rcvpack rcvstore refile repl rmf rmm scan send sendfiles show slocal sortm whatnow
index 27d3622..cf79c47 100644 (file)
@@ -51,7 +51,7 @@ SEDMAN = $(SED) -f man.sed $< > $@
 # man pages to install in $(mandir)/$(manext1)
 MAN1SRC = ali. anno. burst. comp. dist. flist. flists. folder. folders.    \
        forw. inc. mark. mhbuild. mhl. mhlist. mmh. mmhwrap.              \
 # man pages to install in $(mandir)/$(manext1)
 MAN1SRC = ali. anno. burst. comp. dist. flist. flists. folder. folders.    \
        forw. inc. mark. mhbuild. mhl. mhlist. mmh. mmhwrap.              \
-       mhmail. mhparam. mhpath. mhstore. msgchk. new. fnext.       \
+       mhmail. mhparam. mhpath. mhstore. new. fnext.       \
        fprev. unseen. next. packf. pick. prev. prompter. rcvdist. rcvpack. \
        rcvstore. refile. repl. rmf. rmm. scan. send. sendfiles.    \
        show. slocal. sortm. whatnow.
        fprev. unseen. next. packf. pick. prev. prompter. rcvdist. rcvpack. \
        rcvstore. refile. repl. rmf. rmm. scan. send. sendfiles.    \
        show. slocal. sortm. whatnow.
index 212f392..ac54e12 100644 (file)
@@ -200,7 +200,6 @@ commands:
 ^mhpath(1)~^\- print full pathnames of mmh messages and folders
 ^mhstore(1)~^\- store contents of MIME messages into files
 ^mmh(1)~^\- initialize the mmh environment
 ^mhpath(1)~^\- print full pathnames of mmh messages and folders
 ^mhstore(1)~^\- store contents of MIME messages into files
 ^mmh(1)~^\- initialize the mmh environment
-^msgchk(1)~^\- check for messages
 ^next(1)~^\- show the next message
 ^packf(1)~^\- pack a folder into mbox format
 ^pick(1)~^\- select messages by content
 ^next(1)~^\- show the next message
 ^packf(1)~^\- pack a folder into mbox format
 ^pick(1)~^\- select messages by content
diff --git a/man/msgchk.man1 b/man/msgchk.man1
deleted file mode 100644 (file)
index ff41dd0..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-.\"
-.\" %nmhwarning%
-.\"
-.TH MSGCHK %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
-.SH NAME
-msgchk \- check system mail drop for messages
-.SH SYNOPSIS
-.HP 5
-.na
-.B msgchk
-.RB [ \-date " | " \-nodate ]
-.RB [ \-notify
-all/mail/nomail ]
-.RB [ \-nonotify
-all/mail/nomail ]
-.RI [ users
-\&... ]
-.RB [ \-Version ]
-.RB [ \-help ]
-.ad
-.SH DESCRIPTION
-The
-.B msgchk
-program checks your system mail drop for mail waiting
-for you, or the given users.
-If the requested users have mail,
-.B msgchk
-will
-indicate if it believes that they have seen the mail in question before.
-.PP
-The
-.B \-notify
-.I type
-switch indicates under what circumstances
-.B msgchk
-should produce a message.  The default is
-.B \-notify
-.I all
-which says that
-.B msgchk
-should always report the status of the
-users maildrop.  Other values for `type' include `mail' which says that
-.B msgchk
-should report the status of waiting mail; and, `nomail'
-which says that
-.B msgchk
-should report the status of empty maildrops.
-The
-.B \-nonotify
-.I type
-switch has the inverted sense, so
-.B \-nonotify
-.I all
-directs
-.B msgchk
-to never report the status of
-maildrops.  This is useful if the user wishes to check
-.BR msgchk 's
-exit status.  A non\-zero exit status indicates that mail was
-.B not
-waiting for at least one of the indicated users.
-.PP
-If
-.B msgchk
-produces output, then the
-.B \-date
-switch directs
-.B msgchk
-to print out the last date mail was read, if this can
-be determined.
-.PP
-If
-.I users
-are given, then
-.B msgchk
-will only check the default system mail drops.
-Otherwise,
-.B msgchk
-will evaluate the environment variable
-.I MAILDROP
-and profile component
-.I MailDrop
-(in this order) first and, if they are set and non-empty,
-checks that mail drop instead of the system default mail drop.
-
-.SH FILES
-.fc ^ ~
-.nf
-.ta \w'%etcdir%/ExtraBigFileName  'u
-^$HOME/.mmh/profile~^The user profile
-^%mailspool%/$USER~^Location of mail drop
-.fi
-
-.SH "PROFILE COMPONENTS"
-.fc ^ ~
-.nf
-.ta 2.4i
-.ta \w'ExtraBigName  'u
-^MailDrop~^Supersedes the default mail drop location
-.fi
-
-.SH ENVIRONMENT
-.fc ^ ~
-.nf
-.ta \w'ExtraBigName  'u
-^MAILDROP~^Highest priority alternative mail drop location
-.fi
-
-
-.SH "SEE ALSO"
-inc(1)
-
-.SH DEFAULTS
-.nf
-.RB ` user "' defaults to the current user"
-.RB ` \-date '
-.RB ` "\-notify\ all" '
-.fi
-
-.SH CONTEXT
-None
index 4e68ee1..04df405 100644 (file)
@@ -49,7 +49,7 @@ SETGID_MAIL    = @SETGID_MAIL@
 # commands to build
 CMDS = ali anno burst comp dist flist folder forw mmh mark \
        mhbuild mhl \
 # commands to build
 CMDS = ali anno burst comp dist flist folder forw mmh mark \
        mhbuild mhl \
-       mhlist mhmail mhparam mhpath mhstore msgchk new packf pick \
+       mhlist mhmail mhparam mhpath mhstore new packf pick \
        print-mimetype prompter rcvdist rcvpack rcvstore refile repl rmf \
        rmm scan send sendfiles show slocal sortm spost whatnow
 
        print-mimetype prompter rcvdist rcvpack rcvstore refile repl rmf \
        rmm scan send sendfiles show slocal sortm spost whatnow
 
@@ -69,7 +69,7 @@ SRCS = ali.c aliasbr.c anno.c ap.c burst.c comp.c \
        mhfree.c mhl.c mhlist.c mhlistsbr.c \
        mhmail.c mhmisc.c mhoutsbr.c mhparam.c mhparse.c \
        mhpath.c mhshow.c mhshowsbr.c mhstore.c mhtest.c \
        mhfree.c mhl.c mhlist.c mhlistsbr.c \
        mhmail.c mhmisc.c mhoutsbr.c mhparam.c mhparse.c \
        mhpath.c mhshow.c mhshowsbr.c mhstore.c mhtest.c \
-       msgchk.c new.c packf.c pick.c print-mimetype.sh \
+       new.c packf.c pick.c print-mimetype.sh \
        prompter.c rcvdist.c rcvpack.c rcvstore.c \
        refile.c repl.c rmf.c rmm.c scan.c scansbr.c send.c \
        sendfiles.sh slocal.c sortm.c spost.c termsbr.c \
        prompter.c rcvdist.c rcvpack.c rcvstore.c \
        refile.c repl.c rmf.c rmm.c scan.c scansbr.c send.c \
        sendfiles.sh slocal.c sortm.c spost.c termsbr.c \
@@ -161,9 +161,6 @@ mhstore: mhstore.o mhparse.o mhshowsbr.o mhlistsbr.o mhmisc.o mhfree.o termsbr.o
 mhtest: mhtest.o mhparse.o mhoutsbr.o mhmisc.o mhfree.o termsbr.o $(LOCALLIBS)
        $(LINK) mhtest.o mhparse.o mhoutsbr.o mhmisc.o mhfree.o termsbr.o $(LINKLIBS) $(TERMLIB)
 
 mhtest: mhtest.o mhparse.o mhoutsbr.o mhmisc.o mhfree.o termsbr.o $(LOCALLIBS)
        $(LINK) mhtest.o mhparse.o mhoutsbr.o mhmisc.o mhfree.o termsbr.o $(LINKLIBS) $(TERMLIB)
 
-msgchk: msgchk.o $(LOCALLIBS)
-       $(LINK) msgchk.o $(LINKLIBS)
-
 new: new.o $(LOCALLIBS)
        $(LINK) new.o $(LINKLIBS)
 
 new: new.o $(LOCALLIBS)
        $(LINK) new.o $(LINKLIBS)
 
diff --git a/uip/msgchk.c b/uip/msgchk.c
deleted file mode 100644 (file)
index dfbdd69..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
-** msgchk.c -- check for mail
-**
-** This code is Copyright (c) 2002, by the authors of nmh.  See the
-** COPYRIGHT file in the root directory of the nmh distribution for
-** complete copyright information.
-*/
-
-#include <h/mh.h>
-#include <h/tws.h>
-#include <pwd.h>
-
-static struct swit switches[] = {
-#define DATESW  0
-       { "date", 0 },
-#define NDATESW  1
-       { "nodate", 0 },
-#define NOTESW  2
-       { "notify type", 0 },
-#define NNOTESW  3
-       { "nonotify type", 0 },
-#define VERSIONSW  4
-       { "Version", 0 },
-#define HELPSW  5
-       { "help", 0 },
-       { NULL, 0 },
-};
-
-/*
-** Maximum numbers of users we can check (plus
-** one for the NULL vector at the end).
-*/
-#define MAXVEC  51
-
-#define NT_MAIL  0x1
-#define NT_NMAI  0x2
-#define NT_ALL   (NT_MAIL | NT_NMAI)
-
-#define NONEOK   0x0
-#define MAILOLD  0x4
-#define MAILNEW  0x8
-#define MAILOK   (MAILOLD | MAILNEW)
-
-
-/*
-** static prototypes
-*/
-static int donote(char *, int);
-static int checkmail(char *, int, int, int);
-
-
-int
-main(int argc, char **argv)
-{
-       int datesw = 1, notifysw = NT_ALL;
-       int status = 0;
-       int vecp = 0;
-       char buf[BUFSIZ];
-       char *user, *cp;
-       char **argp, **arguments, *vec[MAXVEC];
-       struct passwd *pw;
-
-#ifdef LOCALE
-       setlocale(LC_ALL, "");
-#endif
-       invo_name = mhbasename(argv[0]);
-
-       /* read user profile/context */
-       context_read();
-
-       user = getusername();
-
-       arguments = getarguments(invo_name, argc, argv, 1);
-       argp = arguments;
-
-       while ((cp = *argp++)) {
-               if (*cp == '-') {
-                       switch (smatch(++cp, switches)) {
-                       case AMBIGSW:
-                               ambigsw(cp, switches);
-                               done(1);
-                       case UNKWNSW:
-                               adios(NULL, "-%s unknown", cp);
-
-                       case HELPSW:
-                               snprintf(buf, sizeof(buf), "%s [switches] [users ...]", invo_name);
-                               print_help(buf, switches, 1);
-                               done(1);
-                       case VERSIONSW:
-                               print_version(invo_name);
-                               done(1);
-
-                       case DATESW:
-                               datesw++;
-                               continue;
-                       case NDATESW:
-                               datesw = 0;
-                               continue;
-
-                       case NOTESW:
-                               if (!(cp = *argp++) || *cp == '-')
-                                       adios(NULL, "missing argument to %s",
-                                                       argp[-2]);
-                               notifysw |= donote(cp, 1);
-                               continue;
-                       case NNOTESW:
-                               if (!(cp = *argp++) || *cp == '-')
-                                       adios(NULL, "missing argument to %s",
-                                                       argp[-2]);
-                               notifysw &= ~donote(cp, 0);
-                               continue;
-                       }
-               }
-               if (vecp >= MAXVEC-1)
-                       adios(NULL, "you can only check %d users at a time",
-                                       MAXVEC-1);
-               else
-                       vec[vecp++] = cp;
-       }
-
-       if (!vecp) {
-               done(checkmail(user, datesw, notifysw, 1));
-               return 1;
-       }
-
-       vec[vecp] = NULL;
-       for (vecp = 0; vec[vecp]; vecp++) {
-               if ((pw = getpwnam(vec[vecp])))
-                       status += checkmail(pw->pw_name, datesw, notifysw, 0);
-               else
-                       advise(NULL, "no such user as %s", vec[vecp]);
-       }
-       done(status);
-       return 1;
-}
-
-
-static struct swit ntswitches[] = {
-#define NALLSW  0
-       { "all", 0 },
-#define NMAISW  1
-       { "mail", 0 },
-#define NNMAISW  2
-       { "nomail", 0 },
-       { NULL, 0 }
-};
-
-
-static int
-donote(char *cp, int ntflag)
-{
-       switch (smatch(cp, ntswitches)) {
-       case AMBIGSW:
-               ambigsw(cp, ntswitches);
-               done(1);
-       case UNKWNSW:
-               adios(NULL, "-%snotify %s unknown", ntflag ? "" : "no", cp);
-
-       case NALLSW:
-               return NT_ALL;
-       case NMAISW:
-               return NT_MAIL;
-       case NNMAISW:
-               return NT_NMAI;
-       }
-
-       /* Before 1999-07-15, garbage was returned if control got here. */
-       return 0;
-}
-
-
-static int
-checkmail(char *user, int datesw, int notifysw, int personal)
-{
-       int mf, status;
-       char buffer[BUFSIZ];
-       struct stat st;
-       char *maildrop;
-
-       if (personal) {
-               /*
-               ** Evaluate the env var and profile only if the check is
-               ** for the calling user.
-               */
-               if ((maildrop = getenv("MAILDROP")) && *maildrop) {
-                       snprintf(buffer, sizeof buffer, "%s",
-                                       toabsdir(maildrop));
-               } else if ((maildrop=context_find("maildrop")) && *maildrop) {
-                       snprintf(buffer, sizeof buffer, "%s",
-                                       toabsdir(maildrop));
-               } else {
-                       snprintf(buffer, sizeof buffer, "%s/%s",
-                                       mailspool, user);
-               }
-       } else {
-               snprintf(buffer, sizeof(buffer), "%s/%s", mailspool, user);
-       }
-       if (datesw) {
-               st.st_size = 0;
-               st.st_atime = st.st_mtime = 0;
-       }
-       mf = (stat(buffer, &st) == NOTOK || st.st_size == 0) ? NONEOK
-               : st.st_atime <= st.st_mtime ? MAILNEW : MAILOLD;
-
-       if (mf & MAILOK) {
-               if (notifysw & NT_MAIL) {
-                       if (personal) {
-                               printf("You have ");
-                       } else {
-                               printf("%s has ", user);
-                       }
-                       if (mf & MAILOK)
-                               printf(mf & MAILOLD ? "old" : "new");
-                       printf(" mail waiting");
-               } else {
-                       notifysw = 0;
-               }
-               status = 0;
-       } else {
-               if (notifysw & NT_NMAI) {
-                       if (personal) {
-                               printf("You don't have any mail waiting");
-                       } else {
-                               printf("%s doesn't have any mail waiting",
-                                               user);
-                       }
-               } else {
-                       notifysw = 0;
-               }
-               status = 1;
-       }
-
-       if (notifysw) {
-               if (datesw && st.st_atime) {
-                       printf("; last read on %s", dtime(&st.st_atime));
-               }
-               printf("\n");
-       }
-
-       return status;
-}