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