VirtualBox

Changeset 24825 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Nov 20, 2009 2:41:05 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
55049
Message:

IPRT: Added RTMsgError, RTMsgErrorV and RTGetOptPrintError.

Location:
trunk/src/VBox/Runtime
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/Makefile.kmk

    r24662 r24825  
    239239        common/misc/handletablectx.cpp \
    240240        common/misc/handletablesimple.cpp \
     241        common/misc/message.cpp \
    241242        common/misc/once.cpp \
    242243        common/misc/req.cpp \
  • trunk/src/VBox/Runtime/common/misc/getopt.cpp

    r24140 r24825  
    3636#include "internal/iprt.h"
    3737
    38 #include <iprt/err.h>
    39 #include <iprt/string.h>
    4038#include <iprt/assert.h>
    4139#include <iprt/ctype.h>
     40#include <iprt/err.h>
     41#include <iprt/message.h>
     42#include <iprt/string.h>
    4243#include <iprt/uuid.h>
    4344
     
    640641}
    641642RT_EXPORT_SYMBOL(RTGetOptFetchValue);
     643
     644
     645RTDECL(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}
     665RT_EXPORT_SYMBOL(RTGetOptPrintError);
     666
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette