Bruno Haible <[EMAIL PROTECTED]> writes:

> The way GNU clisp copes with this is a thinner layer: It accepts the facts
> that a file descriptor and a socket are different things, and that some
> initialization function is needed, and defines things like
>
> #ifdef _WIN32
> # define sock_errno WSAGetLastError ()
> # define sock_errno_is(val) (WSAGetLastError () == WSA##val)
> # define sock_set_errno(val) WSASetLastError (WSA##val)
>   extern int sock_read (...);
>   extern int sock_write (...);
> #else
> # define sock_errno errno
> # define sock_errno_is(val) (errno == val)
> # define sock_set_errno(val) (void)(errno = val)
> # define sock_read read
> # define sock_write write
> #endif
>
> This means that the program code uses slightly different conventions than
> POSIX, but still someone who knows POSIX can use this API without effort.
>
> Do you like that? Or better pure POSIX?

I think the above would be sufficient.  My GNU SASL tool uses the same
read/write for both sockets and stdin/stdout, so I would have to
rewrite it slightly.  But I don't need this functionality right now,
so I don't want to spend a lot of time on it.  But it was good to
raise this discussion, so I know what to implement if I get more time
to work on it or if someone sponsor me to do it.

Thanks,
Simon


_______________________________________________
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib

Reply via email to