🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#185
From: Stefan Voss
Date: Wed, 11 Nov 1992 13:17
31 lines
1532 bytes
In article <bazyar.720987769@teal> Jawaid Bazyar writes:
> ...
> 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.

Well, I followed Jawaid's proposal and replaced "gtty(0, ...)" with
"gtty(STDIN_FILENO, ..)", but this doesn't fix the problem. Try this program:

#include <sys/ioctl.h>
#include <unistd.h>

struct sgttyb savetty;
#define gtty(fd,arg)    (ioctl(fd, TIOCGETP, arg))
#define stty(fd,arg)    (ioctl(fd, TIOCSETP, arg))

main()
{
	if (gtty(STDIN_FILENO, &savetty) == -1) 
		printf("Error\n");
	else printf("No Error\n");
}

In my configuration (ORCA/C 1.3, Linker 2.0, GNO 1.0) the call to gtty returns
still -1 (error) and "Error" is printed on my screen, though the components
of variable "savetty" seem to be set up correctly after the call.

I think I'm going to ignore the bad result. Any comments ?

     Stefan Voss        (voss@ira.uka.de)
 
Technical Details
Message-ID: <1dr158INNqc0@iraul1.ira.uka.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!sdd.hp.com!spool.mu.edu!yale.edu!ira.uka.de!uka!i43s6!voss
References: <1dbal6INNlkt@iraul1.ira.uka.de> <bazyar.720987769@teal>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!sdd.hp.com!spool.mu.edu!yale.edu!ira.uka.de!uka!i43s6!voss
From: voss@i43s6.ira.uka.de (Stefan Voss)
Newsgroups: comp.sys.apple2.gno
Subject: Re: Is console a tty ? (was Re: segment sizes)
Date: 11 Nov 1992 13:17:28 GMT
Organization: University of Karlsruhe, FRG
Lines: 37
Distribution: world
Message-ID: <1dr158INNqc0@iraul1.ira.uka.de>
References: <1dbal6INNlkt@iraul1.ira.uka.de> <bazyar.720987769@teal>
NNTP-Posting-Host: i43s6.ira.uka.de
Keywords: gno, ioctl, tty