summaryrefslogtreecommitdiff
path: root/src/getpass.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/getpass.c')
-rw-r--r--src/getpass.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/getpass.c b/src/getpass.c
index b5f2bc4ec..7209a2ab1 100644
--- a/src/getpass.c
+++ b/src/getpass.c
@@ -95,9 +95,18 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
#define DONE
#endif /* VMS */
+
#ifdef WIN32
/* Windows implementation */
#include <conio.h>
+#endif
+
+#ifdef __SYMBIAN32__
+#define getch() getchar()
+#endif
+
+#if defined(WIN32) || defined(__SYMBIAN32__)
+
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{
size_t i;
@@ -105,7 +114,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
for(i=0; i<buflen; i++) {
buffer[i] = getch();
- if ( buffer[i] == '\r' ) {
+ if ( buffer[i] == '\r' || buffer[i] == '\n' ) {
buffer[i] = 0;
break;
}
@@ -115,8 +124,10 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
previous one as well */
i = i - (i>=1?2:1);
}
+#ifndef __SYMBIAN32__
/* since echo is disabled, print a newline */
fputs("\n", stderr);
+#endif
/* if user didn't hit ENTER, terminate buffer */
if (i==buflen)
buffer[buflen-1]=0;
@@ -124,7 +135,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
return buffer; /* we always return success */
}
#define DONE
-#endif /* WIN32 */
+#endif /* WIN32 || __SYMBIAN32__ */
#ifdef NETWARE
/* NetWare implementation */