# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#-
# $NetBSD: usb/devlist2h.awk,v 1.9 2001/01/18 20:28:22 jdolecek Exp $
# $FreeBSD: src/sys/tools/usbdevs2h.awk,v 1.7 2005/01/07 02:29:25 imp Exp $
#
# Copyright (c) 1995, 1996 Christopher G. Demetriou
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Christopher G. Demetriou.
# 4. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
{
exit 1;
}
{
> file
}
{
}
{
}
{
nvendors++
vendorindex[$2] = nvendors; # record index for this name, for later.
if (hfile)
i = 3; f = 4;
# comments
if (hfile)
ocomment = 1;
}
if ($f == "#") {
if (hfile)
oparen = 1
f++
continue
}
if (hfile)
f++
continue
}
if (hfile)
i++; f++;
}
if (hfile)
}
{
if (hfile)
i=4; f = 5;
# comments
if (hfile)
ocomment = 1;
}
if ($f == "#") {
if (hfile)
oparen = 1
f++
continue
}
if (hfile)
f++
continue
}
if (hfile)
i++; f++;
}
if (hfile)
}
{
vendi = vendorindex[products[i, 1]];
j = 3;
needspace = 0;
if (needspace)
needspace = 1
j++
}
j = 4;
needspace = 0;
if (needspace)
needspace = 1
j++
}
}
j = 3;
needspace = 0;
if (needspace)
needspace = 1
j++
}
}
}
BEGIN {
# Process the command line
if (arg ~ /^-.*d/)
if (arg ~ /^-.*D/)
if (arg ~ /^-.*h/)
if (arg ~ /^-.*H/)
}
ARGC = 1;
line=0;
line++;
VERSION = $0
if (dfile)
}
continue;
}
if ($1 == "vendor") {
continue
}
if ($1 == "product") {
continue
}
if ($0 == "")
if (hfile)
print $0 > hfile
if (blanklines < 2 && dfile)
print $0 > dfile
}
# close off the header guard
if (hfile)
# print out the match tables
if (dfile)
}