patch-src_bin_showaudio 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. $OpenBSD: patch-src_bin_showaudio,v 1.1 2012/03/17 10:57:23 sthen Exp $
  2. --- src/bin/showaudio.orig Wed Feb 2 23:21:26 1994
  3. +++ src/bin/showaudio Sat Mar 17 10:51:52 2012
  4. @@ -15,11 +15,37 @@
  5. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  6. #
  7. -
  8. +# Set a sensible value for the temporary directory, if its not
  9. +# already set. If TMPDIR is set previously, then we will
  10. +# assume it is adequately protected.
  11. if (! $?METAMAIL_TMPDIR) then
  12. - set METAMAIL_TMPDIR=/tmp
  13. + if ($?TMPDIR) then
  14. + set METAMAIL_TMPDIR="$TMPDIR"
  15. + else
  16. + set METAMAIL_TMPDIR=~/metamail_tmp
  17. + endif
  18. endif
  19. +# Set a sensible umask value
  20. +umask 077
  21. +
  22. +# Make sure that the temporary directory is available
  23. +if (! -d "$METAMAIL_TMPDIR") then
  24. +
  25. + if (! -e "$METAMAIL_TMPDIR") then
  26. + mkdir "$METAMAIL_TMPDIR"
  27. + else
  28. + echo "$METAMAIL_TMPDIR exists, but is not a directory"
  29. + exit 2
  30. + endif
  31. +
  32. + if ( $status != 0 || ! -d "$METAMAIL_TMPDIR" ) then
  33. + echo "Error creating $METAMAIL_TMPDIR"
  34. + exit 2
  35. + endif
  36. +
  37. +endif
  38. +
  39. # First, figure out which machine to play it on!
  40. set thishost=`hostname`
  41. @@ -33,7 +59,7 @@ set AUDIOLOGMAIL=andrew@thumper.bellcore.com
  42. set ORG="Bellcore"
  43. set STDINPUT=0
  44. if ("$1" == "-p") then
  45. - set AUDIOPHONE=$2
  46. + set AUDIOPHONE="$2"
  47. shift
  48. shift
  49. endif
  50. @@ -173,7 +199,7 @@ if (-d $AUDIOBINDIR) then
  51. set AUDIOPHONE=$<
  52. endif
  53. if ($thishost == $AUDIOPHONEHOST || $thishost == $AUDIOPHONEHOSTLONG) then
  54. - echo Calling Phone number $AUDIOPHONE
  55. + echo Calling Phone number "$AUDIOPHONE"
  56. echo "You MUST SAY HELLO when you answer the phone, or you will not hear the message."
  57. mail -s "showaudio: `whoami` called $AUDIOPHONE" $AUDIOLOGMAIL < /dev/null
  58. if ($STDINPUT) then
  59. @@ -206,7 +232,7 @@ else
  60. echo -n "File name:"
  61. set fname=$<
  62. endif
  63. -cp $1 $fname
  64. +cp "$1" $fname
  65. if ($status == 0) echo Wrote raw audio file: $fname
  66. exit 0