]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
treewide: use fgetc() instead of getc()
authorThomas Weißschuh <thomas@t-8ch.de>
Sat, 13 Apr 2024 10:59:10 +0000 (12:59 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Sat, 13 Apr 2024 11:04:36 +0000 (13:04 +0200)
fgetc() is similar to getc() but is guaranteed to be a function.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
login-utils/islocal.c
term-utils/agetty.c
text-utils/more.c

index ab5c52ed585300085696e9887c667a0aee49786e..7d5541fd10cb6c9da24797e89e98b7047aa2d17e 100644 (file)
@@ -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) {
index 0fc6f151443e5ec122b4b8b991ec7654b4300961..ff5123dbf630f0626664e1ebc1767e984d7e257b 100644 (file)
@@ -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);
        }
index 1badf67d55dbc59fe95e7f1e4b5a5fd3bfd3de94..4c22533185bbcf07e7deb615958d6a937823969b 100644 (file)
@@ -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;
 }