+#ifdef HAVE_GETUTENT
+static int
+logged_in (void)
+{
+ struct utmp * utp;
+
+ if (utmped)
+ return utmped;
+
+ setutent();
+
+ while ((utp = getutent()) != NULL) {
+ if (
+#ifdef HAVE_STRUCT_UTMP_UT_TYPE
+ utp->ut_type == USER_PROCESS
+ &&
+#endif
+ utp->ut_name[0] != 0
+ && strncmp (user, utp->ut_name, sizeof(utp->ut_name)) == 0) {
+ if (debug)
+ continue;
+ endutent();
+ return (utmped = DONE);
+ }
+ }
+
+ endutent();
+ return (utmped = NOTOK);
+}
+#else