653d63b9e7
- Rename patches with update-patches while here
82 lines
2.2 KiB
Plaintext
82 lines
2.2 KiB
Plaintext
$OpenBSD: patch-bin_showpartial,v 1.1 2002/02/20 21:18:02 pvalchev Exp $
|
|
--- bin/showpartial.orig Wed Feb 2 16:21:29 1994
|
|
+++ bin/showpartial Wed Feb 20 14:06:43 2002
|
|
@@ -2,8 +2,44 @@
|
|
# (The "-fb" might need to be changed to "-f" on some systems)
|
|
#
|
|
|
|
+# Check argument integrity. Don't trust mail headers
|
|
+switch ("$1$2$3$4")
|
|
+case "*[\t ]*":
|
|
+ echo "Illegal white space in arguments\!"
|
|
+ echo "Command was:"
|
|
+ echo "'$0' '$1' '$2' '$3' '$4'"
|
|
+ exit 2
|
|
+endsw
|
|
+
|
|
+# Set a sensible value for the temporary directory, if its not
|
|
+# already set. If TMPDIR is set previously, then we will
|
|
+# assume it is adequately protected.
|
|
if (! $?METAMAIL_TMPDIR) then
|
|
- set METAMAIL_TMPDIR=/tmp
|
|
+ if ($?TMPDIR) then
|
|
+ set METAMAIL_TMPDIR="$TMPDIR"
|
|
+ else
|
|
+ set METAMAIL_TMPDIR=~/metamail_tmp
|
|
+ endif
|
|
+endif
|
|
+
|
|
+# Set a sensible umask value
|
|
+umask 077
|
|
+
|
|
+# Make sure that the temporary directory is available
|
|
+if (! -d "$METAMAIL_TMPDIR") then
|
|
+
|
|
+ if (! -e "$METAMAIL_TMPDIR") then
|
|
+ mkdir "$METAMAIL_TMPDIR"
|
|
+ else
|
|
+ echo "$METAMAIL_TMPDIR exists, but is not a directory"
|
|
+ exit 2
|
|
+ endif
|
|
+
|
|
+ if ( $status != 0 || ! -d "$METAMAIL_TMPDIR" ) then
|
|
+ echo "Error creating $METAMAIL_TMPDIR"
|
|
+ exit 2
|
|
+ endif
|
|
+
|
|
endif
|
|
|
|
set TREEROOT=${METAMAIL_TMPDIR}/m-prts-`whoami`
|
|
@@ -11,14 +47,14 @@ if ($#argv < 3 || $#argv > 4) then
|
|
echo "Usage: showpartial file id partnum totalnum"
|
|
exit -1
|
|
endif
|
|
-set file=$1
|
|
+set file="$1"
|
|
# This next line is because message-id can contain weird chars
|
|
-set id=`echo $2 | tr -d \!\$\&\*\(\)\|\'\"\;\/\<\>\\`
|
|
-@ partnum = $3
|
|
-if ($#argv == 3 || $4 == "") then
|
|
+set id=`echo "$2" | tr -d \!\$\&\*\(\)\|\'\"\;\/\<\>\\`
|
|
+@ partnum = "$3"
|
|
+if ($#argv == 3 || "$4" == "") then
|
|
set totalnum=-1
|
|
else
|
|
- @ totalnum = $4
|
|
+ @ totalnum = "$4"
|
|
endif
|
|
|
|
if (! -d $TREEROOT) then
|
|
@@ -35,9 +71,9 @@ if (! -d ${TREEROOT}/$id) then
|
|
exit -1
|
|
endif
|
|
endif
|
|
-cp $file ${TREEROOT}/$id/$partnum
|
|
+cp "$file" ${TREEROOT}/$id/$partnum
|
|
if ($status) then
|
|
- echo cp $file ${TREEROOT}/$id/$partnum failed
|
|
+ echo cp "$file" ${TREEROOT}/$id/$partnum failed
|
|
exit -1
|
|
endif
|
|
if ($totalnum == -1) then
|