5 ############################################################
8 if [ ! -d SCCS ] ; then
12 logfile=/tmp/rcs2sccs_$$_log
14 tmpfile=/tmp/rcs2sccs_$$_tmp
16 emptyfile=/tmp/rcs2sccs_$$_empty
17 echo -n "" > $emptyfile
18 initialfile=/tmp/rcs2sccs_$$_init
19 echo "Initial revision" > $initialfile
20 sedfile=/tmp/rcs2sccs_$$_sed
22 revfile=/tmp/rcs2sccs_$$_rev
24 commentfile=/tmp/rcs2sccs_$$_comment
27 # create the sed script
29 s,;Id;,%Z%%M% %I% %E%,g
30 s,;SunId;,%Z%%M% %I% %E%,g
34 s,;Id:.*;,%Z%%M% %I% %E%,g
35 s,;SunId:.*;,%Z%%M% %I% %E%,g
40 sed -e 's/;/\\$/g' $sedfile > $tmpfile
42 ############################################################
43 # Loop over every RCS file in RCS dir
45 if sort -k 1,1 /dev/null 2>/dev/null
46 then sort_each_field='-k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9'
47 else sort_each_field='+0 +1 +2 +3 +4 +5 +6 +7 +8'
50 # get rid of the ",v" at the end of the name
51 file=`echo $vfile | sed -e 's/,v$//'`
53 # work on each rev of that file in ascending order
55 rlog $file | grep "^revision [0-9][0-9]*\." | awk '{print $2}' | sed -e 's/\./ /g' | sort -n -u $sort_each_field | sed -e 's/ /./g' > $revfile
56 for rev in `cat $revfile`; do
61 # get file into current dir and get stats
62 date=`rlog -r$rev $file | grep "^date: " | awk '{print $2; exit}' | sed -e 's/^19\|^20//'`
63 time=`rlog -r$rev $file | grep "^date: " | awk '{print $3; exit}' | sed -e 's/;//'`
64 author=`rlog -r$rev $file | grep "^date: " | awk '{print $5; exit}' | sed -e 's/;//'`
67 rlog -r$rev $file | sed -e '/^branches: /d' -e '1,/^date: /d' -e '/^===========/d' -e 's/$/\\/' | awk '{if ((total += length($0) + 1) < 510) print $0}' > $commentfile
68 echo "==> file $file, rev=$rev, date=$date, author=$author"
70 co -r$rev $file >> $logfile 2>&1
75 echo checked out of RCS
77 # add SCCS keywords in place of RCS keywords
78 sed -f $sedfile $file > $tmpfile
83 echo performed keyword substitutions
87 # check file into SCCS
88 if [ "$firsttime" = "1" ]; then
90 echo about to do sccs admin
91 echo sccs admin -n -i$file $file < $commentfile
92 sccs admin -n -i$file $file < $commentfile >> $logfile 2>&1
94 echo ERROR - sccs admin
97 echo initial rev checked into SCCS
101 brev=`echo $rev | sed -e 's/\.[0-9]*$//'`
102 sccs admin -fb $file 2>>$logfile
103 echo sccs get -e -p -r$brev $file
104 sccs get -e -p -r$brev $file >/dev/null 2>>$logfile
107 echo sccs get -e -p $file
108 sccs get -e -p $file >/dev/null 2>> $logfile
112 echo ERROR - sccs get
115 sccs delta $file < $commentfile >> $logfile 2>&1
117 echo ERROR - sccs delta -r$rev $file
120 echo checked into SCCS
122 sed -e "s;^
\ 1d D $rev ../../.. ..:..:.. [^ ][^ ]*;
\ 1d D $rev $date $author;" SCCS/s.$file > $tmpfile
124 cp $tmpfile SCCS/s.$file
125 chmod 444 SCCS/s.$file
128 echo ERROR - sccs admin -z
136 ############################################################
140 rm -f $tmpfile $emptyfile $initialfile $sedfile $commentfile
141 echo ===================================================
142 echo " Conversion Completed Successfully"
143 echo ===================================================