Skip to content

Commit

Permalink
One more compatibility fix for old awk versions.
Browse files Browse the repository at this point in the history
Aimed at old "onetrueawk" versions as the preceding commit.
See #10 for details.
  • Loading branch information
step- committed Aug 13, 2020
1 parent 7550234 commit 1f3079f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion JSON.awk
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ BEGIN { #{{{1
} # else usage: awk -f JSON.awk file1 [file2...]

# set file slurping mode
srand(); RS="n/o/m/a/t/c/h" rand()
srand(); RS="\x01n/o/m/a/t/c/h" rand()

This comment has been minimized.

Copy link
@mohd-akram

mohd-akram Aug 15, 2020

Contributor

Hexadecimal sequence isn't allowed in POSIX awk (see Escape Sequences in awk), only octal.

This comment has been minimized.

Copy link
@step-

step- Aug 15, 2020

Author Owner

@mohd-akram, You're right. I even used to know this in 2016 but I forgot about it! If you can, please test if #5 affects jawk. Thank you.

This comment has been minimized.

Copy link
@mohd-akram

mohd-akram Aug 15, 2020

Contributor

It happens with jawk when the underlying awk is gawk. It's not a very big issue - if anything, it reveals incorrectly encoded JSON. I think the spec is too lenient in this case.

This comment has been minimized.

Copy link
@step-

step- Aug 15, 2020

Author Owner

Alright, thank you for all your feedback and testing. You're passionate about jawk and awk!

This comment has been minimized.

Copy link
@step-

step- Aug 18, 2020

Author Owner
}

{ # main loop: process each file in turn {{{1
Expand Down

0 comments on commit 1f3079f

Please sign in to comment.