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