Main Page   Modules   Compound List   File List   Compound Members   File Members   Related Pages  

popt/popt.h

Go to the documentation of this file.
00001 
00005 /* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING
00006    file accompanying popt source distributions, available from 
00007    ftp://ftp.rpm.org/pub/rpm/dist. */
00008 
00009 #ifndef H_POPT
00010 #define H_POPT
00011 
00012 #ifdef __cplusplus
00013 extern "C" {
00014 #endif
00015 
00016 #include <stdio.h>                      /* for FILE * */
00017 
00018 #define POPT_OPTION_DEPTH       10
00019 
00024 #define POPT_ARG_NONE           0       
00025 #define POPT_ARG_STRING         1       
00026 #define POPT_ARG_INT            2       
00027 #define POPT_ARG_LONG           3       
00028 #define POPT_ARG_INCLUDE_TABLE  4       
00029 #define POPT_ARG_CALLBACK       5       
00033 #define POPT_ARG_INTL_DOMAIN    6       
00037 #define POPT_ARG_VAL            7       
00038 #define POPT_ARG_FLOAT          8       
00039 #define POPT_ARG_DOUBLE         9       
00041 #define POPT_ARG_MASK           0x0000FFFF
00042 
00048 #define POPT_ARGFLAG_ONEDASH    0x80000000  
00049 #define POPT_ARGFLAG_DOC_HIDDEN 0x40000000  
00050 #define POPT_ARGFLAG_STRIP      0x20000000  
00051 #define POPT_ARGFLAG_OPTIONAL   0x10000000  
00053 #define POPT_ARGFLAG_OR         0x08000000  
00054 #define POPT_ARGFLAG_NOR        0x09000000  
00055 #define POPT_ARGFLAG_AND        0x04000000  
00056 #define POPT_ARGFLAG_NAND       0x05000000  
00057 #define POPT_ARGFLAG_XOR        0x02000000  
00058 #define POPT_ARGFLAG_NOT        0x01000000  
00059 #define POPT_ARGFLAG_LOGICALOPS \
00060         (POPT_ARGFLAG_OR|POPT_ARGFLAG_AND|POPT_ARGFLAG_XOR)
00061 
00067 #define POPT_CBFLAG_PRE         0x80000000  
00068 #define POPT_CBFLAG_POST        0x40000000  
00069 #define POPT_CBFLAG_INC_DATA    0x20000000  
00071 #define POPT_CBFLAG_SKIPOPTION  0x10000000  
00072 #define POPT_CBFLAG_CONTINUE    0x08000000  
00074 
00075 
00079 #define POPT_ERROR_NOARG        -10     
00080 #define POPT_ERROR_BADOPT       -11     
00081 #define POPT_ERROR_OPTSTOODEEP  -13     
00082 #define POPT_ERROR_BADQUOTE     -15     
00083 #define POPT_ERROR_ERRNO        -16     
00084 #define POPT_ERROR_BADNUMBER    -17     
00085 #define POPT_ERROR_OVERFLOW     -18     
00086 #define POPT_ERROR_BADOPERATION -19     
00088 
00089 
00093 #define POPT_BADOPTION_NOALIAS  (1 << 0)  
00095 
00096 
00100 #define POPT_CONTEXT_NO_EXEC    (1 << 0)  
00101 #define POPT_CONTEXT_KEEP_FIRST (1 << 1)  
00102 #define POPT_CONTEXT_POSIXMEHARDER (1 << 2) 
00104 
00105 
00107 struct poptOption {
00108 /*@observer@*/ /*@null@*/ const char * longName; 
00109     char shortName;                     
00110     int argInfo;
00111 /*@shared@*/ /*@null@*/ void * arg;     
00112     int val;                    
00113 /*@shared@*/ /*@null@*/ const char * descrip;   
00114 /*@shared@*/ /*@null@*/ const char * argDescrip; 
00115 };
00116 
00119 struct poptAlias {
00120 /*@owned@*/ /*@null@*/ const char * longName;   
00121     char shortName;             
00122     int argc;
00123 /*@owned@*/ const char ** argv; 
00124 };
00125 
00130 extern struct poptOption poptHelpOptions[];
00131 #define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \
00132                         0, "Help options:", NULL },
00133 #define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL }
00134 
00138 typedef struct poptContext_s * poptContext;
00139 
00142 #ifndef __cplusplus
00143 typedef struct poptOption * poptOption;
00144 #endif
00145 
00146 enum poptCallbackReason { POPT_CALLBACK_REASON_PRE, 
00147                           POPT_CALLBACK_REASON_POST,
00148                           POPT_CALLBACK_REASON_OPTION };
00149 
00158 typedef void (*poptCallbackType) (poptContext con, 
00159                                  enum poptCallbackReason reason,
00160                                  const struct poptOption * opt,
00161                                  const char * arg, const void * data);
00162 
00172 /*@only@*/ poptContext poptGetContext(/*@keep@*/ const char * name,
00173                 int argc, /*@keep@*/ const char ** argv,
00174                 /*@keep@*/ const struct poptOption * options, int flags);
00175 
00180 void poptResetContext(poptContext con);
00181 
00187 int poptGetNextOpt(poptContext con);
00188 /* returns NULL if no argument is available */
00189 
00193 /*@observer@*/ /*@null@*/ const char * poptGetOptArg(poptContext con);
00194 
00200 /*@observer@*/ /*@null@*/ const char * poptGetArg(poptContext con);
00201 
00207 /*@observer@*/ /*@null@*/ const char * poptPeekArg(poptContext con);
00208 
00214 /*@observer@*/ /*@null@*/ const char ** poptGetArgs(poptContext con);
00215 
00221 /*@observer@*/ const char * poptBadOption(poptContext con, int flags);
00222 
00227 void poptFreeContext( /*@only@*/ poptContext con);
00228 
00235 int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv);
00236 
00245 int poptAddAlias(poptContext con, struct poptAlias alias, int flags);
00246 
00253 int poptReadConfigFile(poptContext con, const char * fn);
00254 
00261 int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv);
00262 
00274 int poptDupArgv(int argc, const char **argv,
00275                 /*@out@*/ int * argcPtr, /*@out@*/ const char *** argvPtr);
00276 
00288 int poptParseArgvString(const char * s,
00289                 /*@out@*/ int * argcPtr, /*@out@*/ const char *** argvPtr);
00290 
00296 /*@observer@*/ const char *const poptStrerror(const int error);
00297 
00304 void poptSetExecPath(poptContext con, const char * path, int allowAbsolute);
00305 
00312 void poptPrintHelp(poptContext con, FILE * f, /*@unused@*/ int flags);
00313 
00320 void poptPrintUsage(poptContext con, FILE * f, /*@unused@*/ int flags);
00321 
00327 void poptSetOtherOptionHelp(poptContext con, const char * text);
00328 
00333 /*@observer@*/ const char * poptGetInvocationName(poptContext con);
00334 
00340 int poptStrippedArgv(poptContext con, int argc, char **argv);
00341 
00342 #ifdef  __cplusplus
00343 }
00344 #endif
00345 
00346 #endif

Generated at Mon May 21 08:53:40 2001 for rpm by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001