#!/bin/sh - # # This script looks for files that are under SCCS control, # and checks for modifications that have been made under # circumvention of SCCS. # # This script uses POSIX sh features and therefore doesn't # work with /bin/sh on Solaris. Please use ksh, zsh or bash. # It _does_ work perfectly fine with /bin/sh on FreeBSD, # DragonFly BSD and Linux # # Oliver Fromme # set -Cef unset CDPATH VERBOSE=false while [ $# -gt 0 ]; do case "$1" in -v) VERBOSE=true ;; *) echo "Usage: $0 [-v]" >&2 echo "Option -v: verbose (display diffs)" >&2 exit ;; esac shift done if [ ! -d SCCS ]; then echo "There is no SCCS subdirectory!" >&2 exit 1 fi SCCS_FILES=$(ls SCCS | sed -n 's/^s\.//p') if [ -z "$SCCS_FILES" ]; then echo "There are no files under SCCS control!" >&2 exit 1 fi SCCS_TMPDIR="tmp.check.$$" mkdir $SCCS_TMPDIR cd $SCCS_TMPDIR ln -s ../SCCS ALL_OK=true for i in $SCCS_FILES; do if [ ! -f ../"$i" ]; then echo "ATTENTION: File \"$i\" has not been checked out!" >&2 echo "Use \"sccs get $i\" to check it out." >&2 ALL_OK=false continue fi sccs get "$i" >/dev/null if ! cmp -sz "$i" ../"$i"; then if $VERBOSE; then printf '\n\n\n' tput md echo " Differences for file \"$i\":" tput me printf '\n\n\n' diff -u "$i" ../"$i" || true else echo "File \"$i\" has been illegally modified!" fi ALL_OK=false fi done cd .. rm -rf $SCCS_TMPDIR if $ALL_OK; then echo "Everything OK, no problems detected." >&2 exit 0 else exit 1 fi #--