*** empty log message ***
[findutils.git] / xargs / xargs.c
blob82bfb5bdee9d22d09d012ff3e369b8fc1d5eb55e
1 /* xargs -- build and execute command lines from standard input
2 Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
18 /* Written by Mike Rendell <michael@cs.mun.ca>
19 and David MacKenzie <djm@gnu.ai.mit.edu>. */
21 #include <config.h>
23 #if __STDC__
24 #define P_(s) s
25 #else
26 #define P_(s) ()
27 #endif
29 #define _GNU_SOURCE
30 #include <ctype.h>
32 #if !defined (isascii) || defined (STDC_HEADERS)
33 #ifdef isascii
34 #undef isascii
35 #endif
36 #define isascii(c) 1
37 #endif
39 #ifdef isblank
40 #define ISBLANK(c) (isascii (c) && isblank (c))
41 #else
42 #define ISBLANK(c) ((c) == ' ' || (c) == '\t')
43 #endif
45 #define ISSPACE(c) (ISBLANK (c) || (c) == '\n' || (c) == '\r' \
46 || (c) == '\f' || (c) == '\v')
48 #include <sys/types.h>
49 #include <stdio.h>
50 #include <errno.h>
51 #include <getopt.h>
53 #if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
54 #include <string.h>
55 #if !defined(STDC_HEADERS)
56 #include <memory.h>
57 #endif
58 #else
59 #include <strings.h>
60 #define memcpy(dest, source, count) (bcopy((source), (dest), (count)))
61 #endif
63 #ifndef _POSIX_SOURCE
64 #include <sys/param.h>
65 #endif
67 #ifdef HAVE_LIMITS_H
68 #include <limits.h>
69 #endif
71 #ifdef HAVE_UNISTD_H
72 #include <unistd.h>
73 #endif
75 #include <signal.h>
77 #if !defined(SIGCHLD) && defined(SIGCLD)
78 #define SIGCHLD SIGCLD
79 #endif
81 /* COMPAT: SYSV version defaults size (and has a max value of) to 470.
82 We try to make it as large as possible. */
83 #if !defined(ARG_MAX) && defined(_SC_ARG_MAX)
84 #define ARG_MAX sysconf (_SC_ARG_MAX)
85 #endif
86 #ifndef ARG_MAX
87 #define ARG_MAX NCARGS
88 #endif
90 #include "wait.h"
92 /* States for read_line. */
93 #define NORM 0
94 #define SPACE 1
95 #define QUOTE 2
96 #define BACKSLASH 3
98 #ifdef STDC_HEADERS
99 #include <stdlib.h>
100 #else
101 extern int errno;
102 #endif
104 /* Return nonzero if S is the EOF string. */
105 #define EOF_STR(s) (eof_str && *eof_str == *s && !strcmp (eof_str, s))
107 extern char **environ;
109 /* Not char because of type promotion; NeXT gcc can't handle it. */
110 typedef int boolean;
111 #define true 1
112 #define false 0
114 #if __STDC__
115 #define VOID void
116 #else
117 #define VOID char
118 #endif
120 VOID *xmalloc P_ ((size_t n));
121 VOID *xrealloc P_ ((VOID * p, size_t n));
122 void error P_ ((int status, int errnum, char *message,...));
124 extern char *version_string;
126 /* The name this program was run with. */
127 char *program_name;
129 /* Buffer for reading arguments from stdin. */
130 static char *linebuf;
132 /* Line number in stdin since the last command was executed. */
133 static int lineno = 0;
135 /* If nonzero, then instead of putting the args from stdin at
136 the end of the command argument list, they are each stuck into the
137 initial args, replacing each occurrence of the `replace_pat' in the
138 initial args. */
139 static char *replace_pat = NULL;
141 /* The length of `replace_pat'. */
142 static size_t rplen = 0;
144 /* If nonzero, when this string is read on stdin it is treated as
145 end of file.
146 I don't like this - it should default to NULL. */
147 static char *eof_str = "_";
149 /* If nonzero, the maximum number of nonblank lines from stdin to use
150 per command line. */
151 static long lines_per_exec = 0;
153 /* The maximum number of arguments to use per command line. */
154 static long args_per_exec = 1024;
156 /* If true, exit if lines_per_exec or args_per_exec is exceeded. */
157 static boolean exit_if_size_exceeded = false;
159 /* The maximum number of characters that can be used per command line. */
160 static long arg_max;
162 /* Storage for elements of `cmd_argv'. */
163 static char *argbuf;
165 /* The list of args being built. */
166 static char **cmd_argv = NULL;
168 /* Number of elements allocated for `cmd_argv'. */
169 static int cmd_argv_alloc = 0;
171 /* Number of valid elements in `cmd_argv'. */
172 static int cmd_argc = 0;
174 /* Number of chars being used in `cmd_argv'. */
175 static int cmd_argv_chars = 0;
177 /* Number of initial arguments given on the command line. */
178 static int initial_argc = 0;
180 /* Number of chars in the initial args. */
181 static int initial_argv_chars = 0;
183 /* true when building up initial arguments in `cmd_argv'. */
184 static boolean initial_args = true;
186 /* If nonzero, the maximum number of child processes that can be running
187 at once. */
188 static int proc_max = 1;
190 /* Total number of child processes that have been executed. */
191 static int procs_executed = 0;
193 /* The number of elements in `pids'. */
194 static int procs_executing = 0;
196 /* List of child processes currently executing. */
197 static pid_t *pids = NULL;
199 /* The number of allocated elements in `pids'. */
200 static int pids_alloc = 0;
202 /* Exit status; nonzero if any child process exited with a
203 status of 1-125. */
204 static int child_error = 0;
206 /* If true, print each command on stderr before executing it. */
207 static boolean print_command = false;
209 /* If true, query the user before executing each command, and only
210 execute the command if the user responds affirmatively. */
211 static boolean query_before_executing = false;
213 static struct option const longopts[] =
215 {"null", no_argument, NULL, '0'},
216 {"eof", optional_argument, NULL, 'e'},
217 {"replace", optional_argument, NULL, 'i'},
218 {"max-lines", optional_argument, NULL, 'l'},
219 {"max-args", required_argument, NULL, 'n'},
220 {"interactive", no_argument, NULL, 'p'},
221 {"no-run-if-empty", no_argument, NULL, 'r'},
222 {"max-chars", required_argument, NULL, 's'},
223 {"verbose", no_argument, NULL, 't'},
224 {"exit", no_argument, NULL, 'x'},
225 {"max-procs", required_argument, NULL, 'P'},
226 {"version", no_argument, NULL, 'v'},
227 {"help", no_argument, NULL, 'h'},
228 {NULL, no_argument, NULL, 0}
231 static int read_line P_ ((void));
232 static int read_string P_ ((void));
233 static void do_insert P_ ((char *arg, size_t arglen, size_t lblen));
234 static void push_arg P_ ((char *arg, size_t len));
235 static boolean print_args P_ ((boolean ask));
236 static void do_exec P_ ((void));
237 static void add_proc P_ ((pid_t pid));
238 static void wait_for_proc P_ ((boolean all));
239 static long parse_num P_ ((char *str, int option, long min, long max));
240 static long env_size P_ ((char **envp));
241 static void usage P_ ((FILE * stream, int status));
243 void
244 main (argc, argv)
245 int argc;
246 char **argv;
248 int optc;
249 int always_run_command = 1;
250 long orig_arg_max;
251 char *default_cmd = "/bin/echo";
252 int (*read_args) P_ ((void)) = read_line;
254 program_name = argv[0];
256 orig_arg_max = ARG_MAX - 2048; /* POSIX.2 requires subtracting 2048. */
257 arg_max = orig_arg_max;
259 /* Sanity check for systems with huge ARG_MAX defines (e.g., Suns which
260 have it at 1 meg). Things will work fine with a large ARG_MAX but it
261 will probably hurt the system more than it needs to; an array of this
262 size is allocated. */
263 if (arg_max > 20 * 1024)
264 arg_max = 20 * 1024;
266 /* Take the size of the environment into account. */
267 arg_max -= env_size (environ);
268 if (arg_max <= 0)
269 error (1, 0, "environment is too large for exec");
271 while ((optc = getopt_long (argc, argv, "+0e::i::l::n:prs:txP:",
272 longopts, (int *) 0)) != -1)
274 switch (optc)
276 case '0':
277 read_args = read_string;
278 break;
280 case 'e':
281 if (optarg)
282 eof_str = optarg;
283 else
284 eof_str = 0;
285 break;
287 case 'h':
288 usage (stdout, 0);
290 case 'i':
291 if (optarg)
292 replace_pat = optarg;
293 else
294 replace_pat = "{}";
295 /* -i excludes -n -l. */
296 args_per_exec = 0;
297 lines_per_exec = 0;
298 break;
300 case 'l':
301 if (optarg)
302 lines_per_exec = parse_num (optarg, 'l', 1L, -1L);
303 else
304 lines_per_exec = 1;
305 /* -l excludes -i -n. */
306 args_per_exec = 0;
307 replace_pat = NULL;
308 break;
310 case 'n':
311 args_per_exec = parse_num (optarg, 'n', 1L, -1L);
312 /* -n excludes -i -l. */
313 lines_per_exec = 0;
314 replace_pat = NULL;
315 break;
317 case 's':
318 arg_max = parse_num (optarg, 's', 1L, orig_arg_max);
319 break;
321 case 't':
322 print_command = true;
323 break;
325 case 'x':
326 exit_if_size_exceeded = true;
327 break;
329 case 'p':
330 query_before_executing = true;
331 print_command = true;
332 break;
334 case 'r':
335 always_run_command = 0;
336 break;
338 case 'P':
339 proc_max = parse_num (optarg, 'P', 0L, -1L);
340 break;
342 case 'v':
343 printf ("GNU xargs version %s\n", version_string);
344 exit (0);
346 default:
347 usage (stderr, 1);
351 if (replace_pat || lines_per_exec)
352 exit_if_size_exceeded = true;
354 if (optind == argc)
356 optind = 0;
357 argc = 1;
358 argv = &default_cmd;
361 linebuf = (char *) xmalloc (arg_max + 1);
362 argbuf = (char *) xmalloc (arg_max + 1);
364 /* Make sure to listen for the kids. */
365 signal (SIGCHLD, SIG_DFL);
367 if (!replace_pat)
369 for (; optind < argc; optind++)
370 push_arg (argv[optind], strlen (argv[optind]) + 1);
371 initial_args = false;
372 initial_argc = cmd_argc;
373 initial_argv_chars = cmd_argv_chars;
375 while ((*read_args) () != -1)
376 if (lines_per_exec && lineno >= lines_per_exec)
378 do_exec ();
379 lineno = 0;
382 /* SYSV xargs seems to do at least one exec, even if the
383 input is empty. */
384 if (cmd_argc != initial_argc
385 || (always_run_command && procs_executed == 0))
386 do_exec ();
388 else
390 int i;
391 size_t len;
392 size_t *arglen = (size_t *) xmalloc (sizeof (size_t) * argc);
394 for (i = optind; i < argc; i++)
395 arglen[i] = strlen(argv[i]);
396 rplen = strlen (replace_pat);
397 while ((len = (*read_args) ()) != -1)
399 /* Don't do insert on the command name. */
400 push_arg (argv[optind], arglen[optind] + 1);
401 len--;
402 for (i = optind + 1; i < argc; i++)
403 do_insert (argv[i], arglen[i], len);
404 do_exec ();
408 wait_for_proc (true);
409 exit (child_error);
412 /* Read a line of arguments from stdin and add them to the list of
413 arguments to pass to the command. Ignore blank lines and initial blanks.
414 Single and double quotes and backslashes quote metacharacters and blanks
415 as they do in the shell.
416 Return -1 if eof (either physical or logical) is reached,
417 otherwise the length of the last string read (including the null). */
419 static int
420 read_line ()
422 static boolean eof = false;
423 /* Start out in mode SPACE to always strip leading spaces (even with -i). */
424 int state = SPACE; /* The type of character we last read. */
425 int prevc; /* The previous value of c. */
426 int quotc = 0; /* The last quote character read. */
427 int c = EOF;
428 boolean first = true; /* true if reading first arg on line. */
429 int len;
430 char *p = linebuf;
431 /* Including the NUL, the args must not grow past this point. */
432 char *endbuf = linebuf + arg_max - initial_argv_chars - 1;
434 if (eof)
435 return -1;
436 while (1)
438 prevc = c;
439 c = getc (stdin);
440 if (c == EOF)
442 /* COMPAT: SYSV seems to ignore stuff on a line that
443 ends without a \n; we don't. */
444 eof = true;
445 if (p == linebuf)
446 return -1;
447 *p++ = '\0';
448 len = p - linebuf;
449 /* FIXME we don't check for unterminated quotes here. */
450 if (first && EOF_STR (linebuf))
451 return -1;
452 if (!replace_pat)
453 push_arg (linebuf, len);
454 return len;
456 switch (state)
458 case SPACE:
459 if (ISSPACE (c))
460 continue;
461 state = NORM;
462 /* aaahhhh.... */
464 case NORM:
465 if (c == '\n')
467 if (!ISBLANK (prevc))
468 lineno++; /* For -l. */
469 if (p == linebuf)
471 /* Blank line. */
472 state = SPACE;
473 continue;
475 *p++ = '\0';
476 len = p - linebuf;
477 if (EOF_STR (linebuf))
479 eof = true;
480 return first ? -1 : len;
482 if (!replace_pat)
483 push_arg (linebuf, len);
484 return len;
486 if (!replace_pat && ISSPACE (c))
488 *p++ = '\0';
489 len = p - linebuf;
490 if (EOF_STR (linebuf))
492 eof = true;
493 return first ? -1 : len;
495 push_arg (linebuf, len);
496 p = linebuf;
497 state = SPACE;
498 first = false;
499 continue;
501 switch (c)
503 case '\\':
504 state = BACKSLASH;
505 continue;
507 case '\'':
508 case '"':
509 state = QUOTE;
510 quotc = c;
511 continue;
513 break;
515 case QUOTE:
516 if (c == '\n')
517 error (1, 0, "unmatched %s quote",
518 quotc == '"' ? "double" : "single");
519 if (c == quotc)
521 state = NORM;
522 continue;
524 break;
526 case BACKSLASH:
527 state = NORM;
528 break;
530 if (p >= endbuf)
531 error (1, 0, "argument line too long");
532 *p++ = c;
536 /* Read a null-terminated string from stdin and add it to the list of
537 arguments to pass to the command.
538 Return -1 if eof (either physical or logical) is reached,
539 otherwise the length of the string read (including the null). */
541 static int
542 read_string ()
544 static boolean eof = false;
545 int len;
546 char *p = linebuf;
547 /* Including the NUL, the args must not grow past this point. */
548 char *endbuf = linebuf + arg_max - initial_argv_chars - 1;
550 if (eof)
551 return -1;
552 while (1)
554 int c = getc (stdin);
555 if (c == EOF)
557 eof = true;
558 if (p == linebuf)
559 return -1;
560 *p++ = '\0';
561 len = p - linebuf;
562 if (!replace_pat)
563 push_arg (linebuf, len);
564 return len;
566 if (c == '\0')
568 lineno++; /* For -l. */
569 *p++ = '\0';
570 len = p - linebuf;
571 if (!replace_pat)
572 push_arg (linebuf, len);
573 return len;
575 if (p >= endbuf)
576 error (1, 0, "argument line too long");
577 *p++ = c;
581 /* Replace all instances of `replace_pat' in ARG with `linebuf',
582 and add the resulting string to the list of arguments for the command
583 to execute.
584 ARGLEN is the length of ARG, not including the null.
585 LBLEN is the length of `linebuf', not including the null.
587 COMPAT: insertions on the SYSV version are limited to 255 chars per line,
588 and a max of 5 occurences of replace_pat in the initial-arguments.
589 Those restrictions do not exist here. */
591 static void
592 do_insert (arg, arglen, lblen)
593 char *arg;
594 size_t arglen;
595 size_t lblen;
597 /* Temporary copy of each arg with the replace pattern replaced by the
598 real arg. */
599 static char *insertbuf;
600 char *p;
601 int bytes_left = arg_max - 1; /* Bytes left on the command line. */
603 if (!insertbuf)
604 insertbuf = (char *) xmalloc (arg_max + 1);
605 p = insertbuf;
609 size_t len; /* Length in ARG before `replace_pat'. */
610 char *s = strstr (arg, replace_pat);
611 if (s)
612 len = s - arg;
613 else
614 len = arglen;
615 bytes_left -= len;
616 if (bytes_left <= 0)
617 break;
619 strncpy (p, arg, len);
620 p += len;
621 arg += len;
622 arglen -= len;
624 if (s)
626 bytes_left -= lblen;
627 if (bytes_left <= 0)
628 break;
629 strcpy (p, linebuf);
630 arg += rplen;
631 arglen -= rplen;
632 p += lblen;
635 while (*arg);
636 if (*arg)
637 error (1, 0, "command too long");
638 *p++ = '\0';
639 push_arg (insertbuf, p - insertbuf);
642 /* Add ARG to the end of the list of arguments `cmd_argv' to pass
643 to the command.
644 LEN is the length of ARG, including the terminating null.
645 If this brings the list up to its maximum size, execute the command. */
647 static void
648 push_arg (arg, len)
649 char *arg;
650 size_t len;
652 if (arg)
654 if (cmd_argv_chars + len > arg_max)
656 if (initial_args || cmd_argc == initial_argc)
657 error (1, 0, "can not fit single argument within argument list size limit");
658 if (replace_pat
659 || (exit_if_size_exceeded &&
660 (lines_per_exec || args_per_exec)))
661 error (1, 0, "argument list too long");
662 do_exec ();
664 if (!initial_args && args_per_exec &&
665 cmd_argc - initial_argc == args_per_exec)
666 do_exec ();
669 if (cmd_argc >= cmd_argv_alloc)
671 if (!cmd_argv)
673 cmd_argv_alloc = 64;
674 cmd_argv = (char **) xmalloc (sizeof (char *) * cmd_argv_alloc);
676 else
678 cmd_argv_alloc *= 2;
679 cmd_argv = (char **) xrealloc (cmd_argv,
680 sizeof (char *) * cmd_argv_alloc);
684 if (!arg)
685 cmd_argv[cmd_argc++] = NULL;
686 else
688 cmd_argv[cmd_argc++] = argbuf + cmd_argv_chars;
689 strcpy (argbuf + cmd_argv_chars, arg);
690 cmd_argv_chars += len;
694 /* Print the arguments of the command to execute.
695 If ASK is nonzero, prompt the user for a response, and
696 if the user responds affirmatively, return true;
697 otherwise, return false. */
699 static boolean
700 print_args (ask)
701 boolean ask;
703 int i;
705 for (i = 0; i < cmd_argc - 1; i++)
706 fprintf (stderr, "%s ", cmd_argv[i]);
707 if (ask)
709 static FILE *tty_stream;
710 int c, savec;
712 if (!tty_stream)
714 tty_stream = fopen ("/dev/tty", "r");
715 if (!tty_stream)
716 error (1, errno, "/dev/tty");
718 fputs ("?...", stderr);
719 fflush (stderr);
720 c = savec = getc (tty_stream);
721 while (c != EOF && c != '\n')
722 c = getc (tty_stream);
723 if (savec == 'y' || savec == 'Y')
724 return true;
726 else
727 putc ('\n', stderr);
729 return false;
732 /* Execute the command that has been built in `cmd_argv'. This may involve
733 waiting for processes that were previously executed. */
735 static void
736 do_exec ()
738 pid_t child;
740 push_arg ((char *) NULL, 0); /* Null terminate the arg list. */
741 if (!query_before_executing || print_args (true))
743 if (proc_max && procs_executing >= proc_max)
744 wait_for_proc (false);
745 if (!query_before_executing && print_command)
746 print_args (false);
747 /* If we run out of processes, wait for a child to return and
748 try again. */
749 while ((child = fork ()) < 0 && errno == EAGAIN && procs_executing)
750 wait_for_proc (false);
751 switch (child)
753 case -1:
754 error (1, errno, "cannot fork");
756 case 0: /* Child. */
757 execvp (cmd_argv[0], cmd_argv);
758 error (0, errno, "%s", cmd_argv[0]);
759 _exit (errno == ENOENT ? 127 : 126);
761 add_proc (child);
764 cmd_argc = initial_argc;
765 cmd_argv_chars = initial_argv_chars;
768 /* Add the process with id PID to the list of processes that have
769 been executed. */
771 static void
772 add_proc (pid)
773 pid_t pid;
775 int i;
777 /* Find an empty slot. */
778 for (i = 0; i < pids_alloc && pids[i]; i++)
780 if (i == pids_alloc)
782 if (pids_alloc == 0)
784 pids_alloc = proc_max ? proc_max : 64;
785 pids = (pid_t *) xmalloc (sizeof (pid_t) * pids_alloc);
787 else
789 pids_alloc *= 2;
790 pids = (pid_t *) xrealloc (pids,
791 sizeof (pid_t) * pids_alloc);
793 memset (&pids[i], '\0', sizeof (pid_t) * (pids_alloc - i));
795 pids[i] = pid;
796 procs_executing++;
797 procs_executed++;
800 /* If ALL is true, wait for all child processes to finish;
801 otherwise, wait for one child process to finish.
802 Remove the processes that finish from the list of executing processes. */
804 static void
805 wait_for_proc (all)
806 boolean all;
808 while (procs_executing)
810 int i, status;
814 pid_t pid;
816 pid = wait (&status);
817 if (pid < 0)
818 error (1, errno, "error waiting for child process");
820 /* Find the entry in `pids' for the child process
821 that exited. */
822 for (i = 0; i < pids_alloc && pid != pids[i]; i++)
825 while (i == pids_alloc); /* A child died that we didn't start? */
827 /* Remove the child from the list. */
828 pids[i] = 0;
829 procs_executing--;
831 if (WEXITSTATUS (status) == 126 || WEXITSTATUS (status) == 127)
832 exit (WEXITSTATUS (status)); /* Can't find or run the command. */
833 if (WEXITSTATUS (status) == 255)
834 error (124, 0, "%s: exited with status 255; aborting", cmd_argv[0]);
835 if (WIFSTOPPED (status))
836 error (125, 0, "%s: stopped by signal %d", cmd_argv[0], WSTOPSIG (status));
837 if (WIFSIGNALED (status))
838 error (125, 0, "%s: terminated by signal %d", cmd_argv[0], WTERMSIG (status));
839 if (WEXITSTATUS (status) != 0)
840 child_error = 123;
842 if (!all)
843 break;
847 /* Return the value of the number represented in STR.
848 OPTION is the command line option to which STR is the argument.
849 If the value does not fall within the boundaries MIN and MAX,
850 Print an error message mentioning OPTION and exit. */
852 static long
853 parse_num (str, option, min, max)
854 char *str;
855 int option;
856 long min;
857 long max;
859 char *eptr;
860 long val;
862 val = strtol (str, &eptr, 10);
863 if (eptr == str || *eptr)
865 fprintf (stderr, "%s: invalid number for -%c option\n",
866 program_name, option);
867 usage (stderr, 1);
869 else if (val < min)
871 fprintf (stderr, "%s: value for -%c option must be >= %ld\n",
872 program_name, option, min);
873 usage (stderr, 1);
875 else if (max >= 0 && val > max)
877 fprintf (stderr, "%s: value for -%c option must be < %ld\n",
878 program_name, option, max);
879 usage (stderr, 1);
881 return val;
884 /* Return how much of ARG_MAX is used by the environment. */
886 static long
887 env_size (envp)
888 char **envp;
890 long len = 0;
892 while (*envp)
893 len += strlen (*envp++) + 1;
895 return len;
898 static void
899 usage (stream, status)
900 FILE *stream;
901 int status;
903 fprintf (stream, "\
904 Usage: %s [-0prtx] [-e[eof-str]] [-i[replace-str]] [-l[max-lines]]\n\
905 [-n max-args] [-s max-chars] [-P max-procs] [--null] [--eof[=eof-str]]\n\
906 [--replace[=replace-str]] [--max-lines[=max-lines]] [--interactive]\n\
907 [--max-chars=max-chars] [--verbose] [--exit] [--max-procs=max-procs]\n\
908 [--max-args=max-args] [--no-run-if-empty] [--version] [--help]\n\
909 [command [initial-arguments]]\n",
910 program_name);
911 exit (status);