Changeset 24901 in vbox for trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
- Timestamp:
- Nov 24, 2009 1:57:53 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r24879 r24901 64 64 #ifndef VBOX_ONLY_DOCS 65 65 using namespace com; 66 67 /** command handler type */68 typedef int (*PFNHANDLER)(HandlerArg *a);69 70 66 #endif /* !VBOX_ONLY_DOCS */ 71 67 72 //////////////////////////////////////////////////////////////////////////////// 73 // 74 // global variables 75 // 76 //////////////////////////////////////////////////////////////////////////////// 77 68 /******************************************************************************* 69 * Global Variables * 70 *******************************************************************************/ 78 71 /*extern*/ bool g_fDetailedProgress = false; 79 72 … … 176 169 return iRc; 177 170 } 178 #endif /* !VBOX_ONLY_DOCS */179 180 void showLogo(void)181 {182 static bool fShown; /* show only once */183 184 if (!fShown)185 {186 RTPrintf("VirtualBox Command Line Management Interface Version "187 VBOX_VERSION_STRING "\n"188 "(C) 2005-2009 Sun Microsystems, Inc.\n"189 "All rights reserved.\n"190 "\n");191 fShown = true;192 }193 }194 195 #ifndef VBOX_ONLY_DOCS196 171 197 172 static int handleRegisterVM(HandlerArg *a) … … 1889 1864 return 0; 1890 1865 } 1891 else if ( !strcmp(argv[i], "-v") 1892 || !strcmp(argv[i], "-version") 1893 || !strcmp(argv[i], "-Version") 1894 || !strcmp(argv[i], "--version")) 1866 1867 if ( !strcmp(argv[i], "-v") 1868 || !strcmp(argv[i], "-version") 1869 || !strcmp(argv[i], "-Version") 1870 || !strcmp(argv[i], "--version")) 1895 1871 { 1896 1872 /* Print version number, and do nothing else. */ … … 1898 1874 return 0; 1899 1875 } 1900 else if ( !strcmp(argv[i], "--dumpopts") 1901 || !strcmp(argv[i], "-dumpopts")) 1876 1877 if ( !strcmp(argv[i], "--dumpopts") 1878 || !strcmp(argv[i], "-dumpopts")) 1902 1879 { 1903 1880 /* Special option to dump really all commands, … … 1906 1883 return 0; 1907 1884 } 1908 else if ( !strcmp(argv[i], "--nologo") 1909 || !strcmp(argv[i], "-nologo") 1910 || !strcmp(argv[i], "-q")) 1885 1886 if ( !strcmp(argv[i], "--nologo") 1887 || !strcmp(argv[i], "-nologo") 1888 || !strcmp(argv[i], "-q")) 1911 1889 { 1912 1890 /* suppress the logo */ … … 1994 1972 * All registered command handlers 1995 1973 */ 1996 st ruct1974 static const struct 1997 1975 { 1998 1976 const char *command; 1999 PFNHANDLER handler;2000 } commandHandlers[] =1977 int (*handler)(HandlerArg *a); 1978 } s_commandHandlers[] = 2001 1979 { 2002 1980 { "internalcommands", handleInternalCommands }, … … 2035 2013 #ifdef VBOX_WITH_GUEST_PROPS 2036 2014 { "guestproperty", handleGuestProperty }, 2037 #endif /* VBOX_WITH_GUEST_PROPS defined */2015 #endif 2038 2016 { "metrics", handleMetrics }, 2039 2017 { "import", handleImportAppliance }, 2040 2018 { "export", handleExportAppliance }, 2041 #if defined(VBOX_WITH_NETFLT)2019 #ifdef VBOX_WITH_NETFLT 2042 2020 { "hostonlyif", handleHostonlyIf }, 2043 2021 #endif … … 2047 2025 2048 2026 int commandIndex; 2049 for (commandIndex = 0; commandHandlers[commandIndex].command != NULL; commandIndex++)2050 { 2051 if (!strcmp( commandHandlers[commandIndex].command, argv[iCmd]))2027 for (commandIndex = 0; s_commandHandlers[commandIndex].command != NULL; commandIndex++) 2028 { 2029 if (!strcmp(s_commandHandlers[commandIndex].command, argv[iCmd])) 2052 2030 { 2053 2031 handlerArg.argc = argc - iCmdArg; 2054 2032 handlerArg.argv = &argv[iCmdArg]; 2055 2033 2056 rc = commandHandlers[commandIndex].handler(&handlerArg);2034 rc = s_commandHandlers[commandIndex].handler(&handlerArg); 2057 2035 break; 2058 2036 } 2059 2037 } 2060 if (! commandHandlers[commandIndex].command)2038 if (!s_commandHandlers[commandIndex].command) 2061 2039 { 2062 2040 rc = errorSyntax(USAGE_ALL, "Invalid command '%s'", Utf8Str(argv[iCmd]).raw());
Note:
See TracChangeset
for help on using the changeset viewer.