X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=conf.c;h=ce7fc5e7fbe65bff92371a1ca558ebbf1dfa51e8;hb=12bb2606082256a5d1dab3ccd4e2481f3e632022;hp=c26f16e289cfa6a39efc792a789b5caa5721a678;hpb=70f1bfb7a0ad81c7b151d0f5171b4515c01acde2;p=scilog%2Fscilog.git diff --git a/conf.c b/conf.c index c26f16e..ce7fc5e 100644 --- a/conf.c +++ b/conf.c @@ -6,6 +6,7 @@ #include "conf.h" #include "debug_print.h" +#include "ad_ring.h" // ミューテックス static pthread_mutex_t mutex_conf = PTHREAD_MUTEX_INITIALIZER; @@ -67,6 +68,28 @@ int conf_linux_time_set_get(void) return linux_time_set; } +// 記録パス +static char recpath[CONF_RECPATH_MAX]; +void conf_recpath_set(char *s) +{ + strncpy(recpath, s, sizeof(recpath)); +} +char* conf_recpath_getp(void) +{ + return recpath; +} + +// 記録CH +static int recchnum; +void conf_recchn_set(int chn) +{ + recchnum = chn; +} +int conf_recchn_get(void) +{ + return recchnum; +} + // /**** 設定ファイル ******************************************* */ @@ -159,9 +182,10 @@ int conf_read(void) FILE *fp; char buf[256]; // char buf2[256]; + char buf2[CONF_RECPATH_MAX]; int f; int val; - + fp = fopen(CONF_FILE, "rt"); if (fp == NULL) { syslog(LOG_ERR, "conf_read(): conf file not found. %s", CONF_FILE); @@ -190,6 +214,17 @@ int conf_read(void) conf_linux_time_set_set(val); syslog(LOG_INFO, "linux_time_set=%d", conf_linux_time_set_get()); } + // 記録パス + if (sscanf(buf, "rec_path = %s", buf2) == 1) { + trim_space(buf2); + conf_recpath_set(buf2); + syslog(LOG_INFO, "rec_path=%s", conf_recpath_getp()); + } + // 記録CH + if (sscanf(buf, "rec_chn = %d", &f) == 1) { + if (f < 1 || f > AD_CHNUM) f = AD_CHNUM; + conf_recchn_set(f); + } } fclose(fp); return 0;