[fa.info-mac] macput/get over a rlogin line

info-mac@uw-beaver (info-mac) (12/02/84)

From: John Foderaro (on a mac) <jkf@ucbmike>
 The following changes allow you to use macput and macget over a
4.2bsd  rlogin connection.  I sent a message about this a few months
ago but I wasn't able to verify that it works because I didn't have a
mac at the time.  Now that I do I have verified that it works.

 The fixed macput/macget will only work if you tell rlogin to pass all 8
bits with the -8 flag.  You should also turn off the escape character
if you want to be perfectly safe.
For example:
% rlogin machinename -8 -e

 These fixes are to the latest versions found on sumex-aim (which is one
version later than that distributed with sumacc 2.0).  The changes will
also work with old versions of macget and macput (but the line numbers
affected will be different).

*** old-macget.c	Fri Nov 30 22:31:06 1984
--- macget.c	Fri Nov 30 23:05:22 1984
***************
*** 88,93
   * revised ddj 7/16/84 -- protocol changes for MacTerminal Beta Version 0.5X
   * revised ddj 7/31/84 -- pre-4.2 signal bugs fixed in timedout()
   * revised ddj 11/7/84 -- renamed send_sync() -> get_sync()
   */
  char usage[] = "usage: \"macget [-o] [-rdu] [filename]\"\n";
  

--- 88,95 -----
   * revised ddj 7/16/84 -- protocol changes for MacTerminal Beta Version 0.5X
   * revised ddj 7/31/84 -- pre-4.2 signal bugs fixed in timedout()
   * revised ddj 11/7/84 -- renamed send_sync() -> get_sync()
+  * revised jkf 11/30/84 -- turn off flow control in setup_tty so it works
+  *			  over a rlogin line (as long as 'rlogin -8' is done)
   */
  char usage[] = "usage: \"macget [-o] [-rdu] [filename]\"\n";
  
***************
*** 414,419
  }
  
  static struct sgttyb otty, ntty;
  /* should turn messages off */
  
  setup_tty()

--- 416,422 -----
  }
  
  static struct sgttyb otty, ntty;
+ static struct tchars OldTchars, NewTchars;
  /* should turn messages off */
  
  setup_tty()
***************
*** 424,429
  	ttyf = stdin;
  	ttyfd = fileno(stdout);
  	ioctl(ttyfd, TIOCGETP, &otty);
  	signal(SIGHUP, cleanup);
  	signal(SIGINT, cleanup);
  	signal(SIGQUIT, cleanup);

--- 427,433 -----
  	ttyf = stdin;
  	ttyfd = fileno(stdout);
  	ioctl(ttyfd, TIOCGETP, &otty);
+ 	ioctl(ttyfd, TIOCGETC, &OldTchars);
  	signal(SIGHUP, cleanup);
  	signal(SIGINT, cleanup);
  	signal(SIGQUIT, cleanup);
***************
*** 432,437
  	ntty = otty;
  	ntty.sg_flags = RAW|ANYP;
  	ioctl(ttyfd, TIOCSETP, &ntty);
  }
  
  reset_tty()

--- 436,445 -----
  	ntty = otty;
  	ntty.sg_flags = RAW|ANYP;
  	ioctl(ttyfd, TIOCSETP, &ntty);
+ 	NewTchars = OldTchars;
+ 	NewTchars.t_startc = NewTchars.t_stopc = -1; /* kill stop and start */
+ 	ioctl(ttyfd, TIOCSETC, &NewTchars);
+ 
  }
  
  reset_tty()
***************
*** 437,442
  reset_tty()
  {
  	sleep(2);	/* should wait for output to drain */
  	ioctl(ttyfd, TIOCSETP, &otty);
  }
  

--- 445,451 -----
  reset_tty()
  {
  	sleep(2);	/* should wait for output to drain */
+ 	ioctl(ttyfd, TIOCSETC, &OldTchars);
  	ioctl(ttyfd, TIOCSETP, &otty);
  }
  
*** old-macput.c	Fri Nov 30 22:27:14 1984
--- macput.c	Fri Nov 30 23:06:07 1984
***************
*** 103,108
   * revised ddj 7/31/84 -- moved forge_info() call ahead of send_sync()
   * revised ddj 11/6/84 -- added sleep(5) after send_sync to give mac time to
   *	turn off xon mode, set up sio chip, and put up progress indicator
   */
  char usage[] =
      "usage: \"macput [-o] [-rdu] [-t type] [-a author] [-n name] filename\"\n";

--- 103,110 -----
   * revised ddj 7/31/84 -- moved forge_info() call ahead of send_sync()
   * revised ddj 11/6/84 -- added sleep(5) after send_sync to give mac time to
   *	turn off xon mode, set up sio chip, and put up progress indicator
+  * revised jkf 11/30/84 -- turn off flow control in setup_tty so it works
+  *			  over a rlogin line (as long as 'rlogin -8' is done)
   */
  char usage[] =
      "usage: \"macput [-o] [-rdu] [-t type] [-a author] [-n name] filename\"\n";
***************
*** 431,436
  }
  
  static struct sgttyb otty, ntty;
  /* should turn messages off */
  
  setup_tty()

--- 433,439 -----
  }
  
  static struct sgttyb otty, ntty;
+ static struct tchars OldTchars, NewTchars;
  /* should turn messages off */
  
  setup_tty()
***************
*** 441,446
  	ttyf = stdin;
  	ttyfd = fileno(stdout);
  	ioctl(ttyfd, TIOCGETP, &otty);
  	signal(SIGHUP, cleanup);
  	signal(SIGINT, cleanup);
  	signal(SIGQUIT, cleanup);

--- 444,450 -----
  	ttyf = stdin;
  	ttyfd = fileno(stdout);
  	ioctl(ttyfd, TIOCGETP, &otty);
+ 	ioctl(ttyfd, TIOCGETC, &OldTchars);
  	signal(SIGHUP, cleanup);
  	signal(SIGINT, cleanup);
  	signal(SIGQUIT, cleanup);
***************
*** 449,454
  	ntty = otty;
  	ntty.sg_flags = RAW|ANYP;
  	ioctl(ttyfd, TIOCSETP, &ntty);
  }
  
  reset_tty()

--- 453,462 -----
  	ntty = otty;
  	ntty.sg_flags = RAW|ANYP;
  	ioctl(ttyfd, TIOCSETP, &ntty);
+ 	NewTchars = OldTchars;
+ 	NewTchars.t_startc = NewTchars.t_stopc = -1; /* kill stop and start */
+ 	ioctl(ttyfd, TIOCSETC, &NewTchars);
+ 	
  }
  
  reset_tty()
***************
*** 455,460
  {
  	if (ttyf != NULL) {
  		sleep(2);	/* should wait for output to drain */
  		ioctl(ttyfd, TIOCSETP, &otty);
  	}
  }

--- 463,469 -----
  {
  	if (ttyf != NULL) {
  		sleep(2);	/* should wait for output to drain */
+ 		ioctl(ttyfd, TIOCSETC, &OldTchars);
  		ioctl(ttyfd, TIOCSETP, &otty);
  	}
  }