Just a little correction at the it.po file.
[midnight-commander.git] / src / popt.h
blobbde2959baf1a110f15dd27a684e8090e30a23ec2
1 /* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING
2 file accompanying popt source distributions, available from
3 ftp://ftp.redhat.com/pub/code/popt */
5 #ifndef H_POPT
6 #define H_POPT
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
12 #include <stdio.h> /* for FILE * */
14 #define POPT_OPTION_DEPTH 10
16 #define POPT_ARG_NONE 0
17 #define POPT_ARG_STRING 1
18 #define POPT_ARG_INT 2
19 #define POPT_ARG_LONG 3
20 #define POPT_ARG_INCLUDE_TABLE 4 /* arg points to table */
21 #define POPT_ARG_CALLBACK 5 /* table-wide callback... must be
22 set first in table; arg points
23 to callback, descrip points to
24 callback data to pass */
25 #define POPT_ARG_INTL_DOMAIN 6 /* set the translation domain
26 for this table and any
27 included tables; arg points
28 to the domain string */
29 #define POPT_ARG_VAL 7 /* arg should take value val */
30 #define POPT_ARG_MASK 0x0000FFFF
31 #define POPT_ARGFLAG_ONEDASH 0x80000000 /* allow -longoption */
32 #define POPT_ARGFLAG_DOC_HIDDEN 0x40000000 /* don't show in help/usage */
33 #define POPT_CBFLAG_PRE 0x80000000 /* call the callback before parse */
34 #define POPT_CBFLAG_POST 0x40000000 /* call the callback after parse */
35 #define POPT_CBFLAG_INC_DATA 0x20000000 /* use data from the include line,
36 not the subtable */
38 #define POPT_ERROR_NOARG -10
39 #define POPT_ERROR_BADOPT -11
40 #define POPT_ERROR_OPTSTOODEEP -13
41 #define POPT_ERROR_BADQUOTE -15 /* only from poptParseArgString() */
42 #define POPT_ERROR_ERRNO -16 /* only from poptParseArgString() */
43 #define POPT_ERROR_BADNUMBER -17
44 #define POPT_ERROR_OVERFLOW -18
46 /* poptBadOption() flags */
47 #define POPT_BADOPTION_NOALIAS (1 << 0) /* don't go into an alias */
49 /* poptGetContext() flags */
50 #define POPT_CONTEXT_NO_EXEC (1 << 0) /* ignore exec expansions */
51 #define POPT_CONTEXT_KEEP_FIRST (1 << 1) /* pay attention to argv[0] */
52 #define POPT_CONTEXT_POSIXMEHARDER (1 << 2) /* options can't follow args */
54 struct poptOption {
55 const char * longName; /* may be NULL */
56 char shortName; /* may be '\0' */
57 int argInfo;
58 void * arg; /* depends on argInfo */
59 int val; /* 0 means don't return, just update flag */
60 char * descrip; /* description for autohelp -- may be NULL */
61 char * argDescrip; /* argument description for autohelp */
64 struct poptAlias {
65 char * longName; /* may be NULL */
66 char shortName; /* may be '\0' */
67 int argc;
68 char ** argv; /* must be free()able */
71 extern struct poptOption const poptHelpOptions[];
72 #define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \
73 0, "Help options", NULL },
75 typedef struct poptContext_s * poptContext;
76 #ifndef __cplusplus
77 typedef struct poptOption * poptOption;
78 #endif
80 enum poptCallbackReason { POPT_CALLBACK_REASON_PRE,
81 POPT_CALLBACK_REASON_POST,
82 POPT_CALLBACK_REASON_OPTION };
83 typedef void (*poptCallbackType)(poptContext con,
84 enum poptCallbackReason reason,
85 const struct poptOption * opt,
86 const char * arg, void * data);
88 poptContext poptGetContext(char * name, int argc, char ** argv,
89 const struct poptOption * options, int flags);
90 void poptResetContext(poptContext con);
92 /* returns 'val' element, -1 on last item, POPT_ERROR_* on error */
93 int poptGetNextOpt(poptContext con);
94 /* returns NULL if no argument is available */
95 char * poptGetOptArg(poptContext con);
96 /* returns NULL if no more options are available */
97 char * poptGetArg(poptContext con);
98 char * poptPeekArg(poptContext con);
99 char ** poptGetArgs(poptContext con);
100 /* returns the option which caused the most recent error */
101 char * poptBadOption(poptContext con, int flags);
102 void poptFreeContext(poptContext con);
103 int poptStuffArgs(poptContext con, char ** argv);
104 int poptAddAlias(poptContext con, struct poptAlias alias, int flags);
105 int poptReadConfigFile(poptContext con, char * fn);
106 /* like above, but reads /etc/popt and $HOME/.popt along with environment
107 vars */
108 int poptReadDefaultConfig(poptContext con, int useEnv);
109 /* argv should be freed -- this allows ', ", and \ quoting, but ' is treated
110 the same as " and both may include \ quotes */
111 int poptParseArgvString(const char * s, int * argcPtr, char *** argvPtr);
112 const char * poptStrerror(const int error);
113 void poptSetExecPath(poptContext con, const char * path, int allowAbsolute);
114 int poptPrintHelp(poptContext con, FILE * f, int flags);
115 void poptPrintUsage(poptContext con, FILE * f, int flags);
116 void poptSetOtherOptionHelp(poptContext con, const char * text);
117 const char * poptGetInvocationName(poptContext con);
119 #ifdef __cplusplus
121 #endif
123 #endif