mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
vsh: Introduce wrapper for add_history()
This allows us to drop include of readline header files from virsh.c and virt-admin.c because they needed it only because of the add_history() function. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
@@ -24,11 +24,6 @@
|
||||
#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"
|
||||
@@ -1597,9 +1592,8 @@ main(int argc, char **argv)
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user