diff options
Diffstat (limited to '')
-rw-r--r-- | src/vfs/shell/helpers/ls (renamed from src/vfs/fish/helpers/ls) | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/src/vfs/fish/helpers/ls b/src/vfs/shell/helpers/ls index 7165b51..c7701d6 100644 --- a/src/vfs/fish/helpers/ls +++ b/src/vfs/shell/helpers/ls @@ -1,11 +1,10 @@ -#LIST /${FISH_DIR} LC_TIME=C export LC_TIME perl_res="1" -fish_list_lsq () +shell_list_lsq () { -FISH_DIR="$1" -ls -Qlan "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | ( +SHELL_DIR="$1" +ls -Qlan "${SHELL_DIR}" 2>/dev/null | grep '^[^cbt]' | ( while read p l u g s m d y n; do echo "P$p $u.$g" echo "S$s" @@ -15,7 +14,7 @@ while read p l u g s m d y n; do done ) -ls -Qlan "${FISH_DIR}" 2>/dev/null | grep '^[cb]' | ( +ls -Qlan "${SHELL_DIR}" 2>/dev/null | grep '^[cb]' | ( while read p l u g a i m d y n; do echo "P$p $u.$g" echo "E$a$i" @@ -27,13 +26,13 @@ done echo '### 200' } -fish_list_sed () +shell_list_sed () { -FISH_DIR="$1" -ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | ( +SHELL_DIR="$1" +ls -lan "${SHELL_DIR}" 2>/dev/null | grep '^[^cbt]' | ( while read p l u g s rec; do if [ -n "$g" ]; then - if [ -n "$FISH_HAVE_DATE_MDYT" ]; then + if [ -n "$SHELL_HAVE_DATE_MDYT" ]; then filename=`echo "$rec"| sed 's/[^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+ //'` filedate=`echo "$rec"| sed 's/\([^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+\) .*/\1/'` else @@ -43,7 +42,7 @@ while read p l u g s rec; do pfile=\"`echo "$filename" | sed -e 's#^\(.*\) -> \(.*\)#\1" -> "\2#'`\" echo "P$p $u.$g" echo "S$s" - if [ -n "$FISH_HAVE_DATE_MDYT" ]; then + if [ -n "$SHELL_HAVE_DATE_MDYT" ]; then echo "d$filedate" else echo "D$filedate" @@ -53,10 +52,10 @@ while read p l u g s rec; do fi done ) -ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[cb]' | ( +ls -lan "${SHELL_DIR}" 2>/dev/null | grep '^[cb]' | ( while read p l u g a i rec; do if [ -n "$g" ]; then - if [ -n "$FISH_HAVE_DATE_MDYT" ]; then + if [ -n "$SHELL_HAVE_DATE_MDYT" ]; then filename=`echo "$rec"| sed 's/[^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+ //'` filedate=`echo "$rec"| sed 's/\([^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+\) .*/\1/'` else @@ -66,7 +65,7 @@ while read p l u g a i rec; do pfile=\"`echo "$filename" | sed -e 's#^\(.*\) -> \(.*\)#\1" -> "\2#'`\" echo "P$p $u.$g" echo "E$a$i" - if [ -n "$FISH_HAVE_DATE_MDYT" ]; then + if [ -n "$SHELL_HAVE_DATE_MDYT" ]; then echo "d$filedate" else echo "D$filedate" @@ -79,10 +78,10 @@ done echo '### 200' } -fish_list_poor_ls () +shell_list_poor_ls () { -FISH_DIR="$1" -ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | ( +SHELL_DIR="$1" +ls -lan "${SHELL_DIR}" 2>/dev/null | grep '^[^cbt]' | ( while read p l u g s m d y n n2 n3; do if [ -n "$g" ]; then if [ "$m" = "0" ]; then @@ -98,7 +97,7 @@ while read p l u g s m d y n n2 n3; do fi done ) -ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[cb]' | ( +ls -lan "${SHELL_DIR}" 2>/dev/null | grep '^[cb]' | ( while read p l u g a i m d y n n2 n3; do if [ -n "$g" ]; then if [ "$a" = "0" ]; then @@ -117,15 +116,14 @@ done echo '### 200' } -fish_list_perl () +shell_list_perl () { -FISH_DIR=$1 +SHELL_DIR=$1 perl -e ' use strict; use POSIX; -use Fcntl; -use POSIX ":fcntl_h"; #S_ISLNK was here until 5.6 -import Fcntl ":mode" unless defined &S_ISLNK; #and is now here +use Fcntl ":mode"; # S_ISLNK, S_IFMT, S_IMODE are here +use POSIX ":fcntl_h"; # S_ISLNK might be here as well my $dirname = $ARGV[0]; if (opendir (DIR, $dirname)) { while((my $filename = readdir (DIR))){ @@ -152,19 +150,19 @@ while((my $filename = readdir (DIR))){ printf("### 500\n"); } exit 0 -' "/${FISH_DIR}" +' "/${SHELL_DIR}" perl_res=$? } -if [ -n "${FISH_HAVE_PERL}" ]; then - fish_list_perl "/${FISH_FILENAME}" +if [ -n "${SHELL_HAVE_PERL}" ]; then + shell_list_perl "/${SHELL_FILENAME}" fi if [ "${perl_res}" != "0" ]; then - if [ -n "${FISH_HAVE_LSQ}" ]; then - fish_list_lsq "/${FISH_FILENAME}" - elif [ -n "${FISH_HAVE_SED}" ]; then - fish_list_sed "/${FISH_FILENAME}" + if [ -n "${SHELL_HAVE_LSQ}" ]; then + shell_list_lsq "/${SHELL_FILENAME}" + elif [ -n "${SHELL_HAVE_SED}" ]; then + shell_list_sed "/${SHELL_FILENAME}" else - fish_list_poor_ls "/${FISH_FILENAME}" + shell_list_poor_ls "/${SHELL_FILENAME}" fi fi |