1 /* rxvt.c - gives output lines on rxvt with a special rxvt patch
2 Copyright (C) 1997 Paul Sheer
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #include <sys/types.h>
29 #include "tty.h" /* move, addch */
30 #include "cons.saver.h"
32 static int rxvt_extensions
= 0;
34 int look_for_rxvt_extensions (void)
36 static int been_called
= 0;
40 e
= getenv ("RXVT_EXT");
42 if (!strcmp (e
, "1.0"))
48 return rxvt_extensions
;
51 /* my own wierd protocol base 16 - paul */
52 static int rxvt_getc (void)
56 while (read (0, &c
, 1) != 1);
60 while (read (0, &c
, 1) != 1);
65 extern int keybar_visible
;
67 static int anything_ready (void)
76 return select (1, &fds
, 0, 0, &tv
);
79 void show_rxvt_contents (int starty
, unsigned char y1
, unsigned char y2
)
82 int bytes
, i
, j
, cols
= 0;
83 y1
+= (keybar_visible
!= 0); /* i don't knwo why we need this - paul */
84 y2
+= (keybar_visible
!= 0);
85 while (anything_ready ())
88 /* my own wierd protocol base 26 - paul */
89 printf ("\033CL%c%c%c%c\n",
90 (y1
/ 26) + 'A', (y1
% 26) + 'A',
91 (y2
/ 26) + 'A', (y2
% 26) + 'A');
93 bytes
= (y2
- y1
) * (COLS
+ 1) + 1; /* *should* be the number of bytes read */
103 for (cols
= 1;;cols
++) {
111 for (i
= 0; i
< j
; i
++) {
113 move (starty
+ (i
/ cols
), 0);
114 addch (is_printable (k
[i
]) ? k
[i
] : ' ');