I'm guessing all this comes pasted from another project? glibc maybe? What is the license? Can we put the pts related stuff in a separate file? pts.c?