/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getttyent.c 5.10 (Berkeley) 3/23/91";
+static char sccsid[] = "@(#)getttyent.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <ttyent.h>
return (t);
}
+static char *skip __P((char *)) internal_function;
+static char *value __P((char *)) internal_function;
+
struct ttyent *
getttyent()
{
register char *p;
#define MAXLINELENGTH 100
static char line[MAXLINELENGTH];
- static char *skip(), *value();
if (!tf && !setttyent())
return (NULL);
+ flockfile (tf);
for (;;) {
- if (!fgets(p = line, sizeof(line), tf))
+ if (!fgets_unlocked(p = line, sizeof(line), tf)) {
+ funlockfile (tf);
return (NULL);
+ }
/* skip lines that are too big */
if (!index(p, '\n')) {
- while ((c = getc(tf)) != '\n' && c != EOF)
+ while ((c = getc_unlocked(tf)) != '\n' && c != EOF)
;
continue;
}
if (*p && *p != '#')
break;
}
+ funlockfile(tf);
zapchar = 0;
tty.ty_name = p;
tty.ty_status |= TTY_ON;
else if (scmp(_TTYS_SECURE))
tty.ty_status |= TTY_SECURE;
- else if (scmp(_TTYS_TRUSTED))
- tty.ty_status |= TTY_TRUSTED;
- else if (scmp(_TTYS_CONSOLE))
- tty.ty_status |= TTY_CONSOLE;
else if (vcmp(_TTYS_WINDOW))
tty.ty_window = value(p);
else
* the next field.
*/
static char *
+internal_function
skip(p)
register char *p;
{
}
static char *
+internal_function
value(p)
register char *p;
{