onetrueawk / awk

One true awk
Other
1.96k stars 156 forks source link

Fix a bad cast to char * that causes incorrect results on big endian. #196

Closed millert closed 8 months ago

millert commented 10 months ago

Now that awk stores chars as int we need to cast the Node to int .

Fixes the following script on big endian CPUs.

BEGIN { work="K"; gsub("[x]", "J", work); print work; }

Before fix:

JKJ

After:

K

Thanks to George Koehler for simplifying the test case.

plan9 commented 10 months ago

thanks todd, appreciated.