]> code.citadel.org Git - citadel.git/blobdiff - citadel/getutline.c
- port to Cygwin (DLL support, etc.)
[citadel.git] / citadel / getutline.c
index 0398b8ff6babee532b08c02c87bbc987ec949da8..f64559abce30d9383fc99f2a8ed6753c610479ff 100644 (file)
@@ -1,22 +1,35 @@
 /*
+ * $Id$
+ *
  * getutline.c: not-quite-compatible replacement for getutline(3)
  * by nathan bryant, feb 1999
  *
- * $Id$
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #ifdef HAVE_UTMP_H
 #include <stdio.h>
+#include <sys/types.h>
 #include <utmp.h>
+#ifdef HAVE_PATHS_H
 #include <paths.h>
+#endif
+#include <string.h>
 
 struct utmp *getutline(struct utmp *ut)
 {
   static struct utmp retval;
   FILE *utmp;
 
+#ifdef UTMP_FILE
+  if ((utmp = fopen(UTMP_FILE, "rb")) == NULL)
+#else
   if ((utmp = fopen(_PATH_UTMP, "rb")) == NULL)
+#endif
     return NULL;
 
   do
@@ -25,7 +38,7 @@ struct utmp *getutline(struct utmp *ut)
        fclose(utmp);
        return NULL;
       }
-  while (ut->ut_line != retval.ut_line);
+  while (strcmp(ut->ut_line, retval.ut_line));
 
   fclose(utmp);
   return &retval;