...
 
Commits (1)
  • Rob Swindell's avatar
    More control over output streams · 74b4a948
    Rob Swindell authored
    Added options -A[filename] and -S[filename] to allow more control over which output streams go where (for mlong and his troubles with running ircd via systemd).
    
    -A controls "all messages" either sending all to stdout or the specified filename. This override the automatic suppression of the console output stream when run without a controlling TTY.
    
    -S controls "status message" (includes non-error level log messages), either sending the status messages to stdout or the specified filename. This also overrides the automatic suppression of the console output stream when run without a controlling TTY.
    74b4a948
......@@ -148,8 +148,12 @@ void usage(FILE* fp)
" -i<path_list> set load() comma-sep search path list (default=\"%s\")\n"
" -f use non-buffered stream for console messages\n"
" -a append instead of overwriting message output files\n"
" -A send all message to stdout\n"
" -A<filename> send all message to file instead of stdout/stderr\n"
" -e<filename> send error messages to file in addition to stderr\n"
" -o<filename> send console messages to file instead of stdout\n"
" -S<filename> send status messages to file instead of stderr\n"
" -S send status messages to stdout\n"
" -n send status messages to %s instead of stderr\n"
" -q send console messages to %s instead of stdout\n"
" -v display version details and exit\n"
......@@ -1306,6 +1310,22 @@ int main(int argc, char **argv, char** env)
case 'a':
omode="a";
break;
case 'A':
if (errfp != stderr)
fclose(errfp);
if(*p == '\0') {
errfp = stdout;
confp = stdout;
statfp = stdout;
} else {
if((errfp = fopen(p, omode)) == NULL) {
perror(p);
return(do_bail(1));
}
statfp = errfp;
confp = errfp;
}
break;
case 'C':
change_cwd = FALSE;
break;
......@@ -1329,6 +1349,16 @@ int main(int argc, char **argv, char** env)
case 'l':
loop=TRUE;
break;
case 'S':
if(*p == '\0')
statfp = stdout;
else {
if((statfp = fopen(p,omode))==NULL) {
perror(p);
return(do_bail(1));
}
}
break;
case 'n':
statfp=nulfp;
break;
......