Tue Jul 26 00:25:57 1994 Mark Eichin (eichin@cygnus.com)
+ * krlogin.c: include <fcntl.h>
+
+ * configure.in: Added tests for NO_UT_HOST, NO_UT_EXIT.
+ * logutil.c: use them.
+
+ * configure.in: add CHECK_DIRENT, CHECK_FCNTL.
+
* configure.in: Added tests for HAVE_SETOWN, HAVE_SYS_FILIO_H.
* krlogin.c, krsh.c, krshd.c, krlogin.c, krlogind.c: use them.
AC_HAVE_LIBRARY(socket)
AC_HAVE_LIBRARY(nsl)
AC_FUNC_CHECK(utimes,AC_DEFINE(HAS_UTIMES))
+AC_FUNC_CHECK(getutent,AC_DEFINE(HAVE_GETUTENT))
AC_HAVE_HEADERS(sys/filio.h)
+CHECK_DIRENT
+CHECK_FCNTL
AC_COMPILE_CHECK([F_SETOWN],
[#include <sys/types.h>
#include <fcntl.h>],
[1+F_SETOWN;],
AC_DEFINE(HAVE_SETOWN))
+AC_COMPILE_CHECK([ut_host in struct utmp],
+[#include <utmp.h>],
+[struct utmp ut; ut.ut_host;],
+,
+AC_DEFINE(NO_UT_HOST))
+AC_COMPILE_CHECK([ut_exit in struct utmp],
+[#include <utmp.h>],
+[struct utmp ut; ut.ut_exit;],
+,
+AC_DEFINE(NO_UT_EXIT))
KRB_INCLUDE
WITH_KRB5ROOT
WITH_KRB4
#include <sys/types.h>
#include <sys/file.h>
-#if defined (CRAY) || defined (sgi)
-#include <sys/fcntl.h>
-#define L_SET 0
-#define L_INCR 1
-#endif
#include <utmp.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <sys/stat.h>
+#ifdef NEED_SYS_FCNTL_H
+#include <sys/fcntl.h>
+#endif
+#ifdef USE_UNISTD_H
+#include <unistd.h>
+#endif
#ifndef UTMP_FILE
#define UTMP_FILE "/etc/utmp"
struct utmp utmp;
int tty;
-#if defined(_AIX)
+#ifdef HAVE_GETUTENT
if (!ut->ut_pid)
ut->ut_pid = getppid();
ut->ut_type = USER_PROCESS;
#else
tty = ttyslot();
if (tty > 0 && (fd = open(UTMP_FILE, O_WRONLY, 0)) >= 0) {
- (void)lseek(fd, (long)(tty * sizeof(struct utmp)), L_SET);
+ (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET);
(void)write(fd, (char *)ut, sizeof(struct utmp));
(void)close(fd);
}
memset(ut.ut_host,0, sizeof(ut.ut_host));
#endif
(void)time(&ut.ut_time);
-#if defined(_AIX)
+#ifdef HAVE_GETUTENT
memset(ut.ut_id, 0, sizeof(ut.ut_id));
- ut.ut_pid = ut.ut_exit.e_exit = 0;
+ ut.ut_pid = 0;
+#ifndef NO_UT_EXIT
+ ut.ut_exit.e_exit = 0;
+#endif
ut.ut_type = EMPTY;
#endif
- (void)fseek(fp, (long)-sizeof(struct utmp), L_INCR);
+ (void)fseek(fp, (off_t)-sizeof(struct utmp), SEEK_CUR);
(void)fwrite((char *)&ut, sizeof(struct utmp), 1, fp);
- (void)fseek(fp, (long)0, L_INCR);
+ (void)fseek(fp, (off_t)0, SEEK_CUR);
rval = 0;
}
(void)fclose(fp);
ut.ut_pid = getpid();
#endif
(void)time(&ut.ut_time);
-#if defined(_AIX)
+#ifdef HAVE_GETUTENT
if (*name) {
if (!ut.ut_pid)
ut.ut_pid = getpid();