
!if class = $doctype or $abandon!=$empty
 job=read
 !changeto read.proc
!endif

!if $coder=$empty
 !exit
!endif

oldcode=!record 0 of $docdir/$doc/.code
oldcode=!word 1 of $oldcode
!if $oldcode!=$coder1
 error=bad_oldcode
 !exit
!endif

coder=!trim $coder
coder2=!trim $coder2
m1=!charcnt $coder
m2=!charcnt $coder2
coder=!text select $namechars in $coder
coder2=!text select $namechars in $coder2
n1=!charcnt $coder
n2=!charcnt $coder2
!if $m1!=$n1 or $m2!=$n2
 error=bad_newcode
 !exit
!endif
!if $coder!=$coder2
 error=code_discord
 !exit
!endif
n=!charcnt $coder
!if $n<$codemin
 error=small_code
 !exit
!endif
!if $n>$codemax
 error=big_code
 !exit
!endif

!mexec scripts/setcode.sh
job=recode2

