1
1

Add new read dir stuff based on perl.

- please note that this patch won't work right now
Этот коммит содержится в:
Patrick Winnertz 2009-01-22 23:26:57 +01:00
родитель 01ef2aaf80
Коммит 1667b696b7

Просмотреть файл

@ -366,24 +366,60 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
dir->timestamp.tv_sec += fish_directory_timeout;
quoted_path = name_quote (remote_path, 0);
fish_command (me, super, NONE,
"#LIST /%s\n"
"if ls -1 /%s >/dev/null 2>&1 ;\n"
"then\n"
"ls -lan /%s 2>/dev/null | grep '^[^cbt]' | (\n"
"while read p l u g s m d y n; do\n"
"echo \"P$p $u.$g\nS$s\nd$m $d $y\n:$n\n\"\n"
"done\n"
")\n"
"ls -lan /%s 2>/dev/null | grep '^[cb]' | (\n"
"while read p l u g a i m d y n; do\n"
"echo \"P$p $u.$g\nE$a$i\nd$m $d $y\n:$n\n\"\n"
"done\n"
")\n"
"echo '### 200'\n"
"else\n"
"echo '### 500'\n"
"fi\n",
remote_path, quoted_path, quoted_path, quoted_path);
"#LIST /%s\n"
"if `perl -v > /dev/null 2>&1` ; then\n"
"perl -e \"\n"
"use strict;\n"
"use POSIX;\n"
"use Fcntl;\n"
"use POSIX ':fcntl_h'; #S_ISLNK was here until 5.6\n"
"import Fcntl ':mode' unless defined &S_ISLNK; #and is now here\n"
"my $dirname = \"/%s\";\n"
"opendir ( DIR, $dirname ) || printf \"###500\n\";\n"
"while( (my $filename = readdir(DIR))){\""
"my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = lstat(\"$dirname/$filename\");\n"
"if (S_ISLNK($mode) ) {\n"
"printf(\"P%s %i.%i\nS%s\nd%s\n:\\\"%s\\\" -> \\\"%s\\\"\n\n\",$mode,$uid,$gid,$size,scalar localtime $mtime,$filename,readlink(\"$dirname/$filename\"));\n"
"} else {\n"
"printf(\"P%s %i.%i\nS%s\nd%s\n:\\\"%s\\\"\n\n\",$mode,$uid,$gid,$size,scalar localtime $mtime,$filename);\n"
"}}\n"
"printf(\"###200\n\");\n"
"closedir(DIR);\"\n"
"elif `ls -1 /%s >/dev/null 2>&1` ; then\n"
"if `ls -Q >/dev/null 2>&1`; then\n"
"LSOPT=\"-Qlan\";\n"
"ADD=0;\n"
"else\n"
"LSOPT=\"-lan\";\n"
"ADD=1;\n"
"fi\n"
"ls $LSOPT /%s 2>/dev/null | grep '^[^cbt]' | (\n"
"while read p l u g s m d y n; do\n"
"if [ $ADD = 0 ]; then\n"
"echo \"P$p $u.$g\nS$s\nd$m $d $y\n:$n\n\"\n"
"elif `sed --version >/dev/null 2>&1` ; then\n"
"file=`echo $n | sed -e 's#\(.*\) -> \([^->]*\)#\1\" -> \"\2#'`\n"
"echo \"P$p $u $g\nS$s\nd$m $d $y\n:\"$file\"\n\"\n"
"else\n"
"echo \"P$p $u $g\nS$s\nd$m $d $y\n:\"$n\"\n\"\n"
"fi\n"
"done )\n"
"ls $LSOPT /%s 2>/dev/null | grep '^[cb]' | (\n"
"while read p l u g a i m d y n; do\n"
"if [ $ADD = 0 ]; then\n"
"echo \"P$p $u.$g\nE$a$i\nd$m $d $y\n:$n\n\"\n"
"elif `sed --version >/dev/null 2>&1` ; then\n"
"file=`echo $n | sed -e 's#\(.*\) -> \([^->]*\)#\1\" -> \"\2#'`\n"
"echo \"P$p $u $g\nS$s\nd$m $d $y\n:\"$file\"\n\"\n"
"else\n"
"echo \"P$p $u $g\nS$s\nd$m $d $y\n:\"$n\"\n\"\n"
"fi\n"
"done)\n"
"echo '### 200'\n"
"else\n"
"echo '### 500'\n"
"fi\n",
remote_path, quoted_path, quoted_path, quoted_path, quoted_path);
g_free (quoted_path);
ent = vfs_s_generate_entry(me, NULL, dir, 0);
while (1) {