tools: thanks to Ludovic; check for getline() in configure.ac and use 'HAVE_GETLINE' macro in get password procedure.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4266 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
viktor.tarasov 2010-04-26 12:29:42 +00:00
parent 06f5b0ba5b
commit 122d357fde
2 changed files with 5 additions and 2 deletions

View File

@ -17,6 +17,8 @@ OPENSC_VERSION_MAJOR="PACKAGE_VERSION_MAJOR"
OPENSC_VERSION_MINOR="PACKAGE_VERSION_MINOR"
OPENSC_VERSION_FIX="PACKAGE_VERSION_FIX"
AC_CHECK_FUNCS([getline])
# LT Version numbers, remember to change them just *before* a release.
# (Code changed: REVISION++)
# (Oldest interface removed: OLDEST++)

View File

@ -285,7 +285,7 @@ util_warn(const char *fmt, ...)
int util_getpass (char **lineptr, size_t *len, FILE *stream)
{
#ifdef _WIN32
#ifndef HAVE_GETLINE
#define MAX_PASS_SIZE 128
char *buf;
int i;
@ -295,7 +295,8 @@ int util_getpass (char **lineptr, size_t *len, FILE *stream)
return -1;
for (i = 0; i < MAX_PASS_SIZE - 1; i++) {
buf[i] = _getch();
/* buf[i] = _getch(); */
buf[i] = getchar();
if (buf[i] == 0 || buf[i] == 3)
return -1;
if (buf[i] == '\n' || buf[i] == '\r')