head	1.1;
access;
symbols
	TIGRIS_1_1_0RC2:1.1
	TIGRIS_1_1_0RC1:1.1
	TIGRIS_1_1:1.1.0.14
	TIGRIS_1_0_8:1.1
	TIGRIS_1_0_8RC3:1.1
	TIGRIS_1_0_8RC2:1.1
	TIGRIS_1_0_8RC1:1.1
	TIGRIS_1_0_7:1.1
	TIGRIS_1_0_7RC3:1.1
	TIGRIS_1_0_7RC2:1.1
	TIGRIS_1_0_7RC1:1.1
	TIGRIS_1_0_6:1.1
	TIGRIS_1_0_6RC5:1.1
	TIGRIS_1_0_6RC4:1.1
	TIGRIS_1_0_6RC3:1.1
	TIGRIS_1_0_6RC2:1.1
	TIGRIS_1_0_6RC1:1.1
	TIGRIS_1_0_5:1.1
	TIGRIS_1_0_5RC6:1.1
	TIGRIS_1_0_5RC5:1.1
	TIGRIS_1_0_5RC4:1.1
	TIGRIS_1_0_5RC3:1.1
	TIGRIS_1_0_5RC2:1.1
	TIGRIS_1_0_5RC1:1.1
	TIGRIS_1_0_4:1.1
	TIGRIS_1_0_3:1.1
	TIGRIS_1_0_2:1.1
	TIGRIS_1_0_1:1.1
	TIGRIS_1_0:1.1.0.16
	TIGRIS_1_0_0:1.1
	TIGRIS_1_0_0_RC1:1.1.0.12
	HELM_PEER_PORT_BRANCH:1.1.0.10
	TIGRIS_0_9_2_4:1.1
	TIGRIS_0_9_2_3:1.1
	TIGRIS_0_9_2:1.1.0.8
	TIGRIS_0_9_0:1.1.0.6
	TIGRIS_0_8_4:1.1.0.4
	TIGRIS_710_FF:1.1
	TIGRIS_706:1.1
	TIGRIS_705:1.1
	TIGRIS_704:1.1
	TIGRIS_703:1.1
	TIGRIS_702:1.1
	TIGRIS_701:1.1
	TIGRIS_SEP_13_2000:1.1.0.2
	TIGRIS_BASELINE:1.1;
locks; strict;
comment	@# @;


1.1
date	2000.06.09.02.13.42;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Needed by template Makefiles.
@
text
@#!/usr/bin/perl
# Copyright (c) 1999 DataWeb Systems, Inc. All rights reserved.

#
#	Edits files in a directory and its sub-directories recursively.
#

use Getopt::Std;

%option=();
# getopts("co:v", \%option);
getopts("c", \%option);


$operation = shift || die "Usage: editsx [-c] operation [files [directory]]\n";
$filemask = shift || "*.java";
$directory = shift || ".";

# Get the full path of the directory.
chdir $directory;
my $startingPoint = `pwd`;
chomp $startingPoint;

print "Directories under $startingPoint\n";
listDir($startingPoint);

exit;

sub listDir
{
    my $dir = shift;
    my $DIRHANDLE;
    my $filename, $fullpath;
    my @@subdirs;
    my @@files;
    my $old;
    my $new = "temporary";

    # Process this directory
    print "$dir\n";
    chdir $dir;
    @@files = glob($filemask);
    foreach $old (@@files)
    {
	print "$old\n";
	open(OLD, "< $old") or die "Could not open $old: $!\n";
	open(NEW, "> $new") or die "Could not open $new: $!\n";
	select(NEW);
	while(<OLD>)
	{
	    eval $operation;
	    print;
	}
	close(OLD);
	close(NEW);

	if ($option{c})
	{
	    unlink($old);
	}
	else
	{
	    rename($old, "$old.orig");
	}

	rename($new, $old);
    }

    # Get the subdirectories for processing.
    opendir(DIRHANDLE, $dir) or die "Could not open $dir: $!\n";
    while (defined($filename = readdir(DIRHANDLE)))
    {
	$fullpath = $dir . "/" . $filename;
	if (-d $fullpath)
	{
	    if (($filename eq ".") ||
		($filename eq "..") ||
		($filename eq "limbo") ||
		($filename eq "RCS") ||
		($filename eq "CVS")) {next;}

	    # print "$filename\n";
	    push(@@subdirs, $fullpath);
	}
    }
    closedir(DIRHANDLE);

    foreach $fullpath (sort(@@subdirs))
    {
	listDir($fullpath);
    }
}
@
