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 * https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 ****************************************************************
30 #ifndef SCREEN_SCREEN_H
31 #define SCREEN_SCREEN_H
39 /* here comes my own Free: jw. */
40 #define Free(a) {if ((a) == NULL) abort(); else free((void *)(a)); (a)=NULL;}
42 #define Ctrl(c) ((c)&037)
48 #define SILENCEWAIT 30
51 * if a nasty user really wants to try a history of 3000 lines on all 10
52 * windows, he will allocate 8 MegaBytes of memory, which is quite enough.
54 #define MAXHISTHEIGHT 3000
55 #define DEFAULTHISTHEIGHT 100
56 #define DEFAULT_BUFFERFILE "/tmp/screen-exchange"
61 struct jtchars m_jtchars
;
75 * Parameters for the Detach() routine
81 #define D_REMOTE_POWER 4
86 * Here are the messages the attacher sends to the backend
93 #define MSG_POW_DETACH 5
100 * versions of struct Message:
101 * 0: screen version 3.6.6 (version count introduced)
102 * 1: screen version 4.1.0devel (revisions e3fc19a upto 8147d08)
103 * A few revisions after 8147d08 incorrectly
104 * carried version 1, but should have carried 2.
105 * 2: screen version 4.1.0devel (revisions 8b46d8a upto YYYYYYY)
106 * 3: screen version 4.2.0 (was incorrectly originally. Patched here)
107 * 4: screen version 4.2.1 (bumped once again due to changed terminal and login length)
109 #define MSG_VERSION 4
111 #define MSG_REVISION (('m'<<24) | ('s'<<16) | ('g'<<8) | MSG_VERSION)
112 typedef struct Message Message
;
114 int protocol_revision
; /* reduce harm done by incompatible messages */
116 char m_tty
[MAXPATHLEN
]; /* ttyname */
123 int hheight
; /* size of scrollback buffer */
125 char line
[MAXPATHLEN
];
126 char dir
[MAXPATHLEN
];
127 char screenterm
[MAXTERMLEN
+ 1];/* is screen really "screen" ? */
130 char auser
[MAXLOGINLEN
+ 1]; /* username */
131 pid_t apid
; /* pid of frontend */
132 int adaptflag
; /* adapt window size? */
133 int lines
, columns
; /* display size */
135 int esc
; /* his new escape character unless -1 */
136 int meta_esc
; /* his new meta esc character unless -1 */
137 char envterm
[MAXTERMLEN
+ 1]; /* terminal type */
138 int encoding
; /* encoding of display */
139 int detachfirst
; /* whether to detach remote sessions first */
142 char duser
[MAXLOGINLEN
+ 1]; /* username */
143 pid_t dpid
; /* pid of frontend */
146 char auser
[MAXLOGINLEN
+ 1]; /* username */
148 char cmd
[MAXPATHLEN
+ 1]; /* command */
149 pid_t apid
; /* pid of frontend */
151 char writeback
[MAXPATHLEN
]; /* The socket to write the result.
152 Only used for MSG_QUERY */
154 char message
[MAXPATHLEN
* 2];
159 * And the signals the attacher receives from the backend
161 #define SIG_BYE SIGHUP
162 #define SIG_POWER_BYE SIGUSR1
163 #define SIG_LOCK SIGUSR2
164 #define SIG_STOP SIGTSTP
166 #define BELL (Ctrl('g'))
167 #define VBELLWAIT 1 /* No. of seconds a vbell will be displayed */
169 #define BELL_ON 0 /* No bell has occurred in the window */
170 #define BELL_FOUND 1 /* A bell has occurred, but user not yet notified */
171 #define BELL_DONE 2 /* A bell has occured, user has been notified */
173 #define BELL_VISUAL 3 /* A bell has occured in fore win, notify him visually */
175 #define MON_OFF 0 /* Monitoring is off in the window */
176 #define MON_ON 1 /* No activity has occurred in the window */
177 #define MON_FOUND 2 /* Activity has occured, but user not yet notified */
178 #define MON_DONE 3 /* Activity has occured, user has been notified */
180 #define DUMP_TERMCAP 0 /* WriteFile() options */
181 #define DUMP_HARDCOPY 1
182 #define DUMP_EXCHANGE 2
183 #define DUMP_SCROLLBACK 3
185 #define SILENCE_OFF 0 /* Not checking for silence */
186 #define SILENCE_ON 1 /* Window being monitored for silence */
187 #define SILENCE_FOUND 2 /* Window is silent */
188 #define SILENCE_DONE 3 /* Window is silent and user is notified */
191 * line modes used by Input()
206 #define MAX_PLOP_DEFS 256
209 int bps
; /* bits per seconds */
210 int sym
; /* symbol defined in bits/termios.h */
218 #define WLIST_NESTED 2
221 void eexit (int) __attribute__((__noreturn__
));
224 void Kill (pid_t
, int);
225 void Msg (int, const char *, ...) __attribute__((format(printf
, 2, 3)));
226 void Panic (int, const char *, ...) __attribute__((format(printf
, 2, 3))) __attribute__((__noreturn__
));
227 void QueryMsg (int, const char *, ...) __attribute__((format(printf
, 2, 3)));
228 void Dummy (int, const char *, ...) __attribute__((format(printf
, 2, 3)));
229 void Finit (int) __attribute__((__noreturn__
));
230 void MakeNewEnv (void);
231 void PutWinMsg (char *, int, int);
232 void setbacktick (int, int, int, char **);
234 /* global variables */
236 /* Content of the tty symlink when attach_tty_is_in_new_ns == true. */
237 extern char attach_tty_name_in_ns
[];
238 extern char strnomem
[];
239 extern char HostName
[];
240 extern char SocketPath
[MAXPATHLEN
];
241 extern char *attach_tty
;
242 extern char *attach_term
;
243 extern char *captionstring
;
244 extern char *hardcopydir
;
246 extern char *hstatusstring
;
247 extern char *logtstamp_string
;
249 extern char *preselect
;
250 extern char *screenencodings
;
251 extern char *screenlogfile
;
252 extern char *wliststr
;
253 extern char *wlisttit
;
254 extern char *ActivityString
;
255 extern char *BellString
;
256 extern char *BufferFile
;
257 extern char *LoginName
;
258 extern char *PowDetachString
;
259 extern char *RcFileName
;
260 extern char *ShellArgs
[];
261 extern char *ShellProg
;
262 extern char *SocketMatch
;
263 extern char *SocketName
;
264 extern char *VisualBellString
;
265 extern char **NewEnv
;
267 extern bool adaptflag
;
268 extern bool auto_detach
;
269 extern bool cjkwidth
;
270 extern bool default_startup
;
272 extern bool hastruecolor
;
274 extern bool logtstamp_on
;
276 extern bool quietflag
;
277 extern bool wipeflag
;
279 /* Indicator whether the current tty exists in another namespace. */
280 extern bool attach_tty_is_in_new_ns
;
283 extern int attach_fd
;
286 extern int log_flush
;
287 extern int logtstamp_after
;
288 extern uid_t multi_uid
;
289 extern int multiattach
;
291 extern uid_t own_uid
;
292 extern int queryflag
;
295 extern int tty_oldmode
;
296 extern pid_t MasterPid
;
297 extern int MsgMinWait
;
299 extern int ServerSocket
;
300 extern int SilenceWait
;
301 extern int VBellWait
;
302 extern int ZombieKey_destroy
;
303 extern int ZombieKey_onerror
;
304 extern int ZombieKey_resurrect
;
306 extern Window
*console_window
;
308 extern Window
*mru_window
;
309 extern Window
*first_window
;
310 extern Window
*last_window
;
312 extern Layer
*flayer
;
314 extern Event logflushev
;
315 extern Event serv_read
;
317 extern struct mode attach_Mode
;
319 extern gid_t eff_gid
;
320 extern gid_t real_gid
;
322 extern uid_t eff_uid
;
323 extern uid_t real_uid
;
325 extern struct passwd
*ppp
;
327 #endif /* SCREEN_SCREEN_H */