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} ...@@ -4853,6 +4853,11 @@ Note that it will not match a message containing @samp{Staff Meeting}
4853 which matches the pattern is printed. 4853 which matches the pattern is printed.
4854 @end enumerate 4854 @end enumerate
4855 4855
4856 Unless one of the informational options is used, at least one command
4857 line argument must be present. Informational options are:
4858 @option{--help} (@option{-?}), @option{--usage}, and
4859 @option{--version} (@option{-V}).
4860
4856 @menu 4861 @menu
4857 * Opt-readmsg:: Invocation of @command{readmsg}. 4862 * Opt-readmsg:: Invocation of @command{readmsg}.
4858 * Conf-readmsg:: Configuration of @command{readmsg}. 4863 * Conf-readmsg:: Configuration of @command{readmsg}.
......
...@@ -297,6 +297,14 @@ main (int argc, char **argv) ...@@ -297,6 +297,14 @@ main (int argc, char **argv)
297 argc, argv, 0, &index, NULL)) 297 argc, argv, 0, &index, NULL))
298 exit (1); 298 exit (1);
299 299
300 argc -= index;
301
302 if (argc == 0)
303 {
304 mu_error (_("not enough arguments"));
305 exit (1);
306 }
307
300 status = mu_mailbox_create_default (&mbox, mailbox_name); 308 status = mu_mailbox_create_default (&mbox, mailbox_name);
301 if (status != 0) 309 if (status != 0)
302 { 310 {
...@@ -367,8 +375,6 @@ main (int argc, char **argv) ...@@ -367,8 +375,6 @@ main (int argc, char **argv)
367 } 375 }
368 376
369 /* Build an array containing the message number. */ 377 /* Build an array containing the message number. */
370 argc -= index;
371 if (argc > 0)
372 msglist (mbox, show_all, argc, &argv[index], &set, &n); 378 msglist (mbox, show_all, argc, &argv[index], &set, &n);
373 379
374 for (i = 0; i < n; ++i) 380 for (i = 0; i < n; ++i)
......