AJA NTV2 SDK
17.1.3.1410
NTV2 SDK 17.1.3.1410
|
#include "ajabase/system/file_io.h"
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "options_popt.h"
#include <float.h>
#include <math.h>
#include <sys/stat.h>
#include <stdarg.h>
Go to the source code of this file.
Classes | |
struct | pbm_set |
union | poptArg_u |
struct | optionStackEntry |
struct | poptContext_s |
struct | columns_s |
struct | poptDone_s |
union | _dbswap |
Macros | |
#define | _isspaceptr(_chp) isspace((int)(*(unsigned char *)(_chp))) |
#define | xmalloc(_size) malloc(_size) |
#define | xcalloc(_nmemb, _size) calloc((_nmemb), (_size)) |
#define | xrealloc(_ptr, _size) realloc((_ptr), (_size)) |
#define | xstrdup(_str) strdup(_str) |
#define | __PBM_NBITS (8 * sizeof (__pbm_bits)) |
#define | __PBM_IX(d) ((d) / __PBM_NBITS) |
#define | __PBM_MASK(d) ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS)) |
#define | __PBM_BITS(set) ((set)->bits) |
#define | PBM_ALLOC(d) calloc(__PBM_IX (d) + 1, sizeof(__pbm_bits)) |
#define | PBM_FREE(s) _free(s); |
#define | PBM_SET(d, s) (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d)) |
#define | PBM_CLR(d, s) (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d)) |
#define | PBM_ISSET(d, s) ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0) |
#define | poptArgType(_opt) ((_opt)->argInfo & _poptArgMask) |
#define | poptGroup(_opt) ((_opt)->argInfo & _poptGroupMask) |
#define | F_ISSET(_opt, _FLAG) ((_opt)->argInfo & POPT_ARGFLAG_##_FLAG) |
#define | LF_ISSET(_FLAG) (argInfo & POPT_ARGFLAG_##_FLAG) |
#define | CBF_ISSET(_opt, _FLAG) ((_opt)->argInfo & POPT_CBFLAG_##_FLAG) |
#define | _POPTHELP_MAXLINE ((size_t)79) |
#define | poptSubstituteHelpI18N(opt) |
#define | _(foo) foo |
#define | D_(dom, str) str |
#define | POPT_(foo) foo |
#define | POPT_WCHAR_HACK |
#define | prtlong (opt->longName != NULL) /* XXX splint needs a clue */ |
#define | prtlong (opt->longName != NULL) /* XXX splint needs a clue */ |
#define | _JLU3_jlu32lpair 1 |
#define | jlu32lpair poptJlu32lpair |
#define | HASH_LITTLE_ENDIAN (endian.uc[0] == (unsigned char) 0x44) |
#define | HASH_BIG_ENDIAN (endian.uc[0] == (unsigned char) 0x11) |
#define | ROTL32(x, s) (((x) << (s)) | ((x) >> (32 - (s)))) |
#define | _JLU3_INIT(_h, _size) (0xdeadbeef + ((uint32_t)(_size)) + (_h)) |
#define | _JLU3_MIX(a, b, c) |
#define | _JLU3_FINAL(a, b, c) |
#define | POPT_ARGV_ARRAY_GROW_DELTA 5 |
#define | POPT_ABS(a) ((((a) - 0.0) < DBL_EPSILON) ? -(a) : (a)) |
Typedefs | |
typedef unsigned int | __pbm_bits |
typedef poptString * | poptArgv |
typedef union poptArg_u | poptArg |
typedef struct columns_s * | columns_t |
typedef struct poptDone_s * | poptDone |
Functions | |
void * | xmalloc (size_t size) |
void * | xcalloc (size_t nmemb, size_t size) |
void * | xrealloc (void *ptr, size_t size) |
char * | xstrdup (const char *str) |
static void * | _free (const void *p) |
void | poptJlu32lpair (const void *key, size_t size, uint32_t *pc, uint32_t *pb) |
int | POPT_fprintf (FILE *stream, const char *format,...) |
const char * | POPT_prev_char (const char *str) |
const char * | POPT_next_char (const char *str) |
static int | poptGlob (poptContext con __attribute__((__unused__)), const char *pattern, int *acp, const char ***avp) |
int | poptSaneFile (const char *fn) |
int | poptReadFile (const char *fn, char **bp, size_t *nbp, int flags) |
static int | configAppMatch (poptContext con, const char *s) |
static int | poptConfigLine (poptContext con, char *line) |
int | poptReadConfigFile (poptContext con, const char *fn) |
int | poptReadConfigFiles (poptContext con, const char *paths) |
int | poptReadDefaultConfig (poptContext con, int useEnv __attribute__((__unused__))) |
poptContext | poptFini (poptContext con) |
poptContext | poptInit (int argc, const char **argv, const struct poptOption *options, const char *configPaths) |
void | displayArgs (poptContext con, enum poptCallbackReason foo __attribute__((__unused__)), struct poptOption *key, const char *arg __attribute__((__unused__)), void *data __attribute__((__unused__))) |
static size_t | maxColumnWidth (FILE *fp) |
static size_t | stringDisplayWidth (const char *s) |
static const char * | getTableTranslationDomain (const struct poptOption *opt) |
static const char * | getArgDescrip (const struct poptOption *opt, const char *translation_domain) |
static char * | singleOptionDefaultValue (size_t lineLength, const struct poptOption *opt, const char *translation_domain) |
static void | singleOptionHelp (FILE *fp, columns_t columns, const struct poptOption *opt, const char *translation_domain) |
static size_t | maxArgWidth (const struct poptOption *opt, const char *translation_domain) |
static void | itemHelp (FILE *fp, poptItem items, int nitems, columns_t columns, const char *translation_domain) |
static void | singleTableHelp (poptContext con, FILE *fp, const struct poptOption *table, columns_t columns, const char *translation_domain) |
static size_t | showHelpIntro (poptContext con, FILE *fp) |
void | poptPrintHelp (poptContext con, FILE *fp, int flags __attribute__((__unused__))) |
static size_t | singleOptionUsage (FILE *fp, columns_t columns, const struct poptOption *opt, const char *translation_domain) |
static size_t | itemUsage (FILE *fp, columns_t columns, poptItem item, int nitems, const char *translation_domain) |
static size_t | singleTableUsage (poptContext con, FILE *fp, columns_t columns, const struct poptOption *opt, const char *translation_domain, poptDone done) |
static size_t | showShortOptions (const struct poptOption *opt, FILE *fp, char *str) |
void | poptPrintUsage (poptContext con, FILE *fp, int flags __attribute__((__unused__))) |
void | poptSetOtherOptionHelp (poptContext con, const char *text) |
int | poptDupArgv (int argc, const char **argv, int *argcPtr, const char ***argvPtr) |
int | poptParseArgvString (const char *s, int *argcPtr, const char ***argvPtr) |
int | poptConfigFileToString (FILE *fp, char **argstrp, int flags __attribute__((__unused__))) |
void | poptSetExecPath (poptContext con, const char *path, int allowAbsolute) |
static void | invokeCallbacksPRE (poptContext con, const struct poptOption *opt) |
static void | invokeCallbacksPOST (poptContext con, const struct poptOption *opt) |
static void | invokeCallbacksOPTION (poptContext con, const struct poptOption *opt, const struct poptOption *myOpt, const void *myData, int shorty) |
poptContext | poptGetContext (const char *name, int argc, const char **argv, const struct poptOption *options, unsigned int flags) |
static void | cleanOSE (struct optionStackEntry *os) |
void | poptResetContext (poptContext con) |
static int | handleExec (poptContext con, const char *longName, char shortName) |
static int | longOptionStrcmp (const struct poptOption *opt, const char *longName, size_t longNameLen) |
static int | handleAlias (poptContext con, const char *longName, size_t longNameLen, char shortName, const char *nextArg) |
static const char * | findProgramPath (const char *argv0) |
static int | execCommand (poptContext con) |
static const struct poptOption * | findOption (const struct poptOption *opt, const char *longName, size_t longNameLen, char shortName, poptCallbackType *callback, const void **callbackData, unsigned int argInfo) |
static const char * | findNextArg (poptContext con, unsigned argx, int delete_arg) |
static const char * | expandNextArg (poptContext con, const char *s) |
static void | poptStripArg (poptContext con, int which) |
static int | _poptBitsNew (poptBits *bitsp) |
int | poptBitsAdd (poptBits bits, const char *s) |
int | poptBitsChk (poptBits bits, const char *s) |
int | poptBitsClr (poptBits bits) |
int | poptBitsDel (poptBits bits, const char *s) |
int | poptBitsIntersect (poptBits *ap, const poptBits b) |
int | poptBitsUnion (poptBits *ap, const poptBits b) |
int | poptBitsArgs (poptContext con, poptBits *ap) |
int | poptSaveBits (poptBits *bitsp, unsigned int argInfo __attribute__((__unused__)), const char *s) |
int | poptSaveString (const char ***argvp, unsigned int argInfo __attribute__((__unused__)), const char *val) |
int | poptSaveLongLong (long long *arg, unsigned int argInfo, long long aLongLong) |
int | poptSaveLong (long *arg, unsigned int argInfo, long aLong) |
int | poptSaveInt (int *arg, unsigned int argInfo, long aLong) |
int | poptSaveShort (short *arg, unsigned int argInfo, long aLong) |
static unsigned int | poptArgInfo (poptContext con, const struct poptOption *opt) |
static int | poptParseInteger (long long *llp, unsigned int argInfo __attribute__((__unused__)), const char *val) |
static int | poptSaveArg (poptContext con, const struct poptOption *opt) |
int | poptGetNextOpt (poptContext con) |
char * | poptGetOptArg (poptContext con) |
const char * | poptGetArg (poptContext con) |
const char * | poptPeekArg (poptContext con) |
const char ** | poptGetArgs (poptContext con) |
static poptItem | poptFreeItems (poptItem items, int nitems) |
poptContext | poptFreeContext (poptContext con) |
int | poptAddAlias (poptContext con, struct poptAlias alias, int flags __attribute__((__unused__))) |
int | poptAddItem (poptContext con, poptItem newItem, int flags) |
const char * | poptBadOption (poptContext con, unsigned int flags) |
const char * | poptStrerror (const int error) |
int | poptStuffArgs (poptContext con, const char **argv) |
const char * | poptGetInvocationName (poptContext con) |
int | poptStrippedArgv (poptContext con, int argc, char **argv) |
Variables | |
const typedef char * | poptString |
unsigned int | _poptArgMask = 0x000000FFU |
unsigned int | _poptGroupMask = 0x0000FF00U |
static struct poptOption | poptHelpOptions [] |
struct poptOption * | poptHelpOptionsAutoHelp = poptHelpOptions |
static struct poptOption | poptHelpOptions2 [] |
struct poptOption * | poptHelpOptionsI18N = poptHelpOptions2 |
struct poptOption | poptAliasOptions [] |
static const union _dbswap | endian = { 0x11223344 } |
static const unsigned char | utf8_skip_data [256] |
unsigned int | _poptBitsN = 1024U |
unsigned int | _poptBitsM = ((3U * 1024U ) / 2U) |
unsigned int | _poptBitsK = 16U |
#define _ | ( | foo | ) | foo |
Definition at line 320 of file options_popt.cpp.
#define __PBM_BITS | ( | set | ) | ((set)->bits) |
Definition at line 204 of file options_popt.cpp.
#define __PBM_IX | ( | d | ) | ((d) / __PBM_NBITS) |
Definition at line 199 of file options_popt.cpp.
#define __PBM_MASK | ( | d | ) | ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS)) |
Definition at line 200 of file options_popt.cpp.
#define __PBM_NBITS (8 * sizeof (__pbm_bits)) |
Definition at line 198 of file options_popt.cpp.
#define _isspaceptr | ( | _chp | ) | isspace((int)(*(unsigned char *)(_chp))) |
Definition at line 149 of file options_popt.cpp.
#define _JLU3_FINAL | ( | a, | |
b, | |||
c | |||
) |
_JLU3_FINAL – final mixing of 3 32-bit values (a,b,c) into c
Pairs of (a,b,c) values differing in only a few bits will usually produce values of c that look totally different. This was tested for
These constants passed: 14 11 25 16 4 14 24 12 14 25 16 4 14 24 and these came close: 4 8 15 26 3 22 24 10 8 15 26 3 22 24 11 8 15 26 3 22 24
Definition at line 1665 of file options_popt.cpp.
#define _JLU3_INIT | ( | _h, | |
_size | |||
) | (0xdeadbeef + ((uint32_t)(_size)) + (_h)) |
Definition at line 1584 of file options_popt.cpp.
#define _JLU3_jlu32lpair 1 |
Definition at line 1530 of file options_popt.cpp.
#define _JLU3_MIX | ( | a, | |
b, | |||
c | |||
) |
#define _POPTHELP_MAXLINE ((size_t)79) |
Auto help table options.
Definition at line 250 of file options_popt.cpp.
#define CBF_ISSET | ( | _opt, | |
_FLAG | |||
) | ((_opt)->argInfo & POPT_CBFLAG_##_FLAG) |
Definition at line 245 of file options_popt.cpp.
#define D_ | ( | dom, | |
str | |||
) | str |
Definition at line 322 of file options_popt.cpp.
#define F_ISSET | ( | _opt, | |
_FLAG | |||
) | ((_opt)->argInfo & POPT_ARGFLAG_##_FLAG) |
Definition at line 243 of file options_popt.cpp.
#define HASH_BIG_ENDIAN (endian.uc[0] == (unsigned char) 0x11) |
Definition at line 1577 of file options_popt.cpp.
#define HASH_LITTLE_ENDIAN (endian.uc[0] == (unsigned char) 0x44) |
Definition at line 1576 of file options_popt.cpp.
#define jlu32lpair poptJlu32lpair |
Definition at line 1531 of file options_popt.cpp.
#define LF_ISSET | ( | _FLAG | ) | (argInfo & POPT_ARGFLAG_##_FLAG) |
Definition at line 244 of file options_popt.cpp.
#define PBM_ALLOC | ( | d | ) | calloc(__PBM_IX (d) + 1, sizeof(__pbm_bits)) |
Definition at line 206 of file options_popt.cpp.
#define PBM_CLR | ( | d, | |
s | |||
) | (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d)) |
Definition at line 209 of file options_popt.cpp.
#define PBM_FREE | ( | s | ) | _free(s); |
Definition at line 207 of file options_popt.cpp.
#define PBM_ISSET | ( | d, | |
s | |||
) | ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0) |
Definition at line 210 of file options_popt.cpp.
#define PBM_SET | ( | d, | |
s | |||
) | (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d)) |
Definition at line 208 of file options_popt.cpp.
#define POPT_ | ( | foo | ) | foo |
Definition at line 323 of file options_popt.cpp.
#define POPT_ABS | ( | a | ) | ((((a) - 0.0) < DBL_EPSILON) ? -(a) : (a)) |
#define POPT_ARGV_ARRAY_GROW_DELTA 5 |
Definition at line 1937 of file options_popt.cpp.
#define POPT_WCHAR_HACK |
Definition at line 745 of file options_popt.cpp.
#define poptArgType | ( | _opt | ) | ((_opt)->argInfo & _poptArgMask) |
Definition at line 240 of file options_popt.cpp.
#define poptGroup | ( | _opt | ) | ((_opt)->argInfo & _poptGroupMask) |
Definition at line 241 of file options_popt.cpp.
#define poptSubstituteHelpI18N | ( | opt | ) |
Definition at line 272 of file options_popt.cpp.
#define prtlong (opt->longName != NULL) /* XXX splint needs a clue */ |
#define prtlong (opt->longName != NULL) /* XXX splint needs a clue */ |
#define ROTL32 | ( | x, | |
s | |||
) | (((x) << (s)) | ((x) >> (32 - (s)))) |
Definition at line 1580 of file options_popt.cpp.
#define xcalloc | ( | _nmemb, | |
_size | |||
) | calloc((_nmemb), (_size)) |
Definition at line 169 of file options_popt.cpp.
#define xmalloc | ( | _size | ) | malloc(_size) |
Definition at line 168 of file options_popt.cpp.
#define xrealloc | ( | _ptr, | |
_size | |||
) | realloc((_ptr), (_size)) |
Definition at line 170 of file options_popt.cpp.
#define xstrdup | ( | _str | ) | strdup(_str) |
Definition at line 171 of file options_popt.cpp.
typedef unsigned int __pbm_bits |
Definition at line 197 of file options_popt.cpp.
typedef poptString* poptArgv |
Definition at line 219 of file options_popt.cpp.
typedef struct poptDone_s * poptDone |
Keep track of option tables already processed.
|
inlinestatic |
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
p | memory to free |
NULL | always |
Definition at line 190 of file options_popt.cpp.
|
static |
< opt->arg should not be NULL
Definition at line 2767 of file options_popt.cpp.
|
static |
Definition at line 2303 of file options_popt.cpp.
|
static |
Check for application match.
con | context |
s | config application name return 0 if config application matches |
Definition at line 448 of file options_popt.cpp.
void displayArgs | ( | poptContext | con, |
enum poptCallbackReason foo | __attribute__(__unused__), | ||
struct poptOption * | key, | ||
const char *arg | __attribute__(__unused__), | ||
void *data | __attribute__(__unused__) | ||
) |
Display arguments.
con | context |
foo | (unused) |
key | option(s) |
arg | (unused) |
data | (unused) |
Definition at line 760 of file options_popt.cpp.
|
static |
< errno set, use strerror(errno)
< missing argument
< missing argument
< memory allocation failed
< missing argument
Definition at line 2549 of file options_popt.cpp.
|
static |
Definition at line 2709 of file options_popt.cpp.
|
static |
Definition at line 2676 of file options_popt.cpp.
|
static |
< allow -longoption
< arg points to table
< table-wide callback... must be set first in table; arg points to callback, descrip points to callback data to pass
< allow -longoption
< allow -longoption
< use data from the include line, not the subtable
Definition at line 2610 of file options_popt.cpp.
|
static |
Return absolute path to executable by searching PATH.
argv0 | name of executable |
Definition at line 2510 of file options_popt.cpp.
|
static |
opt | option(s) |
translation_domain | translation domain |
< EXPERIMENTAL: return (*arg) (argc, argv)
< dupe'd arg appended to realloc'd argv array.
< no arg
< arg should take value val
< arg ==> int
< arg ==> short
< arg ==> long
< arg ==> long long
< arg will be saved as string
< arg ==> float
< arg ==> double
< EXPERIMENTAL: return (*arg) (argc, argv)
< dupe'd arg appended to realloc'd argv array.
Definition at line 834 of file options_popt.cpp.
|
static |
opt | option(s) |
< set the translation domain for this table and any included tables; arg points to the domain string
Definition at line 819 of file options_popt.cpp.
|
static |
< aliases nested too deeply
Definition at line 2434 of file options_popt.cpp.
|
static |
< ignore exec expansions
Definition at line 2340 of file options_popt.cpp.
|
static |
< arg points to table
< table-wide callback... must be set first in table; arg points to callback, descrip points to callback data to pass
< don't callback with option
< continue callbacks with option
Definition at line 2220 of file options_popt.cpp.
|
static |
< arg points to table
< table-wide callback... must be set first in table; arg points to callback, descrip points to callback data to pass
< call the callback after parse
Definition at line 2199 of file options_popt.cpp.
|
static |
< arg points to table
< table-wide callback... must be set first in table; arg points to callback, descrip points to callback data to pass
< call the callback before parse
Definition at line 2178 of file options_popt.cpp.
|
static |
Display popt alias and exec help.
fp | output file handle |
items | alias/exec array |
nitems | no. of alias/exec entries |
columns | output display width control |
translation_domain | translation domain |
< don't show in help/usage
Definition at line 1187 of file options_popt.cpp.
|
static |
Display popt alias and exec usage.
fp | output file handle |
columns | output display width control |
item | alias/exec array |
nitems | no. of ara/exec entries |
translation_domain | translation domain |
< set the translation domain for this table and any included tables; arg points to the domain string
< don't show in help/usage
Definition at line 1361 of file options_popt.cpp.
|
static |
Compare long option for equality, adjusting for POPT_ARGFLAG_TOGGLE.
opt | option |
longName | arg option |
longNameLen | arg option length |
< permit –[no]opt prefix toggle
Definition at line 2403 of file options_popt.cpp.
|
static |
Find display width for longest argument string.
opt | option(s) |
translation_domain | translation domain |
< arg points to table
< don't show in help/usage
< allow -longoption
< arg may be missing
Definition at line 1137 of file options_popt.cpp.
|
static |
Return no. of columns in output window.
fp | FILE |
Definition at line 791 of file options_popt.cpp.
int POPT_fprintf | ( | FILE * | stream, |
const char * | format, | ||
... | |||
) |
Definition at line 1895 of file options_popt.cpp.
const char * POPT_next_char | ( | const char * | str | ) |
Definition at line 1880 of file options_popt.cpp.
const char * POPT_prev_char | ( | const char * | str | ) |
Definition at line 1868 of file options_popt.cpp.
int poptAddAlias | ( | poptContext | con, |
struct poptAlias | alias, | ||
int flags | __attribute__(__unused__) | ||
) |
< don't show in help/usage
Definition at line 3562 of file options_popt.cpp.
int poptAddItem | ( | poptContext | con, |
poptItem | newItem, | ||
int | flags | ||
) |
Add alias/exec item to context.
con | context |
newItem | alias/exec item to add |
flags | 0 for alias, 1 for exec |
Definition at line 3580 of file options_popt.cpp.
|
static |
Return argInfo field, handling POPT_ARGFLAG_TOGGLE overrides.
con | context |
opt | option |
< permit –[no]opt prefix toggle
< arg will be xor'ed
< arg will be or'ed
< arg will be and'ed
< arg will be xor'ed
< arg will be or'ed
< arg will be and'ed
< arg will be negated
Definition at line 3082 of file options_popt.cpp.
const char* poptBadOption | ( | poptContext | con, |
unsigned int | flags | ||
) |
Return the option which caused the most recent error.
con | context |
flags | option flags |
< don't go into an alias
Definition at line 3623 of file options_popt.cpp.
int poptBitsAdd | ( | poptBits | bits, |
const char * | s | ||
) |
< opt->arg should not be NULL
Definition at line 2785 of file options_popt.cpp.
int poptBitsArgs | ( | poptContext | con, |
poptBits * | ap | ||
) |
< opt->arg should not be NULL
Definition at line 2897 of file options_popt.cpp.
int poptBitsChk | ( | poptBits | bits, |
const char * | s | ||
) |
< opt->arg should not be NULL
Definition at line 2804 of file options_popt.cpp.
int poptBitsClr | ( | poptBits | bits | ) |
< opt->arg should not be NULL
Definition at line 2827 of file options_popt.cpp.
int poptBitsDel | ( | poptBits | bits, |
const char * | s | ||
) |
< opt->arg should not be NULL
Definition at line 2838 of file options_popt.cpp.
< opt->arg should not be NULL
Definition at line 2857 of file options_popt.cpp.
< opt->arg should not be NULL
Definition at line 2877 of file options_popt.cpp.
int poptConfigFileToString | ( | FILE * | fp, |
char ** | argstrp, | ||
int flags | __attribute__(__unused__) | ||
) |
< opt->arg should not be NULL
< memory allocation failed
< number too large or too small
< memory allocation failed
< memory allocation failed
Definition at line 2056 of file options_popt.cpp.
|
static |
< config file failed sanity test
< don't show in help/usage
< don't show in help/usage
< don't show in help/usage
< arg will be saved as string
Definition at line 459 of file options_popt.cpp.
int poptDupArgv | ( | int | argc, |
const char ** | argv, | ||
int * | argcPtr, | ||
const char *** | argvPtr | ||
) |
Duplicate an argument array.
argc | no. of arguments |
argv | argument array |
argcPtr | address of returned no. of arguments |
argvPtr | address of returned argument array |
< missing argument
< missing argument
< memory allocation failed
Definition at line 1939 of file options_popt.cpp.
poptContext poptFini | ( | poptContext | con | ) |
Destroy context (alternative implementation).
con | context |
Definition at line 714 of file options_popt.cpp.
poptContext poptFreeContext | ( | poptContext | con | ) |
Destroy context.
con | context |
Definition at line 3539 of file options_popt.cpp.
Definition at line 3523 of file options_popt.cpp.
const char* poptGetArg | ( | poptContext | con | ) |
Return next argument.
con | context |
Definition at line 3494 of file options_popt.cpp.
const char** poptGetArgs | ( | poptContext | con | ) |
Return remaining arguments.
con | context |
Definition at line 3510 of file options_popt.cpp.
poptContext poptGetContext | ( | const char * | name, |
int | argc, | ||
const char ** | argv, | ||
const struct poptOption * | options, | ||
unsigned int | flags | ||
) |
Initialize popt context.
name | context name (usually argv[0] program name) |
argc | no. of arguments |
argv | argument array |
options | address of popt option table |
flags | or'd POPT_CONTEXT_* bits |
< pay attention to argv[0]
< options can't follow args
Definition at line 2264 of file options_popt.cpp.
const char* poptGetInvocationName | ( | poptContext | con | ) |
Return argv[0] from context.
con | context |
Definition at line 3686 of file options_popt.cpp.
int poptGetNextOpt | ( | poptContext | con | ) |
Return value of next option found.
con | context |
< unknown option
< options can't follow args
< return args as options with value 0
< unknown option
< allow -longoption
< allow -longoption
< unknown option
< strip this arg from argv(only applies to long args)
< unknown option
< unknown option
< no arg
< mutually exclusive logical operations requested
< arg should take value val
< mutually exclusive logical operations requested
< no arg
< arg may be missing
< missing argument
< strip this arg from argv(only applies to long args)
< arg may be missing
< arg should take value val
< allow -longoption
< no arg
< arg should take value val
< no arg
Definition at line 3236 of file options_popt.cpp.
char* poptGetOptArg | ( | poptContext | con | ) |
Return next option argument (if any).
con | context |
Definition at line 3484 of file options_popt.cpp.
|
static |
Return path(s) from a glob pattern.
con | context |
pattern | glob pattern |
*acp | no. of paths |
*avp | array of paths |
Definition at line 341 of file options_popt.cpp.
poptContext poptInit | ( | int | argc, |
const char ** | argv, | ||
const struct poptOption * | options, | ||
const char * | configPaths | ||
) |
Initialize popt context (alternative implementation). This routine does poptGetContext() and then poptReadConfigFiles().
argc | no. of arguments |
argv | argument array |
options | address of popt option table |
configPaths | colon separated file path(s) to read. |
Definition at line 720 of file options_popt.cpp.
void poptJlu32lpair | ( | const void * | key, |
size_t | size, | ||
uint32_t * | pc, | ||
uint32_t * | pb | ||
) |
jlu32lpair: return 2 32-bit hash values.
This is identical to jlu32l(), except it returns two 32-bit hash values instead of just one. This is good enough for hash table lookup with 2^^64 buckets, or if you want a second hash if you're not happy with the first, or if you want a probably-unique 64-bit ID for the key. *pc is better mixed than *pb, so use *pc first. If you want a 64-bit value do something like "*pc + (((uint64_t)*pb)<<32)".
h | the previous hash, or an arbitrary value |
*key | the key, an array of uint8_t values |
size | the size of the key in bytes |
*pc,IN | primary initval, OUT: primary hash *retval *pb IN: secondary initval, OUT: secondary hash |
Definition at line 1693 of file options_popt.cpp.
int poptParseArgvString | ( | const char * | s, |
int * | argcPtr, | ||
const char *** | argvPtr | ||
) |
Parse a string into an argument array. The parse allows ', ", and \ quoting, but ' is treated the same as " and both may include \ quotes.
s | string to parse |
argcPtr | address of returned no. of arguments |
argvPtr | address of returned argument array |
< memory allocation failed
< error in paramter quoting
< error in paramter quoting
Definition at line 1980 of file options_popt.cpp.
|
static |
Parse an integer expression.
*llp | integer expression value |
argInfo | integer expression type |
val | integer expression string |
< invalid numeric value
Definition at line 3111 of file options_popt.cpp.
const char* poptPeekArg | ( | poptContext | con | ) |
Peek at current argument.
con | context |
Definition at line 3502 of file options_popt.cpp.
void poptPrintHelp | ( | poptContext | con, |
FILE * | fp, | ||
int flags | __attribute__(__unused__) | ||
) |
Definition at line 1272 of file options_popt.cpp.
void poptPrintUsage | ( | poptContext | con, |
FILE * | fp, | ||
int flags | __attribute__(__unused__) | ||
) |
Definition at line 1480 of file options_popt.cpp.
int poptReadConfigFile | ( | poptContext | con, |
const char * | fn | ||
) |
Read configuration file.
con | context |
fn | file name to read |
< config file failed sanity test
Definition at line 579 of file options_popt.cpp.
int poptReadConfigFiles | ( | poptContext | con, |
const char * | paths | ||
) |
Read configuration file(s). Colon separated files to read, looping over poptReadConfigFile(). Note that an '@' character preceeding a path in the list will also perform additional sanity checks on the file before reading.
con | context |
paths | colon separated file name(s) to read |
< config file failed sanity test
Definition at line 629 of file options_popt.cpp.
int poptReadDefaultConfig | ( | poptContext | con, |
int useEnv | __attribute__(__unused__) | ||
) |
< errno set, use strerror(errno)
Definition at line 681 of file options_popt.cpp.
int poptReadFile | ( | const char * | fn, |
char ** | bp, | ||
size_t * | nbp, | ||
int | flags | ||
) |
Read a file into a buffer.
fn | file name |
*bp | buffer (malloc'd) (or NULL) |
*nbp | no. of bytes in buffer (including final NUL) (or NULL) |
flags | 1 to trim escaped newlines return 0 on success |
< errno set, use strerror(errno)
< memory allocation failed
Definition at line 377 of file options_popt.cpp.
void poptResetContext | ( | poptContext | con | ) |
int poptSaneFile | ( | const char * | fn | ) |
Perform sanity checks on a file path.
fn | file name |
Definition at line 361 of file options_popt.cpp.
|
static |
Save the option argument through the (*opt->arg) pointer.
con | context |
opt | option |
< arg ==> bit set
< dupe'd arg appended to realloc'd argv array.
< arg will be saved as string
< arg ==> int
< arg ==> short
< arg ==> long
< arg ==> long long
< arg ==> long long
< number too large or too small
< arg ==> long
< number too large or too small
< arg ==> int
< number too large or too small
< arg ==> short
< number too large or too small
< arg ==> float
< arg ==> double
< number too large or too small
< invalid numeric value
< arg ==> double
< arg ==> float
< number too large or too small
< EXPERIMENTAL: return (*arg) (argc, argv)
Definition at line 3134 of file options_popt.cpp.
int poptSaveBits | ( | poptBits * | bitsp, |
unsigned int argInfo | __attribute__(__unused__), | ||
const char * | s | ||
) |
< opt->arg should not be NULL
Definition at line 2916 of file options_popt.cpp.
int poptSaveInt | ( | int * | arg, |
unsigned int | argInfo, | ||
long | aLong | ||
) |
Save an integer, performing logical operation with value.
arg | integer pointer, aligned on int boundary. |
argInfo | logical operation (see POPT_ARGFLAG_*) |
aLong | value to use |
< opt->arg should not be NULL
< random value in [1,arg]
< mutually exclusive logical operations requested
< arg will be negated
< arg will be or'ed
< arg will be and'ed
< arg will be xor'ed
< arg will be or'ed
< arg will be and'ed
< arg will be xor'ed
< mutually exclusive logical operations requested
Definition at line 3025 of file options_popt.cpp.
int poptSaveLong | ( | long * | arg, |
unsigned int | argInfo, | ||
long | aLong | ||
) |
Save a long, performing logical operation with value.
arg | integer pointer, aligned on int boundary. |
argInfo | logical operation (see POPT_ARGFLAG_*) |
aLong | value to use |
< opt->arg should not be NULL
< random value in [1,arg]
< mutually exclusive logical operations requested
< arg will be negated
< arg will be or'ed
< arg will be and'ed
< arg will be xor'ed
< arg will be or'ed
< arg will be and'ed
< arg will be xor'ed
< mutually exclusive logical operations requested
Definition at line 3001 of file options_popt.cpp.
int poptSaveLongLong | ( | long long * | arg, |
unsigned int | argInfo, | ||
long long | aLongLong | ||
) |
Save a long long, performing logical operation with value.
arg | integer pointer, aligned on int boundary. |
argInfo | logical operation (see POPT_ARGFLAG_*) |
aLongLong | value to use |
< opt->arg should not be NULL
< random value in [1,arg]
< mutually exclusive logical operations requested
< arg will be negated
< arg will be or'ed
< arg will be and'ed
< arg will be xor'ed
< arg will be or'ed
< arg will be and'ed
< arg will be xor'ed
< mutually exclusive logical operations requested
Definition at line 2970 of file options_popt.cpp.
int poptSaveShort | ( | short * | arg, |
unsigned int | argInfo, | ||
long | aLong | ||
) |
Save a short integer, performing logical operation with value.
arg | short pointer, aligned on short boundary. |
argInfo | logical operation (see POPT_ARGFLAG_*) |
aLong | value to use |
< opt->arg should not be NULL
< random value in [1,arg]
< mutually exclusive logical operations requested
< arg will be negated
< arg will be or'ed
< arg will be and'ed
< arg will be xor'ed
< arg will be or'ed
< arg will be and'ed
< arg will be xor'ed
< mutually exclusive logical operations requested
Definition at line 3049 of file options_popt.cpp.
int poptSaveString | ( | const char *** | argvp, |
unsigned int argInfo | __attribute__(__unused__), | ||
const char * | val | ||
) |
< opt->arg should not be NULL
Definition at line 2950 of file options_popt.cpp.
void poptSetExecPath | ( | poptContext | con, |
const char * | path, | ||
int | allowAbsolute | ||
) |
Limit search for executables.
con | context |
path | single path to search for executables |
allowAbsolute | absolute paths only? |
Definition at line 2170 of file options_popt.cpp.
void poptSetOtherOptionHelp | ( | poptContext | con, |
const char * | text | ||
) |
Provide text to replace default "[OPTION...]" in help/usage output.
con | context |
text | replacement text |
Definition at line 1515 of file options_popt.cpp.
const char* poptStrerror | ( | const int | error | ) |
Return formatted error string for popt failure.
error | popt error |
< missing argument
< unknown option
< mutually exclusive logical operations requested
< opt->arg should not be NULL
< aliases nested too deeply
< error in paramter quoting
< invalid numeric value
< number too large or too small
< memory allocation failed
< config file failed sanity test
< errno set, use strerror(errno)
Definition at line 3633 of file options_popt.cpp.
|
static |
Definition at line 2754 of file options_popt.cpp.
int poptStrippedArgv | ( | poptContext | con, |
int | argc, | ||
char ** | argv | ||
) |
Shuffle argv pointers to remove stripped args, returns new argc.
con | context |
argc | no. of args |
argv | arg vector |
Definition at line 3691 of file options_popt.cpp.
int poptStuffArgs | ( | poptContext | con, |
const char ** | argv | ||
) |
Add arguments to context.
con | context |
argv | argument array, NULL terminated |
< aliases nested too deeply
Definition at line 3663 of file options_popt.cpp.
|
static |
con | context |
fp | output file handle |
< pay attention to argv[0]
Definition at line 1254 of file options_popt.cpp.
|
static |
Return concatenated short options for display.
opt | option(s) |
fp | output file handle |
str | concatenation of short options |
< don't show in help/usage
< arg points to table
Definition at line 1446 of file options_popt.cpp.
|
static |
Display default value for an option.
lineLength | display positions remaining |
opt | option(s) |
translation_domain | translation domain |
< arg should take value val
< arg ==> int
< arg ==> short
< arg ==> long
< arg ==> long long
< arg ==> float
< arg ==> double
< EXPERIMENTAL: return (*arg) (argc, argv)
< dupe'd arg appended to realloc'd argv array.
< arg will be saved as string
< no arg
Definition at line 884 of file options_popt.cpp.
|
static |
Display help text for an option.
fp | output file handle |
columns | output display width control |
opt | option(s) |
translation_domain | translation domain |
< permit –[no]opt prefix toggle
< allow -longoption
< EXPERIMENTAL: return (*arg) (argc, argv)
< allow -longoption
< permit –[no]opt prefix toggle
< arg may be missing
< show default value in –help
< no arg
< arg should take value val
< arg ==> int
< arg ==> short
< arg ==> long
< arg ==> long long
< arg ==> float
< arg ==> double
< arg will be saved as string
< EXPERIMENTAL: return (*arg) (argc, argv)
< dupe'd arg appended to realloc'd argv array.
< arg may be missing
Definition at line 962 of file options_popt.cpp.
|
static |
Display usage text for an option.
fp | output file handle |
columns | output display width control |
opt | option(s) |
translation_domain | translation domain |
< allow -longoption
< allow -longoption
Definition at line 1297 of file options_popt.cpp.
|
static |
Display help text for a table of options.
con | context |
fp | output file handle |
table | option(s) |
columns | output display width control |
translation_domain | translation domain |
< don't show in help/usage
< arg points to table
Definition at line 1212 of file options_popt.cpp.
|
static |
Display usage text for a table of options.
con | context |
fp | output file handle |
columns | output display width control |
opt | option(s) |
translation_domain | translation domain |
done | tables already processed |
< set the translation domain for this table and any included tables; arg points to the domain string
< arg points to table
< don't show in help/usage
Definition at line 1401 of file options_popt.cpp.
|
inlinestatic |
Determine number of display characters in a string.
s | string |
Definition at line 802 of file options_popt.cpp.
void* xcalloc | ( | size_t | nmemb, |
size_t | size | ||
) |
void* xmalloc | ( | size_t | size | ) |
void* xrealloc | ( | void * | ptr, |
size_t | size | ||
) |
char* xstrdup | ( | const char * | str | ) |
unsigned int _poptArgMask = 0x000000FFU |
Definition at line 2167 of file options_popt.cpp.
unsigned int _poptBitsK = 16U |
Definition at line 2765 of file options_popt.cpp.
unsigned int _poptBitsM = ((3U * 1024U ) / 2U) |
Definition at line 2764 of file options_popt.cpp.
unsigned int _poptBitsN = 1024U |
Definition at line 2763 of file options_popt.cpp.
unsigned int _poptGroupMask = 0x0000FF00U |
Definition at line 2168 of file options_popt.cpp.
|
static |
struct poptOption poptAliasOptions[] |
|
static |
Definition at line 252 of file options_popt.cpp.
|
static |
Definition at line 261 of file options_popt.cpp.
struct poptOption* poptHelpOptionsAutoHelp = poptHelpOptions |
Definition at line 258 of file options_popt.cpp.
struct poptOption* poptHelpOptionsI18N = poptHelpOptions2 |
Definition at line 270 of file options_popt.cpp.
const typedef char* poptString |
Typedef's for string and array of strings.
Definition at line 218 of file options_popt.cpp.
|
static |
Definition at line 1856 of file options_popt.cpp.