smbtorture: Add history support to shell mode.
authorJames Peach <jpeach@samba.org>
Fri, 19 Mar 2010 04:25:17 +0000 (21:25 -0700)
committerJames Peach <jpeach@apple.com>
Mon, 21 Jun 2010 15:58:10 +0000 (08:58 -0700)
source4/lib/smbreadline/readline.m4
source4/torture/smbtorture.c

index df154409aded750d8419e30eeb56460220b6707a..06d60caae18198bb27bc1d249a76740b39f922e0 100644 (file)
@@ -78,6 +78,11 @@ AC_CHECK_LIB(readline, history_list,
             [],
             [$TERMLIBS])
 
+AC_CHECK_LIB(readline, add_history,
+            [AC_DEFINE(HAVE_ADD_HISTORY, 1, [Do we have add_history?])],
+            [],
+            [$TERMLIBS])
+
 AC_MSG_CHECKING(whether to use extern readline)
 if test x"$EXTERNAL_READLINE" = x"yes"; then
        AC_MSG_RESULT(yes)
index 848773ee8a514b8172e766c130ee0cbcebac3849..c1d32a769d738dc464710e38c030d2f85ebc97cb 100644 (file)
@@ -33,6 +33,9 @@
 #include "auth/gensec/gensec.h"
 #include "param/param.h"
 
+#if HAVE_READLINE_HISTORY_H
+#include <readline/history.h>
+#endif
 
 static bool run_matching(struct torture_context *torture,
                                                 const char *prefix, 
@@ -386,7 +389,11 @@ static void run_shell(struct torture_context *tctx)
 
                if (cline == NULL)
                        return;
-       
+
+#if HAVE_ADD_HISTORY
+               add_history(cline);
+#endif
+
                ret = poptParseArgvString(cline, &argc, &argv);
                if (ret != 0) {
                        fprintf(stderr, "Error parsing line\n");