2006-10-31 23:07:32 +03:00
|
|
|
/* $NetBSD: cmdtab.c,v 1.15 2006/10/31 20:07:32 christos Exp $ */
|
1996-06-08 23:48:09 +04:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
1994-06-29 09:09:04 +04:00
|
|
|
* Copyright (c) 1980, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-03-21 12:45:37 +03:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-08-07 15:13:06 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1993-03-21 12:45:37 +03:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
1997-10-19 09:02:57 +04:00
|
|
|
#include <sys/cdefs.h>
|
1993-03-21 12:45:37 +03:00
|
|
|
#ifndef lint
|
1996-06-08 23:48:09 +04:00
|
|
|
#if 0
|
1996-12-28 10:10:57 +03:00
|
|
|
static char sccsid[] = "@(#)cmdtab.c 8.2 (Berkeley) 4/20/95";
|
1996-06-08 23:48:09 +04:00
|
|
|
#else
|
2006-10-31 23:07:32 +03:00
|
|
|
__RCSID("$NetBSD: cmdtab.c,v 1.15 2006/10/31 20:07:32 christos Exp $");
|
1996-06-08 23:48:09 +04:00
|
|
|
#endif
|
1993-03-21 12:45:37 +03:00
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
#include "def.h"
|
1994-06-29 09:09:04 +04:00
|
|
|
#include "extern.h"
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
#ifdef USE_EDITLINE
|
Jumbo mail patch from our anonymous user:
1) Use editline [optional]:
Most of this code was borrowed from src/usr.bin/ftp. It does the
appropriate editing, history, and completion for all mail commands
(from cmdtab[]) and also does editing on header strings ('~h' inside
the mail editor).
2) '-B' flag:
This will suppress the "To:" line passed to sendmail. In most
configurations it will lead to sendmail adding "To: undisclosed
recipients;". Currently, AFAIK mail requires at least one exposed
recipient address.
3) Comments in rcfile:
Currently, comments in .mailrc are only supported if the first
(non-white) character on a line is '#' followed by white space,
i.e., '#' is a 'nop' command. This (trivial) patch allows the more
normal/expected use of '#' as a comment character. It does not
respect quoting, so that might be an objection which I should fix.
4) Sendmail option editing:
This adds the sendmail option string to the strings editable by the
'~h' command within the mail editor. Currently, you can only set
this string from the command-line, which is particularly annoying
when replying to mail.
5) Reply from:
When replying to a message, grab the "To:" address from the message
and, if there is only one such address and it does not match a list of
allowed addresses (set in the "ReplyFrom" variable), pass it to
sendmail as the "From:" address for the reply (with the '-f' option).
I often make aliases for myself so that my primary address is not
given out; if the alias gets out, I know who to blame. Unfortunately,
a reply to such a message would normally use the primary address
without this patch. A warning is displayed when this is going to
happen so that it can be modified with '~h'.
6) CC and BCC lists:
Allow '-c' and '-b' to accept white-space or ',' delimited lists.
Currently, a white-space delimited list of addresses work, but a
list of aliases will not get expanded. For example, currently:
mail -c "foo bar" christos
will fail to send mail to 'foo' and 'bar' if these are mail aliases
(in ~/.mailrc); sendmail aliases (in /etc/aliases) do work.
7) pipe command:
This pipes the current message into a shell command. I use this for
quick decoding of uuencoded mail, but I can imagine it might be
useful for decrypting encrypted mail, too.
8) show command:
This command takes a list of variables and shows their values. It
is probably stupid as the 'set' command without any argument
displays all variable values. Of course, if there are a lot of
variables you have to sift through the list for the one(s) you want.
2006-09-18 23:46:21 +04:00
|
|
|
# define CMP(x) #x,
|
|
|
|
# define CMP0 0,
|
|
|
|
#else
|
|
|
|
# define CMP(x)
|
|
|
|
# define CMP0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* Mail -- a mail program
|
|
|
|
*
|
|
|
|
* Define all of the command names and bindings.
|
|
|
|
*/
|
|
|
|
|
1996-02-20 00:54:32 +03:00
|
|
|
const struct cmd cmdtab[] = {
|
Jumbo mail patch from our anonymous user:
1) Use editline [optional]:
Most of this code was borrowed from src/usr.bin/ftp. It does the
appropriate editing, history, and completion for all mail commands
(from cmdtab[]) and also does editing on header strings ('~h' inside
the mail editor).
2) '-B' flag:
This will suppress the "To:" line passed to sendmail. In most
configurations it will lead to sendmail adding "To: undisclosed
recipients;". Currently, AFAIK mail requires at least one exposed
recipient address.
3) Comments in rcfile:
Currently, comments in .mailrc are only supported if the first
(non-white) character on a line is '#' followed by white space,
i.e., '#' is a 'nop' command. This (trivial) patch allows the more
normal/expected use of '#' as a comment character. It does not
respect quoting, so that might be an objection which I should fix.
4) Sendmail option editing:
This adds the sendmail option string to the strings editable by the
'~h' command within the mail editor. Currently, you can only set
this string from the command-line, which is particularly annoying
when replying to mail.
5) Reply from:
When replying to a message, grab the "To:" address from the message
and, if there is only one such address and it does not match a list of
allowed addresses (set in the "ReplyFrom" variable), pass it to
sendmail as the "From:" address for the reply (with the '-f' option).
I often make aliases for myself so that my primary address is not
given out; if the alias gets out, I know who to blame. Unfortunately,
a reply to such a message would normally use the primary address
without this patch. A warning is displayed when this is going to
happen so that it can be modified with '~h'.
6) CC and BCC lists:
Allow '-c' and '-b' to accept white-space or ',' delimited lists.
Currently, a white-space delimited list of addresses work, but a
list of aliases will not get expanded. For example, currently:
mail -c "foo bar" christos
will fail to send mail to 'foo' and 'bar' if these are mail aliases
(in ~/.mailrc); sendmail aliases (in /etc/aliases) do work.
7) pipe command:
This pipes the current message into a shell command. I use this for
quick decoding of uuencoded mail, but I can imagine it might be
useful for decrypting encrypted mail, too.
8) show command:
This command takes a list of variables and shows their values. It
is probably stupid as the 'set' command without any argument
displays all variable values. Of course, if there are a lot of
variables you have to sift through the list for the one(s) you want.
2006-09-18 23:46:21 +04:00
|
|
|
{ "next", next, CMP(n) NDMLIST, 0, MMNDEL },
|
2006-10-31 23:07:32 +03:00
|
|
|
{ "alias", group, CMP(A) M|RAWLIST, 0, 1000 },
|
2006-10-22 01:37:20 +04:00
|
|
|
#ifdef MIME_SUPPORT
|
|
|
|
{ "print", print, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
{ "Print", Print, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
#else
|
Jumbo mail patch from our anonymous user:
1) Use editline [optional]:
Most of this code was borrowed from src/usr.bin/ftp. It does the
appropriate editing, history, and completion for all mail commands
(from cmdtab[]) and also does editing on header strings ('~h' inside
the mail editor).
2) '-B' flag:
This will suppress the "To:" line passed to sendmail. In most
configurations it will lead to sendmail adding "To: undisclosed
recipients;". Currently, AFAIK mail requires at least one exposed
recipient address.
3) Comments in rcfile:
Currently, comments in .mailrc are only supported if the first
(non-white) character on a line is '#' followed by white space,
i.e., '#' is a 'nop' command. This (trivial) patch allows the more
normal/expected use of '#' as a comment character. It does not
respect quoting, so that might be an objection which I should fix.
4) Sendmail option editing:
This adds the sendmail option string to the strings editable by the
'~h' command within the mail editor. Currently, you can only set
this string from the command-line, which is particularly annoying
when replying to mail.
5) Reply from:
When replying to a message, grab the "To:" address from the message
and, if there is only one such address and it does not match a list of
allowed addresses (set in the "ReplyFrom" variable), pass it to
sendmail as the "From:" address for the reply (with the '-f' option).
I often make aliases for myself so that my primary address is not
given out; if the alias gets out, I know who to blame. Unfortunately,
a reply to such a message would normally use the primary address
without this patch. A warning is displayed when this is going to
happen so that it can be modified with '~h'.
6) CC and BCC lists:
Allow '-c' and '-b' to accept white-space or ',' delimited lists.
Currently, a white-space delimited list of addresses work, but a
list of aliases will not get expanded. For example, currently:
mail -c "foo bar" christos
will fail to send mail to 'foo' and 'bar' if these are mail aliases
(in ~/.mailrc); sendmail aliases (in /etc/aliases) do work.
7) pipe command:
This pipes the current message into a shell command. I use this for
quick decoding of uuencoded mail, but I can imagine it might be
useful for decrypting encrypted mail, too.
8) show command:
This command takes a list of variables and shows their values. It
is probably stupid as the 'set' command without any argument
displays all variable values. Of course, if there are a lot of
variables you have to sift through the list for the one(s) you want.
2006-09-18 23:46:21 +04:00
|
|
|
{ "print", type, CMP(n) MSGLIST, 0, MMNDEL },
|
2006-10-22 01:37:20 +04:00
|
|
|
{ "Print", Type, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
#endif
|
Jumbo mail patch from our anonymous user:
1) Use editline [optional]:
Most of this code was borrowed from src/usr.bin/ftp. It does the
appropriate editing, history, and completion for all mail commands
(from cmdtab[]) and also does editing on header strings ('~h' inside
the mail editor).
2) '-B' flag:
This will suppress the "To:" line passed to sendmail. In most
configurations it will lead to sendmail adding "To: undisclosed
recipients;". Currently, AFAIK mail requires at least one exposed
recipient address.
3) Comments in rcfile:
Currently, comments in .mailrc are only supported if the first
(non-white) character on a line is '#' followed by white space,
i.e., '#' is a 'nop' command. This (trivial) patch allows the more
normal/expected use of '#' as a comment character. It does not
respect quoting, so that might be an objection which I should fix.
4) Sendmail option editing:
This adds the sendmail option string to the strings editable by the
'~h' command within the mail editor. Currently, you can only set
this string from the command-line, which is particularly annoying
when replying to mail.
5) Reply from:
When replying to a message, grab the "To:" address from the message
and, if there is only one such address and it does not match a list of
allowed addresses (set in the "ReplyFrom" variable), pass it to
sendmail as the "From:" address for the reply (with the '-f' option).
I often make aliases for myself so that my primary address is not
given out; if the alias gets out, I know who to blame. Unfortunately,
a reply to such a message would normally use the primary address
without this patch. A warning is displayed when this is going to
happen so that it can be modified with '~h'.
6) CC and BCC lists:
Allow '-c' and '-b' to accept white-space or ',' delimited lists.
Currently, a white-space delimited list of addresses work, but a
list of aliases will not get expanded. For example, currently:
mail -c "foo bar" christos
will fail to send mail to 'foo' and 'bar' if these are mail aliases
(in ~/.mailrc); sendmail aliases (in /etc/aliases) do work.
7) pipe command:
This pipes the current message into a shell command. I use this for
quick decoding of uuencoded mail, but I can imagine it might be
useful for decrypting encrypted mail, too.
8) show command:
This command takes a list of variables and shows their values. It
is probably stupid as the 'set' command without any argument
displays all variable values. Of course, if there are a lot of
variables you have to sift through the list for the one(s) you want.
2006-09-18 23:46:21 +04:00
|
|
|
{ "type", type, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
{ "Type", Type, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
{ "visual", visual, CMP(n) I|MSGLIST, 0, MMNORM },
|
|
|
|
{ "top", top, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
{ "touch", stouch, CMP(n) W|MSGLIST, 0, MMNDEL },
|
|
|
|
{ "preserve", preserve, CMP(n) W|MSGLIST, 0, MMNDEL },
|
|
|
|
{ "delete", delete, CMP(n) W|P|MSGLIST, 0, MMNDEL },
|
|
|
|
{ "dp", deltype, CMP(n) W|MSGLIST, 0, MMNDEL },
|
|
|
|
{ "dt", deltype, CMP(n) W|MSGLIST, 0, MMNDEL },
|
|
|
|
{ "undelete", undeletecmd, CMP(n) P|MSGLIST, MDELETED, MMNDEL },
|
|
|
|
{ "unset", unset, CMP(S) M|RAWLIST, 1, 1000 },
|
|
|
|
{ "mail", sendmail, CMP(A) R|M|I|STRLIST, 0, 0 },
|
|
|
|
{ "mbox", mboxit, CMP(n) W|MSGLIST, 0, 0 },
|
|
|
|
{ "more", more, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
{ "More", More, CMP(n) MSGLIST, 0, MMNDEL },
|
2006-10-22 01:37:20 +04:00
|
|
|
#ifdef MIME_SUPPORT
|
|
|
|
{ "page", page, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
{ "Page", Page, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
{ "view", view, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
{ "View", View, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
#endif
|
|
|
|
{ "page", more, CMP(n) MSGLIST, 0, MMNDEL },
|
Jumbo mail patch from our anonymous user:
1) Use editline [optional]:
Most of this code was borrowed from src/usr.bin/ftp. It does the
appropriate editing, history, and completion for all mail commands
(from cmdtab[]) and also does editing on header strings ('~h' inside
the mail editor).
2) '-B' flag:
This will suppress the "To:" line passed to sendmail. In most
configurations it will lead to sendmail adding "To: undisclosed
recipients;". Currently, AFAIK mail requires at least one exposed
recipient address.
3) Comments in rcfile:
Currently, comments in .mailrc are only supported if the first
(non-white) character on a line is '#' followed by white space,
i.e., '#' is a 'nop' command. This (trivial) patch allows the more
normal/expected use of '#' as a comment character. It does not
respect quoting, so that might be an objection which I should fix.
4) Sendmail option editing:
This adds the sendmail option string to the strings editable by the
'~h' command within the mail editor. Currently, you can only set
this string from the command-line, which is particularly annoying
when replying to mail.
5) Reply from:
When replying to a message, grab the "To:" address from the message
and, if there is only one such address and it does not match a list of
allowed addresses (set in the "ReplyFrom" variable), pass it to
sendmail as the "From:" address for the reply (with the '-f' option).
I often make aliases for myself so that my primary address is not
given out; if the alias gets out, I know who to blame. Unfortunately,
a reply to such a message would normally use the primary address
without this patch. A warning is displayed when this is going to
happen so that it can be modified with '~h'.
6) CC and BCC lists:
Allow '-c' and '-b' to accept white-space or ',' delimited lists.
Currently, a white-space delimited list of addresses work, but a
list of aliases will not get expanded. For example, currently:
mail -c "foo bar" christos
will fail to send mail to 'foo' and 'bar' if these are mail aliases
(in ~/.mailrc); sendmail aliases (in /etc/aliases) do work.
7) pipe command:
This pipes the current message into a shell command. I use this for
quick decoding of uuencoded mail, but I can imagine it might be
useful for decrypting encrypted mail, too.
8) show command:
This command takes a list of variables and shows their values. It
is probably stupid as the 'set' command without any argument
displays all variable values. Of course, if there are a lot of
variables you have to sift through the list for the one(s) you want.
2006-09-18 23:46:21 +04:00
|
|
|
{ "Page", More, CMP(n) MSGLIST, 0, MMNDEL },
|
2006-10-31 23:07:32 +03:00
|
|
|
{ "unalias", unalias, CMP(A) M|RAWLIST, 1, 1000 },
|
Jumbo mail patch from our anonymous user:
1) Use editline [optional]:
Most of this code was borrowed from src/usr.bin/ftp. It does the
appropriate editing, history, and completion for all mail commands
(from cmdtab[]) and also does editing on header strings ('~h' inside
the mail editor).
2) '-B' flag:
This will suppress the "To:" line passed to sendmail. In most
configurations it will lead to sendmail adding "To: undisclosed
recipients;". Currently, AFAIK mail requires at least one exposed
recipient address.
3) Comments in rcfile:
Currently, comments in .mailrc are only supported if the first
(non-white) character on a line is '#' followed by white space,
i.e., '#' is a 'nop' command. This (trivial) patch allows the more
normal/expected use of '#' as a comment character. It does not
respect quoting, so that might be an objection which I should fix.
4) Sendmail option editing:
This adds the sendmail option string to the strings editable by the
'~h' command within the mail editor. Currently, you can only set
this string from the command-line, which is particularly annoying
when replying to mail.
5) Reply from:
When replying to a message, grab the "To:" address from the message
and, if there is only one such address and it does not match a list of
allowed addresses (set in the "ReplyFrom" variable), pass it to
sendmail as the "From:" address for the reply (with the '-f' option).
I often make aliases for myself so that my primary address is not
given out; if the alias gets out, I know who to blame. Unfortunately,
a reply to such a message would normally use the primary address
without this patch. A warning is displayed when this is going to
happen so that it can be modified with '~h'.
6) CC and BCC lists:
Allow '-c' and '-b' to accept white-space or ',' delimited lists.
Currently, a white-space delimited list of addresses work, but a
list of aliases will not get expanded. For example, currently:
mail -c "foo bar" christos
will fail to send mail to 'foo' and 'bar' if these are mail aliases
(in ~/.mailrc); sendmail aliases (in /etc/aliases) do work.
7) pipe command:
This pipes the current message into a shell command. I use this for
quick decoding of uuencoded mail, but I can imagine it might be
useful for decrypting encrypted mail, too.
8) show command:
This command takes a list of variables and shows their values. It
is probably stupid as the 'set' command without any argument
displays all variable values. Of course, if there are a lot of
variables you have to sift through the list for the one(s) you want.
2006-09-18 23:46:21 +04:00
|
|
|
{ "unread", unread, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
{ "!", shell, CMP(xF) I|STRLIST, 0, 0 },
|
|
|
|
{ "|", pipecmd, CMP(xF) I|STRLIST, 0, 0 },
|
|
|
|
{ "copy", copycmd, CMP(F) M|STRLIST, 0, 0 },
|
|
|
|
{ "chdir", schdir, CMP(F) M|RAWLIST, 0, 1 },
|
|
|
|
{ "cd", schdir, CMP(F) M|RAWLIST, 0, 1 },
|
|
|
|
{ "save", save, CMP(F) STRLIST, 0, 0 },
|
2006-10-31 23:07:32 +03:00
|
|
|
{ "Save", Save, CMP(F) STRLIST, 0, 0 },
|
Jumbo mail patch from our anonymous user:
1) Use editline [optional]:
Most of this code was borrowed from src/usr.bin/ftp. It does the
appropriate editing, history, and completion for all mail commands
(from cmdtab[]) and also does editing on header strings ('~h' inside
the mail editor).
2) '-B' flag:
This will suppress the "To:" line passed to sendmail. In most
configurations it will lead to sendmail adding "To: undisclosed
recipients;". Currently, AFAIK mail requires at least one exposed
recipient address.
3) Comments in rcfile:
Currently, comments in .mailrc are only supported if the first
(non-white) character on a line is '#' followed by white space,
i.e., '#' is a 'nop' command. This (trivial) patch allows the more
normal/expected use of '#' as a comment character. It does not
respect quoting, so that might be an objection which I should fix.
4) Sendmail option editing:
This adds the sendmail option string to the strings editable by the
'~h' command within the mail editor. Currently, you can only set
this string from the command-line, which is particularly annoying
when replying to mail.
5) Reply from:
When replying to a message, grab the "To:" address from the message
and, if there is only one such address and it does not match a list of
allowed addresses (set in the "ReplyFrom" variable), pass it to
sendmail as the "From:" address for the reply (with the '-f' option).
I often make aliases for myself so that my primary address is not
given out; if the alias gets out, I know who to blame. Unfortunately,
a reply to such a message would normally use the primary address
without this patch. A warning is displayed when this is going to
happen so that it can be modified with '~h'.
6) CC and BCC lists:
Allow '-c' and '-b' to accept white-space or ',' delimited lists.
Currently, a white-space delimited list of addresses work, but a
list of aliases will not get expanded. For example, currently:
mail -c "foo bar" christos
will fail to send mail to 'foo' and 'bar' if these are mail aliases
(in ~/.mailrc); sendmail aliases (in /etc/aliases) do work.
7) pipe command:
This pipes the current message into a shell command. I use this for
quick decoding of uuencoded mail, but I can imagine it might be
useful for decrypting encrypted mail, too.
8) show command:
This command takes a list of variables and shows their values. It
is probably stupid as the 'set' command without any argument
displays all variable values. Of course, if there are a lot of
variables you have to sift through the list for the one(s) you want.
2006-09-18 23:46:21 +04:00
|
|
|
{ "source", source, CMP(F) M|RAWLIST, 1, 1 },
|
|
|
|
{ "set", set, CMP(sF) M|RAWLIST, 0, 1000 },
|
|
|
|
{ "shell", dosh, CMP(n) I|NOLIST, 0, 0 },
|
2006-09-19 22:01:00 +04:00
|
|
|
{ "show", show, CMP(S) M|RAWLIST, 0, 1000 },
|
Jumbo mail patch from our anonymous user:
1) Use editline [optional]:
Most of this code was borrowed from src/usr.bin/ftp. It does the
appropriate editing, history, and completion for all mail commands
(from cmdtab[]) and also does editing on header strings ('~h' inside
the mail editor).
2) '-B' flag:
This will suppress the "To:" line passed to sendmail. In most
configurations it will lead to sendmail adding "To: undisclosed
recipients;". Currently, AFAIK mail requires at least one exposed
recipient address.
3) Comments in rcfile:
Currently, comments in .mailrc are only supported if the first
(non-white) character on a line is '#' followed by white space,
i.e., '#' is a 'nop' command. This (trivial) patch allows the more
normal/expected use of '#' as a comment character. It does not
respect quoting, so that might be an objection which I should fix.
4) Sendmail option editing:
This adds the sendmail option string to the strings editable by the
'~h' command within the mail editor. Currently, you can only set
this string from the command-line, which is particularly annoying
when replying to mail.
5) Reply from:
When replying to a message, grab the "To:" address from the message
and, if there is only one such address and it does not match a list of
allowed addresses (set in the "ReplyFrom" variable), pass it to
sendmail as the "From:" address for the reply (with the '-f' option).
I often make aliases for myself so that my primary address is not
given out; if the alias gets out, I know who to blame. Unfortunately,
a reply to such a message would normally use the primary address
without this patch. A warning is displayed when this is going to
happen so that it can be modified with '~h'.
6) CC and BCC lists:
Allow '-c' and '-b' to accept white-space or ',' delimited lists.
Currently, a white-space delimited list of addresses work, but a
list of aliases will not get expanded. For example, currently:
mail -c "foo bar" christos
will fail to send mail to 'foo' and 'bar' if these are mail aliases
(in ~/.mailrc); sendmail aliases (in /etc/aliases) do work.
7) pipe command:
This pipes the current message into a shell command. I use this for
quick decoding of uuencoded mail, but I can imagine it might be
useful for decrypting encrypted mail, too.
8) show command:
This command takes a list of variables and shows their values. It
is probably stupid as the 'set' command without any argument
displays all variable values. Of course, if there are a lot of
variables you have to sift through the list for the one(s) you want.
2006-09-18 23:46:21 +04:00
|
|
|
{ "version", pversion, CMP(n) M|NOLIST, 0, 0 },
|
|
|
|
{ "group", group, CMP(a) M|RAWLIST, 0, 1000 },
|
|
|
|
{ "write", swrite, CMP(F) STRLIST, 0, 0 },
|
|
|
|
{ "from", from, CMP(n) MSGLIST, 0, MMNORM },
|
|
|
|
{ "file", file, CMP(F) T|M|RAWLIST, 0, 1 },
|
|
|
|
{ "folder", file, CMP(F) T|M|RAWLIST, 0, 1 },
|
|
|
|
{ "folders", folders, CMP(F) T|M|NOLIST, 0, 0 },
|
|
|
|
{ "?", help, CMP(n) M|NOLIST, 0, 0 },
|
|
|
|
{ "z", scroll, CMP(n) M|STRLIST, 0, 0 },
|
|
|
|
{ "headers", headers, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
{ "help", help, CMP(n) M|NOLIST, 0, 0 },
|
|
|
|
{ "=", pdot, CMP(n) NOLIST, 0, 0 },
|
|
|
|
{ "Reply", Respond, CMP(n) R|I|MSGLIST, 0, MMNDEL },
|
|
|
|
{ "Respond", Respond, CMP(n) R|I|MSGLIST, 0, MMNDEL },
|
|
|
|
{ "reply", respond, CMP(n) R|I|MSGLIST, 0, MMNDEL },
|
|
|
|
{ "respond", respond, CMP(n) R|I|MSGLIST, 0, MMNDEL },
|
|
|
|
{ "edit", editor, CMP(n) I|MSGLIST, 0, MMNORM },
|
|
|
|
{ "echo", echo, CMP(F) M|RAWLIST, 0, 1000 },
|
|
|
|
{ "quit", quitcmd, CMP(n) NOLIST, 0, 0 },
|
|
|
|
{ "list", pcmdlist, CMP(n) M|NOLIST, 0, 0 },
|
|
|
|
{ "xit", rexit, CMP(n) M|NOLIST, 0, 0 },
|
|
|
|
{ "exit", rexit, CMP(n) M|NOLIST, 0, 0 },
|
|
|
|
{ "size", messize, CMP(n) MSGLIST, 0, MMNDEL },
|
|
|
|
{ "hold", preserve, CMP(n) W|MSGLIST, 0, MMNDEL },
|
|
|
|
{ "if", ifcmd, CMP(F) F|M|RAWLIST, 1, 1 },
|
|
|
|
{ "else", elsecmd, CMP(F) F|M|RAWLIST, 0, 0 },
|
|
|
|
{ "endif", endifcmd, CMP(F) F|M|RAWLIST, 0, 0 },
|
|
|
|
{ "alternates", alternates, CMP(n) M|RAWLIST, 0, 1000 },
|
|
|
|
{ "ignore", igfield, CMP(n) M|RAWLIST, 0, 1000 },
|
|
|
|
{ "discard", igfield, CMP(n) M|RAWLIST, 0, 1000 },
|
|
|
|
{ "retain", retfield, CMP(n) M|RAWLIST, 0, 1000 },
|
|
|
|
{ "saveignore", saveigfield, CMP(n) M|RAWLIST, 0, 1000 },
|
|
|
|
{ "savediscard",saveigfield, CMP(n) M|RAWLIST, 0, 1000 },
|
|
|
|
{ "saveretain", saveretfield, CMP(n) M|RAWLIST, 0, 1000 },
|
|
|
|
/* { "Header", Header, CMP(n) STRLIST, 0, 1000 }, */
|
|
|
|
{ "core", core, CMP(F) M|NOLIST, 0, 0 },
|
|
|
|
{ "#", null, CMP(n) M|NOLIST, 0, 0 },
|
|
|
|
{ "clobber", clobber, CMP(n) M|RAWLIST, 0, 1 },
|
|
|
|
{ "inc", inc, CMP(n) T|NOLIST, 0, 0 },
|
2006-10-31 23:07:32 +03:00
|
|
|
#ifdef SMOPTS_CMD
|
|
|
|
{ "smopts", smoptscmd, CMP(m) M|RAWLIST, 0, 1000 },
|
|
|
|
{ "unsmopts", unsmopts, CMP(M) M|RAWLIST, 1, 1000 },
|
|
|
|
#endif
|
|
|
|
{ "mkread", markread, CMP(n) MSGLIST, 0, MMNDEL },
|
Jumbo mail patch from our anonymous user:
1) Use editline [optional]:
Most of this code was borrowed from src/usr.bin/ftp. It does the
appropriate editing, history, and completion for all mail commands
(from cmdtab[]) and also does editing on header strings ('~h' inside
the mail editor).
2) '-B' flag:
This will suppress the "To:" line passed to sendmail. In most
configurations it will lead to sendmail adding "To: undisclosed
recipients;". Currently, AFAIK mail requires at least one exposed
recipient address.
3) Comments in rcfile:
Currently, comments in .mailrc are only supported if the first
(non-white) character on a line is '#' followed by white space,
i.e., '#' is a 'nop' command. This (trivial) patch allows the more
normal/expected use of '#' as a comment character. It does not
respect quoting, so that might be an objection which I should fix.
4) Sendmail option editing:
This adds the sendmail option string to the strings editable by the
'~h' command within the mail editor. Currently, you can only set
this string from the command-line, which is particularly annoying
when replying to mail.
5) Reply from:
When replying to a message, grab the "To:" address from the message
and, if there is only one such address and it does not match a list of
allowed addresses (set in the "ReplyFrom" variable), pass it to
sendmail as the "From:" address for the reply (with the '-f' option).
I often make aliases for myself so that my primary address is not
given out; if the alias gets out, I know who to blame. Unfortunately,
a reply to such a message would normally use the primary address
without this patch. A warning is displayed when this is going to
happen so that it can be modified with '~h'.
6) CC and BCC lists:
Allow '-c' and '-b' to accept white-space or ',' delimited lists.
Currently, a white-space delimited list of addresses work, but a
list of aliases will not get expanded. For example, currently:
mail -c "foo bar" christos
will fail to send mail to 'foo' and 'bar' if these are mail aliases
(in ~/.mailrc); sendmail aliases (in /etc/aliases) do work.
7) pipe command:
This pipes the current message into a shell command. I use this for
quick decoding of uuencoded mail, but I can imagine it might be
useful for decrypting encrypted mail, too.
8) show command:
This command takes a list of variables and shows their values. It
is probably stupid as the 'set' command without any argument
displays all variable values. Of course, if there are a lot of
variables you have to sift through the list for the one(s) you want.
2006-09-18 23:46:21 +04:00
|
|
|
{ 0, 0, CMP0 0, 0, 0 }
|
1993-03-21 12:45:37 +03:00
|
|
|
};
|