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

[PATCH] Fix prompting on win32

From: Chris Foote <Chris.Foote_at_xtra.co.nz>
Date: 2003-04-27 23:24:58 CEST

This patch fixes the prompting on win32. I found this using https, as it prompts
twice.
The first prompt returns after the '\r' and leaves the '\n' in stdin, which causes
the second prompt
to return an empty result. The below patch ignores any '\r' and just uses '\n' as the
end of input.

E:\Programs\svn-sec>svn --version
svn, version 0.21.0 (r5639)
   compiled Apr 17 2003, 00:21:13

E:\Programs\svn-sec>svn up
Error validating server certificate: Unknown certificate issuer. Accept? (y/N):
y
Error validating server certificate: Unknown certificate issuer. Accept? (y/N):
svn: RA layer request failed
svn: GET of /repos/svn/!svn/ver/5702/trunk/Makefile.in: Certificate verification
 failed

Log:
Prevent leaving half of the '\r\n' win32 newline sequence in stdin when prompting.

* prompt.c:
  (svn_cl__prompt_user): Finish reading stdin on '\n' and continue when getting a
'\r'.

Index: subversion/clients/cmdline/prompt.c
===================================================================
--- subversion/clients/cmdline/prompt.c (revision 5740)
+++ subversion/clients/cmdline/prompt.c (working copy)
@@ -75,7 +75,9 @@
           status = apr_file_getc (&c, fp);
           if (status && ! APR_STATUS_IS_EOF(status))
             return svn_error_create (status, NULL, "error reading stdin.");
- if ((c == '\n') || (c == '\r'))
+ if (c == '\r')
+ continue;
+ if (c == '\n')
             break;

           svn_stringbuf_appendbytes (strbuf, &c, 1);

Regards,
Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Apr 27 23:31:20 2003

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