First draft of the PATSUBST code since back from holidays.  Although it
compiles I'm expecting bugs as it has been about three weeks since I
last looked at it.