diff options
author | Chris Hall <chris.hall@highwayman.com> | 2011-03-21 01:16:05 +0000 |
---|---|---|
committer | Chris Hall <chris.hall@highwayman.com> | 2011-03-21 01:16:05 +0000 |
commit | 9470cb2c32eab220f796b1438b787528272cbe84 (patch) | |
tree | b9b2cc12446173436d2bc7a32e82cc3378ec721e /lib/misc.h | |
parent | 5cae7eea451f2b7d65b5892e2c1dafc70f8b836e (diff) | |
download | quagga-ex11p.tar.bz2 quagga-ex11p.tar.xz |
Upgrade of "pipework" -- including piping to/from shell commandsex11p
Version 0.99.15ex11p
A major overhaul.
Diffstat (limited to 'lib/misc.h')
-rw-r--r-- | lib/misc.h | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -87,6 +87,9 @@ typedef unsigned int uint ; typedef unsigned int usize ; typedef unsigned int ulen ; +typedef int ssize ; +typedef int slen ; + typedef unsigned long ulong ; /* cvp == const void* -- ptr to constant void @@ -95,4 +98,46 @@ typedef unsigned long ulong ; */ typedef const void* cvp ; +/* Macros for sexing value of compilation options. + * + * In particular allow a blank option to be treated as true, and a zero option + * to be treated as false. + * + * NB: the option MUST be defined, and must be decimal numeric !! + */ +#define STRING_VALUE_INNER(x) #x +#define STRING_VALUE(x) STRING_VALUE_INNER(x) + +#define IS_BLANK_OPTION(x) IS_BLANK_OPTION_INNER(x) +#define IS_ZERO_OPTION(x) IS_ZERO_OPTION_INNER(x) +#define IS_NOT_ZERO_OPTION(x) IS_NOT_OPTION_ZERO_INNER(x) + +#define IS_BLANK_OPTION_INNER(x) (1##x##1 == 11) +#define IS_ZERO_OPTION_INNER(x) (1##x##1 == 101) +#define IS_NOT_ZERO_OPTION_INNER(x) (1##x##1 != 101) + +/* If QDEBUG is defined, make QDEBUG_NAME and set QDEBUG + * + * Numeric value for QDEBUG: undefined => 0 + * defined, blank => 1 + * defined, 0 => 0 + * defined, other => other + * + * Template for turning compilation option into a value. + */ +#ifdef QDEBUG +# if IS_BLANK_OPTION(QDEBUG) +# undef QDEBUG +# define QDEBUG 1 +# endif +#else +# define QDEBUG 0 +#endif + +enum { qdebug = QDEBUG } ; + +#ifndef QDEBUG_NAME +# define QDEBUG_NAME STRING_VALUE(QDEBUG) +#endif + #endif /* _ZEBRA_MISC_H */ |