1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
#!/bin/csh -f
# Try cassette.sh instead if you do not have /bin/csh.
set done = 0
set control_file = '.cassette.ctl'
set default_format = '1'
set format_name = ( 'cas' 'cpt' 'wav' 'direct' 'debug' )
if(! -e $control_file) then
echo "Creating" $control_file
echo "cassette.$format_name[$default_format] 0 $default_format" \
> $control_file
endif
while($done != 1)
set control = `cat $control_file`
set filename = $control[1]
set position = $control[2]
if (${#control} < 3) then
set format = $default_format
else
set format = $control[3]
endif
if ({ test -e $filename }) then
set isnew = ""
else
set isnew = " (new)"
endif
echo ""
echo "Tape loaded: " $filename$isnew
echo "Type: " $format_name[$format]
echo "Position: " $position
echo ""
echo -n "Command: "
set command = "$<"
set command = ( $command )
if($#command < 1) then
set command = "help"
endif
switch($command[1])
case "pos":
breaksw
case "load":
case "file":
if($#command != 2) then
echo "Must specify a file name"
else
switch($command[2])
case *.cas:
case *.bin:
set format = 1
breaksw
case *.cpt:
set format = 2
breaksw
case *.wav:
set format = 3
breaksw
case "/dev/dsp*":
set format = 4
breaksw
case *.debug:
set format = 5
breaksw
default:
set format = $default_format
breaksw
endsw
echo $command[2] 0 $format > $control_file
endif
breaksw
case "type":
if($#command != 2) then
echo "Types are:"
echo " " $format_name
else
switch($command[2])
case "cas":
set format = 1
breaksw
case "cpt":
set format = 2
breaksw
case "wav":
set format = 3
breaksw
case "direct":
set format = 4
set filename = "/dev/dsp"
set position = 0
breaksw
case "debug":
set format = 5
breaksw
default:
echo "Types are:"
echo " " $format_name
breaksw
endsw
echo $filename $position $format > $control_file
endif
breaksw
case "rew":
if($#command == 2) then
@ position = $command[2]
else
@ position = 0
endif
echo $filename $position $format > $control_file
breaksw
case "ff":
if($#command == 2) then
@ position = $command[2]
else
set wcout = `wc -c $filename`
@ position = $wcout[1]
endif
echo $filename $position $format > $control_file
breaksw
case "quit":
case "exit":
case "done":
set done = 1
breaksw
case "help":
default:
echo "Commands are:"
echo " pos"
echo " load filename"
echo " type {$format_name}"
echo " rew [position]"
echo " ff [position]"
echo " quit"
breaksw
endsw
end
exit 0
|