Implement screens.layouts.
[screen-lua.git] / src / comm.c
blob0762f768b94ad5cfb59177391815349eb5755ab1
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 { "alias", ARGS_12|ARGS_ORMORE },
60 { "allpartial", NEED_DISPLAY|ARGS_1 },
61 { "altscreen", ARGS_01 },
62 { "at", NEED_DISPLAY|ARGS_2|ARGS_ORMORE },
63 #ifdef COLOR
64 { "attrcolor", ARGS_12 },
65 #endif
66 { "autodetach", ARGS_1 },
67 #ifdef AUTO_NUKE
68 { "autonuke", NEED_DISPLAY|ARGS_1 },
69 #endif
70 { "backtick", ARGS_1|ARGS_ORMORE },
71 #ifdef COLOR
72 { "bce", NEED_FORE|ARGS_01 },
73 #endif
75 #ifdef HAVE_BRAILLE
76 /* keywords for braille display (bd) */
77 { "bd_bc_down", ARGS_0 },
78 { "bd_bc_left", ARGS_0 },
79 { "bd_bc_right", ARGS_0 },
80 { "bd_bc_up", ARGS_0 },
81 { "bd_bell", ARGS_01 },
82 { "bd_braille_table", ARGS_01 },
83 { "bd_eightdot", ARGS_01 },
84 { "bd_info", ARGS_01 },
85 { "bd_link", ARGS_01 },
86 { "bd_lower_left", ARGS_0 },
87 { "bd_lower_right", ARGS_0 },
88 { "bd_ncrc", ARGS_01 },
89 { "bd_port", ARGS_01 },
90 { "bd_scroll", ARGS_01 },
91 { "bd_skip", ARGS_01 },
92 { "bd_start_braille", ARGS_01 },
93 { "bd_type", ARGS_01 },
94 { "bd_upper_left", ARGS_0 },
95 { "bd_upper_right", ARGS_0 },
96 { "bd_width", ARGS_01 },
97 #endif
99 { "bell", ARGS_01 },
100 { "bell_msg", ARGS_01 },
101 { "bind", ARGS_1|ARGS_ORMORE },
102 #ifdef MAPKEYS
103 { "bindkey", ARGS_0|ARGS_ORMORE },
104 #endif
105 { "blanker", NEED_DISPLAY|ARGS_0},
106 #ifdef BLANKER_PRG
107 { "blankerprg", ARGS_1|ARGS_ORMORE },
108 #endif
109 { "break", NEED_FORE|ARGS_01 },
110 { "breaktype", NEED_FORE|ARGS_01 },
111 #ifdef COPY_PASTE
112 { "bufferfile", ARGS_01 },
113 #endif
114 { "c1", NEED_FORE|ARGS_01 },
115 { "caption", ARGS_12 },
116 #ifdef MULTIUSER
117 { "chacl", ARGS_23 },
118 #endif
119 { "charset", NEED_FORE|ARGS_1 },
120 { "chdir", ARGS_01 },
121 #ifdef DW_CHARS
122 { "cjkwidth", ARGS_01 },
123 #endif
124 { "clear", NEED_FORE|ARGS_0 },
125 { "colon", NEED_LAYER|ARGS_01 },
126 { "command", NEED_DISPLAY|ARGS_02 },
127 #ifdef COPY_PASTE
128 { "compacthist", ARGS_01 },
129 #endif
130 { "console", NEED_FORE|ARGS_01 },
131 #ifdef COPY_PASTE
132 { "copy", NEED_FORE|NEED_DISPLAY|ARGS_0 },
133 { "crlf", ARGS_01 },
134 #endif
135 { "debug", ARGS_01 },
136 #ifdef AUTO_NUKE
137 { "defautonuke", ARGS_1 },
138 #endif
139 #ifdef COLOR
140 { "defbce", ARGS_1 },
141 #endif
142 { "defbreaktype", ARGS_01 },
143 { "defc1", ARGS_1 },
144 { "defcharset", ARGS_01 },
145 #ifdef ENCODINGS
146 { "defencoding", ARGS_1 },
147 #endif
148 { "defescape", ARGS_1 },
149 { "defflow", ARGS_12 },
150 { "defgr", ARGS_1 },
151 { "defhstatus", ARGS_01 },
152 #ifdef ENCODINGS
153 { "defkanji", ARGS_1 },
154 #endif
155 { "deflog", ARGS_1 },
156 #if defined(UTMPOK) && defined(LOGOUTOK)
157 { "deflogin", ARGS_1 },
158 #endif
159 { "defmode", ARGS_1 },
160 { "defmonitor", 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 { "msgminwait", ARGS_1 },
239 { "msgwait", ARGS_1 },
240 #ifdef MULTIUSER
241 { "multiuser", ARGS_1 },
242 #endif
243 #ifdef NETHACK
244 { "nethack", ARGS_1 },
245 #endif
246 { "next", ARGS_0 },
247 #ifdef MULTI
248 { "nonblock", NEED_DISPLAY|ARGS_01 },
249 #endif
250 { "number", NEED_FORE|ARGS_01 },
251 { "obuflimit", NEED_DISPLAY|ARGS_01 },
252 { "only", NEED_DISPLAY|ARGS_0 },
253 { "other", ARGS_0 },
254 { "partial", NEED_FORE|ARGS_01 },
255 #ifdef PASSWORD
256 { "password", ARGS_01 },
257 #endif
258 #ifdef COPY_PASTE
259 { "paste", NEED_LAYER|ARGS_012 },
260 { "pastefont", ARGS_01 },
261 #endif
262 { "pow_break", NEED_FORE|ARGS_01 },
263 #if defined(DETACH) && defined(POW_DETACH)
264 { "pow_detach", NEED_DISPLAY|ARGS_0 },
265 { "pow_detach_msg", ARGS_01 },
266 #endif
267 { "prev", ARGS_0 },
268 { "printcmd", ARGS_01 },
269 { "process", NEED_DISPLAY|ARGS_01 },
270 { "quit", ARGS_0 },
271 #ifdef COPY_PASTE
272 { "readbuf", ARGS_0123 },
273 #endif
274 { "readreg", ARGS_0|ARGS_ORMORE },
275 { "redisplay", NEED_DISPLAY|ARGS_0 },
276 { "register", ARGS_24 },
277 { "remove", NEED_DISPLAY|ARGS_0 },
278 #ifdef COPY_PASTE
279 { "removebuf", ARGS_0 },
280 #endif
281 { "rendition", ARGS_23 },
282 { "reset", NEED_FORE|ARGS_0 },
283 { "resize", NEED_DISPLAY|ARGS_0|ARGS_ORMORE },
284 { "screen", ARGS_0|ARGS_ORMORE },
285 #ifdef SCRIPT
286 { "script", ARGS_2|ARGS_ORMORE },
287 #endif
288 #ifdef COPY_PASTE
289 { "scrollback", NEED_FORE|ARGS_1 },
290 #endif
291 { "select", ARGS_01 },
292 { "sessionname", ARGS_01 },
293 { "setenv", ARGS_012 },
294 { "setsid", ARGS_1 },
295 { "shell", ARGS_1 },
296 { "shelltitle", ARGS_1 },
297 { "silence", NEED_FORE|ARGS_01 },
298 { "silencewait", ARGS_1 },
299 { "sleep", ARGS_1 },
300 { "slowpaste", NEED_FORE|ARGS_01 },
301 { "sorendition", ARGS_012 },
302 { "source", ARGS_1 },
303 { "split", NEED_DISPLAY|ARGS_01 },
304 { "startup_message", ARGS_1 },
305 { "stuff", NEED_LAYER|ARGS_012 },
306 #ifdef MULTIUSER
307 { "su", NEED_DISPLAY|ARGS_012 },
308 #endif
309 #ifdef BSDJOBS
310 { "suspend", NEED_DISPLAY|ARGS_0 },
311 #endif
312 { "term", ARGS_1 },
313 { "termcap", ARGS_23 },
314 { "termcapinfo", ARGS_23 },
315 { "terminfo", ARGS_23 },
316 { "time", ARGS_01 },
317 { "title", NEED_FORE|ARGS_01 },
318 { "umask", ARGS_1|ARGS_ORMORE },
319 { "unsetenv", ARGS_1 },
320 #ifdef UTF8
321 { "utf8", NEED_FORE|ARGS_012 },
322 #endif
323 { "vbell", ARGS_01 },
324 { "vbell_msg", ARGS_01 },
325 { "vbellwait", ARGS_1 },
326 { "verbose", ARGS_01 },
327 { "version", ARGS_0 },
328 { "wall", NEED_DISPLAY|ARGS_1},
329 { "width", ARGS_0123 },
330 { "windowlist", ARGS_012 },
331 { "windows", NEED_DISPLAY|ARGS_0 },
332 { "wrap", NEED_FORE|ARGS_01 },
333 #ifdef COPY_PASTE
334 { "writebuf", ARGS_0123 },
335 #endif
336 { "writelock", NEED_FORE|ARGS_01 },
337 { "xoff", NEED_LAYER|ARGS_0 },
338 { "xon", NEED_LAYER|ARGS_0 },
339 #ifdef ZMODEM
340 { "zmodem", ARGS_012 },
341 #endif
342 { "zombie", ARGS_012 }