From 35d455fd72a9f2e3658795b089d5468aaa09ed52 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 11 Jul 2025 15:54:52 +0100 Subject: [PATCH] C23: CmdSubrs.c fixup deprecated isascii() --- commands/CmdSubrs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/commands/CmdSubrs.c b/commands/CmdSubrs.c index 14de68bf..f62c5386 100644 --- a/commands/CmdSubrs.c +++ b/commands/CmdSubrs.c @@ -1196,6 +1196,17 @@ cmdGetSelFunc( return 1; /* Skip any other selected cells. */ } + +/* The Open Group, Sep 2006, Austin/317 deprecated isascii(), + * Apparently it cannot be used portably in a localized application. + */ +static int +magic_isascii(int c) +{ + return (c & ~0x7f) == 0; +} + + /* * ---------------------------------------------------------------------------- * @@ -1228,7 +1239,7 @@ CmdIllegalChars( for (p = string; *p != 0; p++) { - if (!isascii(*p)) goto error; + if (!magic_isascii(*p)) goto error; if (iscntrl(*p)) goto error; for (bad = illegal; *bad != 0; bad++) { @@ -1237,7 +1248,7 @@ CmdIllegalChars( continue; error: - if (!isascii(*p) || iscntrl(*p)) + if (!magic_isascii(*p) || iscntrl(*p)) { TxError("%s contains illegal control character 0x%x\n", msg, *p);