#!/bin/sh
# editing [<dir>] - Shows files sccs-edit'ed in <dir> (or .) and its subdirs.
#
# THIS SAMPLE PROGRAM IS BEING PROVIDED "AS IS" AND ONLY AS A COURTESY TO
# THE RECIPIENT.  SUN MAKES NO WARRANTY OR REPRESENTATION, EITHER EXPRESS 
# OR IMPLIED WITH RESPECT TO THIS SAMPLE PROGRAM INCLUDING QUALITY, PERF- 
# FORMANCE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON- 
# INFRINGEMENT.  IN NO EVENT WILL SUN BE LIABLE FOR ANY DIRECT, INDIRECT,  
# SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR  
# INABILITY TO USE THIS SAMPLE PROGRAM.

# For each SCCS directory in the specified <dir> (or .) ...
for dir in `/usr/bin/find "${1:-.}" -name SCCS`
do
	# For each p. file in that directory ...
	for file in "$dir"/p.*
	do
		# Have to check for the case that there was no match;
		# unfortunately, the shell leaves $dir/p.* in the list.
		[ "$file" = "$dir/p.*" ] && break

		# This is a real p. file; show name and contents.
		/usr/bin/echo "$file" '	\c'
		/usr/bin/cat  "$file"
	done
done | /usr/bin/sed 's/SCCS\/p\.//'
exit 0
