xref: /titanic_44/usr/src/tools/scripts/copyrightchk.py (revision cdf0c1d55d9b3b6beaf994835440dfb01aef5cf0)
1*cdf0c1d5Smjnelson#! /usr/bin/python
2*cdf0c1d5Smjnelson#
3*cdf0c1d5Smjnelson# CDDL HEADER START
4*cdf0c1d5Smjnelson#
5*cdf0c1d5Smjnelson# The contents of this file are subject to the terms of the
6*cdf0c1d5Smjnelson# Common Development and Distribution License (the "License").
7*cdf0c1d5Smjnelson# You may not use this file except in compliance with the License.
8*cdf0c1d5Smjnelson#
9*cdf0c1d5Smjnelson# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*cdf0c1d5Smjnelson# or http://www.opensolaris.org/os/licensing.
11*cdf0c1d5Smjnelson# See the License for the specific language governing permissions
12*cdf0c1d5Smjnelson# and limitations under the License.
13*cdf0c1d5Smjnelson#
14*cdf0c1d5Smjnelson# When distributing Covered Code, include this CDDL HEADER in each
15*cdf0c1d5Smjnelson# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*cdf0c1d5Smjnelson# If applicable, add the following below this CDDL HEADER, with the
17*cdf0c1d5Smjnelson# fields enclosed by brackets "[]" replaced with your own identifying
18*cdf0c1d5Smjnelson# information: Portions Copyright [yyyy] [name of copyright owner]
19*cdf0c1d5Smjnelson#
20*cdf0c1d5Smjnelson# CDDL HEADER END
21*cdf0c1d5Smjnelson#
22*cdf0c1d5Smjnelson
23*cdf0c1d5Smjnelson#
24*cdf0c1d5Smjnelson# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
25*cdf0c1d5Smjnelson# Use is subject to license terms.
26*cdf0c1d5Smjnelson#
27*cdf0c1d5Smjnelson# ident	"%Z%%M%	%I%	%E% SMI"
28*cdf0c1d5Smjnelson#
29*cdf0c1d5Smjnelson
30*cdf0c1d5Smjnelson#
31*cdf0c1d5Smjnelson# Check for valid SMI copyright notices in source files.
32*cdf0c1d5Smjnelson#
33*cdf0c1d5Smjnelson
34*cdf0c1d5Smjnelsonimport sys, os
35*cdf0c1d5Smjnelson
36*cdf0c1d5Smjnelsonsys.path.append(os.path.join(os.path.dirname(__file__), '../lib/python'))
37*cdf0c1d5Smjnelsonsys.path.append(os.path.join(os.path.dirname(__file__), '..'))
38*cdf0c1d5Smjnelson
39*cdf0c1d5Smjnelsonfrom onbld.Checks.Copyright import copyright
40*cdf0c1d5Smjnelson
41*cdf0c1d5Smjnelsonret = 0
42*cdf0c1d5Smjnelsonfor filename in sys.argv[1:]:
43*cdf0c1d5Smjnelson	try:
44*cdf0c1d5Smjnelson		fin = open(filename, 'r')
45*cdf0c1d5Smjnelson	except IOError, e:
46*cdf0c1d5Smjnelson		sys.stderr.write("failed to open '%s': %s\n" %
47*cdf0c1d5Smjnelson				 (e.filename, e.strerror))
48*cdf0c1d5Smjnelson		continue
49*cdf0c1d5Smjnelson
50*cdf0c1d5Smjnelson	ret |= copyright(fin, output=sys.stdout)
51*cdf0c1d5Smjnelson	fin.close()
52*cdf0c1d5Smjnelson
53*cdf0c1d5Smjnelsonsys.exit(ret)
54