diff options
| author | jmc <jmc@NetBSD.org> | 2003-12-15 07:32:20 +0000 |
|---|---|---|
| committer | jmc <jmc@NetBSD.org> | 2003-12-15 07:32:20 +0000 |
| commit | 43bf89bfc649acef57475def27b6ac3d55e6d60e (patch) | |
| tree | 6a2ca1258f87c63d7124c3b27e00cd156d37b103 /sys/dev/usb/devlist2h.awk | |
| parent | 9efe6a53664913e02f852106edda3b481b0d0203 (diff) | |
Fixes from PR#23177. Various lint/logic fixes:
Fix some non-initialized variables
close the output files when done
Redo the printing for RCS strings so they don't expand in the awk script too
Do proper tests for variables existance before accessing
Verified output from all scripts is identical to original versions
Diffstat (limited to 'sys/dev/usb/devlist2h.awk')
| -rw-r--r-- | sys/dev/usb/devlist2h.awk | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sys/dev/usb/devlist2h.awk b/sys/dev/usb/devlist2h.awk index 8a247ebf74d..b6376a25176 100644 --- a/sys/dev/usb/devlist2h.awk +++ b/sys/dev/usb/devlist2h.awk @@ -1,5 +1,5 @@ #! /usr/bin/awk -f -# $NetBSD: devlist2h.awk,v 1.10 2003/10/28 10:35:12 augustss Exp $ +# $NetBSD: devlist2h.awk,v 1.11 2003/12/15 07:32:21 jmc Exp $ # # Copyright (c) 1995, 1996 Christopher G. Demetriou # All rights reserved. @@ -30,7 +30,7 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # BEGIN { - nproducts = nvendors = 0 + nproducts = nvendors = blanklines = 0 dfile="usbdevs_data.h" hfile="usbdevs.h" } @@ -39,11 +39,11 @@ NR == 1 { gsub("\\$", "", VERSION) if (os == "NetBSD") - printf("/*\t$NetBSD: devlist2h.awk,v 1.10 2003/10/28 10:35:12 augustss Exp $\t*/\n\n") > dfile + printf("/*\t$NetBSD" "$\t*/\n\n") > dfile else if (os == "FreeBSD") - printf("/*\t$FreeBSD$\t*/\n\n") > dfile + printf("/*\t$FreeBSD" "$\t*/\n\n") > dfile else if (os == "OpenBSD") - printf("/*\t$OpenBSD$\t*/\n\n") > dfile + printf("/*\t$OpenBSD" "$\t*/\n\n") > dfile else printf("/* ??? */\n\n") > dfile printf("/*\n") > dfile @@ -55,11 +55,11 @@ NR == 1 { printf(" */\n") > dfile if (os == "NetBSD") - printf("/*\t$NetBSD: devlist2h.awk,v 1.10 2003/10/28 10:35:12 augustss Exp $\t*/\n\n") > hfile + printf("/*\t$NetBSD" "$\t*/\n\n") > hfile else if (os == "FreeBSD") - printf("/*\t$FreeBSD$\t*/\n\n") > hfile + printf("/*\t$FreeBSD" "$\t*/\n\n") > hfile else if (os == "OpenBSD") - printf("/*\t$OpenBSD$\t*/\n\n") > hfile + printf("/*\t$OpenBSD" "$\t*/\n\n") > hfile else printf("/* ??? */\n\n") > hfile printf("/*\n") > hfile @@ -72,7 +72,7 @@ NR == 1 { next } -$1 == "vendor" { +NF > 0 && $1 == "vendor" { nvendors++ vendorindex[$2] = nvendors; # record index for this name, for later. @@ -117,7 +117,7 @@ $1 == "vendor" { next } -$1 == "product" { +NF > 0 && $1 == "product" { nproducts++ products[nproducts, 1] = $2; # vendor name @@ -188,7 +188,7 @@ END { printf("\t \"") > dfile j = 3; needspace = 0; - while (vendors[vendi, j] != "") { + while ((vendi, j) in vendors) { if (needspace) printf(" ") > dfile printf("%s", vendors[vendi, j]) > dfile @@ -200,7 +200,7 @@ END { printf("\t \"") > dfile j = 4; needspace = 0; - while (products[i, j] != "") { + while ((i, j) in products) { if (needspace) printf(" ") > dfile printf("%s", products[i, j]) > dfile @@ -219,7 +219,7 @@ END { printf("\t \"") > dfile j = 3; needspace = 0; - while (vendors[i, j] != "") { + while ((i, j) in vendors) { if (needspace) printf(" ") > dfile printf("%s", vendors[i, j]) > dfile @@ -232,4 +232,6 @@ END { } printf("\t{ 0, 0, 0, NULL, NULL, }\n") > dfile printf("};\n") > dfile + close(dfile) + close(hfile) } |
