extfs audio.in & hp48.in patch
q#
eth0 at o2.pl
Mon Oct 18 00:27:37 UTC 2004
Hi,
I modify little those two files. Command `echo "test test"` is not the
same as "`echo "test test"`", so I add those additional `"'. Small test
shows:
mkdir "$HOME/dir with spaces"
cd `basename "$HOME/dir with spaces"`
/bin/sh: cd: too many arguments
Second point is, that in hp48.in there is $*, but parrent function
execute it with "", that means there will be only one argv -- "$1".
With "$1" is easier to see the picture.
My practice with /bin/sh scripts is that the best solution with
functions that have many arguments is using "$@", with this you don't
lost special characters like spaces, etc.
ps. I hope that some one understand me :/ this is word-mess :\
--
best regards
q#
-------------- next part --------------
Index: vfs/extfs/audio.in
===================================================================
RCS file: /cvsroot/mc/mc/vfs/extfs/audio.in,v
retrieving revision 1.7
diff -u -r1.7 audio.in
--- vfs/extfs/audio.in 17 Oct 2004 19:42:20 -0000 1.7
+++ vfs/extfs/audio.in 18 Oct 2004 00:08:48 -0000
@@ -12,7 +12,7 @@
CDDB_HANDSHAKE="hello=user+localhost+mc+1.0&proto=1"
CDDB_TIMEOUT=20 # in seconds
-audiofs_list ()
+audiofs_list()
{
DATE=`date +"%b %d %H:%M"`
echo "-r--r--r-- 1 0 0 0 $DATE CDDB"
@@ -24,7 +24,7 @@
done
}
-audiofs_copyout ()
+audiofs_copyout()
{
if [ "$2" == "CDDB" ]; then
DISCID=`cd-discid "$1" | tr " " "+"`
@@ -32,7 +32,7 @@
exit 1
fi
RESPONSE=`wget -q -T $CDDB_TIMEOUT -O - "$CDDB_SERVER/~cddb/cddb.cgi?cmd=cddb+query+$DISCID&$CDDB_HANDSHAKE" | tee "$3" | @AWK@ '/^200/ { print $2,$3; }'`
- wget -q -T $CDDB_TIMEOUT -O - "$CDDB_SERVER/~cddb/cddb.cgi?cmd=cddb+read+$RESPONSE&$CDDB_HANDSHAKE" | grep -v "^#" >> $3
+ wget -q -T $CDDB_TIMEOUT -O - "$CDDB_SERVER/~cddb/cddb.cgi?cmd=cddb+read+$RESPONSE&$CDDB_HANDSHAKE" | grep -v "^#" >> "$3"
else
TRACK=`echo "$2" | sed 's/track-0*//' | sed 's/\.wav//'`
cdparanoia -q -d "$1" $TRACK "$3" >/dev/null
@@ -43,7 +43,7 @@
then
BASE=/dev/cdrom
else
- BASE=$2
+ BASE="$2"
fi
case "$1" in
Index: vfs/extfs/hp48.in
===================================================================
RCS file: /cvsroot/mc/mc/vfs/extfs/hp48.in,v
retrieving revision 1.2
diff -u -r1.2 hp48.in
--- vfs/extfs/hp48.in 17 Oct 2004 19:33:55 -0000 1.2
+++ vfs/extfs/hp48.in 18 Oct 2004 00:08:48 -0000
@@ -26,13 +26,13 @@
hp48_cmd()
{
-$KERMIT -C "SET EXIT WARNING OFF,REMOTE $*,QUIT"
+$KERMIT -C "SET EXIT WARNING OFF,REMOTE $@,QUIT"
}
hp48_cd()
{
(echo SET EXIT WARNING OFF;echo REMOTE HOST HOME
-for HP48_DIR in `echo "$*" | tr '/' ' '`;do
+for HP48_DIR in `echo "$1" | tr '/' ' '`;do
if [ "x$HP48_DIR" != "x." ];then echo REMOTE HOST "$HP48_DIR"; fi
done
echo QUIT)| $KERMIT -B >/dev/null
@@ -79,20 +79,20 @@
LC_ALL=C
export LC_ALL
-case $1 in
+case "$1" in
list) HP48_CDIR=
hp48_cmd HOST HOME >/dev/null
hp48_list
exit 0;;
copyout)
- cd `dirname "$4"`
- hp48_cd `dirname "$3"`
- $KERMIT -B -g `basename "$3"` -a "$4" >/dev/null
+ cd "`dirname "$4"`"
+ hp48_cd "`dirname "$3"`"
+ $KERMIT -B -g "`basename "$3"`" -a "$4" >/dev/null
exit 0;;
copyin)
- cd `dirname "$4"`
- hp48_cd `dirname "$3"`
- $KERMIT -B -s "$4" -a `basename "$3"` >/dev/null
+ cd "`dirname "$4"`"
+ hp48_cd "`dirname "$3"`"
+ $KERMIT -B -s "$4" -a "`basename "$3"`" >/dev/null
exit 0;;
esac
exit 1
More information about the mc-devel
mailing list