VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp@ 45846

Last change on this file since 45846 was 45838, checked in by vboxsync, 12 years ago

VPX: plugged memory leak; introduced rate parameter; clear artefacts from previous frames after resize; cleanup

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 44.1 KB
Line 
1/* $Id: VBoxManageHelp.cpp 45838 2013-04-30 13:54:20Z 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
34void 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
49void 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 " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"
126#else
127 " bridgedifs|dhcpservers|hostinfo|\n"
128#endif
129 " hostcpuids|hddbackends|hdds|dvds|floppies|\n"
130 " usbhost|usbfilters|systemproperties|extpacks|\n"
131 " groups\n"
132 "\n", SEP);
133
134 if (u64Cmd & USAGE_SHOWVMINFO)
135 RTStrmPrintf(pStrm,
136 "%s showvminfo %s <uuid>|<name> [--details]\n"
137 " [--machinereadable]\n"
138 "%s showvminfo %s <uuid>|<name> --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>|<name> [--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|name>\n"
165 " [--name <name>]\n"
166 " [--groups <group>, ...]\n"
167 " [--ostype <ostype>]\n"
168 " [--memory <memorysize in MB>]\n"
169 " [--pagefusion on|off]\n"
170 " [--vram <vramsize in MB>]\n"
171 " [--acpi on|off]\n"
172#ifdef VBOX_WITH_PCI_PASSTHROUGH
173 " [--pciattach 03:04.0]\n"
174 " [--pciattach 03:04.0@02:01.0]\n"
175 " [--pcidetach 03:04.0]\n"
176#endif
177 " [--ioapic on|off]\n"
178 " [--pae on|off]\n"
179 " [--hpet on|off]\n"
180 " [--hwvirtex on|off]\n"
181 " [--hwvirtexexcl on|off]\n"
182 " [--nestedpaging on|off]\n"
183 " [--largepages on|off]\n"
184 " [--vtxvpid on|off]\n"
185 " [--synthcpu on|off]\n"
186 " [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
187 " [--cpuidremove <leaf>]\n"
188 " [--cpuidremoveall]\n"
189 " [--hardwareuuid <uuid>]\n"
190 " [--cpus <number>]\n"
191 " [--cpuhotplug on|off]\n"
192 " [--plugcpu <id>]\n"
193 " [--unplugcpu <id>]\n"
194 " [--cpuexecutioncap <1-100>]\n"
195 " [--rtcuseutc on|off]\n"
196 " [--graphicscontroller none|vboxvga]\n"
197 " [--monitorcount <number>]\n"
198 " [--accelerate3d on|off]\n"
199#ifdef VBOX_WITH_VIDEOHWACCEL
200 " [--accelerate2dvideo on|off]\n"
201#endif
202 " [--firmware bios|efi|efi32|efi64]\n"
203 " [--chipset ich9|piix3]\n"
204 " [--bioslogofadein on|off]\n"
205 " [--bioslogofadeout on|off]\n"
206 " [--bioslogodisplaytime <msec>]\n"
207 " [--bioslogoimagepath <imagepath>]\n"
208 " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
209 " [--biossystemtimeoffset <msec>]\n"
210 " [--biospxedebug on|off]\n"
211 " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
212 " [--nic<1-N> none|null|nat|bridged|intnet"
213#if defined(VBOX_WITH_NETFLT)
214 "|hostonly"
215#endif
216 "|\n"
217 " generic"
218 "]\n"
219 " [--nictype<1-N> Am79C970A|Am79C973"
220#ifdef VBOX_WITH_E1000
221 "|\n 82540EM|82543GC|82545EM"
222#endif
223#ifdef VBOX_WITH_VIRTIO
224 "|\n virtio"
225#endif /* VBOX_WITH_VIRTIO */
226 "]\n"
227 " [--cableconnected<1-N> on|off]\n"
228 " [--nictrace<1-N> on|off]\n"
229 " [--nictracefile<1-N> <filename>]\n"
230 " [--nicproperty<1-N> name=[value]]\n"
231 " [--nicspeed<1-N> <kbps>]\n"
232 " [--nicbootprio<1-N> <priority>]\n"
233 " [--nicpromisc<1-N> deny|allow-vms|allow-all]\n"
234 " [--nicbandwidthgroup<1-N> none|<name>]\n"
235 " [--bridgeadapter<1-N> none|<devicename>]\n"
236#if defined(VBOX_WITH_NETFLT)
237 " [--hostonlyadapter<1-N> none|<devicename>]\n"
238#endif
239 " [--intnet<1-N> <network name>]\n"
240 " [--natnet<1-N> <network>|default]\n"
241 " [--nicgenericdrv<1-N> <driver>\n"
242 " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
243 " [<sockrcv>],[<tcpsnd>],\n"
244 " [<tcprcv>]]\n"
245 " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
246 " <hostport>,[<guestip>],<guestport>]\n"
247 " [--natpf<1-N> delete <rulename>]\n"
248 " [--nattftpprefix<1-N> <prefix>]\n"
249 " [--nattftpfile<1-N> <file>]\n"
250 " [--nattftpserver<1-N> <ip>]\n"
251 " [--natbindip<1-N> <ip>\n"
252 " [--natdnspassdomain<1-N> on|off]\n"
253 " [--natdnsproxy<1-N> on|off]\n"
254 " [--natdnshostresolver<1-N> on|off]\n"
255 " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
256 " [sameports]]\n"
257 " [--macaddress<1-N> auto|<mac>]\n"
258 " [--mouse ps2|usb|usbtablet\n"
259 " [--keyboard ps2|usb\n"
260 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
261 " [--uartmode<1-N> disconnected|\n"
262 " server <pipe>|\n"
263 " client <pipe>|\n"
264 " file <file>|\n"
265 " <devicename>]\n"
266#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
267 " [--lpt<1-N> off|<I/O base> <IRQ>]\n"
268 " [--lptmode<1-N> <devicename>]\n"
269#endif
270 " [--guestmemoryballoon <balloonsize in MB>]\n"
271 " [--audio none|null", SEP);
272 if (fWin)
273 {
274#ifdef VBOX_WITH_WINMM
275 RTStrmPrintf(pStrm, "|winmm|dsound");
276#else
277 RTStrmPrintf(pStrm, "|dsound");
278#endif
279 }
280 if (fSolaris)
281 {
282 RTStrmPrintf(pStrm, "|solaudio"
283#ifdef VBOX_WITH_SOLARIS_OSS
284 "|oss"
285#endif
286 );
287 }
288 if (fLinux)
289 {
290 RTStrmPrintf(pStrm, "|oss"
291#ifdef VBOX_WITH_ALSA
292 "|alsa"
293#endif
294#ifdef VBOX_WITH_PULSE
295 "|pulse"
296#endif
297 );
298 }
299 if (fFreeBSD)
300 {
301 /* Get the line break sorted when dumping all option variants. */
302 if (fDumpOpts)
303 {
304 RTStrmPrintf(pStrm, "|\n"
305 " oss");
306 }
307 else
308 RTStrmPrintf(pStrm, "|oss");
309#ifdef VBOX_WITH_PULSE
310 RTStrmPrintf(pStrm, "|pulse");
311#endif
312 }
313 if (fDarwin)
314 {
315 RTStrmPrintf(pStrm, "|coreaudio");
316 }
317 RTStrmPrintf(pStrm, "]\n");
318 RTStrmPrintf(pStrm,
319 " [--audiocontroller ac97|hda|sb16]\n"
320 " [--clipboard disabled|hosttoguest|guesttohost|\n"
321 " bidirectional]\n"
322 " [--draganddrop disabled|hosttoguest\n");
323 RTStrmPrintf(pStrm,
324 " [--vrde on|off]\n"
325 " [--vrdeextpack default|<name>\n"
326 " [--vrdeproperty <name=[value]>]\n"
327 " [--vrdeport <hostport>]\n"
328 " [--vrdeaddress <hostip>]\n"
329 " [--vrdeauthtype null|external|guest]\n"
330 " [--vrdeauthlibrary default|<name>\n"
331 " [--vrdemulticon on|off]\n"
332 " [--vrdereusecon on|off]\n"
333 " [--vrdevideochannel on|off]\n"
334 " [--vrdevideochannelquality <percent>]\n");
335 RTStrmPrintf(pStrm,
336 " [--usb on|off]\n"
337 " [--usbehci on|off]\n"
338 " [--snapshotfolder default|<path>]\n"
339 " [--teleporter on|off]\n"
340 " [--teleporterport <port>]\n"
341 " [--teleporteraddress <address|empty>\n"
342 " [--teleporterpassword <password>]\n"
343 " [--teleporterpasswordfile <file>|stdin]\n"
344 " [--tracing-enabled on|off]\n"
345 " [--tracing-config <config-string>]\n"
346 " [--tracing-allow-vm-access on|off]\n"
347#if 0
348 " [--iocache on|off]\n"
349 " [--iocachesize <I/O cache size in MB>]\n"
350#endif
351#if 0
352 " [--faulttolerance master|standby]\n"
353 " [--faulttoleranceaddress <name>]\n"
354 " [--faulttoleranceport <port>]\n"
355 " [--faulttolerancesyncinterval <msec>]\n"
356 " [--faulttolerancepassword <password>]\n"
357#endif
358#ifdef VBOX_WITH_USB_VIDEO
359 " [--usbwebcam on|off]\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 " [--vcpfile <filename>]\n"
373 " [--vcpwidth <width>]\n"
374 " [--vcpheight <height>]\n"
375 " [--vcprate <rate>]\n"
376#endif
377 " [--defaultfrontend default|<name]\n"
378 "\n");
379 }
380
381 if (u64Cmd & USAGE_CLONEVM)
382 RTStrmPrintf(pStrm,
383 "%s clonevm %s <uuid>|<name>\n"
384 " [--snapshot <uuid>|<name>]\n"
385 " [--mode machine|machineandchildren|all]\n"
386 " [--options link|keepallmacs|keepnatmacs|\n"
387 " keepdisknames]\n"
388 " [--name <name>]\n"
389 " [--groups <group>, ...]\n"
390 " [--basefolder <basefolder>]\n"
391 " [--uuid <uuid>]\n"
392 " [--register]\n"
393 "\n", SEP);
394
395 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
396 RTStrmPrintf(pStrm,
397 "%s import %s <ovf/ova>\n"
398 " [--dry-run|-n]\n"
399 " [--options keepallmacs|keepnatmacs]\n"
400 " [more options]\n"
401 " (run with -n to have options displayed\n"
402 " for a particular OVF)\n\n", SEP);
403
404 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
405 RTStrmPrintf(pStrm,
406 "%s export %s <machines> --output|-o <name>.<ovf/ova>\n"
407 " [--legacy09|--ovf09|--ovf10|--ovf20]\n"
408 " [--manifest]\n"
409 " [--vsys <number of virtual system>]\n"
410 " [--product <product name>]\n"
411 " [--producturl <product url>]\n"
412 " [--vendor <vendor name>]\n"
413 " [--vendorurl <vendor url>]\n"
414 " [--version <version info>]\n"
415 " [--eula <license text>]\n"
416 " [--eulafile <filename>]\n"
417 "\n", SEP);
418
419 if (u64Cmd & USAGE_STARTVM)
420 {
421 RTStrmPrintf(pStrm,
422 "%s startvm %s <uuid>|<name>...\n"
423 " [--type gui", SEP);
424 if (fVBoxSDL)
425 RTStrmPrintf(pStrm, "|sdl");
426 RTStrmPrintf(pStrm, "|headless]\n");
427 RTStrmPrintf(pStrm,
428 "\n");
429 }
430
431 if (u64Cmd & USAGE_CONTROLVM)
432 {
433 RTStrmPrintf(pStrm,
434 "%s controlvm %s <uuid>|<name>\n"
435 " pause|resume|reset|poweroff|savestate|\n"
436 " acpipowerbutton|acpisleepbutton|\n"
437 " keyboardputscancode <hex> [<hex> ...]|\n"
438 " setlinkstate<1-N> on|off |\n"
439#if defined(VBOX_WITH_NETFLT)
440 " nic<1-N> null|nat|bridged|intnet|hostonly|generic"
441 "\n"
442 " [<devicename>] |\n"
443#else /* !VBOX_WITH_NETFLT */
444 " nic<1-N> null|nat|bridged|intnet|generic\n"
445 " [<devicename>] |\n"
446#endif /* !VBOX_WITH_NETFLT */
447 " nictrace<1-N> on|off |\n"
448 " nictracefile<1-N> <filename> |\n"
449 " nicproperty<1-N> name=[value] |\n"
450 " nicpromisc<1-N> deny|allow-vms|allow-all |\n"
451 " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
452 " <hostport>,[<guestip>],<guestport> |\n"
453 " natpf<1-N> delete <rulename> |\n"
454 " guestmemoryballoon <balloonsize in MB> |\n"
455 " usbattach <uuid>|<address> |\n"
456 " usbdetach <uuid>|<address> |\n"
457 " clipboard disabled|hosttoguest|guesttohost|\n"
458 " bidirectional |\n"
459 " draganddrop disabled|hosttoguest |\n"
460 " vrde on|off |\n"
461 " vrdeport <port> |\n"
462 " vrdeproperty <name=[value]> |\n"
463 " vrdevideochannelquality <percent> |\n"
464 " setvideomodehint <xres> <yres> <bpp>\n"
465 " [[<display>] [<enabled:yes|no> |\n"
466 " [<xorigin> <yorigin>]]] |\n"
467 " screenshotpng <file> [display] |\n"
468 " setcredentials <username>\n"
469 " --passwordfile <file> | <password>\n"
470 " <domain>\n"
471 " [--allowlocallogon <yes|no>] |\n"
472 " teleport --host <name> --port <port>\n"
473 " [--maxdowntime <msec>]\n"
474 " [--passwordfile <file> |\n"
475 " --password <password>] |\n"
476 " plugcpu <id> |\n"
477 " unplugcpu <id> |\n"
478 " cpuexecutioncap <1-100>\n"
479 "\n", SEP);
480 }
481
482 if (u64Cmd & USAGE_DISCARDSTATE)
483 RTStrmPrintf(pStrm,
484 "%s discardstate %s <uuid>|<name>\n"
485 "\n", SEP);
486
487 if (u64Cmd & USAGE_ADOPTSTATE)
488 RTStrmPrintf(pStrm,
489 "%s adoptstate %s <uuid>|<name> <state_file>\n"
490 "\n", SEP);
491
492 if (u64Cmd & USAGE_SNAPSHOT)
493 RTStrmPrintf(pStrm,
494 "%s snapshot %s <uuid>|<name>\n"
495 " take <name> [--description <desc>] [--pause] |\n"
496 " delete <uuid>|<name> |\n"
497 " restore <uuid>|<name> |\n"
498 " restorecurrent |\n"
499 " edit <uuid>|<name>|--current\n"
500 " [--name <name>]\n"
501 " [--description <desc>] |\n"
502 " list [--details|--machinereadable]\n"
503 " showvminfo <uuid>|<name>\n"
504 "\n", SEP);
505
506 if (u64Cmd & USAGE_CLOSEMEDIUM)
507 RTStrmPrintf(pStrm,
508 "%s closemedium %s disk|dvd|floppy <uuid>|<filename>\n"
509 " [--delete]\n"
510 "\n", SEP);
511
512 if (u64Cmd & USAGE_STORAGEATTACH)
513 RTStrmPrintf(pStrm,
514 "%s storageattach %s <uuid|vmname>\n"
515 " --storagectl <name>\n"
516 " [--port <number>]\n"
517 " [--device <number>]\n"
518 " [--type dvddrive|hdd|fdd]\n"
519 " [--medium none|emptydrive|additions|\n"
520 " <uuid>|<filename>|host:<drive>|iscsi]\n"
521 " [--mtype normal|writethrough|immutable|shareable|\n"
522 " readonly|multiattach]\n"
523 " [--comment <text>]\n"
524 " [--setuuid <uuid>]\n"
525 " [--setparentuuid <uuid>]\n"
526 " [--passthrough on|off]\n"
527 " [--tempeject on|off]\n"
528 " [--nonrotational on|off]\n"
529 " [--discard on|off]\n"
530 " [--bandwidthgroup <name>]\n"
531 " [--forceunmount]\n"
532 " [--server <name>|<ip>]\n"
533 " [--target <target>]\n"
534 " [--tport <port>]\n"
535 " [--lun <lun>]\n"
536 " [--encodedlun <lun>]\n"
537 " [--username <username>]\n"
538 " [--password <password>]\n"
539 " [--initiator <initiator>]\n"
540 " [--intnet]\n"
541 "\n", SEP);
542
543 if (u64Cmd & USAGE_STORAGECONTROLLER)
544 RTStrmPrintf(pStrm,
545 "%s storagectl %s <uuid|vmname>\n"
546 " --name <name>\n"
547 " [--add ide|sata|scsi|floppy|sas]\n"
548 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
549 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
550 " [--sataportcount <1-30>]\n"
551 " [--hostiocache on|off]\n"
552 " [--bootable on|off]\n"
553 " [--remove]\n"
554 "\n", SEP);
555
556 if (u64Cmd & USAGE_BANDWIDTHCONTROL)
557 RTStrmPrintf(pStrm,
558 "%s bandwidthctl %s <uuid|vmname>\n"
559 " add <name> --type disk|network\n"
560 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
561 " set <name>\n"
562 " --limit <megabytes per second>[k|m|g|K|M|G] |\n"
563 " remove <name> |\n"
564 " list [--machinereadable]\n"
565 " (limit units: k=kilobit, m=megabit, g=gigabit,\n"
566 " K=kilobyte, M=megabyte, G=gigabyte)\n"
567 "\n", SEP);
568
569 if (u64Cmd & USAGE_SHOWHDINFO)
570 RTStrmPrintf(pStrm,
571 "%s showhdinfo %s <uuid>|<filename>\n"
572 "\n", SEP);
573
574 if (u64Cmd & USAGE_CREATEHD)
575 RTStrmPrintf(pStrm,
576 "%s createhd %s --filename <filename>\n"
577 " [--size <megabytes>|--sizebyte <bytes>]\n"
578 " [--diffparent <uuid>|<filename>\n"
579 " [--format VDI|VMDK|VHD] (default: VDI)\n"
580 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
581 "\n", SEP);
582
583 if (u64Cmd & USAGE_MODIFYHD)
584 RTStrmPrintf(pStrm,
585 "%s modifyhd %s <uuid>|<filename>\n"
586 " [--type normal|writethrough|immutable|shareable|\n"
587 " readonly|multiattach]\n"
588 " [--autoreset on|off]\n"
589 " [--compact]\n"
590 " [--resize <megabytes>|--resizebyte <bytes>]\n"
591 "\n", SEP);
592
593 if (u64Cmd & USAGE_CLONEHD)
594 RTStrmPrintf(pStrm,
595 "%s clonehd %s <uuid>|<filename> <uuid>|<outputfile>\n"
596 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
597 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
598 " [--existing]\n"
599 "\n", SEP);
600
601 if (u64Cmd & USAGE_CONVERTFROMRAW)
602 RTStrmPrintf(pStrm,
603 "%s convertfromraw %s <filename> <outputfile>\n"
604 " [--format VDI|VMDK|VHD]\n"
605 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
606 " [--uuid <uuid>]\n"
607 "%s convertfromraw %s stdin <outputfile> <bytes>\n"
608 " [--format VDI|VMDK|VHD]\n"
609 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
610 " [--uuid <uuid>]\n"
611 "\n", SEP, SEP);
612
613 if (u64Cmd & USAGE_GETEXTRADATA)
614 RTStrmPrintf(pStrm,
615 "%s getextradata %s global|<uuid>|<name>\n"
616 " <key>|enumerate\n"
617 "\n", SEP);
618
619 if (u64Cmd & USAGE_SETEXTRADATA)
620 RTStrmPrintf(pStrm,
621 "%s setextradata %s global|<uuid>|<name>\n"
622 " <key>\n"
623 " [<value>] (no value deletes key)\n"
624 "\n", SEP);
625
626 if (u64Cmd & USAGE_SETPROPERTY)
627 RTStrmPrintf(pStrm,
628 "%s setproperty %s machinefolder default|<folder> |\n"
629 " vrdeauthlibrary default|<library> |\n"
630 " websrvauthlibrary default|null|<library> |\n"
631 " vrdeextpack null|<library> |\n"
632 " autostartdbpath null|<folder> |\n"
633 " loghistorycount <value>\n"
634 " defaultfrontend default|<name>\n"
635 "\n", SEP);
636
637 if (u64Cmd & USAGE_USBFILTER_ADD)
638 RTStrmPrintf(pStrm,
639 "%s usbfilter %s add <index,0-N>\n"
640 " --target <uuid>|<name>|global\n"
641 " --name <string>\n"
642 " --action ignore|hold (global filters only)\n"
643 " [--active yes|no] (yes)\n"
644 " [--vendorid <XXXX>] (null)\n"
645 " [--productid <XXXX>] (null)\n"
646 " [--revision <IIFF>] (null)\n"
647 " [--manufacturer <string>] (null)\n"
648 " [--product <string>] (null)\n"
649 " [--remote yes|no] (null, VM filters only)\n"
650 " [--serialnumber <string>] (null)\n"
651 " [--maskedinterfaces <XXXXXXXX>]\n"
652 "\n", SEP);
653
654 if (u64Cmd & USAGE_USBFILTER_MODIFY)
655 RTStrmPrintf(pStrm,
656 "%s usbfilter %s modify <index,0-N>\n"
657 " --target <uuid>|<name>|global\n"
658 " [--name <string>]\n"
659 " [--action ignore|hold] (global filters only)\n"
660 " [--active yes|no]\n"
661 " [--vendorid <XXXX>|\"\"]\n"
662 " [--productid <XXXX>|\"\"]\n"
663 " [--revision <IIFF>|\"\"]\n"
664 " [--manufacturer <string>|\"\"]\n"
665 " [--product <string>|\"\"]\n"
666 " [--remote yes|no] (null, VM filters only)\n"
667 " [--serialnumber <string>|\"\"]\n"
668 " [--maskedinterfaces <XXXXXXXX>]\n"
669 "\n", SEP);
670
671 if (u64Cmd & USAGE_USBFILTER_REMOVE)
672 RTStrmPrintf(pStrm,
673 "%s usbfilter %s remove <index,0-N>\n"
674 " --target <uuid>|<name>|global\n"
675 "\n", SEP);
676
677 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
678 RTStrmPrintf(pStrm,
679 "%s sharedfolder %s add <vmname>|<uuid>\n"
680 " --name <name> --hostpath <hostpath>\n"
681 " [--transient] [--readonly] [--automount]\n"
682 "\n", SEP);
683
684 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
685 RTStrmPrintf(pStrm,
686 "%s sharedfolder %s remove <vmname>|<uuid>\n"
687 " --name <name> [--transient]\n"
688 "\n", SEP);
689
690#ifdef VBOX_WITH_GUEST_PROPS
691 if (u64Cmd & USAGE_GUESTPROPERTY)
692 usageGuestProperty(pStrm, SEP);
693#endif /* VBOX_WITH_GUEST_PROPS defined */
694
695#ifdef VBOX_WITH_GUEST_CONTROL
696 if (u64Cmd & USAGE_GUESTCONTROL)
697 usageGuestControl(pStrm, SEP);
698#endif /* VBOX_WITH_GUEST_CONTROL defined */
699
700 if (u64Cmd & USAGE_DEBUGVM)
701 {
702 RTStrmPrintf(pStrm,
703 "%s debugvm %s <uuid>|<name>\n"
704 " dumpguestcore --filename <name> |\n"
705 " info <item> [args] |\n"
706 " injectnmi |\n"
707 " log [--release|--debug] <settings> ...|\n"
708 " logdest [--release|--debug] <settings> ...|\n"
709 " logflags [--release|--debug] <settings> ...|\n"
710 " osdetect |\n"
711 " osinfo |\n"
712 " getregisters [--cpu <id>] <reg>|all ... |\n"
713 " setregisters [--cpu <id>] <reg>=<value> ... |\n"
714 " show [--human-readable|--sh-export|--sh-eval|\n"
715 " --cmd-set] \n"
716 " <logdbg-settings|logrel-settings>\n"
717 " [[opt] what ...] |\n"
718 " statistics [--reset] [--pattern <pattern>]\n"
719 " [--descriptions]\n"
720 "\n", SEP);
721 }
722 if (u64Cmd & USAGE_METRICS)
723 RTStrmPrintf(pStrm,
724 "%s metrics %s list [*|host|<vmname> [<metric_list>]]\n"
725 " (comma-separated)\n\n"
726 "%s metrics %s setup\n"
727 " [--period <seconds>] (default: 1)\n"
728 " [--samples <count>] (default: 1)\n"
729 " [--list]\n"
730 " [*|host|<vmname> [<metric_list>]]\n\n"
731 "%s metrics %s query [*|host|<vmname> [<metric_list>]]\n\n"
732 "%s metrics %s enable\n"
733 " [--list]\n"
734 " [*|host|<vmname> [<metric_list>]]\n\n"
735 "%s metrics %s disable\n"
736 " [--list]\n"
737 " [*|host|<vmname> [<metric_list>]]\n\n"
738 "%s metrics %s collect\n"
739 " [--period <seconds>] (default: 1)\n"
740 " [--samples <count>] (default: 1)\n"
741 " [--list]\n"
742 " [--detach]\n"
743 " [*|host|<vmname> [<metric_list>]]\n"
744 "\n", SEP, SEP, SEP, SEP, SEP, SEP);
745
746#if defined(VBOX_WITH_NETFLT)
747 if (u64Cmd & USAGE_HOSTONLYIFS)
748 {
749 RTStrmPrintf(pStrm,
750 "%s hostonlyif %s ipconfig <name>\n"
751 " [--dhcp |\n"
752 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
753 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
754# if !defined(RT_OS_SOLARIS)
755 " create |\n"
756 " remove <name>\n"
757# endif
758 "\n", SEP);
759 }
760#endif
761
762 if (u64Cmd & USAGE_DHCPSERVER)
763 {
764 RTStrmPrintf(pStrm,
765 "%s dhcpserver %s add|modify --netname <network_name> |\n"
766#if defined(VBOX_WITH_NETFLT)
767 " --ifname <hostonly_if_name>\n"
768#endif
769 " [--ip <ip_address>\n"
770 " --netmask <network_mask>\n"
771 " --lowerip <lower_ip>\n"
772 " --upperip <upper_ip>]\n"
773 " [--enable | --disable]\n\n"
774 "%s dhcpserver %s remove --netname <network_name> |\n"
775#if defined(VBOX_WITH_NETFLT)
776 " --ifname <hostonly_if_name>\n"
777#endif
778 "\n", SEP, SEP);
779 }
780 if (u64Cmd & USAGE_EXTPACK)
781 {
782 RTStrmPrintf(pStrm,
783 "%s extpack %s install [--replace] <tarball> |\n"
784 " uninstall [--force] <name> |\n"
785 " cleanup\n"
786 "\n", SEP);
787 }
788}
789
790/**
791 * Print a usage synopsis and the syntax error message.
792 * @returns RTEXITCODE_SYNTAX.
793 */
794RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
795{
796 va_list args;
797 showLogo(g_pStdErr); // show logo even if suppressed
798#ifndef VBOX_ONLY_DOCS
799 if (g_fInternalMode)
800 printUsageInternal(u64Cmd, g_pStdErr);
801 else
802 printUsage(u64Cmd, g_pStdErr);
803#endif /* !VBOX_ONLY_DOCS */
804 va_start(args, pszFormat);
805 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
806 va_end(args);
807 return RTEXITCODE_SYNTAX;
808}
809
810/**
811 * errorSyntax for RTGetOpt users.
812 *
813 * @returns RTEXITCODE_SYNTAX.
814 *
815 * @param fUsageCategory The usage category of the command.
816 * @param rc The RTGetOpt return code.
817 * @param pValueUnion The value union.
818 */
819RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
820{
821 /*
822 * Check if it is an unhandled standard option.
823 */
824 if (rc == 'V')
825 {
826 RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
827 return RTEXITCODE_SUCCESS;
828 }
829
830 if (rc == 'h')
831 {
832 showLogo(g_pStdErr);
833#ifndef VBOX_ONLY_DOCS
834 if (g_fInternalMode)
835 printUsageInternal(fUsageCategory, g_pStdOut);
836 else
837 printUsage(fUsageCategory, g_pStdOut);
838#endif
839 return RTEXITCODE_SUCCESS;
840 }
841
842 /*
843 * General failure.
844 */
845 showLogo(g_pStdErr); // show logo even if suppressed
846#ifndef VBOX_ONLY_DOCS
847 if (g_fInternalMode)
848 printUsageInternal(fUsageCategory, g_pStdErr);
849 else
850 printUsage(fUsageCategory, g_pStdErr);
851#endif /* !VBOX_ONLY_DOCS */
852
853 if (rc == VINF_GETOPT_NOT_OPTION)
854 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
855 if (rc > 0)
856 {
857 if (RT_C_IS_PRINT(rc))
858 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
859 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
860 }
861 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
862 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
863 if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
864 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz);
865 if (pValueUnion->pDef)
866 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
867 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
868}
869
870/**
871 * Print an error message without the syntax stuff.
872 *
873 * @returns RTEXITCODE_SYNTAX.
874 */
875RTEXITCODE errorArgument(const char *pszFormat, ...)
876{
877 va_list args;
878 va_start(args, pszFormat);
879 RTMsgErrorV(pszFormat, args);
880 va_end(args);
881 return RTEXITCODE_SYNTAX;
882}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette