| verzia 1.23, 2002/08/03 20:03:21 |
verzia 1.24, 2002/08/05 19:23:20 |
|
|
| * ____________________________________________________________ |
* ____________________________________________________________ |
| * |
* |
| * Developed by Ondrej Jombik <nepto@pobox.sk> |
* Developed by Ondrej Jombik <nepto@pobox.sk> |
| * and Lubomir Host <rajo@host.sk> |
* and Lubomir Host <rajo@host.sk> |
| * Copyright (c) 2001-2002 Platon SDG, http://www.platon.sk/ |
* Copyright (c) 2001-2002 Platon SDG, http://www.platon.sk/ |
| * All rights reserved. |
* All rights reserved. |
| * |
* |
| Riadok 46 char *cfg_default_properties[CFG_N_PROPS |
|
| Riadok 46 char *cfg_default_properties[CFG_N_PROPS |
|
| /* CFG_FILE_LEFTOVER_MULTI_VALS_SEPARATOR */ { " ", NULL, NULL, NULL }, |
/* CFG_FILE_LEFTOVER_MULTI_VALS_SEPARATOR */ { " ", NULL, NULL, NULL }, |
| /* CFG_FILE_QUOTE_PREFIX */ { "\"", "'", NULL, NULL }, |
/* CFG_FILE_QUOTE_PREFIX */ { "\"", "'", NULL, NULL }, |
| /* CFG_FILE_QUOTE_POSTFIX */ { "\"", "'", NULL, NULL }, |
/* CFG_FILE_QUOTE_POSTFIX */ { "\"", "'", NULL, NULL }, |
| }; /* }}} */ |
}; /* }}} */ |
| |
|
| /* |
/* |
| * Static functions for strdyn manipulation |
* Static functions for strdyn manipulation |
| Riadok 223 cfg_clear_property(con, type) |
|
| Riadok 223 cfg_clear_property(con, type) |
|
| } /* }}} */ |
} /* }}} */ |
| |
|
| int |
int |
| |
cfg_clear_properties( |
| |
const CFG_CONTEXT con, |
| |
enum cfg_property_type type, ...) |
| |
{ /* {{{ */ |
| |
va_list ap; |
| |
enum cfg_property_type tmp_type; |
| |
int ret = 1; |
| |
|
| |
/* initialization */ |
| |
tmp_type = type; |
| |
va_start(ap, type); |
| |
|
| |
/* argument list must be termited with typeN = CFG_EOF */ |
| |
while (tmp_type != CFG_EOF) { |
| |
ret &= cfg_clear_property(con, tmp_type); |
| |
if (!ret) |
| |
break; |
| |
tmp_type = va_arg(ap, enum cfg_property_type); |
| |
} |
| |
|
| |
/* cleanup */ |
| |
va_end(ap); |
| |
|
| |
return ret; |
| |
} /* }}} */ |
| |
|
| |
int |
| cfg_add_property(con, type, str) |
cfg_add_property(con, type, str) |
| const CFG_CONTEXT con; |
const CFG_CONTEXT con; |
| enum cfg_property_type type; |
enum cfg_property_type type; |
| Riadok 308 cfg_add_property(con, type, str) |
|
| Riadok 335 cfg_add_property(con, type, str) |
|
| |
|
| int |
int |
| cfg_add_properties( |
cfg_add_properties( |
| const CFG_CONTEXT con, |
const CFG_CONTEXT con, |
| enum cfg_property_type type, |
enum cfg_property_type type, |
| char *str, ...) |
char *str, ...) |
| { /* {{{ */ |
{ /* {{{ */ |
| va_list ap; |
va_list ap; |
| enum cfg_property_type tmp_type; |
enum cfg_property_type tmp_type; |
| Riadok 341 cfg_add_properties( |
|
| Riadok 368 cfg_add_properties( |
|
| return ret; |
return ret; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
|
| int |
int |
| cfg_remove_property(con, type, str) |
cfg_remove_property(con, type, str) |
| const CFG_CONTEXT con; |
const CFG_CONTEXT con; |
| Riadok 426 cfg_remove_property(con, type, str) |
|
| Riadok 452 cfg_remove_property(con, type, str) |
|
| return 0; /* failure */ |
return 0; /* failure */ |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
int |
| |
cfg_remove_properties( /* code same like cfg_add_properties() */ |
| |
const CFG_CONTEXT con, |
| |
enum cfg_property_type type, |
| |
char *str, ...) |
| |
{ /* {{{ */ |
| |
va_list ap; |
| |
enum cfg_property_type tmp_type; |
| |
char * tmp_str; |
| |
int ret = 1; |
| |
|
| |
/* initialization */ |
| |
tmp_type = type; |
| |
tmp_str = str; |
| |
va_start(ap, str); |
| |
|
| |
/* argument list must be termited with typeN = CFG_EOF or |
| |
* str = NULL |
| |
*/ |
| |
while (tmp_type != CFG_EOF && tmp_str != NULL) { |
| |
ret &= cfg_remove_property(con, tmp_type, tmp_str); |
| |
if (!ret) |
| |
break; |
| |
tmp_type = va_arg(ap, enum cfg_property_type); |
| |
if (tmp_type == CFG_EOF) /* if typeN == CFG_EOF, strN may be not specified! */ |
| |
break; |
| |
tmp_str = va_arg(ap, char *); |
| |
} |
| |
|
| |
/* cleanup */ |
| |
va_end(ap); |
| |
|
| |
return ret; |
| |
} /* }}} */ |
| |
|
| |
|
| /* Modeline for ViM {{{ |
/* Modeline for ViM {{{ |
| * vim:set ts=4: |
* vim:set ts=4: |
| * vim600:fdm=marker fdl=0 fdc=0: |
* vim600:fdm=marker fdl=0 fdc=0: |