[Sysfence-commit] sysfence/parseopt parse.c,1.15,1.16
Status: Alpha
Brought to you by:
emes
|
From: Michal S. <em...@us...> - 2004-05-28 23:29:20
|
Update of /cvsroot/sysfence/sysfence/parseopt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11687/parseopt Modified Files: parse.c Log Message: + fs watching enabled. this does not work properly yet Index: parse.c =================================================================== RCS file: /cvsroot/sysfence/sysfence/parseopt/parse.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- parse.c 26 May 2004 17:54:53 -0000 1.15 +++ parse.c 28 May 2004 23:29:10 -0000 1.16 @@ -255,14 +255,42 @@ #endif sf_atomic *at = (sf_atomic *) xalloc (NULL, sizeof (sf_atomic)); tokdata *var = tok, - *op = tok + 1, - *val = tok + 2; + *arg1 = NULL, + *arg2 = NULL, + *op, + *val; parserdata *res; double *tmp; + int skiptok = 3; - tok += 3; switch (var->type) { + // temporary hack ? + case ID_LA1: + case ID_LA5: + case ID_LA15: + case ID_MUSED: + case ID_MFREE: + case ID_SUSED: + case ID_SFREE: + op = tok + 1; + val = tok + 2; + break; + case ID_FSFREE: + case ID_FSAVAIL: + case ID_FSUSED: + arg1 = tok + 1; + op = tok + 2; + val = tok + 3; + skiptok ++; + break; + default: + op = NULL; + } + + tok += skiptok; + + switch (var->type) { case ID_LA1: at->thresh.type = DOUBLE; at->op = op->type; @@ -305,9 +333,49 @@ at->stat.label = ST_SWAP; at->stat.arg[0].resstat = VA_USED; break; + case ID_FSFREE: + at->thresh.type = INTEGER; + at->op = op->type; + at->stat.label = ST_FS; + at->stat.arg[0].resstat = VA_FREE; + at->stat.arg[1].path = (char *) arg1->val; + break; + case ID_FSAVAIL: + at->thresh.type = INTEGER; + at->op = op->type; + at->stat.label = ST_FS; + at->stat.arg[0].resstat = VA_AVAIL; + at->stat.arg[1].path = (char *) arg1->val; + break; + case ID_FSUSED: + at->thresh.type = INTEGER; + at->op = op->type; + at->stat.label = ST_FS; + at->stat.arg[0].resstat = VA_USED; + at->stat.arg[1].path = (char *) arg1->val; + break; default: return NULL; } + + /* check arguments */ + switch (var->type) { + case ID_FSFREE: + case ID_FSAVAIL: + case ID_FSUSED: + if (arg1->type != VA_STR) { +#ifdef DEBUG + parse_error (tok, thisfuncname, "no path given"); +#else + parse_error (tok); +#endif + } + /* register fs in database */ + add_fs_entry_to_list (&tmp_fs_db, (char *) arg1->val); + break; + default: + break; // to avoid warnings + } switch (op->type) { /* allow only operators */ |