aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2024-04-13 10:21:21 +0200
committerThomas Weißschuh <thomas@t-8ch.de>2024-04-13 10:34:53 +0200
commitef4fd528cb6dcddb867df903355d8289e12a7206 (patch)
treee94a655c21308342a4c3e5f6ff2e9f8729e295ef
parent5ebf0edb0a0531cba801c7791543c610725bf944 (diff)
downloadutil-linux-ef4fd528cb6dcddb867df903355d8289e12a7206.tar.gz
textutils: use fgetwc() instead of getwc()
getwc() has the same semantics as fgetwc() but may be a function or macro. According to the manpage "there is no reason ever to use it". Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
-rw-r--r--text-utils/colcrt.c6
-rw-r--r--text-utils/colrm.c6
-rw-r--r--text-utils/ul.c6
3 files changed, 9 insertions, 9 deletions
diff --git a/text-utils/colcrt.c b/text-utils/colcrt.c
index a6da499763..44d2c8a8c8 100644
--- a/text-utils/colcrt.c
+++ b/text-utils/colcrt.c
@@ -164,7 +164,7 @@ static void colcrt(struct colcrt_control *ctl)
errno = 0;
old_pos = ftell(ctl->f);
- while (getwc(ctl->f) != L'\n') {
+ while (fgetwc(ctl->f) != L'\n') {
long new_pos;
if (ferror(ctl->f) || feof(ctl->f))
@@ -179,10 +179,10 @@ static void colcrt(struct colcrt_control *ctl)
col = -1;
continue;
}
- c = getwc(ctl->f);
+ c = fgetwc(ctl->f);
switch (c) {
case 033: /* ESC */
- c = getwc(ctl->f);
+ c = fgetwc(ctl->f);
if (c == L'8') {
col = rubchars(ctl, col, 1);
continue;
diff --git a/text-utils/colrm.c b/text-utils/colrm.c
index 122564339f..d893137164 100644
--- a/text-utils/colrm.c
+++ b/text-utils/colrm.c
@@ -81,7 +81,7 @@ static int process_input(unsigned long first, unsigned long last)
int padding;
for (;;) {
- c = getwc(stdin);
+ c = fgetwc(stdin);
if (c == WEOF)
return 0;
if (c == '\t')
@@ -112,7 +112,7 @@ static int process_input(unsigned long first, unsigned long last)
/* Loop getting rid of characters */
while (!last || ct < last) {
- c = getwc(stdin);
+ c = fgetwc(stdin);
if (c == WEOF)
return 0;
if (c == '\n') {
@@ -135,7 +135,7 @@ static int process_input(unsigned long first, unsigned long last)
/* Output last of the line */
for (;;) {
- c = getwc(stdin);
+ c = fgetwc(stdin);
if (c == WEOF)
break;
if (c == '\n') {
diff --git a/text-utils/ul.c b/text-utils/ul.c
index 85fa86fe48..1df4642eb3 100644
--- a/text-utils/ul.c
+++ b/text-utils/ul.c
@@ -439,7 +439,7 @@ static int handle_escape(struct ul_ctl *ctl, struct term_caps const *const tcs,
{
wint_t c;
- switch (c = getwc(f)) {
+ switch (c = fgetwc(f)) {
case HREV:
if (0 < ctl->half_position) {
ctl->mode &= ~SUBSCRIPT;
@@ -479,7 +479,7 @@ static void filter(struct ul_ctl *ctl, struct term_caps const *const tcs, FILE *
wint_t c;
int i, width;
- while ((c = getwc(f)) != WEOF) {
+ while ((c = fgetwc(f)) != WEOF) {
switch (c) {
case '\b':
set_column(ctl, ctl->column && 0 < ctl->column ? ctl->column - 1 : 0);
@@ -498,7 +498,7 @@ static void filter(struct ul_ctl *ctl, struct term_caps const *const tcs, FILE *
continue;
case ESC:
if (handle_escape(ctl, tcs, f)) {
- c = getwc(f);
+ c = fgetwc(f);
errx(EXIT_FAILURE,
_("unknown escape sequence in input: %o, %o"), ESC, c);
}