From e1572aefd37030a99ef4da0eee110e1cb35058c9 Mon Sep 17 00:00:00 2001 From: Patrick Winnertz Date: Sun, 25 Jan 2009 22:45:06 +0100 Subject: [PATCH] Remove embedded function and use instead the regex directly as we doesn't need more lines of code as really necessary. The regex stuff is taken from this site: http://www.slac.stanford.edu/slac/www/resource/how-to-use/cgi-rexx/cgi-esc.htm --- vfs/fish.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/vfs/fish.c b/vfs/fish.c index c63949815..545aa2529 100644 --- a/vfs/fish.c +++ b/vfs/fish.c @@ -392,23 +392,17 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path) "while( (my $filename = readdir(DIR))){\n" "my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = lstat(\"$dirname/$filename\");\n" "my $mloctime= scalar localtime $mtime;\n" - "\n" - "# shell escs are taken from here: http://www.slac.stanford.edu/slac/www/resource/how-to-use/cgi-rexx/cgi-esc.html\n" - " sub esc_shell_chars {\n" - " my $s = $_[0];\n" - " $s =~ s/([;<>\\*\\|`&\\$!#\\(\\)\\[\\]\\{\\}:'\\''\"\\ \\\\])/\\\\$1/g;\n" - " return $s;\n" - " }\n" - "\n" - "my $e_filename = esc_shell_chars($filename);\n" + "my $shell_escape_regex= s/([;<>\\*\\|`&\\$!#\\(\\)\\[\\]\\{\\}:'\\''\"\\ \\\\])/\\\\$1/g;\n" + "my $e_filename = $filename;\n" + "$e_filename =~ $shell_escape_regex;\n" "if (S_ISLNK($mode) ) {\n" "my $linkname = readlink (\"$dirname/$filename\");\n" - "my $e_linkname = esc_shell_chars($linkname);\n" + "$linkname =~ $shell_escape_regex;\n" "\n" "printf(\"R%%o %%o $uid.$gid\\n" "S$size\\n" "d$mloctime\\n" - ":\\\"$e_filename\\\" -> \\\"$e_linkname\\\"\\n" + ":\\\"$e_filename\\\" -> \\\"$linkname\\\"\\n" "\\n\", S_IMODE($mode), S_IFMT($mode));\n" "} else {\n" "printf(\"R%%o %%o $uid.$gid\\n" -- 2.11.4.GIT