Changeset 19510 in vbox
- Timestamp:
- May 8, 2009 7:02:22 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/DHCPServerRunner.cpp
r18208 r19510 36 36 #endif 37 37 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"} 38 static 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"} 54 55 }; 55 56 … … 57 58 { 58 59 for (unsigned i = 0; i < RT_ELEMENTS(g_aArgDefs); i++) 59 {60 60 if(g_aArgDefs[i].Type == type) 61 {62 61 return &g_aArgDefs[i]; 63 } 64 } 62 65 63 return NULL; 66 64 } … … 73 71 int DHCPServerRunner::start() 74 72 { 75 if (isRunning())73 if (isRunning()) 76 74 return VINF_ALREADY_INITIALIZED; 77 75 … … 79 77 80 78 /* get the path to the executable */ 81 // const char *exePath = DHCP_EXECUTABLE_NAME;82 79 char exePathBuf [RTPATH_MAX]; 83 c har *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, '\\'); 86 83 char *suffix = substrSl ? substrSl : substrBs; 87 84 88 if (suffix)85 if (suffix) 89 86 { 90 87 suffix++; … … 92 89 } 93 90 else 94 {95 91 exePath = DHCP_EXECUTABLE_NAME; 96 }97 92 98 93 int index = 0; … … 100 95 args[index++] = exePath; 101 96 102 for (inti = 0; i < DHCPCFG_NOTOPT_MAXVAL; i++)97 for (unsigned i = 0; i < DHCPCFG_NOTOPT_MAXVAL; i++) 103 98 { 104 if (!mOptions[i].isNull())99 if (!mOptions[i].isNull()) 105 100 { 106 101 const ARGDEF * pArgDef = getArgDef((DHCPCFG)i); 107 102 args[index++] = pArgDef->Name; 108 if (!mOptions[i].isEmpty())103 if (!mOptions[i].isEmpty()) 109 104 { 110 105 args[index++] = mOptions[i].raw(); … … 117 112 int rc = RTProcCreate (exePath, args, RTENV_DEFAULT, 0, &mProcess); 118 113 if (RT_FAILURE (rc)) 119 {120 114 mProcess = NIL_RTPROCESS; 121 } 115 122 116 return rc; 123 117 } … … 125 119 int DHCPServerRunner::stop() 126 120 { 127 if (!isRunning())121 if (!isRunning()) 128 122 return VINF_OBJECT_DESTROYED; 129 123
Note:
See TracChangeset
for help on using the changeset viewer.