add a config file git-buildpackage
[debian/dds2tar] / scsi_vendor
1 #!/bin/csh
2
3 # Determine the Verndor of a device
4 #
5 # csh-Example:
6 #
7 #       <1>scsi_vendor
8 #       Disks: SEAGATE SAMSUNG
9 #       Cdroms: TOSHIBA PHILIPS
10 #       Tapes: HP
11 #       <2>scsi_vendor disk
12 #       SEAGATE SAMSUNG
13 #       <383>scsi_vendor cd
14 #       TOSHIBA PHILIPS
15 #       <3>scsi_vendor tape 
16 #       HP
17 #       <4>scsi_vendor tape 1
18 #       HP
19 #       <5>scsi_vendor dsik 1
20 #       <6>scsi_vendor disk 1
21 #       SEAGATE
22 #       <7>scsi_vendor disk 2
23 #       SAMSUNG
24 #
25 set s = ( ) ;
26 set c = ( ) ;
27 set d = ( ) ;
28 set x = ( `grep '^ ' /proc/scsi/scsi | cut -c3-18` )
29 set o = '' ;
30 set v = '' ;
31 foreach i ( $x )
32         if ( "$o" == 'Vendor:' ) set v = $i ;
33         if ( "$o" == 'Type:' && "$i" == 'Sequenti' ) set s = ( $s $v );
34         if ( "$o" == 'Type:' && "$i" == 'CD-ROM' ) set c = ( $c $v );
35         if ( "$o" == 'Type:' && "$i" == 'Direct-A' ) set d = ( $d $v );
36         set o = $i ;
37 end
38 if ( $# == 0 ) then
39         echo Disks: $d
40         echo Cdroms: $c
41         echo Tapes: $s
42         exit 0 ;
43 endif
44 if ( $# == 1 ) then
45         set v = '' ;
46         if ( $1 == disk ) then
47                 echo $d
48         endif
49         if ( $1 == cd ) then
50                 echo $c
51         endif
52         if ( $1 == tape ) then
53                 echo $s
54         endif
55         exit 0 ;
56 endif
57 if ( $# == 2 ) then
58         set v = '' ;
59         if ( $1 == disk && $#d >= $2 ) then
60                 set v = $d[$2] ;
61         endif
62         if ( $1 == cd && $#c >= $2 ) then
63                 set v = $c[$2] ;
64         endif
65         if ( $1 == tape && $#s >= $2 ) then
66                 set v = $s[$2] ;
67         endif
68         echo $v
69         exit 0 ;
70 endif
71 if ( "$v" == "$3" ) then
72         exit 2 ;
73 endif
74 exit 1 ;
75