xref: /illumos-gate/usr/src/cmd/mailx/cmdtab.c (revision 13539f0d)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23*13539f0dSToomas Soome /*	  All Rights Reserved	*/
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*
267c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
277c478bd9Sstevel@tonic-gate  * The Regents of the University of California
287c478bd9Sstevel@tonic-gate  * All Rights Reserved
297c478bd9Sstevel@tonic-gate  *
307c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
317c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
327c478bd9Sstevel@tonic-gate  * contributors.
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include "def.h"
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * mailx -- a modified version of a University of California at Berkeley
397c478bd9Sstevel@tonic-gate  *	mail program
407c478bd9Sstevel@tonic-gate  *
417c478bd9Sstevel@tonic-gate  * Define all of the command names and bindings.
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * Since the type of the argument to the procedures in the
467c478bd9Sstevel@tonic-gate  * command table depends on the flags in the table, and since
477c478bd9Sstevel@tonic-gate  * the argument type must be specified in struct cmd for C++
487c478bd9Sstevel@tonic-gate  * compatibility, and since I didn't want to change all the
497c478bd9Sstevel@tonic-gate  * command procedures to expect an argument of type void *,
507c478bd9Sstevel@tonic-gate  * the following cast "makes it all work".  Yes, it's ugly.
517c478bd9Sstevel@tonic-gate  */
52*13539f0dSToomas Soome #define	C	(int (*)(void *))(uintptr_t)
537c478bd9Sstevel@tonic-gate 
546c83d09fSrobbin const struct cmd cmdtab[] = {
557c478bd9Sstevel@tonic-gate 	"next",		C next,		NDMLIST,	0,	MMNDEL,
567c478bd9Sstevel@tonic-gate 	"alias",	C group,	M|RAWLIST,	0,	1000,
577c478bd9Sstevel@tonic-gate 	"print",	C type,		MSGLIST,	0,	MMNDEL,
587c478bd9Sstevel@tonic-gate 	"type",		C type,		MSGLIST,	0,	MMNDEL,
597c478bd9Sstevel@tonic-gate 	"Type",		C Type,		MSGLIST,	0,	MMNDEL,
607c478bd9Sstevel@tonic-gate 	"Print",	C Type,		MSGLIST,	0,	MMNDEL,
617c478bd9Sstevel@tonic-gate 	"visual",	C visual,	I|MSGLIST,	0,	MMNORM,
627c478bd9Sstevel@tonic-gate 	"top",		C top,		MSGLIST,	0,	MMNDEL,
637c478bd9Sstevel@tonic-gate 	"touch",	C stouch,	W|MSGLIST,	0,	MMNDEL,
647c478bd9Sstevel@tonic-gate 	"preserve",	C preserve,	I|W|MSGLIST,	0,	MMNDEL,
657c478bd9Sstevel@tonic-gate 	"delete",	C delm,		W|P|MSGLIST,	0,	MMNDEL,
667c478bd9Sstevel@tonic-gate 	"dp",		C deltype,	W|MSGLIST,	0,	MMNDEL,
677c478bd9Sstevel@tonic-gate 	"dt",		C deltype,	W|MSGLIST,	0,	MMNDEL,
68*13539f0dSToomas Soome 	"undelete",	C undelete,	P|MSGLIST,	MDELETED, MMNDEL,
697c478bd9Sstevel@tonic-gate 	"unset",	C unset,	M|RAWLIST,	1,	1000,
707c478bd9Sstevel@tonic-gate 	"mail",		C sendm,	R|M|I|STRLIST,	0,	0,
717c478bd9Sstevel@tonic-gate 	"Mail",		C Sendm,	R|M|I|STRLIST,	0,	0,
727c478bd9Sstevel@tonic-gate 	"mbox",		C mboxit,	W|MSGLIST,	0,	0,
737c478bd9Sstevel@tonic-gate 	"more",		C more,		MSGLIST,	0,	MMNDEL,
747c478bd9Sstevel@tonic-gate 	"page",		C more,		MSGLIST,	0,	MMNDEL,
757c478bd9Sstevel@tonic-gate 	"More",		C More,		MSGLIST,	0,	MMNDEL,
767c478bd9Sstevel@tonic-gate 	"Page",		C More,		MSGLIST,	0,	MMNDEL,
777c478bd9Sstevel@tonic-gate 	"unread",	C unread,	MSGLIST,	0,	MMNDEL,
787c478bd9Sstevel@tonic-gate 	"Unread",	C unread,	MSGLIST,	0,	MMNDEL,
797c478bd9Sstevel@tonic-gate 	"new",		C unread,	MSGLIST,	0,	MMNDEL,
807c478bd9Sstevel@tonic-gate 	"New",		C unread,	MSGLIST,	0,	MMNDEL,
817c478bd9Sstevel@tonic-gate 	"!",		C shell,	I|STRLIST,	0,	0,
827c478bd9Sstevel@tonic-gate 	"copy",		C copycmd,	M|STRLIST,	0,	0,
837c478bd9Sstevel@tonic-gate 	"Copy",		C Copy,		M|MSGLIST,	0,	0,
847c478bd9Sstevel@tonic-gate 	"chdir",	C schdir,	M|STRLIST,	0,	0,
857c478bd9Sstevel@tonic-gate 	"cd",		C schdir,	M|STRLIST,	0,	0,
867c478bd9Sstevel@tonic-gate 	"save",		C save,		STRLIST,	0,	0,
877c478bd9Sstevel@tonic-gate 	"Save",		C Save,		MSGLIST,	0,	0,
887c478bd9Sstevel@tonic-gate 	"source",	C source,	M|STRLIST,	0,	0,
897c478bd9Sstevel@tonic-gate 	"set",		C set,		M|RAWLIST,	0,	1000,
907c478bd9Sstevel@tonic-gate 	"shell",	C dosh,		I|NOLIST,	0,	0,
917c478bd9Sstevel@tonic-gate 	"version",	C pversion,	M|NOLIST,	0,	0,
927c478bd9Sstevel@tonic-gate 	"group",	C group,	M|RAWLIST,	0,	1000,
937c478bd9Sstevel@tonic-gate 	"unalias",	C ungroup,	M|RAWLIST,	0,	1000,
947c478bd9Sstevel@tonic-gate 	"ungroup",	C ungroup,	M|RAWLIST,	0,	1000,
957c478bd9Sstevel@tonic-gate 	"write",	C swrite,	STRLIST,	0,	0,
967c478bd9Sstevel@tonic-gate 	"from",		C from,		MSGLIST,	0,	MMNORM,
977c478bd9Sstevel@tonic-gate 	"followup",	C followup,	R|I|MSGLIST,	0,	MMNDEL,
987c478bd9Sstevel@tonic-gate 	"Followup",	C Followup,	R|I|MSGLIST,	0,	MMNDEL,
997c478bd9Sstevel@tonic-gate 	"file",		C file,		T|M|RAWLIST,	0,	1,
1007c478bd9Sstevel@tonic-gate 	"folder",	C file,		T|M|RAWLIST,	0,	1,
1017c478bd9Sstevel@tonic-gate 	"folders",	C folders,	T|M|RAWLIST,	0,	1,
1027c478bd9Sstevel@tonic-gate 	"?",		C help,		M|NOLIST,	0,	0,
1037c478bd9Sstevel@tonic-gate 	"z",		C scroll,	M|STRLIST,	0,	0,
1047c478bd9Sstevel@tonic-gate 	"headers",	C headers,	MSGLIST,	0,	MMNDEL,
1057c478bd9Sstevel@tonic-gate 	"help",		C help,		M|NOLIST,	0,	0,
1067c478bd9Sstevel@tonic-gate 	"=",		C pdot,		NOLIST,		0,	0,
1077c478bd9Sstevel@tonic-gate 	"Reply",	C Respond,	R|I|MSGLIST,	0,	MMNDEL,
1087c478bd9Sstevel@tonic-gate 	"Respond",	C Respond,	R|I|MSGLIST,	0,	MMNDEL,
1097c478bd9Sstevel@tonic-gate 	"reply",	C respond,	R|I|MSGLIST,	0,	MMNDEL,
1107c478bd9Sstevel@tonic-gate 	"respond",	C respond,	R|I|MSGLIST,	0,	MMNDEL,
1117c478bd9Sstevel@tonic-gate 	"replyall",	C replyall,	R|I|MSGLIST,	0,	MMNDEL,
1127c478bd9Sstevel@tonic-gate 	"replysender",	C replysender,	R|I|MSGLIST,	0,	MMNDEL,
1137c478bd9Sstevel@tonic-gate 	"edit",		C editor,	I|MSGLIST,	0,	MMNORM,
1147c478bd9Sstevel@tonic-gate 	"echo",		C echo,		M|RAWLIST,	0,	1000,
115*13539f0dSToomas Soome 	"quit",		C edstop,	NOLIST,		0,	0,
1167c478bd9Sstevel@tonic-gate 	"list",		C pcmdlist,	M|NOLIST,	0,	0,
1177c478bd9Sstevel@tonic-gate 	"load",		C loadmsg,	W|STRLIST,	0,	0,
1187c478bd9Sstevel@tonic-gate 	"xit",		C rexit,	M|NOLIST,	0,	0,
1197c478bd9Sstevel@tonic-gate 	"exit",		C rexit,	M|NOLIST,	0,	0,
1207c478bd9Sstevel@tonic-gate 	"size",		C messize,	MSGLIST,	0,	MMNDEL,
1217c478bd9Sstevel@tonic-gate 	"hold",		C preserve,	I|W|MSGLIST,	0,	MMNDEL,
1227c478bd9Sstevel@tonic-gate 	"if",		C ifcmd,	F|M|RAWLIST,	1,	1,
1237c478bd9Sstevel@tonic-gate 	"else",		C elsecmd,	F|M|RAWLIST,	0,	0,
1247c478bd9Sstevel@tonic-gate 	"endif",	C endifcmd,	F|M|RAWLIST,	0,	0,
1257c478bd9Sstevel@tonic-gate 	"alternates",	C alternates,	M|RAWLIST,	0,	1000,
1267c478bd9Sstevel@tonic-gate 	"ignore",	C igfield,	M|RAWLIST,	0,	1000,
1277c478bd9Sstevel@tonic-gate 	"discard",	C igfield,	M|RAWLIST,	0,	1000,
1287c478bd9Sstevel@tonic-gate 	"unignore",	C unigfield,	M|RAWLIST,	0,	1000,
1297c478bd9Sstevel@tonic-gate 	"undiscard",	C unigfield,	M|RAWLIST,	0,	1000,
1307c478bd9Sstevel@tonic-gate 	"retain",	C retfield,	M|RAWLIST,	0,	1000,
1317c478bd9Sstevel@tonic-gate 	"unretain",	C unretfield,	M|RAWLIST,	0,	1000,
1327c478bd9Sstevel@tonic-gate /*	"Header",	C Header,	STRLIST,	0,	1000,	*/
1337c478bd9Sstevel@tonic-gate 	"#",		C null,		M|NOLIST,	0,	0,
1347c478bd9Sstevel@tonic-gate 	"pipe",		C dopipe,	STRLIST,	0,	0,
1357c478bd9Sstevel@tonic-gate 	"|",		C dopipe,	STRLIST,	0,	0,
1367c478bd9Sstevel@tonic-gate 	"inc",		C inc,		T|NOLIST,	0,	0,
1377c478bd9Sstevel@tonic-gate 	"field",	C field,	STRLIST,	0,	0,
1387c478bd9Sstevel@tonic-gate 	"put",		C sput,		STRLIST,	0,	0,
1397c478bd9Sstevel@tonic-gate 	"Put",		C Sput,		STRLIST,	0,	0,
1407c478bd9Sstevel@tonic-gate 	0,		C 0,		0,		0,	0
1417c478bd9Sstevel@tonic-gate };
142