1 /* $NetBSD: cmdtab.c,v 1.13 2006/09/19 18:01:00 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.13 2006/09/19 18:01:00 christos Exp $"); 38 #endif 39 #endif /* not lint */ 40 41 #include "def.h" 42 #include "extern.h" 43 44 #ifdef USE_READLINE 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 { "print", type, CMP(n) MSGLIST, 0, MMNDEL }, 63 { "type", type, CMP(n) MSGLIST, 0, MMNDEL }, 64 { "Type", Type, CMP(n) MSGLIST, 0, MMNDEL }, 65 { "Print", Type, CMP(n) MSGLIST, 0, MMNDEL }, 66 { "visual", visual, CMP(n) I|MSGLIST, 0, MMNORM }, 67 { "top", top, CMP(n) MSGLIST, 0, MMNDEL }, 68 { "touch", stouch, CMP(n) W|MSGLIST, 0, MMNDEL }, 69 { "preserve", preserve, CMP(n) W|MSGLIST, 0, MMNDEL }, 70 { "delete", delete, CMP(n) W|P|MSGLIST, 0, MMNDEL }, 71 { "dp", deltype, CMP(n) W|MSGLIST, 0, MMNDEL }, 72 { "dt", deltype, CMP(n) W|MSGLIST, 0, MMNDEL }, 73 { "undelete", undeletecmd, CMP(n) P|MSGLIST, MDELETED, MMNDEL }, 74 { "unset", unset, CMP(S) M|RAWLIST, 1, 1000 }, 75 { "mail", sendmail, CMP(A) R|M|I|STRLIST, 0, 0 }, 76 { "mbox", mboxit, CMP(n) W|MSGLIST, 0, 0 }, 77 { "more", more, CMP(n) MSGLIST, 0, MMNDEL }, 78 { "page", more, CMP(n) MSGLIST, 0, MMNDEL }, 79 { "More", More, CMP(n) MSGLIST, 0, MMNDEL }, 80 { "Page", More, CMP(n) MSGLIST, 0, MMNDEL }, 81 { "unalias", unalias, CMP(a) M|RAWLIST, 1, 1000 }, 82 { "unread", unread, CMP(n) MSGLIST, 0, MMNDEL }, 83 { "!", shell, CMP(xF) I|STRLIST, 0, 0 }, 84 { "|", pipecmd, CMP(xF) I|STRLIST, 0, 0 }, 85 { "copy", copycmd, CMP(F) M|STRLIST, 0, 0 }, 86 { "chdir", schdir, CMP(F) M|RAWLIST, 0, 1 }, 87 { "cd", schdir, CMP(F) M|RAWLIST, 0, 1 }, 88 { "save", save, CMP(F) STRLIST, 0, 0 }, 89 { "source", source, CMP(F) M|RAWLIST, 1, 1 }, 90 { "set", set, CMP(sF) M|RAWLIST, 0, 1000 }, 91 { "shell", dosh, CMP(n) I|NOLIST, 0, 0 }, 92 { "show", show, CMP(S) M|RAWLIST, 0, 1000 }, 93 { "version", pversion, CMP(n) M|NOLIST, 0, 0 }, 94 { "group", group, CMP(a) M|RAWLIST, 0, 1000 }, 95 { "write", swrite, CMP(F) STRLIST, 0, 0 }, 96 { "from", from, CMP(n) MSGLIST, 0, MMNORM }, 97 { "file", file, CMP(F) T|M|RAWLIST, 0, 1 }, 98 { "folder", file, CMP(F) T|M|RAWLIST, 0, 1 }, 99 { "folders", folders, CMP(F) T|M|NOLIST, 0, 0 }, 100 { "?", help, CMP(n) M|NOLIST, 0, 0 }, 101 { "z", scroll, CMP(n) M|STRLIST, 0, 0 }, 102 { "headers", headers, CMP(n) MSGLIST, 0, MMNDEL }, 103 { "help", help, CMP(n) M|NOLIST, 0, 0 }, 104 { "=", pdot, CMP(n) NOLIST, 0, 0 }, 105 { "Reply", Respond, CMP(n) R|I|MSGLIST, 0, MMNDEL }, 106 { "Respond", Respond, CMP(n) R|I|MSGLIST, 0, MMNDEL }, 107 { "reply", respond, CMP(n) R|I|MSGLIST, 0, MMNDEL }, 108 { "respond", respond, CMP(n) R|I|MSGLIST, 0, MMNDEL }, 109 { "edit", editor, CMP(n) I|MSGLIST, 0, MMNORM }, 110 { "echo", echo, CMP(F) M|RAWLIST, 0, 1000 }, 111 { "quit", quitcmd, CMP(n) NOLIST, 0, 0 }, 112 { "list", pcmdlist, CMP(n) M|NOLIST, 0, 0 }, 113 { "xit", rexit, CMP(n) M|NOLIST, 0, 0 }, 114 { "exit", rexit, CMP(n) M|NOLIST, 0, 0 }, 115 { "size", messize, CMP(n) MSGLIST, 0, MMNDEL }, 116 { "hold", preserve, CMP(n) W|MSGLIST, 0, MMNDEL }, 117 { "if", ifcmd, CMP(F) F|M|RAWLIST, 1, 1 }, 118 { "else", elsecmd, CMP(F) F|M|RAWLIST, 0, 0 }, 119 { "endif", endifcmd, CMP(F) F|M|RAWLIST, 0, 0 }, 120 { "alternates", alternates, CMP(n) M|RAWLIST, 0, 1000 }, 121 { "ignore", igfield, CMP(n) M|RAWLIST, 0, 1000 }, 122 { "discard", igfield, CMP(n) M|RAWLIST, 0, 1000 }, 123 { "retain", retfield, CMP(n) M|RAWLIST, 0, 1000 }, 124 { "saveignore", saveigfield, CMP(n) M|RAWLIST, 0, 1000 }, 125 { "savediscard",saveigfield, CMP(n) M|RAWLIST, 0, 1000 }, 126 { "saveretain", saveretfield, CMP(n) M|RAWLIST, 0, 1000 }, 127 /* { "Header", Header, CMP(n) STRLIST, 0, 1000 }, */ 128 { "core", core, CMP(F) M|NOLIST, 0, 0 }, 129 { "#", null, CMP(n) M|NOLIST, 0, 0 }, 130 { "clobber", clobber, CMP(n) M|RAWLIST, 0, 1 }, 131 { "inc", inc, CMP(n) T|NOLIST, 0, 0 }, 132 { 0, 0, CMP0 0, 0, 0 } 133 }; 134