From ccb3af024cb134acb391a44283dec4ed40c3605b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sat, 13 Apr 2024 12:59:10 +0200 Subject: [PATCH] treewide: use fgetc() instead of getc() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit fgetc() is similar to getc() but is guaranteed to be a function. Signed-off-by: Thomas Weißschuh --- login-utils/islocal.c | 2 +- term-utils/agetty.c | 4 ++-- text-utils/more.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/login-utils/islocal.c b/login-utils/islocal.c index ab5c52ed58..7d5541fd10 100644 --- a/login-utils/islocal.c +++ b/login-utils/islocal.c @@ -39,7 +39,7 @@ static int is_local_in_file(const char *user, const char *filename) match = 0u; skip = 0; - while ((chin = getc(f)) != EOF) { + while ((chin = fgetc(f)) != EOF) { if (skip) { /* Looking for the start of the next line. */ if ('\n' == chin) { diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 0fc6f15144..ff5123dbf6 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -1843,9 +1843,9 @@ static int issuefile_read_stream( ie->output = open_memstream(&ie->mem, &ie->mem_sz); } - while ((c = getc(f)) != EOF) { + while ((c = fgetc(f)) != EOF) { if (c == '\\') - output_special_char(ie, getc(f), op, tp, f); + output_special_char(ie, fgetc(f), op, tp, f); else putc(c, ie->output); } diff --git a/text-utils/more.c b/text-utils/more.c index 1badf67d55..4c22533185 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -379,7 +379,7 @@ static void more_fseek(struct more_control *ctl, off_t pos) static int more_getc(struct more_control *ctl) { - int ret = getc(ctl->current_file); + int ret = fgetc(ctl->current_file); ctl->file_position = ftello(ctl->current_file); return ret; } -- 2.47.3