Changeset 66861 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- May 10, 2017 12:56:16 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/getoptargv.cpp
r65642 r66861 276 276 * Parse and copy the string over. 277 277 */ 278 RTUNICP Cp;278 RTUNICP uc; 279 279 if ((fFlags & RTGETOPTARGV_CNV_QUOTE_MASK) == RTGETOPTARGV_CNV_QUOTE_BOURNE_SH) 280 280 { … … 282 282 * Bourne shell style. 283 283 */ 284 RTUNICP CpQuote = 0;284 RTUNICP ucQuote = 0; 285 285 for (;;) 286 286 { 287 rc = RTStrGetCpEx(&pszSrc, & Cp);288 if (RT_FAILURE(rc) || ! Cp)287 rc = RTStrGetCpEx(&pszSrc, &uc); 288 if (RT_FAILURE(rc) || !uc) 289 289 break; 290 if (! CpQuote)291 { 292 if ( Cp == '"' || Cp== '\'')293 CpQuote = Cp;294 else if (rtGetOptIsCpInSet( Cp, pszSeparators, cchSeparators))290 if (!ucQuote) 291 { 292 if (uc == '"' || uc == '\'') 293 ucQuote = uc; 294 else if (rtGetOptIsCpInSet(uc, pszSeparators, cchSeparators)) 295 295 break; 296 else if ( Cp!= '\\')297 pszDst = RTStrPutCp(pszDst, Cp);296 else if (uc != '\\') 297 pszDst = RTStrPutCp(pszDst, uc); 298 298 else 299 299 { 300 300 /* escaped char */ 301 rc = RTStrGetCpEx(&pszSrc, & Cp);302 if (RT_FAILURE(rc) || ! Cp)301 rc = RTStrGetCpEx(&pszSrc, &uc); 302 if (RT_FAILURE(rc) || !uc) 303 303 break; 304 pszDst = RTStrPutCp(pszDst, Cp);304 pszDst = RTStrPutCp(pszDst, uc); 305 305 } 306 306 } 307 else if ( CpQuote != Cp)308 { 309 if ( Cp != '\\' || CpQuote == '\'')310 pszDst = RTStrPutCp(pszDst, Cp);307 else if (ucQuote != uc) 308 { 309 if (uc != '\\' || ucQuote == '\'') 310 pszDst = RTStrPutCp(pszDst, uc); 311 311 else 312 312 { 313 313 /* escaped char */ 314 rc = RTStrGetCpEx(&pszSrc, & Cp);315 if (RT_FAILURE(rc) || ! Cp)314 rc = RTStrGetCpEx(&pszSrc, &uc); 315 if (RT_FAILURE(rc) || !uc) 316 316 break; 317 pszDst = RTStrPutCp(pszDst, Cp); 317 if ( uc != '"' 318 && uc != '\\' 319 && uc != '`' 320 && uc != '$' 321 && uc != '\n') 322 pszDst = RTStrPutCp(pszDst, ucQuote); 323 pszDst = RTStrPutCp(pszDst, uc); 318 324 } 319 325 } 320 326 else 321 CpQuote = 0;327 ucQuote = 0; 322 328 } 323 329 } … … 331 337 for (;;) 332 338 { 333 rc = RTStrGetCpEx(&pszSrc, & Cp);334 if (RT_FAILURE(rc) || ! Cp)339 rc = RTStrGetCpEx(&pszSrc, &uc); 340 if (RT_FAILURE(rc) || !uc) 335 341 break; 336 if ( Cp== '"')342 if (uc == '"') 337 343 { 338 344 /* Two double quotes insides a quoted string in an escape … … 349 355 } 350 356 } 351 else if (!fInQuote && rtGetOptIsCpInSet( Cp, pszSeparators, cchSeparators))357 else if (!fInQuote && rtGetOptIsCpInSet(uc, pszSeparators, cchSeparators)) 352 358 break; 353 else if ( Cp!= '\\')354 pszDst = RTStrPutCp(pszDst, Cp);359 else if (uc != '\\') 360 pszDst = RTStrPutCp(pszDst, uc); 355 361 else 356 362 { … … 387 393 388 394 *pszDst++ = '\0'; 389 if (RT_FAILURE(rc) || ! Cp)395 if (RT_FAILURE(rc) || !uc) 390 396 break; 391 397 }
Note:
See TracChangeset
for help on using the changeset viewer.