From b9b1816c2ff338dbcbe349d15d38e2d1ef36d459 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 27 Jul 2021 18:28:20 +0000 Subject: POSIX mandates that -F str be treated the same as -v FS=str. For a null string, this was not the case. Since awk(1) documents that a null string for FS has a specific behavior, make -F '' behave consistently with -v FS="". https://github.com/onetrueawk/awk/pull/128 --- usr.bin/awk/main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c index 5a195940b94..61b011b4128 100644 --- a/usr.bin/awk/main.c +++ b/usr.bin/awk/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.47 2020/12/18 21:36:24 millert Exp $ */ +/* $OpenBSD: main.c,v 1.48 2021/07/27 18:28:19 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -111,9 +111,7 @@ setfs(char *p) /* wart: t=>\t */ if (p[0] == 't' && p[1] == '\0') return "\t"; - else if (p[0] != '\0') - return p; - return NULL; + return p; } static char * @@ -189,8 +187,6 @@ int main(int argc, char *argv[]) break; case 'F': /* set field separator */ fs = setfs(getarg(&argc, &argv, "no field separator")); - if (fs == NULL) - WARNING("field separator FS is empty"); break; case 'v': /* -v a=1 to be done NOW. one -v for each */ vn = getarg(&argc, &argv, "no variable name"); -- cgit v1.2.3