VirtualBox

Ignore:
Timestamp:
Mar 13, 2018 1:25:43 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
121244
Message:

NetworkServices/Dhcpd: getopt improvements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/Dhcpd/Config.cpp

    r70836 r71306  
    2020#include <iprt/getopt.h>
    2121#include <iprt/path.h>
     22#include <iprt/message.h>
    2223#include <iprt/string.h>
    2324
     
    9596
    9697/* compatibility with old VBoxNetDHCP */
    97 static RTGETOPTDEF g_aCompatOptions[] =
     98static const RTGETOPTDEF g_aCompatOptions[] =
    9899{
    99100    { "--ip-address",     'i',   RTGETOPT_REQ_IPV4ADDR },
     
    114115
    115116    rc = RTGetOptInit(&State, argc, argv,
    116                       g_aCompatOptions, RT_ELEMENTS(g_aCompatOptions), 0,
     117                      g_aCompatOptions, RT_ELEMENTS(g_aCompatOptions), 1,
    117118                      RTGETOPTINIT_FLAGS_NO_STD_OPTS);
     119    AssertRCReturn(rc, NULL);
    118120
    119121    std::unique_ptr<Config> config(new Config());
     
    162164                    config->m_enmTrunkType = kIntNetTrunkType_NetAdp;
    163165                else
     166                {
     167                    RTMsgError("Unknown trunk type '%s'", Val.psz);
    164168                    return NULL;
     169                }
    165170                break;
    166171
     
    168173                config->m_IPv4PoolLast = Val.IPv4Addr;
    169174                break;
     175
     176            case VINF_GETOPT_NOT_OPTION:
     177                RTMsgError("%s: Unexpected command line argument", Val.psz);
     178                return NULL;
     179
     180            default:
     181                RTGetOptPrintError(rc, &Val);
     182                return NULL;
    170183        }
    171184    }
Note: See TracChangeset for help on using the changeset viewer.

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