99 #define OPTS_NO_SHORT 0 104 #define OPTS_RVAL_ERROR '?' 105 #define OPTS_RVAL_LOG 'l'
106 #define OPTS_RVAL_LONG (CHAR_MAX + 1)
107 #define OPTS_RVAL_HELP (OPTS_RVAL_LONG)
108 #define OPTS_RVAL_VERSION (OPTS_RVAL_LONG + 1)
109 #define OPTS_RVAL_LOGFILE (OPTS_RVAL_LONG + 2)
110 #define OPTS_RVAL_LOGNOCOLOR (OPTS_RVAL_LONG + 3)
111 #define OPTS_RVAL_LOGNOTIME (OPTS_RVAL_LONG + 4)
112 #define OPTS_RVAL_USER (OPTS_RVAL_LONG + 5)
119 char *optarg,
void *pOptVal);
124 typedef char *(*OptsFmtFunc_T)(
char *buf,
size_t buflen,
void *pOptVal);
263 #define OPTSBADARG(argv0, opt, arg) \ 264 OptsInvalid(argv0, "Invalid '%s' argument to '%s' option.", arg, opt) 272 extern char **
OptsGet(
const char *argv0,
277 int *pargc,
char *argv[]);
280 extern int OptsCvtArgStr(
const char *argv0,
const char *sOptName,
281 char *optarg,
void *pOptVal);
282 extern int OptsCvtArgBool(
const char *argv0,
const char *sOptName,
283 char *optarg,
void *pOptVal);
284 extern int OptsCvtArgInt(
const char *argv0,
const char *sOptName,
285 char *optarg,
void *pOptVal);
287 char *optarg,
void *pOptVal);
289 char *optarg,
void *pOptVal);
292 extern char *
OptsFmtStr(
char *buf,
size_t buflen,
void *pOptVal);
293 extern char *
OptsFmtInt(
char *buf,
size_t buflen,
void *pOptVal);
294 extern char *
OptsFmtFloat(
char *buf,
size_t buflen,
void *pOptVal);
295 extern char *
OptsFmtBool(
char *buf,
size_t buflen,
void *pOptVal);
296 extern char *
OptsFmtChar(
char *buf,
size_t buflen,
void *pOptVal);
300 extern void OptsInvalid(
const char *argv0,
const char *sFmt, ...);
305 #endif // _RNR_OPTS_H int(* OptsCvtFunc_T)(const char *argv0, const char *sOptName, char *optarg, void *pOptVal)
Option Argument Conversion Function Type.
const char * diagnostics
Programs diagnostics subsection string.
int OptsCvtArgBool(const char *argv0, const char *sOptName, char *optarg, void *pOptVal)
Convert options boolean argument to bool_t.
int short_opt
Short option character.
OptsFmtFunc_T fn_fmt
Option value string formatting function.
char * OptsFmtLogLevel(char *buf, size_t buflen, void *pOptVal)
Log Level option value string formatter.
Program Description Strings Info Structure.
int OptsCvtArgFloat(const char *argv0, const char *sOptName, char *optarg, void *pOptVal)
Convert options float argument to double.
char * OptsFmtInt(char *buf, size_t buflen, void *pOptVal)
Integer option value string formatter.
void * opt_addr
Address of option variable.
RoadNarrows Robotics standard package information.
const char * long_desc
Program full description string.
const char * synopsis
Simple program synopsis string.
char * pvt_opt_dft
Option default value in string format.
char * OptsFmtStr(char *buf, size_t buflen, void *pOptVal)
String option value string formatter.
int OptsCvtArgInt(const char *argv0, const char *sOptName, char *optarg, void *pOptVal)
Convert options integer argument to integer.
const char * usage_args
Single line description string of non-option arguments.
const char * arg_name
Option argument name string.
#define C_DECLS_BEGIN
C declaration block begin in C.
char *(* OptsFmtFunc_T)(char *buf, size_t buflen, void *pOptVal)
Option Value String Formatter Type.
void OptsInvalid(const char *argv0, const char *sFmt,...)
Invalid option or option argument print and exit.
char * OptsFmtChar(char *buf, size_t buflen, void *pOptVal)
Character option value string formatter.
OptsCvtFunc_T fn_cvt
Option conversion function.
int pvt_retval
Return value.
RoadNarrows Robotics common configuration file.
char ** OptsGet(const char *argv0, const PkgInfo_T *pPkgInfo, OptsPgmInfo_T *pPgmInfo, OptsInfo_T *pOptsInfo, bool_t bHasLogging, int *pargc, char *argv[])
Gets, validates, and sets all command line options.
bool_t has_default
Option does [not] have a default value.
#define C_DECLS_END
C declaration block end in C.
int OptsCvtArgStr(const char *argv0, const char *sOptName, char *optarg, void *pOptVal)
Convert options string argument to string.
char * OptsFmtBool(char *buf, size_t buflen, void *pOptVal)
Boolean option value string formatter.
int has_arg
Option does [not] have an argument of type.
char * OptsFmtFloat(char *buf, size_t buflen, void *pOptVal)
Float option value string formatter.
const char * opt_desc
Option description string.
const char * long_opt
Long option string name.
Short and Long Options Info.
int OptsCvtArgLogLevel(const char *argv0, const char *sOptName, char *optarg, void *pOptVal)
Convert options string argument to log threshold level.