Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

select(2) gawk extension

22 views
Skip to first unread message

Andy Spencer

unread,
Jan 24, 2012, 4:43:29 AM1/24/12
to
I started writing a GNU Awk extension that provides an interfaces to the
select(2) system call so that awk can read input from different sources
without blocking forever.

So far the interface I have is:

select(how, timeout, fd, ..)

how is one of: to, from, except, or any
timeout is an optional timeout in seconds
fd, .. is a list of strings representing file descriptors

I was wondering if anyone had any thoughts on this, and whether it might
be possible to get this extension included in the GNU Awk distribution.
I've pasted an example and a rough draft of the source code here:

Example: http://vpaste.net/3QIGf
Source: http://vpaste.net/YDR5z

Thanks

Aharon Robbins

unread,
Jan 25, 2012, 12:14:40 PM1/25/12
to
In article <20120124094...@c.gateway.2wire.net>,
Andy Spencer <andy7...@gmail.com> wrote:
>I started writing a GNU Awk extension that provides an interfaces to the
>select(2) system call so that awk can read input from different sources
>without blocking forever.
>
>So far the interface I have is:
>
> select(how, timeout, fd, ..)
>
> how is one of: to, from, except, or any
> timeout is an optional timeout in seconds

Don't most selects support at least milliseconds?

> fd, .. is a list of strings representing file descriptors

This should be an array of strings, each of which represents an
open redirection. Maybe that's what you meant?

>I was wondering if anyone had any thoughts on this, and whether it might
>be possible to get this extension included in the GNU Awk distribution.

Getting something included is a matter of signing paperwork. Be in
touch with me offline.

>I've pasted an example and a rough draft of the source code here:
>
> Example: http://vpaste.net/3QIGf
> Source: http://vpaste.net/YDR5z

Will try to take a look at them.

>Thanks

Sure,

Arnold
--
Aharon (Arnold) Robbins arnold AT skeeve DOT com
P.O. Box 354 Home Phone: +972 8 979-0381
Nof Ayalon Cell Phone: +972 50 729-7545
D.N. Shimshon 99785 ISRAEL

Aharon Robbins

unread,
Jan 25, 2012, 12:18:00 PM1/25/12
to
In article <jfpda0$5u5$1...@dont-email.me>,
Aharon Robbins <arn...@skeeve.com> wrote:
>In article <20120124094...@c.gateway.2wire.net>,
>Andy Spencer <andy7...@gmail.com> wrote:
>>I started writing a GNU Awk extension that provides an interfaces to the
>>select(2) system call so that awk can read input from different sources
>>without blocking forever.
>>
>>So far the interface I have is:
>>
>> select(how, timeout, fd, ..)
>>
>> how is one of: to, from, except, or any
>> timeout is an optional timeout in seconds
>
>Don't most selects support at least milliseconds?
>
>> fd, .. is a list of strings representing file descriptors
>
>This should be an array of strings, each of which represents an
>open redirection. Maybe that's what you meant?

Ah - looked at your code. Now I see what you mean. Not too unreasonable.

>>I was wondering if anyone had any thoughts on this, and whether it might
>>be possible to get this extension included in the GNU Awk distribution.
>
>Getting something included is a matter of signing paperwork. Be in
>touch with me offline.
>
>>I've pasted an example and a rough draft of the source code here:
>>
>> Example: http://vpaste.net/3QIGf
>> Source: http://vpaste.net/YDR5z

Please try to follow the gawk coding style more (K&R layout). Also, please
use strcmp(x, y) == 0 instead of !strcmp.

Thanks,
0 new messages