README: nits
[s-mailx.git] / cmdtab.c
blob6139c4ce2e3761a653f8a5ad9b454478902ad9e1
1 /*@ S-nail - a mail user agent derived from Berkeley Mail.
2 *@ Define all of the command names and bindings.
4 * Copyright (c) 2000-2004 Gunnar Ritter, Freiburg i. Br., Germany.
5 * Copyright (c) 2012 - 2013 Steffen "Daode" Nurpmeso <sdaoden@users.sf.net>.
6 */
7 /*
8 * Copyright (c) 1980, 1993
9 * The Regents of the University of California. All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
40 #include "rcv.h"
41 #include "extern.h"
43 #ifdef HAVE_DOCSTRINGS
44 # define DS(ID,S) , ID, S
45 #else
46 # define DS(ID,S)
47 #endif
49 struct cmd const cmdtab[] = {
50 { "next", next, (A | NDMLIST), 0, MMNDEL
51 DS(355, "Goes to the next message (-list) and prints it")
53 { "alias", group, (M | RAWLIST), 0, 1000
54 DS(304, "Show all or the specified alias(es), or (re)define one")
56 { "print", type, (A | MSGLIST), 0, MMNDEL
57 DS(361, "Type each message of <message-list> on the terminal")
59 { "type", type, (A | MSGLIST), 0, MMNDEL
60 DS(361, "Type each message of <message-list> on the terminal")
62 { "Type", Type, (A | MSGLIST), 0, MMNDEL
63 DS(360, "Like \"print\", but prints all headers and parts")
65 { "Print", Type, (A | MSGLIST), 0, MMNDEL
66 DS(360, "Like \"print\", but prints all headers and parts")
68 { "visual", visual, (A | I | MSGLIST), 0, MMNORM
69 DS(326, "Edit <message-list>")
71 { "top", top, (A | MSGLIST), 0, MMNDEL
72 DS(385, "Print top few lines of <message-list>")
74 { "touch", stouch, (A | W | MSGLIST), 0, MMNDEL
75 DS(386, "Mark <message-list> for saving in *mbox*")
77 { "preserve", preserve, (A | W | MSGLIST), 0, MMNDEL
78 DS(344, "Save <message-list> in system mailbox instead of *mbox*")
80 { "delete", delete, (A | W | P | MSGLIST), 0, MMNDEL
81 DS(320, "Delete <message-list>")
83 { "dp", deltype, (A | W | MSGLIST), 0, MMNDEL
84 DS(323, "Delete the current message, then print the next")
86 { "dt", deltype, (A | W | MSGLIST), 0, MMNDEL
87 DS(323, "Delete the current message, then print the next")
89 { "undelete", undeletecmd, (A | P | MSGLIST), MDELETED,MMNDEL
90 DS(392, "Un\"delete\" <message-list>")
92 { "unset", unset, (M | RAWLIST), 1, 1000
93 DS(402, "Unset <option-list>")
95 { "mail", sendmail, (R | M | I | STRLIST), 0, 0
96 DS(351, "Compose mail; recipients may be given as arguments")
98 { "Mail", Sendmail, (R | M | I | STRLIST), 0, 0
99 DS(350, "Like \"mail\", but derive filename from first recipient")
101 { "mbox", mboxit, (A | W | MSGLIST), 0, 0
102 DS(352, "Indicate that <message-list> is to be stored in *mbox*")
104 { "more", more, (A | MSGLIST), 0, MMNDEL
105 DS(410, "Like \"type\"/\"print\", put print \\f between messages")
107 { "page", more, (A | MSGLIST), 0, MMNDEL
108 DS(410, "Like \"type\"/\"print\", put print \\f between messages")
110 { "More", More, (A | MSGLIST), 0, MMNDEL
111 DS(411, "Like \"Type\"/\"Print\", put print \\f between messages")
113 { "Page", More, (A | MSGLIST), 0, MMNDEL
114 DS(411, "Like \"Type\"/\"Print\", put print \\f between messages")
116 { "unread", unread, (A | MSGLIST), 0, MMNDEL
117 DS(356, "Mark <message-list> as not being read")
119 { "Unread", unread, (A | MSGLIST), 0, MMNDEL
120 DS(356, "Mark <message-list> as not being read")
122 { "new", unread, (A | MSGLIST), 0, MMNDEL
123 DS(356, "Mark <message-list> as not being read")
125 { "New", unread, (A | MSGLIST), 0, MMNDEL
126 DS(356, "Mark <message-list> as not being read")
128 { "!", shell, (I | STRLIST), 0, 0
129 DS(412, "Execute <shell-command>")
131 { "copy", copycmd, (A | M | STRLIST), 0, 0
132 DS(314, "Copy <message-list>, but don't mark them for deletion")
134 { "Copy", Copycmd, (A | M | STRLIST), 0, 0
135 DS(315, "Like \"copy\", but derive filename from first sender")
137 { "chdir", schdir, (M | RAWLIST), 0, 1
138 DS(309, "Change CWD to the specified/the login directory")
140 { "cd", schdir, (M | RAWLIST), 0, 1
141 DS(309, "Change CWD to the specified/the login directory")
143 { "save", save, (A | STRLIST), 0, 0
144 DS(371, "Append <message-list> to <file>")
146 { "Save", Save, (A | STRLIST), 0, 0
147 DS(372, "Like \"save\", but derive filename from first sender")
149 { "source", csource, (M | RAWLIST), 1, 1
150 DS(383, "Read commands from <file>")
152 { "set", set, (M | RAWLIST), 0, 1000
153 DS(376, "Print all variables, or set variables to argument(s)")
155 { "shell", dosh, (I | NOLIST), 0, 0
156 DS(378, "Invoke an interactive shell")
158 { "version", pversion, (M | NOLIST), 0, 0
159 DS(413, "Print the MUA version")
161 { "unalias", ungroup, (M | RAWLIST), 0, 1000
162 DS(387, "Un\"alias\" <name-list>")
164 { "write", cwrite, (A | STRLIST), 0, 0
165 DS(406, "Write (append) to <file>")
167 { "from", from, (A | MSGLIST), 0, MMNORM
168 DS(338, "Show message headers of <message-list>")
170 { "file", cfile, (T | M | RAWLIST), 0, 1
171 DS(329, "Switch to new or show the current mail file or folder")
173 { "followup", followup, (A | R | I | MSGLIST), 0, MMNDEL
174 DS(333, "Like \"respond\", but derive filename from first sender")
176 { "followupall", followupall, (A | R | I | MSGLIST), 0, MMNDEL
177 DS(334, "Like \"respond\", but derive filename from first sender")
179 { "followupsender", followupsender, (A | R | I | MSGLIST), 0, MMNDEL
180 DS(335, "Like \"Followup\", but always respond to the sender only")
182 { "folder", cfile, (T | M | RAWLIST), 0, 1
183 DS(329, "Switch to new or show the current mail file or folder")
185 { "folders", folders, (T | M | RAWLIST), 0, 1
186 DS(332, "List folders (below given folder)")
188 { "z", scroll, (A | M | STRLIST), 0, 0
189 DS(407, "Scroll to next/previous window of headers")
191 { "Z", Scroll, (A | M | STRLIST), 0, 0
192 DS(408, "Like \"z\", but continues to the next flagged message")
194 { "headers", headers, (A | MSGLIST), 0, MMNDEL
195 DS(342, "Show the current(/last/next) 18-message group of headers")
197 { "help", help, (M | RAWLIST), 0, 1
198 DS(343, "Show command help (for the given one)")
200 { "?", help, (M | RAWLIST), 0, 1
201 DS(343, "Show command help (for the given one)")
203 { "=", pdot, (A | NOLIST), 0, 0
204 DS(409, "Show current message number")
206 { "Reply", Respond, (A | R | I | MSGLIST), 0, MMNDEL
207 DS(368, "Reply to originator, exclusively")
209 { "Respond", Respond, (A | R | I | MSGLIST), 0, MMNDEL
210 DS(368, "Reply to originator, exclusively")
212 { "Followup", Followup, (A | R | I | MSGLIST), 0, MMNDEL
213 DS(332, "Like \"Respond\", but derive filename from first sender")
215 { "reply", respond, (A | R | I | MSGLIST), 0, MMNDEL
216 DS(369, "Reply to originator and recipients of <message-list>")
218 { "replyall", respondall, (A | R | I | MSGLIST), 0, MMNDEL
219 DS(369, "Reply to originator and recipients of <message-list>")
221 { "replysender", respondsender, (A | R | I | MSGLIST), 0, MMNDEL
222 DS(368, "Reply to originator, exclusively")
224 { "respond", respond, (A | R | I | MSGLIST), 0, MMNDEL
225 DS(369, "Reply to originators and recipients of <message-list>")
227 { "respondall", respondall, (A | R | I | MSGLIST), 0, MMNDEL
228 DS(369, "Reply to originators and recipients of <message-list>")
230 { "respondsender", respondsender, (A | R | I | MSGLIST),0, MMNDEL
231 DS(368, "Reply to originator, exclusively")
233 { "Resend", Resendcmd, (A | R | STRLIST), 0, MMNDEL
234 DS(365, "Like \"resend\", but don't add Resent-* headers")
236 { "Redirect", Resendcmd, (A | R | STRLIST), 0, MMNDEL
237 DS(365, "Like \"resend\", but don't add Resent-* headers")
239 { "resend", resendcmd, (A | R | STRLIST), 0, MMNDEL
240 DS(364, "Resend <message-list> to <user>, add Resent-* headers")
242 { "redirect", resendcmd, (A | R | STRLIST), 0, MMNDEL
243 DS(364, "Resend <message-list> to <user>, add Resent-* headers")
245 { "Forward", Forwardcmd, (A | R | STRLIST), 0, MMNDEL
246 DS(337, "Like \"forward\", but derive filename from <address>")
248 { "Fwd", Forwardcmd, (A | R | STRLIST), 0, MMNDEL
249 DS(337, "Like \"forward\", but derive filename from <address>")
251 { "forward", forwardcmd, (A | R | STRLIST), 0, MMNDEL
252 DS(336, "Forward <message> to <address>")
254 { "fwd", forwardcmd, (A | R | STRLIST), 0, MMNDEL
255 DS(336, "Forward <message> to <address>")
257 { "edit", editor, (A | I | MSGLIST), 0, MMNORM
258 DS(326, "Edit <message-list>")
260 { "echo", echo, (M | ECHOLIST), 0, 1000
261 DS(325, "Echo given arguments")
263 { "quit", quitcmd, NOLIST, 0, 0
264 DS(363, "Terminate session, saving messages as necessary")
266 { "list", pcmdlist, (M | NOLIST), 0, 0
267 DS(349, "List all available commands")
269 { "xit", rexit, (M | NOLIST), 0, 0
270 DS(328, "Immediate return to the shell without saving")
272 { "exit", rexit, (M | NOLIST), 0, 0
273 DS(328, "Immediate return to the shell without saving")
275 { "pipe", pipecmd, (A | STRLIST), 0, MMNDEL
276 DS(359, "Pipe <message-list> to <command>")
278 { " | ", pipecmd, (A | STRLIST), 0, MMNDEL
279 DS(359, "Pipe <message-list> to <command>")
281 { "Pipe", Pipecmd, (A | STRLIST), 0, MMNDEL
282 DS(358, "Like \"pipe\", but pipes all headers and parts")
284 { "size", messize, (A | MSGLIST), 0, MMNDEL
285 DS(381, "Show size in characters for <message-list>")
287 { "hold", preserve, (A | W | MSGLIST), 0, MMNDEL
288 DS(344, "Save <message-list> in system mailbox instead of *mbox*")
290 { "if", ifcmd, (F | M | RAWLIST), 1, 1
291 DS(327, "Part of the if .. then .. endif statement")
293 { "else", elsecmd, (F | M | RAWLIST), 0, 0
294 DS(327, "Part of the if .. then .. endif statement")
296 { "endif", endifcmd, (F | M | RAWLIST), 0, 0
297 DS(327, "Part of the if .. then .. endif statement")
299 { "alternates", alternates, (M | RAWLIST), 0, 1000
300 DS(305, "Show or define an alternate list for the invoking user")
302 { "ignore", igfield, (M | RAWLIST), 0, 1000
303 DS(321, "Add header fields to ignored LIST), or show that list")
305 { "discard", igfield, (M | RAWLIST), 0, 1000
306 DS(321, "Add header fields to ignored LIST), or show that list")
308 { "retain", retfield, (M | RAWLIST), 0, 1000
309 DS(370, "Add header fields to retained LIST), or show that list")
311 { "saveignore", saveigfield, (M | RAWLIST), 0, 1000
312 DS(373, "Is to \"save\" what \"ignore\" is to \"type\"/\"print\"")
314 { "savediscard",saveigfield, (M | RAWLIST), 0, 1000
315 DS(373, "Is to \"save\" what \"ignore\" is to \"type\"/\"print\"")
317 { "saveretain", saveretfield, (M | RAWLIST), 0, 1000
318 DS(374, "Is to \"save\" what \"retain\" is to \"type\"/\"print\"")
320 { "unignore", unignore, (M | RAWLIST), 0, 1000
321 DS(396, "Un\"ignore\" <header-fields>")
323 { "unretain", unretain, (M | RAWLIST), 0, 1000
324 DS(399, "Un\"retain\" <header-fields>")
326 { "unsaveignore", unsaveignore, (M | RAWLIST), 0, 1000
327 DS(400, "Un\"saveignore\" <header-fields>")
329 { "unsaveretain", unsaveretain, (M | RAWLIST), 0, 1000
330 DS(401, "Un\"saveretain\" <header-fields>")
332 { "inc", newmail, (A | T | NOLIST), 0, 0
333 DS(346, "Check for new mail in current folder")
335 { "newmail", newmail, (A | T | NOLIST), 0, 0
336 DS(346, "Check for new mail in current folder")
338 { "shortcut", shortcut, (M | RAWLIST), 0, 1000
339 DS(379, "Define a <shortcut> and <expansion>, or list shortcuts")
341 { "unshortcut", unshortcut, (M | RAWLIST), 0, 1000
342 DS(403, "Delete <shortcut-list>")
344 { "imap", imap_imap, (A | STRLIST), 0, 1000
345 DS(345, "Send command strings directly to the IMAP server")
347 { "account", account, (M | RAWLIST), 0, 1000
348 DS(303, "Creates, selects or lists an email account")
350 { "thread", thread, (A | MSGLIST), 0, 0
351 DS(384, "Create threaded view of current \"folder\"")
353 { "unthread", unthread, (A | MSGLIST), 0, 0
354 DS(404, "Disable sorted or threaded mode")
356 { "online", cconnect, (A | NOLIST), 0, 0
357 DS(314, "If disconnected, connect to IMAP mailbox")
359 { "connect", cconnect, (A | NOLIST), 0, 0
360 DS(314, "If disconnected, connect to IMAP mailbox")
362 { "disconnect", cdisconnect, (A | NDMLIST), 0, 0
363 DS(322, "If connected, disconnect from IMAP mailbox")
365 { "sort", sort, (A | RAWLIST), 0, 1
366 DS(382, "Change sorting criteria (and addressing modes)")
368 { "unsort", unthread, (A | MSGLIST), 0, 0
369 DS(404, "Disable sorted or threaded mode")
371 { "cache", ccache, (A | MSGLIST), 0, 0
372 DS(307, "Read specified <message list> into the IMAP cache")
374 { "flag", cflag, (A | M | MSGLIST), 0, 0
375 DS(330, "(Un)Flag <message-list> (for special attention)")
377 { "unflag", cunflag, (A | M | MSGLIST), 0, 0
378 DS(330, "(Un)Flag <message-list> (for special attention)")
380 { "answered", canswered, (A | M | MSGLIST), 0, 0
381 DS(306, "Mark the given <message list> as \"answered\"")
383 { "unanswered", cunanswered, (A | M | MSGLIST), 0, 0
384 DS(388, "Un\"answered\" <message-list>")
386 { "draft", cdraft, (A | M | MSGLIST), 0, 0
387 DS(324, "Mark <message-list> as draft")
389 { "undraft", cundraft, (A | M | MSGLIST), 0, 0
390 DS(389, "Un\"draft\" <message-list>")
392 { "define", cdefine, (M | RAWLIST), 0, 2
393 DS(319, "Define a macro")
395 { "defines", cdefines, (M | RAWLIST), 0, 0
396 DS(320, "Show all defined macros including their content")
398 { "undef", cundef, (M | RAWLIST), 0, 1000
399 DS(391, "Un\"define\" all <macros>")
401 { "call", ccall, (M | RAWLIST), 0, 1
402 DS(308, "Call a macro")
404 { "~", ccall, (M | RAWLIST), 0, 1
405 DS(308, "Call a macro")
407 { "move", cmove, (A | M | STRLIST), 0, 0
408 DS(353, "Like \"copy\", but mark messages for deletion")
410 { "mv", cmove, (A | M | STRLIST), 0, 0
411 DS(353, "Like \"copy\", but mark messages for deletion")
413 { "Move", cMove, (A | M | STRLIST), 0, 0
414 DS(354, "Like \"move\", but derive filename from first sender")
416 { "Mv", cMove, (A | M | STRLIST), 0, 0
417 DS(354, "Like \"move\", but derive filename from first sender")
419 { "noop", cnoop, (A | M | RAWLIST), 0, 0
420 DS(357, "NOOP command if IMAP or POP folder; else noop")
422 { "collapse", ccollapse, (A | MSGLIST), 0, 0
423 DS(312, "Collapse thread views for <message-list>")
425 { "uncollapse", cuncollapse, (A | MSGLIST), 0, 0
426 DS(390, "Uncollapse <message-list> if in threaded view")
428 { "verify", cverify, (A | MSGLIST), 0, 0
429 DS(405, "Verify <message-list>")
431 { "decrypt", cdecrypt, (A | M | STRLIST), 0, 0
432 DS(316, "Like \"copy\", but decrypt first, if encrypted")
434 { "Decrypt", cDecrypt, (A | M | STRLIST), 0, 0
435 DS(317, "Like \"decrypt\", but derive filename from first sender")
437 { "certsave", ccertsave, (A | STRLIST), 0, 0
438 DS(310, "Save S/MIME certificates of <message-list> to <file>")
440 { "rename", crename, (M | RAWLIST), 0, 2
441 DS(367, "Rename <existing-folder> to <new-folder>")
443 { "remove", cremove, (M | RAWLIST), 0, 1000
444 DS(366, "Remove the named folders")
446 { "show", show, (A | MSGLIST), 0, MMNDEL
447 DS(380, "Like \"print\", but show raw message content")
449 { "Show", show, (A | MSGLIST), 0, MMNDEL
450 DS(380, "Like \"print\", but show raw message content")
452 { "seen", seen, (A | M | MSGLIST), 0, MMNDEL
453 DS(377, "Mark <message-list> as seen")
455 { "Seen", seen, (A | M | MSGLIST), 0, MMNDEL
456 DS(377, "Mark <message-list> as seen")
458 { "fwdignore", fwdigfield, (M | RAWLIST), 0, 1000
459 DS(339, "Which header fields are to be ignored with \"forward\"")
461 { "fwddiscard", fwdigfield, (M | RAWLIST), 0, 1000
462 DS(339, "Which header fields are to be ignored with \"forward\"")
464 { "fwdretain", fwdretfield, (M | RAWLIST), 0, 1000
465 DS(340, "Which header fields have to be retained with \"forward\"")
467 { "unfwdignore", unfwdignore, (M | RAWLIST), 0, 1000
468 DS(393, "Un\"fwdignore\" <header-fields>")
470 { "unfwdretain", unfwdretain, (M | RAWLIST), 0, 1000
471 DS(394, "Un\"fwdretain\" <header-fields>")
473 /* { "Header", Header, STRLIST), 0, 1000 */
474 { "mimetypes", cmimetypes, (M | RAWLIST), 0, 1000
475 DS(418, "Either <show> (default) or <clear> the mime.types cache")
477 { "spamrate", cspam_rate, (A | M | R | MSGLIST), 0, 0
478 DS(419, "Rate <message-list> via the spam detector")
480 { "spamham", cspam_ham, (A | M | R | MSGLIST), 0, 0
481 DS(420, "Teach the spam detector that <message-list> is ham")
483 { "spamspam", cspam_spam, (A | M | R | MSGLIST), 0, 0
484 DS(421, "Teach the spam detector that <message-list> is spam")
486 { "spamforget", cspam_forget, (A | M | R | MSGLIST), 0, 0
487 DS(422, "Force the spam detector to \"unlearn\" <message-list>")
489 { "spamset", cspam_set, (A | M | MSGLIST), 0, 0
490 DS(423, "Set the spam flag for each message in <message-list>")
492 { "spamclear", cspam_clear, (A | M | MSGLIST), 0, 0
493 DS(424, "Clear the spam flag for each message in <message-list>")
495 #ifdef HAVE_ASSERTS
496 { "core", core, (M | NOLIST), 0, 0
497 DS(414, "Produce a core dump (ouch!)")
499 { "clobber", clobber, (M | RAWLIST), 0, 1
500 DS(415, "Globber <number> 512 byte blocks on the stack")
502 { "sstats", sstats, (M | NOLIST), 0, 0
503 DS(416, "Print statistics about the auto-reclaimed string store")
505 { "smemtrace", smemtrace, (M | NOLIST), 0, 0
506 DS(417, "Trace current memory usage afap")
508 #endif
509 { NULL, NULL, 0, 0, 0 DS(0, "") }
512 /* vim:set fenc=utf-8:s-it-mode */