Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The devil finds work for idle circuits to do.


devel / comp.lang.awk / Re: cppawk has some charms. :)

SubjectAuthor
* cppawk has some charms. :)Kaz Kylheku
`- Re: cppawk has some charms. :)Ed Morton

1
cppawk has some charms. :)

<20220318182426.515@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1149&group=comp.lang.awk#1149

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-1380@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.awk
Subject: cppawk has some charms. :)
Date: Sat, 19 Mar 2022 01:29:41 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <20220318182426.515@kylheku.com>
Injection-Date: Sat, 19 Mar 2022 01:29:41 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="1e616d23022a883ee3a9d2c780f8baa8";
logging-data="6860"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+aDnBJFoMq3XNJ76XxGOkpIKt6niaX9Rc="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:LBbuFHudcQr8Y3HlVDmbplKgIvw=
 by: Kaz Kylheku - Sat, 19 Mar 2022 01:29 UTC

$ cppawk -f foo.cwk
/dev/sda1

$ cat foo.cwk
#include "awkloop.h"

function main()
{ awkloop ("/proc/mounts") {
rule ($3 != "ext4") { nextrec }
rule ($2 == "/") { print $1 }
}
}

BEGIN {
main()
}

$ cat awkloop.h
#define awkloop(file) for (; getline < file || (close(file) && 0); )
#define nextrec continue
#define rule(cond) if (cond)

:)

Re: cppawk has some charms. :)

<t1s8n2$fin$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1173&group=comp.lang.awk#1173

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.lang.awk
Subject: Re: cppawk has some charms. :)
Date: Mon, 28 Mar 2022 07:12:18 -0500
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <t1s8n2$fin$1@dont-email.me>
References: <20220318182426.515@kylheku.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 28 Mar 2022 12:12:18 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b83f6ea49277a1dbb8daccf82b3277b8";
logging-data="15959"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19l+W/bBZbUJz/i6jeHh15p"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:clSKyI3hHseydUyfQRRQrfVF/a0=
In-Reply-To: <20220318182426.515@kylheku.com>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 220327-4, 3/27/2022), Outbound message
 by: Ed Morton - Mon, 28 Mar 2022 12:12 UTC

On 3/18/2022 8:29 PM, Kaz Kylheku wrote:
> $ cppawk -f foo.cwk
> /dev/sda1
>
>
> $ cat foo.cwk
> #include "awkloop.h"
>
> function main()
> {
> awkloop ("/proc/mounts") {
> rule ($3 != "ext4") { nextrec }
> rule ($2 == "/") { print $1 }
> }
> }
>
> BEGIN {
> main()
> }
>
>
> $ cat awkloop.h
> #define awkloop(file) for (; getline < file || (close(file) && 0); )

That would spin off into an infinite loop if getline failed since it'd
then return a negative number which is non-zero and therefore considered
"true" in a conditional context. `getline < file` needs to be `(getline
< file) > 0`. See http://awk.freeshell.org/AllAboutGetline.

Ed.

> #define nextrec continue
> #define rule(cond) if (cond)
>
>
> :)

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor