[libvirt] [PATCH] virsh: new environment variable VIRSH_HISTSIZE
Daniel P. Berrange
berrange at redhat.com
Mon Oct 28 12:27:20 UTC 2013
On Sun, Oct 27, 2013 at 10:17:29AM +0100, Pavel Raiskup wrote:
> Allow adjust the number of commands to remember in the command
> history.
>
> * tools/virsh.c (vshReadlineInit): Read and sanity the
> VIRSH_HISTSIZE variable.
> (VIRSH_HISTSIZE_MAX): New constant.
> * tools/virsh.pod: Document VIRSH_HISTSIZE variable.
> ---
> tools/virsh.c | 17 ++++++++++++++++-
> tools/virsh.pod | 5 +++++
> 2 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/tools/virsh.c b/tools/virsh.c
> index bad78c9..58bc841 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -2748,11 +2748,14 @@ vshReadlineCompletion(const char *text, int start,
> return matches;
> }
>
> +#define VIRSH_HISTSIZE_MAX 500000
>
> static int
> vshReadlineInit(vshControl *ctl)
> {
> char *userdir = NULL;
> + int max_history = 500;
> + char *histsize_str;
>
> /* Allow conditional parsing of the ~/.inputrc file. */
> rl_readline_name = "virsh";
> @@ -2761,7 +2764,19 @@ vshReadlineInit(vshControl *ctl)
> rl_attempted_completion_function = vshReadlineCompletion;
>
> /* Limit the total size of the history buffer */
> - stifle_history(500);
> + if ((histsize_str = getenv("VIRSH_HISTSIZE"))) {
'getenv' is now forbidden in libvirt code - use virGetEnvBlockSUID
instead in this context.
If you run 'make syntax-check' before submitting pathces it'll warn
you of various coding style/rule issues.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list