b9b7a241a5c8882ac6a897372cb906bddd454012
[screen-lua.git] / src / comm.c
blobb9b7a241a5c8882ac6a897372cb906bddd454012
1 /* Copyright (c) 2008
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 #ifdef MULTI
161 { "defnonblock", ARGS_1 },
162 #endif
163 { "defobuflimit", ARGS_1 },
164 #ifdef COPY_PASTE
165 { "defscrollback", ARGS_1 },
166 #endif
167 { "defshell", ARGS_1 },
168 { "defsilence", ARGS_1 },
169 { "defslowpaste", ARGS_1 },
170 #ifdef UTF8
171 { "defutf8", ARGS_1 },
172 #endif
173 { "defwrap", ARGS_1 },
174 { "defwritelock", ARGS_1 },
175 #ifdef DETACH
176 { "detach", NEED_DISPLAY|ARGS_01 },
177 #endif
178 { "digraph", NEED_LAYER|ARGS_01 },
179 { "dinfo", NEED_DISPLAY|ARGS_0 },
180 { "displays", NEED_LAYER|ARGS_0 },
181 { "dumptermcap", NEED_FORE|ARGS_0 },
182 { "echo", ARGS_12 },
183 #ifdef ENCODINGS
184 { "encoding", ARGS_12 },
185 #endif
186 { "escape", ARGS_1 },
187 { "eval", ARGS_1|ARGS_ORMORE },
188 #ifdef PSEUDOS
189 { "exec", ARGS_0|ARGS_ORMORE },
190 #endif
191 { "fit", NEED_DISPLAY|ARGS_0 },
192 { "flow", NEED_FORE|ARGS_01 },
193 { "focus", NEED_DISPLAY|ARGS_01 },
194 { "focusminsize", ARGS_02 },
195 { "gr", NEED_FORE|ARGS_01 },
196 { "group", NEED_FORE|ARGS_01 },
197 { "hardcopy", ARGS_012 },
198 { "hardcopy_append", ARGS_1 },
199 { "hardcopydir", ARGS_01 },
200 { "hardstatus", ARGS_012 },
201 { "height", ARGS_0123 },
202 { "help", NEED_LAYER|ARGS_02 },
203 #ifdef COPY_PASTE
204 { "history", NEED_DISPLAY|NEED_FORE|ARGS_0 },
205 #endif
206 { "hstatus", NEED_FORE|ARGS_1 },
207 { "idle", ARGS_0|ARGS_ORMORE },
208 { "ignorecase", ARGS_01 },
209 { "info", NEED_LAYER|ARGS_0 },
210 #ifdef ENCODINGS
211 { "kanji", NEED_FORE|ARGS_12 },
212 #endif
213 { "kill", NEED_FORE|ARGS_0 },
214 { "lastmsg", NEED_DISPLAY|ARGS_0 },
215 { "layout", ARGS_1|ARGS_ORMORE},
216 { "license", NEED_LAYER|ARGS_0 },
217 #ifdef LOCK
218 { "lockscreen", NEED_DISPLAY|ARGS_0 },
219 #endif
220 { "log", NEED_FORE|ARGS_01 },
221 { "logfile", ARGS_012 },
222 #if defined(UTMPOK) && defined(LOGOUTOK)
223 { "login", NEED_FORE|ARGS_01 },
224 #endif
225 { "logtstamp", ARGS_012 },
226 #ifdef MAPKEYS
227 { "mapdefault", NEED_DISPLAY|ARGS_0 },
228 { "mapnotnext", NEED_DISPLAY|ARGS_0 },
229 { "maptimeout", ARGS_01 },
230 #endif
231 #ifdef COPY_PASTE
232 { "markkeys", ARGS_1 },
233 #endif
234 { "maxwin", ARGS_1 },
235 { "meta", NEED_LAYER|ARGS_0 },
236 { "monitor", NEED_FORE|ARGS_01 },
237 { "msgminwait", ARGS_1 },
238 { "msgwait", ARGS_1 },
239 #ifdef MULTIUSER
240 { "multiuser", ARGS_1 },
241 #endif
242 #ifdef NETHACK
243 { "nethack", ARGS_1 },
244 #endif
245 { "next", ARGS_0 },
246 #ifdef MULTI
247 { "nonblock", NEED_DISPLAY|ARGS_01 },
248 #endif
249 { "number", NEED_FORE|ARGS_01 },
250 { "obuflimit", NEED_DISPLAY|ARGS_01 },
251 { "only", NEED_DISPLAY|ARGS_0 },
252 { "other", ARGS_0 },
253 { "partial", NEED_FORE|ARGS_01 },
254 #ifdef PASSWORD
255 { "password", ARGS_01 },
256 #endif
257 #ifdef COPY_PASTE
258 { "paste", NEED_LAYER|ARGS_012 },
259 { "pastefont", ARGS_01 },
260 #endif
261 { "pow_break", NEED_FORE|ARGS_01 },
262 #if defined(DETACH) && defined(POW_DETACH)
263 { "pow_detach", NEED_DISPLAY|ARGS_0 },
264 { "pow_detach_msg", ARGS_01 },
265 #endif
266 { "prev", ARGS_0 },
267 { "printcmd", ARGS_01 },
268 { "process", NEED_DISPLAY|ARGS_01 },
269 { "quit", ARGS_0 },
270 #ifdef COPY_PASTE
271 { "readbuf", ARGS_0123 },
272 #endif
273 { "readreg", ARGS_0|ARGS_ORMORE },
274 { "redisplay", NEED_DISPLAY|ARGS_0 },
275 { "register", ARGS_24 },
276 { "remove", NEED_DISPLAY|ARGS_0 },
277 #ifdef COPY_PASTE
278 { "removebuf", ARGS_0 },
279 #endif
280 { "rendition", ARGS_23 },
281 { "reset", NEED_FORE|ARGS_0 },
282 { "resize", NEED_DISPLAY|ARGS_0|ARGS_ORMORE },
283 { "screen", ARGS_0|ARGS_ORMORE },
284 #ifdef COPY_PASTE
285 { "scrollback", NEED_FORE|ARGS_1 },
286 #endif
287 { "select", ARGS_01 },
288 { "sessionname", ARGS_01 },
289 { "setenv", ARGS_012 },
290 { "setsid", ARGS_1 },
291 { "shell", ARGS_1 },
292 { "shelltitle", ARGS_1 },
293 { "silence", NEED_FORE|ARGS_01 },
294 { "silencewait", ARGS_1 },
295 { "sleep", ARGS_1 },
296 { "slowpaste", NEED_FORE|ARGS_01 },
297 { "sorendition", ARGS_012 },
298 { "source", ARGS_1 },
299 { "split", NEED_DISPLAY|ARGS_01 },
300 { "startup_message", ARGS_1 },
301 { "stuff", NEED_LAYER|ARGS_012 },
302 #ifdef MULTIUSER
303 { "su", NEED_DISPLAY|ARGS_012 },
304 #endif
305 #ifdef BSDJOBS
306 { "suspend", NEED_DISPLAY|ARGS_0 },
307 #endif
308 { "term", ARGS_1 },
309 { "termcap", ARGS_23 },
310 { "termcapinfo", ARGS_23 },
311 { "terminfo", ARGS_23 },
312 { "time", ARGS_01 },
313 { "title", NEED_FORE|ARGS_01 },
314 { "umask", ARGS_1|ARGS_ORMORE },
315 { "unsetenv", ARGS_1 },
316 #ifdef UTF8
317 { "utf8", NEED_FORE|ARGS_012 },
318 #endif
319 { "vbell", ARGS_01 },
320 { "vbell_msg", ARGS_01 },
321 { "vbellwait", ARGS_1 },
322 { "verbose", ARGS_01 },
323 { "version", ARGS_0 },
324 { "wall", NEED_DISPLAY|ARGS_1},
325 { "width", ARGS_0123 },
326 { "windowlist", ARGS_012 },
327 { "windows", NEED_DISPLAY|ARGS_0 },
328 { "wrap", NEED_FORE|ARGS_01 },
329 #ifdef COPY_PASTE
330 { "writebuf", ARGS_0123 },
331 #endif
332 { "writelock", NEED_FORE|ARGS_01 },
333 { "xoff", NEED_LAYER|ARGS_0 },
334 { "xon", NEED_LAYER|ARGS_0 },
335 #ifdef ZMODEM
336 { "zmodem", ARGS_012 },
337 #endif
338 { "zombie", ARGS_012 }