is there config file analysis code can be read?

W

Wade Yin

hello everyone:

I wanna write a fucntion to analyze the configuration file httpd.conf of
Apache.

I just constructed a global list data type, in it I can have node like this:

/***************************************************************

typedef struct KEY_VALUE{
char *key;
char *value;
}KVPair;

typedef enum {ATOM, LIST} ElemTag;

typedef struct GLNode{
ElemTag tag; // tag "base node"(ATOM) or "sublist"(LIST)
KVPair atom; // element value
struct GLNode *head; // point to first node of the sublist; NULL if empty
struct GLNode *prev; // point to prev node of the list; NULL if head
struct GLNode *next; // point to next node of the list; NULL if tail
} GLNode, *GLLink;

typedef struct GList{
GLLink hp;
GLLink tp;
} *GList;

***************************************************************/

if the option is in first level let "tag = ATOM "

spliting the config option into 2 parts...

else let "tag = LIST"; GLNode.head point to the first sub node..


And I can use the sublist to deal with the following config info...

<Directroy /docs>
options ..... // lever 2 , first node
...... .....
</Directory>


but when I met the sublist with another sublist (see the following config info)
I got no idea...

<IfModule ...>
option_key option_value
<Directroy /docs>
options .....
...... .....
</Directory>
</IfMoudle>


try to give me some advise on how to initilize the GList...


Thank you in advance



Wade
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top