Subject: patch to tip so you can use it from shell scripts
To: None <netbsd-bugs@sun-lamp.cs.berkeley.edu>
From: Marc Mengel <mengel@mwm.chi.il.us.chi.il.us>
List: netbsd-bugs
Date: 02/21/1994 23:21:16
	The following is a patch so you can do stuff like;

	(
		sleep 30
		echo -n "do something^M"
		sleep 1
		echo -n "~.^M"
		sleep 1
	) | tip host | analyze_results

	in a shell script, for doing automatic slip dialup, etc.
	Mostly just ditches the check for isatty(0), and tries
	to pass on SIGPIPE, in case tip is being piped into another
	command.  Anyhow, it works for me...

Marc
- - - - - - - - - - - - - cut here - - - - - - - - - - - -
*** 1.2	1994/02/06 20:51:04
--- 1.1	1994/02/06 20:36:03
***************
*** 87,98 ****
  		fprintf(stderr, "usage: tip [-v] [-speed] [system-name]\n");
  		exit(1);
  	}
! /*
  	if (!isatty(0)) {
  		fprintf(stderr, "tip: must be interactive\n");
  		exit(1);
  	}
- */
  
  	for (; argc > 1; argv++, argc--) {
  		if (argv[1][0] != '-')
--- 87,97 ----
  		fprintf(stderr, "usage: tip [-v] [-speed] [system-name]\n");
  		exit(1);
  	}
! 
  	if (!isatty(0)) {
  		fprintf(stderr, "tip: must be interactive\n");
  		exit(1);
  	}
  
  	for (; argc > 1; argv++, argc--) {
  		if (argv[1][0] != '-')
***************
*** 140,146 ****
  	(void)signal(SIGQUIT, cleanup);
  	(void)signal(SIGHUP, cleanup);
  	(void)signal(SIGTERM, cleanup);
- 	(void)signal(SIGPIPE, cleanup);
  
  	if ((i = hunt(system)) == 0) {
  		printf("all ports busy\n");
--- 139,144 ----
***************
*** 236,242 ****
  
  	daemon_uid();
  	(void)uu_unlock(uucplock);
- 	kill(pid,SIGTERM);
  	if (odisc)
  		ioctl(0, TIOCSETD, (char *)&odisc);
  	exit(0);
--- 234,239 ----

------------------------------------------------------------------------------