From 7e37b204c4f1e186f276dd9f0822cb86dfce406a Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Thu, 18 Jan 1996 03:35:38 +0000 Subject: [PATCH] allow for slashes in tty name --- pppd/options.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pppd/options.c b/pppd/options.c index e29dbb0..ba5bfe6 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: options.c,v 1.28 1996/01/18 03:22:22 paulus Exp $"; +static char rcsid[] = "$Id: options.c,v 1.29 1996/01/18 03:35:38 paulus Exp $"; #endif #include @@ -518,21 +518,22 @@ options_from_user() int options_for_tty() { - char *dev, *path; + char *dev, *path, *p; int ret; - dev = strrchr(devnam, '/'); - if (dev == NULL) - dev = devnam; - else - ++dev; + dev = devnam; + if (strncmp(dev, "/dev/", 5) == 0) + dev += 5; if (strcmp(dev, "tty") == 0) return 1; /* don't look for /etc/ppp/options.tty */ path = malloc(strlen(_PATH_TTYOPT) + strlen(dev) + 1); if (path == NULL) novm("tty init file name"); strcpy(path, _PATH_TTYOPT); - strcat(path, dev); + /* Turn slashes into dots, for Solaris case (e.g. /dev/term/a) */ + for (p = path + strlen(path); *dev != 0; ++dev) + *p++ = (*dev == '/'? '.': *dev); + *p = 0; ret = options_from_file(path, 0, 0); free(path); return ret; -- 2.39.2