summaryrefslogtreecommitdiff
path: root/japanese/mh/files/patch-uip_slocal.c
blob: 38c142b95ecc1c5703f4c924d7aed77541239983 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--- uip/slocal.c.orig	2000-12-04 12:09:38 UTC
+++ uip/slocal.c
@@ -36,6 +36,10 @@ static char ident[] = "@(#)$Id: slocal.c
 #endif	/* NOIOCTLH */
 #endif	/* not V7 */
 #include <sys/stat.h>
+#include <sys/param.h>
+#if __FreeBSD_version > 900007
+#include <utmpx.h>
+#else /* __FreeBSD_version > 900007 */
 #include <utmp.h>
 #ifndef UTMP_FILENAME
 #ifdef UTMP_FILE
@@ -48,6 +52,7 @@ static char ident[] = "@(#)$Id: slocal.c
 #endif
 #endif
 #endif	/* UTMP_FILENAME */
+#endif /* __FreeBSD_version > 900007 */
 #ifdef LOCALE
 #include	<locale.h>
 #endif
@@ -938,6 +943,24 @@ register char  *key;
 
 /*  */
 
+#if __FreeBSD_version > 900007
+static int  logged_in (void) {
+    if (utmped) {
+	return utmped;
+    }
+    else {
+	struct utmpx* ut = NULL;
+
+	ut = getutxuser(user);
+	if (ut != NULL) {
+	    return (utmped = DONE);
+	}
+	else {
+	    return (utmped = NOTOK);
+	}
+    }
+}
+#else /* __FreeBSD_version > 900007 */
 static int  logged_in () {
     struct utmp ut;
     register FILE  *uf;
@@ -963,6 +986,7 @@ static int  logged_in () {
     (void) fclose (uf);
     return (utmped = NOTOK);
 }
+#endif /* __FreeBSD_version > 900007 */
 
 
 static int  timely (t1, t2)