VBoxManageHelp.cpp revision 01b2e367e947049139a5d5813ccc1fa162b11f76
3853N/A/* $Id$ */
3853N/A/** @file
3853N/A * VBoxManage - help and other message output.
3853N/A */
3853N/A
3853N/A/*
3853N/A * Copyright (C) 2006-2012 Oracle Corporation
3853N/A *
3853N/A * This file is part of VirtualBox Open Source Edition (OSE), as
3853N/A * available from http://www.virtualbox.org. This file is free software;
3853N/A * you can redistribute it and/or modify it under the terms of the GNU
3853N/A * General Public License (GPL) as published by the Free Software
3853N/A * Foundation, in version 2 as it comes in the "COPYING" file of the
3853N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3853N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3853N/A */
3853N/A
3853N/A
3853N/A/*******************************************************************************
3853N/A* Header Files *
3853N/A*******************************************************************************/
3853N/A#include <VBox/version.h>
3853N/A
3853N/A#include <iprt/buildconfig.h>
5035N/A#include <iprt/ctype.h>
3853N/A#include <iprt/err.h>
3853N/A#include <iprt/getopt.h>
3853N/A#include <iprt/stream.h>
3853N/A
3853N/A#include "VBoxManage.h"
4803N/A
3853N/A
3853N/A
3853N/Avoid showLogo(PRTSTREAM pStrm)
4141N/A{
3853N/A static bool s_fShown; /* show only once */
3853N/A
3853N/A if (!s_fShown)
3853N/A {
3853N/A RTStrmPrintf(pStrm, VBOX_PRODUCT " Command Line Management Interface Version "
4141N/A VBOX_VERSION_STRING "\n"
3898N/A "(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
3898N/A "All rights reserved.\n"
4920N/A "\n");
4518N/A s_fShown = true;
3853N/A }
3853N/A}
3853N/A
3853N/Avoid printUsage(USAGECATEGORY u64Cmd, PRTSTREAM pStrm)
4803N/A{
3853N/A bool fDumpOpts = false;
3853N/A#ifdef RT_OS_LINUX
3853N/A bool fLinux = true;
3853N/A#else
3853N/A bool fLinux = false;
3853N/A#endif
3853N/A#ifdef RT_OS_WINDOWS
3853N/A bool fWin = true;
3853N/A#else
3853N/A bool fWin = false;
3853N/A#endif
3853N/A#ifdef RT_OS_SOLARIS
3853N/A bool fSolaris = true;
3853N/A#else
3853N/A bool fSolaris = false;
4803N/A#endif
4803N/A#ifdef RT_OS_FREEBSD
3853N/A bool fFreeBSD = true;
3853N/A#else
3853N/A bool fFreeBSD = false;
3853N/A#endif
3853N/A#ifdef RT_OS_DARWIN
3853N/A bool fDarwin = true;
3853N/A#else
3853N/A bool fDarwin = false;
4141N/A#endif
4141N/A#ifdef VBOX_WITH_VBOXSDL
4141N/A bool fVBoxSDL = true;
4141N/A#else
4141N/A bool fVBoxSDL = false;
4141N/A#endif
4141N/A
4141N/A if (u64Cmd == USAGE_DUMPOPTS)
4141N/A {
4141N/A fDumpOpts = true;
4518N/A fLinux = true;
4518N/A fWin = true;
4141N/A fSolaris = true;
4141N/A fFreeBSD = true;
3853N/A fDarwin = true;
3853N/A fVBoxSDL = true;
4920N/A u64Cmd = USAGE_ALL;
3853N/A }
4500N/A
4500N/A RTStrmPrintf(pStrm,
4500N/A "Usage:\n"
4500N/A "\n");
3853N/A
3853N/A if (u64Cmd == USAGE_ALL)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage [-v|--version] print version number and exit\n"
3853N/A "VBoxManage [-q|--nologo] ... suppress the logo\n"
3853N/A "VBoxManage [--settingspw <pw>] ...\n"
3853N/A "VBoxManage [--settingspwfile] ... provide the settings password\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_LIST)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
3853N/A#if defined(VBOX_WITH_NETFLT)
3853N/A " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"
3853N/A#else
3853N/A " bridgedifs|dhcpservers|hostinfo|\n"
3853N/A#endif
3853N/A " hostcpuids|hddbackends|hdds|dvds|floppies|\n"
3853N/A " usbhost|usbfilters|systemproperties|extpacks\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_SHOWVMINFO)
3853N/A RTStrmPrintf(pStrm,
4500N/A "VBoxManage showvminfo <uuid>|<name> [--details]\n"
4500N/A " [--machinereadable]\n"
4500N/A "VBoxManage showvminfo <uuid>|<name> --log <idx>\n"
4500N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_REGISTERVM)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage registervm <filename>\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_UNREGISTERVM)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage unregistervm <uuid>|<name> [--delete]\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_CREATEVM)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage createvm --name <name>\n"
3853N/A " [--ostype <ostype>]\n"
3853N/A " [--register]\n"
3853N/A " [--basefolder <path>]\n"
3853N/A " [--uuid <uuid>]\n"
3858N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_MODIFYVM)
3853N/A {
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage modifyvm <uuid|name>\n"
3853N/A " [--name <name>]\n"
3853N/A " [--ostype <ostype>]\n"
3853N/A " [--memory <memorysize in MB>]\n"
3858N/A " [--pagefusion on|off]\n"
3853N/A " [--vram <vramsize in MB>]\n"
3853N/A " [--acpi on|off]\n"
3853N/A#ifdef VBOX_WITH_PCI_PASSTHROUGH
3853N/A " [--pciattach 03:04.0]\n"
3853N/A " [--pciattach 03:04.0@02:01.0]\n"
3853N/A " [--pcidetach 03:04.0]\n"
3853N/A#endif
3853N/A " [--ioapic on|off]\n"
3853N/A " [--pae on|off]\n"
3853N/A " [--hpet on|off]\n"
3853N/A " [--hwvirtex on|off]\n"
3853N/A " [--hwvirtexexcl on|off]\n"
3853N/A " [--nestedpaging on|off]\n"
3853N/A " [--largepages on|off]\n"
3853N/A " [--vtxvpid on|off]\n"
3853N/A " [--synthcpu on|off]\n"
3853N/A " [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
3853N/A " [--cpuidremove <leaf>]\n"
3853N/A " [--cpuidremoveall]\n"
3853N/A " [--hardwareuuid <uuid>]\n"
3853N/A " [--cpus <number>]\n"
3853N/A " [--cpuhotplug on|off]\n"
3853N/A " [--plugcpu <id>]\n"
4060N/A " [--unplugcpu <id>]\n"
4060N/A " [--cpuexecutioncap <1-100>]\n"
4060N/A " [--rtcuseutc on|off]\n"
4060N/A " [--monitorcount <number>]\n"
4060N/A " [--accelerate3d on|off]\n"
4803N/A#ifdef VBOX_WITH_VIDEOHWACCEL
4060N/A " [--accelerate2dvideo on|off]\n"
4060N/A#endif
4060N/A " [--firmware bios|efi|efi32|efi64]\n"
4060N/A " [--chipset ich9|piix3]\n"
4060N/A " [--bioslogofadein on|off]\n"
4060N/A " [--bioslogofadeout on|off]\n"
4060N/A " [--bioslogodisplaytime <msec>]\n"
4060N/A " [--bioslogoimagepath <imagepath>]\n"
4060N/A " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
4060N/A " [--biossystemtimeoffset <msec>]\n"
4803N/A " [--biospxedebug on|off]\n"
4060N/A " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
4060N/A " [--nic<1-N> none|null|nat|bridged|intnet"
4060N/A#if defined(VBOX_WITH_NETFLT)
4060N/A "|hostonly"
4060N/A#endif
3853N/A "|\n"
3853N/A " generic"
3853N/A "]\n"
4803N/A " [--nictype<1-N> Am79C970A|Am79C973"
3853N/A#ifdef VBOX_WITH_E1000
3853N/A "|\n 82540EM|82543GC|82545EM"
3853N/A#endif
3853N/A#ifdef VBOX_WITH_VIRTIO
3853N/A "|\n virtio"
3853N/A#endif /* VBOX_WITH_VIRTIO */
3853N/A "]\n"
3853N/A " [--cableconnected<1-N> on|off]\n"
4803N/A " [--nictrace<1-N> on|off]\n"
3853N/A " [--nictracefile<1-N> <filename>]\n"
3853N/A " [--nicproperty<1-N> name=[value]]\n"
3853N/A " [--nicspeed<1-N> <kbps>]\n"
3853N/A " [--nicbootprio<1-N> <priority>]\n"
3853N/A " [--nicpromisc<1-N> deny|allow-vms|allow-all]\n"
4803N/A " [--nicbandwidthgroup<1-N> none|<name>]\n"
4803N/A " [--bridgeadapter<1-N> none|<devicename>]\n"
4803N/A#if defined(VBOX_WITH_NETFLT)
4803N/A " [--hostonlyadapter<1-N> none|<devicename>]\n"
4803N/A#endif
4803N/A " [--intnet<1-N> <network name>]\n"
4803N/A " [--natnet<1-N> <network>|default]\n"
4803N/A " [--nicgenericdrv<1-N> <driver>\n"
4803N/A " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
4803N/A " [<sockrcv>],[<tcpsnd>],\n"
4803N/A " [<tcprcv>]]\n"
4803N/A " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
4803N/A " <hostport>,[<guestip>],<guestport>]\n"
4803N/A " [--natpf<1-N> delete <rulename>]\n"
4803N/A " [--nattftpprefix<1-N> <prefix>]\n"
4803N/A " [--nattftpfile<1-N> <file>]\n"
4803N/A " [--nattftpserver<1-N> <ip>]\n"
4803N/A " [--natbindip<1-N> <ip>\n"
4803N/A " [--natdnspassdomain<1-N> on|off]\n"
4803N/A " [--natdnsproxy<1-N> on|off]\n"
4803N/A " [--natdnshostresolver<1-N> on|off]\n"
4803N/A " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
4803N/A " [sameports]]\n"
4803N/A " [--macaddress<1-N> auto|<mac>]\n"
4803N/A " [--mouse ps2|usb|usbtablet\n"
4803N/A " [--keyboard ps2|usb\n"
4803N/A " [--uart<1-N> off|<I/O base> <IRQ>]\n"
4803N/A " [--uartmode<1-N> disconnected|\n"
4803N/A " server <pipe>|\n"
4803N/A " client <pipe>|\n"
4803N/A " file <file>|\n"
4803N/A " <devicename>]\n"
4803N/A#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
4803N/A " [--lpt<1-N> off|<I/O base> <IRQ>]\n"
4803N/A " [--lptmode<1-N> <devicename>]\n"
4803N/A#endif
4803N/A " [--guestmemoryballoon <balloonsize in MB>]\n"
3853N/A " [--gueststatisticsinterval <seconds>]\n"
3853N/A " [--audio none|null");
3853N/A if (fWin)
3853N/A {
3853N/A#ifdef VBOX_WITH_WINMM
3853N/A RTStrmPrintf(pStrm, "|winmm|dsound");
3853N/A#else
3853N/A RTStrmPrintf(pStrm, "|dsound");
3853N/A#endif
3853N/A }
3853N/A if (fSolaris)
3853N/A {
3853N/A RTStrmPrintf(pStrm, "|solaudio"
3853N/A#ifdef VBOX_WITH_SOLARIS_OSS
3853N/A "|oss"
3853N/A#endif
3853N/A );
3853N/A }
3853N/A if (fLinux)
3853N/A {
3853N/A RTStrmPrintf(pStrm, "|oss"
3853N/A#ifdef VBOX_WITH_ALSA
3853N/A "|alsa"
3853N/A#endif
3853N/A#ifdef VBOX_WITH_PULSE
3853N/A "|pulse"
3853N/A#endif
3853N/A );
3853N/A }
3853N/A if (fFreeBSD)
3853N/A {
3853N/A /* Get the line break sorted when dumping all option variants. */
3853N/A if (fDumpOpts)
3853N/A {
3853N/A RTStrmPrintf(pStrm, "|\n"
3853N/A " oss");
3853N/A }
3853N/A else
3853N/A RTStrmPrintf(pStrm, "|oss");
3853N/A#ifdef VBOX_WITH_PULSE
3853N/A RTStrmPrintf(pStrm, "|pulse");
3853N/A#endif
3853N/A }
3853N/A if (fDarwin)
3853N/A {
3853N/A RTStrmPrintf(pStrm, "|coreaudio");
3853N/A }
3853N/A RTStrmPrintf(pStrm, "]\n");
3853N/A RTStrmPrintf(pStrm,
3853N/A " [--audiocontroller ac97|hda|sb16]\n"
3853N/A " [--clipboard disabled|hosttoguest|guesttohost|\n"
3853N/A " bidirectional]\n");
3853N/A RTStrmPrintf(pStrm,
3853N/A " [--vrde on|off]\n"
3853N/A " [--vrdeextpack default|<name>\n"
3853N/A " [--vrdeproperty <name=[value]>]\n"
3853N/A " [--vrdeport <hostport>]\n"
3853N/A " [--vrdeaddress <hostip>]\n"
3853N/A " [--vrdeauthtype null|external|guest]\n"
3853N/A " [--vrdeauthlibrary default|<name>\n"
3853N/A " [--vrdemulticon on|off]\n"
3853N/A " [--vrdereusecon on|off]\n"
3853N/A " [--vrdevideochannel on|off]\n"
3853N/A " [--vrdevideochannelquality <percent>]\n");
3853N/A RTStrmPrintf(pStrm,
3853N/A " [--usb on|off]\n"
3853N/A " [--usbehci on|off]\n"
3853N/A " [--snapshotfolder default|<path>]\n"
3853N/A " [--teleporter on|off]\n"
3853N/A " [--teleporterport <port>]\n"
3853N/A " [--teleporteraddress <address|empty>\n"
3853N/A " [--teleporterpassword <password>]\n"
4518N/A " [--teleporterpasswordfile <file>|stdin]\n"
4518N/A " [--tracing-enabled on|off]\n"
4518N/A " [--tracing-config <config-string>]\n"
4518N/A " [--tracing-allow-vm-access on|off]\n"
4518N/A#if 0
4518N/A " [--iocache on|off]\n"
4518N/A " [--iocachesize <I/O cache size in MB>]\n"
4518N/A#endif
4518N/A#if 0
4518N/A " [--faulttolerance master|standby]\n"
4518N/A " [--faulttoleranceaddress <name>]\n"
4518N/A " [--faulttoleranceport <port>]\n"
4518N/A " [--faulttolerancesyncinterval <msec>]\n"
4518N/A " [--faulttolerancepassword <password>]\n"
4518N/A#endif
4518N/A#ifdef VBOX_WITH_USB_CARDREADER
4518N/A " [--usbcardreader on|off]\n"
4518N/A#endif
3853N/A " [--autostart-enabled on|off]\n"
3853N/A " [--autostart-delay <seconds>]\n"
3853N/A " [--autostop-type disabled|savestate|poweroff|acpishutdown]\n"
3853N/A "\n");
3853N/A }
3853N/A
3853N/A if (u64Cmd & USAGE_CLONEVM)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage clonevm <uuid>|<name>\n"
3853N/A " [--snapshot <uuid>|<name>]\n"
3853N/A " [--mode machine|machineandchildren|all]\n"
3853N/A " [--options link|keepallmacs|keepnatmacs|\n"
3853N/A " keepdisknames]\n"
3853N/A " [--name <name>]\n"
4500N/A " [--basefolder <basefolder>]\n"
4500N/A " [--uuid <uuid>]\n"
4500N/A " [--register]\n"
4500N/A "\n");
4500N/A
3853N/A if (u64Cmd & USAGE_IMPORTAPPLIANCE)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage import <ovf/ova>\n"
3853N/A " [--dry-run|-n]\n"
3853N/A " [--options keepallmacs|keepnatmacs]\n"
3853N/A " [more options]\n"
3853N/A " (run with -n to have options displayed\n"
3853N/A " for a particular OVF)\n\n");
3853N/A
3853N/A if (u64Cmd & USAGE_EXPORTAPPLIANCE)
4500N/A RTStrmPrintf(pStrm,
4500N/A "VBoxManage export <machines> --output|-o <ovf/ova>\n"
4500N/A " [--legacy09|--ovf09|--ovf10|--ovf20]\n"
4500N/A " [--manifest]\n"
4500N/A " [--vsys <number of virtual system>]\n"
4500N/A " [--product <product name>]\n"
4500N/A " [--producturl <product url>]\n"
4500N/A " [--vendor <vendor name>]\n"
3853N/A " [--vendorurl <vendor url>]\n"
3853N/A " [--version <version info>]\n"
3853N/A " [--eula <license text>]\n"
3853N/A " [--eulafile <filename>]\n"
4500N/A "\n");
4500N/A
4500N/A if (u64Cmd & USAGE_STARTVM)
4500N/A {
4500N/A RTStrmPrintf(pStrm,
4500N/A "VBoxManage startvm <uuid>|<name>...\n");
4500N/A RTStrmPrintf(pStrm,
4500N/A " [--type gui");
4060N/A if (fVBoxSDL)
4060N/A RTStrmPrintf(pStrm, "|sdl");
4060N/A RTStrmPrintf(pStrm, "|headless]\n");
4060N/A RTStrmPrintf(pStrm,
3853N/A "\n");
3853N/A }
3853N/A
3853N/A if (u64Cmd & USAGE_CONTROLVM)
3853N/A {
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage controlvm <uuid>|<name>\n"
3853N/A " pause|resume|reset|poweroff|savestate|\n"
3853N/A " acpipowerbutton|acpisleepbutton|\n"
3853N/A " keyboardputscancode <hex> [<hex> ...]|\n"
3853N/A " setlinkstate<1-N> on|off |\n"
3853N/A#if defined(VBOX_WITH_NETFLT)
4500N/A " nic<1-N> null|nat|bridged|intnet|hostonly|generic"
4500N/A "\n"
4500N/A " [<devicename>] |\n"
4500N/A#else /* !VBOX_WITH_NETFLT */
4500N/A " nic<1-N> null|nat|bridged|intnet|generic\n"
4500N/A " [<devicename>] |\n"
4500N/A#endif /* !VBOX_WITH_NETFLT */
4500N/A " nictrace<1-N> on|off\n"
3853N/A " nictracefile<1-N> <filename>\n"
3853N/A " nicproperty<1-N> name=[value]\n"
3853N/A " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
3853N/A " <hostport>,[<guestip>],<guestport>\n"
3853N/A " natpf<1-N> delete <rulename>\n"
3853N/A " guestmemoryballoon <balloonsize in MB>]\n"
3853N/A " gueststatisticsinterval <seconds>]\n"
3853N/A " usbattach <uuid>|<address> |\n"
3853N/A " usbdetach <uuid>|<address> |\n"
3853N/A " clipboard disabled|hosttoguest|guesttohost|\n"
3853N/A " bidirectional]\n"
3853N/A " vrde on|off |\n"
3853N/A " vrdeport <port> |\n"
3853N/A " vrdeproperty <name=[value]> |\n"
3853N/A " vrdevideochannelquality <percent>\n"
3853N/A " setvideomodehint <xres> <yres> <bpp> [display] |\n"
3853N/A " screenshotpng <file> [display] |\n"
3853N/A " setcredentials <username> <password> <domain>\n"
3853N/A " [--allowlocallogon <yes|no>] |\n"
3853N/A " teleport --host <name> --port <port>\n"
3853N/A " [--maxdowntime <msec>] [--password password]\n"
3853N/A " plugcpu <id>\n"
3853N/A " unplugcpu <id>\n"
3853N/A " cpuexecutioncap <1-100>\n"
3853N/A "\n");
3853N/A }
3853N/A
3853N/A if (u64Cmd & USAGE_DISCARDSTATE)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage discardstate <uuid>|<name>\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_ADOPTSTATE)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage adoptstate <uuid>|<name> <state_file>\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_SNAPSHOT)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage snapshot <uuid>|<name>\n"
3853N/A " take <name> [--description <desc>] [--pause] |\n"
3853N/A " delete <uuid>|<name> |\n"
3853N/A " restore <uuid>|<name> |\n"
3898N/A " restorecurrent |\n"
3898N/A " edit <uuid>|<name>|--current\n"
3898N/A " [--name <name>]\n"
3898N/A " [--description <desc>] |\n"
3898N/A " list [--details|--machinereadable]\n"
3898N/A " showvminfo <uuid>|<name>\n"
4518N/A "\n");
4518N/A
4518N/A if (u64Cmd & USAGE_CLOSEMEDIUM)
4518N/A RTStrmPrintf(pStrm,
4518N/A "VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
3853N/A " [--delete]\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_STORAGEATTACH)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage storageattach <uuid|vmname>\n"
3853N/A " --storagectl <name>\n"
3853N/A " [--port <number>]\n"
3853N/A " [--device <number>]\n"
3853N/A " [--type dvddrive|hdd|fdd]\n"
3853N/A " [--medium none|emptydrive|\n"
3853N/A " <uuid>|<filename>|host:<drive>|iscsi]\n"
3853N/A " [--mtype normal|writethrough|immutable|shareable|\n"
3853N/A " readonly|multiattach]\n"
3853N/A " [--comment <text>]\n"
3853N/A " [--setuuid <uuid>]\n"
3853N/A " [--setparentuuid <uuid>]\n"
3853N/A " [--passthrough on|off]\n"
3853N/A " [--tempeject on|off]\n"
3853N/A " [--nonrotational on|off]\n"
3853N/A " [--discard on|off]\n"
3853N/A " [--bandwidthgroup <name>]\n"
3853N/A " [--forceunmount]\n"
3853N/A " [--server <name>|<ip>]\n"
3853N/A " [--target <target>]\n"
3853N/A " [--tport <port>]\n"
3853N/A " [--lun <lun>]\n"
3853N/A " [--encodedlun <lun>]\n"
3853N/A " [--username <username>]\n"
3853N/A " [--password <password>]\n"
3853N/A " [--intnet]\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_STORAGECONTROLLER)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage storagectl <uuid|vmname>\n"
3853N/A " --name <name>\n"
3853N/A " [--add ide|sata|scsi|floppy|sas]\n"
3853N/A " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
3853N/A " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
3853N/A " [--sataideemulation<1-4> <1-30>]\n"
3853N/A " [--sataportcount <1-30>]\n"
3853N/A " [--hostiocache on|off]\n"
3853N/A " [--bootable on|off]\n"
3853N/A " [--remove]\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_BANDWIDTHCONTROL)
3853N/A RTStrmPrintf(pStrm,
3858N/A "VBoxManage bandwidthctl <uuid|vmname>\n"
3853N/A " add <name> --type disk|network --limit <megabytes per second>[k|m|g|K|M|G] |\n"
3853N/A " set <name> --limit <megabytes per second>[k|m|g|K|M|G] |\n"
3853N/A " remove <name> |\n"
3853N/A " list [--machinereadable]\n"
3853N/A " (limit units: k=kilobit, m=megabit, g=gigabit, K=kilobyte, M=megabyte, G=gigabyte)\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_SHOWHDINFO)
3858N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage showhdinfo <uuid>|<filename>\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_CREATEHD)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage createhd --filename <filename>\n"
3853N/A " [--size <megabytes>|--sizebyte <bytes>]\n"
3853N/A " [--diffparent <uuid>|<filename>\n"
3858N/A " [--format VDI|VMDK|VHD] (default: VDI)\n"
3853N/A " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_MODIFYHD)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage modifyhd <uuid>|<filename>\n"
3853N/A " [--type normal|writethrough|immutable|shareable|\n"
3853N/A " readonly|multiattach]\n"
3858N/A " [--autoreset on|off]\n"
3853N/A " [--compact]\n"
3853N/A " [--resize <megabytes>|--resizebyte <bytes>]\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_CLONEHD)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage clonehd <uuid>|<filename> <uuid>|<outputfile>\n"
3853N/A " [--format VDI|VMDK|VHD|RAW|<other>]\n"
3853N/A " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
3853N/A " [--existing]\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_CONVERTFROMRAW)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage convertfromraw <filename> <outputfile>\n"
3853N/A " [--format VDI|VMDK|VHD]\n"
3853N/A " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
3853N/A " [--uuid <uuid>]\n"
3853N/A "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
3853N/A " [--format VDI|VMDK|VHD]\n"
3853N/A " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
3853N/A " [--uuid <uuid>]\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_GETEXTRADATA)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage getextradata global|<uuid>|<name>\n"
3853N/A " <key>|enumerate\n"
3853N/A "\n");
3853N/A
4500N/A if (u64Cmd & USAGE_SETEXTRADATA)
4500N/A RTStrmPrintf(pStrm,
4500N/A "VBoxManage setextradata global|<uuid>|<name>\n"
4500N/A " <key>\n"
4500N/A " [<value>] (no value deletes key)\n"
4500N/A "\n");
4500N/A
4500N/A if (u64Cmd & USAGE_SETPROPERTY)
4500N/A RTStrmPrintf(pStrm,
4500N/A "VBoxManage setproperty machinefolder default|<folder> |\n"
4500N/A " vrdeauthlibrary default|<library> |\n"
4500N/A " websrvauthlibrary default|null|<library> |\n"
4500N/A " vrdeextpack null|<library> |\n"
4500N/A " loghistorycount <value>\n"
4500N/A "\n");
4500N/A
4500N/A if (u64Cmd & USAGE_USBFILTER_ADD)
4500N/A RTStrmPrintf(pStrm,
4500N/A "VBoxManage usbfilter add <index,0-N>\n"
4500N/A " --target <uuid>|<name>|global\n"
4500N/A " --name <string>\n"
4500N/A " --action ignore|hold (global filters only)\n"
4500N/A " [--active yes|no] (yes)\n"
4500N/A " [--vendorid <XXXX>] (null)\n"
4500N/A " [--productid <XXXX>] (null)\n"
4500N/A " [--revision <IIFF>] (null)\n"
4500N/A " [--manufacturer <string>] (null)\n"
4500N/A " [--product <string>] (null)\n"
4500N/A " [--remote yes|no] (null, VM filters only)\n"
4500N/A " [--serialnumber <string>] (null)\n"
4500N/A " [--maskedinterfaces <XXXXXXXX>]\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_USBFILTER_MODIFY)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage usbfilter modify <index,0-N>\n"
3853N/A " --target <uuid>|<name>|global\n"
3853N/A " [--name <string>]\n"
3853N/A " [--action ignore|hold] (global filters only)\n"
3853N/A " [--active yes|no]\n"
3853N/A " [--vendorid <XXXX>|\"\"]\n"
3853N/A " [--productid <XXXX>|\"\"]\n"
3853N/A " [--revision <IIFF>|\"\"]\n"
3853N/A " [--manufacturer <string>|\"\"]\n"
3853N/A " [--product <string>|\"\"]\n"
3853N/A " [--remote yes|no] (null, VM filters only)\n"
3853N/A " [--serialnumber <string>|\"\"]\n"
3853N/A " [--maskedinterfaces <XXXXXXXX>]\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_USBFILTER_REMOVE)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage usbfilter remove <index,0-N>\n"
3853N/A " --target <uuid>|<name>|global\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage sharedfolder add <vmname>|<uuid>\n"
3853N/A " --name <name> --hostpath <hostpath>\n"
3853N/A " [--transient] [--readonly] [--automount]\n"
3853N/A "\n");
3853N/A
3853N/A if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage sharedfolder remove <vmname>|<uuid>\n"
3853N/A " --name <name> [--transient]\n"
3853N/A "\n");
3853N/A
3853N/A#ifdef VBOX_WITH_GUEST_PROPS
3853N/A if (u64Cmd & USAGE_GUESTPROPERTY)
4803N/A usageGuestProperty(pStrm);
4803N/A#endif /* VBOX_WITH_GUEST_PROPS defined */
4803N/A
4803N/A#ifdef VBOX_WITH_GUEST_CONTROL
4803N/A if (u64Cmd & USAGE_GUESTCONTROL)
4803N/A usageGuestControl(pStrm);
4803N/A#endif /* VBOX_WITH_GUEST_CONTROL defined */
4803N/A
4803N/A if (u64Cmd & USAGE_DEBUGVM)
4803N/A {
4803N/A RTStrmPrintf(pStrm,
4803N/A "VBoxManage debugvm <uuid>|<name>\n"
4803N/A " dumpguestcore --filename <name> |\n"
4803N/A " info <item> [args] |\n"
4803N/A " injectnmi |\n"
4803N/A " log [--release|--debug] <settings> ...|\n"
4803N/A " logdest [--release|--debug] <settings> ...|\n"
4803N/A " logflags [--release|--debug] <settings> ...|\n"
4803N/A " osdetect |\n"
4803N/A " osinfo |\n"
4803N/A " getregisters [--cpu <id>] <reg>|all ... |\n"
4803N/A " setregisters [--cpu <id>] <reg>=<value> ... |\n"
4803N/A " show [--human-readable|--sh-export|--sh-eval|--cmd-set] \n"
4803N/A " <logdbg-settings|logrel-settings> [[opt] what ...] |\n"
4803N/A " statistics [--reset] [--pattern <pattern>]\n"
4803N/A " [--descriptions]\n"
4803N/A "\n");
4803N/A }
4803N/A if (u64Cmd & USAGE_METRICS)
4803N/A RTStrmPrintf(pStrm,
4803N/A "VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
4803N/A " (comma-separated)\n\n"
4803N/A "VBoxManage metrics setup\n"
4803N/A " [--period <seconds>] (default: 1)\n"
4803N/A " [--samples <count>] (default: 1)\n"
4803N/A " [--list]\n"
3853N/A " [*|host|<vmname> [<metric_list>]]\n\n"
3853N/A "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
3853N/A "VBoxManage metrics enable\n"
3853N/A " [--list]\n"
3853N/A " [*|host|<vmname> [<metric_list>]]\n\n"
3853N/A "VBoxManage metrics disable\n"
3853N/A " [--list]\n"
3853N/A " [*|host|<vmname> [<metric_list>]]\n\n"
3853N/A "VBoxManage metrics collect\n"
3853N/A " [--period <seconds>] (default: 1)\n"
3853N/A " [--samples <count>] (default: 1)\n"
3853N/A " [--list]\n"
3853N/A " [--detach]\n"
3853N/A " [*|host|<vmname> [<metric_list>]]\n"
3853N/A "\n");
3853N/A
3853N/A#if defined(VBOX_WITH_NETFLT)
3853N/A if (u64Cmd & USAGE_HOSTONLYIFS)
3853N/A {
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage hostonlyif ipconfig <name>\n"
3853N/A " [--dhcp |\n"
3853N/A " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
3853N/A " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
3853N/A# if !defined(RT_OS_SOLARIS)
3853N/A " create |\n"
3853N/A " remove <name>\n"
3853N/A# endif
3853N/A "\n");
3853N/A }
3853N/A#endif
3853N/A
3853N/A if (u64Cmd & USAGE_DHCPSERVER)
3853N/A {
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage dhcpserver add|modify --netname <network_name> |\n"
3853N/A#if defined(VBOX_WITH_NETFLT)
3853N/A " --ifname <hostonly_if_name>\n"
3853N/A#endif
3853N/A " [--ip <ip_address>\n"
3853N/A " --netmask <network_mask>\n"
3853N/A " --lowerip <lower_ip>\n"
3853N/A " --upperip <upper_ip>]\n"
3853N/A " [--enable | --disable]\n\n"
3853N/A "VBoxManage dhcpserver remove --netname <network_name> |\n"
3853N/A#if defined(VBOX_WITH_NETFLT)
3853N/A " --ifname <hostonly_if_name>\n"
3853N/A#endif
3853N/A "\n");
3853N/A }
3853N/A if (u64Cmd & USAGE_EXTPACK)
3853N/A {
3853N/A RTStrmPrintf(pStrm,
3853N/A "VBoxManage extpack install [--replace] <tarball> |\n"
3853N/A " uninstall [--force] <name> |\n"
3853N/A " cleanup\n"
3853N/A "\n");
3853N/A }
3853N/A}
3853N/A
3853N/A/**
3853N/A * Print a usage synopsis and the syntax error message.
3853N/A * @returns RTEXITCODE_SYNTAX.
3853N/A */
3853N/ARTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
3853N/A{
3853N/A va_list args;
3853N/A showLogo(g_pStdErr); // show logo even if suppressed
3853N/A#ifndef VBOX_ONLY_DOCS
3853N/A if (g_fInternalMode)
3853N/A printUsageInternal(u64Cmd, g_pStdErr);
3853N/A else
3853N/A printUsage(u64Cmd, g_pStdErr);
3853N/A#endif /* !VBOX_ONLY_DOCS */
3853N/A va_start(args, pszFormat);
3853N/A RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
3853N/A va_end(args);
3853N/A return RTEXITCODE_SYNTAX;
3853N/A}
3853N/A
3853N/A/**
3853N/A * errorSyntax for RTGetOpt users.
3853N/A *
3853N/A * @returns RTEXITCODE_SYNTAX.
3853N/A *
3853N/A * @param fUsageCategory The usage category of the command.
3853N/A * @param rc The RTGetOpt return code.
3853N/A * @param pValueUnion The value union.
3853N/A */
3853N/ARTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
3853N/A{
3853N/A /*
3853N/A * Check if it is an unhandled standard option.
3853N/A */
3853N/A if (rc == 'V')
3853N/A {
3853N/A RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
3853N/A return RTEXITCODE_SUCCESS;
3853N/A }
3853N/A
3853N/A if (rc == 'h')
3853N/A {
3853N/A showLogo(g_pStdErr);
3853N/A#ifndef VBOX_ONLY_DOCS
3853N/A if (g_fInternalMode)
3853N/A printUsageInternal(fUsageCategory, g_pStdOut);
3853N/A else
3853N/A printUsage(fUsageCategory, g_pStdOut);
3853N/A#endif
3853N/A return RTEXITCODE_SUCCESS;
3853N/A }
3853N/A
3853N/A /*
3853N/A * General failure.
3853N/A */
3853N/A showLogo(g_pStdErr); // show logo even if suppressed
3853N/A#ifndef VBOX_ONLY_DOCS
3853N/A if (g_fInternalMode)
5035N/A printUsageInternal(fUsageCategory, g_pStdErr);
3853N/A else
3853N/A printUsage(fUsageCategory, g_pStdErr);
3853N/A#endif /* !VBOX_ONLY_DOCS */
3853N/A
3853N/A if (rc == VINF_GETOPT_NOT_OPTION)
3853N/A return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
3853N/A if (rc > 0)
3853N/A {
3853N/A if (RT_C_IS_PRINT(rc))
3853N/A return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
3853N/A return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
3853N/A }
3853N/A if (rc == VERR_GETOPT_UNKNOWN_OPTION)
3853N/A return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
3853N/A if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT)
3853N/A return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz);
3853N/A if (pValueUnion->pDef)
3853N/A return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
3853N/A return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
3853N/A}
3853N/A
3853N/A/**
3853N/A * Print an error message without the syntax stuff.
3853N/A *
3853N/A * @returns RTEXITCODE_SYNTAX.
3853N/A */
3853N/ARTEXITCODE errorArgument(const char *pszFormat, ...)
3853N/A{
3853N/A va_list args;
3853N/A va_start(args, pszFormat);
3853N/A RTMsgErrorV(pszFormat, args);
3853N/A va_end(args);
3853N/A return RTEXITCODE_SYNTAX;
3853N/A}
3853N/A