patch-src_bin_showpicture 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. $OpenBSD: patch-src_bin_showpicture,v 1.1 2012/03/17 10:57:23 sthen Exp $
  2. --- src/bin/showpicture.orig Mon Feb 7 17:59:54 1994
  3. +++ src/bin/showpicture Sat Mar 17 10:51:52 2012
  4. @@ -15,15 +15,42 @@
  5. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  6. #
  7. +# Set a sensible value for the temporary directory, if its not
  8. +# already set. If TMPDIR is set previously, then we will
  9. +# assume it is adequately protected.
  10. if (! $?METAMAIL_TMPDIR) then
  11. - set METAMAIL_TMPDIR=/tmp
  12. + if ($?TMPDIR) then
  13. + set METAMAIL_TMPDIR="$TMPDIR"
  14. + else
  15. + set METAMAIL_TMPDIR=~/metamail_tmp
  16. + endif
  17. endif
  18. +# Set a sensible umask value
  19. +umask 077
  20. +
  21. +# Make sure that the temporary directory is available
  22. +if (! -d "$METAMAIL_TMPDIR") then
  23. +
  24. + if (! -e "$METAMAIL_TMPDIR") then
  25. + mkdir "$METAMAIL_TMPDIR"
  26. + else
  27. + echo "$METAMAIL_TMPDIR exists, but is not a directory"
  28. + exit 2
  29. + endif
  30. +
  31. + if ( $status != 0 || ! -d "$METAMAIL_TMPDIR" ) then
  32. + echo "Error creating $METAMAIL_TMPDIR"
  33. + exit 2
  34. + endif
  35. +
  36. +endif
  37. +
  38. if (! $?X_VIEWER) then
  39. -set X_VIEWER="xloadimage -view -quiet -geometry +1+1"
  40. + set X_VIEWER="xloadimage -view -quiet -geometry +1+1"
  41. # set X_VIEWER="xv -geometry +1+1"
  42. endif
  43. -if ($1 == "-viewer" && $#argv > 1) then
  44. +if ("$1" == "-viewer" && $#argv > 1) then
  45. set X_VIEWER = "$2"
  46. shift
  47. shift
  48. @@ -57,7 +84,7 @@ if (! $?DISPLAY) then
  49. endif
  50. end
  51. endif
  52. - cp $1 $fname
  53. + cp "$1" $fname
  54. if ($status == 0) echo Wrote file $fname
  55. exit 0
  56. endif