search for: bs_escape_filenam

Displaying 5 results from an estimated 5 matches for "bs_escape_filenam".

Did you mean: bs_escape_filename
2014 Oct 31
6
[PATCH 0/3] WIP readline escaping functions
From: Maros Zatko <hacxman@gmail.com> Auxiliary functions for readline to support space character escaping in filenames in future. Escaping function is taken from fish.c (used to be parse_quoted_string) plus its un-escaping counterpart. There are a few tests for both. Maros Zatko (3): fish: rl.{c,h} - escaping functions for readline fish: basic tests for readline escaping autotools:
2014 Oct 31
0
[PATCH 2/3] fish: basic tests for readline escaping
...> + +#include <guestfs.h> +#include <guestfs-internal-frontend.h> +#include <rl.h> + +int +eq_bracket (char *(*fn)(char*), char * in, char * out) +{ + char * q = fn(in); + return (q != NULL) && STREQ(q, out); +} + +int +test_empty_escape (void) +{ + return eq_bracket(bs_escape_filename, "", ""); +} + +int +test_empty_unescape (void) +{ + return eq_bracket(bs_unescape_filename, "", ""); +} + +int +test_singlespace_escape (void) +{ + return eq_bracket(bs_escape_filename, " ", "\\ "); +} + +int +test_singlespace_unescape...
2014 Nov 07
3
[PATCH 0/3] v2 readline escaping functions
From: Maros Zatko <mzatko@redhat.com> Helper functions for future support of backslash escaped spaces in filenames. There are a few tests too. Changed according to review remarks. Maros Zatko (3): fish: rl.{c, h} - escaping functions for readline fish: basic tests for readline escaping autotools: add fish/test Makefile.am | 1 + configure.ac | 1 +
2014 Nov 13
4
[PATCH 0/4 v3] readline escaping functions
Helper functions for future support of backslash escaped spaces in filenames. There are a few tests too. Changed according to review remarks and fixed few other mistakes. Maros Zatko (4): fish: copy parse_quoted_string and hexdigit from fish.h to rl.c fish: rl.{c,h} - escaping functions for readline fish: basic tests for readline escaping autotools: add fish/test Makefile.am
2014 Oct 31
0
[PATCH 1/3] fish: rl.{c, h} - escaping functions for readline
...fprintf (stderr, ("%s: invalid escape sequence in string (starting at offset %d)\n"), + program_name, (int) (p - start)); + return NULL; + } + memmove (p+1, p+1+m, strlen (p+1+m) + 1); + } + } + + return start; +} + +// backslash scape +char * +bs_escape_filename (char *p) +{ + char *start = p; + // four times original length - if all chars are unprintable + // new string would be \xXY\xWZ + char *n = calloc(strlen(p) * 4 + 1, 1); + char *nstart = n; + if (strlen(p) == 0) { + n[0] = '\0'; + return n; + } + + for (; *p; p++, n++) { +...