I'v got a little bug to report. The function ttyname does not work with /dev/pts/* I think it is because the routine has been witten for /dev/<something> but not for /dev/<something>/<otherthing>