From bbc33d34502ef074746c8db88b2c285b70421fe8 Mon Sep 17 00:00:00 2001 From: surdeus Date: Wed, 1 Feb 2023 02:56:27 +0500 Subject: [PATCH] Fixed AWKs wrong argument interpretation. Should replace their argument parsing with the standard one.; --- src/tool/awk/goawk.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tool/awk/goawk.go b/src/tool/awk/goawk.go index 27e7e39..f9bfb27 100644 --- a/src/tool/awk/goawk.go +++ b/src/tool/awk/goawk.go @@ -83,6 +83,8 @@ func Run(args []string) { outputMode := "" header := false + argv0 := args[0] + var i int for i = 1; i < len(args); i++ { // Stop on explicit end of args or first arg not prefixed with "-" @@ -177,6 +179,7 @@ func Run(args []string) { // Any remaining args are program and input files args = args[i:] + fmt.Printf("args: %q\n", args) var src []byte var stdinBytes []byte // used if there's a parse error if len(progFiles) > 0 { @@ -259,7 +262,7 @@ func Run(args []string) { } config := &interp.Config{ - Argv0: filepath.Base(args[0]), + Argv0: filepath.Base(argv0), Args: expandWildcardsOnWindows(args), Vars: []string{ "FS", fieldSep,