4.2 tip CONNECT features

Jim Ziobro z at rocksvax.UUCP
Sat Jul 20 05:34:12 AEST 1985


> I noticed that 4.2 tip had an extra command "~C" to connect a program to the
> remote line.  As it was it wasn't very useful since file descriptors 4 and 5 
> were the remote line after fork.  I changed it so the remote line is file
> descriptors 0 and 1 and it seems to open up a whole world of possibilities.
>
Here are the changes.  Really only 3 lines of code changed.  The line
numbers will probably be different for your version since our version has
been hacked tremendously.  Also remember to add -DCONNECT to CFLAGS in
the Makefile.


*** cmds.c	Fri Jul 19 15:19:29 1985
--- cmds.c.CKP	Thu Jul 18 16:44:12 1985
***************
*** 1,5
  #ifndef lint
! static char *RCSid = "$Header: cmds.c,v 1.7 85/07/18 21:13:18 z Exp $";
  #endif
  
  /*

--- 1,5 -----
  #ifndef lint
! static char *RCSid = "$Header: cmds.c,v 1.6 85/07/18 16:42:25 root Exp $";
  #endif
  
  /*
***************
*** 4,13
  
  /*
   * $Log:	cmds.c,v $
-  * Revision 1.7  85/07/18  21:13:18  z
-  * Changed consh() [~C command] to connect remote tty to stdin and stdout
-  * of command.
-  * 
   * Revision 1.6  85/07/18  16:42:25  root
   * 1) Added a XMODEM hack and associated stuff for that
   * 

--- 4,9 -----
  
  /*
   * $Log:	cmds.c,v $
   * Revision 1.6  85/07/18  16:42:25  root
   * 1) Added a XMODEM hack and associated stuff for that
   * 
***************
*** 462,469
  #ifdef CONNECT
  /*
   * Fork a program with:
!  *  0 <-> remote tty in
!  *  1 <-> remote tty out
   *  2 <-> local tty out
   */
  consh(c)

--- 458,465 -----
  #ifdef CONNECT
  /*
   * Fork a program with:
!  *  0 <-> local tty in
!  *  1 <-> local tty out
   *  2 <-> local tty out
   *  3 <-> remote tty in
   *  4 <-> remote tty out
***************
*** 465,470
   *  0 <-> remote tty in
   *  1 <-> remote tty out
   *  2 <-> local tty out
   */
  consh(c)
  {

--- 461,468 -----
   *  0 <-> local tty in
   *  1 <-> local tty out
   *  2 <-> local tty out
+  *  3 <-> remote tty in
+  *  4 <-> remote tty out
   */
  consh(c)
  {
***************
*** 493,501
  	} else {
  		register int i;
  
! 		dup2(FD, 1);
! 		dup2(3, 0);
! 		for (i = 3; i < 20; i++)
  			close(i);
  		signal(SIGINT, SIG_DFL);
  		signal(SIGQUIT, SIG_DFL);

--- 491,499 -----
  	} else {
  		register int i;
  
! 		dup2(FD, 3);
! 		dup2(3, 4);
! 		for (i = 5; i < 20; i++)
  			close(i);
  		signal(SIGINT, SIG_DFL);
  		signal(SIGQUIT, SIG_DFL);
-- 
//Z\\
James M. Ziobro
Ziobro.Henr at Xerox.COM
{rochester,amd,sunybcs,allegra}!rocksvax!z



More information about the Comp.unix.wizards mailing list