]> git.ozlabs.org Git - ppp.git/commitdiff
allow for slashes in tty name
authorPaul Mackerras <paulus@samba.org>
Thu, 18 Jan 1996 03:35:38 +0000 (03:35 +0000)
committerPaul Mackerras <paulus@samba.org>
Thu, 18 Jan 1996 03:35:38 +0000 (03:35 +0000)
pppd/options.c

index e29dbb051f0f7b03413cc55716cdee9822e93374..ba5bfe6e44d78dae361d771019e267ae84308c68 100644 (file)
@@ -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 <stdio.h>
@@ -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;