summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anylike.org>2010-01-11 19:16:03 +0000
committerChristian Pointner <equinox@anylike.org>2010-01-11 19:16:03 +0000
commit286253c656aa40437455dd4f691ad9054a328ef2 (patch)
treef61376ae144e37e35159cd14a45e0dae787e1bf2
parentcleaned up lua libs (no require socket anymore) (diff)
moved default log target to options
-rw-r--r--src/anylike.c31
-rw-r--r--src/options.c8
2 files changed, 21 insertions, 18 deletions
diff --git a/src/anylike.c b/src/anylike.c
index 427477f..826824a 100644
--- a/src/anylike.c
+++ b/src/anylike.c
@@ -219,26 +219,21 @@ int main(int argc, char* argv[])
exit(ret);
}
string_list_element_t* tmp = opt.log_targets_.first_;
- if(!tmp) {
- log_add_target("syslog:3,anylike,daemon");
- }
- else {
- while(tmp) {
- ret = log_add_target(tmp->string_);
- if(ret) {
- switch(ret) {
- case -2: fprintf(stderr, "memory error on log_add_target, exitting\n"); break;
- case -3: fprintf(stderr, "unknown log target: '%s', exitting\n", tmp->string_); break;
- case -4: fprintf(stderr, "this log target is only allowed once: '%s', exitting\n", tmp->string_); break;
- default: fprintf(stderr, "syntax error near: '%s', exitting\n", tmp->string_); break;
- }
-
- options_clear(&opt);
- log_close();
- exit(ret);
+ while(tmp) {
+ ret = log_add_target(tmp->string_);
+ if(ret) {
+ switch(ret) {
+ case -2: fprintf(stderr, "memory error on log_add_target, exitting\n"); break;
+ case -3: fprintf(stderr, "unknown log target: '%s', exitting\n", tmp->string_); break;
+ case -4: fprintf(stderr, "this log target is only allowed once: '%s', exitting\n", tmp->string_); break;
+ default: fprintf(stderr, "syntax error near: '%s', exitting\n", tmp->string_); break;
}
- tmp = tmp->next_;
+
+ options_clear(&opt);
+ log_close();
+ exit(ret);
}
+ tmp = tmp->next_;
}
log_printf(NOTICE, "just started...");
diff --git a/src/options.c b/src/options.c
index 27241ac..8de7cc6 100644
--- a/src/options.c
+++ b/src/options.c
@@ -188,6 +188,14 @@ int options_parse(options_t* opt, int argc, char* argv[])
return i;
}
+ if(!opt->log_targets_.first_) {
+#ifndef WINVER
+ string_list_add(&opt->log_targets_, "syslog:3,anylike,daemon");
+#else
+ string_list_add(&opt->log_targets_, "stdout:3");
+#endif
+ }
+
return 0;
}