Deleted Added
full compact
usbdevs2h.awk (139513) usbdevs2h.awk (139518)
1#! /usr/bin/awk -f
2# $NetBSD: usb/devlist2h.awk,v 1.9 2001/01/18 20:28:22 jdolecek Exp $
1#! /usr/bin/awk -f
2# $NetBSD: usb/devlist2h.awk,v 1.9 2001/01/18 20:28:22 jdolecek Exp $
3# $FreeBSD: head/sys/tools/usbdevs2h.awk 139513 2004-12-31 21:02:43Z imp $
3# $FreeBSD: head/sys/tools/usbdevs2h.awk 139518 2004-12-31 21:12:17Z imp $
4#
5# Copyright (c) 1995, 1996 Christopher G. Demetriou
6# All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions
10# are met:
11# 1. Redistributions of source code must retain the above copyright

--- 20 unchanged lines hidden (view full) ---

32#
33
34function usage()
35{
36 print "usage: usbdevs2h.awk <srcfile> [-d|-h]";
37 exit 1;
38}
39
4#
5# Copyright (c) 1995, 1996 Christopher G. Demetriou
6# All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions
10# are met:
11# 1. Redistributions of source code must retain the above copyright

--- 20 unchanged lines hidden (view full) ---

32#
33
34function usage()
35{
36 print "usage: usbdevs2h.awk <srcfile> [-d|-h]";
37 exit 1;
38}
39
40function dheader(dfile)
40function header(file)
41{
42 if (os == "NetBSD")
41{
42 if (os == "NetBSD")
43 printf("/*\t\$NetBSD\$\t*/\n\n") > dfile
43 printf("/*\t\$NetBSD\$\t*/\n\n") > file
44 else if (os == "FreeBSD")
44 else if (os == "FreeBSD")
45 printf("/* \$FreeBSD\$ */\n\n") > dfile
45 printf("/* \$FreeBSD\$ */\n\n") > file
46 else if (os == "OpenBSD")
46 else if (os == "OpenBSD")
47 printf("/*\t\$OpenBSD\$\t*/\n\n") > dfile
47 printf("/*\t\$OpenBSD\$\t*/\n\n") > file
48 else
48 else
49 printf("/* ??? */\n\n") > dfile
50 printf("/*\n") > dfile
49 printf("/* ??? */\n\n") > file
50 printf("/*\n") > file
51 printf(" * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
51 printf(" * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
52 > dfile
53 printf(" *\n") > dfile
54 printf(" * generated from:\n") > dfile
55 printf(" *\t%s\n", VERSION) > dfile
56 printf(" */\n") > dfile
52 > file
53 printf(" *\n") > file
54 printf(" * generated from:\n") > file
55 printf(" *\t%s\n", VERSION) > file
56 printf(" */\n") > file
57}
58
57}
58
59function hheader(hfile)
60{
61 if (os == "NetBSD")
62 printf("/*\t\$NetBSD\$\t*/\n\n") > hfile
63 else if (os == "FreeBSD")
64 printf("/* \$FreeBSD\$ */\n\n") > hfile
65 else if (os == "OpenBSD")
66 printf("/*\t\$OpenBSD\$\t*/\n\n") > hfile
67 else
68 printf("/* ??? */\n\n") > hfile
69 printf("/*\n") > hfile
70 printf(" * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
71 > hfile
72 printf(" *\n") > hfile
73 printf(" * generated from:\n") > hfile
74 printf(" *\t%s\n", VERSION) > hfile
75 printf(" */\n") > hfile
76}
77
78
79function vendor(hfile)
80{
81 nvendors++
82
83 vendorindex[$2] = nvendors; # record index for this name, for later.
84 vendors[nvendors, 1] = $2; # name
85 vendors[nvendors, 2] = $3; # id
86 if (hfile)

--- 169 unchanged lines hidden (view full) ---

256ARGC = 1;
257line=0;
258
259while ((getline < srcfile) > 0) {
260 line++;
261 if (line == 1) {
262 VERSION = $0
263 gsub("\\$", "", VERSION)
59function vendor(hfile)
60{
61 nvendors++
62
63 vendorindex[$2] = nvendors; # record index for this name, for later.
64 vendors[nvendors, 1] = $2; # name
65 vendors[nvendors, 2] = $3; # id
66 if (hfile)

--- 169 unchanged lines hidden (view full) ---

236ARGC = 1;
237line=0;
238
239while ((getline < srcfile) > 0) {
240 line++;
241 if (line == 1) {
242 VERSION = $0
243 gsub("\\$", "", VERSION)
264
265 if (dfile)
244 if (dfile)
266 dheader(dfile)
267
245 header(dfile)
268 if (hfile)
246 if (hfile)
269 hheader(hfile)
247 header(hfile)
270 continue;
271 }
272 if ($1 == "vendor") {
273 vendor(hfile)
274 continue
275 }
276 if ($1 == "product") {
277 product(hfile)

--- 15 unchanged lines hidden ---
248 continue;
249 }
250 if ($1 == "vendor") {
251 vendor(hfile)
252 continue
253 }
254 if ($1 == "product") {
255 product(hfile)

--- 15 unchanged lines hidden ---