xref: /illumos-gate/usr/src/cmd/mailx/cmdtab.c (revision 13539f0d)
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 #include "def.h"
36 
37 /*
38  * mailx -- a modified version of a University of California at Berkeley
39  *	mail program
40  *
41  * Define all of the command names and bindings.
42  */
43 
44 /*
45  * Since the type of the argument to the procedures in the
46  * command table depends on the flags in the table, and since
47  * the argument type must be specified in struct cmd for C++
48  * compatibility, and since I didn't want to change all the
49  * command procedures to expect an argument of type void *,
50  * the following cast "makes it all work".  Yes, it's ugly.
51  */
52 #define	C	(int (*)(void *))(uintptr_t)
53 
54 const struct cmd cmdtab[] = {
55 	"next",		C next,		NDMLIST,	0,	MMNDEL,
56 	"alias",	C group,	M|RAWLIST,	0,	1000,
57 	"print",	C type,		MSGLIST,	0,	MMNDEL,
58 	"type",		C type,		MSGLIST,	0,	MMNDEL,
59 	"Type",		C Type,		MSGLIST,	0,	MMNDEL,
60 	"Print",	C Type,		MSGLIST,	0,	MMNDEL,
61 	"visual",	C visual,	I|MSGLIST,	0,	MMNORM,
62 	"top",		C top,		MSGLIST,	0,	MMNDEL,
63 	"touch",	C stouch,	W|MSGLIST,	0,	MMNDEL,
64 	"preserve",	C preserve,	I|W|MSGLIST,	0,	MMNDEL,
65 	"delete",	C delm,		W|P|MSGLIST,	0,	MMNDEL,
66 	"dp",		C deltype,	W|MSGLIST,	0,	MMNDEL,
67 	"dt",		C deltype,	W|MSGLIST,	0,	MMNDEL,
68 	"undelete",	C undelete,	P|MSGLIST,	MDELETED, MMNDEL,
69 	"unset",	C unset,	M|RAWLIST,	1,	1000,
70 	"mail",		C sendm,	R|M|I|STRLIST,	0,	0,
71 	"Mail",		C Sendm,	R|M|I|STRLIST,	0,	0,
72 	"mbox",		C mboxit,	W|MSGLIST,	0,	0,
73 	"more",		C more,		MSGLIST,	0,	MMNDEL,
74 	"page",		C more,		MSGLIST,	0,	MMNDEL,
75 	"More",		C More,		MSGLIST,	0,	MMNDEL,
76 	"Page",		C More,		MSGLIST,	0,	MMNDEL,
77 	"unread",	C unread,	MSGLIST,	0,	MMNDEL,
78 	"Unread",	C unread,	MSGLIST,	0,	MMNDEL,
79 	"new",		C unread,	MSGLIST,	0,	MMNDEL,
80 	"New",		C unread,	MSGLIST,	0,	MMNDEL,
81 	"!",		C shell,	I|STRLIST,	0,	0,
82 	"copy",		C copycmd,	M|STRLIST,	0,	0,
83 	"Copy",		C Copy,		M|MSGLIST,	0,	0,
84 	"chdir",	C schdir,	M|STRLIST,	0,	0,
85 	"cd",		C schdir,	M|STRLIST,	0,	0,
86 	"save",		C save,		STRLIST,	0,	0,
87 	"Save",		C Save,		MSGLIST,	0,	0,
88 	"source",	C source,	M|STRLIST,	0,	0,
89 	"set",		C set,		M|RAWLIST,	0,	1000,
90 	"shell",	C dosh,		I|NOLIST,	0,	0,
91 	"version",	C pversion,	M|NOLIST,	0,	0,
92 	"group",	C group,	M|RAWLIST,	0,	1000,
93 	"unalias",	C ungroup,	M|RAWLIST,	0,	1000,
94 	"ungroup",	C ungroup,	M|RAWLIST,	0,	1000,
95 	"write",	C swrite,	STRLIST,	0,	0,
96 	"from",		C from,		MSGLIST,	0,	MMNORM,
97 	"followup",	C followup,	R|I|MSGLIST,	0,	MMNDEL,
98 	"Followup",	C Followup,	R|I|MSGLIST,	0,	MMNDEL,
99 	"file",		C file,		T|M|RAWLIST,	0,	1,
100 	"folder",	C file,		T|M|RAWLIST,	0,	1,
101 	"folders",	C folders,	T|M|RAWLIST,	0,	1,
102 	"?",		C help,		M|NOLIST,	0,	0,
103 	"z",		C scroll,	M|STRLIST,	0,	0,
104 	"headers",	C headers,	MSGLIST,	0,	MMNDEL,
105 	"help",		C help,		M|NOLIST,	0,	0,
106 	"=",		C pdot,		NOLIST,		0,	0,
107 	"Reply",	C Respond,	R|I|MSGLIST,	0,	MMNDEL,
108 	"Respond",	C Respond,	R|I|MSGLIST,	0,	MMNDEL,
109 	"reply",	C respond,	R|I|MSGLIST,	0,	MMNDEL,
110 	"respond",	C respond,	R|I|MSGLIST,	0,	MMNDEL,
111 	"replyall",	C replyall,	R|I|MSGLIST,	0,	MMNDEL,
112 	"replysender",	C replysender,	R|I|MSGLIST,	0,	MMNDEL,
113 	"edit",		C editor,	I|MSGLIST,	0,	MMNORM,
114 	"echo",		C echo,		M|RAWLIST,	0,	1000,
115 	"quit",		C edstop,	NOLIST,		0,	0,
116 	"list",		C pcmdlist,	M|NOLIST,	0,	0,
117 	"load",		C loadmsg,	W|STRLIST,	0,	0,
118 	"xit",		C rexit,	M|NOLIST,	0,	0,
119 	"exit",		C rexit,	M|NOLIST,	0,	0,
120 	"size",		C messize,	MSGLIST,	0,	MMNDEL,
121 	"hold",		C preserve,	I|W|MSGLIST,	0,	MMNDEL,
122 	"if",		C ifcmd,	F|M|RAWLIST,	1,	1,
123 	"else",		C elsecmd,	F|M|RAWLIST,	0,	0,
124 	"endif",	C endifcmd,	F|M|RAWLIST,	0,	0,
125 	"alternates",	C alternates,	M|RAWLIST,	0,	1000,
126 	"ignore",	C igfield,	M|RAWLIST,	0,	1000,
127 	"discard",	C igfield,	M|RAWLIST,	0,	1000,
128 	"unignore",	C unigfield,	M|RAWLIST,	0,	1000,
129 	"undiscard",	C unigfield,	M|RAWLIST,	0,	1000,
130 	"retain",	C retfield,	M|RAWLIST,	0,	1000,
131 	"unretain",	C unretfield,	M|RAWLIST,	0,	1000,
132 /*	"Header",	C Header,	STRLIST,	0,	1000,	*/
133 	"#",		C null,		M|NOLIST,	0,	0,
134 	"pipe",		C dopipe,	STRLIST,	0,	0,
135 	"|",		C dopipe,	STRLIST,	0,	0,
136 	"inc",		C inc,		T|NOLIST,	0,	0,
137 	"field",	C field,	STRLIST,	0,	0,
138 	"put",		C sput,		STRLIST,	0,	0,
139 	"Put",		C Sput,		STRLIST,	0,	0,
140 	0,		C 0,		0,		0,	0
141 };
142