primitive sccs gadgets
Bill Kennedy
bill at ssbn.WLK.COM
Wed Dec 27 10:24:40 AEST 1989
Having beaten my head against sccs for the last few days I tossed
together some scripts that are handy for getting stuff in and out
of sccs as well as putting a (hopefully) useful/appropriate sccs
key into the source. There's nothing fancy about thse, nor are
they bulletproof, but they are a lot easier to use than admin, get,
and delta. Hopefully someone with better developed sccs skills
will spruce them up and re-post.
============================ cut ======== cut =========== cut ============
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
# scopy
# sget
# skey
# snew
# sput
# This archive created: Tue Dec 26 17:16:09 1989
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'scopy'" '(332 characters)'
if test -f 'scopy'
then
echo shar: "will not over-write existing file 'scopy'"
else
sed 's/^ X//' << \SHAR_EOF > 'scopy'
X#
X# @(#)scopy.sh 1.1 @(#)scopy.sh 1.1 12/26/89 17:05:37
X# /usr/lbin/scopy
X#
X# Get a file from sccs but not for editing.
X#
Xif [ -z "$1" ]
Xthen
X echo "Usage: scopy -getflags file1 [file2 [file3]...]"
X exit 0
Xfi
Xflags=
Xfor arg in $*
Xdo
X case $arg in
X
X -*)
X flags=$flags" $arg"
X ;;
X *)
X get $flags s.$arg
X ;;
X esac
Xdone
SHAR_EOF
if test 332 -ne "`wc -c < 'scopy'`"
then
echo shar: "error transmitting 'scopy'" '(should have been 332 characters)'
fi
chmod +x 'scopy'
fi
echo shar: "extracting 'sget'" '(329 characters)'
if test -f 'sget'
then
echo shar: "will not over-write existing file 'sget'"
else
sed 's/^ X//' << \SHAR_EOF > 'sget'
X#
X# @(#)sget.sh 1.1 @(#)sget.sh 1.1 12/26/89 17:06:42
X# /usr/lbin/sget
X#
X# Check out a file from sccs for editing.
X#
Xif [ -z "$1" ]
Xthen
X echo "Usage: sget -getflags file1 [file2 [file3]...]"
X exit 0
Xfi
Xflags=
Xfor arg in $*
Xdo
X case $arg in
X
X -*)
X flags=$flags" $arg"
X ;;
X *)
X get -e $flags s.$arg
X ;;
X esac
Xdone
SHAR_EOF
if test 329 -ne "`wc -c < 'sget'`"
then
echo shar: "error transmitting 'sget'" '(should have been 329 characters)'
fi
chmod +x 'sget'
fi
echo shar: "extracting 'skey'" '(1489 characters)'
if test -f 'skey'
then
echo shar: "will not over-write existing file 'skey'"
else
sed 's/^ X//' << \SHAR_EOF > 'skey'
X# @(#)skey.sh 1.1 @(#)skey.sh 1.1 12/26/89 17:06:53
X#
X# /usr/lbin/skey
X#
X# This script will accept a string of file names and figure
X# out what kind(s) of sccs key(s) belong on the more common
X# kinds of source files.
X#
X# W. L. Kennedy, Jr. 10/28/89
X#
Xheader="@(#)skey.sh 1.1 @(#)skey.sh 1.1 12/26/89 17:06:53"
Xsccsc="static char *sccsid = \"$header\";" # for .c files
Xsccsh="/* $header */"
Xsccss="# $header"
X#
X# If no arguments, display usage
X#
Xif [ -z "$1" ]
Xthen
X echo "Usage: skey file1 [file2 [file3]...]"
X exit 1
Xfi
X#
X# Figure out what kind of file each of them is
X#
Xfor file in $*
Xdo
X if [ ! -f "$file" ]
X then
X echo "$0: invalid file $file"
X continue
X fi
X #
X # Pitch it if it already has an sccs key
X #
X if fgrep '@(#)skey.sh' $file > /dev/null 2>&1
X then
X echo "$file already has an sccs key"
X continue
X fi
X #
X # Pitch it if it already has a filled out sccs header
X #
X if fgrep '@(#)' $file > /dev/null 2>&1
X then
X echo "$file already has an sccs header"
X continue
X fi
X #
X # Select the appropriate sccs key for the file type
X #
X case $file in
X *.c)
X sccskey=$sccsc
X ;;
X *.h)
X sccskey=$sccsh
X ;;
X *)
X sccskey=$sccss
X ;;
X esac
X #
X # Now edit the appropriate key into the file
X #
X case $file in
X *.sh)
X ed - $file << EOF > /dev/null
X1a
X$sccskey
X.
Xw
Xq
XEOF
X ;;
X *.c)
X ed - $file << EOF > /dev/null
X0a
X#ifndef LINT
X$sccskey
X#endif
X.
Xw
Xq
XEOF
X ;;
X *)
X ed - $file << EOF > /dev/null
X0a
X$sccskey
X.
Xw
Xq
XEOF
X ;;
X esac
Xdone
SHAR_EOF
if test 1489 -ne "`wc -c < 'skey'`"
then
echo shar: "error transmitting 'skey'" '(should have been 1489 characters)'
fi
chmod +x 'skey'
fi
echo shar: "extracting 'snew'" '(443 characters)'
if test -f 'snew'
then
echo shar: "will not over-write existing file 'snew'"
else
sed 's/^ X//' << \SHAR_EOF > 'snew'
X#
X# @(#)snew.sh 1.1 @(#)snew.sh 1.1 12/26/89 17:07:01
X# /usr/lbin/snew
X#
X# Put a new file into sccs with the admin command
X#
Xif [ -z "$1" ]
Xthen
X echo "Usage: snew -adminflags file1 [file2 [file3]...]"
X exit 0
Xfi
Xflags=
Xfor arg in $*
Xdo
X case $arg in
X
X -*)
X flags=$flags" $arg"
X ;;
X *)
X if fgrep '@(#)%M' $arg > /dev/null 2>&1
X then
X admin -i$arg $flags s.$arg
X else
X echo "$arg has no sccs key"
X fi
X ;;
X esac
Xdone
SHAR_EOF
if test 443 -ne "`wc -c < 'snew'`"
then
echo shar: "error transmitting 'snew'" '(should have been 443 characters)'
fi
chmod +x 'snew'
fi
echo shar: "extracting 'sput'" '(318 characters)'
if test -f 'sput'
then
echo shar: "will not over-write existing file 'sput'"
else
sed 's/^ X//' << \SHAR_EOF > 'sput'
X#
X# @(#)sput.sh 1.1 @(#)sput.sh 1.1 12/26/89 17:07:07
X# /usr/lbin/sput
X#
X# Delta a file back into sccs
X#
Xif [ -z "$1" ]
Xthen
X echo "Usage: sput -deltaflags file1 [file2 [file3]...]"
X exit 0
Xfi
Xflags=
Xfor arg in $*
Xdo
X case $arg in
X
X -*)
X flags=$flags" $arg"
X ;;
X *)
X delta $flags s.$arg
X ;;
X esac
Xdone
SHAR_EOF
if test 318 -ne "`wc -c < 'sput'`"
then
echo shar: "error transmitting 'sput'" '(should have been 318 characters)'
fi
chmod +x 'sput'
fi
exit 0
# End of shell archive
============================ cut ======== cut =========== cut ============
--
Bill Kennedy usenet {attctc,att,cs.utexas.edu,sun!daver}!ssbn!bill
internet bill at ssbn.WLK.COM or attmail!ssbn!bill
More information about the Alt.sources
mailing list