magic flag strings must be tokens
authorJay Lepreau <lepreau@ucbvax.Berkeley.EDU>
Tue, 20 May 1986 06:15:57 +0000 (22:15 -0800)
committerJay Lepreau <lepreau@ucbvax.Berkeley.EDU>
Tue, 20 May 1986 06:15:57 +0000 (22:15 -0800)
SCCS-vsn: lib/libc/gen/getttyent.c 5.3

usr/src/lib/libc/gen/getttyent.c

index 5a7257e..d77e3a4 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getttyent.c        5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)getttyent.c        5.3 (Berkeley) %G%";
 #endif LIBC_SCCS and not lint
 
 #include <stdio.h>
 #endif LIBC_SCCS and not lint
 
 #include <stdio.h>
@@ -119,11 +119,12 @@ getttyent()
        tty.ty_status = 0;
        tty.ty_window = EMPTY;
        for (; *p; p = skip(p)) {
        tty.ty_status = 0;
        tty.ty_window = EMPTY;
        for (; *p; p = skip(p)) {
-               if (strncmp(p, "on", 2) == 0)
+#define space(x) ((c = p[x]) == ' ' || c == '\t' || c == '\n')
+               if (strncmp(p, "on", 2) == 0 && space(2))
                        tty.ty_status |= TTY_ON;
                        tty.ty_status |= TTY_ON;
-               else if (strncmp(p, "off", 3) == 0)
+               else if (strncmp(p, "off", 3) == 0 && space(3))
                        tty.ty_status &= ~TTY_ON;
                        tty.ty_status &= ~TTY_ON;
-               else if (strncmp(p, "secure", 6) == 0)
+               else if (strncmp(p, "secure", 6) == 0 && space(6))
                        tty.ty_status |= TTY_SECURE;
                else if (strncmp(p, "window", 6) == 0) {
                        if ((tty.ty_window = value(p)) == NULL)
                        tty.ty_status |= TTY_SECURE;
                else if (strncmp(p, "window", 6) == 0) {
                        if ((tty.ty_window = value(p)) == NULL)