---
tools/virsh.c | 82 +++++++++++++++++++++++++++---------------------------
tools/virsh.pod | 61 +++++++++++++++++++++--------------------
2 files changed, 72 insertions(+), 71 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 33aeb6c..4da5e1a 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -20151,19 +20151,19 @@ vshUsage(void)
"\n%s [options]... <command> [args...]\n\n"
" options:\n"
" -c | --connect=URI hypervisor connection
URI\n"
- " -r | --readonly connect readonly\n"
" -d | --debug=NUM debug level [0-4]\n"
+ " -e | --escape <char> set escape sequence for
console\n"
" -h | --help this help\n"
+ " -i | --keepalive_interval\n"
+ " interval time value \n"
+ " -l | --log=FILE output logging to file\n"
+ " -n | --keepalive_count number of keepalive
message\n\n"
" -q | --quiet quiet mode\n"
+ " -r | --readonly connect readonly\n"
" -t | --timing print timing information\n"
- " -l | --log=FILE output logging to file\n"
" -v short version\n"
" -V long version\n"
" --version[=TYPE] version, TYPE is short or long
(default short)\n"
- " -e | --escape <char> set escape sequence for
console\n"
- " -i | --keepalive_interval\n"
- " interval time value \n"
- " -n | --keepalive_count number of keepalive
message\n\n"
" commands (non interactive mode):\n\n"), progname,
progname);
for (grp = cmdGroups; grp->name; grp++) {
@@ -20331,59 +20331,34 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
{
int arg, len;
struct option opt[] = {
+ {"connect", required_argument, NULL, 'c'},
{"debug", required_argument, NULL, 'd'},
+ {"escape", required_argument, NULL, 'e'},
{"help", no_argument, NULL, 'h'},
+ {"keepalive_count", required_argument, NULL, 'n'},
+ {"keepalive_interval", required_argument, NULL, 'i'},
+ {"log", required_argument, NULL, 'l'},
{"quiet", no_argument, NULL, 'q'},
+ {"readonly", no_argument, NULL, 'r'},
{"timing", no_argument, NULL, 't'},
{"version", optional_argument, NULL, 'v'},
- {"connect", required_argument, NULL, 'c'},
- {"readonly", no_argument, NULL, 'r'},
- {"log", required_argument, NULL, 'l'},
- {"escape", required_argument, NULL, 'e'},
- {"keepalive_interval", required_argument, NULL, 'i'},
- {"keepalive_count", required_argument, NULL, 'n'},
{NULL, 0, NULL, 0}
};
/* Standard (non-command) options. The leading + ensures that no
* argument reordering takes place, so that command options are
* not confused with top-level virsh options. */
- while ((arg = getopt_long(argc, argv, "+d:hqtc:vVrl:e:i:n:", opt, NULL)) !=
-1) {
+ while ((arg = getopt_long(argc, argv, "+c:d:e:hi:l:n:qrtvV", opt, NULL)) !=
-1) {
switch (arg) {
+ case 'c':
+ ctl->name = vshStrdup(ctl, optarg);
+ break;
case 'd':
if (virStrToLong_i(optarg, NULL, 10, &ctl->debug) < 0) {
vshError(ctl, "%s", _("option -d takes a numeric
argument"));
exit(EXIT_FAILURE);
}
break;
- case 'h':
- vshUsage();
- exit(EXIT_SUCCESS);
- break;
- case 'q':
- ctl->quiet = true;
- break;
- case 't':
- ctl->timing = true;
- break;
- case 'c':
- ctl->name = vshStrdup(ctl, optarg);
- break;
- case 'v':
- if (STRNEQ_NULLABLE(optarg, "long")) {
- puts(VERSION);
- exit(EXIT_SUCCESS);
- }
- /* fall through */
- case 'V':
- vshShowVersion(ctl);
- exit(EXIT_SUCCESS);
- case 'r':
- ctl->readonly = true;
- break;
- case 'l':
- ctl->logfile = vshStrdup(ctl, optarg);
- break;
case 'e':
len = strlen(optarg);
@@ -20397,6 +20372,10 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
exit(EXIT_FAILURE);
}
break;
+ case 'h':
+ vshUsage();
+ exit(EXIT_SUCCESS);
+ break;
case 'i':
if (virStrToLong_ui(optarg, NULL, 10, &ctl->keepalive_interval) <
0) {
vshError(ctl,
@@ -20404,6 +20383,9 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
exit(EXIT_FAILURE);
}
break;
+ case 'l':
+ ctl->logfile = vshStrdup(ctl, optarg);
+ break;
case 'n':
if (virStrToLong_ui(optarg, NULL, 10, &ctl->keepalive_count) < 0)
{
vshError(ctl,
@@ -20411,6 +20393,24 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
exit(EXIT_FAILURE);
}
break;
+ case 'q':
+ ctl->quiet = true;
+ break;
+ case 'r':
+ ctl->readonly = true;
+ break;
+ case 't':
+ ctl->timing = true;
+ break;
+ case 'v':
+ if (STRNEQ_NULLABLE(optarg, "long")) {
+ puts(VERSION);
+ exit(EXIT_SUCCESS);
+ }
+ /* fall through */
+ case 'V':
+ vshShowVersion(ctl);
+ exit(EXIT_SUCCESS);
default:
vshError(ctl, _("unsupported option '-%c'. See --help."),
arg);
exit(EXIT_FAILURE);
diff --git a/tools/virsh.pod b/tools/virsh.pod
index faa97a2..656f6f0 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -49,21 +49,6 @@ The B<virsh> program understands the following I<OPTIONS>.
=over 4
-=item B<-h>, B<--help>
-
-Ignore all other arguments, and behave as if the B<help> command were
-given instead.
-
-=item B<-v>, B<--version[=short]>
-
-Ignore all other arguments, and prints the version of the libvirt library
-virsh is coming from
-
-=item B<-V>, B<--version=long>
-
-Ignore all other arguments, and prints the version of the libvirt library
-virsh is coming from and which options and driver are compiled in.
-
=item B<-c>, B<--connect> I<URI>
Connect to the specified I<URI>, as if by the B<connect> command,
@@ -75,10 +60,35 @@ Enable debug messages at integer I<LEVEL> and above.
I<LEVEL> can
range from 0 to 4 (default). See the documentation of B<VIRSH_DEBUG>
environment variable below for the description of each I<LEVEL>.
+=item B<-e>, B<--escape> I<string>
+
+Set alternative escape sequence for I<console> command. By default,
+telnet's B<^]> is used. Allowed characters when using hat notation are:
+alphabetic character, @, [, ], \, ^, _.
+
+=item B<-h>, B<--help>
+
+Ignore all other arguments, and behave as if the B<help> command were
+given instead.
+
+=item B<-i>, B<--keepalive_interval> I<second>
+
+Use together with I<--keepalive_count> to start keepalive messaging between
+libvirt client and server. A keepalive message will be sent to a libvirt server
+after I<--keepalive_interval> seconds of inactivity to check if server is still
+responding. I<seconds> with 0 value has the same effect as without using this
+option.
+
=item B<-l>, B<--log> I<FILE>
Output logging details to I<FILE>.
+=item B<-n>, B<--keepalive_count> I<number>
+
+The maximum number of keepalive messages that are allowed to be sent to libvirt
+server without getting any response before the connection is considered broken.
+I<number> with 0 value has the same effect as without using this option.
+
=item B<-q>, B<--quiet>
Avoid extra informational messages.
@@ -92,24 +102,15 @@ option of the B<connect> command.
Output elapsed time information for each command.
-=item B<-e>, B<--escape> I<string>
-
-Set alternative escape sequence for I<console> command. By default,
-telnet's B<^]> is used. Allowed characters when using hat notation are:
-alphabetic character, @, [, ], \, ^, _.
+=item B<-v>, B<--version[=short]>
-=item B<-i>, B<--keepalive_interval> I<second>
+Ignore all other arguments, and prints the version of the libvirt library
+virsh is coming from
-Use together with I<--keepalive_count> to start keepalive messaging between
-libvirt client and server. A keepalive message will be sent to a libvirt server
-after I<--keepalive_interval> seconds of inactivity to check if server is still
-responding. I<seconds> with 0 value has the same effect as without using this
-option.
+=item B<-V>, B<--version=long>
-=item B<-n>, B<--keepalive_count> I<number>
-The maximum number of keepalive messages that are allowed to be sent to libvirt
-server without getting any response before the connection is considered broken.
-I<number> with 0 value has the same effect as without using this option.
+Ignore all other arguments, and prints the version of the libvirt library
+virsh is coming from and which options and driver are compiled in.
=back
--
1.7.7.5