bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] [PATCH] gawk 4.1.1 replace "/inet" with preprocessor macr


From: Andrew J. Schorr
Subject: Re: [bug-gawk] [PATCH] gawk 4.1.1 replace "/inet" with preprocessor macro
Date: Thu, 17 Apr 2014 10:49:30 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Arnold,

On Thu, Apr 17, 2014 at 05:18:00PM +0300, Aharon Robbins wrote:
> I think I agree with Andy. Improving the check to look for
> 
>       /inet{,4,6}/{tcp,udp}/whatever
> 
> would probably handle the case of a real /inet directory and should
> not complicate the code overly much.  I think this would let you
> have your cake and eat it too, no?
> 
> Andy - do you have the cycles to prepare a patch?

I should be able to get to it.  Do you want to match only
on the "/inet{,4,6}/{tcp,udp}/" prefix or parse the name fully to
make sure all components match the required syntax?  I had been
leaning towards the latter.  In other words, I would move the
parsing logic out of devopen and into inetfile.  I would patch
inetfile to take an optional argument of a pointer to a structure
that would contain the broken-down elements of the name:

struct inet_socket_info {
        int family;             /* AF_UNSPEC, AF_INET, or AF_INET6 */
        int protocol;           /* SOCK_STREAM or SOCK_DGRAM */
        struct {
                int offset;
                int len;
        } localport, remotehost, remoteport;
};

static int
inetfile(const char *str, struct inet_socket_info *isn)
{
        struct inet_socket_info buf;

        if (! isn)
                isn = & buf;
        ...
}

Or do you prefer a looser match in inetfile?

Regards,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]