[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] virsh: Clarify escape sequence



On Tue, Apr 03, 2012 at 03:10:32PM +0200, Michal Privoznik wrote:
> Currently, we put no strains on escape sequence possibly leaving users
> with console that cannot be terminated. However, not all ASCII
> characters can be used as escape sequence. Only those falling in
> @ - _ can be; implement and document this constraint.
> ---
>  tools/console.c |    3 ++-
>  tools/virsh.c   |   13 ++++++++++++-
>  tools/virsh.pod |    3 ++-
>  3 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/console.c b/tools/console.c
> index ca226c3..0f30b95 100644
> --- a/tools/console.c
> +++ b/tools/console.c
> @@ -34,6 +34,7 @@
>  # include <errno.h>
>  # include <unistd.h>
>  # include <signal.h>
> +# include <c-ctype.h>
>  
>  # include "internal.h"
>  # include "console.h"
> @@ -292,7 +293,7 @@ static char
>  vshGetEscapeChar(const char *s)
>  {
>      if (*s == '^')
> -        return CONTROL(s[1]);
> +        return CONTROL(c_islower(s[1]) ? c_toupper(s[1]) : s[1]);

I'm not really understanding why you need to convert to uppercase
here. I tested it though, and confirmed you are doing the right
thing though.

If you understand, then can you add a comment explaining why
we need uppercase.



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 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]