aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/utmp.h13
-rw-r--r--src/include/utmps/utmp.h40
-rw-r--r--src/include/utmps/utmpx.h6
-rw-r--r--src/utmps/deps-lib/utmps3
-rw-r--r--src/utmps/getutxent_r.c13
-rw-r--r--src/utmps/getutxid_r.c13
-rw-r--r--src/utmps/getutxline_r.c13
7 files changed, 101 insertions, 0 deletions
diff --git a/src/include/utmp.h b/src/include/utmp.h
new file mode 100644
index 0000000..2a7706d
--- /dev/null
+++ b/src/include/utmp.h
@@ -0,0 +1,13 @@
+/* ISC license. */
+
+/*
+ This file is part of the utmps package.
+ See https://skarnet.org/software/utmps/
+*/
+
+#ifndef UTMP_H
+#define UTMP_H
+
+#include <utmps/utmp.h>
+
+#endif
diff --git a/src/include/utmps/utmp.h b/src/include/utmps/utmp.h
new file mode 100644
index 0000000..bd2ea3f
--- /dev/null
+++ b/src/include/utmps/utmp.h
@@ -0,0 +1,40 @@
+/* ISC license. */
+
+#ifndef UTMPS_UTMP_H
+#define UTMPS_UTMP_H
+
+#include <utmps/utmpx.h>
+
+/* Unused, but some packages require these macros to be present */
+#define UTMP_FILE UTMPX_FILE
+#define WTMP_FILE "/var/log/wtmp"
+#define UTMP_FILENAME UTMP_FILE
+#define WTMP_FILENAME WTMP_FILE
+#define _PATH_UTMP UTMP_FILE
+#define _PATH_WTMP WTMP_FILE
+
+struct lastlog
+{
+ time_t ll_time ;
+ char ll_line[UTMPS_UT_LINESIZE] ;
+ char ll_host[UTMPS_UT_HOSTSIZE] ;
+} ;
+
+#define utmp utmpx
+
+#define endutent endutxent
+#define setutent setutxent
+#define getutent getutxent
+#define getutid getutxid
+#define getutline getutxline
+#define pututline pututxline
+#define utmpname utmpxname
+#define updwtmp updwtmpx
+
+#ifdef _DEFAULT_SOURCE
+#define getutent_r utmps_getutxent_r
+#define getutid_r utmps_getutxid_r
+#define getutline_r utmps_getutxline_r
+#endif
+
+#endif
diff --git a/src/include/utmps/utmpx.h b/src/include/utmps/utmpx.h
index 8fa6dd2..fdc1dbc 100644
--- a/src/include/utmps/utmpx.h
+++ b/src/include/utmps/utmpx.h
@@ -79,6 +79,12 @@ extern void logwtmp (char const *, char const *, char const *) ;
# define ut_time ut_tv.tv_sec
#endif
+#ifdef _DEFAULT_SOURCE
+extern int utmps_getutxent_r (struct utmpx *, struct utmpx **) ;
+extern int utmps_getutxid_r (struct utmpx const *, struct utmpx *, struct utmpx **) ;
+extern int utmps_getutxent_r (struct utmpx const *, struct utmpx *, struct utmpx **) ;
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/src/utmps/deps-lib/utmps b/src/utmps/deps-lib/utmps
index c73d439..b3325d8 100644
--- a/src/utmps/deps-lib/utmps
+++ b/src/utmps/deps-lib/utmps
@@ -1,7 +1,10 @@
endutxent.o
getutxent.o
+getutxent_r.o
getutxid.o
+getutxid_r.o
getutxline.o
+getutxline_r.o
logwtmp.o
pututxline.o
setutxent.o
diff --git a/src/utmps/getutxent_r.c b/src/utmps/getutxent_r.c
new file mode 100644
index 0000000..3630bcd
--- /dev/null
+++ b/src/utmps/getutxent_r.c
@@ -0,0 +1,13 @@
+/* ISC license. */
+
+#include <utmps/utmpx.h>
+#include <utmps/utmps.h>
+#include "utmps-internal.h"
+
+int utmps_getutxent_r (struct utmpx *b, struct utmpx **p)
+{
+ if (!utmps_here_maybe_init()) return -1 ;
+ if (!utmps_getent(&utmps_here, b, 0, 0)) return -1 ;
+ *p = b ;
+ return 0 ;
+}
diff --git a/src/utmps/getutxid_r.c b/src/utmps/getutxid_r.c
new file mode 100644
index 0000000..f8438e1
--- /dev/null
+++ b/src/utmps/getutxid_r.c
@@ -0,0 +1,13 @@
+/* ISC license. */
+
+#include <utmps/utmpx.h>
+#include <utmps/utmps.h>
+#include "utmps-internal.h"
+
+int utmps_getutxid_r (struct utmpx const *a, struct utmpx *b, struct utmpx **p)
+{
+ if (!utmps_here_maybe_init()) return -1 ;
+ if (!utmps_getid(&utmps_here, (unsigned short)a->ut_type, a->ut_id, b, 0, 0)) return -1 ;
+ *p = b ;
+ return 0 ;
+}
diff --git a/src/utmps/getutxline_r.c b/src/utmps/getutxline_r.c
new file mode 100644
index 0000000..d43d59b
--- /dev/null
+++ b/src/utmps/getutxline_r.c
@@ -0,0 +1,13 @@
+/* ISC license. */
+
+#include <utmps/utmpx.h>
+#include <utmps/utmps.h>
+#include "utmps-internal.h"
+
+int utmps_getutxline_r (struct utmpx const *a, struct utmpx *b, struct utmpx **p)
+{
+ if (!utmps_here_maybe_init()) return -1 ;
+ if (!utmps_getline(&utmps_here, a->ut_line, b, 0, 0)) return -1 ;
+ *p = b ;
+ return 0 ;
+}