VirtualBox

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

Last change on this file since 28796 was 28787, checked in by vboxsync, 15 years ago

NAT: introduces management routines of NAT libalias core. (see xTracker/#4843 for details)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 31.4 KB
Line 
1/* $Id: VBoxManageHelp.cpp 28787 2010-04-27 06:36:48Z vboxsync $ */
2/** @file
3 * VBoxManage - help and other message output.
4 */
5
6/*
7 * Copyright (C) 2006-2010 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 "\n");
123 }
124
125 if (u64Cmd & USAGE_SHOWVMINFO)
126 {
127 RTPrintf("VBoxManage showvminfo <uuid>|<name> [--details] [--statistics]\n"
128 " [--machinereadable]\n"
129 "VBoxManage showvminfo <uuid>|<name> --log <idx>\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 " [--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 " [--natsettings<1-N> \"[<mtu>],[<socksnd>],[<sockrcv>],\n"
216 " [<tcpsnd>],[<tcprcv>]\"]\n"
217 " [--natpf<1-N> \"[<rulename>],tcp|udp,\n"
218 " [<hostip>],<hostport>,\n"
219 " [<guestip>],<guestport>\"]\n"
220 " [--natpf<1-N> delete <rulename>]\n"
221 " [--nattftpprefix<1-N> <prefix>]\n"
222 " [--nattftpfile<1-N> <file>]\n"
223 " [--nattftpserver<1-N> <ip>]\n"
224 " [--natdnspassdomain<1-N> on|off]\n"
225 " [--natdnsproxy<1-N> on|off]\n"
226 " [--natdnshostresolver<1-N> on|off]\n"
227 " [--nataliasmode<1-N> default|[log],[proxyonly],[sameports]]\n"
228 " [--macaddress<1-N> auto|<mac>]\n"
229 " [--mouse ps2|usb|usbtablet\n"
230 " [--keyboard ps2|usb\n"
231 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
232 " [--uartmode<1-N> disconnected|\n"
233 " server <pipe>|\n"
234 " client <pipe>|\n"
235 " file <file>|\n"
236 " <devicename>]\n"
237 " [--guestmemoryballoon <balloonsize in MB>]\n"
238 " [--gueststatisticsinterval <seconds>]\n"
239 );
240 RTPrintf(" [--audio none|null");
241 if (fWin)
242 {
243#ifdef VBOX_WITH_WINMM
244 RTPrintf( "|winmm|dsound");
245#else
246 RTPrintf( "|dsound");
247#endif
248 }
249 if (fSolaris)
250 {
251 RTPrintf( "|solaudio"
252#ifdef VBOX_WITH_SOLARIS_OSS
253 "|oss"
254#endif
255 );
256 }
257 if (fLinux)
258 {
259 RTPrintf( "|oss"
260#ifdef VBOX_WITH_ALSA
261 "|alsa"
262#endif
263#ifdef VBOX_WITH_PULSE
264 "|pulse"
265#endif
266 );
267 }
268 if (fFreeBSD)
269 {
270 RTPrintf( "|oss"
271#ifdef VBOX_WITH_PULSE
272 "|pulse"
273#endif
274 );
275 }
276 if (fDarwin)
277 {
278 RTPrintf( "|coreaudio");
279 }
280 RTPrintf( "]\n");
281 RTPrintf(" [--audiocontroller ac97|sb16]\n"
282 " [--clipboard disabled|hosttoguest|guesttohost|\n"
283 " bidirectional]\n");
284 if (fVRDP)
285 {
286 RTPrintf(" [--vrdp on|off]\n"
287 " [--vrdpport default|<ports>]\n"
288 " [--vrdpaddress <host>]\n"
289 " [--vrdpauthtype null|external|guest]\n"
290 " [--vrdpmulticon on|off]\n"
291 " [--vrdpreusecon on|off]\n");
292 }
293 RTPrintf(" [--usb on|off]\n"
294 " [--usbehci on|off]\n"
295 " [--snapshotfolder default|<path>]\n"
296 " [--teleporter on|off]\n"
297 " [--teleporterport <port>]\n"
298 " [--teleporteraddress <address|empty>\n"
299 " [--teleporterpassword <password>]\n"
300#if 0
301 " [--iomgr simple|async]\n"
302 " [--iobackend buffered|unbuffered]\n"
303 " [--iocache on|off]\n"
304 " [--iocachesize <I/O cache size in MB>]\n"
305 " [--iobandwidthmax <Maximum I/O bandwidth in MB/s>]\n"
306#endif
307 );
308 RTPrintf("\n");
309 }
310
311 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
312 {
313 RTPrintf("VBoxManage import <ovf> [--dry-run|-n] [more options]\n"
314 " (run with -n to have options displayed\n"
315 " for a particular OVF)\n\n");
316 }
317
318 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
319 {
320 RTPrintf("VBoxManage export <machines> --output|-o <ovf>\n"
321 " [--legacy09]\n"
322 " [--vsys <number of virtual system>]\n"
323 " [--product <product name>]\n"
324 " [--producturl <product url>]\n"
325 " [--vendor <vendor name>]\n"
326 " [--vendorurl <vendor url>]\n"
327 " [--version <version info>]\n"
328 " [--eula <license text>]\n"
329 " [--eulafile <filename>]\n"
330 "\n");
331 }
332
333 if (u64Cmd & USAGE_STARTVM)
334 {
335 RTPrintf("VBoxManage startvm <uuid>|<name>\n");
336 RTPrintf(" [--type gui");
337 if (fVBoxSDL)
338 RTPrintf( "|sdl");
339 if (fVRDP)
340 RTPrintf( "|vrdp");
341 RTPrintf( "|headless]\n");
342 RTPrintf("\n");
343 }
344
345 if (u64Cmd & USAGE_CONTROLVM)
346 {
347 RTPrintf("VBoxManage controlvm <uuid>|<name>\n"
348 " pause|resume|reset|poweroff|savestate|\n"
349 " acpipowerbutton|acpisleepbutton|\n"
350 " keyboardputscancode <hex> [<hex> ...]|\n"
351 " injectnmi|\n"
352 " setlinkstate<1-N> on|off |\n"
353#ifdef VBOX_DYNAMIC_NET_ATTACH
354#if defined(VBOX_WITH_NETFLT)
355 " nic<1-N> null|nat|bridged|intnet|hostonly\n"
356 " [<devicename>] |\n"
357#else /* !RT_OS_LINUX && !RT_OS_DARWIN */
358 " nic<1-N> null|nat|bridged|intnet\n"
359 " [<devicename>] |\n"
360#endif /* !RT_OS_LINUX && !RT_OS_DARWIN */
361 " nictrace<1-N> on|off\n"
362 " nictracefile<1-N> <filename>\n"
363#endif /* VBOX_DYNAMIC_NET_ATTACH */
364 " guestmemoryballoon <balloonsize in MB>]\n"
365 " gueststatisticsinterval <seconds>]\n"
366 " usbattach <uuid>|<address> |\n"
367 " usbdetach <uuid>|<address> |\n");
368 if (fVRDP)
369 {
370 RTPrintf(" vrdp on|off |\n");
371 RTPrintf(" vrdpport default|<ports> |\n");
372 }
373 RTPrintf(" setvideomodehint <xres> <yres> <bpp> [display] |\n"
374 " setcredentials <username> <password> <domain>\n"
375 " [--allowlocallogon <yes|no>] |\n"
376 " teleport --host <name> --port <port>\n"
377 " [--maxdowntime <msec>] [--password password]\n"
378 "\n");
379 }
380
381 if (u64Cmd & USAGE_DISCARDSTATE)
382 {
383 RTPrintf("VBoxManage discardstate <uuid>|<name>\n"
384 "\n");
385 }
386
387 if (u64Cmd & USAGE_ADOPTSTATE)
388 {
389 RTPrintf("VBoxManage adoptstate <uuid>|<name> <state_file>\n"
390 "\n");
391 }
392
393 if (u64Cmd & USAGE_SNAPSHOT)
394 {
395 RTPrintf("VBoxManage snapshot <uuid>|<name>\n"
396 " take <name> [--description <desc>] [--pause] |\n"
397 " delete <uuid>|<name> |\n"
398 " restore <uuid>|<name> |\n"
399 " restorecurrent |\n"
400 " edit <uuid>|<name>|--current\n"
401 " [--name <name>]\n"
402 " [--description <desc>] |\n"
403 " showvminfo <uuid>|<name>\n"
404 "\n");
405 }
406
407 if (u64Cmd & USAGE_OPENMEDIUM)
408 {
409 RTPrintf("VBoxManage openmedium disk|dvd|floppy <filename>\n"
410 " [--type normal|immutable|writethrough] (disk only)\n"
411 " [--uuid <uuid>]\n"
412 " [--parentuuid <uuid>] (disk only)\n"
413 "\n");
414 }
415
416 if (u64Cmd & USAGE_CLOSEMEDIUM)
417 {
418 RTPrintf("VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
419 " [--delete]\n"
420 "\n");
421 }
422
423 if (u64Cmd & USAGE_STORAGEATTACH)
424 {
425 RTPrintf("VBoxManage storageattach <uuid|vmname>\n"
426 " --storagectl <name>\n"
427 " --port <number>\n"
428 " --device <number>\n"
429 " [--type dvddrive|hdd|fdd\n"
430 " --medium none|emptydrive|uuid|filename|host:<drive>]\n"
431 " [--passthrough on|off]\n"
432 " [--forceunmount]\n"
433 "\n");
434 }
435
436 if (u64Cmd & USAGE_STORAGECONTROLLER)
437 {
438 RTPrintf("VBoxManage storagectl <uuid|vmname>\n"
439 " --name <name>\n"
440 " [--add ide|sata|scsi|floppy|sas]\n"
441 " [--controller LSILogic|LSILogicSAS|BusLogic|IntelAHCI|\n"
442 " PIIX3|PIIX4|ICH6|I82078]\n"
443 " [--sataideemulation<1-4> <1-30>]\n"
444 " [--sataportcount <1-30>]\n"
445 " [--iobackend Buffered|Unbuffered]\n"
446 " [--remove]\n"
447 "\n");
448 }
449
450 if (u64Cmd & USAGE_SHOWHDINFO)
451 {
452 RTPrintf("VBoxManage showhdinfo <uuid>|<filename>\n"
453 "\n");
454 }
455
456 if (u64Cmd & USAGE_CREATEHD)
457 {
458 RTPrintf("VBoxManage createhd --filename <filename>\n"
459 " --size <megabytes>\n"
460 " [--format VDI|VMDK|VHD] (default: VDI)\n"
461 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
462 " [--type normal|writethrough] (default: normal)\n"
463 " [--comment <comment>]\n"
464 " [--remember]\n"
465 "\n");
466 }
467
468 if (u64Cmd & USAGE_MODIFYHD)
469 {
470 RTPrintf("VBoxManage modifyhd <uuid>|<filename>\n"
471 " [--type normal|writethrough|immutable]\n"
472 " [--autoreset on|off]\n"
473 " [--compact]\n"
474 "\n");
475 }
476
477 if (u64Cmd & USAGE_CLONEHD)
478 {
479 RTPrintf("VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
480 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
481 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
482 " [--type normal|writethrough|immutable]\n"
483 " [--remember] [--existing]\n"
484 "\n");
485 }
486
487 if (u64Cmd & USAGE_CONVERTFROMRAW)
488 {
489 RTPrintf("VBoxManage convertfromraw <filename> <outputfile>\n"
490 " [--format VDI|VMDK|VHD]\n"
491 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
492 "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
493 " [--format VDI|VMDK|VHD]\n"
494 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
495 "\n");
496 }
497
498 if (u64Cmd & USAGE_ADDISCSIDISK)
499 {
500 RTPrintf("VBoxManage addiscsidisk --server <name>|<ip>\n"
501 " --target <target>\n"
502 " [--port <port>]\n"
503 " [--lun <lun>]\n"
504 " [--encodedlun <lun>]\n"
505 " [--username <username>]\n"
506 " [--password <password>]\n"
507 " [--type normal|writethrough|immutable]\n"
508 " [--intnet]\n"
509 "\n");
510 }
511
512 if (u64Cmd & USAGE_GETEXTRADATA)
513 {
514 RTPrintf("VBoxManage getextradata global|<uuid>|<name>\n"
515 " <key>|enumerate\n"
516 "\n");
517 }
518
519 if (u64Cmd & USAGE_SETEXTRADATA)
520 {
521 RTPrintf("VBoxManage setextradata global|<uuid>|<name>\n"
522 " <key>\n"
523 " [<value>] (no value deletes key)\n"
524 "\n");
525 }
526
527 if (u64Cmd & USAGE_SETPROPERTY)
528 {
529 RTPrintf("VBoxManage setproperty hdfolder default|<folder> |\n"
530 " machinefolder default|<folder> |\n"
531 " vrdpauthlibrary default|<library> |\n"
532 " websrvauthlibrary default|null|<library> |\n"
533 " loghistorycount <value>\n"
534 "\n");
535 }
536
537 if (u64Cmd & USAGE_USBFILTER_ADD)
538 {
539 RTPrintf("VBoxManage usbfilter add <index,0-N>\n"
540 " --target <uuid>|<name>|global\n"
541 " --name <string>\n"
542 " --action ignore|hold (global filters only)\n"
543 " [--active yes|no] (yes)\n"
544 " [--vendorid <XXXX>] (null)\n"
545 " [--productid <XXXX>] (null)\n"
546 " [--revision <IIFF>] (null)\n"
547 " [--manufacturer <string>] (null)\n"
548 " [--product <string>] (null)\n"
549 " [--remote yes|no] (null, VM filters only)\n"
550 " [--serialnumber <string>] (null)\n"
551 " [--maskedinterfaces <XXXXXXXX>]\n"
552 "\n");
553 }
554
555 if (u64Cmd & USAGE_USBFILTER_MODIFY)
556 {
557 RTPrintf("VBoxManage usbfilter modify <index,0-N>\n"
558 " --target <uuid>|<name>|global\n"
559 " [--name <string>]\n"
560 " [--action ignore|hold] (global filters only)\n"
561 " [--active yes|no]\n"
562 " [--vendorid <XXXX>|\"\"]\n"
563 " [--productid <XXXX>|\"\"]\n"
564 " [--revision <IIFF>|\"\"]\n"
565 " [--manufacturer <string>|\"\"]\n"
566 " [--product <string>|\"\"]\n"
567 " [--remote yes|no] (null, VM filters only)\n"
568 " [--serialnumber <string>|\"\"]\n"
569 " [--maskedinterfaces <XXXXXXXX>]\n"
570 "\n");
571 }
572
573 if (u64Cmd & USAGE_USBFILTER_REMOVE)
574 {
575 RTPrintf("VBoxManage usbfilter remove <index,0-N>\n"
576 " --target <uuid>|<name>|global\n"
577 "\n");
578 }
579
580 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
581 {
582 RTPrintf("VBoxManage sharedfolder add <vmname>|<uuid>\n"
583 " --name <name> --hostpath <hostpath>\n"
584 " [--transient] [--readonly]\n"
585 "\n");
586 }
587
588 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
589 {
590 RTPrintf("VBoxManage sharedfolder remove <vmname>|<uuid>\n"
591 " --name <name> [--transient]\n"
592 "\n");
593 }
594
595 if (u64Cmd & USAGE_VM_STATISTICS)
596 {
597 RTPrintf("VBoxManage vmstatistics <vmname>|<uuid> [--reset]\n"
598 " [--pattern <pattern>] [--descriptions]\n"
599 "\n");
600 }
601
602#ifdef VBOX_WITH_GUEST_PROPS
603 if (u64Cmd & USAGE_GUESTPROPERTY)
604 usageGuestProperty();
605#endif /* VBOX_WITH_GUEST_PROPS defined */
606
607#ifdef VBOX_WITH_GUEST_CONTROL
608 if (u64Cmd & USAGE_GUESTCONTROL)
609 usageGuestControl();
610#endif /* VBOX_WITH_GUEST_CONTROL defined */
611
612 if (u64Cmd & USAGE_METRICS)
613 {
614 RTPrintf("VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
615 " (comma-separated)\n\n"
616 "VBoxManage metrics setup\n"
617 " [--period <seconds>] (default: 1)\n"
618 " [--samples <count>] (default: 1)\n"
619 " [--list]\n"
620 " [*|host|<vmname> [<metric_list>]]\n\n"
621 "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
622 "VBoxManage metrics enable\n"
623 " [--list]\n"
624 " [*|host|<vmname> [<metric_list>]]\n\n"
625 "VBoxManage metrics disable\n"
626 " [--list]\n"
627 " [*|host|<vmname> [<metric_list>]]\n\n"
628 "VBoxManage metrics collect\n"
629 " [--period <seconds>] (default: 1)\n"
630 " [--samples <count>] (default: 1)\n"
631 " [--list]\n"
632 " [--detach]\n"
633 " [*|host|<vmname> [<metric_list>]]\n"
634 "\n");
635 }
636#if defined(VBOX_WITH_NETFLT)
637 if (u64Cmd & USAGE_HOSTONLYIFS)
638 {
639 RTPrintf("VBoxManage hostonlyif ipconfig <name>\n"
640 " [--dhcp |\n"
641 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
642 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
643# if defined(RT_OS_WINDOWS)
644 " create |\n"
645 " remove <name>\n"
646# endif
647 "\n");
648 }
649#endif
650
651 if (u64Cmd & USAGE_DHCPSERVER)
652 {
653 RTPrintf("VBoxManage dhcpserver add|modify --netname <network_name> |\n"
654#if defined(VBOX_WITH_NETFLT)
655 " --ifname <hostonly_if_name>\n"
656#endif
657 " [--ip <ip_address>\n"
658 " --netmask <network_mask>\n"
659 " --lowerip <lower_ip>\n"
660 " --upperip <upper_ip>]\n"
661 " [--enable | --disable]\n\n"
662 "VBoxManage dhcpserver remove --netname <network_name> |\n"
663#if defined(VBOX_WITH_NETFLT)
664 " --ifname <hostonly_if_name>\n"
665#endif
666 "\n");
667 }
668}
669
670/**
671 * Print a usage synopsis and the syntax error message.
672 */
673int errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
674{
675 va_list args;
676 showLogo(); // show logo even if suppressed
677#ifndef VBOX_ONLY_DOCS
678 if (g_fInternalMode)
679 printUsageInternal(u64Cmd);
680 else
681 printUsage(u64Cmd);
682#endif /* !VBOX_ONLY_DOCS */
683 va_start(args, pszFormat);
684 RTPrintf("\n"
685 "Syntax error: %N\n", pszFormat, &args);
686 va_end(args);
687 return 1;
688}
689
690/**
691 * errorSyntax for RTGetOpt users.
692 *
693 * @returns 1.
694 *
695 * @param fUsageCategory The usage category of the command.
696 * @param rc The RTGetOpt return code.
697 * @param pValueUnion The value union.
698 */
699int errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
700{
701 showLogo(); // show logo even if suppressed
702#ifndef VBOX_ONLY_DOCS
703 if (g_fInternalMode)
704 printUsageInternal(fUsageCategory);
705 else
706 printUsage(fUsageCategory);
707#endif /* !VBOX_ONLY_DOCS */
708
709 if (rc == VINF_GETOPT_NOT_OPTION)
710 return RTPrintf("error: Invalid parameter '%s'\n", pValueUnion->psz);
711 if (rc > 0)
712 {
713 if (RT_C_IS_PRINT(rc))
714 return RTPrintf("error: Invalid option -%c\n", rc);
715 return RTPrintf("error: Invalid option case %i\n", rc);
716 }
717 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
718 return RTPrintf("error: unknown option: %s\n", pValueUnion->psz);
719 if (pValueUnion->pDef)
720 return RTPrintf("error: %s: %Rrs\n", pValueUnion->pDef->pszLong, rc);
721 return RTPrintf("error: %Rrs\n", rc);
722}
723
724/**
725 * Print an error message without the syntax stuff.
726 */
727int errorArgument(const char *pszFormat, ...)
728{
729 va_list args;
730 va_start(args, pszFormat);
731 RTPrintf("error: %N\n", pszFormat, &args);
732 va_end(args);
733 return 1;
734}
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