From - Wed Feb 24 12:19:18 1999
Received: from npac.syr.edu (georgia.npac.syr.edu [128.230.21.203])
	by postoffice.npac.syr.edu (8.9.1a/8.9.1) with ESMTP id MAA19271
	for <globus@npac.syr.edu>; Wed, 24 Feb 1999 12:18:34 -0500 (EST)
Message-ID: <36D44172.BCBC077E@npac.syr.edu>
Date: Wed, 24 Feb 1999 12:14:10 -0600
From: Erol Akarsu <akarsu@npac.syr.edu>
X-Mailer: Mozilla 4.06 [en] (WinNT; I)
MIME-Version: 1.0
To: globus@npac.syr.edu
Subject: [Fwd: ]
Content-Type: multipart/mixed; boundary="------------9CC21BE142BDFB98154EE7CF"
X-Mozilla-Status: 8001
X-Mozilla-Status2: 00000000
X-UIDL: f0d825dcbf86b08ee376cf7e8dbf038a

This is a multi-part message in MIME format.
--------------9CC21BE142BDFB98154EE7CF
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit



--------------9CC21BE142BDFB98154EE7CF
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Received: from sultan.npac.syr.edu (sultan.npac.syr.edu [128.230.117.41])
	by postoffice.npac.syr.edu (8.9.1a/8.9.1) with SMTP id MAA19227
	for <akarsu@npac.syr.edu>; Wed, 24 Feb 1999 12:16:26 -0500 (EST)
Received: (from msen7@localhost) by sultan.npac.syr.edu (951211.SGI.8.6.12.PATCH1502/8.6.6) id MAA12762 for akarsu; Wed, 24 Feb 1999 12:16:25 -0500
Date: Wed, 24 Feb 1999 12:16:25 -0500
From: Mehmet Sen <msen7@npac.syr.edu>
Message-Id: <199902241716.MAA12762@sultan.npac.syr.edu>
Apparently-To: akarsu@sultan.npac.syr.edu
Content-Type: text

#! /usr/bin/perl
#############################################################################
# 
#############################################################################
#  
#   GLOBAL VARIABLES {
#
#############################################################################
 
 
$dirname = ".";
 
$replace=$ARGV[0];
$by=$ARGV[1];
$extention=$ARGV[2];
   
if (($replace eq "") || ($by eq "") ) {
    print"\n USAGE: \n\tabsolute.pl   current_string  replace_by_string [extension] \n\n";
    exit();
}
print "Replacing $replace with $by \n";
    
handledir($dirname,0);



sub handledir() {
local($dir,$l)=@_;
print "$dir\n";
opendir(DIR, $dir) || die "no dir .";
foreach $fn ( readdir(DIR)) {
	#if ($l >= 5) {continue;}

	if ($fn eq ".") { next;}
	elsif ($fn eq "..") { next;}
	

	$fn=$dir."/".$fn;

	if (-d $fn) {
	        if ( $x =readlink($fn) ) {
		    print "SKIPPING THE LINK at $fn --> $x \n";
		    next;
		}
		$l+=1;
		handledir($fn,$l);
		$l-=1;
	} else {
	    if ($extention eq "ALL" ) {;}
	    elsif (!($fn =~ /.html\b/ || $fn =~ /.htm\b/)){next;}
	    handlefile($fn,$l);	
	}
}
}

sub handlefile(){
local($file,$l)=@_;
#$margin="";
#for ($i=0;$i<$l;$i++){
#   	$margin.=" ";
#}
#print "$margin $file \n";
print "$file \n";

 open(IN, "<$file"); 
$of=$file."___";
 open(OUT, ">$of"); 

	 while (<IN>) {
		$line=$_;
		$line=~ s/$replace/$by/g;
	 	print OUT $line;
	}
 close(IN);
 close(OUT);

 rename($of,$file);

}


--------------9CC21BE142BDFB98154EE7CF--


