VirtualBox

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

Last change on this file since 41371 was 41371, checked in by vboxsync, 13 years ago

Main,include,VBoxManage: smartcard support: IMachine::EmulatedUSBCardReaderEnabled.

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