--- Hi, I don't quite know whether this is the right place to send patches to, but runit's homepage didn't mention any way to contribute patches (or I didn't find it). Please feel free to redirect me if I've chosen the wrong place. Regards Patrick man/svlogd.8 | 15 ++++++++++++++- src/svlogd.c | 11 ++++++++--- src/svlogd.check | 10 ++++++++++ src/svlogd.dist | 5 +++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/man/svlogd.8 b/man/svlogd.8 index 01b2324..5359d94 100644 --- a/man/svlogd.8 +++ b/man/svlogd.8 _at_@ -3,7 +3,8 @@ svlogd \- runit's service logging daemon .SH SYNOPSIS .B svlogd -[\-tttv] [\-r +[\-tttv] [\-c +.I file\fR] [\-r .I c\fR] [\-R .I xyz\fR] [\-l .I len\fR] [\-b _at_@ -377,6 +378,18 @@ the form YYYY-MM-DDTHH:MM:SS.xxxxx when writing to .I log or to standard error. .TP +.B \-c \fIfile +config file. +Use +.I file +as configuration instead of the default +.I log/config +path. +.I file +may either be absolute or relative, in which case it will be relative to the +.I log +directory. +.TP .B \-r \fIc replace. .I c diff --git a/src/svlogd.c b/src/svlogd.c index 90a3321..0109684 100644 --- a/src/svlogd.c +++ b/src/svlogd.c _at_@ -49,6 +49,7 @@ unsigned long linemax =1000; unsigned long buflen =1024; unsigned long linelen; +const char *config = "config"; const char *replace =""; char repl =0; _at_@ -437,13 +438,14 @@ unsigned int logdir_open(struct logdir *ld, const char *fn) { while (! stralloc_copys(&ld->processor, "")) pause_nomem(); /* read config */ - if ((i =openreadclose("config", &sa, 128)) == -1) + if ((i =openreadclose(config, &sa, 128)) == -1) warn2("unable to read config", ld->name); if (i != 0) { int len, c; unsigned long port; - if (verbose) strerr_warn4(INFO, "read: ", ld->name, "/config", 0); + if (verbose && *config != '/') strerr_warn5(INFO, "read: ", ld->name, "/", config, 0); + else if (verbose) strerr_warn3(INFO, "read: ", config, 0); for (i =0; i +1 < sa.len; ++i) { len =byte_chr(&sa.s[i], sa.len -i, '\n'); sa.s[len +i] =0; _at_@ -667,8 +669,11 @@ int main(int argc, const char **argv) { progname =*argv; - while ((opt =getopt(argc, argv, "R:r:l:b:tvV")) != opteof) { + while ((opt =getopt(argc, argv, "c:R:r:l:b:tvV")) != opteof) { switch(opt) { + case 'c': + config =optarg; + break; case 'R': replace =optarg; if (! repl) repl ='_'; diff --git a/src/svlogd.check b/src/svlogd.check index 7d926ef..e9584ee 100755 --- a/src/svlogd.check +++ b/src/svlogd.check _at_@ -24,4 +24,14 @@ echo t2 >"${ctmp}"/config echo $? cat "${ctmp}"/current +echo prelative-alternate >"${ctmp}"/alternate-config +echo foo |svlogd -c alternate-config "${ctmp}" +echo $? +cat "${ctmp}"/current + +echo pabsolute-alternate >>"${ctmp}"/alternate-config +echo foo |svlogd -c "${ctmp}"/alternate-config "${ctmp}" +echo $? +cat "${ctmp}"/current + rm -rf "${ctmp}" diff --git a/src/svlogd.dist b/src/svlogd.dist index b3329e6..8570230 100644 --- a/src/svlogd.dist +++ b/src/svlogd.dist _at_@ -19,3 +19,8 @@ baz :ar :az 0 +0 +relative-alternatefoo +0 +relative-alternatefoo +absolute-alternatefoo -- 2.22.0Received on Wed Jul 31 2019 - 18:00:32 UTC
This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC