bilbo.gregh@SEAS.UCLA.EDU (Gregory Holmberg) (05/11/88)
The xterm documentation says: -Sccn This option specifies the last two letters of the name of a pseudoterminal to use in slave mode. This allows xterm to be used as an input and output channel for an existing program and is sometimes used in specialized applications. Also, although it doesn't say it, the "n" is the file descriptor number you want to use. For those of you who've looked at the xterm code, expecially main.c, this is what the am_slave stuff is all about. My question is: is this feature supposed to work? Has anyone tried it? I don't have a BSD system to answer this question my self; we have ported X to SVR3 and are using streams instead of ptys. If it is supposed to work under BSD, I would like to get it working under SVR3 too. You see, looking at the code, I can't see how it could work: if (get_ty) { screen->respond = loginpty; #if !defined(SYSV) && !defined(LOCUS) if((tslot = ttyslot()) <= 0) SysError(ERROR_TSLOT); #endif } else if (am_slave) { screen->respond = am_slave; ptydev[strlen(ptydev) - 2] = ttydev[strlen(ttydev) - 2] = passedPty[0]; ptydev[strlen(ptydev) - 1] = ttydev[strlen(ttydev) - 1] = passedPty[1]; /* use the same tty name that everyone else will use ** (from ttyname) */ if (ptr = ttyname(ttydev)) { /* it may be bigger! */ ttydev = malloc((unsigned) (strlen(ptr) + 1)); (void) strcpy(ttydev, ptr); } #if !defined(SYSV) && !defined(LOCUS) if((tslot = ttyslot()) <= 0) SysError(ERROR_TSLOT2); #endif setgid (screen->gid); setuid (screen->uid); } else { Specifically, if the person who wrote this code is listening, why is ttyname() called with a char *, when both the SVR3 and BSD documentation says it takes an int, the file descriptor of an open tty? It is being passed a path string and returning a path string. What is the author trying to do in this code? If I can figure out his/her intentions, then maybe I could get the correct effect with streams-based pseudo-terminals. Note that the same ttyname() thing is done in main() in the -L case. Also, if anyone has a program that can be used to test the -S feature, could you please send it to me. To test, I think one just needs to fork and exec "xterm -Sccn", where n is fileno(stdout), and write to stdout. Is that right? Confused, Greg Holmberg Locus Computing Corp. ARPANET: bilbo.gregh@SEAS.UCLA.EDU UUCP: {ucivax,trwrb}!lcc!gregh {ihnp4,randvax,sdcrdcf,ucbvax,trwspp}!ucla-cs!lcc!gregh
ogata@leviathan.cs.umd.EDU (Jeff Ogata) (05/12/88)
If you look in XCreateTTY, you'll find it also tries to use xterm -S. Our XCreateTTY has never worked because of this; I suspect someone changed the -S xterm feature some and forgot to finish before they distributed it. That's all I know about the subject. - Jeff Ogata