#!/bin/sh - # # rcslist: # # Show all locked/readonly/not RCSed files # in each given directory, or the current directory if none given # # originally by: Duncan C. White, 17th March 1992 # prog=`basename $0` if [ $# -eq 0 ] then dirs_to_try="." else dirs_to_try="$*" fi for dir_to_try in $dirs_to_try ; do ( dir=`echo $dir_to_try | sed -e 's|/*$||' -e 's|^$|/.|'` if [ -d $dir ]; then head=`basename $dir` if [ $head = RCS ]; then dir=`dirname $dir` fi cd $dir # # Amazingly, on our Linux and FreeBSD machines, # the Bourne shell "cd" command doesn't cause # exit on failure - it just barges on! # Naturally, all hell can break loose in a # shell script which is in a different directory # from where it thinks it is. # So, to avoid such chaos, we check explicitly # for failure here. # if [ $? -ne 0 ]; then echo "$prog: directory $dir/ cannot be entered (cd $dir failed), ignoring..." >&2 exit 1 fi else echo "$prog: directory $dir/ not found, ignoring..." >&2 exit 1 fi if [ ! -d RCS ] then echo "$prog: directory $dir/ has no RCS/ sub-directory, ignoring..." >&2 exit 1 fi echo "=========== Directory $dir/: ===========" files=`ls -a RCS` out= notrcs= dirs= for i in $files do if [ -f RCS/$i ] then j=`basename $i ,v` out="$out $j" fi done for i in `ls -a` do if [ -f $i -a ! -f RCS/$i,v ] then notrcs="$notrcs $i" elif [ -d $i ] then dirs="$dirs $i" fi done if [ "x$out" != x ] then echo "Files locked under RCS are:" ls -lgF $out 2>/dev/null | egrep '^-rw' | sed 's/^/ /' echo "Files checked out (readonly) from RCS are:" ls -lgF $out 2>/dev/null | egrep '^-r-' | sed 's/^/ /' fi if [ "x$notrcs" != x ] then echo "Files not under RCS at all:" ls -lgF $notrcs 2>/dev/null | sed 's/^/ /' fi if [ "x$dirs" != x ] then echo "Directories:" ls -ldgF $dirs 2>/dev/null | sed 's/^/ /' fi echo "" ) done #for dir_to_try