Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site proper.UUCP Path: utzoo!watmath!clyde!burl!ulysses!harpo!seismo!hao!hplabs!intelca!proper!guy From: guy@proper.UUCP (Guy Hillyer ) Newsgroups: net.general Subject: utilities for Lear-Siegler ADM22 terminals Message-ID: <995@proper.UUCP> Date: Wed, 8-Feb-84 22:05:33 EST Article-I.D.: proper.995 Posted: Wed Feb 8 22:05:33 1984 Date-Received: Sat, 11-Feb-84 09:19:17 EST Organization: Proper UNIX, San Leandro, CA Lines: 112 Here are a couple of programs for reading and setting options on the Lear-Siegler ADM22 terminal. I would be interested to know if anyone finds these useful. -guy- (proper!guy) ---------------------adm22get.c------------------------- /* * command to get and print adm22 options. * * proper!guy 11-29-83 */ #include#include struct sgttyb ttyb; char rdln_command[2] = {'\033', '$'}; char stat_line[11]; main () { register int i; int noresponse(); gtty (2, &ttyb); ttyb.sg_flags |= RAW; stty (2, &ttyb); write (2, rdln_command, 2); signal (SIGALRM, noresponse); alarm (6); /* in case it isn't really an adm22 */ for (i = 0; i < 11; i++) read (0, stat_line + i, 1); ttyb.sg_flags &= ~RAW; stty (2, &ttyb); for (i = 0; i < 10; i++) printf ("%x ", stat_line[i] & 0xF); printf ("\n"); } noresponse () { ttyb.sg_flags &= ~RAW; stty (2, &ttyb); printf ("adm22get: No response from terminal\n"); exit (); } -----------------adm22set.c---------------------------- /* * command to set up adm22 options. * each argument is a value for a set-up nybble * as diplayed on the status line in set-up mode. * * proper!guy 11-29-83 */ #include struct sgttyb ttyb; char wrln_command[2] = {'\033', '%'}; char stat_line[10]; main (argc, argv) int argc; char *argv[]; { register int i; int j; int x; if (argc != 11) { printf("Proper usage is: %s <10 set up values>\n", argv[0]); exit (); } gtty (1, &ttyb); ttyb.sg_flags |= RAW; stty (1, &ttyb); for (i = 0; i < 10; i++) { sscanf (argv[i+1], "%x", &x); stat_line[i] = x & 0xF; } write (1, wrln_command, 2); for (i=0; i < 10; i++) { for (j=0; j < 10000; j++); /* a brief delay */ write (1, stat_line + i, 1); } ttyb.sg_flags &= ~RAW; stty (1, &ttyb); }