VirtualBox

Changeset 19510 in vbox


Ignore:
Timestamp:
May 8, 2009 7:02:22 AM (16 years ago)
Author:
vboxsync
Message:

DHCP runner: warnings, spaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/DHCPServerRunner.cpp

    r18208 r19510  
    3636#endif
    3737
    38 static const ARGDEF g_aArgDefs[] = {
    39         {DHCPCFG_NAME, "--name"},
    40         {DHCPCFG_NETNAME, "--network"},
    41         {DHCPCFG_TRUNKTYPE, "--trunk-type"},
    42         {DHCPCFG_TRUNKNAME, "--trunk-name"},
    43         {DHCPCFG_MACADDRESS, "--mac-address"},
    44         {DHCPCFG_IPADDRESS, "--ip-address"},
    45         {DHCPCFG_LEASEDB, "--lease-db"},
    46         {DHCPCFG_VERBOSE, "--verbose"},
    47         {DHCPCFG_BEGINCONFIG, "--begin-config"},
    48         {DHCPCFG_GATEWAY, "--gateway"},
    49         {DHCPCFG_LOWERIP, "--lower-ip"},
    50         {DHCPCFG_UPPERIP, "--upper-ip"},
    51         {DHCPCFG_NETMASK, "--netmask"},
    52         {DHCPCFG_HELP, "--help"},
    53         {DHCPCFG_VERSION, "--version"}
     38static const ARGDEF g_aArgDefs[] =
     39{
     40    {DHCPCFG_NAME, "--name"},
     41    {DHCPCFG_NETNAME, "--network"},
     42    {DHCPCFG_TRUNKTYPE, "--trunk-type"},
     43    {DHCPCFG_TRUNKNAME, "--trunk-name"},
     44    {DHCPCFG_MACADDRESS, "--mac-address"},
     45    {DHCPCFG_IPADDRESS, "--ip-address"},
     46    {DHCPCFG_LEASEDB, "--lease-db"},
     47    {DHCPCFG_VERBOSE, "--verbose"},
     48    {DHCPCFG_BEGINCONFIG, "--begin-config"},
     49    {DHCPCFG_GATEWAY, "--gateway"},
     50    {DHCPCFG_LOWERIP, "--lower-ip"},
     51    {DHCPCFG_UPPERIP, "--upper-ip"},
     52    {DHCPCFG_NETMASK, "--netmask"},
     53    {DHCPCFG_HELP, "--help"},
     54    {DHCPCFG_VERSION, "--version"}
    5455};
    5556
     
    5758{
    5859    for (unsigned i = 0; i < RT_ELEMENTS(g_aArgDefs); i++)
    59     {
    6060        if(g_aArgDefs[i].Type == type)
    61         {
    6261            return &g_aArgDefs[i];
    63         }
    64     }
     62
    6563    return NULL;
    6664}
     
    7371int DHCPServerRunner::start()
    7472{
    75     if(isRunning())
     73    if (isRunning())
    7674        return VINF_ALREADY_INITIALIZED;
    7775
     
    7977
    8078    /* get the path to the executable */
    81 //    const char *exePath = DHCP_EXECUTABLE_NAME;
    8279    char exePathBuf [RTPATH_MAX];
    83     char *exePath = RTProcGetExecutableName (exePathBuf, RTPATH_MAX);
    84     char *substrSl = strrchr( exePath, '/');
    85     char *substrBs = strrchr( exePath, '\\');
     80    const char *exePath = RTProcGetExecutableName (exePathBuf, RTPATH_MAX);
     81    char *substrSl = strrchr(exePathBuf, '/');
     82    char *substrBs = strrchr(exePathBuf, '\\');
    8683    char *suffix = substrSl ? substrSl : substrBs;
    8784
    88     if(suffix)
     85    if (suffix)
    8986    {
    9087        suffix++;
     
    9289    }
    9390    else
    94     {
    9591        exePath = DHCP_EXECUTABLE_NAME;
    96     }
    9792
    9893    int index = 0;
     
    10095    args[index++] = exePath;
    10196
    102     for(int i = 0; i < DHCPCFG_NOTOPT_MAXVAL; i++)
     97    for (unsigned i = 0; i < DHCPCFG_NOTOPT_MAXVAL; i++)
    10398    {
    104         if(!mOptions[i].isNull())
     99        if (!mOptions[i].isNull())
    105100        {
    106101            const ARGDEF * pArgDef = getArgDef((DHCPCFG)i);
    107102            args[index++] = pArgDef->Name;
    108             if(!mOptions[i].isEmpty())
     103            if (!mOptions[i].isEmpty())
    109104            {
    110105                args[index++] = mOptions[i].raw();
     
    117112    int rc = RTProcCreate (exePath, args, RTENV_DEFAULT, 0, &mProcess);
    118113    if (RT_FAILURE (rc))
    119     {
    120114        mProcess = NIL_RTPROCESS;
    121     }
     115
    122116    return rc;
    123117}
     
    125119int DHCPServerRunner::stop()
    126120{
    127     if(!isRunning())
     121    if (!isRunning())
    128122        return VINF_OBJECT_DESTROYED;
    129123
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