Protect input parameter file name with double quotes every where in case it contains white space. Closes issue #28
This commit is contained in:
parent
13d550a40e
commit
7b803170c2
@ -84,7 +84,7 @@ umask 77
|
|||||||
|
|
||||||
checkcmds xsltproc
|
checkcmds xsltproc
|
||||||
|
|
||||||
xsltproc - $infile <<EOF
|
xsltproc - "$infile" <<EOF
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
|||||||
@ -86,7 +86,7 @@ checkcmds sed
|
|||||||
# Delete everything from <div id="menu"> to <div id="main-page">
|
# Delete everything from <div id="menu"> to <div id="main-page">
|
||||||
# This prints an additional blank line at top which does not matter
|
# This prints an additional blank line at top which does not matter
|
||||||
sed -n -e '1,/<div id="menu">/{x;p' -e '}' \
|
sed -n -e '1,/<div id="menu">/{x;p' -e '}' \
|
||||||
-e '/<div id="main-page">/,$p' < $infile
|
-e '/<div id="main-page">/,$p' < "$infile"
|
||||||
|
|
||||||
# exit normally
|
# exit normally
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@ -114,7 +114,7 @@ else
|
|||||||
fi
|
fi
|
||||||
tmplink=$ttdir/rcldjvu_tmp$$.djvu
|
tmplink=$ttdir/rcldjvu_tmp$$.djvu
|
||||||
rm -f $tmplink
|
rm -f $tmplink
|
||||||
ln -s $infile $tmplink || exit 1
|
ln -s "$infile" $tmplink || exit 1
|
||||||
|
|
||||||
cleanup()
|
cleanup()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -145,6 +145,6 @@ END {
|
|||||||
# seem to be an issue with our brave html input handler...
|
# seem to be an issue with our brave html input handler...
|
||||||
if test $? -eq 1 ; then
|
if test $? -eq 1 ; then
|
||||||
if iscmd wvWare ; then
|
if iscmd wvWare ; then
|
||||||
wvWare --nographics --charset=utf-8 $infile
|
wvWare --nographics --charset=utf-8 "$infile"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -79,7 +79,7 @@ umask 77
|
|||||||
|
|
||||||
checkcmds xsltproc
|
checkcmds xsltproc
|
||||||
|
|
||||||
xsltproc - $infile <<EOF
|
xsltproc - "$infile" <<EOF
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
|||||||
@ -138,7 +138,7 @@ NR == 1 {
|
|||||||
END {
|
END {
|
||||||
printf("</body></html>\n")
|
printf("</body></html>\n")
|
||||||
}
|
}
|
||||||
' < $infile
|
' < "$infile"
|
||||||
|
|
||||||
# exit normally
|
# exit normally
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@ -107,7 +107,7 @@ cleanup()
|
|||||||
trap cleanup EXIT HUP QUIT INT TERM
|
trap cleanup EXIT HUP QUIT INT TERM
|
||||||
|
|
||||||
# Old kwd files are gzip/tar archibes. Newer ones are zip archives.
|
# Old kwd files are gzip/tar archibes. Newer ones are zip archives.
|
||||||
if file $infile | grep -qi gzip ; then
|
if file "$infile" | grep -qi gzip ; then
|
||||||
# Unzip the input file and change to the unzipped directory
|
# Unzip the input file and change to the unzipped directory
|
||||||
gunzip < "$infile" | (cd $tmpdir/rclkwdtmp;tar xf -)
|
gunzip < "$infile" | (cd $tmpdir/rclkwdtmp;tar xf -)
|
||||||
else
|
else
|
||||||
|
|||||||
@ -128,7 +128,7 @@ trap cleanup EXIT HUP QUIT INT TERM
|
|||||||
workdir=$tmpdir/rcllyxtmp
|
workdir=$tmpdir/rcllyxtmp
|
||||||
case "$infile" in
|
case "$infile" in
|
||||||
*/*) ;;
|
*/*) ;;
|
||||||
*) infile=`pwd`/$infile;;
|
*) infile=`pwd`/"$infile";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
binfile=`basename "$infile"`
|
binfile=`basename "$infile"`
|
||||||
|
|||||||
@ -137,7 +137,7 @@ NR == 1 {
|
|||||||
END {
|
END {
|
||||||
printf("</body></html>\n")
|
printf("</body></html>\n")
|
||||||
}
|
}
|
||||||
' < $infile
|
' < "$infile"
|
||||||
|
|
||||||
# exit normally
|
# exit normally
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@ -106,7 +106,7 @@ sedjoinprog=':a
|
|||||||
#P;D'
|
#P;D'
|
||||||
|
|
||||||
# Extract description title author and keywords
|
# Extract description title author and keywords
|
||||||
description=`sed -e "$sedjoinprog" < $infile | \
|
description=`sed -e "$sedjoinprog" < "$infile" | \
|
||||||
awk '
|
awk '
|
||||||
/<DOCUMENT / {
|
/<DOCUMENT / {
|
||||||
if (match($0, " COMMENTS=\"[^\"]+")) {
|
if (match($0, " COMMENTS=\"[^\"]+")) {
|
||||||
@ -117,7 +117,7 @@ awk '
|
|||||||
}
|
}
|
||||||
'`
|
'`
|
||||||
|
|
||||||
title=`sed -e "$sedjoinprog" < $infile | \
|
title=`sed -e "$sedjoinprog" < "$infile" | \
|
||||||
awk '
|
awk '
|
||||||
/<DOCUMENT / {
|
/<DOCUMENT / {
|
||||||
if (match($0, " TITLE=\"[^\"]+")) {
|
if (match($0, " TITLE=\"[^\"]+")) {
|
||||||
@ -128,7 +128,7 @@ awk '
|
|||||||
}
|
}
|
||||||
'`
|
'`
|
||||||
|
|
||||||
author=`sed -e "$sedjoinprog" < $infile | \
|
author=`sed -e "$sedjoinprog" < "$infile" | \
|
||||||
awk '
|
awk '
|
||||||
/<DOCUMENT / {
|
/<DOCUMENT / {
|
||||||
if (match($0, " AUTHOR=\"[^\"]+")) {
|
if (match($0, " AUTHOR=\"[^\"]+")) {
|
||||||
@ -139,7 +139,7 @@ awk '
|
|||||||
}
|
}
|
||||||
'`
|
'`
|
||||||
|
|
||||||
keywords=`sed -e "$sedjoinprog" < $infile | \
|
keywords=`sed -e "$sedjoinprog" < "$infile" | \
|
||||||
awk '
|
awk '
|
||||||
/<DOCUMENT / {
|
/<DOCUMENT / {
|
||||||
if (match($0, " KEYWORDS=\"[^\"]+")) {
|
if (match($0, " KEYWORDS=\"[^\"]+")) {
|
||||||
@ -165,7 +165,7 @@ cat <<EOF
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
sed -e ':a' -e '/[^>] *$/N; s/\n/ /; ta' < $infile | \
|
sed -e ':a' -e '/[^>] *$/N; s/\n/ /; ta' < "$infile" | \
|
||||||
awk '
|
awk '
|
||||||
/<ITEXT / {
|
/<ITEXT / {
|
||||||
if (match($0, " CH=\"[^\"]+")) {
|
if (match($0, " CH=\"[^\"]+")) {
|
||||||
|
|||||||
@ -86,7 +86,7 @@ checkcmds sed
|
|||||||
# Delete everything from <div id="menu"> to <div id="main-page">
|
# Delete everything from <div id="menu"> to <div id="main-page">
|
||||||
# This prints an additional blank line at top which does not matter
|
# This prints an additional blank line at top which does not matter
|
||||||
sed -n -e '1,/<div id="menu">/{x;p' -e '}' \
|
sed -n -e '1,/<div id="menu">/{x;p' -e '}' \
|
||||||
-e '/<div id="main-page">/,$p' < $infile
|
-e '/<div id="main-page">/,$p' < "$infile"
|
||||||
|
|
||||||
# exit normally
|
# exit normally
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@ -79,7 +79,7 @@ umask 77
|
|||||||
|
|
||||||
checkcmds xsltproc
|
checkcmds xsltproc
|
||||||
|
|
||||||
xsltproc - $infile <<EOF
|
xsltproc - "$infile" <<EOF
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user