~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to include/iprt/getopt.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
#define RTGETOPT_REQ_MACADDR                    14
84
84
/** The value must be a valid UUID. */
85
85
#define RTGETOPT_REQ_UUID                       15
 
86
/** The value must be a string with value as "on" or "off". */
 
87
#define RTGETOPT_REQ_BOOL_ONOFF                 16
86
88
/** The mask of the valid required types. */
87
 
#define RTGETOPT_REQ_MASK                       15
 
89
#define RTGETOPT_REQ_MASK                       31
88
90
/** Treat the value as hexadecimal - only applicable with the RTGETOPT_REQ_*INT*. */
89
91
#define RTGETOPT_FLAG_HEX                       RT_BIT(16)
90
92
/** Treat the value as octal - only applicable with the RTGETOPT_REQ_*INT*. */
91
93
#define RTGETOPT_FLAG_OCT                       RT_BIT(17)
92
94
/** Treat the value as decimal - only applicable with the RTGETOPT_REQ_*INT*. */
93
95
#define RTGETOPT_FLAG_DEC                       RT_BIT(18)
 
96
/** The index value is attached to the argument - only valid for long arguments. */
 
97
#define RTGETOPT_FLAG_INDEX                     RT_BIT(19)
94
98
/** Mask of valid bits - for validation. */
95
 
#define RTGETOPT_VALID_MASK                     ( RTGETOPT_REQ_MASK | RTGETOPT_FLAG_HEX | RTGETOPT_FLAG_OCT | RTGETOPT_FLAG_DEC )
 
99
#define RTGETOPT_VALID_MASK                     (  RTGETOPT_REQ_MASK \
 
100
                                                 | RTGETOPT_FLAG_HEX \
 
101
                                                 | RTGETOPT_FLAG_OCT \
 
102
                                                 | RTGETOPT_FLAG_DEC \
 
103
                                                 | RTGETOPT_FLAG_INDEX)
96
104
/** @} */
97
105
 
98
106
/**
165
173
    int64_t         i;
166
174
    /** An unsigned integer value. */
167
175
    uint64_t        u;
 
176
    /** A boolean flag. */
 
177
    bool            f;
168
178
} RTGETOPTUNION;
169
179
/** Pointer to an option argument union. */
170
180
typedef RTGETOPTUNION *PRTGETOPTUNION;
192
202
    const char     *pszNextShort;
193
203
    /** The option definition which matched. NULL otherwise. */
194
204
    PCRTGETOPTDEF   pDef;
 
205
    /** The index of an index option, otherwise UINT64_MAX. */
 
206
    uint64_t        uIndex;
195
207
    /* More members will be added later for dealing with initial
196
208
       call, optional sorting, '--' and so on. */
197
209
} RTGETOPTSTATE;
322
334
 */
323
335
RTDECL(int) RTGetOpt(PRTGETOPTSTATE pState, PRTGETOPTUNION pValueUnion);
324
336
 
 
337
/**
 
338
 * Fetch an additional value.
 
339
 *
 
340
 * This is used for special cases where an option have more than one value.
 
341
 *
 
342
 *
 
343
 * @returns VINF_SUCCESS on success.
 
344
 * @returns IPRT error status on parse error.
 
345
 * @returns VERR_INVALID_PARAMETER if the flags are wrong.
 
346
 * @returns VERR_GETOPT_UNKNOWN_OPTION when pState->pDef is null.
 
347
 * @returns VERR_GETOPT_REQUIRED_ARGUMENT_MISSING if there are no more
 
348
 *          available arguments. pValueUnion->pDef is NULL.
 
349
 * @returns VERR_GETOPT_INVALID_ARGUMENT_FORMAT and pValueUnion->pDef if
 
350
 *          value conversion failed.
 
351
 *
 
352
 * @param   pState      The state previously initialized with RTGetOptInit.
 
353
 * @param   pValueUnion Union with value; in the event of an error, psz member
 
354
 *                      points to erroneous parameter; otherwise, for options
 
355
 *                      that require an argument, this contains the value of
 
356
 *                      that argument, depending on the type that is required.
 
357
 * @param   fFlags      The flags.
 
358
 */
 
359
RTDECL(int) RTGetOptFetchValue(PRTGETOPTSTATE pState, PRTGETOPTUNION pValueUnion, uint32_t fFlags);
 
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
 
325
373
/** @} */
326
374
 
327
375
RT_C_DECLS_END