cvs commit: apache-2.0/src/lib/apr/time/unix time.c

2000-01-06 Thread rbb
rbb 00/01/06 12:20:30

  Modified:src/lib/apr/include apr_time.h
   src/lib/apr/time/unix time.c
  Log:
  Add a new time function which creates a new time instance and initializes
  the current time.  This augments the ap_make_time ap_current_time
  combination that we already have because it does the same thing in one
  function.  Both methods are necessary, because more often than not, we
  create a time instance, but don't fill it out with the current time.
  
  Revision  ChangesPath
  1.10  +1 -0  apache-2.0/src/lib/apr/include/apr_time.h
  
  Index: apr_time.h
  ===
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_time.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- apr_time.h2000/01/06 19:19:26 1.9
  +++ apr_time.h2000/01/06 20:20:21 1.10
  @@ -76,6 +76,7 @@
   
   /* Function Definitions */
   ap_status_t ap_make_time(ap_time_t **, ap_context_t *);
  +ap_status_t ap_make_init_time(ap_time_t **, ap_context_t *);
   ap_status_t ap_current_time(ap_time_t *);
   ap_status_t ap_explode_time(ap_time_t *, ap_timetype_e);
   ap_status_t ap_implode_time(ap_time_t *);
  
  
  
  1.15  +22 -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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- time.c1999/12/21 15:16:36 1.14
  +++ time.c2000/01/06 20:20:25 1.15
  @@ -58,7 +58,7 @@
   
   /* ***APRDOC
* ap_status_t ap_make_time(ap_context_t *, ap_time_t *)
  - *Create a time entity.
  + *Create an empty time entity.
* arg 1) The context to operate on.
* arg 2) The new time entity to create.
*/
  @@ -74,6 +74,27 @@
   (*new)-explodedtime = ap_palloc(cont, sizeof(struct tm));
   (*new)-time_ex = 0;
   (*new)-currtime = NULL;
  +return APR_SUCCESS;
  +}
  +
  +/* ***APRDOC
  + * ap_status_t ap_make_init_time(ap_context_t *, ap_time_t *)
  + *Create a time entity and fill it out with the current time.
  + * arg 1) The context to operate on.
  + * arg 2) The new time entity to create.
  + */
  +ap_status_t ap_make_init_time(struct atime_t **new, ap_context_t *cont)
  +{
  +(*new) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t));
  +
  +if ((*new) == NULL) {
  +return APR_ENOMEM;
  +}
  +
  +(*new)-cntxt = cont;
  +(*new)-explodedtime = ap_palloc(cont, sizeof(struct tm));
  +(*new)-time_ex = 0;
  +gettimeofday((*new)-currtime, NULL);
   return APR_SUCCESS;
   }
   
  
  
  


cvs commit: apache-2.0/src/lib/apr/time/unix time.c

1999-12-21 Thread bjh
bjh 99/12/21 07:16:39

  Modified:src/lib/apr/time/unix time.c
  Log:
  Prevent segfault on comparing an uninitialized ap_time_t object. Treat it
  as a zero value, same as a NULL ap_time_t pointer.
  
  Revision  ChangesPath
  1.14  +2 -2  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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- time.c1999/12/20 16:10:16 1.13
  +++ time.c1999/12/21 15:16:36 1.14
  @@ -237,10 +237,10 @@
