Expand PMF_FN_* macros.
[netbsd-mini2440.git] / usr.bin / mail / cmdtab.c
blob3b5f6c2dd954182a37376146750a084173f38618
1 /* $NetBSD: cmdtab.c,v 1.20 2007/10/30 02:28:31 christos Exp $ */
3 /*
4 * Copyright (c) 1980, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
32 #include <sys/cdefs.h>
33 #ifndef lint
34 #if 0
35 static char sccsid[] = "@(#)cmdtab.c 8.2 (Berkeley) 4/20/95";
36 #else
37 __RCSID("$NetBSD: cmdtab.c,v 1.20 2007/10/30 02:28:31 christos Exp $");
38 #endif
39 #endif /* not lint */
41 #include "def.h"
42 #include "extern.h"
43 #include "thread.h"
45 #ifdef USE_EDITLINE
46 # define CMP(x) #x,
47 # define CMP0 0,
48 #else
49 # define CMP(x)
50 # define CMP0
51 #endif
53 #define A (C_PIPE_SHELL | C_PIPE_PAGER)
54 #define C (C_PIPE_SHELL | C_PIPE_CRT)
55 #define S (C_PIPE_SHELL)
58 * Mail -- a mail program
60 * Define all of the command names and bindings.
62 /* R - in left comment means recursive */
63 const struct cmd cmdtab[] = {
64 { "next", next, C, CMP(n) NDMLIST, 0, MMNDEL },
65 { "alias", group, S, CMP(A) T|M|RAWLIST, 0, 1000 },
66 /* R */ { "print", type, C, CMP(n) MSGLIST, 0, MMNDEL },
67 /* R */ { "Print", Type, C, CMP(n) MSGLIST, 0, MMNDEL },
68 /* R */ { "type", type, C, CMP(n) MSGLIST, 0, MMNDEL },
69 /* R */ { "Type", Type, C, CMP(n) MSGLIST, 0, MMNDEL },
70 { "visual", visual, 0, CMP(n) I|MSGLIST, 0, MMNORM },
71 /* R */ { "top", top, S, CMP(n) MSGLIST, 0, MMNDEL },
72 /* R */ { "touch", stouch, 0, CMP(n) W|MSGLIST, 0, MMNDEL },
73 /* R */ { "preserve", preserve, 0, CMP(n) W|MSGLIST, 0, MMNDEL },
74 /* R */ { "delete", delete, 0, CMP(n) W|P|MSGLIST, 0, MMNDEL },
75 /* R */ { "dp", deltype, C, CMP(n) W|MSGLIST, 0, MMNDEL },
76 /* R */ { "dt", deltype, C, CMP(n) W|MSGLIST, 0, MMNDEL },
77 /* R */ { "undelete", undeletecmd, 0, CMP(n) P|MSGLIST, MDELETED, MMNDEL },
78 { "unset", unset, 0, CMP(S) T|M|RAWLIST, 1, 1000 },
79 { "mail", sendmail, 0, CMP(A) R|M|I|STRLIST, 0, 0 },
80 /* R */ { "mbox", mboxit, 0, CMP(n) W|MSGLIST, 0, MMNDEL },
81 /* R */ { "more", type, A, CMP(n) MSGLIST, 0, MMNDEL },
82 /* R */ { "More", Type, A, CMP(n) MSGLIST, 0, MMNDEL },
83 /* R */ { "page", type, A, CMP(n) MSGLIST, 0, MMNDEL },
84 /* R */ { "Page", Type, A, CMP(n) MSGLIST, 0, MMNDEL },
85 #ifdef MIME_SUPPORT
86 /* R */ { "view", view, A, CMP(n) MSGLIST, 0, MMNDEL },
87 /* R */ { "View", View, A, CMP(n) MSGLIST, 0, MMNDEL },
88 #endif
89 { "unalias", unalias, 0, CMP(A) T|M|RAWLIST, 1, 1000 },
90 /* R */ { "unread", unread, 0, CMP(n) MSGLIST, 0, MMNDEL },
91 { "!", shell, 0, CMP(xF) T|I|STRLIST, 0, 0 },
92 { "|", pipecmd, 0, CMP(xF) I|STRLIST, 0, 0 },
93 /* R */ { "copy", copycmd, 0, CMP(F) M|STRLIST, 0, 0 },
94 { "chdir", schdir, 0, CMP(F) T|M|RAWLIST, 0, 1 },
95 { "cd", schdir, 0, CMP(F) T|M|RAWLIST, 0, 1 },
96 /* R */ { "save", save, 0, CMP(F) STRLIST, 0, 0 },
97 /* R */ { "Save", Save, 0, CMP(F) STRLIST, 0, 0 },
98 { "source", source, 0, CMP(F) T|M|RAWLIST, 1, 1 },
99 { "set", set, S, CMP(sF) T|M|RAWLIST, 0, 1000 },
100 { "shell", dosh, 0, CMP(n) T|I|NOLIST, 0, 0 },
101 { "show", show, S, CMP(S) T|M|RAWLIST, 0, 1000 },
102 { "version", pversion, S, CMP(n) T|M|NOLIST, 0, 0 },
103 { "group", group, S, CMP(a) T|M|RAWLIST, 0, 1000 },
104 /* R */ { "write", swrite, 0, CMP(F) STRLIST, 0, 0 },
105 { "from", from, S, CMP(n) MSGLIST, 0, MMNORM },
106 { "file", file, 0, CMP(f) T|M|RAWLIST, 0, 1 },
107 { "folder", file, 0, CMP(f) T|M|RAWLIST, 0, 1 },
108 { "folders", folders, S, CMP(n) T|M|NOLIST, 0, 0 },
109 #ifdef MIME_SUPPORT
110 { "forward", forward, 0, CMP(n) R|I|MSGLIST, 0, 0 },
111 #endif
112 { "bounce", bounce, 0, CMP(n) R|I|MSGLIST, 0, 0 },
113 { "?", help, S, CMP(n) T|M|NOLIST, 0, 0 },
114 { "z", scroll, S, CMP(n) M|STRLIST, 0, 0 },
115 { "headers", headers, S, CMP(n) T|MSGLIST, 0, MMNDEL },
116 { "help", help, S, CMP(n) T|M|NOLIST, 0, 0 },
117 { "=", pdot, S, CMP(n) T|MSGLIST, 0, MMNDEL },
118 { "Reply", Respond, 0, CMP(n) R|I|MSGLIST, 0, MMNDEL },
119 { "Respond", Respond, 0, CMP(n) R|I|MSGLIST, 0, MMNDEL },
120 { "reply", respond, 0, CMP(n) R|I|MSGLIST, 0, MMNDEL },
121 { "respond", respond, 0, CMP(n) R|I|MSGLIST, 0, MMNDEL },
122 { "edit", editor, 0, CMP(n) I|MSGLIST, 0, MMNORM },
123 { "echo", echo, S, CMP(F) T|M|RAWLIST, 0, 1000 },
124 { "quit", quitcmd, 0, CMP(n) NOLIST, 0, 0 },
125 { "list", pcmdlist, S, CMP(n) T|M|NOLIST, 0, 0 },
126 { "xit", rexit, 0, CMP(n) M|NOLIST, 0, 0 },
127 { "exit", rexit, 0, CMP(n) M|NOLIST, 0, 0 },
128 { "size", messize, S, CMP(n) T|MSGLIST, 0, MMNDEL },
129 /* R */ { "hold", preserve, 0, CMP(n) W|MSGLIST, 0, MMNDEL },
130 { "if", ifcmd, 0, CMP(F) T|F|M|RAWLIST, 1, 1 },
131 { "ifdef", ifdefcmd, 0, CMP(F) T|F|M|RAWLIST, 1, 1 },
132 { "ifndef", ifndefcmd, 0, CMP(F) T|F|M|RAWLIST, 1, 1 },
133 { "else", elsecmd, 0, CMP(F) T|F|M|RAWLIST, 0, 0 },
134 { "endif", endifcmd, 0, CMP(F) T|F|M|RAWLIST, 0, 0 },
135 { "alternates", alternates, S, CMP(n) T|M|RAWLIST, 0, 1000 },
136 { "ignore", igfield, S, CMP(n) T|M|RAWLIST, 0, 1000 },
137 { "discard", igfield, S, CMP(n) T|M|RAWLIST, 0, 1000 },
138 { "retain", retfield, S, CMP(n) T|M|RAWLIST, 0, 1000 },
139 { "saveignore", saveigfield, S, CMP(n) T|M|RAWLIST, 0, 1000 },
140 { "savediscard",saveigfield, S, CMP(n) T|M|RAWLIST, 0, 1000 },
141 { "saveretain", saveretfield, S, CMP(n) T|M|RAWLIST, 0, 1000 },
142 { "Header", Header, S, CMP(n) T|M|STRLIST, 0, 1000 },
143 { "core", core, 0, CMP(F) T|M|NOLIST, 0, 0 },
144 { "#", null, 0, CMP(n) T|M|NOLIST, 0, 0 },
145 { "clobber", clobber, 0, CMP(n) T|M|RAWLIST, 0, 1 },
146 { "inc", inc, S, CMP(n) T|NOLIST, 0, 0 },
147 { "smopts", smoptscmd, S, CMP(m) T|M|RAWLIST, 0, 1000 },
148 { "unsmopts", unsmoptscmd, S, CMP(M) T|M|RAWLIST, 1, 1000 },
149 /* R */ { "mkread", markread, 0, CMP(n) MSGLIST, 0, MMNDEL },
150 #ifdef MIME_SUPPORT
151 /* R */ { "detach", detach, S, CMP(F) STRLIST, 0, 0 },
152 /* R */ { "Detach", Detach, S, CMP(F) STRLIST, 0, 0 },
153 #endif
154 #ifdef THREAD_SUPPORT
155 { "flatten", flattencmd, 0, CMP(n) T|NDMLIST, 0, MMNDEL },
156 { "reverse", reversecmd, 0, CMP(n) T|STRLIST, 0, 0 },
157 { "sort", sortcmd, 0, CMP(T) T|STRLIST, 0, 0 },
158 { "thread", threadcmd, 0, CMP(T) T|STRLIST, 0, 0 },
159 { "unthread", unthreadcmd, 0, CMP(n) T|STRLIST, 0, 0 },
161 { "down", downcmd, 0, CMP(n) T|MSGLIST, 0, MMNDEL },
162 { "tset", tsetcmd, 0, CMP(n) T|MSGLIST, 0, MMNDEL },
163 { "up", upcmd, 0, CMP(n) T|STRLIST, 0, 0 },
165 { "expose", exposecmd, 0, CMP(n) T|STRLIST, 0, 0 },
166 { "hide", hidecmd, 0, CMP(n) T|STRLIST, 0, 0 },
167 { "showthreads",exposecmd, 0, CMP(n) T|STRLIST, 0, 0 },
168 { "hidethreads",hidecmd, 0, CMP(n) T|STRLIST, 0, 0 },
169 #ifdef THREAD_DEBUG
170 { "debug_links",thread_showcmd, S, CMP(n) T|MSGLIST, 0, MMNDEL },
171 #endif
172 /* R */ { "tag", tagcmd, 0, CMP(n) T|MSGLIST, 0, MMNDEL },
173 /* R */ { "untag", untagcmd, 0, CMP(n) T|MSGLIST, 0, MMNDEL },
174 /* R */ { "invtags", invtagscmd, 0, CMP(n) T|MSGLIST, 0, MMNDEL },
175 { "tagbelow", tagbelowcmd, 0, CMP(n) T|MSGLIST, 0, MMNDEL },
177 { "hidetags", hidetagscmd, 0, CMP(n) T|STRLIST, 0, 0 },
178 { "showtags", showtagscmd, 0, CMP(n) T|STRLIST, 0, 0 },
180 { "deldups", deldupscmd, 0, CMP(n) T|STRLIST, 0, 0 },
181 #endif /* THREAD_SUPPORT */
182 { 0, 0, 0, CMP0 0, 0, 0 }