1 /* Copyright (c) 2008, 2009
2 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
4 * Micah Cowan (micah@cowan.name)
5 * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
6 * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
7 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
8 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
9 * Copyright (c) 1987 Oliver Laumann
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3, or (at your option)
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program (see the file COPYING); if not, see
23 * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 ****************************************************************
54 # define STATIC /* a function that the debugger should see */
56 # define STATIC static
60 # define DEBUGDIR "/tmp/debug"
61 # define debugf(a) do {if(dfp){fprintf a;fflush(dfp);}} while (0)
62 # define debug(x) debugf((dfp,x))
63 # define debug1(x,a) debugf((dfp,x,a))
64 # define debug2(x,a,b) debugf((dfp,x,a,b))
65 # define debug3(x,a,b,c) debugf((dfp,x,a,b,c))
68 # define debugf(a) do {} while (0)
69 # define debug(x) debugf(x)
70 # define debug1(x,a) debugf(x)
71 # define debug2(x,a,b) debugf(x)
72 # define debug3(x,a,b,c) debugf(x)
80 # if defined(__STDC__)
81 # define ASSERT(lousy_cpp) do {if (!(lousy_cpp)) {if (!dfp) opendebug(0, 1);debug2("ASSERT("#lousy_cpp") failed file %s line %d\n", __FILE__, __LINE__);abort();}} while (0)
83 # define ASSERT(lousy_cpp) do {if (!(lousy_cpp)) {if (!dfp) opendebug(0, 1);debug2("ASSERT(lousy_cpp) failed file %s line %d\n", __FILE__, __LINE__);abort();}} while (0)
86 # define ASSERT(lousy_cpp) do {} while (0)
89 /* here comes my own Free: jw. */
90 #define Free(a) {if ((a) == 0) abort(); else free((void *)(a)); (a)=0;}
92 #define Ctrl(c) ((c)&037)
98 #define SILENCEWAIT 30
101 * if a nasty user really wants to try a history of 3000 lines on all 10
102 * windows, he will allocate 8 MegaBytes of memory, which is quite enough.
104 #define MAXHISTHEIGHT 3000
105 #define DEFAULTHISTHEIGHT 100
106 #if defined(NAME_MAX) && NAME_MAX < 16
107 # define DEFAULT_BUFFERFILE "/tmp/screen-xchg"
109 # define DEFAULT_BUFFERFILE "/tmp/screen-exchange"
113 #if defined(hpux) && !(defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT))
114 # define HPUX_LTCHARS_HACK
121 # ifdef HPUX_LTCHARS_HACK
122 struct ltchars m_ltchars
;
123 # endif /* HPUX_LTCHARS_HACK */
133 struct sgttyb m_ttyb
;
134 struct tchars m_tchars
;
135 struct ltchars m_ltchars
;
140 #if defined(KANJI) && defined(TIOCKSET)
141 struct jtchars m_jtchars
;
147 /* #include "logfile.h" */ /* (requires stat.h) struct logfile */
153 * Parameters for the Detach() routine
159 #define D_REMOTE_POWER 4
164 * Here are the messages the attacher sends to the backend
171 #define MSG_POW_DETACH 5
174 #define MSG_COMMAND 8
177 * versions of struct msg:
178 * 0: screen version 3.6.6 (version count introduced)
179 * 1: screen version 4.1.0
181 #define MSG_VERSION 1
182 #define MSG_REVISION (('m'<<24) | ('s'<<16) | ('g'<<8) | MSG_VERSION)
185 int protocol_revision
; /* reduce harm done by incompatible messages */
187 char m_tty
[MAXPATHLEN
]; /* ttyname */
195 int hheight
; /* size of scrollback buffer */
197 char line
[MAXPATHLEN
];
198 char dir
[MAXPATHLEN
];
199 char screenterm
[20]; /* is screen really "screen" ? */
204 char auser
[20 + 1]; /* username */
205 int apid
; /* pid of frontend */
206 int adaptflag
; /* adapt window size? */
207 int lines
, columns
; /* display size */
209 int esc
; /* his new escape character unless -1 */
210 int meta_esc
; /* his new meta esc character unless -1 */
211 char envterm
[20 + 1]; /* terminal type */
212 int encoding
; /* encoding of display */
213 int detachfirst
; /* whether to detach remote sessions first */
218 char duser
[20 + 1]; /* username */
219 int dpid
; /* pid of frontend */
224 char auser
[20 + 1]; /* username */
226 char cmd
[MAXPATHLEN
]; /* command */
227 int apid
; /* pid of frontend */
231 char message
[MAXPATHLEN
* 2];
236 * And the signals the attacher receives from the backend
238 #define SIG_BYE SIGHUP
239 #define SIG_POWER_BYE SIGUSR1
240 #define SIG_LOCK SIGUSR2
241 #define SIG_STOP SIGTSTP
243 #define SIG_NODEBUG SIGIO /* triggerd by command 'debug off' */
247 #define BELL (Ctrl('g'))
248 #define VBELLWAIT 1 /* No. of seconds a vbell will be displayed */
250 #define BELL_ON 0 /* No bell has occurred in the window */
251 #define BELL_FOUND 1 /* A bell has occurred, but user not yet notified */
252 #define BELL_DONE 2 /* A bell has occured, user has been notified */
254 #define BELL_VISUAL 3 /* A bell has occured in fore win, notify him visually */
256 #define MON_OFF 0 /* Monitoring is off in the window */
257 #define MON_ON 1 /* No activity has occurred in the window */
258 #define MON_FOUND 2 /* Activity has occured, but user not yet notified */
259 #define MON_DONE 3 /* Activity has occured, user has been notified */
261 #define DUMP_TERMCAP 0 /* WriteFile() options */
262 #define DUMP_HARDCOPY 1
263 #define DUMP_EXCHANGE 2
264 #define DUMP_SCROLLBACK 3
266 #define SILENCE_OFF 0
269 extern char strnomem
[];
272 * line modes used by Input()
289 #define MAX_PLOP_DEFS 256
293 int idx
; /* the index in the bsd-is padding lookup table */
294 int bps
; /* bits per seconds */
295 int sym
; /* symbol defined in ttydev.h */
303 #define WLIST_NESTED 2