*/
   ap_status_t ap_timecmp(struct atime_t *a, struct atime_t *b)
   {
  -if (a == NULL) {
  +if (a == NULL || a-currtime == NULL) {
   return APR_LESS;
   }
  -else if (b == NULL) {
  +else if (b == NULL || b-currtime == NULL) {
   return APR_MORE;
   }
   
  
  
  


cvs commit: apache-2.0/src/lib/apr/time/unix time.c

1999-10-16 Thread dreid
dreid   99/10/16 05:52:09

  Modified:src/lib/apr/time/unix time.c
  Log:
  This corrects a small problem with the safety locks.  Always helps
  to lock and unlock the same lock!
  
  Revision  ChangesPath
  1.9   +2 -2  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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- time.c1999/10/14 18:14:38 1.8
  +++ time.c1999/10/16 12:52:07 1.9
  @@ -115,13 +115,13 @@
   case APR_LOCALTIME: {
   SAFETY_LOCK(time, timefile);
   LOCALTIME_R(atime-currtime-tv_sec, atime-explodedtime);
  -SAFETY_UNLOCK(localtime);
  +SAFETY_UNLOCK(time);
   break;
   }
   case APR_UTCTIME: {
   SAFETY_LOCK(time, timefile);
   GMTIME_R(atime-currtime-tv_sec, atime-explodedtime);
  -SAFETY_UNLOCK(gmtime);
  +SAFETY_UNLOCK(time);
   break;
   }
   }
  
  
  


cvs commit: apache-2.0/src/lib/apr/time/unix time.c

1999-10-14 Thread rbb
rbb 99/10/14 10:39:09

  Modified:src/lib/apr acconfig.h
   src/lib/apr/time/unix time.c
  Added:   src/lib/apr/inc apr_macro.h
  Log:
  Isolate the APR thread-safety macros.  This makes any macro available to
  ANY portion of APR.  It also makes these macros internal to APR only,
  because this header file is not exposed to programs which use APR.
  
  Revision  ChangesPath
  1.7   +0 -34 apache-2.0/src/lib/apr/acconfig.h
  
  Index: acconfig.h
  ===
  RCS file: /home/cvs/apache-2.0/src/lib/apr/acconfig.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- acconfig.h1999/10/11 14:13:19 1.6
  +++ acconfig.h1999/10/14 17:38:45 1.7
  @@ -66,40 +66,6 @@
   Sigfunc *signal(int signo, Sigfunc * func);
   #endif
   
  -#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
  -#define SAFETY_LOCK(func_name, cnt, name_str) \
  -{ \
  -if (lock_##func_name == NULL) \
  -if (ap_create_lock(lock_##func_name, APR_MUTEX, APR_INTRAPROCESS, 
name_str, cnt) != APR_SUCCESS) \
  -return APR_NOTTHREADSAFE; \
  -if (ap_lock(lock_##func_name) != APR_SUCCESS) \
  -return APR_NOTTHREADSAFE; \
  -}
  -#else
  -#define SAFETY_LOCK(func_name, cnt)
  -#endif 
  -
  -#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
  -#define SAFETY_UNLOCK(func_name) \
  -if (ap_unlock(lock_##func_name) != APR_SUCCESS) { \
  -return APR_NOTTHREADSAFE; \
  -}
  -#else
  -#define SAFETY_UNLOCK(func_name, cnt)
  -#endif 
  -
  -#ifdef HAVE_GMTIME_R
  -#define GMTIME_R(x, y) gmtime_r(x, y)
  -#else
  -#define GMTIME_R(x, y) memcpy(y, gmtime(x), sizeof(y))
  -#endif
  -
  -#ifdef HAVE_LOCALTIME_R
  -#define LOCALTIME_R(x, y) localtime_r(x, y)
  -#else
  -#define LOCALTIME_R(x, y) memcpy(y, localtime(x), sizeof(y))
  -#endif
  -
   #if !defined(HAVE_STRCASECMP)  defined(HAVE_STRICMP)
   #define strcasecmp(s1,s2) stricmp(s1,s2)
   #endif
  
  
  
  1.1  apache-2.0/src/lib/apr/inc/apr_macro.h
  
  Index: apr_macro.h
  ===
  /* 
   * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. All advertising materials mentioning features or use of this
   *software must display the following acknowledgment:
   *This product includes software developed by the Apache Group
   *for use in the Apache HTTP server project (http://www.apache.org/).
   *
   * 4. The names Apache Server and Apache Group must not be used to
   *endorse or promote products derived from this software without
   *prior written permission. For written permission, please contact
   *[EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called Apache
   *nor may Apache appear in their names without prior written
   *permission of the Apache Group.
   *
   * 6. Redistributions of any form whatsoever must retain the following
   *acknowledgment:
   *This product includes software developed by the Apache Group
   *for use in the Apache HTTP server project (http://www.apache.org/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
   * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Group and was originally based
   * on public domain software written at the National Center for
   * Supercomputing Applications, University of Illinois, Urbana-Champaign.
   * For 

cvs commit: apache-2.0/src/lib/apr/time/unix time.c

1999-10-14 Thread rbb
rbb 99/10/14 11:14:39

  Modified:src/lib/apr/time/unix time.c
  Log:
  Rid ourselves of a warning, and make all the time functions use one lock.
  This is because all the time functions supposedly may use the same
  static memory space for their work.
  
  Revision  ChangesPath
  1.8   +5 -4  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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- time.c1999/10/14 17:39:03 1.7
  +++ time.c1999/10/14 18:14:38 1.8
  @@ -63,8 +63,9 @@
   #include errno.h
   #include string.h
   
  -static ap_lock_t *lock_gmtime = NULL;
  -static ap_lock_t *lock_localtime = NULL;
  +#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
  +static ap_lock_t *lock_time = NULL;
  +#endif
   
   
   /* ***APRDOC
  @@ -112,13 +113,13 @@
   {
   switch (type) {
   case APR_LOCALTIME: {
  -SAFETY_LOCK(localtime, localtimefile);
  +SAFETY_LOCK(time, timefile);
   LOCALTIME_R(atime-currtime-tv_sec, atime-explodedtime);
   SAFETY_UNLOCK(localtime);
   break;
   }
   case APR_UTCTIME: {
  -SAFETY_LOCK(gmtime, gmtimefile);
  +SAFETY_LOCK(time, timefile);
   GMTIME_R(atime-currtime-tv_sec, atime-explodedtime);
   SAFETY_UNLOCK(gmtime);
   break;
  
  
  


cvs commit: apache-2.0/src/lib/apr/time/unix time.c

1999-10-06 Thread rbb
rbb 99/10/05 23:48:52

  Modified:src/lib/apr acconfig.h configure.in
   src/lib/apr/include apr_config.h.in apr_errno.h
   src/lib/apr/time/unix time.c
  Log:
  Make time functions threadsafe in APR.  This is the current way to make
  a function thread-safe, when the C Run-Time function it relies on is NOT
  thread-safe.  For more information, please read the message that will be
  posted to new-httpd@apache.org regarding this topic.
  
  Revision  ChangesPath
  1.3   +34 -0 apache-2.0/src/lib/apr/acconfig.h
  
  Index: acconfig.h
  ===
  RCS file: /home/cvs/apache-2.0/src/lib/apr/acconfig.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- acconfig.h1999/08/19 13:31:08 1.2
  +++ acconfig.h1999/10/06 06:48:49 1.3
  @@ -66,5 +66,39 @@
   Sigfunc *signal(int signo, Sigfunc * func);
   #endif
   
  +#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
  +#define SAFETY_LOCK(func_name, cnt, name_str) \
  +{ \
  +struct lock_t *funclock = lock_##func_name; \
  +if (funclock == NULL) \
  +if (ap_create_lock(cnt, APR_MUTEX, APR_LOCKALL, name_str, funclock) 
!= APR_SUCCESS) \
  +return APR_NOTTHREADSAFE; \
  +if (ap_lock(funclock) != APR_SUCCESS) \
  +return APR_NOTTHREADSAFE; \
  +}
  +#else
  +#define SAFETY_LOCK(func_name, cnt)
  +#endif 
  +
  +#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
  +#define SAFETY_UNLOCK(func_name) \
  +if (ap_unlock(lock_##func_name) != APR_SUCCESS) { \
  +return APR_NOTTHREADSAFE; \
  +}
  +#else
  +#define SAFETY_UNLOCK(func_name, cnt)
  +#endif 
  +
  +#ifdef HAVE_GMTIME_R
  +#define GMTIME_R(x, y) gmtime_r(x, y)
  +#else
  +#define GMTIME_R(x, y) memcpy(y, gmtime(x), sizeof(y))
  +#endif
  +
  +#ifdef HAVE_LOCALTIME_R
  +#define LOCALTIME_R(x, y) localtime_r(x, y)
  +#else
  +#define LOCALTIME_R(x, y) memcpy(y, localtime(x), sizeof(y))
  +#endif
   
   #endif /* APR_CONFIG_H */
  
  
  
  1.14  +2 -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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- configure.in  1999/10/01 09:47:08 1.13
  +++ configure.in  1999/10/06 06:48:49 1.14
  @@ -198,6 +198,8 @@
   AC_CHECK_FUNCS(getpass)
   AC_CHECK_FUNC(_getch)
   
  +AC_CHECK_FUNCS(gmtime_r localtime_r)
  +
   dnl Start building stuff from our information
   AC_SUBST(LDLIBS)
   AC_SUBST(OPTIM)
  
  
  
  1.8   +40 -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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- apr_config.h.in   1999/09/12 12:12:00 1.7
  +++ apr_config.h.in   1999/10/06 06:48:50 1.8
  @@ -103,6 +103,12 @@
   /* Define if you have the getpass function.  */
   #undef HAVE_GETPASS
   
  +/* Define if you have the gmtime_r function.  */
  +#undef HAVE_GMTIME_R
  +
  +/* Define if you have the localtime_r function.  */
  +#undef HAVE_LOCALTIME_R
  +
   /* Define if you have the poll function.  */
   #undef HAVE_POLL
   
  @@ -317,5 +323,39 @@
   Sigfunc *signal(int signo, Sigfunc * func);
   #endif
   
  +#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
  +#define SAFETY_LOCK(func_name, cnt, name_str) \
  +{ \
  +struct lock_t *funclock = lock_##func_name; \
  +if (funclock == NULL) \
  +if (ap_create_lock(cnt, APR_MUTEX, APR_LOCKALL, name_str, funclock) 
!= APR_SUCCESS) \
  +return APR_NOTTHREADSAFE; \
  +if (ap_lock(funclock) != APR_SUCCESS) \
  +return APR_NOTTHREADSAFE; \
  +}
  +#else
  +#define SAFETY_LOCK(func_name, cnt)
  +#endif 
  +
  +#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
  +#define SAFETY_UNLOCK(func_name) \
  +if (ap_unlock(lock_##func_name) != APR_SUCCESS) { \
  +return APR_NOTTHREADSAFE; \
  +}
  +#else
  +#define SAFETY_UNLOCK(func_name, cnt)
  +#endif 
  +
  +#ifdef HAVE_GMTIME_R
  +#define GMTIME_R(x, y) gmtime_r(x, y)
  +#else
  +#define GMTIME_R(x, y) memcpy(y, gmtime(x), sizeof(y))
  +#endif
  +
  +#ifdef HAVE_LOCALTIME_R
  +#define LOCALTIME_R(x, y) localtime_r(x, y)
  +#else
  +#define LOCALTIME_R(x, y) memcpy(y, localtime(x), sizeof(y))
  +#endif
   
   #endif /* APR_CONFIG_H */
  
  
  
  1.3   +1 -0  apache-2.0/src/lib/apr/include/apr_errno.h
  
  Index: apr_errno.h
  ===
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_errno.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apr_errno.h   1999/09/04 00:21:15 1.2
  +++ apr_errno.h   1999/10/06 

cvs commit: apache-2.0/src/lib/apr/time/unix time.c

1999-08-30 Thread rbb
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  ChangesPath
  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