Changeset 24825 in vbox
- Timestamp:
- Nov 20, 2009 2:41:05 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
-
include/iprt/getopt.h (modified) (1 diff)
-
include/iprt/message.h (added)
-
src/VBox/Runtime/Makefile.kmk (modified) (1 diff)
-
src/VBox/Runtime/common/misc/getopt.cpp (modified) (2 diffs)
-
src/VBox/Runtime/common/misc/message.cpp (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/getopt.h
r24140 r24825 359 359 RTDECL(int) RTGetOptFetchValue(PRTGETOPTSTATE pState, PRTGETOPTUNION pValueUnion, uint32_t fFlags); 360 360 361 /** 362 * Print error messages for a RTGetOpt default case. 363 * 364 * Uses RTMsgError. 365 * 366 * @returns Suitable exit code. 367 * 368 * @param ch The RTGetOpt return value. 369 * @param pValueUnion The value union returned by RTGetOpt. 370 */ 371 RTDECL(int) RTGetOptPrintError(int ch, PCRTGETOPTUNION pValueUnion); 372 361 373 /** @} */ 362 374 -
trunk/src/VBox/Runtime/Makefile.kmk
r24662 r24825 239 239 common/misc/handletablectx.cpp \ 240 240 common/misc/handletablesimple.cpp \ 241 common/misc/message.cpp \ 241 242 common/misc/once.cpp \ 242 243 common/misc/req.cpp \ -
trunk/src/VBox/Runtime/common/misc/getopt.cpp
r24140 r24825 36 36 #include "internal/iprt.h" 37 37 38 #include <iprt/err.h>39 #include <iprt/string.h>40 38 #include <iprt/assert.h> 41 39 #include <iprt/ctype.h> 40 #include <iprt/err.h> 41 #include <iprt/message.h> 42 #include <iprt/string.h> 42 43 #include <iprt/uuid.h> 43 44 … … 640 641 } 641 642 RT_EXPORT_SYMBOL(RTGetOptFetchValue); 643 644 645 RTDECL(int) RTGetOptPrintError(int ch, PCRTGETOPTUNION pValueUnion) 646 { 647 if (ch == VINF_GETOPT_NOT_OPTION) 648 RTMsgError("Invalid parameter: %s", pValueUnion->psz); 649 else if (ch > 0) 650 { 651 if (RT_C_IS_GRAPH(ch)) 652 RTMsgError("Unhandled option: -%c", ch); 653 else 654 RTMsgError("Unhandled option: %i (%#x)", ch, ch); 655 } 656 else if (ch == VERR_GETOPT_UNKNOWN_OPTION) 657 RTMsgError("Unknown option: '%s'", pValueUnion->psz); 658 else if (pValueUnion->pDef) 659 RTMsgError("%s: %Rrs\n", pValueUnion->pDef->pszLong, ch); 660 else 661 RTMsgError("%Rrs\n", ch); 662 663 return 2; /** @todo add defines for EXIT_SUCCESS, EXIT_FAILURE, EXIT_INVAL, etc... */ 664 } 665 RT_EXPORT_SYMBOL(RTGetOptPrintError); 666
Note:
See TracChangeset
for help on using the changeset viewer.

