nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

qtmp.h1 (615B)


      1 #ifndef QTMP_H
      2 #define QTMP_H
      3 
      4 #include <utmp.h>
      5 #ifndef UTMP_FILE
      6 #ifdef _PATH_UTMP
      7 #define UTMP_FILE _PATH_UTMP
      8 #else
      9 #define UTMP_FILE "/etc/utmp"
     10 #endif
     11 #endif
     12 #define UTMP_INIT \
     13     struct utmp utm; \
     14     struct utmp *ut = &utm; \
     15     substdio ssutmp; \
     16     char bufutmp[sizeof(struct utmp) * 16]; \
     17     int fdutmp
     18 #define UTMP_USER ut_name
     19 #define UTMP_OPEN \
     20     fdutmp = open_read(UTMP_FILE); \
     21     if (fdutmp == -1) _exit(0); \
     22     substdio_fdbuf(&ssutmp,read,fdutmp,bufutmp,sizeof(bufutmp))
     23 #define UTMP_READ_MORE (substdio_get(&ssutmp,ut,sizeof(utm)) == sizeof(utm))
     24 #define UTMP_TYPE_MATCHES 1
     25 
     26 #endif