xref: /titanic_50/usr/src/tools/scripts/checkproto.sh (revision 004388ebfdfe2ed7dfd2d153a876dfcc22d2c006)
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_FLG="-d ${SRC}/pkgdefs"
76[ -d ${SRC}/../closed ] && \
77	PKGDEFS_FLG="$PKGDEFS_FLG -d ${SRC}/../closed/pkgdefs"
78EXCEPTION=${PKGDEFS}/etc/exception_list_${MACH}
79
80protolist ${PROTO} > $PLIST
81protocmp ${GUFLAG} -e ${EXCEPTION} ${PKGDEFS_FLG} ${PLIST}
82
83rm -f $PLIST
84