summaryrefslogtreecommitdiffstats
path: root/term-utils
diff options
context:
space:
mode:
Diffstat (limited to 'term-utils')
-rw-r--r--term-utils/agetty.c26
-rw-r--r--term-utils/wall.c8
-rw-r--r--term-utils/write.c22
3 files changed, 28 insertions, 28 deletions
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index 0f114a532..46eea0122 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -25,7 +25,7 @@
#include <fcntl.h>
#include <stdarg.h>
#include <ctype.h>
-#include <utmp.h>
+#include <utmpx.h>
#include <getopt.h>
#include <time.h>
#include <sys/socket.h>
@@ -884,13 +884,13 @@ static void parse_speeds(struct options *op, char *arg)
/* Update our utmp entry. */
static void update_utmp(struct options *op)
{
- struct utmp ut;
+ struct utmpx ut;
time_t t;
pid_t pid = getpid();
pid_t sid = getsid(0);
char *vcline = op->vcline;
char *line = op->tty;
- struct utmp *utp;
+ struct utmpx *utp;
/*
* The utmp file holds miscellaneous information about things started by
@@ -900,8 +900,8 @@ static void update_utmp(struct options *op)
* utmp file can be opened for update, and if we are able to find our
* entry in the utmp file.
*/
- utmpname(_PATH_UTMP);
- setutent();
+ utmpxname(_PATH_UTMP);
+ setutxent();
/*
* Find my pid in utmp.
@@ -912,7 +912,7 @@ static void update_utmp(struct options *op)
* FIXME: The present code is taken from login.c, so if this is changed,
* maybe login has to be changed as well (is this true?).
*/
- while ((utp = getutent()))
+ while ((utp = getutxent()))
if (utp->ut_pid == pid
&& utp->ut_type >= INIT_PROCESS
&& utp->ut_type <= DEAD_PROCESS)
@@ -947,10 +947,10 @@ static void update_utmp(struct options *op)
ut.ut_pid = pid;
ut.ut_session = sid;
- pututline(&ut);
- endutent();
+ pututxline(&ut);
+ endutxent();
- updwtmp(_PATH_WTMP, &ut);
+ updwtmpx(_PATH_WTMP, &ut);
}
#endif /* SYSV_STYLE */
@@ -2448,12 +2448,12 @@ static void output_special_char(unsigned char c, struct options *op,
case 'U':
{
int users = 0;
- struct utmp *ut;
- setutent();
- while ((ut = getutent()))
+ struct utmpx *ut;
+ setutxent();
+ while ((ut = getutxent()))
if (ut->ut_type == USER_PROCESS)
users++;
- endutent();
+ endutxent();
if (c == 'U')
printf(P_("%d user", "%d users", users), users);
else
diff --git a/term-utils/wall.c b/term-utils/wall.c
index 2c1697c3b..0b7f52245 100644
--- a/term-utils/wall.c
+++ b/term-utils/wall.c
@@ -56,7 +56,7 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
-#include <utmp.h>
+#include <utmpx.h>
#include <getopt.h>
#include <sys/types.h>
#include <grp.h>
@@ -171,7 +171,7 @@ int main(int argc, char **argv)
{
int ch;
struct iovec iov;
- struct utmp *utmpptr;
+ struct utmpx *utmpptr;
char *p;
char line[sizeof(utmpptr->ut_line) + 1];
int print_banner = TRUE;
@@ -235,7 +235,7 @@ int main(int argc, char **argv)
iov.iov_base = mbuf;
iov.iov_len = mbufsize;
- while((utmpptr = getutent())) {
+ while((utmpptr = getutxent())) {
if (!utmpptr->ut_user[0])
continue;
#ifdef USER_PROCESS
@@ -255,7 +255,7 @@ int main(int argc, char **argv)
if ((p = ttymsg(&iov, 1, line, timeout)) != NULL)
warnx("%s", p);
}
- endutent();
+ endutxent();
free(mbuf);
free_group_workspace(group_buf);
exit(EXIT_SUCCESS);
diff --git a/term-utils/write.c b/term-utils/write.c
index 4f8f21eb5..2b05e89d9 100644
--- a/term-utils/write.c
+++ b/term-utils/write.c
@@ -57,7 +57,7 @@
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
-#include <utmp.h>
+#include <utmpx.h>
#include "c.h"
#include "carefulputc.h"
@@ -130,13 +130,13 @@ static int check_tty(const char *tty, int *tty_writeable, time_t *tty_atime, int
*/
static int check_utmp(const struct write_control *ctl)
{
- struct utmp *u;
+ struct utmpx *u;
int res = 1;
- utmpname(_PATH_UTMP);
- setutent();
+ utmpxname(_PATH_UTMP);
+ setutxent();
- while ((u = getutent())) {
+ while ((u = getutxent())) {
if (strncmp(ctl->dst_login, u->ut_user, sizeof(u->ut_user)) == 0 &&
strncmp(ctl->dst_tty_name, u->ut_line, sizeof(u->ut_line)) == 0) {
res = 0;
@@ -144,7 +144,7 @@ static int check_utmp(const struct write_control *ctl)
}
}
- endutent();
+ endutxent();
return res;
}
@@ -161,15 +161,15 @@ static int check_utmp(const struct write_control *ctl)
*/
static void search_utmp(struct write_control *ctl)
{
- struct utmp *u;
+ struct utmpx *u;
time_t best_atime = 0, tty_atime;
int num_ttys = 0, valid_ttys = 0, tty_writeable = 0, user_is_me = 0;
char path[sizeof(u->ut_line) + 6];
- utmpname(_PATH_UTMP);
- setutent();
+ utmpxname(_PATH_UTMP);
+ setutxent();
- while ((u = getutent())) {
+ while ((u = getutxent())) {
if (strncmp(ctl->dst_login, u->ut_user, sizeof(u->ut_user)) != 0)
continue;
num_ttys++;
@@ -197,7 +197,7 @@ static void search_utmp(struct write_control *ctl)
}
}
- endutent();
+ endutxent();
if (num_ttys == 0)
errx(EXIT_FAILURE, _("%s is not logged in"), ctl->dst_login);
if (valid_ttys == 0) {