candump: handle individual logfile name for stdout
Since commitpull/354/headad250a68dc("candump: add option to define individual filename for logfile") the option "-f <fname>" allows to define an individual filename for a logfile. Usually the "-" is used as filename to represent stdout or stdin on Linux/Posix systems to be able to concatenate several applications via pipes. This patch handles this special case by detecting the filename "-" to print the logfile format on stdout instead of creating a logfile with the name "-". Fixes:ad250a68dc("candump: add option to define individual filename for logfile") Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
parent
aa3f029925
commit
c70d0a8e61
|
|
@ -442,6 +442,12 @@ int main(int argc, char **argv)
|
|||
exit(0);
|
||||
}
|
||||
|
||||
/* "-f -" is equal to "-L" (print logfile format on stdout) */
|
||||
if (log && logname && strcmp("-", logname) == 0) {
|
||||
log = 0; /* no logging into a file */
|
||||
logfrmt = 1; /* print logformat output to stdout */
|
||||
}
|
||||
|
||||
if (silent == SILENT_INI) {
|
||||
if (log) {
|
||||
fprintf(stderr, "Disabled standard output while logging.\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue