diff --git a/chrony.texi b/chrony.texi index d1c77b3..beb6b40 100644 --- a/chrony.texi +++ b/chrony.texi @@ -2741,6 +2741,9 @@ This option disables resolving IP addresses to hostnames. With this option hostnames will be resolved only to IPv4 addresses. @item -6 With this option hostnames will be resolved only to IPv6 addresses. +@item -m +With this option multiple commands can be specified on the command line. +Each argument will be interpreted as a whole command. @end table @c }}} @c {{{ SS:Security with chronyc diff --git a/chronyc.1 b/chronyc.1 index 7183c2e..af0f060 100644 --- a/chronyc.1 +++ b/chronyc.1 @@ -38,6 +38,10 @@ resolve hostnames only to IPv4 addresses \fB\-6\fR resolve hostnames only to IPv6 addresses .TP +\fB\-m\fR +allow multiple commands to be specified on the command line. Each argument +will be interpreted as a whole command. +.TP \fIcommand\fR specify command. If no command is given, chronyc will read commands interactively. diff --git a/client.c b/client.c index 64147d1..f2b195a 100644 --- a/client.c +++ b/client.c @@ -2516,7 +2516,7 @@ process_line(char *line, int *quit) /* ================================================== */ static int -process_args(int argc, char **argv) +process_args(int argc, char **argv, int multi) { int total_length, i, ret, quit; char *line; @@ -2527,15 +2527,25 @@ process_args(int argc, char **argv) } line = (char *) malloc((2 + total_length) * sizeof(char)); - line[0] = 0; - for (i=0; i] [-p ] [-n] [-4|-6] [command]\n", progname); + fprintf(stderr, "Usage : %s [-h ] [-p ] [-n] [-4|-6] [-m] [command]\n", progname); exit(1); } else { break; /* And process remainder of line as a command */ @@ -2608,7 +2620,7 @@ main(int argc, char **argv) open_io(hostname, port); if (argc > 0) { - ret = process_args(argc, argv); + ret = process_args(argc, argv, multi); } else { do { line = read_line();