xref: /illumos-gate/usr/src/cmd/mailx/cmdtab.c (revision 88f8b78a88cbdc6d8c1af5c3e54bc49d25095c98)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 /*
26  * University Copyright- Copyright (c) 1982, 1986, 1988
27  * The Regents of the University of California
28  * All Rights Reserved
29  *
30  * University Acknowledgment- Portions of this document are derived from
31  * software developed by the University of California, Berkeley, and its
32  * contributors.
33  */
34 
35 #pragma ident	"%Z%%M%	%I%	%E% SMI"
36 
37 #include "def.h"
38 
39 /*
40  * mailx -- a modified version of a University of California at Berkeley
41  *	mail program
42  *
43  * Define all of the command names and bindings.
44  */
45 
46 /*
47  * Since the type of the argument to the procedures in the
48  * command table depends on the flags in the table, and since
49  * the argument type must be specified in struct cmd for C++
50  * compatibility, and since I didn't want to change all the
51  * command procedures to expect an argument of type void *,
52  * the following cast "makes it all work".  Yes, it's ugly.
53  */
54 #define	C	(int (*)(void *))
55 
56 const struct cmd cmdtab[] = {
57 	"next",		C next,		NDMLIST,	0,	MMNDEL,
58 	"alias",	C group,	M|RAWLIST,	0,	1000,
59 	"print",	C type,		MSGLIST,	0,	MMNDEL,
60 	"type",		C type,		MSGLIST,	0,	MMNDEL,
61 	"Type",		C Type,		MSGLIST,	0,	MMNDEL,
62 	"Print",	C Type,		MSGLIST,	0,	MMNDEL,
63 	"visual",	C visual,	I|MSGLIST,	0,	MMNORM,
64 	"top",		C top,		MSGLIST,	0,	MMNDEL,
65 	"touch",	C stouch,	W|MSGLIST,	0,	MMNDEL,
66 	"preserve",	C preserve,	I|W|MSGLIST,	0,	MMNDEL,
67 	"delete",	C delm,		W|P|MSGLIST,	0,	MMNDEL,
68 	"dp",		C deltype,	W|MSGLIST,	0,	MMNDEL,
69 	"dt",		C deltype,	W|MSGLIST,	0,	MMNDEL,
70 	"undelete",	C undelete,	P|MSGLIST,	MDELETED,MMNDEL,
71 	"unset",	C unset,	M|RAWLIST,	1,	1000,
72 	"mail",		C sendm,	R|M|I|STRLIST,	0,	0,
73 	"Mail",		C Sendm,	R|M|I|STRLIST,	0,	0,
74 	"mbox",		C mboxit,	W|MSGLIST,	0,	0,
75 	"more",		C more,		MSGLIST,	0,	MMNDEL,
76 	"page",		C more,		MSGLIST,	0,	MMNDEL,
77 	"More",		C More,		MSGLIST,	0,	MMNDEL,
78 	"Page",		C More,		MSGLIST,	0,	MMNDEL,
79 	"unread",	C unread,	MSGLIST,	0,	MMNDEL,
80 	"Unread",	C unread,	MSGLIST,	0,	MMNDEL,
81 	"new",		C unread,	MSGLIST,	0,	MMNDEL,
82 	"New",		C unread,	MSGLIST,	0,	MMNDEL,
83 	"!",		C shell,	I|STRLIST,	0,	0,
84 	"copy",		C copycmd,	M|STRLIST,	0,	0,
85 	"Copy",		C Copy,		M|MSGLIST,	0,	0,
86 	"chdir",	C schdir,	M|STRLIST,	0,	0,
87 	"cd",		C schdir,	M|STRLIST,	0,	0,
88 	"save",		C save,		STRLIST,	0,	0,
89 	"Save",		C Save,		MSGLIST,	0,	0,
90 	"source",	C source,	M|STRLIST,	0,	0,
91 	"set",		C set,		M|RAWLIST,	0,	1000,
92 	"shell",	C dosh,		I|NOLIST,	0,	0,
93 	"version",	C pversion,	M|NOLIST,	0,	0,
94 	"group",	C group,	M|RAWLIST,	0,	1000,
95 	"unalias",	C ungroup,	M|RAWLIST,	0,	1000,
96 	"ungroup",	C ungroup,	M|RAWLIST,	0,	1000,
97 	"write",	C swrite,	STRLIST,	0,	0,
98 	"from",		C from,		MSGLIST,	0,	MMNORM,
99 	"followup",	C followup,	R|I|MSGLIST,	0,	MMNDEL,
100 	"Followup",	C Followup,	R|I|MSGLIST,	0,	MMNDEL,
101 	"file",		C file,		T|M|RAWLIST,	0,	1,
102 	"folder",	C file,		T|M|RAWLIST,	0,	1,
103 	"folders",	C folders,	T|M|RAWLIST,	0,	1,
104 	"?",		C help,		M|NOLIST,	0,	0,
105 	"z",		C scroll,	M|STRLIST,	0,	0,
106 	"headers",	C headers,	MSGLIST,	0,	MMNDEL,
107 	"help",		C help,		M|NOLIST,	0,	0,
108 	"=",		C pdot,		NOLIST,		0,	0,
109 	"Reply",	C Respond,	R|I|MSGLIST,	0,	MMNDEL,
110 	"Respond",	C Respond,	R|I|MSGLIST,	0,	MMNDEL,
111 	"reply",	C respond,	R|I|MSGLIST,	0,	MMNDEL,
112 	"respond",	C respond,	R|I|MSGLIST,	0,	MMNDEL,
113 	"replyall",	C replyall,	R|I|MSGLIST,	0,	MMNDEL,
114 	"replysender",	C replysender,	R|I|MSGLIST,	0,	MMNDEL,
115 	"edit",		C editor,	I|MSGLIST,	0,	MMNORM,
116 	"echo",		C echo,		M|RAWLIST,	0,	1000,
117 	"quit",		C edstop,	NOLIST, 	0,	0,
118 	"list",		C pcmdlist,	M|NOLIST,	0,	0,
119 	"load",		C loadmsg,	W|STRLIST,	0,	0,
120 	"xit",		C rexit,	M|NOLIST,	0,	0,
121 	"exit",		C rexit,	M|NOLIST,	0,	0,
122 	"size",		C messize,	MSGLIST,	0,	MMNDEL,
123 	"hold",		C preserve,	I|W|MSGLIST,	0,	MMNDEL,
124 	"if",		C ifcmd,	F|M|RAWLIST,	1,	1,
125 	"else",		C elsecmd,	F|M|RAWLIST,	0,	0,
126 	"endif",	C endifcmd,	F|M|RAWLIST,	0,	0,
127 	"alternates",	C alternates,	M|RAWLIST,	0,	1000,
128 	"ignore",	C igfield,	M|RAWLIST,	0,	1000,
129 	"discard",	C igfield,	M|RAWLIST,	0,	1000,
130 	"unignore",	C unigfield,	M|RAWLIST,	0,	1000,
131 	"undiscard",	C unigfield,	M|RAWLIST,	0,	1000,
132 	"retain",	C retfield,	M|RAWLIST,	0,	1000,
133 	"unretain",	C unretfield,	M|RAWLIST,	0,	1000,
134 /*	"Header",	C Header,	STRLIST,	0,	1000,	*/
135 	"#",		C null,		M|NOLIST,	0,	0,
136 	"pipe",		C dopipe,	STRLIST,	0,	0,
137 	"|",		C dopipe,	STRLIST,	0,	0,
138 	"inc",		C inc,		T|NOLIST,	0,	0,
139 	"field",	C field,	STRLIST,	0,	0,
140 	"put",		C sput,		STRLIST,	0,	0,
141 	"Put",		C Sput,		STRLIST,	0,	0,
142 	0,		C 0,		0,		0,	0
143 };
144