newfile(): expand() part filename user input..
[s-mailx.git] / cmdtab.c
blob4e328c9b45caf970c33cf59d8de5796bb206f2ce
1 /*
2 * S-nail - a mail user agent derived from Berkeley Mail.
4 * Copyright (c) 2000-2004 Gunnar Ritter, Freiburg i. Br., Germany.
5 * Copyright (c) 2012 Steffen "Daode" Nurpmeso.
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"
44 * Mail -- a mail program
46 * Define all of the command names and bindings.
49 const struct cmd cmdtab[] = {
50 { "next", next, A|NDMLIST, 0, MMNDEL },
51 { "alias", group, M|RAWLIST, 0, 1000 },
52 { "print", type, A|MSGLIST, 0, MMNDEL },
53 { "type", type, A|MSGLIST, 0, MMNDEL },
54 { "Type", Type, A|MSGLIST, 0, MMNDEL },
55 { "Print", Type, A|MSGLIST, 0, MMNDEL },
56 { "visual", visual, A|I|MSGLIST, 0, MMNORM },
57 { "top", top, A|MSGLIST, 0, MMNDEL },
58 { "touch", stouch, A|W|MSGLIST, 0, MMNDEL },
59 { "preserve", preserve, A|W|MSGLIST, 0, MMNDEL },
60 { "delete", delete, A|W|P|MSGLIST, 0, MMNDEL },
61 { "dp", deltype, A|W|MSGLIST, 0, MMNDEL },
62 { "dt", deltype, A|W|MSGLIST, 0, MMNDEL },
63 { "undelete", undeletecmd, A|P|MSGLIST, MDELETED,MMNDEL },
64 { "unset", unset, M|RAWLIST, 1, 1000 },
65 { "mail", sendmail, R|M|I|STRLIST, 0, 0 },
66 { "Mail", Sendmail, R|M|I|STRLIST, 0, 0 },
67 { "mbox", mboxit, A|W|MSGLIST, 0, 0 },
68 { "more", more, A|MSGLIST, 0, MMNDEL },
69 { "page", more, A|MSGLIST, 0, MMNDEL },
70 { "More", More, A|MSGLIST, 0, MMNDEL },
71 { "Page", More, A|MSGLIST, 0, MMNDEL },
72 { "unread", unread, A|MSGLIST, 0, MMNDEL },
73 { "Unread", unread, A|MSGLIST, 0, MMNDEL },
74 { "new", unread, A|MSGLIST, 0, MMNDEL },
75 { "New", unread, A|MSGLIST, 0, MMNDEL },
76 { "!", shell, I|STRLIST, 0, 0 },
77 { "copy", copycmd, A|M|STRLIST, 0, 0 },
78 { "Copy", Copycmd, A|M|STRLIST, 0, 0 },
79 { "chdir", schdir, M|RAWLIST, 0, 1 },
80 { "cd", schdir, M|RAWLIST, 0, 1 },
81 { "save", save, A|STRLIST, 0, 0 },
82 { "Save", Save, A|STRLIST, 0, 0 },
83 { "source", source, M|RAWLIST, 1, 1 },
84 { "set", set, M|RAWLIST, 0, 1000 },
85 { "shell", dosh, I|NOLIST, 0, 0 },
86 { "version", pversion, M|NOLIST, 0, 0 },
87 { "group", group, M|RAWLIST, 0, 1000 },
88 { "ungroup", ungroup, M|RAWLIST, 0, 1000 },
89 { "unalias", ungroup, M|RAWLIST, 0, 1000 },
90 { "write", cwrite, A|STRLIST, 0, 0 },
91 { "from", from, A|MSGLIST, 0, MMNORM },
92 { "file", cfile, T|M|RAWLIST, 0, 1 },
93 { "followup", followup, A|R|I|MSGLIST, 0, MMNDEL },
94 { "followupall", followupall, A|R|I|MSGLIST, 0, MMNDEL },
95 { "followupsender", followupsender, A|R|I|MSGLIST, 0, MMNDEL },
96 { "folder", cfile, T|M|RAWLIST, 0, 1 },
97 { "folders", folders, T|M|RAWLIST, 0, 1 },
98 { "?", help, M|NOLIST, 0, 0 },
99 { "z", scroll, A|M|STRLIST, 0, 0 },
100 { "Z", Scroll, A|M|STRLIST, 0, 0 },
101 { "headers", headers, A|MSGLIST, 0, MMNDEL },
102 { "help", help, M|NOLIST, 0, 0 },
103 { "=", pdot, A|NOLIST, 0, 0 },
104 { "Reply", Respond, A|R|I|MSGLIST, 0, MMNDEL },
105 { "Respond", Respond, A|R|I|MSGLIST, 0, MMNDEL },
106 { "Followup", Followup, A|R|I|MSGLIST, 0, MMNDEL },
107 { "reply", respond, A|R|I|MSGLIST, 0, MMNDEL },
108 { "replyall", respondall, A|R|I|MSGLIST, 0, MMNDEL },
109 { "replysender", respondsender, A|R|I|MSGLIST, 0, MMNDEL },
110 { "respond", respond, A|R|I|MSGLIST, 0, MMNDEL },
111 { "respondall", respondall, A|R|I|MSGLIST, 0, MMNDEL },
112 { "respondsender", respondsender, A|R|I|MSGLIST,0, MMNDEL },
113 { "Resend", Resendcmd, A|R|STRLIST, 0, MMNDEL },
114 { "Redirect", Resendcmd, A|R|STRLIST, 0, MMNDEL },
115 { "resend", resendcmd, A|R|STRLIST, 0, MMNDEL },
116 { "redirect", resendcmd, A|R|STRLIST, 0, MMNDEL },
117 { "Forward", Forwardcmd, A|R|STRLIST, 0, MMNDEL },
118 { "Fwd", Forwardcmd, A|R|STRLIST, 0, MMNDEL },
119 { "forward", forwardcmd, A|R|STRLIST, 0, MMNDEL },
120 { "fwd", forwardcmd, A|R|STRLIST, 0, MMNDEL },
121 { "edit", editor, A|I|MSGLIST, 0, MMNORM },
122 { "echo", echo, M|ECHOLIST, 0, 1000 },
123 { "quit", quitcmd, NOLIST, 0, 0 },
124 { "list", pcmdlist, M|NOLIST, 0, 0 },
125 { "xit", rexit, M|NOLIST, 0, 0 },
126 { "exit", rexit, M|NOLIST, 0, 0 },
127 { "pipe", pipecmd, A|STRLIST, 0, MMNDEL },
128 { "|", pipecmd, A|STRLIST, 0, MMNDEL },
129 { "Pipe", Pipecmd, A|STRLIST, 0, MMNDEL },
130 { "size", messize, A|MSGLIST, 0, MMNDEL },
131 { "hold", preserve, A|W|MSGLIST, 0, MMNDEL },
132 { "if", ifcmd, F|M|RAWLIST, 1, 1 },
133 { "else", elsecmd, F|M|RAWLIST, 0, 0 },
134 { "endif", endifcmd, F|M|RAWLIST, 0, 0 },
135 { "alternates", alternates, M|RAWLIST, 0, 1000 },
136 { "ignore", igfield, M|RAWLIST, 0, 1000 },
137 { "discard", igfield, M|RAWLIST, 0, 1000 },
138 { "retain", retfield, M|RAWLIST, 0, 1000 },
139 { "saveignore", saveigfield, M|RAWLIST, 0, 1000 },
140 { "savediscard",saveigfield, M|RAWLIST, 0, 1000 },
141 { "saveretain", saveretfield, M|RAWLIST, 0, 1000 },
142 { "unignore", unignore, M|RAWLIST, 0, 1000 },
143 { "unretain", unretain, M|RAWLIST, 0, 1000 },
144 { "unsaveignore", unsaveignore, M|RAWLIST, 0, 1000 },
145 { "unsaveretain", unsaveretain, M|RAWLIST, 0, 1000 },
146 { "inc", newmail, A|T|NOLIST, 0, 0 },
147 { "newmail", newmail, A|T|NOLIST, 0, 0 },
148 { "shortcut", shortcut, M|RAWLIST, 0, 1000 },
149 { "unshortcut", unshortcut, M|RAWLIST, 0, 1000 },
150 { "imap", imap_imap, A|STRLIST, 0, 1000 },
151 { "account", account, M|RAWLIST, 0, 1000 },
152 { "thread", thread, A|MSGLIST, 0, 0 },
153 { "unthread", unthread, A|MSGLIST, 0, 0 },
154 { "online", cconnect, A|NOLIST, 0, 0 },
155 { "connect", cconnect, A|NOLIST, 0, 0 },
156 { "disconnect", cdisconnect, A|NDMLIST, 0, 0 },
157 { "sort", sort, A|RAWLIST, 0, 1 },
158 { "unsort", unthread, A|MSGLIST, 0, 0 },
159 { "cache", ccache, A|MSGLIST, 0, 0 },
160 { "flag", cflag, A|M|MSGLIST, 0, 0 },
161 { "unflag", cunflag, A|M|MSGLIST, 0, 0 },
162 { "answered", canswered, A|M|MSGLIST, 0, 0 },
163 { "unanswered", cunanswered, A|M|MSGLIST, 0, 0 },
164 { "draft", cdraft, A|M|MSGLIST, 0, 0 },
165 { "undraft", cundraft, A|M|MSGLIST, 0, 0 },
166 { "kill", ckill, A|M|MSGLIST, 0, 0 },
167 { "unkill", cunkill, A|M|MSGLIST, 0, 0 },
168 { "score", cscore, A|M|STRLIST, 0, 0 },
169 { "define", cdefine, M|RAWLIST, 0, 2 },
170 { "defines", cdefines, M|RAWLIST, 0, 0 },
171 { "undef", cundef, M|RAWLIST, 0, 1000 },
172 { "call", ccall, M|RAWLIST, 0, 1 },
173 { "move", cmove, A|M|STRLIST, 0, 0 },
174 { "mv", cmove, A|M|STRLIST, 0, 0 },
175 { "Move", cMove, A|M|STRLIST, 0, 0 },
176 { "Mv", cMove, A|M|STRLIST, 0, 0 },
177 { "noop", cnoop, A|M|RAWLIST, 0, 0 },
178 { "collapse", ccollapse, A|MSGLIST, 0, 0 },
179 { "uncollapse", cuncollapse, A|MSGLIST, 0, 0 },
180 { "verify", cverify, A|MSGLIST, 0, 0 },
181 { "decrypt", cdecrypt, A|M|STRLIST, 0, 0 },
182 { "Decrypt", cDecrypt, A|M|STRLIST, 0, 0 },
183 { "certsave", ccertsave, A|STRLIST, 0, 0 },
184 { "rename", crename, M|RAWLIST, 0, 2 },
185 { "remove", cremove, M|RAWLIST, 0, 1000 },
186 { "classify", cclassify, A|M|MSGLIST, 0, 0 },
187 { "junk", cjunk, A|M|MSGLIST, 0, 0 },
188 { "bad", cjunk, A|M|MSGLIST, 0, 0 },
189 { "good", cgood, A|M|MSGLIST, 0, 0 },
190 { "unjunk", cunjunk, A|M|MSGLIST, 0, 0 },
191 { "ungood", cungood, A|M|MSGLIST, 0, 0 },
192 { "probability",cprobability, M|RAWLIST, 0, 1000 },
193 { "show", show, A|MSGLIST, 0, MMNDEL },
194 { "Show", show, A|MSGLIST, 0, MMNDEL },
195 { "seen", seen, A|M|MSGLIST, 0, MMNDEL },
196 { "Seen", seen, A|M|MSGLIST, 0, MMNDEL },
197 { "fwdignore", fwdigfield, M|RAWLIST, 0, 1000 },
198 { "fwddiscard",fwdigfield, M|RAWLIST, 0, 1000 },
199 { "fwdretain", fwdretfield, M|RAWLIST, 0, 1000 },
200 { "unfwdignore", unfwdignore, M|RAWLIST, 0, 1000 },
201 { "unfwdretain", unfwdretain, M|RAWLIST, 0, 1000 },
202 /* { "Header", Header, STRLIST, 0, 1000 }, */
203 #ifdef HAVE_ASSERTS
204 { "core", core, M|NOLIST, 0, 0 },
205 { "clobber", clobber, M|RAWLIST, 0, 1 },
206 #endif
207 { 0, 0, 0, 0, 0 }