mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-05 22:40:03 +02:00
candump: handle individual logfile name for stdout
Since commitad250a68dc("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>
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user