dircompare	;
	; This routine is run (for now) only on the development environment file listing.
	; The routine adjusts certain file permissions to match with what we expect in an installation
	; The final output is expected to match file listing of an installation
	; set etrap so we get debug info and exit mumps
	set $etrap="use $P write $zstatus,!,""Error line: "" zprint @$zposition s x=$zjobexam() halt"
	set infile=$piece($zcmdline," ",1)
	set defgroup=$piece($zcmdline," ",2)
	if ""=$zsearch(infile) write !," file: ",infile," does not exist",!
	do setspecialperms	; a hard-coded list of files with odd permissions set by configure.gtc
	open infile:(readonly)
	use infile:exception="goto eof"
	for  use infile read line  do  quit:""=line
	. set perm=$piece(line," ",1)		; get the first piece which is the permission field
	. set filename=$piece(line," ",2)	; for now there are no space separated file names
	. set ext=$zparse(filename,"TYPE")
	. if (".a"=ext)!(".o"=ext)!(".m"=ext)!(".dat"=ext)!(".gld"=ext)!(".h"=ext)!(".xc"=ext) do rmxall(.perm)
	. if (".gtc"=ext) do zapgtc(.filename)
	. do fixperms(.perm,filename)
	. do rmwrite(.perm)
	. do:""=defgroup zapworld(.perm)	; If it is not "defgroup", then remove all world permissions
	. use $P
	. write perm," ",filename,!
	close infile
	quit

rmwrite(perm)
	; do the equivalent of chmod a-w by translating permission w to -
	set perm=$translate(perm,"w","-")
	quit

rmxall(perm)
	; do the equivalent of chmod a-x by translating x to -
	set perm=$translate(perm,"x","-")
	quit

zapworld(perm)
	; get everything up to world field and add --- to tail
	set perm=$extract(perm,1,7)_"---"
	quit

zapgtc(str)
	; This is called when the extension of file is .gtc.
	; Return just the name without extension
	set str=$zparse(str,"NAME")
	quit

setspecialperms
	; Permissions for these files are explicity set by configure to specific values
	; Though perm755 is set, it is not used, since that is the default permission when other filters are applied
	for file="gtmstart","gtmstop","gtcm_run","gtcm_slist" set perm744(file)=1
	for file="gdedefaults" set perm444(file)=1
	for file="gtmprofile","gtmprofile_preV54000","gtm","gtmcshrc" set perm755(file)=1
	quit

fixperms(perm,file)
	if $data(perm744(file)) set perm=$extract(perm,1,1)_"rwxr--r--"
	if $data(perm444(file)) set perm=$extract(perm,1,1)_"r--r--r--"
	quit
