From 7bcc45ac7597aa3bc60b3b706c05bd6abc9e6b7a Mon Sep 17 00:00:00 2001 From: millert Date: Wed, 24 Jan 2018 16:28:25 +0000 Subject: [PATCH] POSIX requires that awk support \v and \a escapes. I used '\007' for BEL since that is what lex.c uses, though we could safely use '\a' there instead. OK martijn@ --- usr.bin/awk/b.c | 6 +++++- usr.bin/awk/tran.c | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/usr.bin/awk/b.c b/usr.bin/awk/b.c index cfc0a57339e..5091823bb01 100644 --- a/usr.bin/awk/b.c +++ b/usr.bin/awk/b.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b.c,v 1.19 2017/10/09 14:51:31 deraadt Exp $ */ +/* $OpenBSD: b.c,v 1.20 2018/01/24 16:28:25 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -260,6 +260,8 @@ int quoted(uschar **pp) /* pick up next thing after a \\ */ if ((c = *p++) == 't') c = '\t'; + else if (c == 'v') + c = '\v'; else if (c == 'n') c = '\n'; else if (c == 'f') @@ -268,6 +270,8 @@ int quoted(uschar **pp) /* pick up next thing after a \\ */ c = '\r'; else if (c == 'b') c = '\b'; + else if (c == 'a') + c = '\007'; else if (c == '\\') c = '\\'; else if (c == 'x') { /* hexadecimal goo follows */ diff --git a/usr.bin/awk/tran.c b/usr.bin/awk/tran.c index 6bebe2e9047..1105b5d4fe3 100644 --- a/usr.bin/awk/tran.c +++ b/usr.bin/awk/tran.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tran.c,v 1.16 2017/10/09 14:51:31 deraadt Exp $ */ +/* $OpenBSD: tran.c,v 1.17 2018/01/24 16:28:25 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -434,9 +434,11 @@ char *qstring(const char *is, int delim) /* collect string up to next delim */ case '\\': *bp++ = '\\'; break; case 'n': *bp++ = '\n'; break; case 't': *bp++ = '\t'; break; + case 'v': *bp++ = '\v'; break; case 'b': *bp++ = '\b'; break; case 'f': *bp++ = '\f'; break; case 'r': *bp++ = '\r'; break; + case 'a': *bp++ = '\007'; break; default: if (!isdigit(c)) { *bp++ = c; -- 2.20.1