mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-08 20:41:59 +03:00
Ticket #2031 (FISH fix for Sun Solaris)
Removed bashism, fixed incorrect work under Solaris. Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
parent
325c266506
commit
73fee4232c
@ -332,29 +332,29 @@ fish_set_env (int flags)
|
||||
{
|
||||
GString *tmp;
|
||||
|
||||
tmp = g_string_sized_new (150);
|
||||
g_string_assign (tmp, "export ");
|
||||
tmp = g_string_sized_new (250);
|
||||
g_string_assign (tmp, "");
|
||||
|
||||
if ((flags & FISH_HAVE_HEAD) != 0)
|
||||
g_string_append (tmp, "FISH_HAVE_HEAD=1 ");
|
||||
g_string_append (tmp, "FISH_HAVE_HEAD=1 export FISH_HAVE_HEAD; ");
|
||||
|
||||
if ((flags & FISH_HAVE_SED) != 0)
|
||||
g_string_append (tmp, "FISH_HAVE_SED=1 ");
|
||||
g_string_append (tmp, "FISH_HAVE_SED=1 export FISH_HAVE_SED; ");
|
||||
|
||||
if ((flags & FISH_HAVE_AWK) != 0)
|
||||
g_string_append (tmp, "FISH_HAVE_AWK=1 ");
|
||||
g_string_append (tmp, "FISH_HAVE_AWK=1 export FISH_HAVE_AWK; ");
|
||||
|
||||
if ((flags & FISH_HAVE_PERL) != 0)
|
||||
g_string_append (tmp, "FISH_HAVE_PERL=1 ");
|
||||
g_string_append (tmp, "FISH_HAVE_PERL=1 export FISH_HAVE_PERL; ");
|
||||
|
||||
if ((flags & FISH_HAVE_LSQ) != 0)
|
||||
g_string_append (tmp, "FISH_HAVE_LSQ=1 ");
|
||||
g_string_append (tmp, "FISH_HAVE_LSQ=1 export FISH_HAVE_LSQ; ");
|
||||
|
||||
if ((flags & FISH_HAVE_DATE_MDYT) != 0)
|
||||
g_string_append (tmp, "FISH_HAVE_DATE_MDYT=1 ");
|
||||
g_string_append (tmp, "FISH_HAVE_DATE_MDYT=1 export FISH_HAVE_DATE_MDYT; ");
|
||||
|
||||
if ((flags & FISH_HAVE_TAIL) != 0)
|
||||
g_string_append (tmp, "FISH_HAVE_TAIL=1 ");
|
||||
g_string_append (tmp, "FISH_HAVE_TAIL=1 export FISH_HAVE_TAIL; ");
|
||||
|
||||
return g_string_free (tmp, FALSE);
|
||||
}
|
||||
@ -526,7 +526,7 @@ fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
|
||||
/* Set up remote locale to C, otherwise dates cannot be recognized */
|
||||
if (fish_command
|
||||
(me, super, WAIT_REPLY,
|
||||
"export LANG=C LC_ALL=C LC_TIME=C\n" "echo '### 200'\n") != COMPLETE)
|
||||
"LANG=C LC_ALL=C LC_TIME=C; export LANG LC_ALL LC_TIME;\n" "echo '### 200'\n") != COMPLETE)
|
||||
ERRNOR (E_PROTO, -1);
|
||||
|
||||
print_vfs_message (_("fish: Getting host info..."));
|
||||
|
@ -1,18 +1,17 @@
|
||||
#APPE $FISH_FILESIZE $FISH_FILENAME
|
||||
FILENAME="/${FISH_FILENAME}"
|
||||
echo "### 001"
|
||||
FILENAME="/$FISH_FILENAME"
|
||||
res=`exec 3>&1
|
||||
(
|
||||
head -c $FISH_FILESIZE -q - || echo DD >&3
|
||||
) 2>/dev/null | (
|
||||
cat > "${FILENAME}"
|
||||
cat > /dev/null
|
||||
)`; [ "$res" = DD ] && {
|
||||
{
|
||||
> "${FILENAME}"
|
||||
while [ $FISH_FILESIZE -gt 0 ]
|
||||
do
|
||||
cnt=`expr \\( $FISH_FILESIZE + 255 \\) / 256`
|
||||
n=`dd bs=256 count=$cnt | tee -a "${FILENAME}" | wc -c`
|
||||
FISH_FILESIZE=`expr $FISH_FILESIZE - $n`
|
||||
bss=4096
|
||||
bsl=4095
|
||||
if [ $FISH_FILESIZE -lt $bss ]; then
|
||||
bss=1;
|
||||
bsl=0;
|
||||
fi
|
||||
while [ $FISH_FILESIZE -gt 0 ]; do
|
||||
cnt=`expr \\( $FISH_FILESIZE + $bsl \\) / $bss`
|
||||
n=`dd bs=$bss count=$cnt | tee -a "${FILENAME}" | wc -c`
|
||||
FISH_FILESIZE=`expr $FISH_FILESIZE - $n`
|
||||
done
|
||||
}; echo "### 200"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#RETR $FISH_FILENAME $FISH_START_OFFSET
|
||||
export LC_TIME=C
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
fish_get_perl ()
|
||||
{
|
||||
FILENAME=$1
|
||||
@ -38,7 +39,8 @@ fish_get_tail ()
|
||||
{
|
||||
FILENAME=$1
|
||||
OFFSET=$2
|
||||
export LC_TIME=C
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
if dd if="${FILENAME}" of=/dev/null bs=1 count=1 2>/dev/null ; then
|
||||
file_size=`ls -ln "${FILENAME}" 2>/dev/null | (
|
||||
read p l u g s r
|
||||
@ -69,7 +71,8 @@ fish_get_dd ()
|
||||
{
|
||||
FILENAME=$1
|
||||
OFFSET=$2
|
||||
export LC_TIME=C
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
if dd if="${FILENAME}" of=/dev/null bs=1 count=1 2>/dev/null ; then
|
||||
file_size=`ls -ln "${FILENAME}" 2>/dev/null | (
|
||||
read p l u g s r
|
||||
|
@ -1,4 +1,5 @@
|
||||
export LC_TIME=C
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
#FISH_HAVE_HEAD 1
|
||||
#FISH_HAVE_SED 2
|
||||
#FISH_HAVE_AWK 4
|
||||
@ -10,10 +11,10 @@ res=0
|
||||
if `echo yes| head -c 1 > /dev/null 2>&1` ; then
|
||||
res=`expr $res + 1`
|
||||
fi
|
||||
if `sed --version >/dev/null 2>&1` ; then
|
||||
if `echo 1 | sed 's/1/2/' >/dev/null 2>&1` ; then
|
||||
res=`expr $res + 2`
|
||||
fi
|
||||
if `awk --version > /dev/null 2>&1` ; then
|
||||
if `echo 1| awk '{print}' > /dev/null 2>&1` ; then
|
||||
res=`expr $res + 4`
|
||||
fi
|
||||
if `perl -v > /dev/null 2>&1` ; then
|
||||
@ -22,15 +23,16 @@ fi
|
||||
if `ls -Q / >/dev/null 2>&1` ; then
|
||||
res=`expr $res + 16`
|
||||
fi
|
||||
dat=`ls -lan / 2>/dev/null | head -n 3 | tail -n 1 | (
|
||||
dat=`ls -lan / 2>/dev/null | head -n 3 | (
|
||||
while read p l u g s rec; do
|
||||
if [ -n "$g" ]; then
|
||||
if [ -n "$l" ]; then
|
||||
echo "$rec"
|
||||
fi
|
||||
if [ -n "$g" ]; then
|
||||
if [ -n "$l" ]; then
|
||||
echo "$rec"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
) |cut -c1 2>/dev/null`
|
||||
)`
|
||||
dat=`echo $dat | cut -c1 2>/dev/null`
|
||||
r=`echo "0123456789"| grep "$dat"`
|
||||
if [ -z "$r" ]; then
|
||||
res=`expr $res + 32`
|
||||
|
@ -1,5 +1,7 @@
|
||||
#LIST /${FISH_DIR}
|
||||
export LC_TIME=C
|
||||
#LIST /${FISH_DIR }
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
|
||||
fish_list_lsq ()
|
||||
{
|
||||
FISH_DIR="$1"
|
||||
@ -28,7 +30,7 @@ echo '### 200'
|
||||
fish_list_sed ()
|
||||
{
|
||||
FISH_DIR="$1"
|
||||
ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | (
|
||||
ls -lan "${FISH_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
|
||||
|
@ -2,9 +2,15 @@
|
||||
FILENAME="/${FISH_FILENAME}"
|
||||
echo "### 001"
|
||||
{
|
||||
bss=4096
|
||||
bsl=4095
|
||||
if [ $FISH_FILESIZE -lt $bss ]; then
|
||||
bss=1;
|
||||
bsl=0;
|
||||
fi
|
||||
while [ $FISH_FILESIZE -gt 0 ]; do
|
||||
cnt=`expr \\( $FISH_FILESIZE + 255 \\) / 256`
|
||||
n=`dd bs=256 count=$cnt | tee -a "${FILENAME}" | wc -c`
|
||||
cnt=`expr \\( $FISH_FILESIZE + $bsl \\) / $bss`
|
||||
n=`dd bs=$bss count=$cnt | tee -a "${FILENAME}" | wc -c`
|
||||
FISH_FILESIZE=`expr $FISH_FILESIZE - $n`
|
||||
done
|
||||
}; echo "### 200"
|
||||
|
Loading…
Reference in New Issue
Block a user