🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.apple2.gno
Article #152

Re: Is console a tty ? (was Re: segment sizes)

#152
From: mfrankow Michael Frankowski
Date: Fri, 06 Nov 1992 00:25
33 lines
1844 bytes
In article <1dbal6INNlkt@iraul1.ira.uka.de> voss@i40s16.ira.uka.de (Stefan Voss) writes:
>Hi C experts,
>
>But, one error vanished and another has arised.
>The code that deals with the operating system (originally Unix, now GNO)
>uses a lot of IOCTL-stuff. Especially, there is a line
>
>if (gtty(0, &savetty) == -1) { ... }; \* savetty being a struct sgttyb *\
>
>with gtty as usual defined as : 
>#define gtty(fd, arg)    (ioctl(fd, TIOCGETP, arg))
>

Okay, UNIX uses 0 (stdin), 1 (stdout), 2 (stderr), but GNO uses 1 (stdin),
2 (stdout), 3 (stderr).  So, basically, when dealing with the console or
any TTY, remember this simple rule and you will be set.  So, above, change
the getty(0, &savetty) call to getty(1, &savetty) and it should then work.

>The call to gtty returns -1 (i.e. an error) with the variable 
>errno set to 20 (ENOTTY).
>Conclusion: The current controlling terminal (GNO Console driver) isn't
>a tty (whatever that is).
>
>Can I make the GNO Console driver a tty ? (Perhaps, setting a variable ?)
>Or do I have to modify/throw out the source code ?
>
>Hope, somebody can help.

And I just did :)

>     Stefan Voss       (voss@ira.uka.de)

Mike
Technical Details
Message-ID: <1992Nov6.002519.22080@uc.msc.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!usc!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!msus1.msus.edu!gacvx2.gac.edu!noc.msc.net!uc.msc.edu!hamline.edu.!mfrankow
References: <1dbal6INNlkt@iraul1.ira.uka.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!usc!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!msus1.msus.edu!gacvx2.gac.edu!noc.msc.net!uc.msc.edu!hamline.edu.!mfrankow
Newsgroups: comp.sys.apple2.gno
Subject: Re: Is console a tty ? (was Re: segment sizes)
Message-ID: <1992Nov6.002519.22080@uc.msc.edu>
From: mfrankow@hamline.edu. (Michael Frankowski)
Date: Fri, 6 Nov 1992 00:25:19 GMT
Sender: netnews@uc.msc.edu (UC Network News)
References: <1dbal6INNlkt@iraul1.ira.uka.de>
Organization: Hamline University, St. Paul, Minnesota. [The Little U]
Keywords: gno, ioctl, tty
Lines: 33