summaryrefslogtreecommitdiff
path: root/src/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/options.c')
-rw-r--r--src/options.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/options.c b/src/options.c
index e30e149..0ad0844 100644
--- a/src/options.c
+++ b/src/options.c
@@ -44,12 +44,12 @@
else if(!strcmp(str,SHORT) || !strcmp(str,LONG)) \
VALUE = 0;
-#define PARSE_INT_PARAM(SHORT, LONG, VALUE) \
+#define PARSE_INT_PARAM(SHORT, LONG, VALUE, BASE) \
else if(!strcmp(str,SHORT) || !strcmp(str,LONG)) \
{ \
if(argc < 1) \
return i; \
- VALUE = atoi(argv[i+1]); \
+ VALUE = strtol(argv[i+1], (char **)NULL, BASE); \
argc--; \
i++; \
}
@@ -199,8 +199,9 @@ int options_parse(options_t* opt, int argc, char* argv[])
PARSE_STRING_PARAM("-s","--source", opt->src_bin_desc_)
PARSE_STRING_PARAM("-d","--output-dir", opt->output_dir_)
PARSE_STRING_PARAM("-f","--name-format", opt->name_format_)
- PARSE_INT_PARAM("-i","--interval", opt->interval_)
- PARSE_INT_PARAM("-o","--offset", opt->offset_)
+ PARSE_INT_PARAM("-m","--mode", opt->mode_, 8)
+ PARSE_INT_PARAM("-i","--interval", opt->interval_, 10)
+ PARSE_INT_PARAM("-o","--offset", opt->offset_, 10)
else
return i;
}
@@ -244,6 +245,7 @@ void options_default(options_t* opt)
opt->src_bin_desc_ = NULL;
opt->output_dir_ = strdup("/srv/archiv");
opt->name_format_ = strdup("%Y-%m-%d-%H00.ogg");
+ opt->mode_ = 0644;
opt->interval_ = 50;
opt->offset_ = 0;
}
@@ -289,6 +291,7 @@ void options_print_usage()
printf(" as data source, see gst-launch man-page for syntax\n");
printf(" [-d|--output-dir] <path> path to the output directory\n");
printf(" [-f|--name-format] <format> the file name format, see manpage of strftime for the syntax\n");
+ printf(" [-m|--mode] <value> ocatl represantion of the file permission mode\n");
printf(" [-i|--interval] <value> interval for time checks in ms\n");
printf(" [-o|--offset] <value> time offset for recordings in ms\n");
}
@@ -316,6 +319,7 @@ void options_print(options_t* opt)
printf("src_bin_desc: >>%s<<\n", opt->src_bin_desc_);
printf("output_dir: '%s'\n", opt->output_dir_);
printf("name_format: '%s'\n", opt->name_format_);
+ printf("mode: %04o\n", (int)opt->mode_);
printf("interval: %d\n", opt->interval_);
printf("offset: %d\n", opt->offset_);
}