00001
00005
00006
00007
00008
00009 #ifndef H_POPTINT
00010 #define H_POPTINT
00011
00017 static inline void *
00018 _free( const void * p)
00019
00020 {
00021 if (p != NULL) free((void *)p);
00022 return NULL;
00023 }
00024
00025
00026
00027 typedef unsigned int __pbm_bits;
00028
00029 #define __PBM_NBITS (8 * sizeof (__pbm_bits))
00030 #define __PBM_IX(d) ((d) / __PBM_NBITS)
00031 #define __PBM_MASK(d) ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS))
00032
00033 typedef struct {
00034 __pbm_bits bits[1];
00035 } pbm_set;
00036
00037 #define __PBM_BITS(set) ((set)->bits)
00038
00039 #define PBM_ALLOC(d) calloc(__PBM_IX (d) + 1, sizeof(__pbm_bits))
00040 #define PBM_FREE(s) _free(s);
00041 #define PBM_SET(d, s) (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d))
00042 #define PBM_CLR(d, s) (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d))
00043 #define PBM_ISSET(d, s) ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0)
00044
00045 struct optionStackEntry {
00046 int argc;
00047
00048 const char ** argv;
00049
00050 pbm_set * argb;
00051 int next;
00052
00053 char * nextArg;
00054
00055 const char * nextCharArg;
00056
00057 poptItem currAlias;
00058 int stuffed;
00059 };
00060
00061 struct poptContext_s {
00062 struct optionStackEntry optionStack[POPT_OPTION_DEPTH];
00063
00064 struct optionStackEntry * os;
00065
00066 const char ** leftovers;
00067 int numLeftovers;
00068 int nextLeftover;
00069
00070 const struct poptOption * options;
00071 int restLeftover;
00072
00073 const char * appName;
00074
00075 poptItem aliases;
00076 int numAliases;
00077 unsigned int flags;
00078
00079 poptItem execs;
00080 int numExecs;
00081
00082 const char ** finalArgv;
00083 int finalArgvCount;
00084 int finalArgvAlloced;
00085 int (*maincall) (int argc, const char **argv);
00086
00087 poptItem doExec;
00088
00089 const char * execPath;
00090 int execAbsolute;
00091
00092 const char * otherHelp;
00093
00094 pbm_set * arg_strip;
00095 };
00096
00097 #ifdef HAVE_LIBINTL_H
00098 #include <libintl.h>
00099 #endif
00100
00101 #if defined(HAVE_GETTEXT) && !defined(__LCLINT__)
00102 #define _(foo) gettext(foo)
00103 #else
00104 #define _(foo) foo
00105 #endif
00106
00107 #if defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)
00108 #define D_(dom, str) dgettext(dom, str)
00109 #define POPT_(foo) D_("popt", foo)
00110 #else
00111 #define D_(dom, str) str
00112 #define POPT_(foo) foo
00113 #endif
00114
00115 #define N_(foo) foo
00116
00117 #ifdef HAVE_ICONV
00118 #include <iconv.h>
00119 #if defined(__LCLINT__)
00120
00121 extern iconv_t iconv_open(const char *__tocode, const char *__fromcode)
00122 ;
00123
00124 extern size_t iconv(iconv_t __cd, char ** __inbuf,
00125 size_t * __inbytesleft,
00126 char ** __outbuf,
00127 size_t * __outbytesleft)
00128
00129 ;
00130
00131 extern int iconv_close( iconv_t __cd)
00132 ;
00133
00134 #endif
00135 #endif
00136
00137 #ifdef HAVE_LANGINFO_H
00138 #include <langinfo.h>
00139 #if defined(__LCLINT__)
00140
00141 extern char *nl_langinfo (nl_item __item)
00142 ;
00143
00144 #endif
00145 #endif
00146
00147 int POPT_fprintf (FILE* stream, const char *format, ...)
00148
00149 ;
00150
00151 char *POPT_prev_char ( const char *str)
00152 ;
00153
00154 #endif