#!/bin/csh -f

set RT0=condor_rt0.o
set CkptMain=MAIN
set Patcher=./ObjPatch

cp /lib/crt0.o $RT0
set offset=`strings -ao $RT0 | fgrep _main | sed -e s/_main//`
if $offset == '' then
	echo Could not find the entry for _main in /lib/crt0.o
	exit
endif

set oldstr=`$Patcher $RT0 $offset`

if $oldstr != _main then
	echo Could not find the entry for _main in /lib/crt0.o
	exit
endif

set oldstr=`$Patcher $RT0 $offset $CkptMain`
set newstr=`$Patcher $RT0 $offset`

if $newstr != $CkptMain then
	echo Could not renamed _main to $CkptMain
	exit
endif

echo _main has been renamed to $CkptMain
