[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: src/client.c & select
From: |
Derek Price |
Subject: |
Re: src/client.c & select |
Date: |
Wed, 28 Sep 2005 08:51:46 -0400 |
User-agent: |
Mozilla Thunderbird 1.0.6 (Windows/20050716) |
I'd really prefer a select() that always returns 1 for file descriptors
on Windows to all those extra #ifdefs complicating the code.
Regards,
Derek
Conrad T. Pino wrote:
>Hi Derek,
>
>I'm looking at where we're using "select" function.
>
>What's your take on this patch?
>
>Conrad
>
>Index: src/client.c
>===================================================================
>RCS file: /cvsroot/cvs/ccvs/src/client.c,v
>retrieving revision 1.431
>diff -u -p -r1.431 client.c
>--- src/client.c 25 Sep 2005 00:28:51 -0000 1.431
>+++ src/client.c 28 Sep 2005 06:09:42 -0000
>@@ -2807,8 +2807,10 @@ handle_wrapper_rcs_option (char *args, s
> static void
> handle_m (char *args, size_t len)
> {
>+#if ! WOE32
> fd_set wfds;
> int s;
>+#endif
>
> /* In the case where stdout and stderr point to the same place,
> fflushing stderr will make output happen in the correct order.
>@@ -2817,12 +2819,14 @@ handle_m (char *args, size_t len)
> based on being confused between default buffering between
> stdout and stderr. But I'm not sure). */
> fflush (stderr);
>+#if ! WOE32
> FD_ZERO (&wfds);
> FD_SET (STDOUT_FILENO, &wfds);
> errno = 0;
> s = select (STDOUT_FILENO+1, NULL, &wfds, NULL, NULL);
> if (s < 1 && errno != 0)
> perror ("cannot write to stdout");
>+#endif
> fwrite (args, sizeof *args, len, stdout);
> putc ('\n', stdout);
> }
>@@ -2868,12 +2872,15 @@ handle_mbinary (char *args, size_t len)
> static void
> handle_e (char *args, size_t len)
> {
>+#if ! WOE32
> fd_set wfds;
> int s;
>+#endif
>
> /* In the case where stdout and stderr point to the same place,
> fflushing stdout will make output happen in the correct order. */
> fflush (stdout);
>+#if ! WOE32
> FD_ZERO (&wfds);
> FD_SET (STDERR_FILENO, &wfds);
> errno = 0;
>@@ -2886,6 +2893,7 @@ handle_e (char *args, size_t len)
> */
> if (s < 1 && errno != 0)
> fperrmsg (stdout, 1, errno, "cannot write to stderr");
>+#endif
> fwrite (args, sizeof *args, len, stderr);
> putc ('\n', stderr);
> }
>
>
--
Derek R. Price
CVS Solutions Architect
Ximbiot <http://ximbiot.com>
v: +1 717.579.6168
f: +1 717.234.3125
<mailto:derek@ximbiot.com>