rbb 99/08/30 08:20:16
Modified: src/lib/apr configure.in src/lib/apr/include apr_config.h.in src/lib/apr/lib apr_getpass.c src/lib/apr/time/unix time.c Log: More BeOS fixes. Submitted by: David Reid Revision Changes Path 1.6 +6 -0 apache-2.0/src/lib/apr/configure.in Index: configure.in =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/configure.in,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- configure.in 1999/08/30 14:44:46 1.5 +++ configure.in 1999/08/30 15:20:01 1.6 @@ -118,6 +118,7 @@ dnl Checks for header files. AC_HEADER_STDC +AC_CHECK_HEADERS(conio.h) AC_CHECK_HEADERS(crypt.h) AC_CHECK_HEADERS(ctype.h) AC_CHECK_HEADERS(dir.h) @@ -145,6 +146,7 @@ AC_CHECK_HEADERS(string.h) AC_CHECK_HEADERS(sysapi.h) AC_CHECK_HEADERS(sysgtime.h) +AC_CHECK_HEADERS(termios.h) AC_CHECK_HEADERS(time.h) AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS(sys/times.h) @@ -164,12 +166,14 @@ AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/resource.h) AC_CHECK_HEADERS(sys/select.h) +AC_CHECK_HEADERS(sys/signal.h) AC_CHECK_HEADERS(sys/socket.h) AC_CHECK_HEADERS(sys/stat.h) AC_CHECK_HEADERS(sys/types.h) AC_CHECK_HEADERS(sys/wait.h) AC_CHECK_HEADERS(pthread.h) +AC_CHECK_HEADERS(kernel/OS.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -193,6 +197,8 @@ dnl Checks for library functions. AC_CHECK_FUNCS(strcasecmp stricmp poll setsid) AC_CHECK_FUNCS(sigaction writev) +AC_CHECK_FUNC(getpass) +AC_CHECK_FUNC(_getch) dnl Start building stuff from our information AC_SUBST(LDLIBS) 1.5 +6 -0 apache-2.0/src/lib/apr/include/apr_config.h.in Index: apr_config.h.in =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_config.h.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- apr_config.h.in 1999/08/19 13:31:10 1.4 +++ apr_config.h.in 1999/08/30 15:20:06 1.5 @@ -247,6 +247,9 @@ /* Define if you have the <sysgtime.h> header file. */ #undef HAVE_SYSGTIME_H +/* Define if you have the <termios.h> header file. */ +#undef HAVE_TERMIOS_H + /* Define if you have the <time.h> header file. */ #undef HAVE_TIME_H @@ -267,6 +270,9 @@ /* Define if you have the dl library (-ldl). */ #undef HAVE_LIBDL + +/* Define if you have the kernel/OS.h header file (BEOS) */ +#undef HAVE_KERNEL_OS_H /* Define if you have the pthread library (-lpthread). */ #undef HAVE_LIBPTHREAD 1.2 +52 -4 apache-2.0/src/lib/apr/lib/apr_getpass.c Index: apr_getpass.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_getpass.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- apr_getpass.c 1999/08/17 15:59:40 1.1 +++ apr_getpass.c 1999/08/30 15:20:12 1.2 @@ -74,6 +74,10 @@ #include <conio.h> #endif +#if defined(HAVE_TERMIOS_H) && !defined(HAVE_GETPASS) +#include <termios.h> +#endif + #ifndef CHARSET_EBCDIC #define LF 10 #define CR 13 @@ -85,8 +89,12 @@ #define MAX_STRING_LEN 256 #define ERR_OVERFLOW 5 + +#ifndef HAVE_GETPASS + +/* MPE, Win32 and BeOS all lack a native getpass() */ -#ifdef MPE +#if !defined(HAVE_TERMIOS_H) && !defined(WIN32) /* * MPE lacks getpass() and a way to suppress stdin echo. So for now, just * issue the prompt and read the results with echo. (Ugh). @@ -106,9 +114,46 @@ return (char *) &password; } -#endif +#elif defined (HAVE_TERMIOS_H) +static char *getpass(const char *prompt) +{ + struct termios attr; + static char password[MAX_STRING_LEN]; + int n=0; + fputs(prompt, stderr); + fflush(stderr); + + if (tcgetattr(STDIN_FILENO, &attr) != 0) + return NULL; + attr.c_lflag &= ~(ECHO); + + if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &attr) != 0) + return NULL; + while ((password[n] = getchar()) != '\n') { + if (password[n] >= ' ' && password[n] <= '~') { + n++; + } else { + fprintf(stderr,"\n"); + fputs(prompt, stderr); + fflush(stderr); + n = 0; + } + } + + password[n] = '\0'; + fprintf(stderr, "********************\n"); + + if (n > (MAX_STRING_LEN - 1)) { + password[MAX_STRING_LEN - 1] = '\0'; + } + + attr.c_lflag |= ECHO; + tcsetattr(STDIN_FILENO, TCSANOW, &attr); + return (char*) &password; +} + +#else -#ifdef WIN32 /* * Windows lacks getpass(). So we'll re-implement it here. */ @@ -141,7 +186,10 @@ return (char *) &password; } -#endif + +#endif /* no getchar or _getch */ + +#endif /* no getpass */ /* * Use the OS getpass() routine (or our own) to obtain a password from 1.2 +1 -1 apache-2.0/src/lib/apr/time/unix/time.c Index: time.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/time/unix/time.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- time.c 1999/08/17 15:59:53 1.1 +++ time.c 1999/08/30 15:20:14 1.2 @@ -163,7 +163,7 @@ } /* ***APRDOC******************************************************** - * ap_status_t ap_get_os_time(ap_time_t *, ap_os_time_t *) + * ap_status_t ap_get_os_time(ap_time_t *, ap_os_time_t **) * Convert from apr time type to OS specific time value * arg 1) The time value to convert. * arg 2) The OS specific value to convert to.