From: Alan Barrett <
[email protected]>
Index: include/ttyent.h
===================================================================
--- include/ttyent.h 3 Feb 2005 04:39:32 -0000 1.13
+++ include/ttyent.h 2 Aug 2005 17:25:48 -0000
@@ -69,6 +69,9 @@
__BEGIN_DECLS
struct ttyent *getttyent(void);
struct ttyent *getttynam(const char *);
+#if defined(_NETBSD_SOURCE)
+int setttyent1(const char *);
+#endif /* defined(_NETBSD_SOURCE) */
int setttyent(void);
int endttyent(void);
__END_DECLS
Index: lib/libc/include/namespace.h
===================================================================
--- lib/libc/include/namespace.h 17 Jul 2005 16:07:36 -0000 1.103
+++ lib/libc/include/namespace.h 2 Aug 2005 17:25:48 -0000
@@ -452,6 +452,7 @@
#define setservent_r _setservent_r
#define setstate _setstate
#define setttyent _setttyent
+#define setttyent1 _setttyent1
#define settimeofday _settimeofday
#define setusershell _setusershell
#define shm_open _shm_open
Index: lib/libc/gen/getttyent.c
===================================================================
--- lib/libc/gen/getttyent.c 14 May 2005 15:43:47 -0000 1.22
+++ lib/libc/gen/getttyent.c 2 Aug 2005 17:25:48 -0000
@@ -54,6 +54,7 @@
__weak_alias(getttyent,_getttyent)
__weak_alias(getttynam,_getttynam)
__weak_alias(setttyent,_setttyent)
+__weak_alias(setttyent1,_setttyent1)
#endif
static FILE *tf;
@@ -216,18 +217,24 @@
}
int
-setttyent(void)
+setttyent1(const char *path)
{
lineno = 0;
if (tf) {
rewind(tf);
return 1;
- } else if ((tf = fopen(_PATH_TTYS, "r")) != NULL)
+ } else if ((tf = fopen(path, "r")) != NULL)
return 1;
return 0;
}
int
+setttyent(void)
+{
+ return setttyent1(_PATH_TTYS);
+}
+
+int
endttyent(void)
{
int rval;
Index: lib/libc/gen/Makefile.inc
===================================================================
--- lib/libc/gen/Makefile.inc 12 Apr 2005 16:27:42 -0000 1.143
+++ lib/libc/gen/Makefile.inc 2 Aug 2005 17:25:48 -0000
@@ -110,7 +110,8 @@
getpwent.3 getpwuid.3 getpwent.3 setpwent.3
MLINKS+=getpwent.3 getpwnam_r.3 getpwent.3 getpwuid_r.3 getpwent.3 getpwent_r.3
# getpwent.3 setpwfile.3 - deprecated
-MLINKS+=getttyent.3 endttyent.3 getttyent.3 getttynam.3 getttyent.3 setttyent.3
+MLINKS+=getttyent.3 endttyent.3 getttyent.3 getttynam.3 \
+ getttyent.3 setttyent.3 getttyent.3 setttyent1.3
MLINKS+=getusershell.3 endusershell.3 getusershell.3 setusershell.3
MLINKS+=glob.3 globfree.3
MLINKS+=makecontext.3 swapcontext.3