/* For storing name_addr items in res_items table */
#define ITEM(x) ((void **)&res_all.x)
-#define MAX_RES_ITEMS 32 /* maximum resource items per RES */
+#define MAX_RES_ITEMS 50 /* maximum resource items per RES */
/* This is the universal header that is
* at the beginning of every resource
* record.
*/
-struct s_reshdr {
- struct s_reshdr *next; /* pointer to next resource of this type */
+struct RES {
+ RES *next; /* pointer to next resource of this type */
char *name; /* resource name */
char *desc; /* resource description */
int rcode; /* resource id or type */
char item_present[MAX_RES_ITEMS]; /* set if item is present in conf file */
};
-typedef struct s_reshdr RES;
/*
* Master Resource configuration structure definition
#define MAX_RES_NAME_LENGTH MAX_NAME_LENGTH-1 /* maximum resource name length */
-#define ITEM_REQUIRED 0x1 /* item required */
-#define ITEM_DEFAULT 0x2 /* default supplied */
+#define ITEM_REQUIRED 0x1 /* item required */
+#define ITEM_DEFAULT 0x2 /* default supplied */
+#define ITEM_NO_EQUALS 0x4 /* Don't scan = after name */
/* Message Resource */
-struct s_res_msgs {
+struct MSGS {
RES hdr;
char *mail_cmd; /* mail command */
char *operator_cmd; /* Operator command */
DEST *dest_chain; /* chain of destinations */
char send_msg[nbytes_for_bits(M_MAX+1)]; /* bit array of types */
};
-typedef struct s_res_msgs MSGS;
/* Define the Union of all the above common
* resource structure definitions.
*/
-union cu_res {
- struct s_res_msgs res_msgs;
+union CURES {
+ MSGS res_msgs;
RES hdr;
};
-typedef union cu_res CURES;
-
/* Configuration routines */
void parse_config(char *cf);
void save_resource(int type, struct res_items *item, int pass);
char *res_to_str(int rcode);
+/* Loop through each resource of type, returning in var */
+#define foreach_res(var, type) \
+ for(var=NULL; (*((void **)&(var))=(void *)GetNextRes((type), (RES *)var));)
+
+#ifdef the_old_way
+#define foreach_res(var, type) \
+ for((var)=NULL; (((void *)(var))=GetNextRes((type), (RES *)var));)
+#endif
+
+
void store_str(LEX *lc, struct res_items *item, int index, int pass);
void store_dir(LEX *lc, struct res_items *item, int index, int pass);
void store_password(LEX *lc, struct res_items *item, int index, int pass);
void store_yesno(LEX *lc, struct res_items *item, int index, int pass);
void store_time(LEX *lc, struct res_items *item, int index, int pass);
void store_size(LEX *lc, struct res_items *item, int index, int pass);
+void store_defs(LEX *lc, struct res_items *item, int index, int pass);