🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.programmer
1 messages
1 total messages Started by Jay Maynard Mon, 26 Nov 1990 12:40
Logoff after exiting program - the answer
#1282
Author: Jay Maynard
Date: Mon, 26 Nov 1990 12:40
35 lines
2404 bytes
Well, it turns out that I wasn't doing enough. Not only do you have to save
and restore the termio values (via saving a copy of the original termio
structure and using it as the argument of a TCSETA ioctl()), but, at least
on my NCR Tower XP, you also have to save the file status flags via
fcntl(0,F_GETFL,0) and restore them by fcntl(0,F_SETFL,saved_value).

I've gotten two responses:
Raymond Chen (raymond@math.berkeley.edu) suggested that I was tickling a
known csh bug; the description bears repeating:
>First, a few guesses:
>[1] You're running csh.
>[2] It doesn't log you out immediately, but rather as soon as you
>type anything, it acts as if you typed Ctrl-D and logs you out.
>If [1] and [2] are true, then my vague memory tells me that this is
>a known csh bug that occurs when somebody leaves the tty in a funky state.
>(Has to do with the wrong parity or something.)
This was a nice guess...but I'm running sh.

Joe English (jeenglis@alcor.usc.edu) came close...  
>You didn't specify which termio calls you used, but I've got a guess
>as to what might be wrong (I had the same problem once.)
>If you set the terminal to use non-blocking, asynchronous I/O, and
>don't reset it before exiting, when the shell tries to read a command
>line it gets zero bytes back, which it interprets as an end-of-file.
>(The fix is to restore the terminal to cooked, blocking mode before
>exiting.)  If you're using csh, you can 'set ignoreeof' to check if
>this really is the problem.
It turns out that he's right; the problem is that there's more state than
just the termio structure. (Argh!)

Thanks for your help...once again, the net comes through!
-- 
Jay Maynard, EMT-P, K5ZC, PP-ASEL | Never ascribe to malice that which can
jmaynard@thesis1.hsch.utexas.edu  | adequately be explained by stupidity.
         "With design like this, who needs bugs?" - Boyd Roberts
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads