Commit | Line | Data |
---|---|---|
6630b441 KL |
1 | #! /bin/csh -f |
2 | # | |
e4a5fa9a | 3 | # SCCS id: @(#)difftc.sh 1.3 (Berkeley) %G% |
6630b441 KL |
4 | # |
5 | # diff termcap files | |
977b5828 | 6 | set n=1 files=() term=() |
6630b441 KL |
7 | |
8 | while ($n <= $#argv) | |
977b5828 | 9 | if ("$argv[$n]" == "-f") then |
6630b441 | 10 | @ n++ |
6630b441 KL |
11 | if ($argv[$n] !~ /*) then |
12 | set files=($files $cwd/$argv[$n]) | |
13 | else | |
14 | set files=($files $argv[$n]) | |
15 | endif | |
977b5828 KL |
16 | else |
17 | set term=($term $argv[$n]) | |
6630b441 KL |
18 | endif |
19 | @ n++ | |
20 | end | |
977b5828 | 21 | |
6630b441 | 22 | switch ($#files) |
977b5828 | 23 | case 0: |
e4a5fa9a KL |
24 | set files=(/etc/termcap) |
25 | case 1: | |
977b5828 | 26 | if ($#term != 2) then |
e4a5fa9a | 27 | echo need two entries to diff |
6630b441 | 28 | exit 1 |
977b5828 KL |
29 | endif |
30 | breaksw | |
977b5828 | 31 | case 2: |
977b5828 KL |
32 | breaksw |
33 | default: | |
34 | echo too many termcap files | |
35 | exit 1 | |
6630b441 KL |
36 | endsw |
37 | ||
38 | onintr cleanup | |
977b5828 | 39 | |
e4a5fa9a KL |
40 | if ($#files == 1) then |
41 | /usr/local/showtc -s -f $files $term[1] > /tmp/tcd$$.old | |
42 | /usr/local/showtc -s -f $files $term[2] | diff /tmp/tcd$$.old - | |
977b5828 KL |
43 | else |
44 | /usr/local/showtc -f $files[1] $term > /tmp/tcd$$.old | |
45 | /usr/local/showtc -f $files[2] $term | diff /tmp/tcd$$.old - | |
46 | endif | |
6630b441 KL |
47 | |
48 | cleanup: | |
49 | rm -f /tmp/tcd$$.old |