* new awk breaks joynes
@ 2016-05-27 11:21 qwx
2016-05-27 16:07 ` [9front] " cinap_lenrek
0 siblings, 1 reply; 3+ messages in thread
From: qwx @ 2016-05-27 11:21 UTC (permalink / raw)
To: 9front
Hello,
The recent changes to awk(1) seem to have broken
/sys/src/games/nes/joynes.
Specifically, printf's seem to be no longer buffered, but individual
writes. This causes /sys/src/games/nes/nes.c:/^joyproc to read each of
joynes' printf's as a separate message rather than a single line, and
results in any keys being cleared before they may be parsed in mem.c.
I don't know awk well enough nor whether this behavior is desirable or
not, but in case it is, the inlined patch below fixes joynes.
Thanks,
qwx
diff -r 3539dab16880 sys/src/games/nes/joynes
--- a/sys/src/games/nes/joynes Fri May 20 09:56:45 2016 +0200
+++ b/sys/src/games/nes/joynes Thu May 26 23:46:53 2016 +0200
@@ -1,7 +1,7 @@
#!/bin/rc
# run as "nusb/joy epX.Y | joynes N", where N=[1,2]
-awk -safe -v 'joy='$1 '
+awk -safe -v 'joy='joy$1 '
BEGIN { k[0] = "" }
/^axis 0 0/ { k[0] = "left " }
@@ -22,12 +22,5 @@
/^up 1$/ { k[4] = "" }
/^up 2$/ { k[5] = "" }
- {
- if(joy != "")
- printf "joy%s ", joy
- for(i = 0; i <= 5; i++)
- printf k[i]
- printf "\n"
- fflush
- }
+ { print joy " " k[0] k[1] k[2] k[3] k[4] k[5] }
'
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9front] new awk breaks joynes
2016-05-27 11:21 new awk breaks joynes qwx
@ 2016-05-27 16:07 ` cinap_lenrek
2016-05-27 21:46 ` qwx
0 siblings, 1 reply; 3+ messages in thread
From: cinap_lenrek @ 2016-05-27 16:07 UTC (permalink / raw)
To: 9front
you should also put a fflush at the end, so it would work
even with old awk no? but seems fine to me.
--
cinap
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9front] new awk breaks joynes
2016-05-27 16:07 ` [9front] " cinap_lenrek
@ 2016-05-27 21:46 ` qwx
0 siblings, 0 replies; 3+ messages in thread
From: qwx @ 2016-05-27 21:46 UTC (permalink / raw)
To: 9front
On Fri, May 27, 2016 at 06:07:29PM +0200, cinap_lenrek@felloff.net wrote:
>
> you should also put a fflush at the end, so it would work
> even with old awk no? but seems fine to me.
>
> --
> cinap
I didn't understand what you meant by this, but the commit you did is
better than just patching random awk scripts anyway.
Thank you for the work,
qwx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-27 21:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-27 11:21 new awk breaks joynes qwx
2016-05-27 16:07 ` [9front] " cinap_lenrek
2016-05-27 21:46 ` qwx
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).