=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/top/top.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- src/usr.bin/top/top.c 2005/12/04 23:10:06 1.41 +++ src/usr.bin/top/top.c 2006/03/04 06:54:18 1.42 @@ -1,4 +1,4 @@ -/* $OpenBSD: top.c,v 1.41 2005/12/04 23:10:06 tedu Exp $ */ +/* $OpenBSD: top.c,v 1.42 2006/03/04 06:54:18 otto Exp $ */ /* * Top users/processes display for Unix @@ -499,6 +499,15 @@ /* wait for the rest of it .... */ pause(); + if (leaveflag) + exit(0); + if (tstopflag) { + (void) signal(SIGTSTP, SIG_DFL); + (void) kill(0, SIGTSTP); + /* reset the signal handler */ + (void) signal(SIGTSTP, tstop); + tstopflag = 0; + } } else { while (no_command) if (rundisplay()) @@ -536,10 +545,8 @@ pfd[0].fd = STDIN_FILENO; pfd[0].events = POLLIN; - if (leaveflag) { - end_screen(); - exit(0); - } + if (leaveflag) + quit(0); if (tstopflag) { /* move to the lower left */ end_screen();