Changeset 94981 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- May 10, 2022 2:48:36 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 151394
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageUpdateCheck.cpp
r94756 r94981 42 42 43 43 44 /**45 * Returns the proxy mode as a string.46 *47 * @returns Proxy mode as string.48 * @param enmMode Proxy mode to return as string.49 */50 static const char *proxyModeToStr(ProxyMode_T enmMode)51 {52 switch (enmMode)53 {54 case ProxyMode_System: return "System";55 case ProxyMode_Manual: return "Manual";56 case ProxyMode_NoProxy: return "None";57 default: break;58 }59 60 AssertFailed();61 return "<Invalid>";62 }63 64 44 static RTEXITCODE doUpdateList(int argc, char **argv, ComPtr<IUpdateAgent> pUpdateAgent) 65 45 { … … 167 147 RTPrintf(UpdateCheck::tr("Repository: %ls\n"), bstrVal.raw()); 168 148 169 ProxyMode_T enmProxyMode;170 CHECK_ERROR2I_RET(pUpdateAgent, COMGETTER(ProxyMode)(&enmProxyMode), RTEXITCODE_FAILURE);171 if (fMachineReadable)172 outputMachineReadableString("proxy-mode", proxyModeToStr(enmProxyMode));173 else174 RTPrintf(UpdateCheck::tr("Proxy mode: %s\n"), proxyModeToStr(enmProxyMode));175 CHECK_ERROR2I_RET(pUpdateAgent, COMGETTER(ProxyURL)(bstrVal.asOutParam()), RTEXITCODE_FAILURE);176 if (fMachineReadable)177 outputMachineReadableString("proxy-url", &bstrVal);178 else179 RTPrintf(UpdateCheck::tr("Proxy URL: %ls\n"), bstrVal.raw());180 181 149 return RTEXITCODE_SUCCESS; 182 150 } … … 187 155 * Parse options. 188 156 */ 189 enum GETOPTDEF_UPDATEMODIFY190 {191 GETOPTDEF_UPDATEMODIFY_PROXY_MODE = 2000,192 GETOPTDEF_UPDATEMODIFY_PROXY_URL193 };194 157 static const RTGETOPTDEF s_aOptions[] = 195 158 { … … 198 161 { "--channel", 'c', RTGETOPT_REQ_STRING }, 199 162 { "--frequency", 'f', RTGETOPT_REQ_UINT32 }, 200 { "--proxy-mode", GETOPTDEF_UPDATEMODIFY_PROXY_MODE, RTGETOPT_REQ_STRING },201 { "--proxy-url", GETOPTDEF_UPDATEMODIFY_PROXY_URL, RTGETOPT_REQ_STRING }202 163 }; 203 164 … … 209 170 UpdateChannel_T enmChannel = (UpdateChannel_T)-1; 210 171 uint32_t cFrequencyDays = 0; 211 ProxyMode_T enmProxyMode = (ProxyMode_T)-1; /* Default if not modified, or ProxyMode_T values. */212 Bstr strProxyURL = "unmodified"; /* Default if not modified, so that empty values also can be set (clears proxy). */213 172 214 173 int c; … … 244 203 break; 245 204 246 case GETOPTDEF_UPDATEMODIFY_PROXY_MODE:247 if (!RTStrICmp(ValueUnion.psz, "system"))248 enmProxyMode = ProxyMode_System;249 else if ( !RTStrICmp(ValueUnion.psz, "none")250 || !RTStrICmp(ValueUnion.psz, "disabled")251 || !RTStrICmp(ValueUnion.psz, "off"))252 enmProxyMode = ProxyMode_NoProxy;253 else if (!RTStrICmp(ValueUnion.psz, "manual"))254 enmProxyMode = ProxyMode_Manual;255 else256 return errorArgument(UpdateCheck::tr("Invalid proxy mode specified: '%s'"), ValueUnion.psz);257 break;258 259 case GETOPTDEF_UPDATEMODIFY_PROXY_URL:260 strProxyURL = ValueUnion.psz;261 break;262 263 205 /** @todo Add more options like repo handling etc. */ 264 206 … … 270 212 if ( fEnabled == -1 271 213 && enmChannel == (UpdateChannel_T)-1 272 && cFrequencyDays == 0 273 && enmProxyMode == (ProxyMode_T)-1 274 && strProxyURL == "unmodified") 214 && cFrequencyDays == 0) 275 215 return errorSyntax(UpdateCheck::tr("No change requested")); 276 216 … … 289 229 { 290 230 CHECK_ERROR2I_RET(pUpdateAgent, COMSETTER(CheckFrequency)(cFrequencyDays * RT_SEC_1DAY), RTEXITCODE_FAILURE); 291 }292 if (enmProxyMode != (ProxyMode_T)-1)293 {294 CHECK_ERROR2I_RET(pUpdateAgent, COMSETTER(ProxyMode)(enmProxyMode), RTEXITCODE_FAILURE);295 }296 if (strProxyURL.compare("unmodified") != 0)297 {298 CHECK_ERROR2I_RET(pUpdateAgent, COMSETTER(ProxyURL)(strProxyURL.raw()), RTEXITCODE_FAILURE);299 231 } 300 232 return RTEXITCODE_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.