mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +03:00
Merge lib/strescape.h into lib/strutil.h. Rename functions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
933b111a5d
commit
aa38245e85
@ -19,7 +19,6 @@ SUBLIB_includes = \
|
||||
mcconfig.h \
|
||||
search.h \
|
||||
skin.h \
|
||||
strescape.h \
|
||||
strutil.h \
|
||||
widget.h
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "lib/global.h"
|
||||
#include "lib/fileloc.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/skin.h"
|
||||
#include "lib/util.h" /* exist_file() */
|
||||
|
||||
@ -154,7 +154,7 @@ mc_fhl_parse_get_extensions (mc_fhl_t * fhl, const gchar * group_name)
|
||||
{
|
||||
char *esc_ext;
|
||||
|
||||
esc_ext = strutils_regex_escape (*exts);
|
||||
esc_ext = str_regex_escape (*exts);
|
||||
if (buf->len != 0)
|
||||
g_string_append_c (buf, '|');
|
||||
g_string_append (buf, esc_ext);
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "lib/global.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/search.h"
|
||||
#include "lib/strescape.h"
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@ -62,28 +61,28 @@ mc_search__glob_translate_to_regex (const GString * astr)
|
||||
switch (str[loop])
|
||||
{
|
||||
case '*':
|
||||
if (!strutils_is_char_escaped (str, &(str[loop])))
|
||||
if (!str_is_char_escaped (str, &(str[loop])))
|
||||
{
|
||||
g_string_append (buff, inside_group ? ".*" : "(.*)");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
if (!strutils_is_char_escaped (str, &(str[loop])))
|
||||
if (!str_is_char_escaped (str, &(str[loop])))
|
||||
{
|
||||
g_string_append (buff, inside_group ? "." : "(.)");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case ',':
|
||||
if (!strutils_is_char_escaped (str, &(str[loop])))
|
||||
if (!str_is_char_escaped (str, &(str[loop])))
|
||||
{
|
||||
g_string_append_c (buff, inside_group ? '|' : ',');
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '{':
|
||||
if (!strutils_is_char_escaped (str, &(str[loop])))
|
||||
if (!str_is_char_escaped (str, &(str[loop])))
|
||||
{
|
||||
g_string_append_c (buff, '(');
|
||||
inside_group = TRUE;
|
||||
@ -91,7 +90,7 @@ mc_search__glob_translate_to_regex (const GString * astr)
|
||||
}
|
||||
break;
|
||||
case '}':
|
||||
if (!strutils_is_char_escaped (str, &(str[loop])))
|
||||
if (!str_is_char_escaped (str, &(str[loop])))
|
||||
{
|
||||
g_string_append_c (buff, ')');
|
||||
inside_group = FALSE;
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "lib/global.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/search.h"
|
||||
#include "lib/strescape.h"
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "lib/global.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/search.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/util.h" /* MC_PTR_FREE */
|
||||
|
||||
#include "internal.h"
|
||||
@ -97,7 +96,7 @@ mc_search__regex_str_append_if_special (GString * copy_to, const GString * regex
|
||||
spec_chr_len = strlen (*spec_chr);
|
||||
|
||||
if (strncmp (tmp_regex_str, *spec_chr, spec_chr_len) == 0
|
||||
&& !strutils_is_char_escaped (regex_str->str, tmp_regex_str))
|
||||
&& !str_is_char_escaped (regex_str->str, tmp_regex_str))
|
||||
{
|
||||
if (strncmp ("\\x", *spec_chr, spec_chr_len) == 0)
|
||||
{
|
||||
@ -229,13 +228,12 @@ mc_search__cond_struct_new_regex_ci_str (const char *charset, const GString * as
|
||||
continue;
|
||||
}
|
||||
|
||||
if (astr->str[loop] == '[' && !strutils_is_char_escaped (astr->str, &(astr->str[loop])))
|
||||
if (astr->str[loop] == '[' && !str_is_char_escaped (astr->str, &(astr->str[loop])))
|
||||
{
|
||||
mc_search__cond_struct_new_regex_accum_append (charset, ret_str, accumulator);
|
||||
|
||||
while (loop < astr->len && !(astr->str[loop] == ']'
|
||||
&& !strutils_is_char_escaped (astr->str,
|
||||
&(astr->str[loop]))))
|
||||
&& !str_is_char_escaped (astr->str, &(astr->str[loop]))))
|
||||
{
|
||||
g_string_append_c (ret_str, astr->str[loop]);
|
||||
loop++;
|
||||
@ -401,7 +399,7 @@ mc_search_regex__get_max_num_of_replace_tokens (const gchar * str, gsize len)
|
||||
for (loop = 0; loop < len - 1; loop++)
|
||||
if (str[loop] == '\\' && g_ascii_isdigit (str[loop + 1]))
|
||||
{
|
||||
if (strutils_is_char_escaped (str, &str[loop]))
|
||||
if (str_is_char_escaped (str, &str[loop]))
|
||||
continue;
|
||||
if (max_token < str[loop + 1] - '0')
|
||||
max_token = str[loop + 1] - '0';
|
||||
@ -410,7 +408,7 @@ mc_search_regex__get_max_num_of_replace_tokens (const gchar * str, gsize len)
|
||||
{
|
||||
gsize tmp_len;
|
||||
|
||||
if (strutils_is_char_escaped (str, &str[loop]))
|
||||
if (str_is_char_escaped (str, &str[loop]))
|
||||
continue;
|
||||
|
||||
for (tmp_len = 0;
|
||||
@ -555,7 +553,7 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
|
||||
{
|
||||
char *tmp_str;
|
||||
|
||||
if (strutils_is_char_escaped (replace_str->str, curr_str))
|
||||
if (str_is_char_escaped (replace_str->str, curr_str))
|
||||
{
|
||||
*skip_len = 1;
|
||||
return REPLACE_PREPARE_T_NOTHING_SPECIAL;
|
||||
@ -582,7 +580,7 @@ mc_search_regex__process_replace_str (const GString * replace_str, const gsize c
|
||||
|
||||
if (curr_str[0] == '\\' && replace_str->len > current_pos + 1)
|
||||
{
|
||||
if (strutils_is_char_escaped (replace_str->str, curr_str))
|
||||
if (str_is_char_escaped (replace_str->str, curr_str))
|
||||
{
|
||||
*skip_len = 1;
|
||||
return REPLACE_PREPARE_T_NOTHING_SPECIAL;
|
||||
|
@ -1,33 +0,0 @@
|
||||
#ifndef MC__STRUTILS_ESCAPE_H
|
||||
#define MC__STRUTILS_ESCAPE_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "lib/global.h" /* <glib.h> */
|
||||
|
||||
/*** typedefs(not structures) and defined constants **********************************************/
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
char *strutils_escape (const char *src, gsize src_len, const char *escaped_chars,
|
||||
gboolean escape_non_printable);
|
||||
char *strutils_unescape (const char *src, gsize src_len, const char *unescaped_chars,
|
||||
gboolean unescape_non_printable);
|
||||
char *strutils_shell_unescape (const char *text);
|
||||
char *strutils_shell_escape (const char *text);
|
||||
|
||||
char *strutils_glob_escape (const char *text);
|
||||
char *strutils_glob_unescape (const char *text);
|
||||
|
||||
char *strutils_regex_escape (const char *text);
|
||||
char *strutils_regex_unescape (const char *text);
|
||||
|
||||
gboolean strutils_is_char_escaped (const char *start, const char *current);
|
||||
|
||||
#endif /* MC__STRUTILS_ESCAPE_H */
|
@ -613,6 +613,21 @@ strtol_error_t xstrtoumax (const char *s, char **ptr, int base, uintmax_t * val,
|
||||
const char *valid_suffixes);
|
||||
uintmax_t parse_integer (const char *str, gboolean * invalid);
|
||||
|
||||
char *str_escape (const char *src, gsize src_len, const char *escaped_chars,
|
||||
gboolean escape_non_printable);
|
||||
char *str_unescape (const char *src, gsize src_len, const char *unescaped_chars,
|
||||
gboolean unescape_non_printable);
|
||||
char *str_shell_unescape (const char *text);
|
||||
char *str_shell_escape (const char *text);
|
||||
|
||||
char *str_glob_escape (const char *text);
|
||||
char *str_glob_unescape (const char *text);
|
||||
|
||||
char *str_regex_escape (const char *text);
|
||||
char *str_regex_unescape (const char *text);
|
||||
|
||||
gboolean str_is_char_escaped (const char *start, const char *current);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** inline functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "lib/global.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/strutil.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
@ -72,7 +71,7 @@ str_replace_all (const char *haystack, const char *needle, const char *replaceme
|
||||
if (return_str == NULL)
|
||||
return_str = g_string_sized_new (32);
|
||||
|
||||
if (strutils_is_char_escaped (haystack, needle_in_str))
|
||||
if (str_is_char_escaped (haystack, needle_in_str))
|
||||
{
|
||||
char *backslash = needle_in_str - 1;
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "lib/global.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/strutil.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
@ -52,7 +52,7 @@ static const char ESCAPE_GLOB_CHARS[] = "$*\\?";
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
char *
|
||||
strutils_escape (const char *src, gsize src_len, const char *escaped_chars,
|
||||
str_escape (const char *src, gsize src_len, const char *escaped_chars,
|
||||
gboolean escape_non_printable)
|
||||
{
|
||||
GString *ret;
|
||||
@ -103,7 +103,7 @@ strutils_escape (const char *src, gsize src_len, const char *escaped_chars,
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
char *
|
||||
strutils_unescape (const char *src, gsize src_len, const char *unescaped_chars,
|
||||
str_unescape (const char *src, gsize src_len, const char *unescaped_chars,
|
||||
gboolean unescape_non_printable)
|
||||
{
|
||||
GString *ret;
|
||||
@ -182,25 +182,25 @@ strutils_unescape (const char *src, gsize src_len, const char *unescaped_chars,
|
||||
*/
|
||||
|
||||
char *
|
||||
strutils_shell_escape (const char *src)
|
||||
str_shell_escape (const char *src)
|
||||
{
|
||||
return strutils_escape (src, -1, ESCAPE_SHELL_CHARS, FALSE);
|
||||
return str_escape (src, -1, ESCAPE_SHELL_CHARS, FALSE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
char *
|
||||
strutils_glob_escape (const char *src)
|
||||
str_glob_escape (const char *src)
|
||||
{
|
||||
return strutils_escape (src, -1, ESCAPE_GLOB_CHARS, TRUE);
|
||||
return str_escape (src, -1, ESCAPE_GLOB_CHARS, TRUE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
char *
|
||||
strutils_regex_escape (const char *src)
|
||||
str_regex_escape (const char *src)
|
||||
{
|
||||
return strutils_escape (src, -1, ESCAPE_REGEX_CHARS, TRUE);
|
||||
return str_escape (src, -1, ESCAPE_REGEX_CHARS, TRUE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -215,24 +215,24 @@ strutils_regex_escape (const char *src)
|
||||
*/
|
||||
|
||||
char *
|
||||
strutils_shell_unescape (const char *text)
|
||||
str_shell_unescape (const char *text)
|
||||
{
|
||||
return strutils_unescape (text, -1, ESCAPE_SHELL_CHARS, TRUE);
|
||||
return str_unescape (text, -1, ESCAPE_SHELL_CHARS, TRUE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
char *
|
||||
strutils_glob_unescape (const char *text)
|
||||
str_glob_unescape (const char *text)
|
||||
{
|
||||
return strutils_unescape (text, -1, ESCAPE_GLOB_CHARS, TRUE);
|
||||
return str_unescape (text, -1, ESCAPE_GLOB_CHARS, TRUE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
char *
|
||||
strutils_regex_unescape (const char *text)
|
||||
str_regex_unescape (const char *text)
|
||||
{
|
||||
return strutils_unescape (text, -1, ESCAPE_REGEX_CHARS, TRUE);
|
||||
return str_unescape (text, -1, ESCAPE_REGEX_CHARS, TRUE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -247,7 +247,7 @@ strutils_regex_unescape (const char *text)
|
||||
*/
|
||||
|
||||
gboolean
|
||||
strutils_is_char_escaped (const char *start, const char *current)
|
||||
str_is_char_escaped (const char *start, const char *current)
|
||||
{
|
||||
int num_esc = 0;
|
||||
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include "lib/tty/tty.h"
|
||||
#include "lib/tty/key.h" /* XCTRL and ALT macros */
|
||||
#include "lib/vfs/vfs.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/util.h"
|
||||
#include "lib/widget.h"
|
||||
@ -151,12 +150,12 @@ filename_completion_function (const char *text, int state, input_complete_t flag
|
||||
char *result;
|
||||
char *e_result;
|
||||
|
||||
u_text = strutils_shell_unescape (text);
|
||||
u_text = str_shell_unescape (text);
|
||||
|
||||
result = filename_completion_function (u_text, state, flags & (~INPUT_COMPLETE_SHELL_ESC));
|
||||
g_free (u_text);
|
||||
|
||||
e_result = strutils_shell_escape (result);
|
||||
e_result = str_shell_escape (result);
|
||||
g_free (result);
|
||||
|
||||
return e_result;
|
||||
@ -587,7 +586,7 @@ command_completion_function (const char *text, int state, input_complete_t flags
|
||||
if ((flags & INPUT_COMPLETE_COMMANDS) == 0)
|
||||
return NULL;
|
||||
|
||||
u_text = strutils_shell_unescape (text);
|
||||
u_text = str_shell_unescape (text);
|
||||
flags &= ~INPUT_COMPLETE_SHELL_ESC;
|
||||
|
||||
if (state == 0)
|
||||
@ -621,7 +620,7 @@ command_completion_function (const char *text, int state, input_complete_t flags
|
||||
{
|
||||
char *temp_p = p;
|
||||
|
||||
p = strutils_shell_escape (p);
|
||||
p = str_shell_escape (p);
|
||||
g_free (temp_p);
|
||||
}
|
||||
|
||||
@ -688,7 +687,7 @@ command_completion_function (const char *text, int state, input_complete_t flags
|
||||
{
|
||||
char *tmp = found;
|
||||
|
||||
found = strutils_shell_escape (p + 1);
|
||||
found = str_shell_escape (p + 1);
|
||||
g_free (tmp);
|
||||
}
|
||||
}
|
||||
@ -884,7 +883,7 @@ try_complete_find_start_sign (try_complete_automation_state_t * state)
|
||||
state->q = strrchr (state->word, '$');
|
||||
|
||||
/* don't substitute variable in \$ case */
|
||||
if (strutils_is_char_escaped (state->word, state->q))
|
||||
if (str_is_char_escaped (state->word, state->q))
|
||||
{
|
||||
/* drop '\\' */
|
||||
str_move (state->q - 1, state->q);
|
||||
@ -1398,7 +1397,7 @@ try_complete (char *text, int *lc_start, int *lc_end, input_complete_t flags)
|
||||
char *p;
|
||||
|
||||
p = *m;
|
||||
*m = strutils_shell_escape (*m);
|
||||
*m = str_shell_escape (*m);
|
||||
g_free (p);
|
||||
}
|
||||
}
|
||||
@ -1431,7 +1430,7 @@ complete_engine_fill_completions (WInput * in)
|
||||
for (; s >= in->buffer->str; str_prev_char (&s))
|
||||
{
|
||||
start = s - in->buffer->str;
|
||||
if (strchr (word_separators, *s) != NULL && !strutils_is_char_escaped (in->buffer->str, s))
|
||||
if (strchr (word_separators, *s) != NULL && !str_is_char_escaped (in->buffer->str, s))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include "lib/util.h"
|
||||
#include "lib/widget.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/strescape.h" /* strutils_glob_escape() */
|
||||
#ifdef HAVE_CHARSET
|
||||
#include "lib/charsets.h"
|
||||
#endif
|
||||
@ -821,8 +820,8 @@ dff_execute (const char *args, const char *extra, const char *file1, const char
|
||||
char *file1_esc, *file2_esc;
|
||||
|
||||
/* escape potential $ to avoid shell variable substitutions in popen() */
|
||||
file1_esc = strutils_shell_escape (file1);
|
||||
file2_esc = strutils_shell_escape (file2);
|
||||
file1_esc = str_shell_escape (file1);
|
||||
file2_esc = str_shell_escape (file2);
|
||||
cmd = g_strdup_printf ("diff %s %s %s %s %s", args, extra, opt, file1_esc, file2_esc);
|
||||
g_free (file1_esc);
|
||||
g_free (file2_esc);
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include "lib/global.h"
|
||||
#include "lib/vfs/vfs.h"
|
||||
#include "lib/strescape.h" /* strutils_shell_unescape() */
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/util.h" /* whitespace() */
|
||||
#include "lib/widget.h" /* message() */
|
||||
|
||||
@ -90,7 +90,7 @@ examine_cd (const char *_path)
|
||||
char *p;
|
||||
|
||||
/* Tilde expansion */
|
||||
path = strutils_shell_unescape (_path);
|
||||
path = str_shell_unescape (_path);
|
||||
path_tilde = tilde_expand (path);
|
||||
g_free (path);
|
||||
|
||||
|
@ -64,7 +64,6 @@
|
||||
#include "lib/tty/tty.h"
|
||||
#include "lib/tty/key.h"
|
||||
#include "lib/search.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/util.h"
|
||||
#include "lib/vfs/vfs.h"
|
||||
|
@ -147,7 +147,6 @@ statfs (char const *filename, struct fs_info *buf)
|
||||
#include "lib/mcconfig.h"
|
||||
#include "lib/search.h"
|
||||
#include "lib/vfs/vfs.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/timefmt.h" /* file_date() */
|
||||
#include "lib/util.h"
|
||||
@ -1322,9 +1321,9 @@ file_mask_dialog (file_op_context_t * ctx, gboolean only_one, const char *format
|
||||
vfs_path_free (vpath, TRUE);
|
||||
|
||||
if (source_easy_patterns)
|
||||
def_text_secure = strutils_glob_escape (tmp);
|
||||
def_text_secure = str_glob_escape (tmp);
|
||||
else
|
||||
def_text_secure = strutils_regex_escape (tmp);
|
||||
def_text_secure = str_regex_escape (tmp);
|
||||
g_free (tmp);
|
||||
|
||||
if (only_one)
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "lib/tty/tty.h"
|
||||
#include "lib/tty/key.h" /* XCTRL and ALT macros */
|
||||
#include "lib/skin.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/mcconfig.h"
|
||||
#include "lib/vfs/vfs.h"
|
||||
#include "lib/unixcompat.h"
|
||||
@ -2126,7 +2126,7 @@ panel_select_ext_cmd (WPanel * panel)
|
||||
|
||||
do_select = (fe->f.marked == 0);
|
||||
|
||||
cur_file_ext = strutils_regex_escape (extension (filename->str));
|
||||
cur_file_ext = str_regex_escape (extension (filename->str));
|
||||
if (cur_file_ext[0] != '\0')
|
||||
reg_exp = g_strconcat ("^.*\\.", cur_file_ext, "$", (char *) NULL);
|
||||
else
|
||||
@ -2810,7 +2810,7 @@ do_search (WPanel * panel, int c_code)
|
||||
}
|
||||
|
||||
reg_exp = g_strdup_printf ("%s*", panel->quick_search.buffer->str);
|
||||
esc_str = strutils_escape (reg_exp, -1, ",|\\{}[]", TRUE);
|
||||
esc_str = str_escape (reg_exp, -1, ",|\\{}[]", TRUE);
|
||||
search = mc_search_new (esc_str, NULL);
|
||||
search->search_type = MC_SEARCH_T_GLOB;
|
||||
search->is_entire_line = TRUE;
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include "lib/mcconfig.h"
|
||||
#include "lib/vfs/vfs.h"
|
||||
#include "lib/fileloc.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/hook.h"
|
||||
#include "lib/util.h"
|
||||
|
||||
@ -322,7 +322,7 @@ tree_store_load_from (const char *name)
|
||||
static char *
|
||||
encode (const vfs_path_t * vpath, size_t offset)
|
||||
{
|
||||
return strutils_escape (vfs_path_as_str (vpath) + offset, -1, "\n\\", FALSE);
|
||||
return str_escape (vfs_path_as_str (vpath) + offset, -1, "\n\\", FALSE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "lib/tty/tty.h"
|
||||
#include "lib/tty/key.h"
|
||||
#include "lib/mcconfig.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/util.h" /* convert_controls() */
|
||||
#include "lib/widget.h"
|
||||
@ -366,7 +365,7 @@ learn_save (void)
|
||||
{
|
||||
char *esc_str;
|
||||
|
||||
esc_str = strutils_escape (learnkeys[i].sequence, -1, ";\\", TRUE);
|
||||
esc_str = str_escape (learnkeys[i].sequence, -1, ";\\", TRUE);
|
||||
mc_config_set_string_raw_value (mc_global.main_config, section,
|
||||
key_name_conv_tab[i].name, esc_str);
|
||||
g_free (esc_str);
|
||||
|
@ -60,7 +60,7 @@
|
||||
|
||||
#include "lib/global.h"
|
||||
#include "lib/tty/tty.h" /* enable/disable interrupt key */
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/unixcompat.h"
|
||||
#include "lib/fileloc.h"
|
||||
#include "lib/util.h" /* my_exit() */
|
||||
@ -803,12 +803,12 @@ shell_parse_ls (char *buffer, struct vfs_s_entry *ent)
|
||||
|
||||
ent->name = g_strndup (filename, filename_bound - filename);
|
||||
temp = ent->name;
|
||||
ent->name = strutils_shell_unescape (ent->name);
|
||||
ent->name = str_shell_unescape (ent->name);
|
||||
g_free (temp);
|
||||
|
||||
ent->ino->linkname = g_strndup (linkname, linkname_bound - linkname);
|
||||
temp = ent->ino->linkname;
|
||||
ent->ino->linkname = strutils_shell_unescape (ent->ino->linkname);
|
||||
ent->ino->linkname = str_shell_unescape (ent->ino->linkname);
|
||||
g_free (temp);
|
||||
}
|
||||
else
|
||||
@ -828,7 +828,7 @@ shell_parse_ls (char *buffer, struct vfs_s_entry *ent)
|
||||
|
||||
ent->name = g_strndup (filename, filename_bound - filename);
|
||||
temp = ent->name;
|
||||
ent->name = strutils_shell_unescape (ent->name);
|
||||
ent->name = str_shell_unescape (ent->name);
|
||||
g_free (temp);
|
||||
}
|
||||
break;
|
||||
@ -927,7 +927,7 @@ shell_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, const char *remot
|
||||
|
||||
dir->timestamp = g_get_monotonic_time () + shell_directory_timeout * G_USEC_PER_SEC;
|
||||
|
||||
quoted_path = strutils_shell_escape (remote_path);
|
||||
quoted_path = str_shell_escape (remote_path);
|
||||
(void) shell_command_v (me, super, NONE, SHELL_SUPER (super)->scr_ls, "SHELL_FILENAME=%s;\n",
|
||||
quoted_path);
|
||||
g_free (quoted_path);
|
||||
@ -1033,7 +1033,7 @@ shell_file_store (struct vfs_class *me, vfs_file_handler_t * fh, char *name, cha
|
||||
* algorithm for file appending case, therefore just "dd" is used for it.
|
||||
*/
|
||||
|
||||
quoted_name = strutils_shell_escape (name);
|
||||
quoted_name = str_shell_escape (name);
|
||||
vfs_print_message (_("shell: store %s: sending command..."), quoted_name);
|
||||
|
||||
/* FIXME: File size is limited to ULONG_MAX */
|
||||
@ -1105,7 +1105,7 @@ shell_linear_start (struct vfs_class *me, vfs_file_handler_t * fh, off_t offset)
|
||||
name = vfs_s_fullpath (me, fh->ino);
|
||||
if (name == NULL)
|
||||
return 0;
|
||||
quoted_name = strutils_shell_escape (name);
|
||||
quoted_name = str_shell_escape (name);
|
||||
g_free (name);
|
||||
shell->append = FALSE;
|
||||
|
||||
@ -1260,8 +1260,8 @@ shell_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
if (crpath2 == NULL)
|
||||
return -1;
|
||||
|
||||
rpath1 = strutils_shell_escape (crpath1);
|
||||
rpath2 = strutils_shell_escape (crpath2);
|
||||
rpath1 = str_shell_escape (crpath1);
|
||||
rpath2 = str_shell_escape (crpath2);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath1));
|
||||
|
||||
@ -1294,8 +1294,8 @@ shell_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
if (crpath2 == NULL)
|
||||
return -1;
|
||||
|
||||
rpath1 = strutils_shell_escape (crpath1);
|
||||
rpath2 = strutils_shell_escape (crpath2);
|
||||
rpath1 = str_shell_escape (crpath1);
|
||||
rpath2 = str_shell_escape (crpath2);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath1));
|
||||
|
||||
@ -1325,8 +1325,8 @@ shell_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
qsetto = strutils_shell_escape (vfs_path_get_last_path_str (vpath1));
|
||||
rpath = str_shell_escape (crpath);
|
||||
qsetto = str_shell_escape (vfs_path_get_last_path_str (vpath1));
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath2));
|
||||
|
||||
@ -1391,7 +1391,7 @@ shell_chmod (const vfs_path_t * vpath, mode_t mode)
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
rpath = str_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
@ -1434,7 +1434,7 @@ shell_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
rpath = str_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
@ -1497,7 +1497,7 @@ shell_utime (const vfs_path_t * vpath, mc_timesbuf_t * times)
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
rpath = str_shell_escape (crpath);
|
||||
|
||||
shell_get_atime (times, &atime, &atime_nsec);
|
||||
gmt = gmtime (&atime);
|
||||
@ -1545,7 +1545,7 @@ shell_unlink (const vfs_path_t * vpath)
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
rpath = str_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
@ -1573,7 +1573,7 @@ shell_exists (const vfs_path_t * vpath)
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
rpath = str_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
@ -1603,7 +1603,7 @@ shell_mkdir (const vfs_path_t * vpath, mode_t mode)
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
rpath = str_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
@ -1638,7 +1638,7 @@ shell_rmdir (const vfs_path_t * vpath)
|
||||
if (crpath == NULL)
|
||||
return -1;
|
||||
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
rpath = str_shell_escape (crpath);
|
||||
|
||||
me = VFS_CLASS (vfs_path_get_last_path_vfs (vpath));
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
#include "lib/mcconfig.h"
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/vfs/vfs.h"
|
||||
#include "src/vfs/local/local.c"
|
||||
|
||||
@ -215,7 +214,7 @@ START_TEST (emulate__learn_save)
|
||||
{
|
||||
char *esc_str;
|
||||
|
||||
esc_str = strutils_escape ("T;E\\X;T-FOR-\\T;E;S\\TI;N'G", -1, ";", TRUE);
|
||||
esc_str = str_escape ("T;E\\X;T-FOR-\\T;E;S\\TI;N'G", -1, ";", TRUE);
|
||||
mc_config_set_string_raw (mc_config, "test-group1", "test-param1", esc_str);
|
||||
g_free (esc_str);
|
||||
}
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "tests/mctest.h"
|
||||
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/strescape.h"
|
||||
#include "lib/vfs/vfs.h"
|
||||
#include "lib/fileloc.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user