source: commands.c @ aa5f725

barnowl_perlaimdebianowlrelease-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since aa5f725 was aa5f725, checked in by James M. Kretchmar <kretch@mit.edu>, 18 years ago
added buddylists added the 'alist' command to print logged in aimusers added the 'blist' command which prints buddies logged in from all protocols. 'l' is now bound to 'blist' by default
  • Property mode set to 100644
File size: 58.0 KB
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <unistd.h>
5#include "owl.h"
6
7static const char fileIdent[] = "$Id$";
8
9/* fn is "char *foo(int argc, char **argv, char *buff)" */
10#define OWLCMD_ARGS(name, fn, ctx, summary, usage, description) \
11        { name, summary, usage, description, ctx, \
12          NULL, fn, NULL, NULL, NULL, NULL, NULL }
13
14/* fn is "void foo(void)" */
15#define OWLCMD_VOID(name, fn, ctx, summary, usage, description) \
16        { name, summary, usage, description, ctx, \
17          NULL, NULL, fn, NULL, NULL, NULL, NULL }
18
19/* fn is "void foo(int)" */
20#define OWLCMD_INT(name, fn, ctx, summary, usage, description) \
21        { name, summary, usage, description, ctx, \
22          NULL, NULL, NULL, fn, NULL, NULL, NULL }
23
24#define OWLCMD_ALIAS(name, actualname) \
25        { name, OWL_CMD_ALIAS_SUMMARY_PREFIX actualname, "", "", OWL_CTX_ANY, \
26          actualname, NULL, NULL, NULL, NULL, NULL, NULL }
27
28/* fn is "char *foo(void *ctx, int argc, char **argv, char *buff)" */
29#define OWLCMD_ARGS_CTX(name, fn, ctx, summary, usage, description) \
30        { name, summary, usage, description, ctx, \
31          NULL, NULL, NULL, NULL, ((char*(*)(void*,int,char**,char*))fn), NULL, NULL }
32
33/* fn is "void foo(void)" */
34#define OWLCMD_VOID_CTX(name, fn, ctx, summary, usage, description) \
35        { name, summary, usage, description, ctx, \
36          NULL, NULL, NULL, NULL, NULL, ((void(*)(void*))(fn)), NULL }
37
38/* fn is "void foo(int)" */
39#define OWLCMD_INT_CTX(name, fn, ctx, summary, usage, description) \
40        { name, summary, usage, description, ctx, \
41          NULL, NULL, NULL, NULL, NULL, NULL, ((void(*)(void*,int))fn) }
42
43
44owl_cmd commands_to_init[]
45  = {
46  OWLCMD_ARGS("zlog", owl_command_zlog, OWL_CTX_ANY,
47              "send a login or logout notification",
48              "zlog in [tty]\nzlog out",
49              "zlog in will send a login notification, zlog out will send a\n"
50              "logout notification.  By default a login notification is sent\n"
51              "when owl is started and a logout notification is sent when owl\n"
52              "is exited.  This behavior can be changed with the 'startuplogin'\n"
53              "and 'shudownlogout' variables.  If a tty is specified for zlog in\n"
54              "then the owl variable 'tty' will be set to that string, causing\n"
55              "it to be used as the zephyr location tty.\n"),
56
57  OWLCMD_VOID("quit", owl_command_quit, OWL_CTX_ANY,
58              "exit owl",
59              "",
60              "Exit owl and run any shutdown activities."),
61  OWLCMD_ALIAS("exit", "quit"),
62  OWLCMD_ALIAS("q",    "quit"),
63
64  OWLCMD_ARGS("term", owl_command_term, OWL_CTX_ANY,
65              "control the terminal",
66              "term raise\n"
67              "term deiconify\n",
68              ""),
69
70  OWLCMD_VOID("nop", owl_command_nop, OWL_CTX_ANY,
71              "do nothing",
72              "",
73              ""),
74 
75  OWLCMD_ARGS("start-command", owl_command_start_command, OWL_CTX_INTERACTIVE,
76              "prompts the user to enter a command",
77              "start-command [initial-value]",
78              "Initializes the command field to initial-value."),
79
80  OWLCMD_ARGS("alias", owl_command_alias, OWL_CTX_ANY,
81              "creates a command alias",
82              "alias <new_command> <old_command>",
83              "Creates a command alias from new_command to old_command.\n"
84              "Any arguments passed to <new_command> will be appended to\n"
85              "<old_command> before it is executed.\n"),
86
87  OWLCMD_ARGS("bindkey", owl_command_bindkey, OWL_CTX_ANY,
88              "creates a binding in a keymap",
89              "bindkey <keymap> <keyseq> command <command>",
90              "Binds a key sequence to a command within a keymap.\n"
91              "Use 'show keymaps' to see the existing keymaps.\n"
92              "Key sequences may be things like M-C-t or NPAGE.\n"),
93
94  OWLCMD_ARGS("zwrite", owl_command_zwrite, OWL_CTX_INTERACTIVE,
95              "send a zephyr",
96              "zwrite [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcde] [<user> ...] [-m <message...>]",
97              "Zwrite send a zephyr to the one or more users specified.\n\n"
98              "The following options are available:\n\n"
99              "-m    Specifies a message to send without prompting.\n"
100              "      Note that this does not yet log an outgoing message.\n"
101              "      This must be the last argument.\n\n"
102              "-n    Do not send a ping message.\n\n"
103              "-C    If the message is sent to more than one user include a\n"
104              "      \"cc:\" line in the text\n\n"
105              "-c class\n"
106              "      Send to the specified zephyr class\n\n"
107              "-i instance\n"
108              "      Send to the specified zephyr instance\n\n"
109              "-r realm\n"
110              "      Send to a foreign realm\n"
111              "-O opcode\n"
112              "      Send to the specified opcode\n"),
113
114  OWLCMD_ARGS("aimwrite", owl_command_aimwrite, OWL_CTX_INTERACTIVE,
115              "send a zephyr",
116              "aimzwrite <user>",
117              "Send an aim message to a user.\n"),
118
119  /*
120  OWLCMD_ARGS("zcrypt", owl_command_zcrypt, OWL_CTX_INTERACTIVE,
121              "send an encrypted zephyr",
122              "zcrypt [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcde] [-m <message...>]\n",
123              "Behaves like zwrite but uses encryption.  Not for use with\n"
124              "personal messages\n"),
125  */
126 
127  OWLCMD_ARGS("reply", owl_command_reply,  OWL_CTX_INTERACTIVE,
128              "reply to the current message",
129              "reply [-e] [ sender | all | zaway ]",
130              "If -e is specified, the zwrite command line is presented to\n"
131              "allow editing.\n\n"
132              "If 'sender' is specified, reply to the sender.\n\n"
133              "If 'all' or no args are specified, reply publically to the\n"
134              "same class/instance for non-personal messages and to the\n"
135              "sender for personal messages.\n\n"
136              "If 'zaway' is specified, replies with a zaway message.\n\n"),
137
138  OWLCMD_ARGS("set", owl_command_set, OWL_CTX_ANY,
139              "set a variable value",
140              "set [-q] <variable> [<value>]\n"
141              "set",
142              "Set the named variable to the specified value.  If no\n"
143              "arguments are used print the value of all variables.\n"
144              "If value is unspecified and the variable is a boolean, will set it to 'on'.\n"
145              "If -q is specified, is silent and doesn't print a message.\n"),
146
147  OWLCMD_ARGS("unset", owl_command_unset, OWL_CTX_ANY,
148              "unset a boolean variable value",
149              "set [-q] <variable>\n"
150              "set",
151              "Set the named boolean variable to off.\n"
152              "If -q is specified, is silent and doesn't print a message.\n"),
153
154  OWLCMD_ARGS("print", owl_command_print, OWL_CTX_ANY,
155              "print a variable value",
156              "print <variable>\n"
157              "print",
158              "Print the value of the named variable.  If no arugments\n"
159              "are used print the value of all variables.\n"),
160
161  OWLCMD_VOID("version", owl_command_version, OWL_CTX_ANY,
162              "print the version of the running owl", "", ""),
163
164  OWLCMD_ARGS("subscribe", owl_command_subscribe, OWL_CTX_ANY,
165              "subscribe to a zephyr class, instance, recipient",
166              "subscribe [-t] <class> <instance> [recipient]",
167              "Subscribe the specified class and instance.  If the recipient\n"
168              "is not listed on the command line it defaults\n"
169              "to * (the wildcard recipient).  If the -t option is present\n"
170              "the subscription will only be temporary, i.e., it will not\n"
171              "be written to the subscription file and will therefore not\n"
172              "be present the next time owl is started.\n"),
173  OWLCMD_ALIAS("sub", "subscribe"),
174
175  OWLCMD_ARGS("unsubscribe", owl_command_unsubscribe, OWL_CTX_ANY,
176              "unsubscribe from a zephyr class, instance, recipient",
177              "unsubscribe [-t] <class> <instance> [recipient]",
178              "Unsubscribe from the specified class and instance.  If the\n"
179              "recipient is not listed on the command line it defaults\n"
180              "to * (the wildcard recipient).  If the -t option is present\n"
181              "the unsubscription will only be temporary, i.e., it will not\n"
182              "be updated in the subscription file and will therefore not\n"
183              "be in effect the next time owl is started.\n"),
184  OWLCMD_ALIAS("unsub", "unsubscribe"),
185
186  OWLCMD_VOID("unsuball", owl_command_unsuball, OWL_CTX_ANY,
187              "unsubscribe from all zephyrs", "", ""),
188 
189  OWLCMD_VOID("getsubs", owl_command_getsubs, OWL_CTX_ANY,
190              "print all current subscriptions",
191              "getsubs",
192              "getsubs retrieves the current subscriptions from the server\n"
193              "and displays them.\n"),
194
195  OWLCMD_ARGS("dump", owl_command_dump, OWL_CTX_ANY,
196              "dump messages to a file",
197              "dump <filename>",
198              "Dump messages in current view to the named file."),
199
200  OWLCMD_ARGS("smartzpunt", owl_command_smartzpunt, OWL_CTX_INTERACTIVE,
201              "creates a zpunt based on the current message",
202              "smartzpunt [-i | --instance]",
203              "Starts a zpunt command based on the current message's class\n"
204              "(and instance if -i is specified).\n"),
205
206  OWLCMD_ARGS("zpunt", owl_command_zpunt, OWL_CTX_ANY,
207              "suppress a given zephyr triplet",
208              "zpunt <class> <instance> [recipient]\n"
209              "zpunt <instance>",
210              "The zpunt command will supress message to the specified\n"
211              "zephyr triplet.  In the second usage messages as supressed\n"
212              "for class MESSAGE and the named instance.\n\n"
213              "SEE ALSO:  zunpunt, show zpunts\n"),
214
215  OWLCMD_ARGS("zunpunt", owl_command_zunpunt, OWL_CTX_ANY,
216              "undo a previous zpunt",
217              "zunpunt <class> <instance> [recipient]\n"
218              "zunpunt <instance>",
219              "The zunpunt command will allow messages that were previosly\n"
220              "suppressed to be received again.\n\n"
221              "SEE ALSO:  zpunt, show zpunts\n"),
222
223  OWLCMD_VOID("info", owl_command_info, OWL_CTX_INTERACTIVE,
224              "display detailed information about the current message",
225              "", ""),
226 
227  OWLCMD_ARGS("help", owl_command_help, OWL_CTX_INTERACTIVE,
228              "display help on using owl",
229              "help [command]", ""),
230
231  OWLCMD_ARGS("zlist", owl_command_zlist, OWL_CTX_INTERACTIVE,
232              "List users logged in",
233              "znol [-f file]",
234              "Print a znol-style listing of users logged in"),
235
236  OWLCMD_ARGS("alist", owl_command_alist, OWL_CTX_INTERACTIVE,
237              "List AIM users logged in",
238              "alist",
239              "Print a listing of AIM users logged in"),
240
241  OWLCMD_ARGS("blist", owl_command_blist, OWL_CTX_INTERACTIVE,
242              "List all buddies logged in",
243              "alist",
244              "Print a listing of buddies logged in, regardless of protocol."),
245
246  OWLCMD_VOID("recv:shiftleft", owl_command_shift_left, OWL_CTX_INTERACTIVE,
247              "scrolls receive window to the left", "", ""),
248
249  OWLCMD_VOID("recv:shiftright", owl_command_shift_right, OWL_CTX_INTERACTIVE,
250              "scrolls receive window to the left", "", ""),
251
252  OWLCMD_VOID("recv:pagedown", owl_function_mainwin_pagedown, 
253              OWL_CTX_INTERACTIVE,
254              "scrolls down by a page", "", ""),
255
256  OWLCMD_VOID("recv:pageup", owl_function_mainwin_pageup, OWL_CTX_INTERACTIVE,
257              "scrolls up by a page", "", ""),
258
259  OWLCMD_INT ("recv:scroll", owl_function_page_curmsg, OWL_CTX_INTERACTIVE,
260              "scrolls current message up or down", 
261              "recv:scroll <numlines>", 
262              "Scrolls the current message up or down by <numlines>.\n"
263              "Scrolls up if <numlines> is negative, else scrolls down.\n"),
264
265  OWLCMD_ARGS("next", owl_command_next, OWL_CTX_INTERACTIVE,
266              "move the pointer to the next message",
267              "recv:next [ --filter <name> ] [ --skip-deleted ] [ --last-if-none ]\n"
268              "          [ --smart-filter | --smart-filter-instance ]",
269              "Moves the pointer to the next message in the current view.\n"
270              "If --filter is specified, will only consider messages in\n"
271              "the filter <name>.\n"
272              "If --smart-filter or --smart-filter-instance is specified,\n"
273              "goes to the next message that is similar to the current message.\n"
274              "If --skip-deleted is specified, deleted messages will\n"
275              "be skipped.\n"
276              "If --last-if-none is specified, will stop at last message\n"
277              "in the view if no other suitable messages are found.\n"),
278  OWLCMD_ALIAS("recv:next", "next"),
279
280  OWLCMD_ARGS("prev", owl_command_prev, OWL_CTX_INTERACTIVE,
281              "move the pointer to the previous message",
282              "recv:prev [ --filter <name> ] [ --skip-deleted ] [ --first-if-none ]\n"
283              "          [ --smart-filter | --smart-filter-instance ]",
284              "Moves the pointer to the next message in the current view.\n"
285              "If --filter is specified, will only consider messages in\n"
286              "the filter <name>.\n"
287              "If --smart-filter or --smart-filter-instance is specified,\n"
288              "goes to the previous message that is similar to the current message.\n"
289              "If --skip-deleted is specified, deleted messages will\n"
290              "be skipped.\n"
291              "If --first-if-none is specified, will stop at first message\n"
292              "in the view if no other suitable messages are found.\n"),
293  OWLCMD_ALIAS("recv:prev", "prev"),
294
295  OWLCMD_ALIAS("recv:next-notdel", "recv:next --skip-deleted --last-if-none"),
296  OWLCMD_ALIAS("next-notdel",      "recv:next --skip-deleted --last-if-none"),
297
298  OWLCMD_ALIAS("recv:prev-notdel", "recv:prev --skip-deleted --first-if-none"),
299  OWLCMD_ALIAS("prev-notdel",      "recv:prev --skip-deleted --first-if-none"),
300
301  OWLCMD_ALIAS("recv:next-personal", "recv:next --filter personal"),
302
303  OWLCMD_ALIAS("recv:prev-personal", "recv:prev --filter personal"),
304
305  OWLCMD_VOID("first", owl_command_first, OWL_CTX_INTERACTIVE,
306              "move the pointer to the first message", "", ""),
307  OWLCMD_ALIAS("recv:first", "first"),
308
309  OWLCMD_VOID("last", owl_command_last, OWL_CTX_INTERACTIVE,
310              "move the pointer to the last message", "", 
311              "Moves the pointer to the last message in the view.\n"
312              "If we are already at the last message in the view,\n"
313              "blanks the screen and moves just past the end of the view\n"
314              "so that new messages will appear starting at the top\n"
315              "of the screen.\n"),
316  OWLCMD_ALIAS("recv:last", "last"),
317
318  OWLCMD_VOID("expunge", owl_command_expunge, OWL_CTX_INTERACTIVE,
319              "remove all messages marked for deletion", "", ""),
320
321  OWLCMD_VOID("resize", owl_command_resize, OWL_CTX_ANY,
322              "resize the window to the current screen size", "", ""),
323
324  OWLCMD_VOID("redisplay", owl_command_redisplay, OWL_CTX_ANY,
325              "redraw the entire window", "", ""),
326
327  OWLCMD_VOID("suspend", owl_command_suspend, OWL_CTX_ANY,
328              "suspend owl", "", ""),
329
330  OWLCMD_ARGS("echo", owl_command_echo, OWL_CTX_ANY,
331              "pops up a message in popup window",
332              "echo [args .. ]\n\n", ""),
333
334  OWLCMD_ARGS("exec", owl_command_exec, OWL_CTX_ANY,
335              "run a command from the shell",
336              "exec [args .. ]", ""),
337
338  OWLCMD_ARGS("aexec", owl_command_aexec, OWL_CTX_INTERACTIVE,
339              "run a command from the shell and display in an admin message",
340              "aexec [args .. ]", ""),
341
342  OWLCMD_ARGS("pexec", owl_command_pexec, OWL_CTX_INTERACTIVE,
343              "run a command from the shell and display in a popup window",
344              "pexec [args .. ]", ""),
345
346  OWLCMD_ARGS("perl", owl_command_perl, OWL_CTX_ANY,
347              "run a perl expression",
348              "perl [args .. ]", ""),
349
350  OWLCMD_ARGS("aperl", owl_command_aperl, OWL_CTX_INTERACTIVE,
351              "run a perl expression and display in an admin message",
352              "aperl [args .. ]", ""),
353
354  OWLCMD_ARGS("pperl", owl_command_pperl, OWL_CTX_INTERACTIVE,
355              "run a perl expression and display in a popup window",
356              "pperl [args .. ]", ""),
357
358  OWLCMD_ARGS("multi", owl_command_multi, OWL_CTX_ANY,
359              "runs multiple ;-separated commands",
360              "multi <command1> ( ; <command2> )*\n",
361              "Runs multiple semicolon-separated commands in order.\n"
362              "Note quoting isn't supported here yet.\n"
363              "If you want to do something fancy, use perl.\n"),
364
365  OWLCMD_ARGS("(", owl_command_multi, OWL_CTX_ANY,
366              "runs multiple ;-separated commands",
367              "'(' <command1> ( ; <command2> )* ')'\n",
368              "Runs multiple semicolon-separated commands in order.\n"
369              "You must have a space before the final ')'\n"
370              "Note quoting isn't supported here yet.\n"
371              "If you want to do something fancy, use perl.\n"),
372
373  OWLCMD_VOID("pop-message", owl_command_pop_message, OWL_CTX_RECWIN,
374              "pops up a message in a window", "", ""),
375
376  OWLCMD_VOID("openurl", owl_command_openurl, OWL_CTX_INTERACTIVE,
377              "opens up a URL from the current message",
378              "", 
379              "Uses the 'webbrowser' variable to determine\n"
380              "which browser to use.  Currently, 'netscape'\n"
381              "and 'galeon' are supported.\n"),
382
383  OWLCMD_ARGS("zaway", owl_command_zaway, OWL_CTX_INTERACTIVE,
384              "running a command from the shell",
385              "zaway [ on | off | toggle ]\n"
386              "zaway <message>",
387              "Turn on or off the default zaway message.  If a message is\n"
388              "specified turn on zaway with that message\n"),
389
390  OWLCMD_ARGS("load-subs", owl_command_loadsubs, OWL_CTX_ANY,
391              "load subscriptions from a file",
392              "load-subs <file>\n", ""),
393
394  OWLCMD_ARGS("loadsubs", owl_command_loadsubs, OWL_CTX_ANY,
395              "load subscriptions from a file",
396              "loadsubs <file>\n", ""),
397
398  OWLCMD_ARGS("loadloginsubs", owl_command_loadloginsubs, OWL_CTX_ANY,
399              "load login subscriptions from a file",
400              "loadloginsubs <file>\n",
401              "The file should contain a list of usernames, one per line."),
402
403  OWLCMD_VOID("about", owl_command_about, OWL_CTX_INTERACTIVE,
404              "print information about owl", "", ""),
405
406  OWLCMD_VOID("status", owl_command_status, OWL_CTX_ANY,
407              "print status information about the running owl", "", ""),
408 
409  OWLCMD_ARGS("zlocate", owl_command_zlocate, OWL_CTX_INTERACTIVE,
410              "locate a user",
411              "zlocate [-d] <user> ...", 
412              "Performs a zlocate on one ore more users and puts the result\n"
413              "int a popwin.  If -d is specified, does not authenticate\n"
414              "the lookup request.\n"),
415 
416  OWLCMD_ARGS("filter", owl_command_filter, OWL_CTX_ANY,
417              "create a message filter",
418              "filter <name> [ -c color ] [ <expression> ... ]",
419              "The filter command creates a filter with the specified name,\n"
420              "or if one already exists it is replaced.  Example filter\n"
421              "syntax would be:\n\n"
422              "     filter myfilter -c red ( class ^foobar$ ) or ( class ^quux$ and instance ^bar$ )\n\n"
423              "Valid matching fields are class, instance, recipient, sender,\n"
424              "opcode and realm. Valid operations are 'and', 'or' and 'not'.\n"
425              "Spaces must be present before and after parenthesis.  If the\n"
426              "optional color argument is used it specifies the color that\n"
427              "messages matching this filter should be displayed in.\n\n"
428
429              "SEE ALSO: view, viewclass, viewuser\n"),
430
431  OWLCMD_ARGS("colorview", owl_command_colorview, OWL_CTX_INTERACTIVE,
432              "change the color on the current filter",
433              "colorview <color>",
434              "The color of messages in the current filter will be changed\n"
435              "to <color>.  Use the 'show colors' command for a list\n"
436              "of valid colors.\n\n"
437              "SEE ALSO: 'show colors'\n"),
438
439  OWLCMD_ARGS("view", owl_command_view, OWL_CTX_INTERACTIVE,
440              "view messages matching a filter",
441              "view <filter>\n"
442              "view -d <expression>\n"
443              "view --home",
444              "In the first usage, The view command sets the current view to\n"
445              "the specified filter.   This causes only messages matching\n"
446              "that filter to be displayed.\n"
447              "\n"
448              "In the second usage a filter expression\n"
449              "and be specified directly\n"
450              "after -d.  Owl will build an internal filter based on this\n"
451              "filter and change the current view to use it.\n\n"
452              "If --home is specified, switches to the view specified by\n"
453              "the 'view_home' variable.\n\n"
454              "SEE ALSO: filter, viewclass, viewuser\n"),
455
456  OWLCMD_ARGS("smartnarrow", owl_command_smartnarrow, OWL_CTX_INTERACTIVE,
457              "view only messages similar to the current message",
458              "smartnarrow [-i | --instance]",
459              "If the curmsg is a personal message narrow\n"
460              "   to the converstaion with that user.\n"
461              "If the curmsg is a class message, instance foo, recip *\n"
462              "   message, narrow to the class, inst.\n"
463              "If the curmsg is a class message then narrow\n"
464              "    to the class.\n"
465              "If the curmsg is a class message and '-i' is specied\n"
466              "    then narrow to the class, instance\n"),
467
468  OWLCMD_ARGS("smartfilter", owl_command_smartfilter, OWL_CTX_INTERACTIVE,
469              "returns the name of a filter based on the current message",
470              "smartfilter [-i | --instance]",
471              "If the curmsg is a personal message, the filter is\n"
472              "   the converstaion with that user.\n"
473              "If the curmsg is a class message, instance foo, recip *\n"
474              "   message, the filter is the class, inst.\n"
475              "If the curmsg is a class message, the filter is that class.\n"
476              "If the curmsg is a class message and '-i' is specied\n"
477              "    the filter is that <class,instance> pair\n"),
478
479  OWLCMD_ARGS("viewclass", owl_command_viewclass, OWL_CTX_INTERACTIVE,
480              "view messages matching a particular class",
481              "viewclass <class>",
482              "The viewclass command will automatically create a filter\n"
483              "matching the specified class and switch the current view\n"
484              "to it.\n\n"
485              "SEE ALSO: filter, view, viewuser\n"),
486  OWLCMD_ALIAS("vc", "viewclass"),
487
488  OWLCMD_ARGS("viewuser", owl_command_viewuser, OWL_CTX_INTERACTIVE,
489              "view messages matching a particular user",
490              "viewuser <user>",
491              "The viewuser command will automatically create a filter\n"
492              "matching the specified user and switch the current\n"
493              "view to it.\n\n"
494              "SEE ALSO: filter, view, viewclass\n"),
495  OWLCMD_ALIAS("vu", "viewuser"),
496
497  OWLCMD_ARGS("show", owl_command_show, OWL_CTX_INTERACTIVE,
498              "show information",
499              "show variables\n"
500              "show variable <variable>\n"
501              "show filters\n"
502              "show filter <filter>\n"
503              "show keymaps\n"
504              "show keymap <keymap>\n"
505              "show commands\n"
506              "show command <command>\n"
507              "show subs\n"
508              "show subscriptions\n"
509              "show zpunts\n"
510              "show colors\n"
511              "show terminal\n"
512              "show version\n"
513              "show status\n",
514
515              "Show colors will display a list of valid colors for the\n"
516              "     terminal."
517              "Show filters will list the names of all filters.\n"
518              "Show filter <filter> will show the definition of a particular\n"
519              "     filter.\n\n"
520              "Show zpunts will show the active zpunt filters.\n\n"
521              "Show keymaps will list the names of all keymaps.\n"
522              "Show keymap <keymap> will show the key bindings in a keymap.\n\n"
523              "Show commands will list the names of all keymaps.\n"
524              "Show command <command> will provide information about a command.\n\n"
525              "Show variables will list the names of all variables.\n\n"
526              "SEE ALSO: filter, view, alias, bindkey, help\n"),
527 
528  OWLCMD_ARGS("delete", owl_command_delete, OWL_CTX_INTERACTIVE,
529              "mark a message for deletion",
530              "delete [ -id msgid ] [ --no-move ]\n"
531              "delete view\n"
532              "delete trash",
533              "If no message id is specified the current message is marked\n"
534              "for deletion.  Otherwise the message with the given message\n"
535              "id is marked for deltion.\n"
536              "If '--no-move' is specified, don't move after deletion.\n"
537              "If 'trash' is specified, deletes all trash/auto messages\n"
538              "in the current view.\n"
539              "If 'view' is specified, deletes all messages in the\n"
540              "current view.\n"),
541  OWLCMD_ALIAS("del", "delete"),
542
543  OWLCMD_ARGS("undelete", owl_command_undelete, OWL_CTX_INTERACTIVE,
544              "unmark a message for deletion",
545              "undelete [ -id msgid ] [ --no-move ]\n"
546              "undelete view",
547              "If no message id is specified the current message is\n"
548              "unmarked for deletion.  Otherwise the message with the\n"
549              "given message id is marked for undeltion.\n"
550              "If '--no-move' is specified, don't move after deletion.\n"
551              "If 'view' is specified, undeletes all messages\n"
552              "in the current view.\n"),
553  OWLCMD_ALIAS("undel", "undelete"),
554
555  OWLCMD_VOID("beep", owl_command_beep, OWL_CTX_ANY,
556              "ring the terminal bell",
557              "beep",
558              "Beep will ring the terminal bell.\n"
559              "If the variable 'bell' has been\n"
560              "set to 'off' this command does nothing.\n"),
561
562  OWLCMD_ARGS("debug", owl_command_debug, OWL_CTX_ANY,
563              "prints a message into the debug log",
564              "debug <message>", ""),
565
566  OWLCMD_ARGS("getview", owl_command_getview, OWL_CTX_INTERACTIVE,
567              "returns the name of the filter for the current view",
568              "", ""),
569
570  OWLCMD_ARGS("getvar", owl_command_getvar, OWL_CTX_INTERACTIVE,
571              "returns the value of a variable",
572              "getvar <varname>", ""),
573
574  OWLCMD_ARGS("search", owl_command_search, OWL_CTX_INTERACTIVE,
575              "search messages for a particular string",
576              "search [-r] [<string>]",
577              "The search command will find messages that contain the\n"
578              "specified string and move the cursor there.  If no string\n"
579              "argument is supplied then the previous one is used.  By\n"
580              "default searches are done fowards, if -r is used the search\n"
581              "is performed backwards"),
582
583  OWLCMD_ARGS("aimlogin", owl_command_aimlogin, OWL_CTX_ANY,
584              "login to an AIM account",
585              "aimlogin <screenname> <password>\n",
586              ""),
587
588  OWLCMD_ARGS("aimlogout", owl_command_aimlogout, OWL_CTX_ANY,
589              "logout from AIM",
590              "aimlogout\n",
591              ""),
592
593
594  /****************************************************************/
595  /************************* EDIT-SPECIFIC ************************/
596  /****************************************************************/
597
598  OWLCMD_VOID_CTX("edit:move-next-word", owl_editwin_move_to_nextword, 
599                  OWL_CTX_EDIT,
600                  "moves cursor forward a word",
601                  "", ""),
602
603  OWLCMD_VOID_CTX("edit:move-prev-word", owl_editwin_move_to_previousword, 
604                  OWL_CTX_EDIT,
605                  "moves cursor backwards a word",
606                  "", ""),
607
608  OWLCMD_VOID_CTX("edit:move-to-buffer-start", owl_editwin_move_to_top,
609                  OWL_CTX_EDIT,
610                  "moves cursor to the top left (start) of the buffer",
611                  "", ""),
612
613  OWLCMD_VOID_CTX("edit:move-to-buffer-end", owl_editwin_move_to_end, 
614                  OWL_CTX_EDIT,
615                  "moves cursor to the bottom right (end) of the buffer",
616                  "", ""),
617
618  OWLCMD_VOID_CTX("edit:move-to-line-end", owl_editwin_move_to_line_end, 
619                  OWL_CTX_EDIT,
620                  "moves cursor to the end of the line",
621                  "", ""),
622
623  OWLCMD_VOID_CTX("edit:move-to-line-start", owl_editwin_move_to_line_start, 
624                  OWL_CTX_EDIT,
625                  "moves cursor to the beginning of the line",
626                  "", ""),
627
628  OWLCMD_VOID_CTX("edit:move-left", owl_editwin_key_left, 
629                  OWL_CTX_EDIT,
630                  "moves the cursor left by a character",
631                  "", ""),
632
633  OWLCMD_VOID_CTX("edit:move-right", owl_editwin_key_right,
634                  OWL_CTX_EDIT,
635                  "moves the cursor right by a character",
636                  "", ""),
637
638  OWLCMD_VOID_CTX("edit:delete-next-word", owl_editwin_delete_nextword,
639                  OWL_CTX_EDIT,
640                  "deletes the word to the right of the cursor",
641                  "", ""),
642
643  OWLCMD_VOID_CTX("edit:delete-prev-word", owl_editwin_delete_previousword,
644                  OWL_CTX_EDIT,
645                  "deletes the word to the left of the cursor",
646                  "", ""),
647
648  OWLCMD_VOID_CTX("edit:delete-prev-char", owl_editwin_backspace,
649                  OWL_CTX_EDIT,
650                  "deletes the character to the left of the cursor",
651                  "", ""),
652
653  OWLCMD_VOID_CTX("edit:delete-next-char", owl_editwin_delete_char, 
654                  OWL_CTX_EDIT,
655                  "deletes the character to the right of the cursor",
656                  "", ""),
657
658  OWLCMD_VOID_CTX("edit:delete-to-line-end", owl_editwin_delete_to_endofline,
659                  OWL_CTX_EDIT,
660                  "deletes from the cursor to the end of the line",
661                  "", ""),
662
663  OWLCMD_VOID_CTX("edit:delete-all", owl_editwin_clear, 
664                  OWL_CTX_EDIT,
665                  "deletes all of the contents of the buffer",
666                  "", ""),
667
668  OWLCMD_VOID_CTX("edit:transpose-chars", owl_editwin_transpose_chars,
669                  OWL_CTX_EDIT,
670                  "Interchange characters around point, moving forward one character.",
671                  "", ""),
672
673  OWLCMD_VOID_CTX("edit:fill-paragraph", owl_editwin_fill_paragraph, 
674                  OWL_CTX_EDIT,
675                  "fills the current paragraph to line-wrap well",
676                  "", ""),
677
678  OWLCMD_VOID_CTX("edit:recenter", owl_editwin_recenter, 
679                  OWL_CTX_EDIT,
680                  "recenters the buffer",
681                  "", ""),
682
683  OWLCMD_ARGS_CTX("edit:insert-text", owl_command_edit_insert_text, 
684                  OWL_CTX_EDIT,
685                  "inserts text into the buffer",
686                  "edit:insert-text <text>", ""),
687
688  OWLCMD_VOID_CTX("edit:cancel", owl_command_edit_cancel, 
689                  OWL_CTX_EDIT,
690                  "cancels the current command",
691                  "", ""),
692
693  OWLCMD_VOID_CTX("edit:history-next", owl_command_edit_history_next, 
694                  OWL_CTX_EDIT,
695                  "replaces the text with the previous history",
696                  "", ""),
697
698  OWLCMD_VOID_CTX("edit:history-prev", owl_command_edit_history_prev, 
699                  OWL_CTX_EDIT,
700                  "replaces the text with the previous history",
701                  "", ""),
702
703  OWLCMD_VOID_CTX("editline:done", owl_command_editline_done, 
704                  OWL_CTX_EDITLINE,
705                  "completes the command (eg, executes command being composed)",
706                  "", ""),
707
708  OWLCMD_VOID_CTX("editmulti:move-up-line", owl_editwin_key_up, 
709                  OWL_CTX_EDITMULTI,
710                  "moves the cursor up one line",
711                  "", ""),
712
713  OWLCMD_VOID_CTX("editmulti:move-down-line", owl_editwin_key_down, 
714                  OWL_CTX_EDITMULTI,
715                  "moves the cursor down one line",
716                  "", ""),
717
718  OWLCMD_VOID_CTX("editmulti:done", owl_command_editmulti_done, 
719                  OWL_CTX_EDITMULTI,
720                  "completes the command (eg, sends message being composed)",
721                  "", ""),
722
723  OWLCMD_VOID_CTX("editmulti:done-or-delete", owl_command_editmulti_done_or_delete, 
724                  OWL_CTX_EDITMULTI,
725                  "completes the command, but only if at end of message",
726                  "", 
727                  "If only whitespace is to the right of the cursor,\n"
728                  "runs 'editmulti:done'.\n"\
729                  "Otherwise runs 'edit:delete-next-char'\n"),
730
731  /****************************************************************/
732  /********************** POPLESS-SPECIFIC ************************/
733  /****************************************************************/
734
735  OWLCMD_VOID_CTX("popless:scroll-down-page", owl_viewwin_pagedown, 
736                  OWL_CTX_POPLESS,
737                  "scrolls down one page",
738                  "", ""),
739
740  OWLCMD_VOID_CTX("popless:scroll-down-line", owl_viewwin_linedown, 
741                  OWL_CTX_POPLESS,
742                  "scrolls down one line",
743                  "", ""),
744
745  OWLCMD_VOID_CTX("popless:scroll-up-page", owl_viewwin_pageup, 
746                  OWL_CTX_POPLESS,
747                  "scrolls up one page",
748                  "", ""),
749
750  OWLCMD_VOID_CTX("popless:scroll-up-line", owl_viewwin_lineup, 
751                  OWL_CTX_POPLESS,
752                  "scrolls up one line",
753                  "", ""),
754
755  OWLCMD_VOID_CTX("popless:scroll-to-top", owl_viewwin_top, 
756                  OWL_CTX_POPLESS,
757                  "scrolls to the top of the buffer",
758                  "", ""),
759
760  OWLCMD_VOID_CTX("popless:scroll-to-bottom", owl_viewwin_bottom, 
761                  OWL_CTX_POPLESS,
762                  "scrolls to the bottom of the buffer",
763                  "", ""),
764
765  OWLCMD_INT_CTX ("popless:scroll-right", owl_viewwin_right, 
766                  OWL_CTX_POPLESS,
767                  "scrolls right in the buffer",
768                  "popless:scroll-right <num-chars>", ""),
769
770  OWLCMD_INT_CTX ("popless:scroll-left", owl_viewwin_left, 
771                  OWL_CTX_POPLESS,
772                  "scrolls left in the buffer",
773                  "popless:scroll-left <num-chars>", ""),
774
775  OWLCMD_VOID_CTX("popless:quit", owl_command_popless_quit, 
776                  OWL_CTX_POPLESS,
777                  "exits the popless window",
778                  "", ""),
779
780  /* This line MUST be last! */
781  { NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
782
783};
784
785void owl_command_info() {
786  owl_function_info();
787}
788
789void owl_command_nop() {
790}
791
792char *owl_command_help(int argc, char **argv, char *buff) {
793  if (argc!=2) {
794    owl_help();
795    return NULL;
796  }
797 
798  owl_function_help_for_command(argv[1]);
799  return NULL;
800}
801
802char *owl_command_zlist(int argc, char **argv, char *buff) {
803  int elapsed=0, timesort=0;
804  char *file=NULL;
805
806  argc--;
807  argv++;
808  while (argc) {
809    if (!strcmp(argv[0], "-e")) {
810      elapsed=1;
811      argc--;
812      argv++;
813    } else if (!strcmp(argv[0], "-t")) {
814      timesort=1;
815      argc--;
816      argv++;
817    } else if (!strcmp(argv[0], "-f")) {
818      if (argc==1) {
819        owl_function_makemsg("zlist: -f needs an argument");
820        return(NULL);
821      }
822      file=argv[1];
823      argc-=2;
824      argv+=2;
825    } else {
826      owl_function_makemsg("zlist: unknown argument");
827      return(NULL);
828    }
829  }
830  owl_function_buddylist(0, 1, file);
831  return(NULL);
832}
833
834char *owl_command_alist() {
835  owl_function_buddylist(1, 0, NULL);
836  return(NULL);
837}
838
839char *owl_command_blist() {
840  owl_function_buddylist(1, 1, NULL);
841  return(NULL);
842}
843
844void owl_command_about() {
845  owl_function_about();
846}
847
848void owl_command_version() {
849  char buff[1024];
850
851  sprintf(buff, "Owl version %s", OWL_VERSION_STRING);
852  owl_function_makemsg(buff);
853}
854
855char *owl_command_dump(int argc, char **argv, char *buff) {
856  if (argc!=2) {
857    owl_function_makemsg("usage: dump <filename>");
858    return(NULL);
859  }
860
861  owl_function_dump(argv[1]);
862  return(NULL);
863}
864
865char *owl_command_next(int argc, char **argv, char *buff) {
866  char *filter=NULL;
867  int skip_deleted=0, last_if_none=0;
868  while (argc>1) {
869    if (argc>=1 && !strcmp(argv[1], "--skip-deleted")) {
870      skip_deleted=1;
871      argc-=1; argv+=1; 
872    } else if (argc>=1 && !strcmp(argv[1], "--last-if-none")) {
873      last_if_none=1;
874      argc-=1; argv+=1; 
875    } else if (argc>=2 && !strcmp(argv[1], "--filter")) {
876      filter = owl_strdup(argv[2]);
877      argc-=2; argv+=2; 
878    } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) {
879      filter = owl_function_smartfilter(0);
880      argc-=2; argv+=2; 
881    } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) {
882      filter = owl_function_smartfilter(1);
883      argc-=2; argv+=2; 
884    } else {
885      owl_function_makemsg("Invalid arguments to command 'next'.");
886      return(NULL);
887    }
888  }
889  owl_function_nextmsg_full(filter, skip_deleted, last_if_none);
890  if (filter) owl_free(filter);
891  return(NULL);
892}
893
894char *owl_command_prev(int argc, char **argv, char *buff) {
895  char *filter=NULL;
896  int skip_deleted=0, first_if_none=0;
897  while (argc>1) {
898    if (argc>=1 && !strcmp(argv[1], "--skip-deleted")) {
899      skip_deleted=1;
900      argc-=1; argv+=1; 
901    } else if (argc>=1 && !strcmp(argv[1], "--first-if-none")) {
902      first_if_none=1;
903      argc-=1; argv+=1; 
904    } else if (argc>=2 && !strcmp(argv[1], "--filter")) {
905      filter = owl_strdup(argv[2]);
906      argc-=2; argv+=2; 
907    } else if (argc>=2 && !strcmp(argv[1], "--smart-filter")) {
908      filter = owl_function_smartfilter(0);
909      argc-=2; argv+=2; 
910    } else if (argc>=2 && !strcmp(argv[1], "--smart-filter-instance")) {
911      filter = owl_function_smartfilter(1);
912      argc-=2; argv+=2; 
913   } else {
914      owl_function_makemsg("Invalid arguments to command 'prev'.");
915      return(NULL);
916    }
917  }
918  owl_function_prevmsg_full(filter, skip_deleted, first_if_none);
919  if (filter) owl_free(filter);
920  return(NULL);
921}
922
923char *owl_command_smartnarrow(int argc, char **argv, char *buff) {
924  char *filtname = NULL;
925
926  if (argc == 1) {
927    filtname = owl_function_smartfilter(0);
928  } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) {
929    filtname = owl_function_smartfilter(1);
930  } else {
931    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);   
932  }
933  if (filtname) {
934    owl_function_change_view(filtname);
935    owl_free(filtname);
936  }
937  return NULL;
938}
939
940char *owl_command_smartfilter(int argc, char **argv, char *buff) {
941  char *filtname = NULL;
942
943  if (argc == 1) {
944    filtname = owl_function_smartfilter(0);
945  } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) {
946    filtname = owl_function_smartfilter(1);
947  } else {
948    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);   
949  }
950  return filtname;
951}
952
953void owl_command_expunge() {
954  owl_function_expunge();
955}
956
957void owl_command_first() {
958  owl_global_set_rightshift(&g, 0);
959  owl_function_firstmsg();
960}
961
962void owl_command_last() {
963  owl_function_lastmsg();
964}
965
966void owl_command_resize() {
967  owl_function_resize();
968}
969
970void owl_command_redisplay() {
971  owl_function_full_redisplay();
972  owl_global_set_needrefresh(&g);
973}
974
975void owl_command_shift_right() {
976  owl_function_shift_right();
977}
978
979void owl_command_shift_left() {
980  owl_function_shift_left();
981}
982
983void owl_command_unsuball() {
984  owl_function_unsuball();
985}
986
987char *owl_command_loadsubs(int argc, char **argv, char *buff) {
988  if (argc == 2) {
989    owl_function_loadsubs(argv[1]);
990  } else if (argc == 1) {
991    owl_function_loadsubs(NULL);
992  } else {
993    owl_function_makemsg("Wrong number of arguments for load-subs.");
994    return(NULL);
995  }
996  return(NULL);
997}
998
999
1000char *owl_command_loadloginsubs(int argc, char **argv, char *buff) {
1001  if (argc == 2) {
1002    owl_function_loadloginsubs(argv[1]);
1003  } else if (argc == 1) {
1004    owl_function_loadloginsubs(NULL);
1005  } else {
1006    owl_function_makemsg("Wrong number of arguments for load-subs.");
1007    return(NULL);
1008  }
1009  return(NULL);
1010}
1011
1012void owl_command_suspend() {
1013  owl_function_suspend();
1014}
1015
1016char *owl_command_start_command(int argc, char **argv, char *buff) {
1017  buff = skiptokens(buff, 1);
1018  owl_function_start_command(buff);
1019  return NULL;
1020}
1021
1022char *owl_command_zaway(int argc, char **argv, char *buff) {
1023 
1024  if ((argc==1) ||
1025      ((argc==2) && !strcmp(argv[1], "on"))) {
1026    owl_global_set_zaway_msg(&g, owl_global_get_zaway_msg_default(&g));
1027    owl_function_zaway_on();
1028    return NULL;
1029  }
1030
1031  if (argc==2 && !strcmp(argv[1], "off")) {
1032    owl_function_zaway_off();
1033    return NULL;
1034  }
1035
1036  if (argc==2 && !strcmp(argv[1], "toggle")) {
1037    owl_function_zaway_toggle();
1038    return NULL;
1039  }
1040
1041  buff = skiptokens(buff, 1);
1042  owl_global_set_zaway_msg(&g, buff);
1043  owl_function_zaway_on();
1044  return NULL;
1045}
1046
1047
1048char *owl_command_set(int argc, char **argv, char *buff) {
1049  char *var, *val;
1050  int  silent=0;
1051  int requirebool=0;
1052
1053  if (argc == 1) {
1054    owl_function_printallvars();
1055    return NULL;
1056  } 
1057
1058  if (argc > 1 && !strcmp("-q",argv[1])) {
1059    silent = 1;
1060    argc--; argv++;
1061  }
1062
1063  if (argc == 2) {
1064    var=argv[1];
1065    val="on";
1066    requirebool=1;
1067  } else if (argc == 3) {
1068    var=argv[1];
1069    val=argv[2];
1070  } else {
1071    owl_function_makemsg("Wrong number of arguments for set command");
1072    return NULL;
1073  }
1074  owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, requirebool);
1075  return NULL;
1076}
1077
1078char *owl_command_unset(int argc, char **argv, char *buff) {
1079  char *var, *val;
1080  int  silent=0;
1081
1082  if (argc > 1 && !strcmp("-q",argv[1])) {
1083    silent = 1;
1084    argc--; argv++;
1085  }
1086  if (argc == 2) {
1087    var=argv[1];
1088    val="off";
1089  } else {
1090    owl_function_makemsg("Wrong number of arguments for unset command");
1091    return NULL;
1092  }
1093  owl_variable_set_fromstring(owl_global_get_vardict(&g), var, val, !silent, 1);
1094  return NULL;
1095}
1096
1097char *owl_command_print(int argc, char **argv, char *buff) {
1098  char *var;
1099  char valbuff[1024];
1100
1101  if (argc==1) {
1102    owl_function_printallvars();
1103    return NULL;
1104  } else if (argc!=2) {
1105    owl_function_makemsg("Wrong number of arguments for print command");
1106    return NULL;
1107  }
1108
1109  var=argv[1];
1110   
1111  if (0 == owl_variable_get_tostring(owl_global_get_vardict(&g), 
1112                                     var, valbuff, 1024)) {
1113    owl_function_makemsg("%s = '%s'", var, valbuff);
1114  } else {
1115    owl_function_makemsg("Unknown variable '%s'.", var);
1116  }
1117  return NULL;
1118}
1119
1120
1121char *owl_command_exec(int argc, char **argv, char *buff) {
1122  return owl_function_exec(argc, argv, buff, 0);
1123}
1124
1125char *owl_command_pexec(int argc, char **argv, char *buff) {
1126  return owl_function_exec(argc, argv, buff, 1);
1127}
1128
1129char *owl_command_aexec(int argc, char **argv, char *buff) {
1130  return owl_function_exec(argc, argv, buff, 2);
1131}
1132
1133char *owl_command_perl(int argc, char **argv, char *buff) {
1134  return owl_function_perl(argc, argv, buff, 0);
1135}
1136
1137char *owl_command_pperl(int argc, char **argv, char *buff) {
1138  return owl_function_perl(argc, argv, buff, 1);
1139}
1140
1141char *owl_command_aperl(int argc, char **argv, char *buff) {
1142  return owl_function_perl(argc, argv, buff, 2);
1143}
1144
1145char *owl_command_multi(int argc, char **argv, char *buff) {
1146  char *lastrv = NULL, *newbuff;
1147  char **commands;
1148  int  ncommands, i;
1149  if (argc < 2) {
1150    owl_function_makemsg("Invalid arguments to 'multi' command.");   
1151    return NULL;
1152  }
1153  newbuff = owl_strdup(buff);
1154  newbuff = skiptokens(newbuff, 1);
1155  if (!strcmp(argv[0], "(")) {
1156    for (i=strlen(newbuff)-1; i>=0; i--) {
1157      if (newbuff[i] == ')') {
1158        newbuff[i] = '\0';
1159        break;
1160      } else if (newbuff[i] != ' ') {
1161        owl_function_makemsg("Invalid arguments to 'multi' command.");   
1162        owl_free(newbuff);
1163        return NULL;
1164      }
1165    }
1166  }
1167  commands = atokenize(newbuff, ";", &ncommands);
1168  for (i=0; i<ncommands; i++) {
1169    if (lastrv) {
1170      owl_free(lastrv);
1171    }
1172    lastrv = owl_function_command(commands[i]);
1173  }
1174  atokenize_free(commands, ncommands);
1175  return lastrv;
1176}
1177
1178
1179char *owl_command_alias(int argc, char **argv, char *buff) {
1180  if (argc < 3) {
1181    owl_function_makemsg("Invalid arguments to 'alias' command.");
1182    return NULL;
1183  }
1184  buff = skiptokens(buff, 2);
1185  owl_function_command_alias(argv[1], buff);
1186  return (NULL);
1187}
1188
1189
1190char *owl_command_bindkey(int argc, char **argv, char *buff) {
1191  owl_keymap *km;
1192  int ret;
1193
1194  if (argc < 5 || strcmp(argv[3], "command")) {
1195    owl_function_makemsg("Usage: bindkey <keymap> <binding> command <cmd>", argv[3], argc);
1196    return NULL;
1197  }
1198  km = owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), argv[1]);
1199  if (!km) {
1200    owl_function_makemsg("No such keymap '%s'", argv[1]);
1201    return NULL;
1202  }
1203  buff = skiptokens(buff, 4);
1204  ret = owl_keymap_create_binding(km, argv[2], buff, NULL, "*user*");
1205  if (ret!=0) {
1206    owl_function_makemsg("Unable to bind '%s' in keymap '%s' to '%s'.",
1207                         argv[2], argv[1], buff);
1208    return NULL;
1209  }
1210  return NULL;
1211}
1212
1213void owl_command_quit() {
1214  owl_function_quit();
1215}
1216
1217char *owl_command_debug(int argc, char **argv, char *buff) {
1218  if (argc<2) {
1219    owl_function_makemsg("Need at least one argument to debug command");
1220    return(NULL);
1221  }
1222
1223  if (!owl_global_is_debug_fast(&g)) {
1224    owl_function_makemsg("Debugging is not turned on");
1225    return(NULL);
1226  }
1227
1228  owl_function_debugmsg(argv[1]);
1229  return(NULL);
1230}
1231
1232char *owl_command_term(int argc, char **argv, char *buff) {
1233  if (argc<2) {
1234    owl_function_makemsg("Need at least one argument to the term command");
1235    return(NULL);
1236  }
1237
1238  if (!strcmp(argv[1], "raise")) {
1239    owl_function_xterm_raise();
1240  } else if (!strcmp(argv[1], "deiconify")) {
1241    owl_function_xterm_deiconify();
1242  } else {
1243    owl_function_makemsg("Unknown terminal subcommand");
1244  }
1245  return(NULL);
1246}
1247
1248char *owl_command_zlog(int argc, char **argv, char *buff) {
1249  if ((argc<2) || (argc>3)) {
1250    owl_function_makemsg("Wrong number of arguments for zlog command");
1251    return(NULL);
1252  }
1253
1254  if (!strcmp(argv[1], "in")) {
1255    if (argc>2) {
1256      owl_global_set_tty(&g, argv[2]);
1257    }
1258    owl_zephyr_zlog_in();
1259  } else if (!strcmp(argv[1], "out")) {
1260    if (argc!=2) {
1261      owl_function_makemsg("Wrong number of arguments for zlog command");
1262      return(NULL);
1263    }
1264    owl_zephyr_zlog_out();
1265  } else {
1266    owl_function_makemsg("Invalid subcommand for zlog");
1267  }
1268  return(NULL);
1269}
1270
1271
1272void owl_command_zlog_out(void) {
1273  owl_zephyr_zlog_out();
1274}
1275
1276
1277char *owl_command_subscribe(int argc, char **argv, char *buff) {
1278  char *recip="";
1279  int temp=0;
1280 
1281  if (argc<3) {
1282    owl_function_makemsg("Not enough arguments to the subscribe command");
1283    return(NULL);
1284  }
1285  argc--;
1286  argv++;
1287
1288  if (!strcmp(argv[0], "-t")) {
1289    temp=1;
1290    argc--;
1291    argv++;
1292  }
1293  if (argc<2) {
1294    owl_function_makemsg("Not enough arguments to the subscribe command");
1295    return(NULL);
1296  }
1297
1298  if (argc>3) {
1299    owl_function_makemsg("Too many arguments to the subscribe command");
1300    return(NULL);
1301  }
1302
1303  if (argc==2) {
1304    recip="";
1305  } else if (argc==3) {
1306    recip=argv[2];
1307  }
1308
1309  owl_function_subscribe(argv[0], argv[1], recip);
1310  if (!temp) {
1311    owl_zephyr_addsub(NULL, argv[0], argv[1], recip);
1312  }
1313  return(NULL);
1314}
1315
1316
1317char *owl_command_unsubscribe(int argc, char **argv, char *buff) {
1318  char *recip="";
1319  int temp=0;
1320
1321  if (argc<3) {
1322    owl_function_makemsg("Not enough arguments to the unsubscribe command");
1323    return(NULL);
1324  }
1325  argc--;
1326  argv++;
1327
1328  if (!strcmp(argv[0], "-t")) {
1329    temp=1;
1330    argc--;
1331    argv++;
1332  }
1333  if (argc<2) {
1334    owl_function_makemsg("Not enough arguments to the subscribe command");
1335    return(NULL);
1336  }
1337
1338  if (argc>3) {
1339    owl_function_makemsg("Too many arguments to the unsubscribe command");
1340    return(NULL);
1341  }
1342
1343  if (argc==2) {
1344    recip="";
1345  } else if (argc==3) {
1346    recip=argv[2];
1347  }
1348
1349  owl_function_unsubscribe(argv[0], argv[1], recip);
1350  if (!temp) {
1351    owl_zephyr_delsub(NULL, argv[0], argv[1], recip);
1352  }
1353  return(NULL);
1354}
1355
1356char *owl_command_echo(int argc, char **argv, char *buff) {
1357  buff = skiptokens(buff, 1);
1358  owl_function_popless_text(buff);
1359  return NULL;
1360}
1361
1362void owl_command_getsubs() {
1363  owl_function_getsubs();
1364}
1365
1366void owl_command_status() {
1367  owl_function_status();
1368}
1369
1370char *owl_command_zwrite(int argc, char **argv, char *buff) {
1371  char *tmpbuff, *pos, *cmd, *msg;
1372
1373  /* check for a zwrite -m */
1374  for (pos = buff; *pos; pos = skiptokens(pos, 1)) {
1375    if (!strncmp(pos, "-m ", 3)) {
1376      cmd = owl_strdup(buff);
1377      msg = cmd+(pos-buff);
1378      *msg = '\0';
1379      msg += 3;
1380      owl_zwrite_create_and_send_from_line(cmd, msg);
1381      owl_free(cmd);
1382      return NULL;
1383    }
1384  }
1385
1386  if (argc < 2) {
1387    owl_function_makemsg("Not enough arguments to the zwrite command.");
1388  } else {
1389    tmpbuff = owl_strdup(buff);
1390    owl_function_zwrite_setup(tmpbuff);
1391    owl_global_set_buffercommand(&g, tmpbuff);
1392    owl_free(tmpbuff);
1393  }
1394  return NULL;
1395}
1396
1397char *owl_command_aimwrite(int argc, char **argv, char *buff) {
1398  char *tmpbuff;
1399
1400  if (!owl_global_is_aimloggedin(&g)) {
1401    owl_function_makemsg("You are not logged in to AIM.");
1402    return(NULL);
1403  }
1404
1405  if (argc < 2) {
1406    owl_function_makemsg("Not enough arguments to the aimwrite command.");
1407    return(NULL);
1408  }
1409
1410  tmpbuff=owl_strdup(buff);
1411  owl_function_aimwrite_setup(tmpbuff);
1412  owl_global_set_buffercommand(&g, tmpbuff);
1413  owl_free(tmpbuff);
1414  return(NULL);
1415}
1416
1417char *owl_command_zcrypt(int argc, char **argv, char *buff) {
1418  char *tmpbuff, *pos, *cmd, *msg;
1419 
1420  /* check for a zwrite -m */
1421  for (pos = buff; *pos; pos = skiptokens(pos, 1)) {
1422    if (!strncmp(pos, "-m ", 3)) {
1423      cmd = owl_strdup(buff);
1424      msg = cmd+(pos-buff);
1425      *msg = '\0';
1426      msg += 3;
1427      owl_zwrite_create_and_send_from_line(cmd, msg);
1428      owl_free(cmd);
1429      return NULL;
1430    }
1431  }
1432
1433  if (argc < 2) {
1434    owl_function_makemsg("Not enough arguments to the zcrypt command.");
1435  } else {
1436    tmpbuff = owl_strdup(buff);
1437    owl_function_zwrite_setup(tmpbuff);
1438    owl_global_set_buffercommand(&g, tmpbuff);
1439    owl_free(tmpbuff);
1440  }
1441  return(NULL);
1442}
1443
1444char *owl_command_reply(int argc, char **argv, char *buff) {
1445  int edit=0;
1446 
1447  if (argc>=2 && !strcmp("-e", argv[1])) {
1448    edit=1;
1449    argv++;
1450    argc--;
1451  }
1452
1453  if ((argc==1) || (argc==2 && !strcmp(argv[1], "all"))) {   
1454    owl_function_reply(0, !edit);
1455  } else if (argc==2 && !strcmp(argv[1], "sender")) {
1456    owl_function_reply(1, !edit);
1457  } else if (argc==2 && !strcmp(argv[1], "zaway")) {
1458    owl_message *m;
1459    owl_view    *v;
1460    v = owl_global_get_current_view(&g);   
1461    m = owl_view_get_element(v, owl_global_get_curmsg(&g));
1462    if (m) owl_zephyr_zaway(m);
1463  } else {
1464    owl_function_makemsg("Invalid arguments to the reply command.");
1465  }
1466  return NULL;
1467}
1468
1469char *owl_command_filter(int argc, char **argv, char *buff) {
1470  owl_function_create_filter(argc, argv);
1471  return NULL;
1472}
1473
1474char *owl_command_zlocate(int argc, char **argv, char *buff) {
1475  int auth;
1476 
1477  if (argc<2) {
1478    owl_function_makemsg("Too few arguments for zlocate command");
1479    return NULL;
1480  }
1481
1482  auth=1;
1483  if (!strcmp(argv[1], "-d")) {
1484    if (argc>2) {
1485      auth=0;
1486      argc--;
1487      argv++;
1488    } else {
1489      owl_function_makemsg("Missing arguments for zlocate command");
1490      return NULL;
1491    }
1492  }
1493
1494  argc--;
1495  argv++;
1496  owl_function_zlocate(argc, argv, auth);
1497  return NULL;
1498}
1499
1500char *owl_command_view(int argc, char **argv, char *buff) {
1501  if (argc<2) {
1502    owl_function_makemsg("Wrong number of arguments to view command");
1503    return NULL;
1504  }
1505
1506  if (argc == 2 && !strcmp(argv[1], "--home")) {
1507    owl_function_change_view(owl_global_get_view_home(&g));
1508    return NULL;
1509  }
1510
1511  /* is it a dynamic filter? */
1512  if (!strcmp(argv[1], "-d")) {
1513    char **myargv;
1514    int i;
1515
1516    myargv=owl_malloc((argc*sizeof(char *))+50);
1517    myargv[0]="";
1518    myargv[1]="owl-dynamic";
1519    for (i=2; i<argc; i++) {
1520      myargv[i]=argv[i];
1521    }
1522    owl_function_create_filter(argc, myargv);
1523    owl_function_change_view("owl-dynamic");
1524    owl_free(myargv);
1525    return NULL;
1526  }
1527
1528  /* otherwise it's a normal view command */
1529  if (argc>2) {
1530    owl_function_makemsg("Wrong number of arguments to view command");
1531    return NULL;
1532  }
1533  owl_function_change_view(argv[1]);
1534  return NULL;
1535}
1536
1537
1538char *owl_command_show(int argc, char **argv, char *buff) {
1539
1540  if (argc<2) {
1541    owl_function_help_for_command("show");
1542    return NULL;
1543  }
1544
1545  if (!strcmp(argv[1], "filter") || !strcmp(argv[1], "filters")) {
1546    if (argc==2) {
1547      owl_function_show_filters();
1548    } else {
1549      owl_function_show_filter(argv[2]);
1550    }
1551  } else if (argc==2 
1552             && (!strcmp(argv[1], "zpunts") || !strcmp(argv[1], "zpunted"))) {
1553    owl_function_show_zpunts();
1554  } else if (!strcmp(argv[1], "command") || !strcmp(argv[1], "commands")) {
1555    if (argc==2) {
1556      owl_function_show_commands();
1557    } else {
1558      owl_function_show_command(argv[2]);
1559    }
1560  } else if (!strcmp(argv[1], "variable") || !strcmp(argv[1], "variables")) {
1561    if (argc==2) {
1562      owl_function_show_variables();
1563    } else {
1564      owl_function_show_variable(argv[2]);
1565    }
1566  } else if (!strcmp(argv[1], "keymap") || !strcmp(argv[1], "keymaps")) {
1567    if (argc==2) {
1568      owl_function_show_keymaps();
1569    } else {
1570      owl_function_show_keymap(argv[2]);
1571    }
1572  } else if (!strcmp(argv[1], "colors")) {
1573    owl_function_show_colors();
1574  } else if (!strcmp(argv[1], "subs") || !strcmp(argv[1], "subscriptions")) {
1575    owl_function_getsubs();
1576  } else if (!strcmp(argv[1], "terminal") || !strcmp(argv[1], "term")) {
1577    owl_function_show_term();
1578  } else if (!strcmp(argv[1], "version")) {
1579    owl_function_about();
1580  } else if (!strcmp(argv[1], "status")) {
1581    owl_function_status();
1582  } else {
1583    owl_function_makemsg("Unknown subcommand for 'show' command (see 'help show' for allowed args)");
1584    return NULL;
1585  }
1586  return NULL;
1587}
1588
1589char *owl_command_viewclass(int argc, char **argv, char *buff) {
1590  char *filtname;
1591  if (argc!=2) {
1592    owl_function_makemsg("Wrong number of arguments to viewclass command");
1593    return NULL;
1594  }
1595  filtname = owl_function_classinstfilt(argv[1], NULL);
1596  owl_function_change_view(filtname);
1597  owl_free(filtname);
1598  return NULL;
1599}
1600
1601char *owl_command_viewuser(int argc, char **argv, char *buff) {
1602  char *filtname;
1603  if (argc!=2) {
1604    owl_function_makemsg("Wrong number of arguments to viewuser command");
1605    return NULL;
1606  }
1607  filtname=owl_function_zuserfilt(argv[1]);
1608  owl_function_change_view(filtname);
1609  owl_free(filtname);
1610  return NULL;
1611}
1612
1613
1614void owl_command_pop_message(void) {
1615  owl_function_curmsg_to_popwin();
1616}
1617
1618void owl_command_openurl(void) {
1619  owl_function_openurl();
1620}
1621
1622char *owl_command_delete(int argc, char **argv, char *buff) {
1623  int move_after = 1;
1624
1625  if (argc>1 && !strcmp(argv[1], "--no-move")) {
1626    move_after = 0;
1627    argc--; 
1628    argv++;
1629  }
1630
1631  if (argc==1) {
1632    owl_function_deletecur(move_after);
1633    return NULL;
1634  }
1635
1636  if (argc==2 && !strcmp(argv[1], "view")) {
1637    owl_function_delete_curview_msgs(1);
1638    return NULL;
1639  }
1640
1641  if (argc==2 && !strcmp(argv[1], "trash")) {
1642    owl_function_delete_automsgs();
1643    return NULL;
1644  }
1645
1646  if (argc==3 && (!strcmp(argv[1], "-id") || !strcmp(argv[1], "--id"))) {
1647    owl_function_delete_by_id(atoi(argv[2]), 1);
1648    return NULL;
1649  }
1650
1651  owl_function_makemsg("Unknown arguments to delete command");
1652  return NULL;
1653}
1654
1655char *owl_command_undelete(int argc, char **argv, char *buff) {
1656  int move_after = 1;
1657
1658  if (argc>1 && !strcmp(argv[1], "--no-move")) {
1659    move_after = 0;
1660    argc--; 
1661    argv++;
1662  }
1663
1664  if (argc==1) {
1665    owl_function_undeletecur(move_after);
1666    return NULL;
1667  }
1668
1669  if (argc==2 && !strcmp(argv[1], "view")) {
1670    owl_function_delete_curview_msgs(0);
1671    return NULL;
1672  }
1673
1674  if (argc==3 && (!strcmp(argv[1], "-id") || !strcmp(argv[1], "--id"))) {
1675    owl_function_delete_by_id(atoi(argv[2]), 0);
1676    return NULL;
1677  }
1678
1679  owl_function_makemsg("Unknown arguments to delete command");
1680  return NULL;
1681}
1682
1683void owl_command_beep() {
1684  owl_function_beep();
1685}
1686
1687char *owl_command_colorview(int argc, char **argv, char *buff) {
1688  if (argc!=2) {
1689    owl_function_makemsg("Wrong number of arguments to colorview command");
1690    return NULL;
1691  }
1692  owl_function_color_current_filter(argv[1]);
1693  return NULL;
1694}
1695
1696char *owl_command_zpunt(int argc, char **argv, char *buff) {
1697  owl_command_zpunt_and_zunpunt(argc, argv, 0);
1698  return NULL;
1699}
1700
1701char *owl_command_zunpunt(int argc, char **argv, char *buff) {
1702  owl_command_zpunt_and_zunpunt(argc, argv, 1);
1703  return NULL;
1704}
1705
1706
1707void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type) {
1708  /* if type==0 then zpunt
1709   * if type==1 then zunpunt
1710   */
1711  char *class, *inst, *recip;
1712
1713  class="message";
1714  inst="";
1715  recip="*";
1716
1717  if (argc==1) {
1718    /* show current punt filters */
1719    owl_function_show_zpunts();
1720    return;
1721  } else if (argc==2) {
1722    inst=argv[1];
1723  } else if (argc==3) {
1724    class=argv[1];
1725    inst=argv[2];
1726  } else if (argc==4) {
1727    class=argv[1];
1728    inst=argv[2];
1729    recip=argv[3];
1730  } else {
1731    owl_function_makemsg("Wrong number of arguments to the zpunt command");
1732    return;
1733  }
1734
1735  owl_function_zpunt(class, inst, recip, type);
1736  if (type==0) {
1737    owl_function_makemsg("<%s, %s, %s> added to punt list.", class, inst, recip);
1738  } else if (type==1) {
1739    owl_function_makemsg("<%s, %s, %s> removed from punt list.", class, inst, recip);
1740  }
1741}
1742
1743char *owl_command_smartzpunt(int argc, char **argv, char *buff) {
1744  if (argc == 1) {
1745    owl_function_smartzpunt(0);
1746  } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) {
1747    owl_function_smartzpunt(1);
1748  } else {
1749    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);   
1750  }
1751  return NULL;
1752}
1753
1754char *owl_command_getview(int argc, char **argv, char *buff) {
1755  char *filtname;
1756  if (argc != 1) {
1757    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);
1758    return NULL;
1759  }
1760  filtname = owl_view_get_filtname(owl_global_get_current_view(&g));
1761  if (filtname) filtname = owl_strdup(filtname);
1762  return filtname;
1763}
1764
1765char *owl_command_getvar(int argc, char **argv, char *buff) {
1766  char tmpbuff[1024];
1767  if (argc != 2) {
1768    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);
1769    return NULL;
1770  }
1771  if (owl_variable_get_tostring(owl_global_get_vardict(&g), 
1772                                argv[1], tmpbuff, 1024)) {
1773    return NULL;
1774  }
1775  return owl_strdup(tmpbuff); 
1776}
1777
1778char *owl_command_search(int argc, char **argv, char *buff) {
1779  int direction;
1780  char *buffstart;
1781
1782  direction=OWL_DIRECTION_DOWNWARDS;
1783  buffstart=skiptokens(buff, 1);
1784  if (argc>1 && !strcmp(argv[1], "-r")) {
1785    direction=OWL_DIRECTION_UPWARDS;
1786    buffstart=skiptokens(buff, 2);
1787  }
1788   
1789  if (argc==1 || (argc==2 && !strcmp(argv[1], "-r"))) {
1790    owl_function_search_continue(direction);
1791  } else {
1792    owl_function_search_start(buffstart, direction);
1793  }
1794 
1795  return(NULL);
1796}
1797
1798char *owl_command_aimlogin(int argc, char **argv, char *buff) {
1799  int ret;
1800 
1801  if (argc!=3) {
1802    owl_function_makemsg("Wrong number of arguments to aimlogin command");
1803    return(NULL);
1804  }
1805
1806  /* clear the buddylist */
1807  owl_buddylist_clear(owl_global_get_buddylist(&g));
1808
1809  /* try to login */
1810  ret=owl_aim_login(argv[1], argv[2]);
1811  if (!ret) {
1812    owl_function_makemsg("%s logged in.\n", argv[1]);
1813    return(NULL);
1814  }
1815 
1816  owl_function_makemsg("Warning: login for %s failed.\n");
1817  return(NULL);
1818}
1819
1820char *owl_command_aimlogout(int argc, char **argv, char *buff) {
1821  /* clear the buddylist */
1822  owl_buddylist_clear(owl_global_get_buddylist(&g));
1823
1824  owl_aim_logout();
1825  return(NULL);
1826}
1827
1828/*********************************************************************/
1829/************************** EDIT SPECIFIC ****************************/
1830/*********************************************************************/
1831
1832void owl_command_edit_cancel(owl_editwin *e) {
1833  owl_history *hist;
1834
1835  owl_function_makemsg("Command cancelled.");
1836
1837  hist=owl_editwin_get_history(e);
1838  owl_history_store(hist, owl_editwin_get_text(e));
1839  owl_history_reset(hist);
1840
1841  owl_editwin_fullclear(e);
1842  owl_global_set_needrefresh(&g);
1843  wnoutrefresh(owl_editwin_get_curswin(e));
1844  owl_global_set_typwin_inactive(&g);
1845  owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL);
1846}
1847
1848void owl_command_edit_history_prev(owl_editwin *e) {
1849  owl_history *hist;
1850  char *ptr;
1851
1852  hist=owl_editwin_get_history(e);
1853  if (!owl_history_is_touched(hist)) {
1854    owl_history_store(hist, owl_editwin_get_text(e));
1855    owl_history_set_partial(hist);
1856  }
1857  ptr=owl_history_get_prev(hist);
1858  if (ptr) {
1859    owl_editwin_clear(e);
1860    owl_editwin_insert_string(e, ptr);
1861    owl_editwin_redisplay(e, 0);
1862    owl_global_set_needrefresh(&g);
1863  } else {
1864    owl_function_beep();
1865  }
1866}
1867
1868void owl_command_edit_history_next(owl_editwin *e) {
1869  owl_history *hist;
1870  char *ptr;
1871
1872  hist=owl_editwin_get_history(e);
1873  ptr=owl_history_get_next(hist);
1874  if (ptr) {
1875    owl_editwin_clear(e);
1876    owl_editwin_insert_string(e, ptr);
1877    owl_editwin_redisplay(e, 0);
1878    owl_global_set_needrefresh(&g);
1879  } else {
1880    owl_function_beep();
1881  }
1882}
1883
1884char *owl_command_edit_insert_text(owl_editwin *e, int argc, char **argv, char *buff) {
1885  buff = skiptokens(buff, 1);
1886  owl_editwin_insert_string(e, buff);
1887  owl_editwin_redisplay(e, 0);
1888  owl_global_set_needrefresh(&g); 
1889  return NULL;
1890}
1891
1892void owl_command_editline_done(owl_editwin *e) {
1893  owl_history *hist=owl_editwin_get_history(e);
1894  char *rv, *cmd;
1895
1896  owl_history_store(hist, owl_editwin_get_text(e));
1897  owl_history_reset(hist);
1898  owl_global_set_typwin_inactive(&g);
1899  cmd = owl_strdup(owl_editwin_get_text(e));
1900  owl_editwin_fullclear(e);
1901  rv = owl_function_command(cmd);
1902  owl_free(cmd);
1903
1904  wnoutrefresh(owl_editwin_get_curswin(e));
1905  owl_global_set_needrefresh(&g);
1906
1907  if (rv) {
1908    owl_function_makemsg("%s", rv);
1909    owl_free(rv);
1910  }
1911}
1912
1913void owl_command_editmulti_done(owl_editwin *e) {
1914  owl_history *hist=owl_editwin_get_history(e);
1915
1916  owl_history_store(hist, owl_editwin_get_text(e));
1917  owl_history_reset(hist);
1918
1919  owl_function_run_buffercommand();
1920  owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL);
1921  owl_editwin_fullclear(e);
1922  owl_global_set_typwin_inactive(&g);
1923  owl_global_set_needrefresh(&g);
1924  wnoutrefresh(owl_editwin_get_curswin(e));
1925}
1926
1927void owl_command_editmulti_done_or_delete(owl_editwin *e) {
1928  if (owl_editwin_is_at_end(e)) {
1929    owl_command_editmulti_done(e);
1930  } else {
1931    owl_editwin_delete_char(e);
1932  }
1933}
1934
1935
1936/*********************************************************************/
1937/*********************** POPLESS SPECIFIC ****************************/
1938/*********************************************************************/
1939
1940void owl_command_popless_quit(owl_viewwin *vw) {
1941  owl_popwin_close(owl_global_get_popwin(&g));
1942  owl_viewwin_free(vw);
1943  owl_global_set_needrefresh(&g);
1944}
Note: See TracBrowser for help on using the repository browser.