xref: /titanic_44/usr/src/tools/scripts/sccscheck.sh (revision 733ed7372ce52463509c62783a184105d3f1a618)
1*733ed737Ssommerfe#! /bin/ksh -p
2*733ed737Ssommerfe#
3*733ed737Ssommerfe# CDDL HEADER START
4*733ed737Ssommerfe#
5*733ed737Ssommerfe# The contents of this file are subject to the terms of the
6*733ed737Ssommerfe# Common Development and Distribution License (the "License").
7*733ed737Ssommerfe# You may not use this file except in compliance with the License.
8*733ed737Ssommerfe#
9*733ed737Ssommerfe# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*733ed737Ssommerfe# or http://www.opensolaris.org/os/licensing.
11*733ed737Ssommerfe# See the License for the specific language governing permissions
12*733ed737Ssommerfe# and limitations under the License.
13*733ed737Ssommerfe#
14*733ed737Ssommerfe# When distributing Covered Code, include this CDDL HEADER in each
15*733ed737Ssommerfe# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*733ed737Ssommerfe# If applicable, add the following below this CDDL HEADER, with the
17*733ed737Ssommerfe# fields enclosed by brackets "[]" replaced with your own identifying
18*733ed737Ssommerfe# information: Portions Copyright [yyyy] [name of copyright owner]
19*733ed737Ssommerfe#
20*733ed737Ssommerfe# CDDL HEADER END
21*733ed737Ssommerfe#
22*733ed737Ssommerfe
23*733ed737Ssommerfe#
24*733ed737Ssommerfe# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
25*733ed737Ssommerfe# Use is subject to license terms.
26*733ed737Ssommerfe#
27*733ed737Ssommerfe# ident	"%Z%%M%	%I%	%E% SMI"
28*733ed737Ssommerfe#
29*733ed737Ssommerfe
30*733ed737Ssommerfe# Invoked when make thinks a source file is out of touch with SCCS.
31*733ed737Ssommerfe
32*733ed737Ssommerfe#
33*733ed737Ssommerfe# The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout
34*733ed737Ssommerfe# under certain circumstances, which can really screw things up; unset it.
35*733ed737Ssommerfe#
36*733ed737Ssommerfeunset CDPATH
37*733ed737Ssommerfe
38*733ed737Ssommerfe
39*733ed737SsommerfePATH=/usr/bin:/usr/ccs/bin
40*733ed737Ssommerfe
41*733ed737Ssommerfeif [ $# -ne 1 ]; then
42*733ed737Ssommerfe	echo "Usage: $0 filename" 1>&2
43*733ed737Ssommerfe	exit 1
44*733ed737Ssommerfefi
45*733ed737Ssommerfe
46*733ed737Ssommerfefile="$1"
47*733ed737Ssommerfeif [ ! -f "$file" ]; then
48*733ed737Ssommerfe	(echo "\n$0: error: Source file $file has gone missing!"
49*733ed737Ssommerfe	echo "$0: error: Check for over-enthusiastic clobber rules\n") 1>&2
50*733ed737Ssommerfe	exit 1
51*733ed737Ssommerfefi
52*733ed737Ssommerfe
53*733ed737Ssommerfew=warning
54*733ed737Ssommerfestatus=0
55*733ed737Ssommerfe
56*733ed737Ssommerfeif [ ! -z "$SCCSCHECK_FAIL" ]; then
57*733ed737Ssommerfe	w=error
58*733ed737Ssommerfe	status=1
59*733ed737Ssommerfeelif [ -z "$SCCSCHECK_WARN" ]; then
60*733ed737Ssommerfe    	exit 0
61*733ed737Ssommerfefi
62*733ed737Ssommerfe
63*733ed737Ssommerfecase "$file" in
64*733ed737Ssommerfe/*)
65*733ed737Ssommerfe	;;
66*733ed737Ssommerfe*)
67*733ed737Ssommerfe	file="./$file";;
68*733ed737Ssommerfeesac
69*733ed737Ssommerfe
70*733ed737Ssommerfesfile="${file%/*}/SCCS/s.${file##*/}"
71*733ed737Ssommerfe
72*733ed737Ssommerfeif [ "$sfile" -nt "$file" ]; then
73*733ed737Ssommerfe	(echo "\n$0: $w: In $(pwd)"
74*733ed737Ssommerfe	echo "$0: $w: $file is out of date:\n"
75*733ed737Ssommerfe	echo "$0: $w: \c"
76*733ed737Ssommerfe	ls -E $sfile
77*733ed737Ssommerfe	echo "$0: $w: \c"
78*733ed737Ssommerfe	ls -E $file
79*733ed737Ssommerfe	echo "\n$0: $w: Run bringovercheck ${CODEMGR_WS} to fix this workspace.\n") 1>&2
80*733ed737Ssommerfe	exit $status
81*733ed737Ssommerfefi
82*733ed737Ssommerfeexit 0
83