VirtualBox

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

Last change on this file since 33595 was 33590, checked in by vboxsync, 14 years ago

VRDE: removed VBOX_WITH_VRDP from source code, also some obsolete code removed.

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