diff options
author | Kozlov Dmitry <dima@server> | 2010-08-03 13:28:53 +0400 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-08-03 13:28:53 +0400 |
commit | 5a2d6079eba1c7e2a9479cb10d714b5a97bbfe4f (patch) | |
tree | e72134e47e1491580af15e3eccbba451f13fdd42 /accel-pptpd/triton/options.c | |
parent | ba8e1a64e75930a161afac9048e7d03b7f880644 (diff) | |
download | accel-ppp-xebd-5a2d6079eba1c7e2a9479cb10d714b5a97bbfe4f.tar.gz accel-ppp-xebd-5a2d6079eba1c7e2a9479cb10d714b5a97bbfe4f.zip |
initiating work on accel-pptpd, replacement of modified poptop
Diffstat (limited to 'accel-pptpd/triton/options.c')
-rw-r--r-- | accel-pptpd/triton/options.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/accel-pptpd/triton/options.c b/accel-pptpd/triton/options.c new file mode 100644 index 0000000..ba7fc56 --- /dev/null +++ b/accel-pptpd/triton/options.c @@ -0,0 +1,46 @@ +#include <stdlib.h> +#include <string.h> + +#include "triton_p.h" +#include "conf_file.h" + +static struct conf_file_sect_t *sect=NULL; + +static const char* find_option(const char *name) +{ + struct option_t *opt; + + if (!sect) + { + sect=conf_file_get_section("options"); + if (!sect) return 0; + } + + list_for_each_entry(opt,§->items,entry) + { + if (strcmp(opt->name,name)==0) + return opt->val; + } + + return NULL; +} +int triton_get_int_option(const char *str) +{ + const char *val=find_option(str); + if (!val) return 0; + + return atoi(val); +} +const char* triton_get_str_option(const char *str) +{ + const char *val=find_option(str); + + return val; +} +double triton_get_double_option(const char *str) +{ + const char *val=find_option(str); + if (!val) return 0; + + return atof(val); +} |