VirtualBox

Ignore:
Timestamp:
Nov 24, 2009 1:57:53 PM (15 years ago)
Author:
vboxsync
Message:

VBoxManage: A little clean up in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r24879 r24901  
    6464#ifndef VBOX_ONLY_DOCS
    6565using namespace com;
    66 
    67 /** command handler type */
    68 typedef int (*PFNHANDLER)(HandlerArg *a);
    69 
    7066#endif /* !VBOX_ONLY_DOCS */
    7167
    72 ////////////////////////////////////////////////////////////////////////////////
    73 //
    74 // global variables
    75 //
    76 ////////////////////////////////////////////////////////////////////////////////
    77 
     68/*******************************************************************************
     69*   Global Variables                                                           *
     70*******************************************************************************/
    7871/*extern*/ bool g_fDetailedProgress = false;
    7972
     
    176169    return iRc;
    177170}
    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_DOCS
    196171
    197172static int handleRegisterVM(HandlerArg *a)
     
    18891864            return 0;
    18901865        }
    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"))
    18951871        {
    18961872            /* Print version number, and do nothing else. */
     
    18981874            return 0;
    18991875        }
    1900         else if (   !strcmp(argv[i], "--dumpopts")
    1901                  || !strcmp(argv[i], "-dumpopts"))
     1876
     1877        if (   !strcmp(argv[i], "--dumpopts")
     1878            || !strcmp(argv[i], "-dumpopts"))
    19021879        {
    19031880            /* Special option to dump really all commands,
     
    19061883            return 0;
    19071884        }
    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"))
    19111889        {
    19121890            /* suppress the logo */
     
    19941972     * All registered command handlers
    19951973     */
    1996     struct
     1974    static const struct
    19971975    {
    19981976        const char *command;
    1999         PFNHANDLER handler;
    2000     } commandHandlers[] =
     1977        int (*handler)(HandlerArg *a);
     1978    } s_commandHandlers[] =
    20011979    {
    20021980        { "internalcommands", handleInternalCommands },
     
    20352013#ifdef VBOX_WITH_GUEST_PROPS
    20362014        { "guestproperty",    handleGuestProperty },
    2037 #endif /* VBOX_WITH_GUEST_PROPS defined */
     2015#endif
    20382016        { "metrics",          handleMetrics },
    20392017        { "import",           handleImportAppliance },
    20402018        { "export",           handleExportAppliance },
    2041 #if defined(VBOX_WITH_NETFLT)
     2019#ifdef VBOX_WITH_NETFLT
    20422020        { "hostonlyif",       handleHostonlyIf },
    20432021#endif
     
    20472025
    20482026    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]))
    20522030        {
    20532031            handlerArg.argc = argc - iCmdArg;
    20542032            handlerArg.argv = &argv[iCmdArg];
    20552033
    2056             rc = commandHandlers[commandIndex].handler(&handlerArg);
     2034            rc = s_commandHandlers[commandIndex].handler(&handlerArg);
    20572035            break;
    20582036        }
    20592037    }
    2060     if (!commandHandlers[commandIndex].command)
     2038    if (!s_commandHandlers[commandIndex].command)
    20612039    {
    20622040        rc = errorSyntax(USAGE_ALL, "Invalid command '%s'", Utf8Str(argv[iCmd]).raw());
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette