Changeset 19532 in vbox
- Timestamp:
- May 8, 2009 2:53:35 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp
r19527 r19532 396 396 { 397 397 const char *psz = argv[i]; 398 399 /* Translate long argument to short. */ 400 if (*psz+1 == '-') 398 if (*psz != '-') 399 return VBoxServiceSyntax("Unknown argument '%s'\n", psz); 400 psz++; 401 402 /* translate long argument to short */ 403 if (*psz == '-') 401 404 { 402 405 psz++; … … 447 450 return rc; 448 451 } 452 if (!fFound) 453 return VBoxServiceSyntax("Unknown option '%s'\n", argv[i]); 449 454 continue; 450 455 } 451 456 #undef MATCHES 452 457 } 453 else if (*psz == '-') 458 459 /* handle the string of short options. */ 460 do 454 461 { 455 /* Handle the string of short options. */ 456 do 462 switch (*psz) 457 463 { 458 switch (*psz) 464 case 'i': 465 rc = VBoxServiceArgUInt32(argc, argv, psz + 1, &i, 466 &g_DefaultInterval, 1, (UINT32_MAX / 1000) - 1); 467 if (rc) 468 return rc; 469 psz = NULL; 470 break; 471 472 case 'f': 473 fDaemonize = false; 474 break; 475 476 case 'v': 477 g_cVerbosity++; 478 break; 479 480 case 'h': 481 case '?': 482 return VBoxServiceUsage(); 483 484 #ifdef RT_OS_WINDOWS 485 case 'r': 486 return VBoxServiceWinInstall(); 487 488 case 'u': 489 return VBoxServiceWinUninstall(); 490 #endif 491 492 default: 459 493 { 460 case 'i': 461 rc = VBoxServiceArgUInt32(argc, argv, psz + 1, &i, 462 &g_DefaultInterval, 1, (UINT32_MAX / 1000) - 1); 463 if (rc) 494 bool fFound = false; 495 for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++) 496 { 497 rc = g_aServices[j].pDesc->pfnOption(&psz, argc, argv, &i); 498 fFound = rc == 0; 499 if (fFound) 500 break; 501 if (rc != -1) 464 502 return rc; 465 psz = NULL;466 break;467 468 case 'f':469 fDaemonize = false;470 break;471 472 case 'v':473 g_cVerbosity++;474 break;475 476 case 'h':477 case '?':478 return VBoxServiceUsage();479 480 #ifdef RT_OS_WINDOWS481 case 'r':482 return VBoxServiceWinInstall();483 484 case 'u':485 return VBoxServiceWinUninstall();486 #endif487 488 default:489 {490 bool fFound = false;491 for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++)492 {493 rc = g_aServices[j].pDesc->pfnOption(&psz, argc, argv, &i);494 fFound = rc == 0;495 if (fFound)496 break;497 if (rc != -1)498 return rc;499 }500 break;501 503 } 504 if (!fFound) 505 return VBoxServiceSyntax("Unknown option '%c' (%s)\n", *psz, argv[i]); 506 break; 502 507 } 503 } while (psz && *++psz); 504 } 505 else 506 { 507 /* @todo put in here commands without dashes (- or --). */ 508 } 508 } 509 } while (psz && *++psz); 509 510 } 510 511
Note:
See TracChangeset
for help on using the changeset viewer.