summaryrefslogtreecommitdiff
path: root/sys/dev/tc/devlist2h.awk
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-03-13 22:00:32 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-03-13 22:00:32 +0000
commit0a1d6a806d8a00a85843f0d6a56ff70f06e3e708 (patch)
tree48adc9d630c43e7ac6ca421c817d3f2e7234b162 /sys/dev/tc/devlist2h.awk
parent030cf20c38b6252d683b95e95e69ce1315f013b0 (diff)
Conforming to the party's line, report unconfigured devices as
"TC identifier" (description) at tc0 ... unconfigured instead of drivername (description) at tc0 ... unconfigured Plus this allows us to shrinken the description structure and get rid of a generated file. Only affects TCVERBOSE kernels.
Diffstat (limited to 'sys/dev/tc/devlist2h.awk')
-rw-r--r--sys/dev/tc/devlist2h.awk79
1 files changed, 9 insertions, 70 deletions
diff --git a/sys/dev/tc/devlist2h.awk b/sys/dev/tc/devlist2h.awk
index 6cbcb71bbee..3378113515d 100644
--- a/sys/dev/tc/devlist2h.awk
+++ b/sys/dev/tc/devlist2h.awk
@@ -1,5 +1,5 @@
#! /usr/bin/awk -f
-# $OpenBSD: devlist2h.awk,v 1.5 2002/05/03 20:27:44 miod Exp $
+# $OpenBSD: devlist2h.awk,v 1.6 2006/03/13 22:00:31 miod Exp $
# $NetBSD: devlist2h.awk,v 1.3 1996/06/05 18:32:19 cgd Exp $
#
# Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -31,9 +31,7 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
BEGIN {
- nproducts = 0
dfile="tcdevs_data.h"
- hfile="tcdevs.h"
}
NR == 1 {
VERSION = $0
@@ -48,79 +46,22 @@ NR == 1 {
printf(" *\t%s\n", VERSION) > dfile
printf(" */\n") > dfile
- printf("/*\t\$OpenBSD\$\t*/\n\n") > hfile
- printf("/*\n") > hfile
- printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
- > hfile
- printf(" *\n") > hfile
- printf(" * generated from:\n") > hfile
- printf(" *\t%s\n", VERSION) > hfile
- printf(" */\n") > hfile
-
next
}
$1 == "device" {
ndevices++
- devices[ndevices, 0] = $2; # devices id
- devices[ndevices, 1] = $2; # C identifier for device
- gsub("-", "_", devices[ndevices, 1]);
-
- printf("\n") > hfile
- if ($3 == "???") { # driver name
- printf("#define\tTC_DEVICE_%s\tNULL\n",
- devices[ndevices, 1]) > hfile
- } else {
- printf("#define\tTC_DEVICE_%s\t\"%s\"\n",
- devices[ndevices, 1], $3) > hfile
- }
-
- printf("#define\tTC_DESCRIPTION_%s\t\"", devices[ndevices, 1]) > hfile
+ devices[ndevices] = $2; # devices id
+ description[ndevices] = $4
- f = 4;
- i = 3;
-
- # comments
- ocomment = oparen = 0
- if (f <= NF) {
- ocomment = 1;
- }
+ f = 5;
while (f <= NF) {
- if ($f == "#") {
- printf("(") > hfile
- oparen = 1
- f++
- continue
- }
- if (oparen) {
- printf("%s", $f) > hfile
- if (f < NF)
- printf(" ") > hfile
- f++
- continue
- }
- devices[ndevices, i] = $f
- printf("%s", devices[ndevices, i]) > hfile
- if (f < NF)
- printf(" ") > hfile
- i++; f++;
+ description[ndevices] = sprintf("%s %s", description[ndevices], $f)
+ f++;
}
- if (oparen)
- printf(")") > hfile
- if (ocomment)
- printf("\"") > hfile
- printf("\n") > hfile
next
}
-{
- if ($0 == "")
- blanklines++
- if (blanklines < 2)
- print $0 > hfile
- if (blanklines < 2)
- print $0 > dfile
-}
END {
# print out the match tables
@@ -129,15 +70,13 @@ END {
printf("struct tc_knowndev tc_knowndevs[] = {\n") > dfile
for (i = 1; i <= ndevices; i++) {
printf("\t{\n") > dfile
- printf("\t \"%-8s\",\n", devices[i, 0]) \
- > dfile
- printf("\t TC_DEVICE_%s,\n", devices[i, 1]) \
+ printf("\t \"%-8s\",\n", devices[i]) \
> dfile
- printf("\t TC_DESCRIPTION_%s,\n", devices[i, 1]) \
+ printf("\t \"%s\"\n", description[i]) \
> dfile
printf("\t},\n") > dfile
}
- printf("\t{ NULL, NULL, NULL, }\n") > dfile
+ printf("\t{ NULL, NULL }\n") > dfile
printf("};\n") > dfile
}