Exiting a program logs me out!

the main man root at tndsyd.oz
Thu Nov 29 02:53:52 AEST 1990


In article <4366 at lib.tmc.edu>, jmaynard at thesis1.hsch.utexas.edu (Jay Maynard) writes:
> 
> I'm trying to get the dte editor, which was recently posted to
> comp.binaries.ibm.pc, to work on my System V. The author, Douglas Thomson,
> included complete source, as well as an I/O module for HP-UX. Unfortunately,
> it used the TIOCGETA and TIOCSETA functions and the sgttyb structure, which
> aren't supported under vanilla System V. I figured out how to convert them to
> termio calls, and got everything to compile.
> 
> When I run the program, though, it runs fine until I exit. It then gives me a
> shell prompt - and then logs me off.
> 

I don't know the editor you talk about but if it uses CURSES then the 
problem may be inherent in libcurses.a. 

In some versions of CURSES (specifically in early System V), if nodelay() is
set somewhere in your program and not reset before the program exits, an EOF
is sent to the parent process that spawned the program. If the parent process
is the login shell then the user is logged off the system.

The trick is to place a line of code:
	nodelay(stdscr,FALSE);
just before calling endwin() in the exiting stages of your program.

Of course all this assumes the program uses CURSES.


.===========================================================================.
|   ACSnet: berny at tndsyd.oz       UUCP: uunet!munnari.oz!tndsyd.oz.au!berny |
| INTERNET: berny at tndsyd.oz.au  DOMAIN: goodheart_berny at tandem.com          |
|   PSMAIL: smtpgate @comm(berny at tndsyd.oz@munnari.oz.au)                   |
|  FIDONET: berny at f614.n713.z3.fidonet.org@tndsyd.oz.au  (3:713/614.0)      |
`==========================================================================='
TANDEM Computers Incorporated 76 Berry St, North Sydney, NSW, 2060, Australia



More information about the Comp.unix.programmer mailing list