xref: /titanic_51/usr/src/tools/scripts/checkproto.sh (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1#!/bin/ksh -e
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27#ident	"%Z%%M%	%I%	%E% SMI"
28#
29MACH=`uname -p`
30PLIST=/tmp/protolist.$$
31
32usage() {
33	echo "usage: $0 <workspace>"
34	exit 1
35}
36
37OPTIND=1
38while getopts X flag
39do
40	case $flag in
41	*)	usage
42		;;
43	esac
44done
45
46shift `expr $OPTIND - 1`
47
48if [ $# = 0 -a "${CODEMGR_WS}" != "" ]; then
49	WS=${CODEMGR_WS}
50elif [ $# -ne 1 ]; then
51	usage
52else
53	WS=$1
54fi
55
56
57GUFLAG="-gu"
58if [ "${NIGHTLY_OPTIONS%o*}" != "$NIGHTLY_OPTIONS" ]; then
59	GUFLAG=
60fi
61
62if [ ! -d ${WS} ]; then
63	echo "${WS} is not a workspace"
64	exit 1
65fi
66
67if [ -z "${SRC}" ]; then
68	SRC=${WS}/usr/src
69fi
70
71PROTO=${WS}/proto/root_${MACH}
72
73rm -f $PLIST
74
75PKGDEFS=${SRC}/pkgdefs
76EXCEPTION=${PKGDEFS}/etc/exception_list_${MACH}
77
78protolist ${PROTO} > $PLIST
79protocmp ${GUFLAG} -e ${EXCEPTION} -d ${PKGDEFS} ${PLIST}
80
81rm -f $PLIST
82