🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1294

Re: Exiting a program logs me out!

#1294
From: the main man
Date: Wed, 28 Nov 1990 15:53
35 lines
2228 bytes
In article <4366@lib.tmc.edu>, jmaynard@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@tndsyd.oz       UUCP: uunet!munnari.oz!tndsyd.oz.au!berny |
| INTERNET: berny@tndsyd.oz.au  DOMAIN: goodheart_berny@tandem.com          |
|   PSMAIL: smtpgate @comm(berny@tndsyd.oz@munnari.oz.au)                   |
|  FIDONET: berny@f614.n713.z3.fidonet.org@tndsyd.oz.au  (3:713/614.0)      |
`==========================================================================='
TANDEM Computers Incorporated 76 Berry St, North Sydney, NSW, 2060, Australia
Technical Details
Message-ID: <531@tndsyd.oz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!munnari.oz.au!mel.dit.csiro.au!yarra!pta!tndsyd!root
References: <4366@lib.tmc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!munnari.oz.au!mel.dit.csiro.au!yarra!pta!tndsyd!root
From: root@tndsyd.oz (the main man)
Newsgroups: comp.unix.programmer
Subject: Re: Exiting a program logs me out!
Message-ID: <531@tndsyd.oz>
Date: 28 Nov 90 15:53:52 GMT
References: <4366@lib.tmc.edu>
Organization: TANDEM Computers Incorporated, Sydney, NSW, Australia
Lines: 35