cmdtab.c revision 1.15 1 /* $NetBSD: cmdtab.c,v 1.15 2006/10/31 20:07:32 christos Exp $ */
2
3 /*
4 * Copyright (c) 1980, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
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.
18 *
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.
30 */
31
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.15 2006/10/31 20:07:32 christos Exp $");
38 #endif
39 #endif /* not lint */
40
41 #include "def.h"
42 #include "extern.h"
43
44 #ifdef USE_EDITLINE
45 # define CMP(x) #x,
46 # define CMP0 0,
47 #else
48 # define CMP(x)
49 # define CMP0
50 #endif
51
52
53 /*
54 * Mail -- a mail program
55 *
56 * Define all of the command names and bindings.
57 */
58
59 const struct cmd cmdtab[] = {
60 { "next", next, CMP(n) NDMLIST, 0, MMNDEL },
61 { "alias", group, CMP(A) M|RAWLIST, 0, 1000 },
62 #ifdef MIME_SUPPORT
63 { "print", print, CMP(n) MSGLIST, 0, MMNDEL },
64 { "Print", Print, CMP(n) MSGLIST, 0, MMNDEL },
65 #else
66 { "print", type, CMP(n) MSGLIST, 0, MMNDEL },
67 { "Print", Type, CMP(n) MSGLIST, 0, MMNDEL },
68 #endif
69 { "type", type, CMP(n) MSGLIST, 0, MMNDEL },
70 { "Type", Type, CMP(n) MSGLIST, 0, MMNDEL },
71 { "visual", visual, CMP(n) I|MSGLIST, 0, MMNORM },
72 { "top", top, CMP(n) MSGLIST, 0, MMNDEL },
73 { "touch", stouch, CMP(n) W|MSGLIST, 0, MMNDEL },
74 { "preserve", preserve, CMP(n) W|MSGLIST, 0, MMNDEL },
75 { "delete", delete, CMP(n) W|P|MSGLIST, 0, MMNDEL },
76 { "dp", deltype, CMP(n) W|MSGLIST, 0, MMNDEL },
77 { "dt", deltype, CMP(n) W|MSGLIST, 0, MMNDEL },
78 { "undelete", undeletecmd, CMP(n) P|MSGLIST, MDELETED, MMNDEL },
79 { "unset", unset, CMP(S) M|RAWLIST, 1, 1000 },
80 { "mail", sendmail, CMP(A) R|M|I|STRLIST, 0, 0 },
81 { "mbox", mboxit, CMP(n) W|MSGLIST, 0, 0 },
82 { "more", more, CMP(n) MSGLIST, 0, MMNDEL },
83 { "More", More, CMP(n) MSGLIST, 0, MMNDEL },
84 #ifdef MIME_SUPPORT
85 { "page", page, CMP(n) MSGLIST, 0, MMNDEL },
86 { "Page", Page, CMP(n) MSGLIST, 0, MMNDEL },
87 { "view", view, CMP(n) MSGLIST, 0, MMNDEL },
88 { "View", View, CMP(n) MSGLIST, 0, MMNDEL },
89 #endif
90 { "page", more, CMP(n) MSGLIST, 0, MMNDEL },
91 { "Page", More, CMP(n) MSGLIST, 0, MMNDEL },
92 { "unalias", unalias, CMP(A) M|RAWLIST, 1, 1000 },
93 { "unread", unread, CMP(n) MSGLIST, 0, MMNDEL },
94 { "!", shell, CMP(xF) I|STRLIST, 0, 0 },
95 { "|", pipecmd, CMP(xF) I|STRLIST, 0, 0 },
96 { "copy", copycmd, CMP(F) M|STRLIST, 0, 0 },
97 { "chdir", schdir, CMP(F) M|RAWLIST, 0, 1 },
98 { "cd", schdir, CMP(F) M|RAWLIST, 0, 1 },
99 { "save", save, CMP(F) STRLIST, 0, 0 },
100 { "Save", Save, CMP(F) STRLIST, 0, 0 },
101 { "source", source, CMP(F) M|RAWLIST, 1, 1 },
102 { "set", set, CMP(sF) M|RAWLIST, 0, 1000 },
103 { "shell", dosh, CMP(n) I|NOLIST, 0, 0 },
104 { "show", show, CMP(S) M|RAWLIST, 0, 1000 },
105 { "version", pversion, CMP(n) M|NOLIST, 0, 0 },
106 { "group", group, CMP(a) M|RAWLIST, 0, 1000 },
107 { "write", swrite, CMP(F) STRLIST, 0, 0 },
108 { "from", from, CMP(n) MSGLIST, 0, MMNORM },
109 { "file", file, CMP(F) T|M|RAWLIST, 0, 1 },
110 { "folder", file, CMP(F) T|M|RAWLIST, 0, 1 },
111 { "folders", folders, CMP(F) T|M|NOLIST, 0, 0 },
112 { "?", help, CMP(n) M|NOLIST, 0, 0 },
113 { "z", scroll, CMP(n) M|STRLIST, 0, 0 },
114 { "headers", headers, CMP(n) MSGLIST, 0, MMNDEL },
115 { "help", help, CMP(n) M|NOLIST, 0, 0 },
116 { "=", pdot, CMP(n) NOLIST, 0, 0 },
117 { "Reply", Respond, CMP(n) R|I|MSGLIST, 0, MMNDEL },
118 { "Respond", Respond, CMP(n) R|I|MSGLIST, 0, MMNDEL },
119 { "reply", respond, CMP(n) R|I|MSGLIST, 0, MMNDEL },
120 { "respond", respond, CMP(n) R|I|MSGLIST, 0, MMNDEL },
121 { "edit", editor, CMP(n) I|MSGLIST, 0, MMNORM },
122 { "echo", echo, CMP(F) M|RAWLIST, 0, 1000 },
123 { "quit", quitcmd, CMP(n) NOLIST, 0, 0 },
124 { "list", pcmdlist, CMP(n) M|NOLIST, 0, 0 },
125 { "xit", rexit, CMP(n) M|NOLIST, 0, 0 },
126 { "exit", rexit, CMP(n) M|NOLIST, 0, 0 },
127 { "size", messize, CMP(n) MSGLIST, 0, MMNDEL },
128 { "hold", preserve, CMP(n) W|MSGLIST, 0, MMNDEL },
129 { "if", ifcmd, CMP(F) F|M|RAWLIST, 1, 1 },
130 { "else", elsecmd, CMP(F) F|M|RAWLIST, 0, 0 },
131 { "endif", endifcmd, CMP(F) F|M|RAWLIST, 0, 0 },
132 { "alternates", alternates, CMP(n) M|RAWLIST, 0, 1000 },
133 { "ignore", igfield, CMP(n) M|RAWLIST, 0, 1000 },
134 { "discard", igfield, CMP(n) M|RAWLIST, 0, 1000 },
135 { "retain", retfield, CMP(n) M|RAWLIST, 0, 1000 },
136 { "saveignore", saveigfield, CMP(n) M|RAWLIST, 0, 1000 },
137 { "savediscard",saveigfield, CMP(n) M|RAWLIST, 0, 1000 },
138 { "saveretain", saveretfield, CMP(n) M|RAWLIST, 0, 1000 },
139 /* { "Header", Header, CMP(n) STRLIST, 0, 1000 }, */
140 { "core", core, CMP(F) M|NOLIST, 0, 0 },
141 { "#", null, CMP(n) M|NOLIST, 0, 0 },
142 { "clobber", clobber, CMP(n) M|RAWLIST, 0, 1 },
143 { "inc", inc, CMP(n) T|NOLIST, 0, 0 },
144 #ifdef SMOPTS_CMD
145 { "smopts", smoptscmd, CMP(m) M|RAWLIST, 0, 1000 },
146 { "unsmopts", unsmopts, CMP(M) M|RAWLIST, 1, 1000 },
147 #endif
148 { "mkread", markread, CMP(n) MSGLIST, 0, MMNDEL },
149 { 0, 0, CMP0 0, 0, 0 }
150 };
151