/* $Id: VBoxManageHelp.cpp 20521 2009-06-12 15:28:26Z vboxsync $ */ /** @file * VBoxManage - help and other message output. */ /* * Copyright (C) 2006-2009 Sun Microsystems, Inc. * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 USA or visit http://www.sun.com if you need * additional information or have any questions. */ #include #include #include "VBoxManage.h" void printUsage(USAGECATEGORY u64Cmd) { #ifdef RT_OS_LINUX bool fLinux = true; #else bool fLinux = false; #endif #ifdef RT_OS_WINDOWS bool fWin = true; #else bool fWin = false; #endif #ifdef RT_OS_SOLARIS bool fSolaris = true; #else bool fSolaris = false; #endif #ifdef RT_OS_DARWIN bool fDarwin = true; #else bool fDarwin = false; #endif #ifdef VBOX_WITH_VRDP bool fVRDP = true; #else bool fVRDP = false; #endif if (u64Cmd == USAGE_DUMPOPTS) { fLinux = true; fWin = true; fSolaris = true; fDarwin = true; fVRDP = true; u64Cmd = USAGE_ALL; } RTPrintf("Usage:\n" "\n"); if (u64Cmd == USAGE_ALL) { RTPrintf("VBoxManage [-v|--version] print version number and exit\n" "VBoxManage [-q|--nologo] ... suppress the logo\n" "\n"); } if (u64Cmd & USAGE_LIST) { RTPrintf("VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|\n" #if defined(VBOX_WITH_NETFLT) " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n" #else " bridgedifs|hostinfo|dhcpservers|\n" #endif " hddbackends|hdds|dvds|floppies|\n" " usbhost|usbfilters|systemproperties\n" "\n"); } if (u64Cmd & USAGE_SHOWVMINFO) { RTPrintf("VBoxManage showvminfo | [--details] [--statistics]\n" " [--machinereadable]\n" "\n"); } if (u64Cmd & USAGE_REGISTERVM) { RTPrintf("VBoxManage registervm \n" "\n"); } if (u64Cmd & USAGE_UNREGISTERVM) { RTPrintf("VBoxManage unregistervm | [--delete]\n" "\n"); } if (u64Cmd & USAGE_CREATEVM) { RTPrintf("VBoxManage createvm --name \n" " [--ostype ]\n" " [--register]\n" " [--basefolder | --settingsfile ]\n" " [--uuid ]\n" "\n"); } if (u64Cmd & USAGE_MODIFYVM) { RTPrintf("VBoxManage modifyvm \n" " [--name ]\n" " [--ostype ]\n" " [--memory ]\n" " [--vram ]\n" " [--acpi on|off]\n" " [--ioapic on|off]\n" " [--pae on|off]\n" " [--hwvirtex on|off|default]\n" " [--nestedpaging on|off]\n" " [--vtxvpid on|off]\n" " [--cpus ]\n" " [--monitorcount ]\n" " [--accelerate3d ]\n" " [--bioslogofadein on|off]\n" " [--bioslogofadeout on|off]\n" " [--bioslogodisplaytime ]\n" " [--bioslogoimagepath ]\n" " [--biosbootmenu disabled|menuonly|messageandmenu]\n" " [--biossystemtimeoffset ]\n" " [--biospxedebug on|off]\n" " [--boot<1-4> none|floppy|dvd|disk|net>]\n" " [--hd none||]\n" " [--idecontroller PIIX3|PIIX4]\n" #ifdef VBOX_WITH_AHCI " [--sata on|off]\n" " [--sataportcount <1-30>]\n" " [--sataport<1-30> none||]\n" " [--sataideemulation<1-4> <1-30>]\n" #endif #ifdef VBOX_WITH_SCSI " [--scsi on|off]\n" " [--scsiport<1-16> none||]\n" " [--scsitype LsiLogic|BusLogic]\n" #endif " [--dvd none|||host:]\n" " [--dvdpassthrough on|off]\n" " [--floppy disabled|empty||\n" " |host:]\n" #if defined(VBOX_WITH_NETFLT) " [--nic<1-N> none|null|nat|bridged|intnet|hostonly]\n" #else /* !RT_OS_LINUX && !RT_OS_DARWIN */ " [--nic<1-N> none|null|nat|bridged|intnet]\n" #endif /* !RT_OS_LINUX && !RT_OS_DARWIN */ " [--nictype<1-N> Am79C970A|Am79C973" #ifdef VBOX_WITH_E1000 "|\n 82540EM|82543GC|82545EM" #endif "]\n" " [--cableconnected<1-N> on|off]\n" " [--nictrace<1-N> on|off]\n" " [--nictracefile<1-N> ]\n" " [--nicspeed<1-N> ]\n" " [--bridgeadapter<1-N> none|]\n" #if defined(VBOX_WITH_NETFLT) " [--hostonlyadapter<1-N> none|]\n" #endif " [--intnet<1-N> ]\n" " [--natnet<1-N> |default]\n" " [--macaddress<1-N> auto|]\n" " [--uart<1-N> off| ]\n" " [--uartmode<1-N> disconnected|\n" " server |\n" " client |\n" " file |\n" " ]\n" #ifdef VBOX_WITH_MEM_BALLOONING " [--guestmemoryballoon ]\n" #endif " [--gueststatisticsinterval ]\n" ); RTPrintf(" [--audio none|null"); if (fWin) { #ifdef VBOX_WITH_WINMM RTPrintf( "|winmm|dsound"); #else RTPrintf( "|dsound"); #endif } if (fSolaris) { RTPrintf( "|solaudio" #ifdef VBOX_WITH_SOLARIS_OSS "|oss" #endif ); } if (fLinux) { RTPrintf( "|oss" #ifdef VBOX_WITH_ALSA "|alsa" #endif #ifdef VBOX_WITH_PULSE "|pulse" #endif ); } if (fDarwin) { RTPrintf( "|coreaudio"); } RTPrintf( "]\n"); RTPrintf(" [--audiocontroller ac97|sb16]\n" " [--clipboard disabled|hosttoguest|guesttohost|\n" " bidirectional]\n"); if (fVRDP) { RTPrintf(" [--vrdp on|off]\n" " [--vrdpport default|]\n" " [--vrdpaddress ]\n" " [--vrdpauthtype null|external|guest]\n" " [--vrdpmulticon on|off]\n" " [--vrdpreusecon on|off]\n"); } RTPrintf(" [--usb on|off]\n" " [--usbehci on|off]\n" " [--snapshotfolder default|]\n"); RTPrintf("\n"); } if (u64Cmd & USAGE_IMPORTAPPLIANCE) { RTPrintf("VBoxManage import [--dry-run|-n] [more options]\n" " (run with -n to have options displayed for a particular OVF)\n\n"); } if (u64Cmd & USAGE_EXPORTAPPLIANCE) { RTPrintf("VBoxManage export --output|-o \n" " [--legacy09]\n" " [--vsys ]\n" " [--product ]\n" " [--producturl ]\n" " [--vendor ]\n" " [--vendorurl ]\n" " [--version ]\n" " [--eula ]\n" " [--eulafile ]\n" "\n"); } if (u64Cmd & USAGE_STARTVM) { RTPrintf("VBoxManage startvm |\n"); RTPrintf(" [--type gui"); if (fVRDP) RTPrintf( "|vrdp"); RTPrintf( "|headless]\n"); RTPrintf("\n"); } if (u64Cmd & USAGE_CONTROLVM) { RTPrintf("VBoxManage controlvm |\n" " pause|resume|reset|poweroff|savestate|\n" " acpipowerbutton|acpisleepbutton|\n" " keyboardputscancode [ ...]|\n" " injectnmi|\n" " setlinkstate<1-N> on|off |\n" #ifdef VBOX_DYNAMIC_NET_ATTACH #if defined(VBOX_WITH_NETFLT) " nic<1-N> none|null|nat|bridged|intnet|hostonly\n" " [] |\n" #else /* !RT_OS_LINUX && !RT_OS_DARWIN */ " nic<1-N> none|null|nat|bridged|intnet\n" " [] |\n" #endif /* !RT_OS_LINUX && !RT_OS_DARWIN */ #endif /* VBOX_DYNAMIC_NET_ATTACH */ " usbattach |
|\n" " usbdetach |
|\n" " dvdattach none|||host: |\n" " floppyattach none|||host: |\n"); if (fVRDP) { RTPrintf(" vrdp on|off] |\n"); } RTPrintf(" setvideomodehint [display]|\n" " setcredentials \n" " [--allowlocallogon ]\n" "\n"); } if (u64Cmd & USAGE_DISCARDSTATE) { RTPrintf("VBoxManage discardstate |\n" "\n"); } if (u64Cmd & USAGE_ADOPTSTATE) { RTPrintf("VBoxManage adoptstate | \n" "\n"); } if (u64Cmd & USAGE_SNAPSHOT) { RTPrintf("VBoxManage snapshot |\n" " take [--description ] |\n" " discard | |\n" " discardcurrent --state|--all |\n" " edit ||--current\n" " [--name ]\n" " [--description ] |\n" " showvminfo |\n" "\n"); } if (u64Cmd & USAGE_OPENMEDIUM) { RTPrintf("VBoxManage openmedium disk|dvd|floppy \n" " [--type normal|immutable|writethrough] (disk only)\n" "\n"); } if (u64Cmd & USAGE_CLOSEMEDIUM) { RTPrintf("VBoxManage closemedium disk|dvd|floppy |\n" "\n"); } if (u64Cmd & USAGE_SHOWHDINFO) { RTPrintf("VBoxManage showhdinfo |\n" "\n"); } if (u64Cmd & USAGE_CREATEHD) { RTPrintf("VBoxManage createhd --filename \n" " --size \n" " [--format VDI|VMDK|VHD] (default: VDI)\n" " [--variant Standard,Fixed,Split2G,Stream,ESX]\n" " [--type normal|writethrough] (default: normal)\n" " [--comment ]\n" " [--remember]\n" "\n"); } if (u64Cmd & USAGE_MODIFYHD) { RTPrintf("VBoxManage modifyhd |\n" " [--type normal|writethrough|immutable]\n" " [--autoreset on|off]\n" " [--compact]\n" "\n"); } if (u64Cmd & USAGE_CLONEHD) { RTPrintf("VBoxManage clonehd | \n" " [--format VDI|VMDK|VHD|RAW|]\n" " [--variant Standard,Fixed,Split2G,Stream,ESX]\n" " [--type normal|writethrough|immutable]\n" " [--remember]\n" "\n"); } if (u64Cmd & USAGE_CONVERTFROMRAW) { RTPrintf("VBoxManage convertfromraw \n" " [--format VDI|VMDK|VHD]\n" " [--variant Standard,Fixed,Split2G,Stream,ESX]\n" "VBoxManage convertfromraw stdin \n" " [--format VDI|VMDK|VHD]\n" " [--variant Standard,Fixed,Split2G,Stream,ESX]\n" "\n"); } if (u64Cmd & USAGE_ADDISCSIDISK) { RTPrintf("VBoxManage addiscsidisk --server |\n" " --target \n" " [--port ]\n" " [--lun ]\n" " [--encodedlun ]\n" " [--username ]\n" " [--password ]\n" " [--type normal|writethrough|immutable]\n" " [--comment ]\n" " [--intnet]\n" "\n"); } if (u64Cmd & USAGE_GETEXTRADATA) { RTPrintf("VBoxManage getextradata global||\n" " |enumerate\n" "\n"); } if (u64Cmd & USAGE_SETEXTRADATA) { RTPrintf("VBoxManage setextradata global||\n" " \n" " [] (no value deletes key)\n" "\n"); } if (u64Cmd & USAGE_SETPROPERTY) { RTPrintf("VBoxManage setproperty hdfolder default| |\n" " machinefolder default| |\n" " vrdpauthlibrary default| |\n" " websrvauthlibrary default|null| |\n" " hwvirtexenabled yes|no\n" " loghistorycount \n" "\n"); } if (u64Cmd & USAGE_USBFILTER_ADD) { RTPrintf("VBoxManage usbfilter add \n" " --target ||global\n" " --name \n" " --action ignore|hold (global filters only)\n" " [--active yes|no] (yes)\n" " [--vendorid ] (null)\n" " [--productid ] (null)\n" " [--revision ] (null)\n" " [--manufacturer ] (null)\n" " [--product ] (null)\n" " [--remote yes|no] (null, VM filters only)\n" " [--serialnumber ] (null)\n" " [--maskedinterfaces ]\n" "\n"); } if (u64Cmd & USAGE_USBFILTER_MODIFY) { RTPrintf("VBoxManage usbfilter modify \n" " --target ||global\n" " [--name ]\n" " [--action ignore|hold] (global filters only)\n" " [--active yes|no]\n" " [--vendorid |\"\"]\n" " [--productid |\"\"]\n" " [--revision |\"\"]\n" " [--manufacturer |\"\"]\n" " [--product |\"\"]\n" " [--remote yes|no] (null, VM filters only)\n" " [--serialnumber |\"\"]\n" " [--maskedinterfaces ]\n" "\n"); } if (u64Cmd & USAGE_USBFILTER_REMOVE) { RTPrintf("VBoxManage usbfilter remove \n" " --target ||global\n" "\n"); } if (u64Cmd & USAGE_SHAREDFOLDER_ADD) { RTPrintf("VBoxManage sharedfolder add |\n" " --name --hostpath \n" " [--transient] [--readonly]\n" "\n"); } if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE) { RTPrintf("VBoxManage sharedfolder remove |\n" " --name [--transient]\n" "\n"); } if (u64Cmd & USAGE_VM_STATISTICS) { RTPrintf("VBoxManage vmstatistics | [--reset]\n" " [--pattern ] [--descriptions]\n" "\n"); } #ifdef VBOX_WITH_GUEST_PROPS if (u64Cmd & USAGE_GUESTPROPERTY) usageGuestProperty(); #endif /* VBOX_WITH_GUEST_PROPS defined */ if (u64Cmd & USAGE_METRICS) { RTPrintf("VBoxManage metrics list [*|host| []]\n" " (comma-separated)\n\n" "VBoxManage metrics setup\n" " [--period ]\n" " [--samples ]\n" " [--list]\n" " [*|host| []]\n\n" "VBoxManage metrics query [*|host| []]\n\n" "VBoxManage metrics collect\n" " [--period ]\n" " [--samples ]\n" " [--list]\n" " [--detach]\n" " [*|host| []]\n" "\n"); } #if defined(VBOX_WITH_NETFLT) if (u64Cmd & USAGE_HOSTONLYIFS) { RTPrintf("VBoxManage hostonlyif ipconfig \n" " [--dhcp |\n" " --ip [--netmask (def: 255.255.255.0)] |\n" " --ipv6 [--netmasklengthv6 (def: 64)]]\n" # if defined(RT_OS_WINDOWS) " create |\n" " remove \n" # endif "\n"); } #endif if (u64Cmd & USAGE_DHCPSERVER) { RTPrintf("VBoxManage dhcpserver add|modify --netname |\n" #if defined(VBOX_WITH_NETFLT) " --ifname \n" #endif " [--ip \n" " --netmask \n" " --lowerip \n" " --upperip ]\n" " [--enable | --disable]\n" "VBoxManage dhcpserver remove --netname |\n" #if defined(VBOX_WITH_NETFLT) " --ifname \n" #endif "\n"); } } /** * Print a usage synopsis and the syntax error message. */ int errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...) { va_list args; showLogo(); // show logo even if suppressed #ifndef VBOX_ONLY_DOCS if (g_fInternalMode) printUsageInternal(u64Cmd); else printUsage(u64Cmd); #endif /* !VBOX_ONLY_DOCS */ va_start(args, pszFormat); RTPrintf("\n" "Syntax error: %N\n", pszFormat, &args); va_end(args); return 1; } /** * Print an error message without the syntax stuff. */ int errorArgument(const char *pszFormat, ...) { va_list args; va_start(args, pszFormat); RTPrintf("error: %N\n", pszFormat, &args); va_end(args); return 1; }