1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
#include <sys/param.h>
/* a bad hack, we should dynamically allocate the array */
#ifndef MAXPATHLEN
# define MAXPATHLEN 1024
#endif
#ifdef USE_UTMPX
# include <utmpx.h>
# define choice_utmp utmpx
#else
# include <utmp.h>
# define choice_utmp utmp
#endif
#ifndef _HAVE_UT_USER
# define ut_user ut_name
#endif
struct choice_utmp utmp_entry;
#define STRUCTSIZE ((long)sizeof(utmp_entry))
#ifndef UT_NAMESIZE
# define UT_NAMESIZE sizeof(utmp_entry.ut_user)
#endif
#ifndef UT_LINESIZE
# define UT_LINESIZE sizeof(utmp_entry.ut_line)
#endif
#ifdef _HAVE_UT_ID
# define UT_IDSIZE sizeof(utmp_entry.ut_id)
#else
# define UT_IDSIZE UT_LINESIZE
#endif
#ifndef UT_HOSTSIZE
# ifdef _HAVE_UT_HOST
# define UT_HOSTSIZE sizeof(utmp_entry.ut_host)
# else
# define UT_HOSTSIZE 0
# endif
#endif
#ifndef UTMP_FILE
# ifdef _PATH_UTMP /* newer BSD's */
# define UTMP_FILE _PATH_UTMP
# else
# define UTMP_FILE "/etc/utmp"
# endif
#endif
#ifndef WTMP_FILE
# ifdef _PATH_WTMP /* newer BSD's */
# define WTMP_FILE _PATH_WTMP
# else
# define WTMP_FILE "/etc/wtmp"
# endif
#endif
#ifndef _HAVE_UT_TYPE
# define EMPTY 0
# define RUN_LVL 1
# define BOOT_TIME 2
# define NEW_TIME 3
# define OLD_TIME 4
# define INIT_PROCESS 5
# define LOGIN_PROCESS 6
# define USER_PROCESS 7
# define DEAD_PROCESS 8
# define ACCOUNTING 9
# define UT_UNKNOWN EMPTY
#else
#ifndef EMPTY
# define EMPTY 0
#endif
#ifndef RUN_LVL
# define RUN_LVL EMPTY
#endif
#ifndef BOOT_TIME
# define BOOT_TIME EMPTY
#endif
#ifndef NEW_TIME
# define NEW_TIME EMPTY
#endif
#ifndef OLD_TIME
# define OLD_TIME EMPTY
#endif
#ifndef INIT_PROCESS
# define INIT_PROCESS EMPTY
#endif
#ifndef LOGIN_PROCESS
# define LOGIN_PROCESS EMPTY
#endif
#ifndef USER_PROCESS
# define USER_PROCESS EMPTY
#endif
#ifndef DEAD_PROCESS
# define DEAD_PROCESS EMPTY
#endif
#ifndef ACCOUNTING
# define ACCOUNTING EMPTY
#endif
#ifndef UT_UNKNOWN
# define UT_UNKNOWN EMPTY
#endif
#endif /* _HAVE_UT_TYPE */
|