#!/bin/ksh -p

AWK=`whence gawk 2>/dev/null`
if [[ -z $AWK ]] ; then
	AWK=/usr/bin/nawk
fi


/usr/sbin/prtconf -pv | $AWK '

BEGIN {
	print " prtconf.ksh, from http://www.bolthole.com/solaris/HCL/";
	}

$1 == "Node"	{
			if(deviceid != ""){
				print "";
				printf("VendorID=0x%s, DeviceID=0x%s\n", vendorid, deviceid);
				if(subvendorid){
					printf("Sub VendorID=0x%s, Sub DeviceID=0x%s\n",
						 subvendorid, subdeviceid);
				}
				if(model){
					print model;
				}
				if(name){
					print name;
				}
				if(string){
					print string;
				}
			}
			vendorid=""; deviceid="";
			subvendorid=""; subdeviceid="";
			model=""; name="";
			string="";
		}

$1 ~ /string:$/	{ string=$0; }
$1 == "model:"	{ model=$0; }
$1 == "name:"	{ name=$0; }
$1 == "device-id:" { deviceid=$2; gsub(/^0000/,"",deviceid);}
$1 == "vendor-id:" { vendorid=$2; gsub(/^0000/,"",vendorid);}
$1 == "subsystem-id:" { subdeviceid=$2; gsub(/^0000/,"",subdeviceid);}
$1 == "subsystem-vendor-id:" { subvendorid=$2; gsub(/^0000/,"",subvendorid);}
'
