Module Name:    src
Committed By:   rillig
Date:           Mon Jul  4 18:07:41 UTC 2022

Modified Files:
        src/external/historical/nawk/bin: awk.1

Log Message:
awk.1: revert changes to example 'echo' program

I had removed the exit statement in the strong belief that POSIX had
specified that an AWK program consisting of only a BEGIN block would
implicitly exit after the BEGIN block.  This assumption was wrong.
There are several implementations that implement this special case
though.

https://mail-index.netbsd.org/source-changes-d/2022/07/03/msg013718.html


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/historical/nawk/bin/awk.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/historical/nawk/bin/awk.1
diff -u src/external/historical/nawk/bin/awk.1:1.9 src/external/historical/nawk/bin/awk.1:1.10
--- src/external/historical/nawk/bin/awk.1:1.9	Sun Jul  3 10:56:22 2022
+++ src/external/historical/nawk/bin/awk.1	Mon Jul  4 18:07:41 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: awk.1,v 1.9 2022/07/03 10:56:22 rillig Exp $
+.\"	$NetBSD: awk.1,v 1.10 2022/07/04 18:07:41 rillig Exp $
 .\"
 .\" Copyright (C) Lucent Technologies 1997
 .\" All Rights Reserved
@@ -22,7 +22,7 @@
 .\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
 .\" THIS SOFTWARE.
 .\"
-.Dd July 3, 2022
+.Dd December 19, 2019
 .Dt AWK 1
 .Os
 .Sh NAME
@@ -711,11 +711,10 @@ Print all lines between start/stop pairs
 .Pp
 Simulate echo(1):
 .Bd -literal -offset indent
-BEGIN {
-	if (1 < ARGC) printf "%s", ARGV[1]
-	for (i = 2; i < ARGC; i++) printf " %s", ARGV[i]
-	printf "\en"
-}
+BEGIN { # Simulate echo(1)
+        for (i = 1; i < ARGC; i++) printf "%s ", ARGV[i]
+        printf "\en"
+        exit }
 .Ed
 .Pp
 Print an error message to standard error:

Reply via email to