VirtualBox

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

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

Implemented VBoxManage controlvm vrdpvideochannelquality

  • 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 29364 2010-05-11 15:13:50Z 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 " vrdpvideochannelquality <percent>\n");
375 }
376 RTPrintf(" setvideomodehint <xres> <yres> <bpp> [display] |\n"
377 " setcredentials <username> <password> <domain>\n"
378 " [--allowlocallogon <yes|no>] |\n"
379 " teleport --host <name> --port <port>\n"
380 " [--maxdowntime <msec>] [--password password]\n"
381 "\n");
382 }
383
384 if (u64Cmd & USAGE_DISCARDSTATE)
385 {
386 RTPrintf("VBoxManage discardstate <uuid>|<name>\n"
387 "\n");
388 }
389
390 if (u64Cmd & USAGE_ADOPTSTATE)
391 {
392 RTPrintf("VBoxManage adoptstate <uuid>|<name> <state_file>\n"
393 "\n");
394 }
395
396 if (u64Cmd & USAGE_SNAPSHOT)
397 {
398 RTPrintf("VBoxManage snapshot <uuid>|<name>\n"
399 " take <name> [--description <desc>] [--pause] |\n"
400 " delete <uuid>|<name> |\n"
401 " restore <uuid>|<name> |\n"
402 " restorecurrent |\n"
403 " edit <uuid>|<name>|--current\n"
404 " [--name <name>]\n"
405 " [--description <desc>] |\n"
406 " showvminfo <uuid>|<name>\n"
407 "\n");
408 }
409
410 if (u64Cmd & USAGE_OPENMEDIUM)
411 {
412 RTPrintf("VBoxManage openmedium disk|dvd|floppy <filename>\n"
413 " [--type normal|immutable|writethrough] (disk only)\n"
414 " [--uuid <uuid>]\n"
415 " [--parentuuid <uuid>] (disk only)\n"
416 "\n");
417 }
418
419 if (u64Cmd & USAGE_CLOSEMEDIUM)
420 {
421 RTPrintf("VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
422 " [--delete]\n"
423 "\n");
424 }
425
426 if (u64Cmd & USAGE_STORAGEATTACH)
427 {
428 RTPrintf("VBoxManage storageattach <uuid|vmname>\n"
429 " --storagectl <name>\n"
430 " --port <number>\n"
431 " --device <number>\n"
432 " [--type dvddrive|hdd|fdd\n"
433 " --medium none|emptydrive|uuid|filename|host:<drive>]\n"
434 " [--passthrough on|off]\n"
435 " [--forceunmount]\n"
436 "\n");
437 }
438
439 if (u64Cmd & USAGE_STORAGECONTROLLER)
440 {
441 RTPrintf("VBoxManage storagectl <uuid|vmname>\n"
442 " --name <name>\n"
443 " [--add ide|sata|scsi|floppy|sas]\n"
444 " [--controller LSILogic|LSILogicSAS|BusLogic|IntelAHCI|\n"
445 " PIIX3|PIIX4|ICH6|I82078]\n"
446 " [--sataideemulation<1-4> <1-30>]\n"
447 " [--sataportcount <1-30>]\n"
448 " [--iobackend Buffered|Unbuffered]\n"
449 " [--remove]\n"
450 "\n");
451 }
452
453 if (u64Cmd & USAGE_SHOWHDINFO)
454 {
455 RTPrintf("VBoxManage showhdinfo <uuid>|<filename>\n"
456 "\n");
457 }
458
459 if (u64Cmd & USAGE_CREATEHD)
460 {
461 RTPrintf("VBoxManage createhd --filename <filename>\n"
462 " --size <megabytes>\n"
463 " [--format VDI|VMDK|VHD] (default: VDI)\n"
464 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
465 " [--type normal|writethrough] (default: normal)\n"
466 " [--comment <comment>]\n"
467 " [--remember]\n"
468 "\n");
469 }
470
471 if (u64Cmd & USAGE_MODIFYHD)
472 {
473 RTPrintf("VBoxManage modifyhd <uuid>|<filename>\n"
474 " [--type normal|writethrough|immutable]\n"
475 " [--autoreset on|off]\n"
476 " [--compact]\n"
477 "\n");
478 }
479
480 if (u64Cmd & USAGE_CLONEHD)
481 {
482 RTPrintf("VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
483 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
484 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
485 " [--type normal|writethrough|immutable]\n"
486 " [--remember] [--existing]\n"
487 "\n");
488 }
489
490 if (u64Cmd & USAGE_CONVERTFROMRAW)
491 {
492 RTPrintf("VBoxManage convertfromraw <filename> <outputfile>\n"
493 " [--format VDI|VMDK|VHD]\n"
494 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
495 "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
496 " [--format VDI|VMDK|VHD]\n"
497 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
498 "\n");
499 }
500
501 if (u64Cmd & USAGE_ADDISCSIDISK)
502 {
503 RTPrintf("VBoxManage addiscsidisk --server <name>|<ip>\n"
504 " --target <target>\n"
505 " [--port <port>]\n"
506 " [--lun <lun>]\n"
507 " [--encodedlun <lun>]\n"
508 " [--username <username>]\n"
509 " [--password <password>]\n"
510 " [--type normal|writethrough|immutable]\n"
511 " [--intnet]\n"
512 "\n");
513 }
514
515 if (u64Cmd & USAGE_GETEXTRADATA)
516 {
517 RTPrintf("VBoxManage getextradata global|<uuid>|<name>\n"
518 " <key>|enumerate\n"
519 "\n");
520 }
521
522 if (u64Cmd & USAGE_SETEXTRADATA)
523 {
524 RTPrintf("VBoxManage setextradata global|<uuid>|<name>\n"
525 " <key>\n"
526 " [<value>] (no value deletes key)\n"
527 "\n");
528 }
529
530 if (u64Cmd & USAGE_SETPROPERTY)
531 {
532 RTPrintf("VBoxManage setproperty hdfolder default|<folder> |\n"
533 " machinefolder default|<folder> |\n"
534 " vrdpauthlibrary default|<library> |\n"
535 " websrvauthlibrary default|null|<library> |\n"
536 " loghistorycount <value>\n"
537 "\n");
538 }
539
540 if (u64Cmd & USAGE_USBFILTER_ADD)
541 {
542 RTPrintf("VBoxManage usbfilter add <index,0-N>\n"
543 " --target <uuid>|<name>|global\n"
544 " --name <string>\n"
545 " --action ignore|hold (global filters only)\n"
546 " [--active yes|no] (yes)\n"
547 " [--vendorid <XXXX>] (null)\n"
548 " [--productid <XXXX>] (null)\n"
549 " [--revision <IIFF>] (null)\n"
550 " [--manufacturer <string>] (null)\n"
551 " [--product <string>] (null)\n"
552 " [--remote yes|no] (null, VM filters only)\n"
553 " [--serialnumber <string>] (null)\n"
554 " [--maskedinterfaces <XXXXXXXX>]\n"
555 "\n");
556 }
557
558 if (u64Cmd & USAGE_USBFILTER_MODIFY)
559 {
560 RTPrintf("VBoxManage usbfilter modify <index,0-N>\n"
561 " --target <uuid>|<name>|global\n"
562 " [--name <string>]\n"
563 " [--action ignore|hold] (global filters only)\n"
564 " [--active yes|no]\n"
565 " [--vendorid <XXXX>|\"\"]\n"
566 " [--productid <XXXX>|\"\"]\n"
567 " [--revision <IIFF>|\"\"]\n"
568 " [--manufacturer <string>|\"\"]\n"
569 " [--product <string>|\"\"]\n"
570 " [--remote yes|no] (null, VM filters only)\n"
571 " [--serialnumber <string>|\"\"]\n"
572 " [--maskedinterfaces <XXXXXXXX>]\n"
573 "\n");
574 }
575
576 if (u64Cmd & USAGE_USBFILTER_REMOVE)
577 {
578 RTPrintf("VBoxManage usbfilter remove <index,0-N>\n"
579 " --target <uuid>|<name>|global\n"
580 "\n");
581 }
582
583 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
584 {
585 RTPrintf("VBoxManage sharedfolder add <vmname>|<uuid>\n"
586 " --name <name> --hostpath <hostpath>\n"
587 " [--transient] [--readonly]\n"
588 "\n");
589 }
590
591 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
592 {
593 RTPrintf("VBoxManage sharedfolder remove <vmname>|<uuid>\n"
594 " --name <name> [--transient]\n"
595 "\n");
596 }
597
598 if (u64Cmd & USAGE_VM_STATISTICS)
599 {
600 RTPrintf("VBoxManage vmstatistics <vmname>|<uuid> [--reset]\n"
601 " [--pattern <pattern>] [--descriptions]\n"
602 "\n");
603 }
604
605#ifdef VBOX_WITH_GUEST_PROPS
606 if (u64Cmd & USAGE_GUESTPROPERTY)
607 usageGuestProperty();
608#endif /* VBOX_WITH_GUEST_PROPS defined */
609
610#ifdef VBOX_WITH_GUEST_CONTROL
611 if (u64Cmd & USAGE_GUESTCONTROL)
612 usageGuestControl();
613#endif /* VBOX_WITH_GUEST_CONTROL defined */
614
615 if (u64Cmd & USAGE_METRICS)
616 {
617 RTPrintf("VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
618 " (comma-separated)\n\n"
619 "VBoxManage metrics setup\n"
620 " [--period <seconds>] (default: 1)\n"
621 " [--samples <count>] (default: 1)\n"
622 " [--list]\n"
623 " [*|host|<vmname> [<metric_list>]]\n\n"
624 "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
625 "VBoxManage metrics enable\n"
626 " [--list]\n"
627 " [*|host|<vmname> [<metric_list>]]\n\n"
628 "VBoxManage metrics disable\n"
629 " [--list]\n"
630 " [*|host|<vmname> [<metric_list>]]\n\n"
631 "VBoxManage metrics collect\n"
632 " [--period <seconds>] (default: 1)\n"
633 " [--samples <count>] (default: 1)\n"
634 " [--list]\n"
635 " [--detach]\n"
636 " [*|host|<vmname> [<metric_list>]]\n"
637 "\n");
638 }
639#if defined(VBOX_WITH_NETFLT)
640 if (u64Cmd & USAGE_HOSTONLYIFS)
641 {
642 RTPrintf("VBoxManage hostonlyif ipconfig <name>\n"
643 " [--dhcp |\n"
644 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
645 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
646# if defined(RT_OS_WINDOWS)
647 " create |\n"
648 " remove <name>\n"
649# endif
650 "\n");
651 }
652#endif
653
654 if (u64Cmd & USAGE_DHCPSERVER)
655 {
656 RTPrintf("VBoxManage dhcpserver add|modify --netname <network_name> |\n"
657#if defined(VBOX_WITH_NETFLT)
658 " --ifname <hostonly_if_name>\n"
659#endif
660 " [--ip <ip_address>\n"
661 " --netmask <network_mask>\n"
662 " --lowerip <lower_ip>\n"
663 " --upperip <upper_ip>]\n"
664 " [--enable | --disable]\n\n"
665 "VBoxManage dhcpserver remove --netname <network_name> |\n"
666#if defined(VBOX_WITH_NETFLT)
667 " --ifname <hostonly_if_name>\n"
668#endif
669 "\n");
670 }
671}
672
673/**
674 * Print a usage synopsis and the syntax error message.
675 */
676int errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
677{
678 va_list args;
679 showLogo(); // show logo even if suppressed
680#ifndef VBOX_ONLY_DOCS
681 if (g_fInternalMode)
682 printUsageInternal(u64Cmd);
683 else
684 printUsage(u64Cmd);
685#endif /* !VBOX_ONLY_DOCS */
686 va_start(args, pszFormat);
687 RTPrintf("\n"
688 "Syntax error: %N\n", pszFormat, &args);
689 va_end(args);
690 return 1;
691}
692
693/**
694 * errorSyntax for RTGetOpt users.
695 *
696 * @returns 1.
697 *
698 * @param fUsageCategory The usage category of the command.
699 * @param rc The RTGetOpt return code.
700 * @param pValueUnion The value union.
701 */
702int errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
703{
704 showLogo(); // show logo even if suppressed
705#ifndef VBOX_ONLY_DOCS
706 if (g_fInternalMode)
707 printUsageInternal(fUsageCategory);
708 else
709 printUsage(fUsageCategory);
710#endif /* !VBOX_ONLY_DOCS */
711
712 if (rc == VINF_GETOPT_NOT_OPTION)
713 return RTPrintf("error: Invalid parameter '%s'\n", pValueUnion->psz);
714 if (rc > 0)
715 {
716 if (RT_C_IS_PRINT(rc))
717 return RTPrintf("error: Invalid option -%c\n", rc);
718 return RTPrintf("error: Invalid option case %i\n", rc);
719 }
720 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
721 return RTPrintf("error: unknown option: %s\n", pValueUnion->psz);
722 if (pValueUnion->pDef)
723 return RTPrintf("error: %s: %Rrs\n", pValueUnion->pDef->pszLong, rc);
724 return RTPrintf("error: %Rrs\n", rc);
725}
726
727/**
728 * Print an error message without the syntax stuff.
729 */
730int errorArgument(const char *pszFormat, ...)
731{
732 va_list args;
733 va_start(args, pszFormat);
734 RTPrintf("error: %N\n", pszFormat, &args);
735 va_end(args);
736 return 1;
737}
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