🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #6256

How to read terminal reports from a C program, Help !

#6256
From: Francis Demierre
Date: Wed, 28 Feb 1990 21:48
29 lines
1671 bytes
Hi Netland !

I was trying today to write a routine that would query the status of a printer
connected to a vt320 terminal.

To get a printer status report, an escape sequence is to be sent to the terminal
( ^[[?12n as far as I remember). The terminal will then generate a reply 
escape sequence such as ^[[?10n (Printer not connected).

My question is:

Under UNIX from a C program, how do you read the reply from the terminal ?
(as far as I could experiment, the reply comes back on stdin...)

Let's say I send the query with somwething like 'puts("\033[?12n");', how
do I read the answer of the terminal. I would also like to use a similar
method to read the terminal setting (VT100, VT220 or VT320 mode) and
the function keys content. What is the magic ?

Thank you in anticipation !
(answers preferably by Email as this is probably a "green horns" question ;-) )

BTW: I need a portable code that would run on RT AIX, PS2 AIX, XENIX and
     ULTRIX if it is possible.

-------------------------------------------------------------------------------
Francis Demierre       UUCP: ...!mcvax!cernvax!hslrswi!francis
                       Unix mail: francis@hslrswi.UUCP
-------------------------------------------------------------------------------
Technical Details
Message-ID: <1107@hslrswi.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!cernvax!chx400!hslrswi!francis

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!cernvax!chx400!hslrswi!francis
From: francis@hslrswi.UUCP (Francis Demierre)
Newsgroups: comp.std.c,comp.unix.wizards
Subject: How to read terminal reports from a C program, Help !
Message-ID: <1107@hslrswi.UUCP>
Date: 28 Feb 90 21:48:47 GMT
Organization: Hasler AG, CH-3000 Berne 14, Switzerland
Lines: 29