Use libc's built-in getutXXX() functions for manipulating the file. --- tcsh-6.10.00/tc.who.c.utmp Sat Nov 11 21:18:07 2000 +++ tcsh-6.10.00/tc.who.c Thu Nov 30 15:03:23 2000 @@ -167,12 +167,13 @@ watch_login(force) int force; { - int utmpfd, comp = -1, alldone; + int comp = -1, alldone; int firsttime = stlast == 1; #ifdef BSDSIGS sigmask_t omask; #endif /* BSDSIGS */ struct utmp utmp; + struct utmp *uptr; struct who *wp, *wpnew; struct varent *v; Char **vp = NULL; @@ -265,18 +266,9 @@ return; } stlast = sta.st_mtime; - if ((utmpfd = open(_PATH_UTMP, O_RDONLY)) < 0) { - if (!force) - xprintf(CGETS(26, 2, - "%s cannot be opened. Please \"unset watch\".\n"), - _PATH_UTMP); -# ifdef BSDSIGS - (void) sigsetmask(omask); -# else - (void) sigrelse(SIGINT); -# endif - return; - } + + utmpname( _PATH_UTMP ); + setutent(); /* * xterm clears the entire utmp entry - mark everyone on the status list @@ -291,7 +283,9 @@ * Read in the utmp file, sort the entries, and update existing entries or * add new entries to the status list. */ - while (read(utmpfd, (char *) &utmp, sizeof utmp) == sizeof utmp) { + + while ((uptr = getutent())) { + memcpy(&utmp, uptr, sizeof(utmp)); # ifdef DEAD_PROCESS # ifndef IRIS4D @@ -387,7 +381,7 @@ wp->who_prev = wpnew; /* linked in now */ } } - (void) close(utmpfd); + endutent(); # if defined(UTHOST) && defined(_SEQUENT_) endutent(); # endif