Folks:

In the mail program in mailutils, I believe that the POSIX spec has
been misinterpreted.

It states the following, regarding commands being implicitly assumed
to be "next" commands:

22865   "Regular commands are of the form:

22866   [command] [msglist] [argument ...]

22867   If no command is specified in command mode, next shall be assumed."

The word "command" is italicized in line 22866 and 22867, but not 22865.
Also, "command" is in brackets in line 22866.  Because of this, I believe
that one should be able to type a "msglist" on the command line, with
no command name, and it should be treated as a "next" command.  This is
how "mailx" on Solaris 9 operates.

However, the mail utility in mailutils only changes a blank line to
a "next" command.  Can the mail utility be changed so that a bare
msglist (without a command name) is treated as a next command?

I enclose a sample patch.  I'm willing to provide a sample patch for the
documentation, too.

--Paul Vojta
--- a/mail/util.c       Sat Feb 21 12:03:19 2009
+++ b/mail/util.c       Wed Mar  4 14:51:11 2009
@@ -62,8 +62,8 @@
 
   if (cmd)
     {
-      /*  Ignore comments */
-      if (cmd[0] == '#')
+      /*  Ignore comments, and also blank lines in noninteractive mode */
+      if (cmd[0] == '#' || (!interactive && cmd[0] == '\0'))
        {
          free (cmd);
          return 0;
@@ -82,16 +82,15 @@
            return 0;
        }
 
-      if (mu_argcv_get (cmd, delim, NULL, &argc, &argv) == 0 && argc > 0)
+      if (mu_argcv_get (cmd, delim, NULL, &argc, &argv) == 0)
        {
          char *p;
 
-         /* Special case: a number alone implies "print" */
-         if (argc == 1
-             && ((strtoul (argv[0], &p, 10) > 0 && *p == 0)
-                 || (argv[0][1] == 0 && strchr("^$", argv[0][0]))))
+         /* A blank line or a message list without a command name is
+            assumed to be a next command, according to the POSIX spec. */
+         if (argc == 0 || strchr("^.$+-*0123456789/:", argv[0][0]))
            {
-             asprintf (&p, "print %s", argv[0]);
+             asprintf (&p, "next %s", cmd);
              mu_argcv_free (argc, argv);
              mu_argcv_get (p, delim, NULL, &argc, &argv);
              free (p);
--- a/mail/table.c      Sat Feb 21 12:03:19 2009
+++ b/mail/table.c      Wed Mar  4 11:04:00 2009
@@ -176,14 +176,8 @@
     mail_eq, no_compl },
   { "#",       "#",            "# comment",                    0,
     NULL, no_compl },
-  { "*",       "*",            "*",                            0,
-    mail_list, no_compl },
-  { "+",       "+",            "+ [message]",                  0,
-    mail_next, msglist_compl },
   { "|",       "|",            "| [[msglist] command]",        0,
     mail_pipe, msglist_compl }, /* FIXME: msglist_exec_compl */
-  { "-",       "-",            "- [message]",                  0,
-    mail_previous, msglist_compl },
 };
 
 
_______________________________________________
Bug-mailutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-mailutils

Reply via email to