tomw@orac.esd.sgi.com (Tom Weinstein) (09/14/90)
Submitted-by: Tom Weinstein <tomw@orac.esd.sgi.com> Posting-number: Volume 9, Issue 41 Archive-name: colxterm/part11 #! /bin/sh # This is a shell archive. Remove anything before this line, then feed it # into a shell via "sh file" or similar. To overwrite existing files, # type "sh file -c". # The tool that generated this appeared in the comp.sources.unix newsgroup; # send mail to comp-sources-unix@uunet.uu.net if you want that tool. # If this archive is complete, you will see the following message at the end: # "End of archive 11 (of 14)." # Contents: xterm/README xterm/TekPrsTbl.c.ab xterm/resize.c # xterm/screen.c # Wrapped by argv@turnpike on Thu Sep 13 20:42:33 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'xterm/README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xterm/README'\" else echo shar: Extracting \"'xterm/README'\" \(773 characters\) sed "s/^X//" >'xterm/README' <<'END_OF_FILE' X Abandon All Hope, Ye Who Enter Here X X XThis is undoubtedly the most ugly program in the distribution. It was one of Xthe first "serious" programs ported, and still has a lot of historical baggage. XIdeally, there would be a general tty widget and then vt102 and tek4014 Xsubwidgets so that they could be used in other programs. We are trying to Xclean things up as we go, but there is still a lot of work to do. X XIf you are porting this to a machine that has problems with overlapping Xbcopy's, watch out! X XTwo lists of Control Sequences are provided. The file ctlseq.ms is based on Xthe X10 document, with minor and far from sufficient edits. The file Xctlseq2.txt is the result of someone walking through the code. Ideally, Xthe two should be merged into one document. X END_OF_FILE if test 773 -ne `wc -c <'xterm/README'`; then echo shar: \"'xterm/README'\" unpacked with wrong size! fi # end of 'xterm/README' fi if test -f 'xterm/TekPrsTbl.c.ab' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xterm/TekPrsTbl.c.ab'\" else echo shar: Extracting \"'xterm/TekPrsTbl.c.ab'\" \(19647 characters\) sed "s/^X//" >'xterm/TekPrsTbl.c.ab' <<'END_OF_FILE' XCASE_IGNORE, X/* udiaeresis yacute thorn ydiaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X}; X Xint Tesctable[] = { X/* NUL SOH STX ETX */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_VT_MODE, X/* EOT ENQ ACK BEL */ XCASE_CURSTATE, XCASE_REPORT, XCASE_CURSTATE, XCASE_BEL, X/* BS HT NL VT */ XCASE_BS, XCASE_TAB, XCASE_IGNORE, XCASE_UP, X/* NP CR SO SI */ XCASE_PAGE, XCASE_IGNORE, XCASE_APL, XCASE_ASCII, X/* DLE DC1 DC2 DC3 */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* DC4 NAK SYN ETB */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_COPY, X/* CAN EM SUB ESC */ XCASE_BYP_STATE, XCASE_CURSTATE, XCASE_GIN, XCASE_IGNORE, X/* FS GS RS US */ XCASE_SPT_STATE, XCASE_PLT_STATE, XCASE_IPL_STATE, XCASE_ALP_STATE, X/* SP ! " # */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* $ % & ' */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* ( ) * + */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* , - . / */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* 0 1 2 3 */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* 4 5 6 7 */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* 8 9 : ; */ XCASE_CHAR_SIZE, XCASE_CHAR_SIZE, XCASE_CHAR_SIZE, XCASE_CHAR_SIZE, X/* < = > ? */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* @ A B C */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* D E F G */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* H I J K */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* L M N O */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* P Q R S */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* T U V W */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* X Y Z [ */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* \ ] ^ _ */ XCASE_CURSTATE, XCASE_OSC, XCASE_CURSTATE, XCASE_CURSTATE, X/* ` a b c */ XCASE_BEAM_VEC, XCASE_BEAM_VEC, XCASE_BEAM_VEC, XCASE_BEAM_VEC, X/* d e f g */ XCASE_BEAM_VEC, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_BEAM_VEC, X/* h i j k */ XCASE_BEAM_VEC, XCASE_BEAM_VEC, XCASE_BEAM_VEC, XCASE_BEAM_VEC, X/* l m n o */ XCASE_BEAM_VEC, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_BEAM_VEC, X/* p q r s */ XCASE_BEAM_VEC, XCASE_BEAM_VEC, XCASE_BEAM_VEC, XCASE_BEAM_VEC, X/* t u v w */ XCASE_BEAM_VEC, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_BEAM_VEC, X/* x y z { */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, XCASE_CURSTATE, X/* | } ~ DEL */ XCASE_CURSTATE, XCASE_CURSTATE, XCASE_IGNORE, XCASE_CURSTATE, X/* 0x80 0x81 0x82 0x83 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x84 0x85 0x86 0x87 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x88 0x89 0x8a 0x8b */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x8c 0x8d 0x8e 0x8f */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x90 0x91 0x92 0x93 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x94 0x95 0x96 0x97 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x99 0x99 0x9a 0x9b */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x9c 0x9d 0x9e 0x9f */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* nobreakspace exclamdown cent sterling */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* currency yen brokenbar section */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* diaeresis copyright ordfeminine guillemotleft */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* notsign hyphen registered macron */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* degree plusminus twosuperior threesuperior */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* acute mu paragraph periodcentered */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* cedilla onesuperior masculine guillemotright */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* onequarter onehalf threequarters questiondown */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Agrave Aacute Acircumflex Atilde */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Adiaeresis Aring AE Ccedilla */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Egrave Eacute Ecircumflex Ediaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Igrave Iacute Icircumflex Idiaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Eth Ntilde Ograve Oacute */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Ocircumflex Otilde Odiaeresis multiply */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Ooblique Ugrave Uacute Ucircumflex */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Udiaeresis Yacute Thorn ssharp */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* agrave aacute acircumflex atilde */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* adiaeresis aring ae ccedilla */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* egrave eacute ecircumflex ediaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* igrave iacute icircumflex idiaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* eth ntilde ograve oacute */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* ocircumflex otilde odiaeresis division */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* oslash ugrave uacute ucircumflex */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* udiaeresis yacute thorn ydiaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X}; X Xint Tipltable[] = { X/* NUL SOH STX ETX */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* EOT ENQ ACK BEL */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_BEL, X/* BS HT NL VT */ XCASE_BS, XCASE_TAB, XCASE_LF, XCASE_UP, X/* NP CR SO SI */ XCASE_IGNORE, XCASE_CR, XCASE_IGNORE, XCASE_IGNORE, X/* DLE DC1 DC2 DC3 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* DC4 NAK SYN ETB */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* CAN EM SUB ESC */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_ESC_STATE, X/* FS GS RS US */ XCASE_PT_STATE, XCASE_PLT_STATE, XCASE_IPL_STATE, XCASE_ALP_STATE, X/* SP ! " # */ XCASE_PENUP, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* $ % & ' */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* ( ) * + */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* , - . / */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0 1 2 3 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 4 5 6 7 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 8 9 : ; */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* < = > ? */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* @ A B C */ XCASE_IGNORE, XCASE_IPL_POINT, XCASE_IPL_POINT, XCASE_IGNORE, X/* D E F G */ XCASE_IPL_POINT, XCASE_IPL_POINT, XCASE_IPL_POINT, XCASE_IGNORE, X/* H I J K */ XCASE_IPL_POINT, XCASE_IPL_POINT, XCASE_IPL_POINT, XCASE_IGNORE, X/* L M N O */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* P Q R S */ XCASE_PENDOWN, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* T U V W */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* X Y Z [ */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* \ ] ^ _ */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* ` a b c */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* d e f g */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* h i j k */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* l m n o */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* p q r s */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* t u v w */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* x y z { */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* | } ~ DEL */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x80 0x81 0x82 0x83 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x84 0x85 0x86 0x87 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x88 0x89 0x8a 0x8b */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x8c 0x8d 0x8e 0x8f */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x90 0x91 0x92 0x93 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x94 0x95 0x96 0x97 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x99 0x99 0x9a 0x9b */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x9c 0x9d 0x9e 0x9f */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* nobreakspace exclamdown cent sterling */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* currency yen brokenbar section */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* diaeresis copyright ordfeminine guillemotleft */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* notsign hyphen registered macron */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* degree plusminus twosuperior threesuperior */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* acute mu paragraph periodcentered */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* cedilla onesuperior masculine guillemotright */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* onequarter onehalf threequarters questiondown */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Agrave Aacute Acircumflex Atilde */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Adiaeresis Aring AE Ccedilla */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Egrave Eacute Ecircumflex Ediaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Igrave Iacute Icircumflex Idiaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Eth Ntilde Ograve Oacute */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Ocircumflex Otilde Odiaeresis multiply */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Ooblique Ugrave Uacute Ucircumflex */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Udiaeresis Yacute Thorn ssharp */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* agrave aacute acircumflex atilde */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* adiaeresis aring ae ccedilla */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* egrave eacute ecircumflex ediaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* igrave iacute icircumflex idiaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* eth ntilde ograve oacute */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* ocircumflex otilde odiaeresis division */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* oslash ugrave uacute ucircumflex */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* udiaeresis yacute thorn ydiaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X}; X Xint Tplttable[] = { X/* NUL SOH STX ETX */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* EOT ENQ ACK BEL */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_BEL, X/* BS HT NL VT */ XCASE_BS, XCASE_TAB, XCASE_LF, XCASE_UP, X/* NP CR SO SI */ XCASE_IGNORE, XCASE_CR, XCASE_IGNORE, XCASE_IGNORE, X/* DLE DC1 DC2 DC3 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* DC4 NAK SYN ETB */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* CAN EM SUB ESC */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_ESC_STATE, X/* FS GS RS US */ XCASE_PT_STATE, XCASE_PLT_STATE, XCASE_IPL_STATE, XCASE_ALP_STATE, X/* SP ! " # */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* $ % & ' */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* ( ) * + */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* , - . / */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* 0 1 2 3 */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* 4 5 6 7 */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* 8 9 : ; */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* < = > ? */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* @ A B C */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* D E F G */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* H I J K */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* L M N O */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* P Q R S */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* T U V W */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* X Y Z [ */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* \ ] ^ _ */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* ` a b c */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* d e f g */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* h i j k */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* l m n o */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* p q r s */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* t u v w */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* x y z { */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* | } ~ DEL */ XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, XCASE_PLT_VEC, X/* 0x80 0x81 0x82 0x83 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x84 0x85 0x86 0x87 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x88 0x89 0x8a 0x8b */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x8c 0x8d 0x8e 0x8f */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x90 0x91 0x92 0x93 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x94 0x95 0x96 0x97 */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x99 0x99 0x9a 0x9b */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* 0x9c 0x9d 0x9e 0x9f */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* nobreakspace exclamdown cent sterling */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* currency yen brokenbar section */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* diaeresis copyright ordfeminine guillemotleft */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* notsign hyphen registered macron */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* degree plusminus twosuperior threesuperior */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* acute mu paragraph periodcentered */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* cedilla onesuperior masculine guillemotright */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* onequarter onehalf threequarters questiondown */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Agrave Aacute Acircumflex Atilde */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Adiaeresis Aring AE Ccedilla */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Egrave Eacute Ecircumflex Ediaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Igrave Iacute Icircumflex Idiaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Eth Ntilde Ograve Oacute */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Ocircumflex Otilde Odiaeresis multiply */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Ooblique Ugrave Uacute Ucircumflex */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* Udiaeresis Yacute Thorn ssharp */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* agrave aacute acircumflex atilde */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* adiaeresis aring ae ccedilla */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* egrave eacute ecircumflex ediaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* igrave iacute icircumflex idiaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* eth ntilde ograve oacute */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* ocircumflex otilde odiaeresis division */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* oslash ugrave uacute ucircumflex */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* udiaeresis yacute thorn ydiaeresis */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X}; X Xint Tpttable[] = { X/* NUL SOH STX ETX */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, X/* EOT ENQ ACK BEL */ XCASE_IGNORE, XCASE_IGNORE, XCASE_IGNORE, XCASE_BEL, X/* BS HT NL VT */ XCASE_BS, XCASE_TAB, XCASE_LF, XCASE_UP, X/* NP CR SO SI */ XCASE_IGNORE, XCASE_CR, XCASE_IGNORE, XCASE_IGNORE, X/* DLE DC1 DC2 DC3 */ XCASE_IGNORE, END_OF_FILE if test 19647 -ne `wc -c <'xterm/TekPrsTbl.c.ab'`; then echo shar: \"'xterm/TekPrsTbl.c.ab'\" unpacked with wrong size! fi # end of 'xterm/TekPrsTbl.c.ab' fi if test -f 'xterm/resize.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xterm/resize.c'\" else echo shar: Extracting \"'xterm/resize.c'\" \(11859 characters\) sed "s/^X//" >'xterm/resize.c' <<'END_OF_FILE' X/* X * $XConsortium: resize.c,v 1.11 89/12/09 17:24:12 jim Exp $ X */ X X#ifndef lint Xstatic char *rcsid_resize_c = "$XConsortium: resize.c,v 1.11 89/12/09 17:24:12 jim Exp $"; X#endif /* lint */ X X#include <X11/copyright.h> X X/* X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. X * X * All Rights Reserved X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, X * provided that the above copyright notice appear in all copies and that X * both that copyright notice and this permission notice appear in X * supporting documentation, and that the name of Digital Equipment X * Corporation not be used in advertising or publicity pertaining to X * distribution of the software without specific, written prior permission. X * X * X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS X * SOFTWARE. X */ X X X/* resize.c */ X X#include <X11/Xos.h> X#include <stdio.h> X#include <ctype.h> X#include <sys/ioctl.h> X X#ifdef att X#include <sys/stream.h> X#include <sys/ptem.h> X#endif X X#ifdef APOLLO_SR9 X#define CANT_OPEN_DEV_TTY X#endif X X#ifdef macII X#define USE_SYSV_TERMIO X#undef SYSV /* pretend to be bsd */ X#endif /* macII */ X X#ifdef SYSV X#define USE_SYSV_TERMIO X#define USE_SYSV_UTMP X#else /* else not SYSV */ X#define USE_TERMCAP X#endif /* SYSV */ X X#ifdef USE_SYSV_TERMIO X#include <sys/termio.h> X#else /* else not USE_SYSV_TERMIO */ X#include <sgtty.h> X#endif /* USE_SYSV_TERMIO */ X X#include <signal.h> X#include <pwd.h> X X#ifdef USE_SYSV_TERMIO Xextern struct passwd *getpwent(); Xextern struct passwd *getpwuid(); Xextern struct passwd *getpwnam(); Xextern void setpwent(); Xextern void endpwent(); Xextern struct passwd *fgetpwent(); X#define bzero(s, n) memset(s, 0, n) X#endif /* USE_SYSV_TERMIO */ X X#ifndef lint Xstatic char rcs_id[] = "$XConsortium: resize.c,v 1.11 89/12/09 17:24:12 jim Exp $"; X#endif X X#define EMULATIONS 2 X#define SUN 1 X#define TIMEOUT 10 X#define VT100 0 X X#define SHELL_UNKNOWN 0 X#define SHELL_C 1 X#define SHELL_BOURNE 2 Xstruct { X char *name; X int type; X} shell_list[] = { X "csh", SHELL_C, /* vanilla cshell */ X "tcsh", SHELL_C, X "sh", SHELL_BOURNE, /* vanilla Bourne shell */ X "ksh", SHELL_BOURNE, /* Korn shell (from AT&T toolchest) */ X "ksh-i", SHELL_BOURNE, /* other name for latest Korn shell */ X (char *) 0, SHELL_BOURNE, /* last effort default (same as X * xterm's) X */ X}; X Xchar *emuname[EMULATIONS] = { X "VT100", X "Sun", X}; Xchar *myname; Xint shell_type = SHELL_UNKNOWN; Xchar *getsize[EMULATIONS] = { X "\0337\033[r\033[999;999H\033[6n", X "\033[18t", X}; X#ifndef sun X#ifdef TIOCSWINSZ Xchar *getwsize[EMULATIONS] = { X 0, X "\033[14t", X}; X#endif /* TIOCSWINSZ */ X#endif /* sun */ Xchar *restore[EMULATIONS] = { X "\0338", X 0, X}; Xchar *setname = ""; Xchar *setsize[EMULATIONS] = { X 0, X "\033[8;%s;%st", X}; X#ifdef USE_SYSV_TERMIO Xstruct termio tioorig; X#else /* not USE_SYSV_TERMIO */ Xstruct sgttyb sgorig; X#endif /* USE_SYSV_TERMIO */ Xchar *size[EMULATIONS] = { X "\033[%d;%dR", X "\033[8;%d;%dt", X}; Xchar sunname[] = "sunsize"; Xint tty; XFILE *ttyfp; X#ifndef sun X#ifdef TIOCSWINSZ Xchar *wsize[EMULATIONS] = { X 0, X "\033[4;%hd;%hdt", X}; X#endif /* TIOCSWINSZ */ X#endif /* sun */ X Xchar *strindex (), *index (), *rindex(); X Xmain (argc, argv) Xchar **argv; X/* X resets termcap string to reflect current screen size X */ X{ X register char *ptr, *env; X register int emu = VT100; X char *shell; X struct passwd *pw; X int i; X int rows, cols; X#ifdef USE_SYSV_TERMIO X struct termio tio; X#else /* not USE_SYSV_TERMIO */ X struct sgttyb sg; X#endif /* USE_SYSV_TERMIO */ X#ifdef USE_TERMCAP X char termcap [1024]; X char newtc [1024]; X#endif /* USE_TERMCAP */ X char buf[BUFSIZ]; X#ifdef sun X#ifdef TIOCSSIZE X struct ttysize ts; X#endif /* TIOCSSIZE */ X#else /* sun */ X#ifdef TIOCSWINSZ X struct winsize ws; X#endif /* TIOCSWINSZ */ X#endif /* sun */ X char *getenv(); X int onintr(); X char *name_of_tty; X#ifdef CANT_OPEN_DEV_TTY X extern char *ttyname(); X#endif X X if(ptr = rindex(myname = argv[0], '/')) X myname = ptr + 1; X if(strcmp(myname, sunname) == 0) X emu = SUN; X for(argv++, argc-- ; argc > 0 && **argv == '-' ; argv++, argc--) { X switch((*argv)[1]) { X case 's': /* Sun emulation */ X if(emu == SUN) X Usage(); /* Never returns */ X emu = SUN; X break; X case 'u': /* Bourne (Unix) shell */ X shell_type = SHELL_BOURNE; X break; X case 'c': /* C shell */ X shell_type = SHELL_C; X break; X default: X Usage(); /* Never returns */ X } X } X X if (SHELL_UNKNOWN == shell_type) { X /* Find out what kind of shell this user is running. X * This is the same algorithm that xterm uses. X */ X if (((ptr = getenv("SHELL")) == NULL || *ptr == 0) && X (((pw = getpwuid(getuid())) == NULL) || X *(ptr = pw->pw_shell) == 0)) X /* this is the same default that xterm uses */ X ptr = "/bin/sh"; X X if (shell = rindex(ptr, '/')) X shell++; X else X shell = ptr; X X /* now that we know, what kind is it? */ X for (i = 0; shell_list[i].name; i++) X if (!strcmp(shell_list[i].name, shell)) X break; X shell_type = shell_list[i].type; X } X X if(argc == 2) { X if(!setsize[emu]) { X fprintf(stderr, X "%s: Can't set window size under %s emulation\n", X myname, emuname[emu]); X exit(1); X } X if(!checkdigits(argv[0]) || !checkdigits(argv[1])) X Usage(); /* Never returns */ X } else if(argc != 0) X Usage(); /* Never returns */ X X#ifdef CANT_OPEN_DEV_TTY X if ((name_of_tty = ttyname(fileno(stderr))) == NULL) X#endif X name_of_tty = "/dev/tty"; X X if ((ttyfp = fopen (name_of_tty, "r+")) == NULL) { X fprintf (stderr, "%s: can't open terminal %s\n", X myname, name_of_tty); X exit (1); X } X tty = fileno(ttyfp); X#ifdef USE_TERMCAP X if((env = getenv("TERMCAP")) && *env) X strcpy(termcap, env); X else { X if(!(env = getenv("TERM")) || !*env) { X env = "xterm"; X if(SHELL_BOURNE == shell_type) X setname = "TERM=xterm;\nexport TERM;\n"; X else setname = "setenv TERM xterm;\n"; X } X if(tgetent (termcap, env) <= 0) { X fprintf(stderr, "%s: Can't get entry \"%s\"\n", X myname, env); X exit(1); X } X } X#else /* else not USE_TERMCAP */ X if(!(env = getenv("TERM")) || !*env) { X env = "xterm"; X if(SHELL_BOURNE == shell_type) X setname = "TERM=xterm;\nexport TERM;\n"; X else setname = "setenv TERM xterm;\n"; X } X#endif /* USE_TERMCAP */ X X#ifdef USE_SYSV_TERMIO X ioctl (tty, TCGETA, &tioorig); X tio = tioorig; X tio.c_iflag &= ~(ICRNL | IUCLC); X tio.c_lflag &= ~(ICANON | ECHO); X tio.c_cflag |= CS8; X tio.c_cc[VMIN] = 6; X tio.c_cc[VTIME] = 1; X#else /* else not USE_SYSV_TERMIO */ X ioctl (tty, TIOCGETP, &sgorig); X sg = sgorig; X sg.sg_flags |= RAW; X sg.sg_flags &= ~ECHO; X#endif /* USE_SYSV_TERMIO */ X signal(SIGINT, onintr); X signal(SIGQUIT, onintr); X signal(SIGTERM, onintr); X#ifdef USE_SYSV_TERMIO X ioctl (tty, TCSETAW, &tio); X#else /* not USE_SYSV_TERMIO */ X ioctl (tty, TIOCSETP, &sg); X#endif /* USE_SYSV_TERMIO */ X X if (argc == 2) { X sprintf (buf, setsize[emu], argv[0], argv[1]); X write(tty, buf, strlen(buf)); X } X write(tty, getsize[emu], strlen(getsize[emu])); X readstring(ttyfp, buf, size[emu]); X if(sscanf (buf, size[emu], &rows, &cols) != 2) { X fprintf(stderr, "%s: Can't get rows and columns\r\n", myname); X onintr(); X } X if(restore[emu]) X write(tty, restore[emu], strlen(restore[emu])); X#ifdef sun X#ifdef TIOCGSIZE X /* finally, set the tty's window size */ X if (ioctl (tty, TIOCGSIZE, &ts) != -1) { X ts.ts_lines = rows; X ts.ts_cols = cols; X ioctl (tty, TIOCSSIZE, &ts); X } X#endif /* TIOCGSIZE */ X#else /* sun */ X#ifdef TIOCGWINSZ X /* finally, set the tty's window size */ X if(getwsize[emu]) { X /* get the window size in pixels */ X write (tty, getwsize[emu], strlen (getwsize[emu])); X readstring(ttyfp, buf, wsize[emu]); X if(sscanf (buf, wsize[emu], &ws.ws_xpixel, &ws.ws_ypixel) != 2) { X fprintf(stderr, "%s: Can't get window size\r\n", myname); X onintr(); X } X ws.ws_row = rows; X ws.ws_col = cols; X ioctl (tty, TIOCSWINSZ, &ws); X } else if (ioctl (tty, TIOCGWINSZ, &ws) != -1) { X /* we don't have any way of directly finding out X the current height & width of the window in pixels. We try X our best by computing the font height and width from the "old" X struct winsize values, and multiplying by these ratios...*/ X if (ws.ws_col != 0) X ws.ws_xpixel = cols * (ws.ws_xpixel / ws.ws_col); X if (ws.ws_row != 0) X ws.ws_ypixel = rows * (ws.ws_ypixel / ws.ws_row); X ws.ws_row = rows; X ws.ws_col = cols; X ioctl (tty, TIOCSWINSZ, &ws); X } X#endif /* TIOCGWINSZ */ X#endif /* sun */ X X#ifdef USE_SYSV_TERMIO X ioctl (tty, TCSETAW, &tioorig); X#else /* not USE_SYSV_TERMIO */ X ioctl (tty, TIOCSETP, &sgorig); X#endif /* USE_SYSV_TERMIO */ X signal(SIGINT, SIG_DFL); X signal(SIGQUIT, SIG_DFL); X signal(SIGTERM, SIG_DFL); X X#ifdef USE_TERMCAP X /* update termcap string */ X /* first do columns */ X if ((ptr = strindex (termcap, "co#")) == NULL) { X fprintf(stderr, "%s: No `co#'\n", myname); X exit (1); X } X X i = ptr - termcap + 3; X strncpy (newtc, termcap, i); X sprintf (newtc + i, "%d", cols); X ptr = index (ptr, ':'); X strcat (newtc, ptr); X X /* now do lines */ X if ((ptr = strindex (newtc, "li#")) == NULL) { X fprintf(stderr, "%s: No `li#'\n", myname); X exit (1); X } X X i = ptr - newtc + 3; X strncpy (termcap, newtc, i); X sprintf (termcap + i, "%d", rows); X ptr = index (ptr, ':'); X strcat (termcap, ptr); X#endif /* USE_TERMCAP */ X X if(SHELL_BOURNE == shell_type) X#ifdef USE_TERMCAP X printf ("%sTERMCAP='%s'\n", X setname, termcap); X#else /* else not USE_TERMCAP */ X printf ("%sCOLUMNS=%d;\nLINES=%d;\nexport COLUMNS LINES;\n", X setname, cols, rows); X#endif /* USE_SYSV_TERMCAP */ X else X#ifdef USE_TERMCAP X printf ("set noglob;\n%ssetenv TERMCAP '%s';\nunset noglob;\n", X setname, termcap); X#else /* else not USE_TERMCAP */ X printf ("set noglob;\n%ssetenv COLUMNS '%d';\nsetenv LINES '%d';\nunset noglob;\n", X setname, cols, rows); X#endif /* USE_TERMCAP */ X exit(0); X} X Xchar *strindex (s1, s2) X/* X returns a pointer to the first occurrence of s2 in s1, or NULL if there are X none. X */ Xregister char *s1, *s2; X{ X register char *s3; X int s2len = strlen (s2); X X while ((s3 = index (s1, *s2)) != NULL) X { X if (strncmp (s3, s2, s2len) == 0) return (s3); X s1 = ++s3; X } X return (NULL); X} X Xcheckdigits(str) Xregister char *str; X{ X while(*str) { X if(!isdigit(*str)) X return(0); X str++; X } X return(1); X} X Xreadstring(fp, buf, str) Xregister FILE *fp; Xregister char *buf; Xchar *str; X{ X register int i, last; X int timeout(); X#ifndef USG X struct itimerval it; X#endif X X signal(SIGALRM, timeout); X#ifdef USG X alarm (TIMEOUT); X#else X bzero((char *)&it, sizeof(struct itimerval)); X it.it_value.tv_sec = TIMEOUT; X setitimer(ITIMER_REAL, &it, (struct itimerval *)NULL); X#endif X if((*buf++ = getc(fp)) != *str) { X fprintf(stderr, "%s: unknown character, exiting.\r\n", myname); X onintr(); X } X last = str[i = strlen(str) - 1]; X while((*buf++ = getc(fp)) != last); X#ifdef USG X alarm (0); X#else X bzero((char *)&it, sizeof(struct itimerval)); X setitimer(ITIMER_REAL, &it, (struct itimerval *)NULL); X#endif X *buf = 0; X} X XUsage() X{ X fprintf(stderr, strcmp(myname, sunname) == 0 ? X "Usage: %s [rows cols]\n" : X "Usage: %s [-u] [-c] [-s [rows cols]]\n", myname); X exit(1); X} X Xtimeout() X{ X fprintf(stderr, "%s: Time out occurred\r\n", myname); X onintr(); X} X Xonintr() X{ X#ifdef USE_SYSV_TERMIO X ioctl (tty, TCSETAW, &tioorig); X#else /* not USE_SYSV_TERMIO */ X ioctl (tty, TIOCSETP, &sgorig); X#endif /* USE_SYSV_TERMIO */ X exit(1); X} END_OF_FILE if test 11859 -ne `wc -c <'xterm/resize.c'`; then echo shar: \"'xterm/resize.c'\" unpacked with wrong size! fi # end of 'xterm/resize.c' fi if test -f 'xterm/screen.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xterm/screen.c'\" else echo shar: Extracting \"'xterm/screen.c'\" \(19451 characters\) sed "s/^X//" >'xterm/screen.c' <<'END_OF_FILE' X/* X * $XConsortium: screen.c,v 1.19 90/06/08 14:15:40 jim Exp $ X */ X X#include <X11/copyright.h> X X/* X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. X * X * All Rights Reserved X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, X * provided that the above copyright notice appear in all copies and that X * both that copyright notice and this permission notice appear in X * supporting documentation, and that the name of Digital Equipment X * Corporation not be used in advertising or publicity pertaining to X * distribution of the software without specific, written prior permission. X * X * X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS X * SOFTWARE. X */ X X/* screen.c */ X X#ifndef lint Xstatic char rcs_id[] = "$XConsortium: screen.c,v 1.19 90/06/08 14:15:40 jim Exp $"; X#endif /* lint */ X X#include <X11/Xlib.h> X#include <stdio.h> X#include <sys/ioctl.h> X#include "ptyx.h" X#include "error.h" X X#ifdef att X#include <sys/termio.h> X#include <sys/stream.h> /* get typedef used in ptem.h */ X#include <sys/ptem.h> X#endif X Xextern Char *calloc(), *malloc(), *realloc(); Xextern void bcopy(); Xextern void free(); X XScrnBuf Allocate (nrow, ncol, addr) X/* X allocates memory for a 2-dimensional array of chars and returns a pointer X thereto X each line is formed from four char arrays. The first one is the actual X character array, the second one is the attributes, the third is the X foreground color, and the fourth is the background color. X */ Xregister int nrow, ncol; XChar **addr; X{ X register ScrnBuf base; X register Char *tmp; X register int i; X X if ((base = (ScrnBuf) calloc ((unsigned)(nrow *= 4), sizeof (char *))) == 0) X SysError (ERROR_SCALLOC); X X if ((tmp = calloc ((unsigned) (nrow * ncol), sizeof(char))) == 0) X SysError (ERROR_SCALLOC2); X X *addr = tmp; X for (i = 0; i < nrow; i++, tmp += ncol) X base[i] = tmp; X X return (base); X} X X/* X * This is called when the screen is resized. Not complex if you do X * things in the right order... X */ Xstatic void XReallocate(sbuf, sbufaddr, nrow, ncol, oldrow, oldcol) XScrnBuf *sbuf; XChar **sbufaddr; Xint nrow, ncol, oldrow, oldcol; X{ X register ScrnBuf base; X register Char *tmp; X register int i, minrows, mincols; X Char *oldbuf; X X if (sbuf == NULL || *sbuf == NULL) X return; X X oldrow *= 4; X oldbuf = *sbufaddr; X X /* X * Special case if oldcol == ncol - straight forward realloc and X * update of the additional lines in sbuf X */ X X /* X * realloc sbuf; we don't care about losing the lower lines if the X * screen shrinks. It might be cleaner to readjust the screen so X * that the UPPER lines vanish when the screen shrinks but that's X * more work... X */ X nrow *= 4; X *sbuf = (ScrnBuf) realloc((char *) (*sbuf), X (unsigned) (nrow * sizeof(char *))); X if (*sbuf == 0) X SysError(ERROR_RESIZE); X base = *sbuf; X X /* X * create the new buffer space and copy old buffer contents there X * line by line, updating the pointers in sbuf as we go; then free X * the old buffer X */ X if ((tmp = calloc((unsigned) (nrow * ncol), sizeof(char))) == 0) X SysError(ERROR_SREALLOC); X *sbufaddr = tmp; X minrows = (oldrow < nrow) ? oldrow : nrow; X mincols = (oldcol < ncol) ? oldcol : ncol; X for(i = 0; i < minrows; i++, tmp += ncol) { X bcopy(base[i], tmp, mincols); X base[i] = tmp; X } X if (oldrow < nrow) { X for (i = minrows; i < nrow; i++, tmp += ncol) X base[i] = tmp; X } X /* Now free the old buffer - simple, see... */ X free(oldbuf); X} X XScreenWrite (screen, str, flags, cur_fg, cur_bg, length) X/* X Writes str into buf at row row and column col. Characters are set to match X flags. X */ XTScreen *screen; Xchar *str; Xregister unsigned flags; Xregister unsigned cur_fg, cur_bg; Xregister int length; /* length of string */ X{ X register Char *attrs, *fgs, *bgs; X register int avail = screen->max_col - screen->cur_col + 1; X register Char *col; X X if (length > avail) X length = avail; X if (length <= 0) X return; X X col = screen->buf[avail = 4 * screen->cur_row] + screen->cur_col; X attrs = screen->buf[avail + 1] + screen->cur_col; X fgs = screen->buf[avail + 2] + screen->cur_col; X bgs = screen->buf[avail + 3] + screen->cur_col; X flags &= ATTRIBUTES; X bcopy(str, col, length); X while(length-- > 0) { X *attrs++ = flags; X *fgs++ = cur_fg; X *bgs++ = cur_bg; X } X} X XScrnInsertLine (sb, last, where, n, size) X/* X Inserts n blank lines at sb + where, treating last as a bottom margin. X Size is the size of each entry in sb. X Requires: 0 <= where < where + n <= last X n <= MAX_ROWS X */ Xregister ScrnBuf sb; Xint last; Xregister int where, n, size; X{ X register int i; X char *save [4 * MAX_ROWS]; X X X /* save n lines at bottom */ X bcopy ((char *) &sb [4 * (last -= n - 1)], (char *) save, X 4 * sizeof (char *) * n); X X /* clear contents of old rows */ X for (i = 4 * n - 1; i >= 0; i--) X bzero ((char *) save [i], size); X X /* X * WARNING, overlapping copy operation. Move down lines (pointers). X * X * +----|---------|--------+ X * X * is copied in the array to: X * X * +--------|---------|----+ X */ X bcopy ((char *) &sb [4 * where], (char *) &sb [4 * (where + n)], X 4 * sizeof (char *) * (last - where)); X X /* reuse storage for new lines at where */ X bcopy ((char *)save, (char *) &sb[4 * where], 4 * sizeof(char *) * n); X} X X XScrnDeleteLine (sb, last, where, n, size) X/* X Deletes n lines at sb + where, treating last as a bottom margin. X Size is the size of each entry in sb. X Requires 0 <= where < where + n < = last X n <= MAX_ROWS X */ Xregister ScrnBuf sb; Xregister int n, last, size; Xint where; X{ X register int i; X char *save [4 * MAX_ROWS]; X X /* save n lines at where */ X bcopy ((char *) &sb[4 * where], (char *)save, 4 * sizeof(char *) * n); X X /* clear contents of old rows */ X for (i = 4 * n - 1 ; i >= 0 ; i--) X bzero ((char *) save [i], size); X X /* move up lines */ X bcopy ((char *) &sb[4 * (where + n)], (char *) &sb[4 * where], X 4 * sizeof (char *) * ((last -= n - 1) - where)); X X /* reuse storage for new bottom lines */ X bcopy ((char *)save, (char *) &sb[4 * last], X 4 * sizeof(char *) * n); X} X X XScrnInsertChar (sb, row, col, n, size) X/* X Inserts n blanks in sb at row, col. Size is the size of each row. X */ XScrnBuf sb; Xint row, size; Xregister int col, n; X{ X register int i, j; X register Char *ptr = sb [4 * row]; X register Char *attrs = sb [4 * row + 1]; X X for (i = size - 1; i >= col + n; i--) { X ptr[i] = ptr[j = i - n]; X attrs[i] = attrs[j]; X } X X bzero (ptr + col, n); X bzero (attrs + col, n); X} X X XScrnDeleteChar (sb, row, col, n, size) X/* X Deletes n characters in sb at row, col. Size is the size of each row. X */ XScrnBuf sb; Xregister int row, size; Xregister int n, col; X{ X register Char *ptr = sb[4 * row]; X register Char *attrs = sb[4 * row + 1]; X register nbytes = (size - n - col); X X bcopy (ptr + col + n, ptr + col, nbytes); X bcopy (attrs + col + n, attrs + col, nbytes); X bzero (ptr + size - n, n); X bzero (attrs + size - n, n); X} X X XScrnRefresh (screen, toprow, leftcol, nrows, ncols, force) X/* X Repaints the area enclosed by the parameters. X Requires: (toprow, leftcol), (toprow + nrows, leftcol + ncols) are X coordinates of characters in screen; X nrows and ncols positive. X */ Xregister TScreen *screen; Xint toprow, leftcol, nrows, ncols; XBoolean force; /* ... leading/trailing spaces */ X{ X int y = toprow * FontHeight(screen) + screen->border + X screen->fnt_norm->ascent; X register int row; X register int topline = screen->topline; X int maxrow = toprow + nrows - 1; X int scrollamt = screen->scroll_amt; X int max = screen->max_row; X X if(screen->cursor_col >= leftcol && screen->cursor_col <= X (leftcol + ncols - 1) && screen->cursor_row >= toprow + topline && X screen->cursor_row <= maxrow + topline) X screen->cursor_state = OFF; X for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) { X register Char *chars; X register Char *attrs; X register Char *fgs, *bgs; X register int col = leftcol; X int maxcol = leftcol + ncols - 1; X int lastind; X int flags; X int fg, bg; X int x, n; X GC gc; X Boolean hilite; X Pixel fg_pix, bg_pix; X extern XtermWidget term; X X if (row < screen->top_marg || row > screen->bot_marg) X lastind = row; X else X lastind = row - scrollamt; X X if (lastind < 0 || lastind > max) X continue; X X chars = screen->buf [4 * (lastind + topline)]; X attrs = screen->buf [4 * (lastind + topline) + 1]; X fgs = screen->buf [4 * (lastind + topline) + 2]; X bgs = screen->buf [4 * (lastind + topline) + 3]; X X if (row < screen->startHRow || row > screen->endHRow || X (row == screen->startHRow && maxcol < screen->startHCol) || X (row == screen->endHRow && col >= screen->endHCol)) X { X /* row does not intersect selection; don't hilite */ X if (!force) { X while (col <= maxcol && (attrs[col] & ~BOLD) == 0 && X (chars[col] & ~040) == 0) X col++; X X while (col <= maxcol && (attrs[maxcol] & ~BOLD) == 0 && X (chars[maxcol] & ~040) == 0) X maxcol--; X } X hilite = False; X } X else { X /* row intersects selection; split into pieces of single type */ X if (row == screen->startHRow && col < screen->startHCol) { X ScrnRefresh(screen, row, col, 1, screen->startHCol - col, X force); X col = screen->startHCol; X } X if (row == screen->endHRow && maxcol >= screen->endHCol) { X ScrnRefresh(screen, row, screen->endHCol, 1, X maxcol - screen->endHCol + 1, force); X maxcol = screen->endHCol - 1; X } X /* remaining piece should be hilited */ X hilite = True; X } X X if (col > maxcol) continue; X X flags = attrs[col]; X fg = fgs[col]; X bg = bgs[col]; X X fg_pix = (flags & FG_COLOR) ? screen->colors[fg] X : screen->foreground; X bg_pix = (flags & BG_COLOR) ? screen->colors[bg] X : term->core.background_pixel; X X if ( (!hilite && (flags & INVERSE) != 0) || X (hilite && (flags & INVERSE) == 0) ) { X if (flags & BOLD) gc = screen->reverseboldGC; X else gc = screen->reverseGC; X X XSetForeground(screen->display, gc, bg_pix); X XSetBackground(screen->display, gc, fg_pix); X X } else { X if (flags & BOLD) gc = screen->normalboldGC; X else gc = screen->normalGC; X X XSetForeground(screen->display, gc, fg_pix); X XSetBackground(screen->display, gc, bg_pix); X } X X X x = CursorX(screen, col); X lastind = col; X X for (; col <= maxcol; col++) { X if (attrs[col] != flags || X (flags & FG_COLOR && fgs[col] != fg) || X (flags & BG_COLOR && bgs[col] != bg)) { X X XDrawImageString(screen->display, TextWindow(screen), X gc, x, y, (char *) &chars[lastind], X n = col - lastind); X if((flags & BOLD) && screen->enbolden) X XDrawString(screen->display, TextWindow(screen), X gc, x + 1, y, (char *) &chars[lastind], n); X if(flags & UNDERLINE) X XDrawLine(screen->display, TextWindow(screen), X gc, x, y+1, x+n*FontWidth(screen), y+1); X X x += (col - lastind) * FontWidth(screen); X X lastind = col; X X flags = attrs[col]; X fg = fgs[col]; X bg = bgs[col]; X X fg_pix = (flags & FG_COLOR) ? screen->colors[fg] X : screen->foreground; X bg_pix = (flags & BG_COLOR) ? screen->colors[bg] X : term->core.background_pixel; X X if ( (!hilite && (flags & INVERSE) != 0) || X (hilite && (flags & INVERSE) == 0) ) { X if (flags & BOLD) gc = screen->reverseboldGC; X else gc = screen->reverseGC; X X XSetForeground(screen->display, gc, bg_pix); X XSetBackground(screen->display, gc, fg_pix); X X } else { X if (flags & BOLD) gc = screen->normalboldGC; X else gc = screen->normalGC; X X XSetForeground(screen->display, gc, fg_pix); X XSetBackground(screen->display, gc, bg_pix); X X } X } X X if(chars[col] == 0) X chars[col] = ' '; X } X X X if ( (!hilite && (flags & INVERSE) != 0) || X (hilite && (flags & INVERSE) == 0) ) { X if (flags & BOLD) gc = screen->reverseboldGC; X else gc = screen->reverseGC; X X XSetForeground(screen->display, gc, bg_pix); X XSetBackground(screen->display, gc, fg_pix); X X } else { X if (flags & BOLD) gc = screen->normalboldGC; X else gc = screen->normalGC; X X XSetForeground(screen->display, gc, fg_pix); X XSetBackground(screen->display, gc, bg_pix); X X } X X XDrawImageString(screen->display, TextWindow(screen), gc, X x, y, (char *) &chars[lastind], n = col - lastind); X if((flags & BOLD) && screen->enbolden) X XDrawString(screen->display, TextWindow(screen), gc, X x + 1, y, (char *) &chars[lastind], n); X if(flags & UNDERLINE) X XDrawLine(screen->display, TextWindow(screen), gc, X x, y+1, x + n * FontWidth(screen), y+1); X } X} X XClearBufRows (screen, first, last) X/* X Sets the rows first though last of the buffer of screen to spaces. X Requires first <= last; first, last are rows of screen->buf. X */ Xregister TScreen *screen; Xregister int first, last; X{ X first *= 4; X last = 4 * last + 3; X while (first <= last) X bzero (screen->buf [first++], (screen->max_col + 1)); X} X XScreenResize (screen, width, height, flags) X/* X Resizes screen: X 1. If new window would have fractional characters, sets window size so as to X discard fractional characters and returns -1. X Minimum screen size is 1 X 1. X Note that this causes another ExposeWindow event. X 2. Enlarges screen->buf if necessary. New space is appended to the bottom X and to the right X 3. Reduces screen->buf if necessary. Old space is removed from the bottom X and from the right X 4. Cursor is positioned as closely to its former position as possible X 5. Sets screen->max_row and screen->max_col to reflect new size X 6. Maintains the inner border (and clears the border on the screen). X 7. Clears origin mode and sets scrolling region to be entire screen. X 8. Returns 0 X */ Xregister TScreen *screen; Xint width, height; Xunsigned *flags; X{ X int rows, cols; X int border = 2 * screen->border; X#ifdef sun X#ifdef TIOCSSIZE X struct ttysize ts; X#endif /* TIOCSSIZE */ X#else /* sun */ X#ifdef TIOCSWINSZ X struct winsize ws; X#endif /* TIOCSWINSZ */ X#endif /* sun */ X Window tw = TextWindow (screen); X X /* clear the right and bottom internal border because of NorthWest X gravity might have left junk on the right and bottom edges */ X XClearArea (screen->display, tw, X width - screen->border, 0, /* right edge */ X screen->border, height, /* from top to bottom */ X False); X XClearArea (screen->display, tw, X 0, height - screen->border, /* bottom */ X width, screen->border, /* all across the bottom */ X False); X X /* round so that it is unlikely the screen will change size on */ X /* small mouse movements. */ X rows = (height + FontHeight(screen) / 2 - border) / X FontHeight(screen); X cols = (width + FontWidth(screen) / 2 - border - screen->scrollbar) / X FontWidth(screen); X if (rows < 1) rows = 1; X if (cols < 1) cols = 1; X X /* change buffers if the screen has changed size */ X if (screen->max_row != rows - 1 || screen->max_col != cols - 1) { X register int savelines = screen->scrollWidget ? X screen->savelines : 0; X X if(screen->cursor_state) X HideCursor(); X if (screen->altbuf) X Reallocate(&screen->altbuf, (Char **)&screen->abuf_address, X rows, cols, screen->max_row + 1, screen->max_col + 1); X Reallocate(&screen->allbuf, (Char **)&screen->sbuf_address, X rows + savelines, cols, X screen->max_row + 1 + savelines, screen->max_col + 1); X screen->buf = &screen->allbuf[4 * savelines]; X X screen->max_row = rows - 1; X screen->max_col = cols - 1; X X /* adjust scrolling region */ X screen->top_marg = 0; X screen->bot_marg = screen->max_row; X *flags &= ~ORIGIN; X X if (screen->cur_row > screen->max_row) X screen->cur_row = screen->max_row; X if (screen->cur_col > screen->max_col) X screen->cur_col = screen->max_col; X X screen->fullVwin.height = height - border; X screen->fullVwin.width = width - border - screen->scrollbar; X X } else if(FullHeight(screen) == height && FullWidth(screen) == width) X return(0); /* nothing has changed at all */ X X if(screen->scrollWidget) X ResizeScrollBar(screen->scrollWidget, -1, -1, height); X X screen->fullVwin.fullheight = height; X screen->fullVwin.fullwidth = width; X ResizeSelection (screen, rows, cols); X#ifdef sun X#ifdef TIOCSSIZE X /* Set tty's idea of window size */ X ts.ts_lines = rows; X ts.ts_cols = cols; X ioctl (screen->respond, TIOCSSIZE, &ts); X#ifdef SIGWINCH X if(screen->pid > 1) { X int pgrp; X X if (ioctl (screen->respond, TIOCGPGRP, &pgrp) != -1) X killpg(pgrp, SIGWINCH); X } X#endif /* SIGWINCH */ X#endif /* TIOCSSIZE */ X#else /* sun */ X#ifdef TIOCSWINSZ X /* Set tty's idea of window size */ X ws.ws_row = rows; X ws.ws_col = cols; X ws.ws_xpixel = width; X ws.ws_ypixel = height; X ioctl (screen->respond, TIOCSWINSZ, (char *)&ws); X#ifdef notdef /* change to SIGWINCH if this doesn't work for you */ X if(screen->pid > 1) { X int pgrp; X X if (ioctl (screen->respond, TIOCGPGRP, &pgrp) != -1) X killpg(pgrp, SIGWINCH); X } X#endif /* SIGWINCH */ X#endif /* TIOCSWINSZ */ X#endif /* sun */ X return (0); X} X X/* X * Sets the attributes from the row, col, to row, col + length according to X * mask and value. The bits in the attribute byte specified by the mask are X * set to the corresponding bits in the value byte. If length would carry us X * over the end of the line, it stops at the end of the line. X */ Xvoid XScrnSetAttributes(screen, row, col, mask, value, length) XTScreen *screen; Xint row, col; Xunsigned mask, value; Xregister int length; /* length of string */ X{ X register Char *attrs; X register int avail = screen->max_col - col + 1; X X if (length > avail) X length = avail; X if (length <= 0) X return; X attrs = screen->buf[4 * row + 1] + col; X value &= mask; /* make sure we only change the bits allowed by mask*/ X while(length-- > 0) { X *attrs &= mask; /* clear the bits */ X *attrs |= value; /* copy in the new values */ X attrs++; X } X} X X/* X * Gets the attributes from the row, col, to row, col + length into the X * supplied array, which is assumed to be big enough. If length would carry us X * over the end of the line, it stops at the end of the line. Returns X * the number of bytes of attributes (<= length) X */ Xint XScrnGetAttributes(screen, row, col, str, length) XTScreen *screen; Xint row, col; XChar *str; Xregister int length; /* length of string */ X{ X register Char *attrs; X register int avail = screen->max_col - col + 1; X int ret; X X if (length > avail) X length = avail; X if (length <= 0) X return 0; X ret = length; X attrs = screen->buf[4 * row + 1] + col; X while(length-- > 0) { X *str++ = *attrs++; X } X return ret; X} XBool Xnon_blank_line(sb, row, col, len) XScrnBuf sb; Xregister int row, col, len; X{ X register int i; X register Char *ptr = sb [4 * row]; X X for (i = col; i < len; i++) { X if (ptr[i]) X return True; X } X return False; X} END_OF_FILE if test 19451 -ne `wc -c <'xterm/screen.c'`; then echo shar: \"'xterm/screen.c'\" unpacked with wrong size! fi # end of 'xterm/screen.c' fi echo shar: End of archive 11 \(of 14\). cp /dev/null ark11isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 14 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.