Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!samsung!sol.ctr.columbia.edu!emory!hubcap!ncrcae!opusc!jwwalker From: jwwalker@opusc.csd.scarolina.edu (Jim Walker) Newsgroups: comp.unix.programmer Subject: How do you ask a terminal what it is? Message-ID: <1991Jan20.042402.24635@opusc.csd.scarolina.edu> Date: 20 Jan 91 04:24:02 GMT Sender: jwwalker@bigbird.csd.scarolina.edu Distribution: usa Organization: Univ. of South Carolina, Columbia, Dept. of Math. Lines: 33 I'm a UNIX novice, though not a programming novice, and I'm trying to figure out how a program can determine whether a DEC terminal is capable of ReGIS graphics. I don't know of any way to do that with standard Unix functions like stty. So I tried to write a program that would ask the terminal what it is. It almost works. Here's what I tried: #include "stdio.h" main () { int c; fputs("\033[c", stdout); c = getchar(); while ((c != EOF) && (c != 'c')) { if (c != '\033') putchar(c); printf( " = %d, ", c ); c = getchar(); } putchar('\n'); fflush(stdout); } What happens is that the terminal echos the response, something like ^[[?1;2c, and the cursor just sits there at the end of the line. If I then hit Return, the program proceeds and produces the expected output. Any expanations or alternatives? -- -- Jim Walker 76367.2271@compuserve.com