jwwalker@opusc.csd.scarolina.edu (Jim Walker) (01/20/91)
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
jwwalker@opusc.csd.scarolina.edu (Jim Walker) (01/24/91)
In article <383@bria> writes: > >As for a better solution, why not simply make a termcap (or terminfo) >defintion for a terminal type 'regis'. Then, all you need is something >as simple as: > > if ( strcmp(getenv("TERM"),"regis") == 0 ) { [etc] >If you want some more specific help, then send me email. >-- >Michael Stefanik, Systems Engineer (JOAT), Briareus Corporation >UUCP: ...!uunet!bria!mike (I would have sent you email, but neither I nor my mail reader understand how to reply to your message.) The trouble with this suggestion is, how does the TERM environment variable get set correctly? It's normally set with the .login or .cshrc file, right? The trouble is that some of our users, especially grad students without terminals of their own, may log in on one type of terminal one day and another type the next. I myself have a VT330 (a ReGIS terminal) at work and a VT100 emulator at home. One could argue that something in the .login, rather than individual programs, should worry about querying the terminal. Anyway, I did get the details worked out, with the help of some GNU Emacs source code. -- -- Jim Walker 76367.2271@compuserve.com
mike (Michael Stefanik) (01/25/91)
In an article, Jim Walker writes: >The trouble with this suggestion is, how does the TERM environment variable >get set correctly? It's normally set with the .login or .cshrc file, >right? The trouble is that some of our users, especially grad students >without terminals of their own, may log in on one type of terminal one day >and another type the next. I myself have a VT330 (a ReGIS terminal) at >work and a VT100 emulator at home. Use tset(1). The TERM environment should be initially established by the logger; for modem ports and the like, an ambiguous terminal type (such as "dialup" or "unknown") is specified. Then, in .profile or whatever, you would have a line that looks like: eval `tset -h -m dialup:\?vt100 -s -Q -I` If you don't have the tset(1) program, it isn't terribly hard to find. -- Michael Stefanik, Systems Engineer (JOAT), Briareus Corporation UUCP: ...!uunet!bria!mike -- technoignorami (tek'no-ig'no-ram`i) a group of individuals that are constantly found to be saying things like "Well, it works on my DOS machine ..."