Commit 40b616f3 40b616f3dc7fe378846235975a09ebee15b37013 by Sergey Poznyakoff

readmsg: minor fix

* readmsg/readmsg.c: Bail out unless arguments are present.
* doc/texinfo/programs.texi: Update.
1 parent 87e9c792
......@@ -4853,6 +4853,11 @@ Note that it will not match a message containing @samp{Staff Meeting}
which matches the pattern is printed.
@end enumerate
Unless one of the informational options is used, at least one command
line argument must be present. Informational options are:
@option{--help} (@option{-?}), @option{--usage}, and
@option{--version} (@option{-V}).
@menu
* Opt-readmsg:: Invocation of @command{readmsg}.
* Conf-readmsg:: Configuration of @command{readmsg}.
......
......@@ -297,6 +297,14 @@ main (int argc, char **argv)
argc, argv, 0, &index, NULL))
exit (1);
argc -= index;
if (argc == 0)
{
mu_error (_("not enough arguments"));
exit (1);
}
status = mu_mailbox_create_default (&mbox, mailbox_name);
if (status != 0)
{
......@@ -367,9 +375,7 @@ main (int argc, char **argv)
}
/* Build an array containing the message number. */
argc -= index;
if (argc > 0)
msglist (mbox, show_all, argc, &argv[index], &set, &n);
msglist (mbox, show_all, argc, &argv[index], &set, &n);
for (i = 0; i < n; ++i)
{
......