tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfcl...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jni/native/src sslutils.c
Date Mon, 06 Jun 2005 09:52:12 GMT
jfclere     2005/06/06 02:52:12

  Modified:    jni/native Makefile.in configure.in
               jni/native/build tcnative.m4
               jni/native/src sslutils.c
  Log:
  Allow to work without curses.
  
  Revision  Changes    Path
  1.5       +1 -1      jakarta-tomcat-connectors/jni/native/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/Makefile.in,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Makefile.in	23 May 2005 12:23:53 -0000	1.4
  +++ Makefile.in	6 Jun 2005 09:52:12 -0000	1.5
  @@ -9,7 +9,7 @@
   srcdir = @srcdir@
   VPATH = @srcdir@
   
  -INCLUDES = @SSL_CFLAGS@ @APR_INCLUDES@ @TCNATIVE_INCLUDES@ @TCNATIVE_PRIV_INCLUDES@
  +INCLUDES = @CURSES_CFLAGS@ @SSL_CFLAGS@ @APR_INCLUDES@ @TCNATIVE_INCLUDES@ @TCNATIVE_PRIV_INCLUDES@
   TCNATIVE_LDFLAGS = @TCNATIVE_LDFLAGS@
   TCNATIVE_LIBS = @TCNATIVE_LIBS@
   
  
  
  
  1.3       +5 -0      jakarta-tomcat-connectors/jni/native/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/configure.in,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- configure.in	23 May 2005 11:43:36 -0000	1.2
  +++ configure.in	6 Jun 2005 09:52:12 -0000	1.3
  @@ -103,6 +103,11 @@
   dnl 
   TCN_CHECK_SSL_TOOLKIT
   
  +dnl
  +dnl check curses
  +dnl
  +TCN_FIND_CURSES
  +
   so_ext=$APR_SO_EXT
   lib_target=$APR_LIB_TARGET
   AC_SUBST(so_ext)
  
  
  
  1.6       +28 -0     jakarta-tomcat-connectors/jni/native/build/tcnative.m4
  
  Index: tcnative.m4
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/build/tcnative.m4,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- tcnative.m4	23 May 2005 12:43:46 -0000	1.5
  +++ tcnative.m4	6 Jun 2005 09:52:12 -0000	1.6
  @@ -327,3 +327,31 @@
     AC_SUBST(SSL_LIBS)
     AC_SUBST(SSL_CFLAGS)
   ])
  +
  +dnl
  +dnl TCN_FIND_CURSES: figure out how to use curses.
  +dnl
  +AC_DEFUN(
  +  [TCN_FIND_CURSES],
  +  [
  +    AC_MSG_CHECKING([for curses (please wait)])
  +    AC_ARG_WITH(curses,
  +    [  --with-curses         path to the installed curses library],
  +    [
  +    if test "$withval" = "yes"; then
  +      APR_ADDTO(TCNATIVE_LIBS, [-lcurses])
  +      APR_ADDTO(CURSES_CFLAGS, [-DHAVE_CURSES])
  +    elif test "$withval" != "no"; then
  +      if test ! -d "${withval}"; then
  +        AC_MSG_ERROR(Not a directory: ${withval})
  +      fi
  +      APR_ADDTO(TCNATIVE_LIBS, [-L${withval}/lib -lcurses])
  +      APR_ADDTO(CURSES_CFLAGS, [-DHAVE_CURSES -I${withval}/include])
  +    fi
  +    ],
  +    [
  +    AC_MSG_RESULT("no curses")
  +    ])
  +
  +  AC_SUBST(CURSES_CFLAGS)  
  +  ])
  
  
  
  1.14      +28 -1     jakarta-tomcat-connectors/jni/native/src/sslutils.c
  
  Index: sslutils.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslutils.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- sslutils.c	6 Jun 2005 08:19:18 -0000	1.13
  +++ sslutils.c	6 Jun 2005 09:52:12 -0000	1.14
  @@ -34,8 +34,10 @@
   #ifdef WIN32
   #include <conio.h>  /* getch() */
   #else
  +#ifdef HAVE_CURSES
   #include <curses.h> /* getch() */
   #endif
  +#endif
   
   /*  _________________________________________________________________
   **
  @@ -106,6 +108,7 @@
       return APR_SUCCESS;
   }
   
  +#if defined(WIN32) || defined(HAVE_CURSES)
   static void password_prompt(const char *prompt, char *buf, size_t len)
   {
       size_t i;
  @@ -128,6 +131,30 @@
       }
       buf[i] = '\0';
   }
  +#else
  +static void password_prompt(const char *prompt, char *buf, size_t len)
  +{
  +    size_t i=0;
  +    int ch;
  +
  +    fprintf(stderr, prompt);
  +    for (i = 0; i < (len - 1); i++) {
  +        ch = getchar();
  +        if (ch == EOF)
  +            break;
  +        if (ch == '\n')
  +            break;
  +        else if (ch == '\b') {
  +            i--;
  +            if (i > 0)
  +                i--;
  +        }
  +        else
  +            buf[i] = ch;
  +    }
  +    buf[i] = '\0';
  +}
  +#endif
   
   #define PROMPT_STRING "Enter password: "
   /* Simple echo password prompting */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message