5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License, Version 1.0 only
7 # (the "License"). You may not use this file except in compliance
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 1993-1998, 2003 Sun Microsystems, Inc.
25 # All rights reserved.
26 # Use is subject to license terms.
28 #pragma ident "%Z%%M% %I% %E% SMI"
30 # This script is to be used to copy SCCS files and SCCS
31 # directory structures within a CodeManager workspace
32 # You specify the 'clear file' or directory to sccscp, it
33 # will duplicate the coresponding s-dot file(s),
34 # and do an SCCS GET operation on the newly
40 # The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout
41 # under certain circumstances, which can really screw things up; unset it.
51 echo "usage: sccscp [-r] filename1 [ filename2...] target"
52 echo " -r copy a directory and all of its files"
53 echo " -g copy the sdot file, but do not sccs-get it"
54 echo " -e copy most recent delta if file is currently checked out."
60 # function to return that last arguement passed to it.
61 # I use this in place of array indexing - which shell
76 # copy_file(source, destination)
88 # is the file currently checked out?
90 if [ "(" -f $p1 ")" -a "(" $E_FLAG -eq "0" ")" ]; then
91 echo "sccscp: $f1 currently checked out - not copied"
95 # Does the destination directory have an SCCS directory,
96 # if not we will create it!
98 if [ ! -d $d2/SCCS
]; then
102 if [ $G_FLAG -eq "0" ]; then
105 echo "sccs get $d2/$f2"
113 # copy_dir(source, destination)
120 destdir
=$2/`basename $1`
127 find .
-name "s.*" -print |
grep '/SCCS/s\.' \
130 sdot
=`echo $sdot | sed -e "s/^\.\///"`
131 d2
=$PWD/$destdir/`dirname $sdot`
132 f2
=`basename $sdot | sed -e "s/^s\.//" `
133 if [ "(" -f $PWD/$1/`dirname $sdot`/p.
$f2 ")" -a \
134 "(" $E_FLAG -eq "0" ")" ]; then
137 echo "sccscp: $d1/$f2 currently checked out - not copied"
140 if [ ! -d $d2 ]; then
143 cp $PWD/$1/$sdot $PWD/$destdir/$sdot
144 if [ $G_FLAG -eq "0" ]; then
145 dir
=`dirname $destdir/$sdot`
148 echo "sccs get $dir/$f2"
156 if [ -f /usr
/sccs
/admin
]; then
157 ADMIN
=/usr
/sccs
/admin
160 ADMIN
=/usr
/ccs
/bin
/admin
168 set -- `getopt edgr $*`
177 -r) R_FLAG
=1; shift;;
179 -g) G_FLAG
=1; shift;;
180 -e) E_FLAG
=1; shift;;
185 if [ $# -lt 2 ]; then
186 echo "sccscp: Insufficient arguments (${#})"
193 if [ "(" $# -gt 2 ")" -a "(" ! -d $lastarg ")" ]; then
194 echo "sccscp: Target must be a directory"
202 echo "sccscp: cannot access $1"
206 if [ -d $lastarg ]; then
207 dest
=$lastarg/`basename $1`
212 if [ $R_FLAG -eq 0 ]; then
213 echo "sccscp: <$1> directory"