VirtualBox

Ignore:
Timestamp:
Feb 14, 2010 9:39:00 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57688
Message:

*: RTGetOpt cleanup related to --help and --version (now standard option). Use RTGetOptPrintError.

Location:
trunk/src/VBox/HostDrivers/Support
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/testcase/SUPLoggerCtl.cpp

    r26498 r26517  
    3333*******************************************************************************/
    3434#include <VBox/sup.h>
     35#include <iprt/buildconfig.h>
    3536#include <iprt/initterm.h>
    3637#include <iprt/getopt.h>
     
    7980        { "--what",     'o', RTGETOPT_REQ_STRING },
    8081        { "--which",    'l', RTGETOPT_REQ_STRING },
    81         { "--help",     'h', 0 },
    8282    };
    8383
     
    141141                return usage();
    142142
     143            case 'V':
     144                RTPrintf("%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr());
     145                return 0;
     146
    143147            case VINF_GETOPT_NOT_OPTION:
    144148                RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: Unexpected argument '%s'.\n", Val.psz);
     
    146150
    147151            default:
    148                 if (ch > 0)
    149                 {
    150                     if (RT_C_IS_GRAPH(ch))
    151                         RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: unhandled option: -%c\n", ch);
    152                     else
    153                         RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: unhandled option: %i\n", ch);
    154                 }
    155                 else if (ch == VERR_GETOPT_UNKNOWN_OPTION)
    156                     RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: unknown option: %s\n", Val.psz);
    157                 else if (Val.pDef)
    158                     RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: %s: %Rrs\n", Val.pDef->pszLong, ch);
    159                 else
    160                     RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: %Rrs\n", ch);
    161                 return 1;
     152                return RTGetOptPrintError(ch, &Val);
    162153        }
    163154    }
  • trunk/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp

    r22077 r26517  
    6666    RTGETOPTUNION ValueUnion;
    6767    RTGETOPTSTATE GetState;
    68     RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, 0 /* fFlags */);
     68    RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
    6969    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
    7070    {
     
    8787                break;
    8888
    89             case VINF_GETOPT_NOT_OPTION:
    90                 RTPrintf("tstGIP-2: syntax error: %s\n", ValueUnion.psz);
    91                 return 1;
    92 
    9389            default:
    94                 if (ch < 0)
    95                     RTPrintf("tstGIP-2: %Rrc: %s\n", ch, ValueUnion.psz);
    96                 else
    97                     RTPrintf("tstGIP-2: syntax error: %s\n", ValueUnion.psz);
    98                 return 1;
     90                return RTGetOptPrintError(ch, &ValueUnion);
    9991        }
    10092    }
  • trunk/src/VBox/HostDrivers/Support/testcase/tstSupLoadModule.cpp

    r26498 r26517  
    6161    static const RTGETOPTDEF s_aOptions[] =
    6262    {
    63         { "--help",             'h', 0 }
     63        { "--help",             'h', RTGETOPT_REQ_NOTHING } /* (dummy entry) */
    6464    };
    6565
     
    9696                return 1;
    9797
     98            case 'V':
     99                RTPrintf("$Revision$\n");
     100                return 0;
     101
    98102            default:
    99103                return RTGetOptPrintError(ch, &ValueUnion);
  • trunk/src/VBox/HostDrivers/Support/win/SUPSvc-win.cpp

    r22077 r26517  
    270270    RTGETOPTUNION Value;
    271271    RTGETOPTSTATE GetState;
    272     RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 0, 0 /* fFlags*/);
     272    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
    273273    while ((ch = RTGetOpt(&GetState, &Value)))
    274274        switch (ch)
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