From: Ralph Ronnquist Date: Sat, 12 Jun 2021 14:37:53 +0000 (+1000) Subject: slight polishing X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=8e9e9a2c52a654a354a83c9d80662fa34fab677d;p=rrq%2Frrqforth.git slight polishing --- diff --git a/examples/uenventlog.f b/examples/uenventlog.f index ff69c48..acf6222 100755 --- a/examples/uenventlog.f +++ b/examples/uenventlog.f @@ -16,7 +16,7 @@ SYSTEM DEFINITIONS ; : DIE" ( n " quoted" -- ; If v then print message and exit ) - " ROT IF TELL NL EMIT EXIT THEN 2DROP + " ROT IF TELL NL EMIT 1 EXIT THEN 2DROP ; HEX 100 DECIMAL CONSTANT MSG_WAITALL @@ -27,14 +27,6 @@ HEX 80002 DECIMAL CONSTANT SOCK_DGRAM|SOCK_CLOEXEC VARIABLE RECV-BUFFER NL_MAX_PAYLOAD ALLOT -: PRINTMSG ( n -- ; print RECV-BUFFER message ) - ( n is message length when >0 but we only use text up to first NUL ) - DUP 0 > - IF DROP RECV-BUFFER DUP STRLEN TELL NL EMIT - ELSE S" ** Error: " TELL . NL EMIT - THEN -; - VARIABLE NL-SOCKADDR ( 0-1 .family ) AF_NETLINK W, ( 2-3 ??? ) 0 W, @@ -52,7 +44,10 @@ SYS_BIND DIE" Failed to bind" : NL-LOOP BEGIN NL-SOCKET @ RECV-BUFFER NL_MAX_PAYLOAD MSG_WAITALL 0 0 - SYS_RECVFROM PRINTMSG + SYS_RECVFROM DUP 0 > + IF DROP RECV-BUFFER DUP STRLEN TELL NL EMIT + ELSE S" ** Error: " TELL . NL EMIT + THEN AGAIN ;