summaryrefslogtreecommitdiff
path: root/usr.bin/awk
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2021-07-27 18:28:20 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2021-07-27 18:28:20 +0000
commitb9b1816c2ff338dbcbe349d15d38e2d1ef36d459 (patch)
treea9502ff64b37f039ff44b1308ee59a99db7f519c /usr.bin/awk
parent4416fc2f908a415bce0d18d7f6d7b8ada52cb241 (diff)
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
Diffstat (limited to 'usr.bin/awk')
-rw-r--r--usr.bin/awk/main.c8
1 files changed, 2 insertions, 6 deletions
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");