#!/bin/sh
# The SPIMS software is covered by a license. The use of the software
# represents acceptance of the terms and conditions in the license.
# ******************************************************************
# Copyright (c) 1989, Swedish Institute of Computer Science
# Args: Directory { Search-string Exchange-string }+
# Usage: modrecursive <dir> xxx yyy

dir="$1"
shift
string=""

while test $# -gt 0 ; do
	if test $# -le 1 ; then
		echo "Odd number of strings following directory argument"
		exit 1
	fi
	string="$string -e s|$1|$2|"
	shift
	shift
done

echo "Using string $string"

if test "$string" = "" ; then
	echo "At least one set of search/exchange strings are required"
	exit 1
fi

find "$dir" -name RCS -prune -o -type f -name \*.\[ch\] -exec modrecursive-aux "$string" '{}' \;

find "$dir" -name RCS -prune -o -name \*.o -o -name \*.\[chy\] -o -type f -exec modrecursive-aux "$string" '{}' \;
