Mercurial > hg > th-libs
view th_args.h @ 400:f7919a143fcb
Add some missing types and macros when we do not have inttypes.h or stdint.h
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 03 Mar 2016 14:36:14 +0200 |
parents | 4e7e0a74e73e |
children | 1b3472ba7b23 |
line wrap: on
line source
/* * Simple commandline argument processing function * Programmed and designed by Matti 'ccr' Hamalainen * (C) Copyright 2002-2016 Tecnic Software productions (TNSP) * * Please read file 'COPYING' for information on license and distribution. */ #ifndef TH_ARGS #define TH_ARGS #include "th_util.h" #include <stdio.h> #ifdef __cplusplus extern "C" { #endif /* Option flags */ #define OPT_NONE (0) // Simple option with no arguments #define OPT_ARGREQ (1) // Option requires an argument #define OPT_ARGMASK (1) // Mask for option argument flags #define OPTH_BAILOUT 0x0001 // Bail out on errors #define OPTH_ONLY_OPTS 0x0010 // Handle only options #define OPTH_ONLY_OTHER 0x0020 // Handle only "non-options" #define OPTH_ONLY_MASK 0x00f0 // Mask /* Option argument structure */ typedef struct { int id; char o_short; char *o_long; char *desc; int flags; } th_optarg; BOOL th_args_process(int argc, char *argv[], const th_optarg *opts, const int nopts, BOOL (*handle_option)(int id, char *, char *), BOOL (*handle_other)(char *), const int flags); void th_args_help(FILE *, const th_optarg *opts, const int nopts, const int flags); #ifdef __cplusplus } #endif #endif // TH_ARGS