VirtualBox

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

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

Guest Control: Update (VBoxManage, Main, Host Service, VbglR3), not enabled by default.

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