From f018970577d13c3ea790239c9eca0fa60f76699a Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Tue, 9 Jun 2009 12:12:17 +0300 Subject: [PATCH] Renamed functions shell_escape (to strutils_shell_escape) and shell_unescape (to strutils_shell_unescape) Signed-off-by: Slava Zanko --- src/command.c | 2 +- src/complete.c | 10 +++++----- src/file.c | 4 ++-- src/strescape.c | 4 ++-- src/strescape.h | 6 +++--- vfs/fish.c | 26 +++++++++++++------------- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/command.c b/src/command.c index a92c5e571..e4553ea92 100644 --- a/src/command.c +++ b/src/command.c @@ -68,7 +68,7 @@ examine_cd (const char *_path) const char *t; /* Tilde expansion */ - path = shell_unescape(_path); + path = strutils_shell_unescape(_path); path_tilde = tilde_expand (path); /* Leave space for further expansion */ diff --git a/src/complete.c b/src/complete.c index b4ee1291a..5fea2c830 100644 --- a/src/complete.c +++ b/src/complete.c @@ -93,12 +93,12 @@ filename_completion_function (const char * text, int state, INPUT_COMPLETE_FLAGS char * result; char * e_result; - u_text = shell_unescape (text); + u_text = strutils_shell_unescape (text); result = filename_completion_function (u_text, state, flags & (~INPUT_COMPLETE_SHELL_ESC)); g_free (u_text); - e_result = shell_escape (result); + e_result = strutils_shell_escape (result); g_free (result); return e_result; @@ -482,7 +482,7 @@ command_completion_function (const char *_text, int state, INPUT_COMPLETE_FLAGS if (!(flags & INPUT_COMPLETE_COMMANDS)) return 0; - text = shell_unescape(_text); + text = strutils_shell_unescape(_text); flags &= ~INPUT_COMPLETE_SHELL_ESC; if (!state) { /* Initialize us a little bit */ @@ -506,7 +506,7 @@ command_completion_function (const char *_text, int state, INPUT_COMPLETE_FLAGS if (p) { char *temp_p = p; - p = shell_escape (p); + p = strutils_shell_escape (p); g_free (temp_p); } @@ -564,7 +564,7 @@ command_completion_function (const char *_text, int state, INPUT_COMPLETE_FLAGS path = NULL; } else if ((p = strrchr (found, PATH_SEP)) != NULL) { char *tmp = found; - found = shell_escape (p + 1); + found = strutils_shell_escape (p + 1); g_free (tmp); } diff --git a/src/file.c b/src/file.c index 467291af1..8a690a76b 100644 --- a/src/file.c +++ b/src/file.c @@ -2017,10 +2017,10 @@ panel_operate (void *source_panel, FileOperation operation, g_free(temp); temp3 = source_with_path; - source_with_path = shell_unescape(source_with_path); + source_with_path = strutils_shell_unescape(source_with_path); g_free(temp3); temp3 = temp2; - temp2 = shell_unescape(temp2); + temp2 = strutils_shell_unescape(temp2); g_free(temp3); switch (operation) { diff --git a/src/strescape.c b/src/strescape.c index d70430ff0..5be3578a4 100644 --- a/src/strescape.c +++ b/src/strescape.c @@ -62,7 +62,7 @@ or NULL when NULL string is passed. */ char * -shell_escape (const char *src) +strutils_shell_escape (const char *src) { GString *str; char *result = NULL; @@ -110,7 +110,7 @@ shell_escape (const char *src) return unescaped string (which needs to be freed) */ char * -shell_unescape (const char *text) +strutils_shell_unescape (const char *text) { GString *str; char *result = NULL; diff --git a/src/strescape.h b/src/strescape.h index 199cfcff9..41931af0c 100644 --- a/src/strescape.h +++ b/src/strescape.h @@ -15,8 +15,8 @@ /*** declarations of public functions ************************************************************/ -gboolean shell_is_char_escaped (const char *); -char *shell_unescape (const char *); -char *shell_escape (const char *); +gboolean strutils_is_char_escaped (const char *); +char *strutils_shell_unescape (const char *); +char *strutils_shell_escape (const char *); #endif diff --git a/vfs/fish.c b/vfs/fish.c index f2e5c39f9..63e6b824d 100644 --- a/vfs/fish.c +++ b/vfs/fish.c @@ -394,7 +394,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path) gettimeofday(&dir->timestamp, NULL); dir->timestamp.tv_sec += fish_directory_timeout; - quoted_path = shell_escape (remote_path); + quoted_path = strutils_shell_escape (remote_path); shell_commands = g_strconcat( "#LIST /%s\n" "if `perl -v > /dev/null 2>&1` ; then\n" @@ -410,12 +410,12 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path) "my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = lstat(\"$dirname/$filename\");\n" "my $mloctime= scalar localtime $mtime;\n" , - "my $shell_escape_regex= s/([;<>\\*\\|`&\\$!#\\(\\)\\[\\]\\{\\}:'\\''\"\\ \\\\])/\\\\$1/g;\n" + "my $strutils_shell_escape_regex= s/([;<>\\*\\|`&\\$!#\\(\\)\\[\\]\\{\\}:'\\''\"\\ \\\\])/\\\\$1/g;\n" "my $e_filename = $filename;\n" - "$e_filename =~ $shell_escape_regex;\n" + "$e_filename =~ $strutils_shell_escape_regex;\n" "if (S_ISLNK($mode) ) {\n" "my $linkname = readlink (\"$dirname/$filename\");\n" - "$linkname =~ $shell_escape_regex;\n" + "$linkname =~ $strutils_shell_escape_regex;\n" "\n" "printf(\"R%%o %%o $uid.$gid\\n" "S$size\\n" @@ -545,12 +545,12 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path) ent->name = str_dup_range(filename, filename_bound); temp = ent->name; - ent->name = shell_unescape(ent->name); + ent->name = strutils_shell_unescape(ent->name); g_free(temp); ent->ino->linkname = str_dup_range(linkname, linkname_bound); temp = ent->ino->linkname; - ent->ino->linkname = shell_unescape(ent->ino->linkname); + ent->ino->linkname = strutils_shell_unescape(ent->ino->linkname); g_free(temp); } else { /* we expect: "escaped-name" */ @@ -567,7 +567,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path) } ent->name = str_dup_range(filename, filename_bound); temp = ent->name; - ent->name = shell_unescape(ent->name); + ent->name = strutils_shell_unescape(ent->name); g_free(temp); } break; @@ -686,7 +686,7 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc * algorithm for file appending case, therefore just "dd" is used for it. */ - quoted_name = shell_escape(name); + quoted_name = strutils_shell_escape(name); print_vfs_message(_("fish: store %s: sending command..."), quoted_name ); /* FIXME: File size is limited to ULONG_MAX */ @@ -784,7 +784,7 @@ fish_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset) name = vfs_s_fullpath (me, fh->ino); if (!name) return 0; - quoted_name = shell_escape(name); + quoted_name = strutils_shell_escape(name); fh->u.fish.append = 0; /* @@ -925,7 +925,7 @@ fish_send_command(struct vfs_class *me, struct vfs_s_super *super, const char *c g_free (mpath); \ return -1; \ } \ - rpath = shell_escape(crpath); \ + rpath = strutils_shell_escape(crpath); \ g_free (mpath); #define POSTFIX(flags) \ @@ -960,9 +960,9 @@ static int fish_##name (struct vfs_class *me, const char *path1, const char *pat g_free (mpath2); \ return -1; \ } \ - rpath1 = shell_escape (crpath1); \ + rpath1 = strutils_shell_escape (crpath1); \ g_free (mpath1); \ - rpath2 = shell_escape (crpath2); \ + rpath2 = strutils_shell_escape (crpath2); \ g_free (mpath2); \ g_snprintf(buf, sizeof(buf), string "\n", rpath1, rpath2, rpath1, rpath2); \ g_free (rpath1); \ @@ -981,7 +981,7 @@ static int fish_symlink (struct vfs_class *me, const char *setto, const char *pa { char *qsetto; PREFIX - qsetto = shell_escape (setto); + qsetto = strutils_shell_escape (setto); g_snprintf(buf, sizeof(buf), "#SYMLINK %s /%s\n" "ln -s %s /%s 2>/dev/null\n"