From: Yegor Yefremov Date: Thu, 23 Jan 2014 08:49:23 +0000 (+0100) Subject: slcand: accept both tty* and /dev/tty* device names X-Git-Url: http://rtime.felk.cvut.cz/gitweb/can-utils.git/commitdiff_plain/49801ea8a65415a93b50d47e6eae96c25855e781 slcand: accept both tty* and /dev/tty* device names Signed-off-by: Yegor Yefremov Signed-off-by: Marc Kleine-Budde --- diff --git a/slcand.c b/slcand.c index 69d30f7..831e8c6 100644 --- a/slcand.c +++ b/slcand.c @@ -251,10 +251,11 @@ int main(int argc, char *argv[]) /* Prepare the tty device name string */ pch = strstr(tty, devprefix); - if (pch == tty) - print_usage(argv[0]); + if (pch != tty) + snprintf(ttypath, TTYPATH_LENGTH, "%s%s", devprefix, tty); + else + snprintf(ttypath, TTYPATH_LENGTH, "%s", tty); - snprintf(ttypath, TTYPATH_LENGTH, "%s%s", devprefix, tty); syslog(LOG_INFO, "starting on TTY device %s", ttypath); /* Daemonize */