Ticket #302: pci-header-update.diff

File pci-header-update.diff, 1.7 KB (added by johndrinkwater, 19 years ago)

A fix for --traditional awk

  • pci-header.awk

     
    88#
    99# Use with http://pciids.sourceforge.net/pci.ids
    1010# run as: awk -v HEADERFILE=pcihdr.h -f pci-header.awk pci.ids
     11# Updated to run with non-posix / traditional awk
    1112
    1213BEGIN {
    1314
    (this hunk was shorter than expected)  
    2627    print "#if 0" > ofile
    2728    print "#\tPCIHDR.H: PCI Vendors, Devices, and Class Type information\n#" > ofile
    2829    print "#\tGenerated by pci-header.awk, source data from the following URI:\n#\thttp://pciids.sourceforge.net/pci.ids\n#" > ofile
    29     print "#\tHeader created on " strftime( "%A, %d %b %Y %H:%M:%S %Z", systime() ) > ofile
     30    # print "#\tHeader created on " strftime( "%A, %d %b %Y %H:%M:%S %Z", systime() ) > ofile
    3031    print "#endif" > ofile
    3132
    3233    # and we start with vendors..
     
    3638
    3739# matches vendor - starts with an id as first thing on the line
    3840# because this occurs first in the header file, we output it without worry
    39 /^[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] / {
     41/^[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F] / {
    4042
    4143    if ( vendorcount++ > 0 ) {
    4244        formatting = ",\n"
     
    7779}
    7880
    7981# match device class - store data for later
    80 /^C [[:xdigit:]][[:xdigit:]]  / {
     82/^C [0-9a-fA-F][0-9a-fA-F]  / {
    8183
    8284    class = $2
    8385    classname = substr($0, 7)
     
    8587}
    8688
    8789# match subclass, use device class data captured earlier, and output
    88 /^\t[[:xdigit:]][[:xdigit:]]  / {
     90/^\t[0-9a-fA-F][0-9a-fA-F]  / {
    8991
    9092    subclass = $1
    9193    subclassname = substr($0, 6)
     
    101103}
    102104
    103105# match programming interface
    104 /^\t\t[[:xdigit:]][[:xdigit:]]  / {
     106/^\t\t[0-9a-fA-F][0-9a-fA-F]  / {
    105107
    106108    proginterface = $1
    107109    proginterfacename = substr($0, 7)