author | mickeyl <mickeyl> | 2003-03-30 01:51:14 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-30 01:51:14 (UTC) |
commit | d11a0154e2d9732854c9a3d598857bc20f359849 (patch) (side-by-side diff) | |
tree | af0e0273d01f4f6c64c9f230f22bb91a7a8a21d8 /noncore/net/wellenreiter/libwellenreiter/source/wl_conf.cc | |
parent | 99899abc80a8aa05044eeecd8a061b0a8efaa713 (diff) | |
download | opie-d11a0154e2d9732854c9a3d598857bc20f359849.zip opie-d11a0154e2d9732854c9a3d598857bc20f359849.tar.gz opie-d11a0154e2d9732854c9a3d598857bc20f359849.tar.bz2 |
- the network work for libopie2 pays off...
- good bye to wellenreiterd, t'was fun but always too unstable and too hard to maintain
- good bye to libwellenreiter
Diffstat (limited to 'noncore/net/wellenreiter/libwellenreiter/source/wl_conf.cc') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/wl_conf.cc | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_conf.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_conf.cc deleted file mode 100644 index ba56754..0000000 --- a/noncore/net/wellenreiter/libwellenreiter/source/wl_conf.cc +++ b/dev/null @@ -1,81 +0,0 @@ -/* - * Configfile operations for wellenreiter - * - * $Id$ - */ - -#include "wl_conf.hh" -#include "wl_log.hh" -#include "wl_types.hh" - -/* Check whether configfile exists and is readable */ -int wl_checkcfg(void) -{ - FILE *wl_config; - - if((wl_config = fopen(WL_CONFFILE, "r")) == NULL) - { - wl_logerr("Cannot open configfile: %s", strerror(errno)); - return 0; - } - else - { - fclose(wl_config); - return 1; - } - -} - -/* Get value for given token from config file */ -int wl_cfgvalue(const char *token, char *out, int maxlen) -{ - FILE *wl_config; - char *ptr, *ptr2; - char confbuf[WL_CONFBUFF]; - - if(token == NULL) - return -1; - - if((wl_config = fopen(WL_CONFFILE, "r")) == NULL) - { - wl_logerr("Cannot open configfile: %s", strerror(errno)); - return -1; - } - - /* Clear buffers */ - memset(out, 0, maxlen); - memset(confbuf, 0, sizeof(confbuf)); - - while((fgets(confbuf, sizeof(confbuf) - 1, wl_config)) != NULL) - { - - /* Ignore comments */ - if(confbuf[0] == '#') continue; - - /* Search for token, if found check whether next character - * is a '=' or a ' ' - */ - if(strstr(confbuf, token) != NULL && - (confbuf[strlen(token)] == '=' || confbuf[strlen(token)] == ' ')) - { - - /* Get value between quotes */ - if((ptr = strstr(confbuf, "\"")) == NULL) - break; - ++ptr; - if((ptr2 = strstr(ptr, "\"")) == NULL) - break; - ptr2[0] = '\0'; - - memcpy(out, ptr, maxlen - 1); - break; - - } - memset(confbuf, 0, sizeof(confbuf)); - } - - fclose(wl_config); - - return (out[0] == '\0' ? 0 : 1); -} - |