lee@sq.sq.com (Liam R. E. Quin) (08/23/90)
X11 R4 xterm has a -S option that takes the last two characters of a terminal name ("p3" for /dev/ttyp3, for example) and the number of a file descriptor, so you can do xterm -Sp312 to read from file descriptor 12 on /dev/ttyp3. It works unless the file descriptor is zero, in which case the test in the code seems to be incorrect. Here is a (totally unofficial and not tested) patch. I don't seem to be able to recompile xterm without remaking all of the libraries, or spending hours hacking the makefile to use -lX11 instead of ../../lib/X/X11 and so on, sorry. In any case it seems better to test the return value of sscanf() in the following code. Lee Directory: /usr/src/x/mit/clients/xterm *** main.c.orig Wed Aug 22 16:09:47 1990 --- main.c Wed Aug 22 16:13:11 1990 *************** *** 722,730 **** #endif /* TIOCCONS */ continue; case 'S': ! sscanf(*argv + 2, "%c%c%d", passedPty, passedPty+1, ! &am_slave); ! if (am_slave <= 0) Syntax(*argv); continue; #ifdef DEBUG case 'D': --- 722,731 ---- #endif /* TIOCCONS */ continue; case 'S': ! if (sscanf(*argv + 2, "%c%c%d", passedPty, passedPty+1, ! &am_slave) != 3) { ! Syntax(*argv); ! } continue; #ifdef DEBUG case 'D': -- Liam R. E. Quin, lee@sq.com, {utai,utzoo}!sq!lee, SoftQuad Inc., Toronto Nicholas: [...] The best/ Thing we can do is to make wherever we're lost in Look as much like home as we can. [Christopher Fry, The Lady's Not For Burning]
arne@rrzbu.hanse.de (Arne Ludwig) (09/03/90)
lee@sq.sq.com (Liam R. E. Quin) writes: >Here is a (totally unofficial and not tested) patch. I don't seem to >be able to recompile xterm without remaking all of the libraries, or >spending hours hacking the makefile to use -lX11 instead of ../../lib/X/X11 >and so on, sorry. Use xmkmf. Or alternatively imake -DUseInstalled -I<local-config> >In any case it seems better to test the return value of sscanf() in the >following code. This is a bad idea. Berkeley sscanf returned "char *" instead of "int", causing your patch to fail on many systems. -- Arne Ludwig arne@rrzbu.hanse.de ...uunet!??????!rrzbu!arne