diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-06-03 09:06:00 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-06-03 09:06:00 +0000 |
commit | 785e2f4cfd03c4154e390715dbd30fac1a5f178f (patch) | |
tree | e5bfd3fed8285f6383aa0b2d6ce2a9f420d9d5c0 /usr.sbin | |
parent | 63612f96488a933dee5f097e3a47a0f66dee4cb6 (diff) |
mktemp(1) fixes; jason@ackley.net
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ssio/ricoh_fs1_grabscan.sh | 10 | ||||
-rw-r--r-- | usr.sbin/ssio/umax_uc630_grabscan.sh | 24 |
2 files changed, 24 insertions, 10 deletions
diff --git a/usr.sbin/ssio/ricoh_fs1_grabscan.sh b/usr.sbin/ssio/ricoh_fs1_grabscan.sh index b590cb1a484..6c75b35bf20 100644 --- a/usr.sbin/ssio/ricoh_fs1_grabscan.sh +++ b/usr.sbin/ssio/ricoh_fs1_grabscan.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: ricoh_fs1_grabscan.sh,v 1.1 1997/03/11 03:23:15 kstailey Exp $ +# $Id: ricoh_fs1_grabscan.sh,v 1.2 2002/06/03 09:05:59 deraadt Exp $ # # Copyright (c) 1996 Kenneth Stailey # All rights reserved. @@ -56,8 +56,10 @@ set `get_scanner -p -l $scan_lname` width=$1 height=$2 -dd if=/dev/$scan_lname of=/tmp/fs1_grabscan.$$ bs=256k +tempfile=`mktemp -t fs1_grabscan.XXXXXXXXXX` || exit 1 -fs1toppm $width $height /tmp/fs1_grabscan.$$ +dd if=/dev/$scan_lname of=$tempfile bs=256k -rm /tmp/fs1_grabscan.$$ +fs1toppm $width $height $tempfile + +rm $tempfile diff --git a/usr.sbin/ssio/umax_uc630_grabscan.sh b/usr.sbin/ssio/umax_uc630_grabscan.sh index a3d99a16dd6..a435343e0cb 100644 --- a/usr.sbin/ssio/umax_uc630_grabscan.sh +++ b/usr.sbin/ssio/umax_uc630_grabscan.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: umax_uc630_grabscan.sh,v 1.1 1997/03/11 03:23:18 kstailey Exp $ +# $Id: umax_uc630_grabscan.sh,v 1.2 2002/06/03 09:05:59 deraadt Exp $ # # Copyright (c) 1996 Kenneth Stailey # All rights reserved. @@ -57,6 +57,18 @@ set `get_scanner -p -l $scan_lname` width=$1 height=$2 +red_tempfile=`mktemp -t grabscan.red.XXXXXXXXXX` || exit 1 +green_tempfile=`mktemp -t grabscan.green.XXXXXXXXXX` +if [ $? -ne 0 ]; then + rm -f $red_tempfile + exit 1 +fi +blue_tempfile=`mktemp -t grabscan.blue.XXXXXXXXXX` +if [ $? -ne 0 ]; then + rm -f $red_tempfile $green_tempfile + exit 1 +fi + case $image_mode in grayscale) @@ -84,7 +96,7 @@ red|green|blue) (echo P5 echo $width $height echo 255 - dd if=/dev/scan0 bs=256k) > /tmp/grabscan.$$.red + dd if=/dev/scan0 bs=256k) > $red_tempfile # green pass... echo green... >&2 @@ -92,7 +104,7 @@ red|green|blue) (echo P5 echo $width $height echo 255 - dd if=/dev/scan0 bs=256k) > /tmp/grabscan.$$.green + dd if=/dev/scan0 bs=256k) > $green_tempfile # blue pass... echo blue... >&2 @@ -100,12 +112,12 @@ red|green|blue) (echo P5 echo $width $height echo 255 - dd if=/dev/scan0 bs=256k) > /tmp/grabscan.$$.blue + dd if=/dev/scan0 bs=256k) > $blue_tempfile echo mixing colors together... >&2 - rgb3toppm /tmp/grabscan.$$.red /tmp/grabscan.$$.green /tmp/grabscan.$$.blue + rgb3toppm $red_tempfile $green_tempfile $blue_tempfile - rm /tmp/grabscan.$$.red /tmp/grabscan.$$.green /tmp/grabscan.$$.blue + rm $red_tempfile $green_tempfile $blue_tempfile # restore scanner set_scanner $save_modes >/dev/null |