--- lmtp2nntp_option.h 2002/01/24 12:04:46 1.1
+++ lmtp2nntp_option.h 2002/01/24 16:25:54 1.2
@@ -27,8 +27,8 @@
#include "lmtp2nntp_global.h"
#include "val.h"
-struct optionconfig_s;
-typedef struct optionconfig_s optionconfig_t;
+struct optionval_s;
+typedef struct optionval_s optionval_t;
typedef struct {
int childsmax;
@@ -57,8 +57,8 @@
argz_t restrictheader;
argz_t newsgroup;
/*FIXME above*/
- optionconfig_t *first;
- optionconfig_t *last;
+ optionval_t *first;
+ optionval_t *last;
val_t *vo; /* val_t for all options */
int pi; /* popt index to next record */
int pn; /* popt number of available records */
@@ -67,6 +67,12 @@
} lmtp2nntp_option_t;
typedef enum {
+ OPT_FLAG,
+ OPT_SINGLE,
+ OPT_MULTI
+} optiontype_t;
+
+typedef enum {
OPTION_OK,
OPTION_ERR_ARG, /* invalid args passed into function */
OPTION_ERR_USE, /* invalid usage, bad data passed into function */
@@ -74,13 +80,32 @@
OPTION_ERR_VAL /* libval failed */
} lmtp2nntp_option_rc_t;
-typedef enum {
- OPT_FLAG,
- OPT_SINGLE,
- OPT_MULTI
-} optiontype_t;
+typedef lmtp2nntp_option_rc_t (optionloop_cb_t)(optionval_t *oc, char *arg, char *cbctx);
+
+struct optionval_s {
+ optionval_t *next; /* cleanup chain for destroy */
+ lmtp2nntp_option_t *parent; /* include needs access to parent */
+ /**/
+ char *longname; /* the long name (optional if shortname given) */
+ char shortname; /* the short name (optional if longname given) */
+ char *descrip; /* description for autohelp */
+ char *argdescrip; /* argument description for autohelp */
+ optiontype_t type; /* OPT_FLAG, OPT_SINGLE, OPT_MULTI */
+ optionloop_cb_t *cb; /* callback for first iteration - syntax check and include */
+ void *cbctx; /* context for pass1 */
+ val_t *val; /* val we are registered under */
+ /**/
+ int number; /* number of this option for popt */
+ struct { /* option data as read from configuration */
+ int f; /* OPT_FLAG */
+ void *foo1, *foo2, *foo3, *foo4, *foo5, *foo6, *foo7, *foo8, *foo9;
+ char *s; /* OPT_SINGLE */
+ void *bar1, *bar2, *bar3, *bar4, *bar5, *bar6, *bar7, *bar8, *bar9;
+ char **m; /* OPT_MULTI */
+ } data;
+ int ndata;
+};
-typedef lmtp2nntp_option_rc_t (optionloop_cb_t)(optionconfig_t *oc, char *arg, char *cbctx);
lmtp2nntp_option_rc_t option_create (lmtp2nntp_option_t **, val_t *);
lmtp2nntp_option_rc_t option_register(lmtp2nntp_option_t *, char *, char, optiontype_t, optionloop_cb_t *, char *, char *, char *);
lmtp2nntp_option_rc_t option_parse (lmtp2nntp_option_t *, int, char **);
|