#!/bin/csh -f

set LIB=/usr/lib/X11
set WM4D=${LIB}/app-defaults/4DWm
set XRES=${HOME}/.Xresources
set setFlag=0

if ( $#argv > 0 ) then
	if ( "$argv[1]" == "-s" ) set setFlag=1
endif

if ( ! -d ${LIB} ) exit 0

set found=0

if ( -f $XRES ) then
	set line=`grep -s transientDecoration $XRES`
	if ( "$line" == "" ) then
	    set found=0
	else
	    set found=1
	endif
endif
if ( $found == 0  &&  -f $WM4D ) then
	set line=`grep -s transientDecoration $WM4D`
	if ( "$line" == "" ) then
	    set found=0
	else
	    set found=1
	endif
endif

if ( $found == 1 ) then
	echo "$line" | egrep -s "none"
	if ( $status == 0 ) then
	    set found=1
	else
	    set found=0
	endif
endif

if ( $found == 0 ) then
	if ( $setFlag == 0 ) exit 1

	echo '4Dwm*transientDecoration:       none' >>$XRES

	confirm -b Continue \
		-t 'The file "'$XRES'" has been modified to eliminate the' \
		-t "window borders on the Action textport." \
		-t "You must login again to have this change take effect." \
		>&/dev/null
endif
exit 0
