Fixed awk,

This commit is contained in:
Andrey Parhomenko 2023-03-24 21:06:07 +03:00
parent 6777a136e6
commit 7b24de683b
3 changed files with 10 additions and 4 deletions

2
go.mod
View file

@ -2,4 +2,4 @@ module github.com/surdeus/goblin
go 1.18 go 1.18
require github.com/surdeus/gomtool v0.0.0-20230324163514-3199e25c3890 // indirect require github.com/surdeus/gomtool v0.0.0-20230324173629-09da5dcd0204 // indirect

4
go.sum
View file

@ -16,3 +16,7 @@ github.com/surdeus/gomtool v0.0.0-20230324073313-c382bc403f8b h1:9IJVeXxRDTPlp12
github.com/surdeus/gomtool v0.0.0-20230324073313-c382bc403f8b/go.mod h1:48d4QXOu0MwH0fbqseBInNdS6WiJ0+EzZU9K5sGu4uo= github.com/surdeus/gomtool v0.0.0-20230324073313-c382bc403f8b/go.mod h1:48d4QXOu0MwH0fbqseBInNdS6WiJ0+EzZU9K5sGu4uo=
github.com/surdeus/gomtool v0.0.0-20230324163514-3199e25c3890 h1:mT4VDgCb2AgPfq2k4GfXI8O3I2sIjHJUaJwBvx95AYM= github.com/surdeus/gomtool v0.0.0-20230324163514-3199e25c3890 h1:mT4VDgCb2AgPfq2k4GfXI8O3I2sIjHJUaJwBvx95AYM=
github.com/surdeus/gomtool v0.0.0-20230324163514-3199e25c3890/go.mod h1:48d4QXOu0MwH0fbqseBInNdS6WiJ0+EzZU9K5sGu4uo= github.com/surdeus/gomtool v0.0.0-20230324163514-3199e25c3890/go.mod h1:48d4QXOu0MwH0fbqseBInNdS6WiJ0+EzZU9K5sGu4uo=
github.com/surdeus/gomtool v0.0.0-20230324171804-d106f3a7c3da h1:Wm3ZbhHuH/26B4/vde1S/7t3UPdAXVH7aX1LmHtUTWw=
github.com/surdeus/gomtool v0.0.0-20230324171804-d106f3a7c3da/go.mod h1:48d4QXOu0MwH0fbqseBInNdS6WiJ0+EzZU9K5sGu4uo=
github.com/surdeus/gomtool v0.0.0-20230324173629-09da5dcd0204 h1:eNKjFr0w81mb1d3i2P4uAEIzgc6VVTRJJy6BDWq2vK0=
github.com/surdeus/gomtool v0.0.0-20230324173629-09da5dcd0204/go.mod h1:48d4QXOu0MwH0fbqseBInNdS6WiJ0+EzZU9K5sGu4uo=

View file

@ -73,6 +73,8 @@ func Run(flags *mtool.Flags) {
// Parse command line arguments manually rather than using the // Parse command line arguments manually rather than using the
// "flag" package, so we can support flags with no space between // "flag" package, so we can support flags with no space between
// flag and argument, like '-F:' (allowed by POSIX) // flag and argument, like '-F:' (allowed by POSIX)
// J's comment: nope, we will change it, lol.
var progFiles []string var progFiles []string
var vars []string var vars []string
fieldSep := " " fieldSep := " "
@ -86,10 +88,10 @@ func Run(flags *mtool.Flags) {
header := false header := false
argv0 := flags.UtilName() argv0 := flags.UtilName()
args := flags.Args() args := flags.AllArgs()
var i int var i int
for i = 1; i < len(args); i++ { for i = 0; i < len(args); i++ {
// Stop on explicit end of args or first arg not prefixed with "-" // Stop on explicit end of args or first arg not prefixed with "-"
arg := args[i] arg := args[i]
if arg == "--" { if arg == "--" {
@ -181,7 +183,7 @@ func Run(flags *mtool.Flags) {
// Any remaining args are program and input files // Any remaining args are program and input files
args = args[i:] args = args[i:]
var src []byte var src []byte
var stdinBytes []byte // used if there's a parse error var stdinBytes []byte // used if there's a parse error
if len(progFiles) > 0 { if len(progFiles) > 0 {