#! /bin/sh

prog="`basename $0`"
fvwmrc="$1"

[ x$fvwmrc != x ] || { echo "usage: \"$prog FILENAME\"" >&2 ; exit 1; }


# This is going to be a hideous regexp.  I want to replace an 80-character
#  line with a 60-character line, leaving only two parts untouched,
#  _and_ I'm doing it as a "-e" argument to perl!
# Ick.

echo "Modifying \"$fvwmrc\"." >&2
echo "(The old file is backed up as \"$fvwmrc.bak\")" >&2
perl -w -pi.bak -e '(s,([Ee]xec\s+)/bin/csh\s+-cf\s+\"\s*set\s+add_opts\s+=\s+\(?([^\s\(\)]+)\)?\s*;\s*source\s+/usr/athena/lib/init/add\s*;\s*(\S+)\s*\",$1/mit/windowmanagers/arch/share/bin/wattachandrun $3 $2,) && print STDERR ".\n";' "$fvwmrc"
echo "done" >&2
