summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/cvs/os2/getpass.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/cvs/os2/getpass.c')
-rw-r--r--gnu/usr.bin/cvs/os2/getpass.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gnu/usr.bin/cvs/os2/getpass.c b/gnu/usr.bin/cvs/os2/getpass.c
new file mode 100644
index 00000000000..b1113aedfc2
--- /dev/null
+++ b/gnu/usr.bin/cvs/os2/getpass.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <string.h>
+#include "cvs.h"
+
+char *
+getpass (char *prompt)
+{
+ static char passbuf[30];
+ int i;
+ char *p;
+ int ch;
+
+ printf ("%s", prompt);
+ fflush (stdout);
+
+ p = passbuf, i = 0;
+ while (((ch = getchar ()) != '\n') && (ch != EOF))
+ {
+ if (i++ < 24)
+ *p++ = ch;
+ }
+ *p = '\0';
+
+ return passbuf;
+}