1 | /* $Id: VBoxManageHelp.cpp 48630 2013-09-23 10:42:42Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - help and other message output.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2013 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | /*******************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *******************************************************************************/
|
---|
22 | #include <VBox/version.h>
|
---|
23 |
|
---|
24 | #include <iprt/buildconfig.h>
|
---|
25 | #include <iprt/ctype.h>
|
---|
26 | #include <iprt/err.h>
|
---|
27 | #include <iprt/getopt.h>
|
---|
28 | #include <iprt/stream.h>
|
---|
29 |
|
---|
30 | #include "VBoxManage.h"
|
---|
31 |
|
---|
32 |
|
---|
33 |
|
---|
34 | void showLogo(PRTSTREAM pStrm)
|
---|
35 | {
|
---|
36 | static bool s_fShown; /* show only once */
|
---|
37 |
|
---|
38 | if (!s_fShown)
|
---|
39 | {
|
---|
40 | RTStrmPrintf(pStrm, VBOX_PRODUCT " Command Line Management Interface Version "
|
---|
41 | VBOX_VERSION_STRING "\n"
|
---|
42 | "(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
|
---|
43 | "All rights reserved.\n"
|
---|
44 | "\n");
|
---|
45 | s_fShown = true;
|
---|
46 | }
|
---|
47 | }
|
---|
48 |
|
---|
49 | void printUsage(USAGECATEGORY u64Cmd, PRTSTREAM pStrm)
|
---|
50 | {
|
---|
51 | bool fDumpOpts = false;
|
---|
52 | #ifdef RT_OS_LINUX
|
---|
53 | bool fLinux = true;
|
---|
54 | #else
|
---|
55 | bool fLinux = false;
|
---|
56 | #endif
|
---|
57 | #ifdef RT_OS_WINDOWS
|
---|
58 | bool fWin = true;
|
---|
59 | #else
|
---|
60 | bool fWin = false;
|
---|
61 | #endif
|
---|
62 | #ifdef RT_OS_SOLARIS
|
---|
63 | bool fSolaris = true;
|
---|
64 | #else
|
---|
65 | bool fSolaris = false;
|
---|
66 | #endif
|
---|
67 | #ifdef RT_OS_FREEBSD
|
---|
68 | bool fFreeBSD = true;
|
---|
69 | #else
|
---|
70 | bool fFreeBSD = false;
|
---|
71 | #endif
|
---|
72 | #ifdef RT_OS_DARWIN
|
---|
73 | bool fDarwin = true;
|
---|
74 | #else
|
---|
75 | bool fDarwin = false;
|
---|
76 | #endif
|
---|
77 | #ifdef VBOX_WITH_VBOXSDL
|
---|
78 | bool fVBoxSDL = true;
|
---|
79 | #else
|
---|
80 | bool fVBoxSDL = false;
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | if (u64Cmd == USAGE_DUMPOPTS)
|
---|
84 | {
|
---|
85 | fDumpOpts = true;
|
---|
86 | fLinux = true;
|
---|
87 | fWin = true;
|
---|
88 | fSolaris = true;
|
---|
89 | fFreeBSD = true;
|
---|
90 | fDarwin = true;
|
---|
91 | fVBoxSDL = true;
|
---|
92 | u64Cmd = USAGE_ALL;
|
---|
93 | }
|
---|
94 |
|
---|
95 | RTStrmPrintf(pStrm,
|
---|
96 | "Usage:\n"
|
---|
97 | "\n");
|
---|
98 |
|
---|
99 | if (u64Cmd == USAGE_ALL)
|
---|
100 | RTStrmPrintf(pStrm,
|
---|
101 | " VBoxManage [<general option>] <command>\n"
|
---|
102 | " \n \n"
|
---|
103 | "General Options:\n \n"
|
---|
104 | " [-v|--version] print version number and exit\n"
|
---|
105 | " [-q|--nologo] suppress the logo\n"
|
---|
106 | " [--settingspw <pw>] provide the settings password\n"
|
---|
107 | " [--settingspwfile <file>] provide a file containing the settings password\n"
|
---|
108 | " \n \n"
|
---|
109 | "Commands:\n \n");
|
---|
110 |
|
---|
111 | const char *pcszSep1 = " ";
|
---|
112 | const char *pcszSep2 = " ";
|
---|
113 | if (u64Cmd != USAGE_ALL)
|
---|
114 | {
|
---|
115 | pcszSep1 = "VBoxManage";
|
---|
116 | pcszSep2 = "";
|
---|
117 | }
|
---|
118 |
|
---|
119 | #define SEP pcszSep1, pcszSep2
|
---|
120 |
|
---|
121 | if (u64Cmd & USAGE_LIST)
|
---|
122 | RTStrmPrintf(pStrm,
|
---|
123 | "%s list [--long|-l]%s vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
|
---|
124 | #if defined(VBOX_WITH_NETFLT)
|
---|
125 | " intnets|bridgedifs|hostonlyifs|natnets|dhcpservers|\n"
|
---|
126 | #else
|
---|
127 | " intnets|bridgedifs|natnets|dhcpservers|hostinfo|\n"
|
---|
128 | #endif
|
---|
129 | " hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|\n"
|
---|
130 | " usbhost|usbfilters|systemproperties|extpacks|\n"
|
---|
131 | " groups|webcams\n"
|
---|
132 | "\n", SEP);
|
---|
133 |
|
---|
134 | if (u64Cmd & USAGE_SHOWVMINFO)
|
---|
135 | RTStrmPrintf(pStrm,
|
---|
136 | "%s showvminfo %s <uuid|vmname> [--details]\n"
|
---|
137 | " [--machinereadable]\n"
|
---|
138 | "%s showvminfo %s <uuid|vmname> --log <idx>\n"
|
---|
139 | "\n", SEP, SEP);
|
---|
140 |
|
---|
141 | if (u64Cmd & USAGE_REGISTERVM)
|
---|
142 | RTStrmPrintf(pStrm,
|
---|
143 | "%s registervm %s <filename>\n"
|
---|
144 | "\n", SEP);
|
---|
145 |
|
---|
146 | if (u64Cmd & USAGE_UNREGISTERVM)
|
---|
147 | RTStrmPrintf(pStrm,
|
---|
148 | "%s unregistervm %s <uuid|vmname> [--delete]\n"
|
---|
149 | "\n", SEP);
|
---|
150 |
|
---|
151 | if (u64Cmd & USAGE_CREATEVM)
|
---|
152 | RTStrmPrintf(pStrm,
|
---|
153 | "%s createvm %s --name <name>\n"
|
---|
154 | " [--groups <group>, ...]\n"
|
---|
155 | " [--ostype <ostype>]\n"
|
---|
156 | " [--register]\n"
|
---|
157 | " [--basefolder <path>]\n"
|
---|
158 | " [--uuid <uuid>]\n"
|
---|
159 | "\n", SEP);
|
---|
160 |
|
---|
161 | if (u64Cmd & USAGE_MODIFYVM)
|
---|
162 | {
|
---|
163 | RTStrmPrintf(pStrm,
|
---|
164 | "%s modifyvm %s <uuid|vmname>\n"
|
---|
165 | " [--name <name>]\n"
|
---|
166 | " [--groups <group>, ...]\n"
|
---|
167 | " [--ostype <ostype>]\n"
|
---|
168 | " [--iconfile <filename>]\n"
|
---|
169 | " [--memory <memorysize in MB>]\n"
|
---|
170 | " [--pagefusion on|off]\n"
|
---|
171 | " [--vram <vramsize in MB>]\n"
|
---|
172 | " [--acpi on|off]\n"
|
---|
173 | #ifdef VBOX_WITH_PCI_PASSTHROUGH
|
---|
174 | " [--pciattach 03:04.0]\n"
|
---|
175 | " [--pciattach 03:04.0@02:01.0]\n"
|
---|
176 | " [--pcidetach 03:04.0]\n"
|
---|
177 | #endif
|
---|
178 | " [--ioapic on|off]\n"
|
---|
179 | " [--hpet on|off]\n"
|
---|
180 | " [--hwvirtex on|off]\n"
|
---|
181 | " [--nestedpaging on|off]\n"
|
---|
182 | " [--largepages on|off]\n"
|
---|
183 | " [--vtxvpid on|off]\n"
|
---|
184 | " [--vtxux on|off]\n"
|
---|
185 | " [--pae on|off]\n"
|
---|
186 | " [--longmode on|off]\n"
|
---|
187 | " [--synthcpu on|off]\n"
|
---|
188 | " [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
|
---|
189 | " [--cpuidremove <leaf>]\n"
|
---|
190 | " [--cpuidremoveall]\n"
|
---|
191 | " [--hardwareuuid <uuid>]\n"
|
---|
192 | " [--cpus <number>]\n"
|
---|
193 | " [--cpuhotplug on|off]\n"
|
---|
194 | " [--plugcpu <id>]\n"
|
---|
195 | " [--unplugcpu <id>]\n"
|
---|
196 | " [--cpuexecutioncap <1-100>]\n"
|
---|
197 | " [--rtcuseutc on|off]\n"
|
---|
198 | " [--graphicscontroller none|vboxvga]\n"
|
---|
199 | " [--monitorcount <number>]\n"
|
---|
200 | " [--accelerate3d on|off]\n"
|
---|
201 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
202 | " [--accelerate2dvideo on|off]\n"
|
---|
203 | #endif
|
---|
204 | " [--firmware bios|efi|efi32|efi64]\n"
|
---|
205 | " [--chipset ich9|piix3]\n"
|
---|
206 | " [--bioslogofadein on|off]\n"
|
---|
207 | " [--bioslogofadeout on|off]\n"
|
---|
208 | " [--bioslogodisplaytime <msec>]\n"
|
---|
209 | " [--bioslogoimagepath <imagepath>]\n"
|
---|
210 | " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
|
---|
211 | " [--biossystemtimeoffset <msec>]\n"
|
---|
212 | " [--biospxedebug on|off]\n"
|
---|
213 | " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
|
---|
214 | " [--nic<1-N> none|null|nat|bridged|intnet"
|
---|
215 | #if defined(VBOX_WITH_NETFLT)
|
---|
216 | "|hostonly"
|
---|
217 | #endif
|
---|
218 | "|\n"
|
---|
219 | " generic|natnetwork"
|
---|
220 | "]\n"
|
---|
221 | " [--nictype<1-N> Am79C970A|Am79C973"
|
---|
222 | #ifdef VBOX_WITH_E1000
|
---|
223 | "|\n 82540EM|82543GC|82545EM"
|
---|
224 | #endif
|
---|
225 | #ifdef VBOX_WITH_VIRTIO
|
---|
226 | "|\n virtio"
|
---|
227 | #endif /* VBOX_WITH_VIRTIO */
|
---|
228 | "]\n"
|
---|
229 | " [--cableconnected<1-N> on|off]\n"
|
---|
230 | " [--nictrace<1-N> on|off]\n"
|
---|
231 | " [--nictracefile<1-N> <filename>]\n"
|
---|
232 | " [--nicproperty<1-N> name=[value]]\n"
|
---|
233 | " [--nicspeed<1-N> <kbps>]\n"
|
---|
234 | " [--nicbootprio<1-N> <priority>]\n"
|
---|
235 | " [--nicpromisc<1-N> deny|allow-vms|allow-all]\n"
|
---|
236 | " [--nicbandwidthgroup<1-N> none|<name>]\n"
|
---|
237 | " [--bridgeadapter<1-N> none|<devicename>]\n"
|
---|
238 | #if defined(VBOX_WITH_NETFLT)
|
---|
239 | " [--hostonlyadapter<1-N> none|<devicename>]\n"
|
---|
240 | #endif
|
---|
241 | " [--intnet<1-N> <network name>]\n"
|
---|
242 | " [--nat-network<1-N> <network name>]\n"
|
---|
243 | " [--nicgenericdrv<1-N> <driver>\n"
|
---|
244 | " [--natnet<1-N> <network>|default]\n"
|
---|
245 | " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
|
---|
246 | " [<sockrcv>],[<tcpsnd>],\n"
|
---|
247 | " [<tcprcv>]]\n"
|
---|
248 | " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
|
---|
249 | " <hostport>,[<guestip>],<guestport>]\n"
|
---|
250 | " [--natpf<1-N> delete <rulename>]\n"
|
---|
251 | " [--nattftpprefix<1-N> <prefix>]\n"
|
---|
252 | " [--nattftpfile<1-N> <file>]\n"
|
---|
253 | " [--nattftpserver<1-N> <ip>]\n"
|
---|
254 | " [--natbindip<1-N> <ip>\n"
|
---|
255 | " [--natdnspassdomain<1-N> on|off]\n"
|
---|
256 | " [--natdnsproxy<1-N> on|off]\n"
|
---|
257 | " [--natdnshostresolver<1-N> on|off]\n"
|
---|
258 | " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
|
---|
259 | " [sameports]]\n"
|
---|
260 | " [--macaddress<1-N> auto|<mac>]\n"
|
---|
261 | " [--mouse ps2|usb|usbtablet|usbmultitouch]\n"
|
---|
262 | " [--keyboard ps2|usb\n"
|
---|
263 | " [--uart<1-N> off|<I/O base> <IRQ>]\n"
|
---|
264 | " [--uartmode<1-N> disconnected|\n"
|
---|
265 | " server <pipe>|\n"
|
---|
266 | " client <pipe>|\n"
|
---|
267 | " file <file>|\n"
|
---|
268 | " <devicename>]\n"
|
---|
269 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
270 | " [--lpt<1-N> off|<I/O base> <IRQ>]\n"
|
---|
271 | " [--lptmode<1-N> <devicename>]\n"
|
---|
272 | #endif
|
---|
273 | " [--guestmemoryballoon <balloonsize in MB>]\n"
|
---|
274 | " [--audio none|null", SEP);
|
---|
275 | if (fWin)
|
---|
276 | {
|
---|
277 | #ifdef VBOX_WITH_WINMM
|
---|
278 | RTStrmPrintf(pStrm, "|winmm|dsound");
|
---|
279 | #else
|
---|
280 | RTStrmPrintf(pStrm, "|dsound");
|
---|
281 | #endif
|
---|
282 | }
|
---|
283 | if (fSolaris)
|
---|
284 | {
|
---|
285 | RTStrmPrintf(pStrm, "|solaudio"
|
---|
286 | #ifdef VBOX_WITH_SOLARIS_OSS
|
---|
287 | "|oss"
|
---|
288 | #endif
|
---|
289 | );
|
---|
290 | }
|
---|
291 | if (fLinux)
|
---|
292 | {
|
---|
293 | RTStrmPrintf(pStrm, "|oss"
|
---|
294 | #ifdef VBOX_WITH_ALSA
|
---|
295 | "|alsa"
|
---|
296 | #endif
|
---|
297 | #ifdef VBOX_WITH_PULSE
|
---|
298 | "|pulse"
|
---|
299 | #endif
|
---|
300 | );
|
---|
301 | }
|
---|
302 | if (fFreeBSD)
|
---|
303 | {
|
---|
304 | /* Get the line break sorted when dumping all option variants. */
|
---|
305 | if (fDumpOpts)
|
---|
306 | {
|
---|
307 | RTStrmPrintf(pStrm, "|\n"
|
---|
308 | " oss");
|
---|
309 | }
|
---|
310 | else
|
---|
311 | RTStrmPrintf(pStrm, "|oss");
|
---|
312 | #ifdef VBOX_WITH_PULSE
|
---|
313 | RTStrmPrintf(pStrm, "|pulse");
|
---|
314 | #endif
|
---|
315 | }
|
---|
316 | if (fDarwin)
|
---|
317 | {
|
---|
318 | RTStrmPrintf(pStrm, "|coreaudio");
|
---|
319 | }
|
---|
320 | RTStrmPrintf(pStrm, "]\n");
|
---|
321 | RTStrmPrintf(pStrm,
|
---|
322 | " [--audiocontroller ac97|hda|sb16]\n"
|
---|
323 | " [--clipboard disabled|hosttoguest|guesttohost|\n"
|
---|
324 | " bidirectional]\n"
|
---|
325 | " [--draganddrop disabled|hosttoguest\n");
|
---|
326 | RTStrmPrintf(pStrm,
|
---|
327 | " [--vrde on|off]\n"
|
---|
328 | " [--vrdeextpack default|<name>\n"
|
---|
329 | " [--vrdeproperty <name=[value]>]\n"
|
---|
330 | " [--vrdeport <hostport>]\n"
|
---|
331 | " [--vrdeaddress <hostip>]\n"
|
---|
332 | " [--vrdeauthtype null|external|guest]\n"
|
---|
333 | " [--vrdeauthlibrary default|<name>\n"
|
---|
334 | " [--vrdemulticon on|off]\n"
|
---|
335 | " [--vrdereusecon on|off]\n"
|
---|
336 | " [--vrdevideochannel on|off]\n"
|
---|
337 | " [--vrdevideochannelquality <percent>]\n");
|
---|
338 | RTStrmPrintf(pStrm,
|
---|
339 | " [--usb on|off]\n"
|
---|
340 | " [--usbehci on|off]\n"
|
---|
341 | " [--snapshotfolder default|<path>]\n"
|
---|
342 | " [--teleporter on|off]\n"
|
---|
343 | " [--teleporterport <port>]\n"
|
---|
344 | " [--teleporteraddress <address|empty>\n"
|
---|
345 | " [--teleporterpassword <password>]\n"
|
---|
346 | " [--teleporterpasswordfile <file>|stdin]\n"
|
---|
347 | " [--tracing-enabled on|off]\n"
|
---|
348 | " [--tracing-config <config-string>]\n"
|
---|
349 | " [--tracing-allow-vm-access on|off]\n"
|
---|
350 | #if 0
|
---|
351 | " [--iocache on|off]\n"
|
---|
352 | " [--iocachesize <I/O cache size in MB>]\n"
|
---|
353 | #endif
|
---|
354 | #if 0
|
---|
355 | " [--faulttolerance master|standby]\n"
|
---|
356 | " [--faulttoleranceaddress <name>]\n"
|
---|
357 | " [--faulttoleranceport <port>]\n"
|
---|
358 | " [--faulttolerancesyncinterval <msec>]\n"
|
---|
359 | " [--faulttolerancepassword <password>]\n"
|
---|
360 | #endif
|
---|
361 | #ifdef VBOX_WITH_USB_CARDREADER
|
---|
362 | " [--usbcardreader on|off]\n"
|
---|
363 | #endif
|
---|
364 | " [--autostart-enabled on|off]\n"
|
---|
365 | " [--autostart-delay <seconds>]\n"
|
---|
366 | #if 0 /* Disabled until the feature is implemented. */
|
---|
367 | " [--autostop-type disabled|savestate|poweroff|\n"
|
---|
368 | " acpishutdown]\n"
|
---|
369 | #endif
|
---|
370 | #ifdef VBOX_WITH_VPX
|
---|
371 | " [--vcpenabled on|off]\n"
|
---|
372 | " [--vcpscreens [<display>],...\n"
|
---|
373 | " [--vcpfile <filename>]\n"
|
---|
374 | " [--vcpwidth <width>]\n"
|
---|
375 | " [--vcpheight <height>]\n"
|
---|
376 | " [--vcprate <rate>]\n"
|
---|
377 | " [--vcpfps <fps>]\n"
|
---|
378 | #endif
|
---|
379 | " [--defaultfrontend default|<name]\n"
|
---|
380 | "\n");
|
---|
381 | }
|
---|
382 |
|
---|
383 | if (u64Cmd & USAGE_CLONEVM)
|
---|
384 | RTStrmPrintf(pStrm,
|
---|
385 | "%s clonevm %s <uuid|vmname>\n"
|
---|
386 | " [--snapshot <uuid>|<name>]\n"
|
---|
387 | " [--mode machine|machineandchildren|all]\n"
|
---|
388 | " [--options link|keepallmacs|keepnatmacs|\n"
|
---|
389 | " keepdisknames]\n"
|
---|
390 | " [--name <name>]\n"
|
---|
391 | " [--groups <group>, ...]\n"
|
---|
392 | " [--basefolder <basefolder>]\n"
|
---|
393 | " [--uuid <uuid>]\n"
|
---|
394 | " [--register]\n"
|
---|
395 | "\n", SEP);
|
---|
396 |
|
---|
397 | if (u64Cmd & USAGE_IMPORTAPPLIANCE)
|
---|
398 | RTStrmPrintf(pStrm,
|
---|
399 | "%s import %s <ovfname/ovaname>\n"
|
---|
400 | " [--dry-run|-n]\n"
|
---|
401 | " [--options keepallmacs|keepnatmacs]\n"
|
---|
402 | " [more options]\n"
|
---|
403 | " (run with -n to have options displayed\n"
|
---|
404 | " for a particular OVF)\n\n", SEP);
|
---|
405 |
|
---|
406 | if (u64Cmd & USAGE_EXPORTAPPLIANCE)
|
---|
407 | RTStrmPrintf(pStrm,
|
---|
408 | "%s export %s <machines> --output|-o <name>.<ovf/ova>\n"
|
---|
409 | " [--legacy09|--ovf09|--ovf10|--ovf20]\n"
|
---|
410 | " [--manifest]\n"
|
---|
411 | " [--vsys <number of virtual system>]\n"
|
---|
412 | " [--product <product name>]\n"
|
---|
413 | " [--producturl <product url>]\n"
|
---|
414 | " [--vendor <vendor name>]\n"
|
---|
415 | " [--vendorurl <vendor url>]\n"
|
---|
416 | " [--version <version info>]\n"
|
---|
417 | " [--description <description info>]\n"
|
---|
418 | " [--eula <license text>]\n"
|
---|
419 | " [--eulafile <filename>]\n"
|
---|
420 | "\n", SEP);
|
---|
421 |
|
---|
422 | if (u64Cmd & USAGE_STARTVM)
|
---|
423 | {
|
---|
424 | RTStrmPrintf(pStrm,
|
---|
425 | "%s startvm %s <uuid|vmname>...\n"
|
---|
426 | " [--type gui", SEP);
|
---|
427 | if (fVBoxSDL)
|
---|
428 | RTStrmPrintf(pStrm, "|sdl");
|
---|
429 | RTStrmPrintf(pStrm, "|headless]\n");
|
---|
430 | RTStrmPrintf(pStrm,
|
---|
431 | "\n");
|
---|
432 | }
|
---|
433 |
|
---|
434 | if (u64Cmd & USAGE_CONTROLVM)
|
---|
435 | {
|
---|
436 | RTStrmPrintf(pStrm,
|
---|
437 | "%s controlvm %s <uuid|vmname>\n"
|
---|
438 | " pause|resume|reset|poweroff|savestate|\n"
|
---|
439 | " acpipowerbutton|acpisleepbutton|\n"
|
---|
440 | " keyboardputscancode <hex> [<hex> ...]|\n"
|
---|
441 | " setlinkstate<1-N> on|off |\n"
|
---|
442 | #if defined(VBOX_WITH_NETFLT)
|
---|
443 | " nic<1-N> null|nat|bridged|intnet|hostonly|generic|\n"
|
---|
444 | " natnetwork [<devicename>] |\n"
|
---|
445 | #else /* !VBOX_WITH_NETFLT */
|
---|
446 | " nic<1-N> null|nat|bridged|intnet|generic|natnetwork\n"
|
---|
447 | " [<devicename>] |\n"
|
---|
448 | #endif /* !VBOX_WITH_NETFLT */
|
---|
449 | " nictrace<1-N> on|off |\n"
|
---|
450 | " nictracefile<1-N> <filename> |\n"
|
---|
451 | " nicproperty<1-N> name=[value] |\n"
|
---|
452 | " nicpromisc<1-N> deny|allow-vms|allow-all |\n"
|
---|
453 | " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
|
---|
454 | " <hostport>,[<guestip>],<guestport> |\n"
|
---|
455 | " natpf<1-N> delete <rulename> |\n"
|
---|
456 | " guestmemoryballoon <balloonsize in MB> |\n"
|
---|
457 | " usbattach <uuid>|<address> |\n"
|
---|
458 | " usbdetach <uuid>|<address> |\n"
|
---|
459 | " clipboard disabled|hosttoguest|guesttohost|\n"
|
---|
460 | " bidirectional |\n"
|
---|
461 | " draganddrop disabled|hosttoguest |\n"
|
---|
462 | " vrde on|off |\n"
|
---|
463 | " vrdeport <port> |\n"
|
---|
464 | " vrdeproperty <name=[value]> |\n"
|
---|
465 | " vrdevideochannelquality <percent> |\n"
|
---|
466 | " setvideomodehint <xres> <yres> <bpp>\n"
|
---|
467 | " [[<display>] [<enabled:yes|no> |\n"
|
---|
468 | " [<xorigin> <yorigin>]]] |\n"
|
---|
469 | " screenshotpng <file> [display] |\n"
|
---|
470 | " vcpenabled on|off |\n"
|
---|
471 | " vcpscreens all|none|<screen>,[<screen>...] |\n"
|
---|
472 | " setcredentials <username>\n"
|
---|
473 | " --passwordfile <file> | <password>\n"
|
---|
474 | " <domain>\n"
|
---|
475 | " [--allowlocallogon <yes|no>] |\n"
|
---|
476 | " teleport --host <name> --port <port>\n"
|
---|
477 | " [--maxdowntime <msec>]\n"
|
---|
478 | " [--passwordfile <file> |\n"
|
---|
479 | " --password <password>] |\n"
|
---|
480 | " plugcpu <id> |\n"
|
---|
481 | " unplugcpu <id> |\n"
|
---|
482 | " cpuexecutioncap <1-100>\n"
|
---|
483 | " webcam attach [path [settings]] | detach [path] | list]\n"
|
---|
484 | "\n", SEP);
|
---|
485 | }
|
---|
486 |
|
---|
487 | if (u64Cmd & USAGE_DISCARDSTATE)
|
---|
488 | RTStrmPrintf(pStrm,
|
---|
489 | "%s discardstate %s <uuid|vmname>\n"
|
---|
490 | "\n", SEP);
|
---|
491 |
|
---|
492 | if (u64Cmd & USAGE_ADOPTSTATE)
|
---|
493 | RTStrmPrintf(pStrm,
|
---|
494 | "%s adoptstate %s <uuid|vmname> <state_file>\n"
|
---|
495 | "\n", SEP);
|
---|
496 |
|
---|
497 | if (u64Cmd & USAGE_SNAPSHOT)
|
---|
498 | RTStrmPrintf(pStrm,
|
---|
499 | "%s snapshot %s <uuid|vmname>\n"
|
---|
500 | " take <name> [--description <desc>] [--live] |\n"
|
---|
501 | " delete <uuid|snapname> |\n"
|
---|
502 | " restore <uuid|snapname> |\n"
|
---|
503 | " restorecurrent |\n"
|
---|
504 | " edit <uuid|snapname>|--current\n"
|
---|
505 | " [--name <name>]\n"
|
---|
506 | " [--description <desc>] |\n"
|
---|
507 | " list [--details|--machinereadable]\n"
|
---|
508 | " showvminfo <uuid|snapname>\n"
|
---|
509 | "\n", SEP);
|
---|
510 |
|
---|
511 | if (u64Cmd & USAGE_CLOSEMEDIUM)
|
---|
512 | RTStrmPrintf(pStrm,
|
---|
513 | "%s closemedium %s disk|dvd|floppy <uuid|filename>\n"
|
---|
514 | " [--delete]\n"
|
---|
515 | "\n", SEP);
|
---|
516 |
|
---|
517 | if (u64Cmd & USAGE_STORAGEATTACH)
|
---|
518 | RTStrmPrintf(pStrm,
|
---|
519 | "%s storageattach %s <uuid|vmname>\n"
|
---|
520 | " --storagectl <name>\n"
|
---|
521 | " [--port <number>]\n"
|
---|
522 | " [--device <number>]\n"
|
---|
523 | " [--type dvddrive|hdd|fdd]\n"
|
---|
524 | " [--medium none|emptydrive|additions|\n"
|
---|
525 | " <uuid|filename>|host:<drive>|iscsi]\n"
|
---|
526 | " [--mtype normal|writethrough|immutable|shareable|\n"
|
---|
527 | " readonly|multiattach]\n"
|
---|
528 | " [--comment <text>]\n"
|
---|
529 | " [--setuuid <uuid>]\n"
|
---|
530 | " [--setparentuuid <uuid>]\n"
|
---|
531 | " [--passthrough on|off]\n"
|
---|
532 | " [--tempeject on|off]\n"
|
---|
533 | " [--nonrotational on|off]\n"
|
---|
534 | " [--discard on|off]\n"
|
---|
535 | " [--bandwidthgroup <name>]\n"
|
---|
536 | " [--forceunmount]\n"
|
---|
537 | " [--server <name>|<ip>]\n"
|
---|
538 | " [--target <target>]\n"
|
---|
539 | " [--tport <port>]\n"
|
---|
540 | " [--lun <lun>]\n"
|
---|
541 | " [--encodedlun <lun>]\n"
|
---|
542 | " [--username <username>]\n"
|
---|
543 | " [--password <password>]\n"
|
---|
544 | " [--initiator <initiator>]\n"
|
---|
545 | " [--intnet]\n"
|
---|
546 | "\n", SEP);
|
---|
547 |
|
---|
548 | if (u64Cmd & USAGE_STORAGECONTROLLER)
|
---|
549 | RTStrmPrintf(pStrm,
|
---|
550 | "%s storagectl %s <uuid|vmname>\n"
|
---|
551 | " --name <name>\n"
|
---|
552 | " [--add ide|sata|scsi|floppy|sas]\n"
|
---|
553 | " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
|
---|
554 | " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
|
---|
555 | " [--sataportcount <1-30>]\n"
|
---|
556 | " [--hostiocache on|off]\n"
|
---|
557 | " [--bootable on|off]\n"
|
---|
558 | " [--remove]\n"
|
---|
559 | "\n", SEP);
|
---|
560 |
|
---|
561 | if (u64Cmd & USAGE_BANDWIDTHCONTROL)
|
---|
562 | RTStrmPrintf(pStrm,
|
---|
563 | "%s bandwidthctl %s <uuid|vmname>\n"
|
---|
564 | " add <name> --type disk|network\n"
|
---|
565 | " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
|
---|
566 | " set <name>\n"
|
---|
567 | " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
|
---|
568 | " remove <name> |\n"
|
---|
569 | " list [--machinereadable]\n"
|
---|
570 | " (limit units: k=kilobit, m=megabit, g=gigabit,\n"
|
---|
571 | " K=kilobyte, M=megabyte, G=gigabyte)\n"
|
---|
572 | "\n", SEP);
|
---|
573 |
|
---|
574 | if (u64Cmd & USAGE_SHOWHDINFO)
|
---|
575 | RTStrmPrintf(pStrm,
|
---|
576 | "%s showhdinfo %s <uuid|filename>\n"
|
---|
577 | "\n", SEP);
|
---|
578 |
|
---|
579 | if (u64Cmd & USAGE_CREATEHD)
|
---|
580 | RTStrmPrintf(pStrm,
|
---|
581 | "%s createhd %s --filename <filename>\n"
|
---|
582 | " [--size <megabytes>|--sizebyte <bytes>]\n"
|
---|
583 | " [--diffparent <uuid>|<filename>\n"
|
---|
584 | " [--format VDI|VMDK|VHD] (default: VDI)\n"
|
---|
585 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
586 | "\n", SEP);
|
---|
587 |
|
---|
588 | if (u64Cmd & USAGE_MODIFYHD)
|
---|
589 | RTStrmPrintf(pStrm,
|
---|
590 | "%s modifyhd %s <uuid|filename>\n"
|
---|
591 | " [--type normal|writethrough|immutable|shareable|\n"
|
---|
592 | " readonly|multiattach]\n"
|
---|
593 | " [--autoreset on|off]\n"
|
---|
594 | " [--property <name=[value]>]\n"
|
---|
595 | " [--compact]\n"
|
---|
596 | " [--resize <megabytes>|--resizebyte <bytes>]\n"
|
---|
597 | "\n", SEP);
|
---|
598 |
|
---|
599 | if (u64Cmd & USAGE_CLONEHD)
|
---|
600 | RTStrmPrintf(pStrm,
|
---|
601 | "%s clonehd %s <uuid|inputfile> <uuid|outputfile>\n"
|
---|
602 | " [--format VDI|VMDK|VHD|RAW|<other>]\n"
|
---|
603 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
604 | " [--existing]\n"
|
---|
605 | "\n", SEP);
|
---|
606 |
|
---|
607 | if (u64Cmd & USAGE_CONVERTFROMRAW)
|
---|
608 | RTStrmPrintf(pStrm,
|
---|
609 | "%s convertfromraw %s <filename> <outputfile>\n"
|
---|
610 | " [--format VDI|VMDK|VHD]\n"
|
---|
611 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
612 | " [--uuid <uuid>]\n"
|
---|
613 | "%s convertfromraw %s stdin <outputfile> <bytes>\n"
|
---|
614 | " [--format VDI|VMDK|VHD]\n"
|
---|
615 | " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
|
---|
616 | " [--uuid <uuid>]\n"
|
---|
617 | "\n", SEP, SEP);
|
---|
618 |
|
---|
619 | if (u64Cmd & USAGE_GETEXTRADATA)
|
---|
620 | RTStrmPrintf(pStrm,
|
---|
621 | "%s getextradata %s global|<uuid|vmname>\n"
|
---|
622 | " <key>|enumerate\n"
|
---|
623 | "\n", SEP);
|
---|
624 |
|
---|
625 | if (u64Cmd & USAGE_SETEXTRADATA)
|
---|
626 | RTStrmPrintf(pStrm,
|
---|
627 | "%s setextradata %s global|<uuid|vmname>\n"
|
---|
628 | " <key>\n"
|
---|
629 | " [<value>] (no value deletes key)\n"
|
---|
630 | "\n", SEP);
|
---|
631 |
|
---|
632 | if (u64Cmd & USAGE_SETPROPERTY)
|
---|
633 | RTStrmPrintf(pStrm,
|
---|
634 | "%s setproperty %s machinefolder default|<folder> |\n"
|
---|
635 | " hwvirtexclusive on|off |\n"
|
---|
636 | " vrdeauthlibrary default|<library> |\n"
|
---|
637 | " websrvauthlibrary default|null|<library> |\n"
|
---|
638 | " vrdeextpack null|<library> |\n"
|
---|
639 | " autostartdbpath null|<folder> |\n"
|
---|
640 | " loghistorycount <value>\n"
|
---|
641 | " defaultfrontend default|<name>\n"
|
---|
642 | "\n", SEP);
|
---|
643 |
|
---|
644 | if (u64Cmd & USAGE_USBFILTER_ADD)
|
---|
645 | RTStrmPrintf(pStrm,
|
---|
646 | "%s usbfilter %s add <index,0-N>\n"
|
---|
647 | " --target <uuid|vmname>|global\n"
|
---|
648 | " --name <string>\n"
|
---|
649 | " --action ignore|hold (global filters only)\n"
|
---|
650 | " [--active yes|no] (yes)\n"
|
---|
651 | " [--vendorid <XXXX>] (null)\n"
|
---|
652 | " [--productid <XXXX>] (null)\n"
|
---|
653 | " [--revision <IIFF>] (null)\n"
|
---|
654 | " [--manufacturer <string>] (null)\n"
|
---|
655 | " [--product <string>] (null)\n"
|
---|
656 | " [--remote yes|no] (null, VM filters only)\n"
|
---|
657 | " [--serialnumber <string>] (null)\n"
|
---|
658 | " [--maskedinterfaces <XXXXXXXX>]\n"
|
---|
659 | "\n", SEP);
|
---|
660 |
|
---|
661 | if (u64Cmd & USAGE_USBFILTER_MODIFY)
|
---|
662 | RTStrmPrintf(pStrm,
|
---|
663 | "%s usbfilter %s modify <index,0-N>\n"
|
---|
664 | " --target <uuid|vmname>|global\n"
|
---|
665 | " [--name <string>]\n"
|
---|
666 | " [--action ignore|hold] (global filters only)\n"
|
---|
667 | " [--active yes|no]\n"
|
---|
668 | " [--vendorid <XXXX>|\"\"]\n"
|
---|
669 | " [--productid <XXXX>|\"\"]\n"
|
---|
670 | " [--revision <IIFF>|\"\"]\n"
|
---|
671 | " [--manufacturer <string>|\"\"]\n"
|
---|
672 | " [--product <string>|\"\"]\n"
|
---|
673 | " [--remote yes|no] (null, VM filters only)\n"
|
---|
674 | " [--serialnumber <string>|\"\"]\n"
|
---|
675 | " [--maskedinterfaces <XXXXXXXX>]\n"
|
---|
676 | "\n", SEP);
|
---|
677 |
|
---|
678 | if (u64Cmd & USAGE_USBFILTER_REMOVE)
|
---|
679 | RTStrmPrintf(pStrm,
|
---|
680 | "%s usbfilter %s remove <index,0-N>\n"
|
---|
681 | " --target <uuid|vmname>|global\n"
|
---|
682 | "\n", SEP);
|
---|
683 |
|
---|
684 | if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
|
---|
685 | RTStrmPrintf(pStrm,
|
---|
686 | "%s sharedfolder %s add <uuid|vmname>\n"
|
---|
687 | " --name <name> --hostpath <hostpath>\n"
|
---|
688 | " [--transient] [--readonly] [--automount]\n"
|
---|
689 | "\n", SEP);
|
---|
690 |
|
---|
691 | if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
|
---|
692 | RTStrmPrintf(pStrm,
|
---|
693 | "%s sharedfolder %s remove <uuid|vmname>\n"
|
---|
694 | " --name <name> [--transient]\n"
|
---|
695 | "\n", SEP);
|
---|
696 |
|
---|
697 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
698 | if (u64Cmd & USAGE_GUESTPROPERTY)
|
---|
699 | usageGuestProperty(pStrm, SEP);
|
---|
700 | #endif /* VBOX_WITH_GUEST_PROPS defined */
|
---|
701 |
|
---|
702 | #ifdef VBOX_WITH_GUEST_CONTROL
|
---|
703 | if (u64Cmd & USAGE_GUESTCONTROL)
|
---|
704 | usageGuestControl(pStrm, SEP);
|
---|
705 | #endif /* VBOX_WITH_GUEST_CONTROL defined */
|
---|
706 |
|
---|
707 | if (u64Cmd & USAGE_DEBUGVM)
|
---|
708 | {
|
---|
709 | RTStrmPrintf(pStrm,
|
---|
710 | "%s debugvm %s <uuid|vmname>\n"
|
---|
711 | " dumpguestcore --filename <name> |\n"
|
---|
712 | " info <item> [args] |\n"
|
---|
713 | " injectnmi |\n"
|
---|
714 | " log [--release|--debug] <settings> ...|\n"
|
---|
715 | " logdest [--release|--debug] <settings> ...|\n"
|
---|
716 | " logflags [--release|--debug] <settings> ...|\n"
|
---|
717 | " osdetect |\n"
|
---|
718 | " osinfo |\n"
|
---|
719 | " getregisters [--cpu <id>] <reg>|all ... |\n"
|
---|
720 | " setregisters [--cpu <id>] <reg>=<value> ... |\n"
|
---|
721 | " show [--human-readable|--sh-export|--sh-eval|\n"
|
---|
722 | " --cmd-set] \n"
|
---|
723 | " <logdbg-settings|logrel-settings>\n"
|
---|
724 | " [[opt] what ...] |\n"
|
---|
725 | " statistics [--reset] [--pattern <pattern>]\n"
|
---|
726 | " [--descriptions]\n"
|
---|
727 | "\n", SEP);
|
---|
728 | }
|
---|
729 | if (u64Cmd & USAGE_METRICS)
|
---|
730 | RTStrmPrintf(pStrm,
|
---|
731 | "%s metrics %s list [*|host|<vmname> [<metric_list>]]\n"
|
---|
732 | " (comma-separated)\n\n"
|
---|
733 | "%s metrics %s setup\n"
|
---|
734 | " [--period <seconds>] (default: 1)\n"
|
---|
735 | " [--samples <count>] (default: 1)\n"
|
---|
736 | " [--list]\n"
|
---|
737 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
738 | "%s metrics %s query [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
739 | "%s metrics %s enable\n"
|
---|
740 | " [--list]\n"
|
---|
741 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
742 | "%s metrics %s disable\n"
|
---|
743 | " [--list]\n"
|
---|
744 | " [*|host|<vmname> [<metric_list>]]\n\n"
|
---|
745 | "%s metrics %s collect\n"
|
---|
746 | " [--period <seconds>] (default: 1)\n"
|
---|
747 | " [--samples <count>] (default: 1)\n"
|
---|
748 | " [--list]\n"
|
---|
749 | " [--detach]\n"
|
---|
750 | " [*|host|<vmname> [<metric_list>]]\n"
|
---|
751 | "\n", SEP, SEP, SEP, SEP, SEP, SEP);
|
---|
752 |
|
---|
753 | #if defined(VBOX_WITH_NAT_SERVICE)
|
---|
754 | if (u64Cmd & USAGE_NATNETWORK)
|
---|
755 | {
|
---|
756 | RTStrmPrintf(pStrm,
|
---|
757 | "%s natnetwork %s add --netname <name>\n"
|
---|
758 | " --network <network\n"
|
---|
759 | " [--enable|--disable]\n"
|
---|
760 | " [--dhcp on|off]\n"
|
---|
761 | " [--port-forward-4 <rule>]\n"
|
---|
762 | " [--loopback-4 <rule>]\n"
|
---|
763 | " [--ipv6 on|off]\n"
|
---|
764 | " [--port-forward-6 <rule>]\n"
|
---|
765 | " [--loopback-6 <rule>]\n\n"
|
---|
766 | "%s natnetwork %s remove --netname <name>\n\n"
|
---|
767 | "%s natnetwork %s modify --netname <name>\n"
|
---|
768 | " [--network <network]\n"
|
---|
769 | " [--enable|--disable]\n"
|
---|
770 | " [--dhcp on|off]\n"
|
---|
771 | " [--port-forward-4 <rule>]\n"
|
---|
772 | " [--loopback-4 <rule>]\n"
|
---|
773 | " [--ipv6 on|off]\n"
|
---|
774 | " [--port-forward-6 <rule>]\n"
|
---|
775 | " [--loopback-6 <rule>]\n\n"
|
---|
776 | "%s natnetwork %s start --netname <name>\n\n"
|
---|
777 | "%s natnetwork %s stop --netname <name>\n"
|
---|
778 | "\n", SEP, SEP, SEP, SEP, SEP);
|
---|
779 |
|
---|
780 |
|
---|
781 | }
|
---|
782 | #endif
|
---|
783 |
|
---|
784 | #if defined(VBOX_WITH_NETFLT)
|
---|
785 | if (u64Cmd & USAGE_HOSTONLYIFS)
|
---|
786 | {
|
---|
787 | RTStrmPrintf(pStrm,
|
---|
788 | "%s hostonlyif %s ipconfig <name>\n"
|
---|
789 | " [--dhcp |\n"
|
---|
790 | " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
|
---|
791 | " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
|
---|
792 | # if !defined(RT_OS_SOLARIS)
|
---|
793 | " create |\n"
|
---|
794 | " remove <name>\n"
|
---|
795 | # endif
|
---|
796 | "\n", SEP);
|
---|
797 | }
|
---|
798 | #endif
|
---|
799 |
|
---|
800 | if (u64Cmd & USAGE_DHCPSERVER)
|
---|
801 | {
|
---|
802 | RTStrmPrintf(pStrm,
|
---|
803 | "%s dhcpserver %s add|modify --netname <network_name> |\n"
|
---|
804 | #if defined(VBOX_WITH_NETFLT)
|
---|
805 | " --ifname <hostonly_if_name>\n"
|
---|
806 | #endif
|
---|
807 | " [--ip <ip_address>\n"
|
---|
808 | " --netmask <network_mask>\n"
|
---|
809 | " --lowerip <lower_ip>\n"
|
---|
810 | " --upperip <upper_ip>]\n"
|
---|
811 | " [--enable | --disable]\n\n"
|
---|
812 | "%s dhcpserver %s remove --netname <network_name> |\n"
|
---|
813 | #if defined(VBOX_WITH_NETFLT)
|
---|
814 | " --ifname <hostonly_if_name>\n"
|
---|
815 | #endif
|
---|
816 | "\n", SEP, SEP);
|
---|
817 | }
|
---|
818 | if (u64Cmd & USAGE_EXTPACK)
|
---|
819 | {
|
---|
820 | RTStrmPrintf(pStrm,
|
---|
821 | "%s extpack %s install [--replace] <tarball> |\n"
|
---|
822 | " uninstall [--force] <name> |\n"
|
---|
823 | " cleanup\n"
|
---|
824 | "\n", SEP);
|
---|
825 | }
|
---|
826 | }
|
---|
827 |
|
---|
828 | /**
|
---|
829 | * Print a usage synopsis and the syntax error message.
|
---|
830 | * @returns RTEXITCODE_SYNTAX.
|
---|
831 | */
|
---|
832 | RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
|
---|
833 | {
|
---|
834 | va_list args;
|
---|
835 | showLogo(g_pStdErr); // show logo even if suppressed
|
---|
836 | #ifndef VBOX_ONLY_DOCS
|
---|
837 | if (g_fInternalMode)
|
---|
838 | printUsageInternal(u64Cmd, g_pStdErr);
|
---|
839 | else
|
---|
840 | printUsage(u64Cmd, g_pStdErr);
|
---|
841 | #endif /* !VBOX_ONLY_DOCS */
|
---|
842 | va_start(args, pszFormat);
|
---|
843 | RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
|
---|
844 | va_end(args);
|
---|
845 | return RTEXITCODE_SYNTAX;
|
---|
846 | }
|
---|
847 |
|
---|
848 | /**
|
---|
849 | * errorSyntax for RTGetOpt users.
|
---|
850 | *
|
---|
851 | * @returns RTEXITCODE_SYNTAX.
|
---|
852 | *
|
---|
853 | * @param fUsageCategory The usage category of the command.
|
---|
854 | * @param rc The RTGetOpt return code.
|
---|
855 | * @param pValueUnion The value union.
|
---|
856 | */
|
---|
857 | RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
|
---|
858 | {
|
---|
859 | /*
|
---|
860 | * Check if it is an unhandled standard option.
|
---|
861 | */
|
---|
862 | if (rc == 'V')
|
---|
863 | {
|
---|
864 | RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
|
---|
865 | return RTEXITCODE_SUCCESS;
|
---|
866 | }
|
---|
867 |
|
---|
868 | if (rc == 'h')
|
---|
869 | {
|
---|
870 | showLogo(g_pStdErr);
|
---|
871 | #ifndef VBOX_ONLY_DOCS
|
---|
872 | if (g_fInternalMode)
|
---|
873 | printUsageInternal(fUsageCategory, g_pStdOut);
|
---|
874 | else
|
---|
875 | printUsage(fUsageCategory, g_pStdOut);
|
---|
876 | #endif
|
---|
877 | return RTEXITCODE_SUCCESS;
|
---|
878 | }
|
---|
879 |
|
---|
880 | /*
|
---|
881 | * General failure.
|
---|
882 | */
|
---|
883 | showLogo(g_pStdErr); // show logo even if suppressed
|
---|
884 | #ifndef VBOX_ONLY_DOCS
|
---|
885 | if (g_fInternalMode)
|
---|
886 | printUsageInternal(fUsageCategory, g_pStdErr);
|
---|
887 | else
|
---|
888 | printUsage(fUsageCategory, g_pStdErr);
|
---|
889 | #endif /* !VBOX_ONLY_DOCS */
|
---|
890 |
|
---|
891 | if (rc == VINF_GETOPT_NOT_OPTION)
|
---|
892 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
|
---|
893 | if (rc > 0)
|
---|
894 | {
|
---|
895 | if (RT_C_IS_PRINT(rc))
|
---|
896 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
|
---|
897 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
|
---|
898 | }
|
---|
899 | if (rc == VERR_GETOPT_UNKNOWN_OPTION)
|
---|
900 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
|
---|
901 | if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
|
---|
902 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz);
|
---|
903 | if (pValueUnion->pDef)
|
---|
904 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
|
---|
905 | return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
|
---|
906 | }
|
---|
907 |
|
---|
908 | /**
|
---|
909 | * Print an error message without the syntax stuff.
|
---|
910 | *
|
---|
911 | * @returns RTEXITCODE_SYNTAX.
|
---|
912 | */
|
---|
913 | RTEXITCODE errorArgument(const char *pszFormat, ...)
|
---|
914 | {
|
---|
915 | va_list args;
|
---|
916 | va_start(args, pszFormat);
|
---|
917 | RTMsgErrorV(pszFormat, args);
|
---|
918 | va_end(args);
|
---|
919 | return RTEXITCODE_SYNTAX;
|
---|
920 | }
|
---|