Add support for mouse tracking.
[screen-lua.git] / src / comm.c
blob4921911dcc1393e0b3dd2f54b0a92ca6384c120d
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 #ifdef HAVE_BRAILLE
12 * Modified by:
13 * Authors: Hadi Bargi Rangin bargi@dots.physics.orst.edu
14 * Bill Barry barryb@dots.physics.orst.edu
16 * Modifications Copyright (c) 1995 by
17 * Science Access Project, Oregon State University.
18 #endif
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 3, or (at your option)
23 * any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program (see the file COPYING); if not, see
32 * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
33 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
35 ****************************************************************
38 #include "config.h"
39 #include "acls.h"
40 #include "comm.h"
42 #define bcopy :-( /* or include screen.h here */
44 /* Must be in alpha order ! */
46 struct comm comms[RC_LAST + 1] =
48 #ifdef MULTIUSER
49 { "acladd", ARGS_1234 },
50 { "aclchg", ARGS_23 },
51 { "acldel", ARGS_1 },
52 { "aclgrp", ARGS_12 },
53 { "aclumask", ARGS_1|ARGS_ORMORE },
54 #endif
55 { "activity", ARGS_1 },
56 #ifdef MULTIUSER
57 { "addacl", ARGS_1234 },
58 #endif
59 { "allpartial", NEED_DISPLAY|ARGS_1 },
60 { "altscreen", ARGS_01 },
61 { "at", NEED_DISPLAY|ARGS_2|ARGS_ORMORE },
62 #ifdef COLOR
63 { "attrcolor", ARGS_12 },
64 #endif
65 { "autodetach", ARGS_1 },
66 #ifdef AUTO_NUKE
67 { "autonuke", NEED_DISPLAY|ARGS_1 },
68 #endif
69 { "backtick", ARGS_1|ARGS_ORMORE },
70 #ifdef COLOR
71 { "bce", NEED_FORE|ARGS_01 },
72 #endif
74 #ifdef HAVE_BRAILLE
75 /* keywords for braille display (bd) */
76 { "bd_bc_down", ARGS_0 },
77 { "bd_bc_left", ARGS_0 },
78 { "bd_bc_right", ARGS_0 },
79 { "bd_bc_up", ARGS_0 },
80 { "bd_bell", ARGS_01 },
81 { "bd_braille_table", ARGS_01 },
82 { "bd_eightdot", ARGS_01 },
83 { "bd_info", ARGS_01 },
84 { "bd_link", ARGS_01 },
85 { "bd_lower_left", ARGS_0 },
86 { "bd_lower_right", ARGS_0 },
87 { "bd_ncrc", ARGS_01 },
88 { "bd_port", ARGS_01 },
89 { "bd_scroll", ARGS_01 },
90 { "bd_skip", ARGS_01 },
91 { "bd_start_braille", ARGS_01 },
92 { "bd_type", ARGS_01 },
93 { "bd_upper_left", ARGS_0 },
94 { "bd_upper_right", ARGS_0 },
95 { "bd_width", ARGS_01 },
96 #endif
98 { "bell", ARGS_01 },
99 { "bell_msg", ARGS_01 },
100 { "bind", ARGS_1|ARGS_ORMORE },
101 #ifdef MAPKEYS
102 { "bindkey", ARGS_0|ARGS_ORMORE },
103 #endif
104 { "blanker", NEED_DISPLAY|ARGS_0},
105 #ifdef BLANKER_PRG
106 { "blankerprg", ARGS_1|ARGS_ORMORE },
107 #endif
108 { "break", NEED_FORE|ARGS_01 },
109 { "breaktype", NEED_FORE|ARGS_01 },
110 #ifdef COPY_PASTE
111 { "bufferfile", ARGS_01 },
112 #endif
113 { "c1", NEED_FORE|ARGS_01 },
114 { "caption", ARGS_12 },
115 #ifdef MULTIUSER
116 { "chacl", ARGS_23 },
117 #endif
118 { "charset", NEED_FORE|ARGS_1 },
119 { "chdir", ARGS_01 },
120 #ifdef DW_CHARS
121 { "cjkwidth", ARGS_01 },
122 #endif
123 { "clear", NEED_FORE|ARGS_0 },
124 { "colon", NEED_LAYER|ARGS_01 },
125 { "command", NEED_DISPLAY|ARGS_02 },
126 #ifdef COPY_PASTE
127 { "compacthist", ARGS_01 },
128 #endif
129 { "console", NEED_FORE|ARGS_01 },
130 #ifdef COPY_PASTE
131 { "copy", NEED_FORE|NEED_DISPLAY|ARGS_0 },
132 { "crlf", ARGS_01 },
133 #endif
134 { "debug", ARGS_01 },
135 #ifdef AUTO_NUKE
136 { "defautonuke", ARGS_1 },
137 #endif
138 #ifdef COLOR
139 { "defbce", ARGS_1 },
140 #endif
141 { "defbreaktype", ARGS_01 },
142 { "defc1", ARGS_1 },
143 { "defcharset", ARGS_01 },
144 #ifdef ENCODINGS
145 { "defencoding", ARGS_1 },
146 #endif
147 { "defescape", ARGS_1 },
148 { "defflow", ARGS_12 },
149 { "defgr", ARGS_1 },
150 { "defhstatus", ARGS_01 },
151 #ifdef ENCODINGS
152 { "defkanji", ARGS_1 },
153 #endif
154 { "deflog", ARGS_1 },
155 #if defined(UTMPOK) && defined(LOGOUTOK)
156 { "deflogin", ARGS_1 },
157 #endif
158 { "defmode", ARGS_1 },
159 { "defmonitor", ARGS_1 },
160 { "defmousetrack", ARGS_1 },
161 #ifdef MULTI
162 { "defnonblock", ARGS_1 },
163 #endif
164 { "defobuflimit", ARGS_1 },
165 #ifdef COPY_PASTE
166 { "defscrollback", ARGS_1 },
167 #endif
168 { "defshell", ARGS_1 },
169 { "defsilence", ARGS_1 },
170 { "defslowpaste", ARGS_1 },
171 #ifdef UTF8
172 { "defutf8", ARGS_1 },
173 #endif
174 { "defwrap", ARGS_1 },
175 { "defwritelock", ARGS_1 },
176 #ifdef DETACH
177 { "detach", NEED_DISPLAY|ARGS_01 },
178 #endif
179 { "digraph", NEED_LAYER|ARGS_012 },
180 { "dinfo", NEED_DISPLAY|ARGS_0 },
181 { "displays", NEED_LAYER|ARGS_0 },
182 { "dumptermcap", NEED_FORE|ARGS_0 },
183 { "echo", ARGS_12 },
184 #ifdef ENCODINGS
185 { "encoding", ARGS_12 },
186 #endif
187 { "escape", ARGS_1 },
188 { "eval", ARGS_1|ARGS_ORMORE },
189 #ifdef PSEUDOS
190 { "exec", ARGS_0|ARGS_ORMORE },
191 #endif
192 { "fit", NEED_DISPLAY|ARGS_0 },
193 { "flow", NEED_FORE|ARGS_01 },
194 { "focus", NEED_DISPLAY|ARGS_01 },
195 { "focusminsize", ARGS_02 },
196 { "gr", NEED_FORE|ARGS_01 },
197 { "group", NEED_FORE|ARGS_01 },
198 { "hardcopy", ARGS_012 },
199 { "hardcopy_append", ARGS_1 },
200 { "hardcopydir", ARGS_01 },
201 { "hardstatus", ARGS_012 },
202 { "height", ARGS_0123 },
203 { "help", NEED_LAYER|ARGS_02 },
204 #ifdef COPY_PASTE
205 { "history", NEED_DISPLAY|NEED_FORE|ARGS_0 },
206 #endif
207 { "hstatus", NEED_FORE|ARGS_1 },
208 { "idle", ARGS_0|ARGS_ORMORE },
209 { "ignorecase", ARGS_01 },
210 { "info", NEED_LAYER|ARGS_0 },
211 #ifdef ENCODINGS
212 { "kanji", NEED_FORE|ARGS_12 },
213 #endif
214 { "kill", NEED_FORE|ARGS_0 },
215 { "lastmsg", NEED_DISPLAY|ARGS_0 },
216 { "layout", ARGS_1|ARGS_ORMORE},
217 { "license", NEED_LAYER|ARGS_0 },
218 #ifdef LOCK
219 { "lockscreen", NEED_DISPLAY|ARGS_0 },
220 #endif
221 { "log", NEED_FORE|ARGS_01 },
222 { "logfile", ARGS_012 },
223 #if defined(UTMPOK) && defined(LOGOUTOK)
224 { "login", NEED_FORE|ARGS_01 },
225 #endif
226 { "logtstamp", ARGS_012 },
227 #ifdef MAPKEYS
228 { "mapdefault", NEED_DISPLAY|ARGS_0 },
229 { "mapnotnext", NEED_DISPLAY|ARGS_0 },
230 { "maptimeout", ARGS_01 },
231 #endif
232 #ifdef COPY_PASTE
233 { "markkeys", ARGS_1 },
234 #endif
235 { "maxwin", ARGS_1 },
236 { "meta", NEED_LAYER|ARGS_0 },
237 { "monitor", NEED_FORE|ARGS_01 },
238 { "mousetrack", NEED_DISPLAY | ARGS_01 },
239 { "msgminwait", ARGS_1 },
240 { "msgwait", ARGS_1 },
241 #ifdef MULTIUSER
242 { "multiuser", ARGS_1 },
243 #endif
244 #ifdef NETHACK
245 { "nethack", ARGS_1 },
246 #endif
247 { "next", ARGS_0 },
248 #ifdef MULTI
249 { "nonblock", NEED_DISPLAY|ARGS_01 },
250 #endif
251 { "number", NEED_FORE|ARGS_01 },
252 { "obuflimit", NEED_DISPLAY|ARGS_01 },
253 { "only", NEED_DISPLAY|ARGS_0 },
254 { "other", ARGS_0 },
255 { "partial", NEED_FORE|ARGS_01 },
256 #ifdef PASSWORD
257 { "password", ARGS_01 },
258 #endif
259 #ifdef COPY_PASTE
260 { "paste", NEED_LAYER|ARGS_012 },
261 { "pastefont", ARGS_01 },
262 #endif
263 { "pow_break", NEED_FORE|ARGS_01 },
264 #if defined(DETACH) && defined(POW_DETACH)
265 { "pow_detach", NEED_DISPLAY|ARGS_0 },
266 { "pow_detach_msg", ARGS_01 },
267 #endif
268 { "prev", ARGS_0 },
269 { "printcmd", ARGS_01 },
270 { "process", NEED_DISPLAY|ARGS_01 },
271 { "quit", ARGS_0 },
272 #ifdef COPY_PASTE
273 { "readbuf", ARGS_0123 },
274 #endif
275 { "readreg", ARGS_0|ARGS_ORMORE },
276 { "redisplay", NEED_DISPLAY|ARGS_0 },
277 { "register", ARGS_24 },
278 { "remove", NEED_DISPLAY|ARGS_0 },
279 #ifdef COPY_PASTE
280 { "removebuf", ARGS_0 },
281 #endif
282 { "rendition", ARGS_23 },
283 { "reset", NEED_FORE|ARGS_0 },
284 { "resize", NEED_DISPLAY|ARGS_0|ARGS_ORMORE },
285 { "screen", ARGS_0|ARGS_ORMORE },
286 #ifdef COPY_PASTE
287 { "scrollback", NEED_FORE|ARGS_1 },
288 #endif
289 { "select", ARGS_01 },
290 { "sessionname", ARGS_01 },
291 { "setenv", ARGS_012 },
292 { "setsid", ARGS_1 },
293 { "shell", ARGS_1 },
294 { "shelltitle", ARGS_1 },
295 { "silence", NEED_FORE|ARGS_01 },
296 { "silencewait", ARGS_1 },
297 { "sleep", ARGS_1 },
298 { "slowpaste", NEED_FORE|ARGS_01 },
299 { "sorendition", ARGS_012 },
300 { "source", ARGS_1 },
301 { "split", NEED_DISPLAY|ARGS_01 },
302 { "startup_message", ARGS_1 },
303 { "stuff", NEED_LAYER|ARGS_012 },
304 #ifdef MULTIUSER
305 { "su", NEED_DISPLAY|ARGS_012 },
306 #endif
307 #ifdef BSDJOBS
308 { "suspend", NEED_DISPLAY|ARGS_0 },
309 #endif
310 { "term", ARGS_1 },
311 { "termcap", ARGS_23 },
312 { "termcapinfo", ARGS_23 },
313 { "terminfo", ARGS_23 },
314 { "time", ARGS_01 },
315 { "title", NEED_FORE|ARGS_01 },
316 { "umask", ARGS_1|ARGS_ORMORE },
317 { "unbindall", ARGS_0 },
318 { "unsetenv", ARGS_1 },
319 #ifdef UTF8
320 { "utf8", NEED_FORE|ARGS_012 },
321 #endif
322 { "vbell", ARGS_01 },
323 { "vbell_msg", ARGS_01 },
324 { "vbellwait", ARGS_1 },
325 { "verbose", ARGS_01 },
326 { "version", ARGS_0 },
327 { "wall", NEED_DISPLAY|ARGS_1},
328 { "width", ARGS_0123 },
329 { "windowlist", ARGS_012 },
330 { "windows", NEED_DISPLAY|ARGS_0 },
331 { "wrap", NEED_FORE|ARGS_01 },
332 #ifdef COPY_PASTE
333 { "writebuf", ARGS_0123 },
334 #endif
335 { "writelock", NEED_FORE|ARGS_01 },
336 { "xoff", NEED_LAYER|ARGS_0 },
337 { "xon", NEED_LAYER|ARGS_0 },
338 #ifdef ZMODEM
339 { "zmodem", ARGS_012 },
340 #endif
341 { "zombie", ARGS_012 }