From 76b680b1a9deeb83c310115fd96fd6f51d37cd53 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 8 Aug 2019 12:12:55 -0700 Subject: Remove isascii usage There is a c_isascii function that can be used. isascii is deprecated and not available with some libcs like uClibc-ng where it can be compile time disabled. --- include/carefulputc.h | 4 +++- term-utils/agetty.c | 3 ++- term-utils/wall.c | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/carefulputc.h b/include/carefulputc.h index 54a02bfef..f1c03566d 100644 --- a/include/carefulputc.h +++ b/include/carefulputc.h @@ -10,13 +10,15 @@ #include #include +#include "cctype.h" + static inline int fputc_careful(int c, FILE *fp, const char fail) { int ret; if (isprint(c) || c == '\a' || c == '\t' || c == '\r' || c == '\n') ret = putc(c, fp); - else if (!isascii(c)) + else if (!c_isascii(c)) ret = fprintf(fp, "\\%3o", (unsigned char)c); else { ret = putc(fail, fp); diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 703fb9fd7..038152d56 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -42,6 +42,7 @@ #include "nls.h" #include "pathnames.h" #include "c.h" +#include "cctype.h" #include "widechar.h" #include "ttyutils.h" #include "color-names.h" @@ -1432,7 +1433,7 @@ static void auto_baud(struct termios *tp) if ((nread = read(STDIN_FILENO, buf, sizeof(buf) - 1)) > 0) { buf[nread] = '\0'; for (bp = buf; bp < buf + nread; bp++) - if (isascii(*bp) && isdigit(*bp)) { + if (c_isascii(*bp) && isdigit(*bp)) { if ((speed = bcode(bp))) { cfsetispeed(tp, speed); cfsetospeed(tp, speed); diff --git a/term-utils/wall.c b/term-utils/wall.c index c3e89bab9..bf92fe1b7 100644 --- a/term-utils/wall.c +++ b/term-utils/wall.c @@ -68,6 +68,7 @@ #include "pathnames.h" #include "carefulputc.h" #include "c.h" +#include "cctype.h" #include "fileutils.h" #include "closestream.h" @@ -324,7 +325,7 @@ static void buf_putc_careful(struct buffer *bs, int c) if (isprint(c) || c == '\a' || c == '\t' || c == '\r' || c == '\n') { buf_enlarge(bs, 1); bs->data[bs->used++] = c; - } else if (!isascii(c)) + } else if (!c_isascii(c)) buf_printf(bs, "\\%3o", (unsigned char)c); else { char tmp[] = { '^', c ^ 0x40, '\0' }; -- cgit v1.2.3-55-g7522