VirtualBox

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

Last change on this file since 27976 was 27927, checked in by vboxsync, 15 years ago

VBoxMange: Cosmetical fixes to the help. Note: <on|off> is wrong, use on|off instead. But <msec> is correct.

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