# # file: rcs_if.pm # # Descriptoin: Wrapper over RCS via command line interface # [external process]. Implementation of scs object for the # RCS source control system. # # created: Fri Apr 24 11:02:54 EDT 1998 Kyle R. Burton # # revision list: # # use Exporter; use scs_if; package rcs_if; @ISA = ( 'Exporter', 'scs_if', 'rcs_if' ); @EXPORT = ( ); @EXPORT_OK = ( ); sub new { my($pkg) = shift; $rthis = {}; bless $rthis, 'rcs_if'; return $rthis; } sub checkin { my($obj) = shift; my $err_file = "err.$$"; print "this is rcs_if::checkin\n"; } sub checkout { my($obj) = shift; my($file_name) = shift; my($version) = shift; my $cmd; my $err_file = "err.$$"; print "this is rcs_if::checkout\n"; if( defined( $version ) ) { $cmd = "co -l$version $file_name 2> $err_file"; print "cmd is: $cmd\n"; print `$cmd`; } else { $cmd = "co -l $file_name 2> $err_file"; print "cmd is: $cmd\n"; print `$cmd`; } open( ERR, "<$err_file" ); while( ) { print; } close( ERR ); unlink "$err_file"; if( !(-e $file) ) { return "Error retreiving file: $file from path $path\n"; } } sub add { my($obj) = shift; my($file_name) = shift; my($comment) = shift; my $err_file = "err.$$"; print "this is rcs_if::add\n"; # if the RCS directory's not present, make it. if( !(-e "RCS" ) ) { mkdir "RCS", 0755; } # no path info please! if( $file_name =~ /\// ) { return "path info is not allowed in file name."; } if( !(-e $file_name) ) { return "Error, file: \"$file_name\" does not exist."; } if( defined $comment ) { print `ci -i -t-$comment $file_name 2> $err_file`; } else { print `ci -i -t-"no initial comment." $file_name 2> $err_file`; } open( ERR, "<$err_file" ); while( ) { print; } close( ERR ); unlink "$err_file"; return undef; } sub get { my($obj) = shift; my($file) = shift; my($version) = shift; my $cmd; my $err_file = "err.$$"; print "this is rcs_if::get\n"; if( defined( $version ) ) { $cmd = "co -r$version $file 2> $err_file"; } else { $cmd = "co $file 2> $err_file"; } print "executing checkout: $cmd\n"; print `$cmd`; if( -e $file ) { open( FILE, "<$err_file" ); while() { print; } unlink "$err_file"; } if( !(-e $file) ) { return "Error retreiving file: $file from path $path\n"; } return undef; } 1;