diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c index 1745faa57ba0..0d84e75ff168 100644 --- a/usr.bin/tip/tip.c +++ b/usr.bin/tip/tip.c @@ -62,6 +62,7 @@ int disc = OTTYDISC; /* tip normally runs this way */ void intprompt(); void timeout(); void cleanup(); +void tipdone(); char *sname(); char PNbuf[256]; /* This limits the size of a number */ @@ -138,6 +139,7 @@ main(argc, argv) (void)signal(SIGQUIT, cleanup); (void)signal(SIGHUP, cleanup); (void)signal(SIGTERM, cleanup); + (void)signal(SIGUSR1, tipdone); if ((i = hunt(system)) == 0) { printf("all ports busy\n"); @@ -237,6 +239,11 @@ cleanup() exit(0); } +void +tipdone() +{ + tipabort("Hangup."); +} /* * Muck with user ID's. We are setuid to the owner of the lock * directory when we start. user_uid() reverses real and effective diff --git a/usr.bin/tip/tip.h b/usr.bin/tip/tip.h index 403e17f90c61..f1b833d74203 100644 --- a/usr.bin/tip/tip.h +++ b/usr.bin/tip/tip.h @@ -276,3 +276,5 @@ extern int disc; /* current tty discpline */ extern char *ctrl(); extern char *vinterp(); extern char *connect(); + +int tipabort __P((char *)); diff --git a/usr.bin/tip/tipout.c b/usr.bin/tip/tipout.c index 7288eb82c99c..246cfb7d67f9 100644 --- a/usr.bin/tip/tipout.c +++ b/usr.bin/tip/tipout.c @@ -136,6 +136,14 @@ tipout() sigblock(sigmask(SIGTERM)); intTERM(); /*NOTREACHED*/ + } else if (cnt == 0 && errno == ENOENT) { + kill(getppid(),SIGUSR1); + sigblock(sigmask(SIGTERM)); + intTERM(); + /*NOTREACHED*/ + } else { + printf("%d %d\r",cnt,errno); + fflush(stdout); } continue; }