Look in the termsrc.tgz package - part of the standard Slackware packages on disk ap1 - for source to the TERM daemon.