summaryrefslogtreecommitdiff
path: root/usr.bin/awk/main.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2023-09-18 19:32:20 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2023-09-18 19:32:20 +0000
commitf5a82c30f282157f9d8006923716d6986c07dc5c (patch)
tree4ae63f3676910bdd3da7342aeda988735131c47f /usr.bin/awk/main.c
parentdf1ad7a2370e6466128088bc2f14f629e72515aa (diff)
Disable utf-8 for non-multibyte locales, such as C or POSIX.
This makes it possible to get the old awk behavior (where chars are bytes) by setting LC_CTYPE to C or POSIX. OK schwarze@
Diffstat (limited to 'usr.bin/awk/main.c')
-rw-r--r--usr.bin/awk/main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c
index f4a359dac7e..5a976d82814 100644
--- a/usr.bin/awk/main.c
+++ b/usr.bin/awk/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.60 2023/09/18 15:20:48 jmc Exp $ */
+/* $OpenBSD: main.c,v 1.61 2023/09/18 19:32:19 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -56,6 +56,8 @@ bool CSV = false; /* true for csv input */
bool safe = false; /* true => "safe" mode */
bool do_posix = false; /* true => POSIX mode */
+size_t awk_mb_cur_max = 1;
+
static noreturn void fpecatch(int n
#ifdef SA_SIGINFO
, siginfo_t *si, void *uc
@@ -135,6 +137,7 @@ int main(int argc, char *argv[])
setlocale(LC_CTYPE, "");
setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */
+ awk_mb_cur_max = MB_CUR_MAX;
cmdname = __progname;
if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) {