[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r26917 - in trunk/subversion: include libsvn_subr

From: Paul Burba <pburba_at_collab.net>
Date: 2007-10-04 04:35:03 CEST

> -----Original Message-----
> From: dlr@tigris.org [mailto:dlr@tigris.org]
> Sent: Wednesday, October 03, 2007 7:11 PM
> To: svn@subversion.tigris.org
> Subject: svn commit: r26917 - in trunk/subversion: include libsvn_subr
>
> Author: dlr
> Date: Wed Oct 3 16:11:11 2007
> New Revision: 26917
>
> Log:
> Set output buffering mode early during command-line
> initialization processing.
>
> * subversion/include/svn_cmdline.h
> (svn_cmdline_init): Indicate that stdout and ERROR_STREAM will have
> their buffering mode changed to line-based and unbuffered
> (character-based, really), respectively.
>
> * subversion/libsvn_subr/cmdline.c
> Bump copyright date. Include stdio.h.
> (svn_cmdline_init): Call setvbuf() on stdout and ERROR_STREAM (which
> is typically stderr).
>
> Suggested by: epg
> jrepenning
> Reviewed by: epg
>
>
> Modified:
> trunk/subversion/include/svn_cmdline.h
> trunk/subversion/libsvn_subr/cmdline.c
>
> Modified: trunk/subversion/include/svn_cmdline.h
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_
> cmdline.h?pathrev=26917&r1=26916&r2=26917
> ==============================================================
> ================
> --- trunk/subversion/include/svn_cmdline.h (original)
> +++ trunk/subversion/include/svn_cmdline.h Wed Oct 3 16:11:11 2007
> @@ -41,9 +41,10 @@
>
>
> /** Set up the locale for character conversion, and initialize APR.
> - * If @a error_stream is non-null, print error messages to
> the stream,
> - * using @a progname as the program name. Return @c EXIT_SUCCESS if
> - * successful, otherwise @c EXIT_FAILURE.
> + * If @a error_stream is non-NULL, print error messages to
> the stream,
> + * using @a progname as the program name. Attempt to set @c
> stdout to
> + * line-buffered mode, and @a error_stream to unbuffered
> mode. Return
> + * @c EXIT_SUCCESS if successful, otherwise @c EXIT_FAILURE.
> *
> * @note This function should be called exactly once at
> program startup,
> * before calling any other APR or Subversion functions.
>
> Modified: trunk/subversion/libsvn_subr/cmdline.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/
> cmdline.c?pathrev=26917&r1=26916&r2=26917
> ==============================================================
> ================
> --- trunk/subversion/libsvn_subr/cmdline.c (original)
> +++ trunk/subversion/libsvn_subr/cmdline.c Wed Oct 3 16:11:11 2007
> @@ -2,7 +2,7 @@
> * cmdline.c : Helpers for command-line programs.
> *
> *
> ====================================================================
> - * Copyright (c) 2000-2006 CollabNet. All rights reserved.
> + * Copyright (c) 2000-2007 CollabNet. All rights reserved.
> *
> * This software is licensed as described in the file COPYING, which
> * you should have received as part of this distribution.
> The terms @@ -18,6 +18,7 @@
>
>
> #include <stdlib.h> /* for atexit() */
> +#include <stdio.h> /* for setvbuf() */
> #include <locale.h> /* for setlocale() */
>
> #ifndef WIN32
> @@ -88,6 +89,12 @@
> }
> #endif
>
> + /* Ignore any errors encountered while attempting to change stream
> + buffering, as the streams should retain their default buffering
> + modes. */
> + setvbuf(error_stream, NULL, _IONBF, 0); setvbuf(stdout, NULL,
> + _IOLBF, 0);

On Visual Studio 2005 the _IOLBF flag is equivalent to _IOFBF, see
http://msdn2.microsoft.com/en-us/library/86cebhfs(VS.80).aspx

This completely breaks CL on Win32 as the second setvbuf() call with
size 0 chokes.

Right now I have this local mod in place so I can work:

   /* Ignore any errors encountered while attempting to change stream
      buffering, as the streams should retain their default buffering
      modes. */
   setvbuf(error_stream, NULL, _IONBF, 0);
+#ifdef WIN32
+ setvbuf(stdout, NULL, _IONBF, 0);
+#elif
   setvbuf(stdout, NULL, _IOLBF, 0);
 #endif

But I welcome any thoughts as to a better solution.

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 4 04:39:11 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.