#include <sys/stat.h>
#include <inttypes.h>
-#if WITH_READLINE
-# include <readline/readline.h>
-# include <readline/history.h>
-#endif
-
#include "internal.h"
#include "virerror.h"
#include "virbuffer.h"
if (ctl->cmdstr == NULL)
break; /* EOF */
if (*ctl->cmdstr) {
-#if WITH_READLINE
- add_history(ctl->cmdstr);
-#endif
+ vshReadlineHistoryAdd(ctl->cmdstr);
+
if (vshCommandStringParse(ctl, ctl->cmdstr, NULL))
vshCommandRun(ctl, ctl->cmd);
}
#include <unistd.h>
#include <getopt.h>
-#if WITH_READLINE
-# include <readline/readline.h>
-# include <readline/history.h>
-#endif
-
#include "internal.h"
#include "virt-admin.h"
#include "viralloc.h"
if (ctl->cmdstr == NULL)
break; /* EOF */
if (*ctl->cmdstr) {
-#if WITH_READLINE
- add_history(ctl->cmdstr);
-#endif
+ vshReadlineHistoryAdd(ctl->cmdstr);
+
if (vshCommandStringParse(ctl, ctl->cmdstr, NULL))
vshCommandRun(ctl, ctl->cmd);
}
return readline(prompt);
}
+void
+vshReadlineHistoryAdd(const char *cmd)
+{
+ return add_history(cmd);
+}
+
#else /* !WITH_READLINE */
static int
return g_strdup(r);
}
+void
+vshReadlineHistoryAdd(const char *cmd)
+{
+ /* empty */
+}
+
#endif /* !WITH_READLINE */
/*
/* readline */
char * vshReadline(vshControl *ctl, const char *prompt);
+void vshReadlineHistoryAdd(const char *cmd);
+
/* allocation wrappers */
void *_vshMalloc(vshControl *ctl, size_t sz, const char *filename, int line);
#define vshMalloc(_ctl, _sz) _vshMalloc(_ctl, _sz, __FILE__, __LINE__)