🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#145
From: Jawaid Bazyar
Date: Thu, 05 Nov 1992 18:22
34 lines
1973 bytes
voss@i40s16.ira.uka.de (Stefan Voss) writes:

>Hi C experts,

>thanx for the advice of converting '#pragma segement "foo"' to
>'segment "foo       ";'. Works great. Now the program I am trying to
>port to the GS (XLISP 2.0d) compiles and links with no errors.

>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 *\

  GNO's stdin channel is file descriptor 1, not 0.  0 was already special-
cased by GS/OS to mean "close or flush all files" in the Close and Flush
calls. Grr. :)  To be 100% correct as of POSIX and BSD 4.4 #include
<unistd.h> and specify "gtty(STDIN_FILENO, ..)".  You'll see those
references all through the GNO sample code.

>with gtty as usual defined as : 
>#define gtty(fd, arg)    (ioctl(fd, TIOCGETP, arg))
>The call to gtty returns -1 (i.e. an error) with the variable 
>errno set to 20 (ENOTTY).

  Your conclusion is wrong, as is the error message.  Thanks for 
discovering that. :)

  The GNO console is in fact a TTY.
-- 
 Jawaid Bazyar              |   Ask me about the GNO Multitasking Environment
 Procyon, Inc.              |   for the Apple IIgs!   
 bazyar@cs.uiuc.edu         |   P.O Box 620334
 --Apple II Forever!--      |   Littleton, CO 80162-0334   (303) 933-4649
Technical Details
Message-ID: <bazyar.720987769@teal>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.encore.com!csar!foxtail!sdd.hp.com!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!yuma!csn!teal!bazyar
References: <1dbal6INNlkt@iraul1.ira.uka.de>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.apple2.gno
Path: arc1-ca.pugleaf.net!sparky!uunet!news.encore.com!csar!foxtail!sdd.hp.com!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!yuma!csn!teal!bazyar
From: bazyar@teal.csn.org (Jawaid Bazyar)
Subject: Re: Is console a tty ? (was Re: segment sizes)
Message-ID: <bazyar.720987769@teal>
Keywords: gno, ioctl, tty
Sender: news@csn.org (news)
Nntp-Posting-Host: teal.csn.org
Organization: Colorado SuperNet, Inc.
References: <1dbal6INNlkt@iraul1.ira.uka.de>
Date: Thu, 5 Nov 1992 18:22:49 GMT
Lines: 34