VirtualBox

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

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

VBoxManage: VRDE options

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

© 2023 Oracle
ContactPrivacy policyTerms of Use