VirtualBox

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

Last change on this file since 29288 was 29218, checked in by vboxsync, 15 years ago

Main/Settings: Drop global iomgr and iobackend settings

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

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