} else { fprintf(stderr, "Unable to open %s, errno=%d\n", ptydev, errno);
pty_search(int *pty){    char namebuf[PTMS_BUFSZ];    /* ask the PTY manager */    int fd = open("/dev/ptms$", 0);    if (fd && ptioctl(fd, PTMS_GETPTY, namebuf) == 0) {	strcpy(ttydev, namebuf);	strcpy(ptydev, namebuf);	*x_basename(ttydev) = 't';	close(fd);	if ((*pty = open(ptydev, O_RDWR)) >= 0) {#ifdef PTYDEBUG	    ptioctl(*pty, XTY_TRACE, 0);#endif	    return 0;	}    }    return 1;}