Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2005/0922/15

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Add PCI database from web, accessed with pci -v.
 [rsc] --rw-rw-r-- M 191333 rsc sys 193035 Sep 22 10:09 lib/pci
 [rsc] --rwxrwxr-x M 191333 glenda sys 752 Sep 22 10:53 rc/bin/pci
	/n/sourcesdump/2005/0922/plan9/rc/bin/pci:1,3 - 
	/n/sourcesdump/2005/0923/plan9/rc/bin/pci:1,56
	  #!/bin/rc
	  
	- cd '#$/pci' && grep . *ctl | sed 's/ctl:/:	/'
	+ fn verbose { awk '
	+ 
	+ 	function lower(s) {
	+ 		gsub(/A/, "a", s)
	+ 		gsub(/B/, "b", s)
	+ 		gsub(/C/, "c", s)
	+ 		gsub(/D/, "d", s)
	+ 		gsub(/E/, "e", s)
	+ 		gsub(/F/, "f", s)
	+ 		return s
	+ 	}
	+ 	BEGIN{
	+ 		file="/lib/pci"
	+ 		FS="\t"
	+ 		while(getline <file){
	+ 			if(/^;/) continue
	+ 			if(/^[0-9A-F]/){
	+ 				vid=lower($1)
	+ 				vendor[vid] = $2
	+ 			}
	+ 			if(/^	[0-9]/){
	+ 				did=lower($2)
	+ 				id[vid "/" did] = $3
	+ 			}
	+ 		}
	+ 		FS = " "
	+ 	}
	+ 
	+ 	{
	+ 		print $0
	+ 		vid = $4
	+ 		sub(/\/.*/, "", vid)
	+ 		if(vid in vendor){
	+ 			s = vendor[vid]
	+ 			if($4 in id)
	+ 				s = s " " id[$4]
	+ 			print "\t" s
	+ 		}
	+ 	}
	+ '
	+ }
	+ 
	+ filter=cat
	+ if(~ $1 -v){
	+ 	filter=verbose
	+ }
	+ cd '#$/pci' && grep . *ctl | sed '
	+ 	s/ctl:/:	/
	+ 	s/:	01/:	disk 01/
	+ 	s/:	02/:	net  02/
	+ 	s/:	03/:	vid  03/
	+ 	s/:	([0-9])/:	---  \1/
	+ ' | $filter
	+ 
 [rsc] --rw-rw-r-- M 191333 rsc sys 193035 Sep 22 10:09 lib/pci
 [rsc] --rwxrwxr-x M 191333 glenda sys 752 Sep 22 10:53 rc/bin/pci


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].