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