You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Chris Foote <Ch...@xtra.co.nz> on 2003/04/27 21:24:58 UTC

[PATCH] Fix prompting on win32

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