VirtualBox

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

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

Frontends/VBoxManage,doc/manual: more password file handling touchups, documentation update

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