VirtualBox

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

Last change on this file since 33567 was 33556, checked in by vboxsync, 14 years ago

VRDE: More API changes for the VRDP server separation.

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