1*043fbe51Sderaadt /* $OpenBSD: cmdtab.c,v 1.13 2009/10/27 23:59:40 deraadt Exp $ */ 2db59c1a6Smillert /* $NetBSD: cmdtab.c,v 1.7 1996/12/28 07:10:59 tls Exp $ */ 34f4c46caSniklas 4df930be7Sderaadt /* 5df930be7Sderaadt * Copyright (c) 1980, 1993 6df930be7Sderaadt * The Regents of the University of California. All rights reserved. 7df930be7Sderaadt * 8df930be7Sderaadt * Redistribution and use in source and binary forms, with or without 9df930be7Sderaadt * modification, are permitted provided that the following conditions 10df930be7Sderaadt * are met: 11df930be7Sderaadt * 1. Redistributions of source code must retain the above copyright 12df930be7Sderaadt * notice, this list of conditions and the following disclaimer. 13df930be7Sderaadt * 2. Redistributions in binary form must reproduce the above copyright 14df930be7Sderaadt * notice, this list of conditions and the following disclaimer in the 15df930be7Sderaadt * documentation and/or other materials provided with the distribution. 16f75387cbSmillert * 3. Neither the name of the University nor the names of its contributors 17df930be7Sderaadt * may be used to endorse or promote products derived from this software 18df930be7Sderaadt * without specific prior written permission. 19df930be7Sderaadt * 20df930be7Sderaadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21df930be7Sderaadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22df930be7Sderaadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23df930be7Sderaadt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24df930be7Sderaadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25df930be7Sderaadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26df930be7Sderaadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27df930be7Sderaadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28df930be7Sderaadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29df930be7Sderaadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30df930be7Sderaadt * SUCH DAMAGE. 31df930be7Sderaadt */ 32df930be7Sderaadt 33df930be7Sderaadt #include "def.h" 34df930be7Sderaadt #include "extern.h" 35df930be7Sderaadt 36df930be7Sderaadt /* 37df930be7Sderaadt * Mail -- a mail program 38df930be7Sderaadt * 39df930be7Sderaadt * Define all of the command names and bindings. 40df930be7Sderaadt */ 41307ae5a0Smillert typedef int (*cfunc_t)(void *); 424f4c46caSniklas const struct cmd cmdtab[] = { 43ca8b07b0Smillert /* msgmask msgflag */ 44ca8b07b0Smillert /* command function argtype result & mask */ 45ca8b07b0Smillert /* ------- -------- ------- ------- -------- */ 464a9caef2Smillert { "next", { next }, NDMLIST, 0, MMNDEL }, 474a9caef2Smillert { "alias", { group }, M|RAWLIST, 0, 1000 }, 484a9caef2Smillert { "print", { type }, MSGLIST, 0, MMNDEL }, 494a9caef2Smillert { "type", { type }, MSGLIST, 0, MMNDEL }, 504a9caef2Smillert { "Type", { Type }, MSGLIST, 0, MMNDEL }, 514a9caef2Smillert { "Print", { Type }, MSGLIST, 0, MMNDEL }, 524a9caef2Smillert { "visual", { visual }, I|MSGLIST, 0, MMNORM }, 534a9caef2Smillert { "top", { top }, MSGLIST, 0, MMNDEL }, 544a9caef2Smillert { "touch", { stouch }, W|MSGLIST, 0, MMNDEL }, 554a9caef2Smillert { "preserve", { preserve }, W|MSGLIST, 0, MMNDEL }, 56ecebcaffSderaadt { "delete", { deletecmd }, W|P|MSGLIST, 0, MMNDEL }, 574a9caef2Smillert { "dp", { deltype }, W|MSGLIST, 0, MMNDEL }, 584a9caef2Smillert { "dt", { deltype }, W|MSGLIST, 0, MMNDEL }, 594a9caef2Smillert { "undelete", { undeletecmd }, P|MSGLIST, MDELETED,MMNDEL }, 604a9caef2Smillert { "unset", { unset }, M|RAWLIST, 1, 1000 }, 614a9caef2Smillert { "mail", { sendmail }, R|M|I|STRLIST, 0, 0 }, 624a9caef2Smillert { "mbox", { mboxit }, W|MSGLIST, 0, 0 }, 63307ae5a0Smillert { "pipe", { (cfunc_t)pipeit }, MSGLIST|STRLIST,0, MMNDEL }, 64307ae5a0Smillert { "|", { (cfunc_t)pipeit }, MSGLIST|STRLIST,0, MMNDEL }, 654a9caef2Smillert { "more", { more }, MSGLIST, 0, MMNDEL }, 664a9caef2Smillert { "page", { more }, MSGLIST, 0, MMNDEL }, 674a9caef2Smillert { "More", { More }, MSGLIST, 0, MMNDEL }, 684a9caef2Smillert { "Page", { More }, MSGLIST, 0, MMNDEL }, 694a9caef2Smillert { "unread", { unread }, MSGLIST, 0, MMNDEL }, 706512d3c3Smartynas { "Unread", { unread }, MSGLIST, 0, MMNDEL }, 714a9caef2Smillert { "!", { shell }, I|STRLIST, 0, 0 }, 724a9caef2Smillert { "copy", { copycmd }, M|STRLIST, 0, 0 }, 734a9caef2Smillert { "chdir", { schdir }, M|RAWLIST, 0, 1 }, 744a9caef2Smillert { "cd", { schdir }, M|RAWLIST, 0, 1 }, 754a9caef2Smillert { "save", { save }, STRLIST, 0, 0 }, 764a9caef2Smillert { "source", { source }, M|RAWLIST, 1, 1 }, 774a9caef2Smillert { "set", { set }, M|RAWLIST, 0, 1000 }, 784a9caef2Smillert { "shell", { dosh }, I|NOLIST, 0, 0 }, 794a9caef2Smillert { "version", { pversion }, M|NOLIST, 0, 0 }, 804a9caef2Smillert { "group", { group }, M|RAWLIST, 0, 1000 }, 814a9caef2Smillert { "write", { swrite }, STRLIST, 0, 0 }, 824a9caef2Smillert { "from", { from }, MSGLIST, 0, MMNORM }, 834a9caef2Smillert { "file", { file }, T|M|RAWLIST, 0, 1 }, 844a9caef2Smillert { "folder", { file }, T|M|RAWLIST, 0, 1 }, 854a9caef2Smillert { "folders", { folders }, T|M|STRLIST, 0, 0 }, 864a9caef2Smillert { "?", { help }, M|NOLIST, 0, 0 }, 874a9caef2Smillert { "z", { scroll }, M|STRLIST, 0, 0 }, 884a9caef2Smillert { "headers", { headers }, MSGLIST, 0, MMNDEL }, 894a9caef2Smillert { "help", { help }, M|NOLIST, 0, 0 }, 904a9caef2Smillert { "=", { pdot }, NOLIST, 0, 0 }, 914a9caef2Smillert { "Reply", { Respond }, R|I|MSGLIST, 0, MMNDEL }, 924a9caef2Smillert { "Respond", { Respond }, R|I|MSGLIST, 0, MMNDEL }, 934a9caef2Smillert { "reply", { respond }, R|I|MSGLIST, 0, MMNDEL }, 944a9caef2Smillert { "respond", { respond }, R|I|MSGLIST, 0, MMNDEL }, 954a9caef2Smillert { "edit", { editor }, I|MSGLIST, 0, MMNORM }, 964a9caef2Smillert { "echo", { echo }, M|RAWLIST, 0, 1000 }, 974a9caef2Smillert { "quit", { quitcmd }, NOLIST, 0, 0 }, 984a9caef2Smillert { "list", { pcmdlist }, M|NOLIST, 0, 0 }, 994a9caef2Smillert { "xit", { rexit }, M|NOLIST, 0, 0 }, 1004a9caef2Smillert { "exit", { rexit }, M|NOLIST, 0, 0 }, 1014a9caef2Smillert { "size", { messize }, MSGLIST, 0, MMNDEL }, 1024a9caef2Smillert { "hold", { preserve }, W|MSGLIST, 0, MMNDEL }, 1034a9caef2Smillert { "if", { ifcmd }, F|M|RAWLIST, 1, 1 }, 1044a9caef2Smillert { "else", { elsecmd }, F|M|RAWLIST, 0, 0 }, 1054a9caef2Smillert { "endif", { endifcmd }, F|M|RAWLIST, 0, 0 }, 1064a9caef2Smillert { "alternates", { alternates }, M|RAWLIST, 0, 1000 }, 1074a9caef2Smillert { "ignore", { igfield }, M|RAWLIST, 0, 1000 }, 1084a9caef2Smillert { "discard", { igfield }, M|RAWLIST, 0, 1000 }, 1094a9caef2Smillert { "retain", { retfield }, M|RAWLIST, 0, 1000 }, 1104a9caef2Smillert { "saveignore", { saveigfield }, M|RAWLIST, 0, 1000 }, 1114a9caef2Smillert { "savediscard",{ saveigfield }, M|RAWLIST, 0, 1000 }, 1124a9caef2Smillert { "saveretain", { saveretfield }, M|RAWLIST, 0, 1000 }, 1134a9caef2Smillert #if 0 1144a9caef2Smillert { "Header", { Header }, STRLIST, 0, 1000 }, 1154a9caef2Smillert #endif 1164a9caef2Smillert { "#", { null }, M|NOLIST, 0, 0 }, 1174a9caef2Smillert { "inc", { inc }, T|NOLIST, 0, 0 }, 1184a9caef2Smillert { "new", { marknew }, MSGLIST, 0, MMNDEL }, 1194a9caef2Smillert { 0, { 0 }, 0, 0, 0 } 120df930be7Sderaadt }; 121