- (dtucker) [INSTALL Makefile.in configure.ac] Add --with-libedit configure
   option and supporting makefile bits and documentation.
diff --git a/ChangeLog b/ChangeLog
index fe96f8d..48b1aa4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,8 @@
      [clientloop.c clientloop.h ssh.1 ssh.c]
      add basic control of a running multiplex master connection; including the
      ability to check its status and request it to exit; ok markus@
+ - (dtucker) [INSTALL Makefile.in configure.ac] Add --with-libedit configure
+   option and supporting makefile bits and documentation.
 
 20041105
  - (dtucker) OpenBSD CVS Sync
@@ -1852,4 +1854,4 @@
    - (djm) Trim deprecated options from INSTALL. Mention UsePAM
    - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
 
-$Id: ChangeLog,v 1.3580 2004/11/07 09:06:19 dtucker Exp $
+$Id: ChangeLog,v 1.3581 2004/11/07 09:14:34 dtucker Exp $
diff --git a/INSTALL b/INSTALL
index dae1bb1..26d6297 100644
--- a/INSTALL
+++ b/INSTALL
@@ -52,6 +52,14 @@
 S/Key Libraries:
 http://www.sparc.spb.su/solaris/skey/
 
+LibEdit:
+
+sftp now supports command-line editing via NetBSD's libedit.  If your
+platform has it available natively you can use that, alternatively
+you might try these multi-platform ports:
+http://www.thrysoee.dk/editline/
+http://sourceforge.net/projects/libedit/
+
 If you wish to use --with-skey then you will need the above library
 installed.  No other current S/Key library is currently known to be
 supported.
@@ -200,4 +208,4 @@
 http://www.openssh.com/
 
 
-$Id: INSTALL,v 1.64 2004/05/26 23:59:31 dtucker Exp $
+$Id: INSTALL,v 1.65 2004/11/07 09:14:34 dtucker Exp $
diff --git a/Makefile.in b/Makefile.in
index db9eb34..940e686 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.265 2004/08/30 11:33:02 dtucker Exp $
+# $Id: Makefile.in,v 1.266 2004/11/07 09:14:34 dtucker Exp $
 
 # uncomment if you run a non bourne compatable shell. Ie. csh
 #SHELL = @SH@
@@ -43,6 +43,7 @@
 CFLAGS=@CFLAGS@
 CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
 LIBS=@LIBS@
+LIBEDIT=@LIBEDIT@
 LIBPAM=@LIBPAM@
 LIBWRAP=@LIBWRAP@
 AR=@AR@
@@ -158,7 +159,7 @@
 	$(LD) -o $@ sftp-server.o sftp-common.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
 
 sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-common.o sftp-glob.o progressmeter.o
-	$(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
+	$(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LIBEDIT)
 
 ssh-rand-helper${EXEEXT}: $(LIBCOMPAT) libssh.a ssh-rand-helper.o
 	$(LD) -o $@ ssh-rand-helper.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
diff --git a/configure.ac b/configure.ac
index b8f9700..f60bbdd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-# $Id: configure.ac,v 1.232 2004/11/02 09:30:54 dtucker Exp $
+# $Id: configure.ac,v 1.233 2004/11/07 09:14:34 dtucker Exp $
 #
 # Copyright (c) 1999-2004 Damien Miller
 #
@@ -854,6 +854,22 @@
 	]
 )
 
+# Check whether user wants libedit support
+LIBEDIT_MSG="no"
+AC_ARG_WITH(libedit,
+	[  --with-libedit[[=PATH]]      Enable libedit support for sftp],
+	[ if test "x$withval" != "xno" ; then
+		AC_CHECK_LIB(edit, el_init,
+			[ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
+			  LIBEDIT="-ledit -lcurses"
+			  LIBEDIT_MSG="yes"
+			  AC_SUBST(LIBEDIT)
+			],
+			[], [-lcurses]
+		)
+	fi ]
+)
+
 dnl    Checks for library functions. Please keep in alphabetical order
 AC_CHECK_FUNCS(\
 	arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
@@ -3046,6 +3062,7 @@
 echo "                     S/KEY support: $SKEY_MSG"
 echo "              TCP Wrappers support: $TCPW_MSG"
 echo "              MD5 password support: $MD5_MSG"
+echo "                   libedit support: $LIBEDIT_MSG"
 echo "       IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
 echo "           Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
 echo "                  BSD Auth support: $BSD_AUTH_MSG"