Cover V04, I01
Article
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Table 1

jan95.tar


Figure 4: C shell interrupt routine for Control-C

#!/bin/csh -f
#
set N = 30 # Wait N (1 - 59) seconds.
#
#  John Lees                        lees@cps.msu.edu
#  Pattern Recognition & Image Processing Laboratory
#  M i c h i g a n   S t a t e   U n i v e r s i t y
#
# Interrupt routine for Control-C.

# Set a trap on Control-C.
onintr impatient

# Sleep for N seconds.
set start = `date +%S`
sleep $N

echo "This is seen only if you did not hit Control-C"
exit

# On Control-C, execution is transferred to this label.
# Unlike with the Bourne shell example, there is no
# return to the previous point of execution.
impatient:
set now = `date +%S`
# Figure it both ways and use the correct one.
set a = "[ $N $now $start - 60 + - ] sa"
set b = " $N $now $start - - d $N <a p"
set togo = `echo "$a $b" | /usr/bin/dc`
echo "\nPatience! Still $togo seconds to go...."
sleep $togo