summaryrefslogtreecommitdiffstats
path: root/term-utils
diff options
context:
space:
mode:
authorKarel Zak2018-10-11 13:21:23 +0200
committerKarel Zak2018-10-11 13:21:23 +0200
commit980a6e431cf69107a96e1a365be43f66fd3ccb2a (patch)
tree021dc2e002bf0c27752a5f37f3449c01c50b27aa /term-utils
parentagetty: move all issue variables to struct (diff)
downloadkernel-qcow2-util-linux-980a6e431cf69107a96e1a365be43f66fd3ccb2a.tar.gz
kernel-qcow2-util-linux-980a6e431cf69107a96e1a365be43f66fd3ccb2a.tar.xz
kernel-qcow2-util-linux-980a6e431cf69107a96e1a365be43f66fd3ccb2a.zip
agetty: cleanup issue output change, remove bool
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'term-utils')
-rw-r--r--term-utils/agetty.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index 978be43d6..6072694ef 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -28,7 +28,6 @@
#include <utmpx.h>
#include <getopt.h>
#include <time.h>
-#include <stdbool.h>
#include <sys/socket.h>
#include <langinfo.h>
#include <grp.h>
@@ -1759,18 +1758,17 @@ static void eval_issue_file(struct issue *ie __attribute__((__unused__)),
}
#else /* ISSUE_SUPPORT */
-static bool cmp_issue_file(struct issue *ie)
+static int issue_is_changed(struct issue *ie)
{
- if (ie->mem_old && ie->mem) {
- if (!strcmp(ie->mem_old, ie->mem)) {
- free(ie->mem_old);
- ie->mem_old = ie->mem;
- ie->mem = NULL;
- return false;
- }
- } else
- return true;
- return true;
+ if (ie->mem_old && ie->mem
+ && strcmp(ie->mem_old, ie->mem) == 0) {
+ free(ie->mem_old);
+ ie->mem_old = ie->mem;
+ ie->mem = NULL;
+ return 0;
+ }
+
+ return 1;
}
static void print_issue_file(struct issue *ie,
@@ -1869,7 +1867,7 @@ static void eval_issue_file(struct issue *ie,
if (f || dirname) {
int c;
- ie->do_tcsetattr = true;
+ ie->do_tcsetattr = 1;
do {
#ifdef ISSUEDIR_SUPPORT
@@ -1891,7 +1889,7 @@ static void eval_issue_file(struct issue *ie,
fflush(stdout);
if ((op->flags & F_VCONSOLE) == 0)
- ie->do_tcrestore = true;
+ ie->do_tcrestore = 1;
}
#ifdef ISSUEDIR_SUPPORT
@@ -1923,7 +1921,7 @@ again:
/* reload issue */
if (!wait_for_term_input(STDIN_FILENO)) {
eval_issue_file(ie, op, tp);
- if (cmp_issue_file(ie)) {
+ if (issue_is_changed(ie)) {
if (op->flags & F_VCONSOLE)
termio_clear(STDOUT_FILENO);
goto again;
@@ -2062,7 +2060,7 @@ static char *get_logname(struct issue *ie, struct options *op, struct termios *t
if ((op->flags & F_VCONSOLE) == 0)
sleep(1);
eval_issue_file(ie, op, tp);
- if (!cmp_issue_file(ie))
+ if (!issue_is_changed(ie))
goto no_reload;
tcflush(STDIN_FILENO, TCIFLUSH);
if (op->flags & F_VCONSOLE)