* Fixed a multiselect bug in the mailbox view. Ctrl-click was selecting a message...
[citadel.git] / citadel / getutline.c
blob5eae2a76003cbd5e01a890ad319dbd88a0e0d72a
1 /*
2 * $Id$
4 * getutline.c: not-quite-compatible replacement for getutline(3)
5 * by nathan bryant, feb 1999
7 */
9 #include "sysdep.h"
10 #ifdef HAVE_UTMP_H
11 #include <stdio.h>
12 #include <sys/types.h>
13 #include <utmp.h>
14 #ifdef HAVE_PATHS_H
15 #include <paths.h>
16 #endif
17 #include <string.h>
19 struct utmp *getutline(struct utmp *ut)
21 static struct utmp retval;
22 FILE *utmp;
24 #ifdef UTMP_FILE
25 if ((utmp = fopen(UTMP_FILE, "rb")) == NULL)
26 #else
27 if ((utmp = fopen(_PATH_UTMP, "rb")) == NULL)
28 #endif
29 return NULL;
32 if (!fread(&retval, sizeof retval, 1, utmp))
34 fclose(utmp);
35 return NULL;
37 while (strcmp(ut->ut_line, retval.ut_line));
39 fclose(utmp);
40 return &retval;
42 #endif /* HAVE_UTMP_H */