summaryrefslogtreecommitdiff
path: root/src/sydra.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-09-26 00:29:10 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-09-26 00:29:10 +0200
commita32b141e1c7bbdc5e36e9d3debf262eb1c26ddfc (patch)
treeff8b802b606ccb88ebff1db1110a23595d66aa16 /src/sydra.c
parentimproved default pipeline (diff)
now using GOptions for command line parsing
Diffstat (limited to 'src/sydra.c')
-rw-r--r--src/sydra.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/src/sydra.c b/src/sydra.c
index 877172a..085eea2 100644
--- a/src/sydra.c
+++ b/src/sydra.c
@@ -47,7 +47,6 @@
#include "datatypes.h"
#include "options.h"
-#include "string_list.h"
#include "log.h"
#include "daemon.h"
#include "utils.h"
@@ -215,61 +214,51 @@ int main_loop(options_t* opt)
int main(int argc, char* argv[])
{
log_init();
+ log_close();
options_t opt;
int ret = options_parse(&opt, argc, argv);
if(ret) {
- if(ret > 0)
- fprintf(stderr, "syntax error near: %s\n\n", argv[ret]);
- if(ret == -2)
- fprintf(stderr, "memory error on options_parse, exitting\n");
- if(ret == -3)
+ if(ret == -1) {
options_print_version();
- if(ret == -4)
- fprintf(stderr, "the port number is invalid\n");
- if(ret == -5)
- fprintf(stderr, "the timeout value is invalid\n");
-
- if(ret != -2 && ret != -3 && ret != -4)
- options_print_usage();
-
- if(ret == -1 || ret == -3)
ret = 0;
-
+ }
options_clear(&opt);
log_close();
exit(ret);
}
- slist_element_t* tmp = opt.log_targets_.first_;
- while(tmp) {
- ret = log_add_target(tmp->data_);
+
+ guint len = g_strv_length(opt.log_targets_);
+ guint i;
+ for(i = 0; i < len; ++i) {
+ ret = log_add_target(opt.log_targets_[i]);
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", (char*)(tmp->data_)); break;
- case -4: fprintf(stderr, "this log target is only allowed once: '%s', exitting\n", (char*)(tmp->data_)); break;
- default: fprintf(stderr, "syntax error near: '%s', exitting\n", (char*)(tmp->data_)); break;
+ case -3: fprintf(stderr, "unknown log target: '%s', exitting\n", (char*)(opt.log_targets_[i])); break;
+ case -4: fprintf(stderr, "this log target is only allowed once: '%s', exitting\n", (char*)(opt.log_targets_[i])); break;
+ default: fprintf(stderr, "syntax error near: '%s', exitting\n", (char*)(opt.log_targets_[i])); break;
}
options_clear(&opt);
log_close();
exit(ret);
}
- tmp = tmp->next_;
}
log_printf(NOTICE, "just started...");
- options_parse_post(&opt);
if(opt.debug_)
options_print(&opt);
-
if(opt.appname_)
g_set_prgname (opt.appname_);
else
g_set_prgname (opt.progname_);
+ options_clear(&opt);
+ exit(0);
+
priv_info_t priv;
if(opt.username_)
if(priv_init(&priv, opt.username_, opt.groupname_)) {
@@ -311,7 +300,6 @@ int main(int argc, char* argv[])
fclose(pid_file);
}
- gst_init(NULL, NULL);
const gchar *nano_str;
guint major, minor, micro, nano;
gst_version(&major, &minor, &micro, &nano);