home *** CD-ROM | disk | FTP | other *** search
- #! perl
- die "$0 <UnixSourceDir> <RISCOSDestDir>\n" if( $#ARGV < 1 );
- use RISCOS;
-
- $sourcedir = $ARGV[0];
- $destdir = $ARGV[1];
-
- foreach( 'CC', 'cc', 'C', 'c', 'h', 'H', 's', 'S' )
- {
- $ext{ $_ } = $_; # Hash directory name by suffix
- # (Currently dirname == suffix )
- }
-
- $ext{ 'cpp' } = 'cc';
- $ext{ 'CPP' } = 'cc';
- $ext{ 'HPP' } = 'h'; # Some people use this suffix for C++ headers
- $ext{ 'hpp' } = 'h';
-
- opendir( MYDIR, $sourcedir )
- || die "Couldn't open directory $sourcedirname\n";
-
- foreach $file ( readdir( MYDIR ) )
- {
- if ($file =~ /makefile/i) {
- print "$file -> $file\n";
- RISCOS::File::copy "$sourcedir.$file", "$destdir.$file", 0x102 or print STDERR "$!\n";
- } else {
- ( $base, $ext ) = ( $file =~ m#^([^/]*)/([^/]*)$#);
- if( defined $ext{ $ext } ) # Clasic variable naming scheme 8-)
- {
- # We have but one extension, and it's in our list!
- $destsubdir = "$destdir.$ext{$ext}";
- # print "$destsubdir\n";
- mkdir( $destsubdir, 511 ) unless -d $destsubdir;
-
- $source = "$sourcedir.$file";
- $dest = "$destsubdir.$base";
- print "$file -> $ext.$base\n";
- RISCOS::File::copy $source, $dest, 0x102 or print STDERR "$!\n";
- # print "*copy $source $dest ~c\n";
- }
- }
- }
-
-